@agentrun/sdk 0.0.1-test.2d1b17b → 0.0.1-test.70561fe
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 +6263 -4027
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4846 -0
- package/dist/index.d.ts +4846 -0
- package/dist/index.js +6108 -3936
- package/dist/index.js.map +1 -0
- package/package.json +19 -17
- package/dist/src/add.d.ts +0 -2
- package/dist/src/add.d.ts.map +0 -1
- package/dist/src/agent-runtime/api/control.d.ts +0 -190
- package/dist/src/agent-runtime/api/control.d.ts.map +0 -1
- package/dist/src/agent-runtime/api/data.d.ts +0 -38
- package/dist/src/agent-runtime/api/data.d.ts.map +0 -1
- package/dist/src/agent-runtime/api/index.d.ts +0 -5
- package/dist/src/agent-runtime/api/index.d.ts.map +0 -1
- package/dist/src/agent-runtime/client.d.ts +0 -146
- package/dist/src/agent-runtime/client.d.ts.map +0 -1
- package/dist/src/agent-runtime/endpoint.d.ts +0 -132
- package/dist/src/agent-runtime/endpoint.d.ts.map +0 -1
- package/dist/src/agent-runtime/index.d.ts +0 -12
- package/dist/src/agent-runtime/index.d.ts.map +0 -1
- package/dist/src/agent-runtime/model.d.ts +0 -327
- package/dist/src/agent-runtime/model.d.ts.map +0 -1
- package/dist/src/agent-runtime/runtime.d.ts +0 -203
- package/dist/src/agent-runtime/runtime.d.ts.map +0 -1
- package/dist/src/credential/api/control.d.ts +0 -90
- package/dist/src/credential/api/control.d.ts.map +0 -1
- package/dist/src/credential/api/index.d.ts +0 -5
- package/dist/src/credential/api/index.d.ts.map +0 -1
- package/dist/src/credential/client.d.ts +0 -57
- package/dist/src/credential/client.d.ts.map +0 -1
- package/dist/src/credential/credential.d.ts +0 -68
- package/dist/src/credential/credential.d.ts.map +0 -1
- package/dist/src/credential/index.d.ts +0 -9
- package/dist/src/credential/index.d.ts.map +0 -1
- package/dist/src/credential/model.d.ts +0 -116
- package/dist/src/credential/model.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -32
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/integration/adapter.d.ts +0 -128
- package/dist/src/integration/adapter.d.ts.map +0 -1
- package/dist/src/integration/index.d.ts +0 -14
- package/dist/src/integration/index.d.ts.map +0 -1
- package/dist/src/integration/mastra/adapter.d.ts +0 -112
- package/dist/src/integration/mastra/adapter.d.ts.map +0 -1
- package/dist/src/integration/mastra/index.d.ts +0 -15
- package/dist/src/integration/mastra/index.d.ts.map +0 -1
- package/dist/src/integration/mastra/types.d.ts +0 -62
- package/dist/src/integration/mastra/types.d.ts.map +0 -1
- package/dist/src/model/api/control.d.ts +0 -162
- package/dist/src/model/api/control.d.ts.map +0 -1
- package/dist/src/model/client.d.ts +0 -87
- package/dist/src/model/client.d.ts.map +0 -1
- package/dist/src/model/index.d.ts +0 -10
- package/dist/src/model/index.d.ts.map +0 -1
- package/dist/src/model/model-proxy.d.ts +0 -173
- package/dist/src/model/model-proxy.d.ts.map +0 -1
- package/dist/src/model/model-service.d.ts +0 -172
- package/dist/src/model/model-service.d.ts.map +0 -1
- package/dist/src/model/model.d.ts +0 -227
- package/dist/src/model/model.d.ts.map +0 -1
- package/dist/src/sandbox/aio-sandbox.d.ts +0 -235
- package/dist/src/sandbox/aio-sandbox.d.ts.map +0 -1
- package/dist/src/sandbox/api/aio-data.d.ts +0 -50
- package/dist/src/sandbox/api/aio-data.d.ts.map +0 -1
- package/dist/src/sandbox/api/browser-data.d.ts +0 -82
- package/dist/src/sandbox/api/browser-data.d.ts.map +0 -1
- package/dist/src/sandbox/api/code-interpreter-data.d.ts +0 -189
- package/dist/src/sandbox/api/code-interpreter-data.d.ts.map +0 -1
- package/dist/src/sandbox/api/control.d.ts +0 -146
- package/dist/src/sandbox/api/control.d.ts.map +0 -1
- package/dist/src/sandbox/api/sandbox-data.d.ts +0 -168
- package/dist/src/sandbox/api/sandbox-data.d.ts.map +0 -1
- package/dist/src/sandbox/browser-sandbox.d.ts +0 -91
- package/dist/src/sandbox/browser-sandbox.d.ts.map +0 -1
- package/dist/src/sandbox/client.d.ts +0 -122
- package/dist/src/sandbox/client.d.ts.map +0 -1
- package/dist/src/sandbox/code-interpreter-sandbox.d.ts +0 -218
- package/dist/src/sandbox/code-interpreter-sandbox.d.ts.map +0 -1
- package/dist/src/sandbox/index.d.ts +0 -16
- package/dist/src/sandbox/index.d.ts.map +0 -1
- package/dist/src/sandbox/model.d.ts +0 -231
- package/dist/src/sandbox/model.d.ts.map +0 -1
- package/dist/src/sandbox/sandbox.d.ts +0 -90
- package/dist/src/sandbox/sandbox.d.ts.map +0 -1
- package/dist/src/sandbox/template.d.ts +0 -115
- package/dist/src/sandbox/template.d.ts.map +0 -1
- package/dist/src/server/agui-protocol.d.ts +0 -127
- package/dist/src/server/agui-protocol.d.ts.map +0 -1
- package/dist/src/server/index.d.ts +0 -8
- package/dist/src/server/index.d.ts.map +0 -1
- package/dist/src/server/model.d.ts +0 -150
- package/dist/src/server/model.d.ts.map +0 -1
- package/dist/src/server/server.d.ts +0 -66
- package/dist/src/server/server.d.ts.map +0 -1
- package/dist/src/toolset/api/control.d.ts +0 -74
- package/dist/src/toolset/api/control.d.ts.map +0 -1
- package/dist/src/toolset/api/index.d.ts +0 -10
- package/dist/src/toolset/api/index.d.ts.map +0 -1
- package/dist/src/toolset/api/mcp.d.ts +0 -79
- package/dist/src/toolset/api/mcp.d.ts.map +0 -1
- package/dist/src/toolset/client.d.ts +0 -65
- package/dist/src/toolset/client.d.ts.map +0 -1
- package/dist/src/toolset/index.d.ts +0 -15
- package/dist/src/toolset/index.d.ts.map +0 -1
- package/dist/src/toolset/model.d.ts +0 -246
- package/dist/src/toolset/model.d.ts.map +0 -1
- package/dist/src/toolset/openapi.d.ts +0 -174
- package/dist/src/toolset/openapi.d.ts.map +0 -1
- package/dist/src/toolset/toolset.d.ts +0 -154
- package/dist/src/toolset/toolset.d.ts.map +0 -1
- package/dist/src/utils/config.d.ts +0 -124
- package/dist/src/utils/config.d.ts.map +0 -1
- package/dist/src/utils/control-api.d.ts +0 -24
- package/dist/src/utils/control-api.d.ts.map +0 -1
- package/dist/src/utils/data-api.d.ts +0 -163
- package/dist/src/utils/data-api.d.ts.map +0 -1
- package/dist/src/utils/exception.d.ts +0 -67
- package/dist/src/utils/exception.d.ts.map +0 -1
- package/dist/src/utils/helper.d.ts +0 -2
- package/dist/src/utils/helper.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -9
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/log.d.ts +0 -25
- package/dist/src/utils/log.d.ts.map +0 -1
- package/dist/src/utils/model.d.ts +0 -77
- package/dist/src/utils/model.d.ts.map +0 -1
- package/dist/src/utils/resource.d.ts +0 -72
- package/dist/src/utils/resource.d.ts.map +0 -1
- package/dist/tests/e2e/a.test.d.ts +0 -2
- package/dist/tests/e2e/a.test.d.ts.map +0 -1
- package/dist/tests/e2e/agent-runtime/agent-runtime.test.d.ts +0 -14
- package/dist/tests/e2e/agent-runtime/agent-runtime.test.d.ts.map +0 -1
- package/dist/tests/e2e/credential/credential.test.d.ts +0 -2
- package/dist/tests/e2e/credential/credential.test.d.ts.map +0 -1
- package/dist/tests/e2e/model/model.test.d.ts +0 -20
- package/dist/tests/e2e/model/model.test.d.ts.map +0 -1
- package/dist/tests/e2e/model/model_service.test.d.ts +0 -12
- package/dist/tests/e2e/model/model_service.test.d.ts.map +0 -1
- package/dist/tests/e2e/sandbox/aio-sandbox.test.d.ts +0 -18
- package/dist/tests/e2e/sandbox/aio-sandbox.test.d.ts.map +0 -1
- package/dist/tests/e2e/sandbox/browser-sandbox.test.d.ts +0 -15
- package/dist/tests/e2e/sandbox/browser-sandbox.test.d.ts.map +0 -1
- package/dist/tests/e2e/sandbox/code-interpreter-sandbox.test.d.ts +0 -16
- package/dist/tests/e2e/sandbox/code-interpreter-sandbox.test.d.ts.map +0 -1
- package/dist/tests/e2e/sandbox/sandbox.test.d.ts +0 -13
- package/dist/tests/e2e/sandbox/sandbox.test.d.ts.map +0 -1
- package/dist/tests/e2e/sandbox/template.test.d.ts +0 -12
- package/dist/tests/e2e/sandbox/template.test.d.ts.map +0 -1
- package/dist/tests/e2e/toolset/toolset.test.d.ts +0 -2
- package/dist/tests/e2e/toolset/toolset.test.d.ts.map +0 -1
- package/dist/tests/integration/adapter.test.d.ts +0 -8
- package/dist/tests/integration/adapter.test.d.ts.map +0 -1
- package/dist/tests/setup.d.ts +0 -8
- package/dist/tests/setup.d.ts.map +0 -1
- package/dist/tests/unittests/integration/mastra.test.d.ts +0 -8
- package/dist/tests/unittests/integration/mastra.test.d.ts.map +0 -1
- package/dist/tests/unittests/server/agui-protocol.test.d.ts +0 -7
- package/dist/tests/unittests/server/agui-protocol.test.d.ts.map +0 -1
- package/dist/tests/unittests/server/server.test.d.ts +0 -7
- package/dist/tests/unittests/server/server.test.d.ts.map +0 -1
- package/dist/tests/unittests/toolset/openapi.test.d.ts +0 -10
- package/dist/tests/unittests/toolset/openapi.test.d.ts.map +0 -1
- package/dist/tests/unittests/toolset/toolset.test.d.ts +0 -8
- package/dist/tests/unittests/toolset/toolset.test.d.ts.map +0 -1
- package/dist/tests/unittests/utils/config.test.d.ts +0 -7
- package/dist/tests/unittests/utils/config.test.d.ts.map +0 -1
- package/dist/tests/unittests/utils/data-api.test.d.ts +0 -8
- package/dist/tests/unittests/utils/data-api.test.d.ts.map +0 -1
- package/dist/tests/unittests/utils/exception.test.d.ts +0 -5
- package/dist/tests/unittests/utils/exception.test.d.ts.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4846 @@
|
|
|
1
|
+
import * as openai_core_streaming from 'openai/core/streaming';
|
|
2
|
+
import * as openai_resources from 'openai/resources';
|
|
3
|
+
import { ChatCompletionMessageParam } from 'openai/resources';
|
|
4
|
+
import * as $AgentRun from '@alicloud/agentrun20250910';
|
|
5
|
+
import $AgentRun__default from '@alicloud/agentrun20250910';
|
|
6
|
+
import * as $Devs from '@alicloud/devs20230714';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Configuration Management Module
|
|
10
|
+
*
|
|
11
|
+
* 此模块提供 AgentRun SDK 的全局配置管理功能。
|
|
12
|
+
* This module provides global configuration management for AgentRun SDK.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Configuration options for AgentRun SDK
|
|
16
|
+
*/
|
|
17
|
+
interface ConfigOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Access Key ID for authentication.
|
|
20
|
+
* Read from AGENTRUN_ACCESS_KEY_ID or ALIBABA_CLOUD_ACCESS_KEY_ID if not provided.
|
|
21
|
+
*/
|
|
22
|
+
accessKeyId?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Access Key Secret for authentication.
|
|
25
|
+
* Read from AGENTRUN_ACCESS_KEY_SECRET or ALIBABA_CLOUD_ACCESS_KEY_SECRET if not provided.
|
|
26
|
+
*/
|
|
27
|
+
accessKeySecret?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Security token for STS authentication.
|
|
30
|
+
* Read from AGENTRUN_SECURITY_TOKEN or ALIBABA_CLOUD_SECURITY_TOKEN if not provided.
|
|
31
|
+
*/
|
|
32
|
+
securityToken?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Account ID.
|
|
35
|
+
* Read from AGENTRUN_ACCOUNT_ID or FC_ACCOUNT_ID if not provided.
|
|
36
|
+
*/
|
|
37
|
+
accountId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Custom token for data API calls.
|
|
40
|
+
*/
|
|
41
|
+
token?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Region ID. Defaults to cn-hangzhou.
|
|
44
|
+
* Read from AGENTRUN_REGION or FC_REGION if not provided.
|
|
45
|
+
*/
|
|
46
|
+
regionId?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Request timeout in milliseconds. Defaults to 600000 (10 minutes).
|
|
49
|
+
*/
|
|
50
|
+
timeout?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Read timeout in milliseconds. Defaults to 100000000.
|
|
53
|
+
*/
|
|
54
|
+
readTimeout?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Custom control API endpoint.
|
|
57
|
+
* Read from AGENTRUN_CONTROL_ENDPOINT if not provided.
|
|
58
|
+
*/
|
|
59
|
+
controlEndpoint?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Custom data API endpoint.
|
|
62
|
+
* Read from AGENTRUN_DATA_ENDPOINT if not provided.
|
|
63
|
+
*/
|
|
64
|
+
dataEndpoint?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Custom DevS API endpoint.
|
|
67
|
+
* Read from DEVS_ENDPOINT if not provided.
|
|
68
|
+
*/
|
|
69
|
+
devsEndpoint?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Custom request headers.
|
|
72
|
+
*/
|
|
73
|
+
headers?: Record<string, string>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* AgentRun SDK Global Configuration Class
|
|
77
|
+
*
|
|
78
|
+
* 用于管理账号凭证和客户端配置。
|
|
79
|
+
* Used for managing account credentials and client configuration.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Create config from parameters
|
|
84
|
+
* const config = new Config({
|
|
85
|
+
* accountId: 'your-account-id',
|
|
86
|
+
* accessKeyId: 'your-key-id',
|
|
87
|
+
* accessKeySecret: 'your-secret',
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* // Or read from environment variables
|
|
91
|
+
* const config = new Config();
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
declare class Config {
|
|
95
|
+
private _accessKeyId;
|
|
96
|
+
private _accessKeySecret;
|
|
97
|
+
private _securityToken;
|
|
98
|
+
private _accountId;
|
|
99
|
+
private _token?;
|
|
100
|
+
private _regionId;
|
|
101
|
+
private _timeout;
|
|
102
|
+
private _readTimeout;
|
|
103
|
+
private _controlEndpoint;
|
|
104
|
+
private _dataEndpoint;
|
|
105
|
+
private _devsEndpoint;
|
|
106
|
+
private _headers;
|
|
107
|
+
constructor(options?: ConfigOptions);
|
|
108
|
+
/**
|
|
109
|
+
* Create a new Config by merging multiple configs.
|
|
110
|
+
* Later configs take precedence.
|
|
111
|
+
*/
|
|
112
|
+
static withConfigs(...configs: (Config | undefined)[]): Config;
|
|
113
|
+
/**
|
|
114
|
+
* Update this config with values from other configs.
|
|
115
|
+
* Non-undefined values from later configs take precedence.
|
|
116
|
+
*/
|
|
117
|
+
update(...configs: (Config | undefined)[]): Config;
|
|
118
|
+
get accessKeyId(): string;
|
|
119
|
+
get accessKeySecret(): string;
|
|
120
|
+
get securityToken(): string;
|
|
121
|
+
get accountId(): string;
|
|
122
|
+
get token(): string | undefined;
|
|
123
|
+
get regionId(): string;
|
|
124
|
+
get timeout(): number;
|
|
125
|
+
get readTimeout(): number;
|
|
126
|
+
get controlEndpoint(): string;
|
|
127
|
+
get dataEndpoint(): string;
|
|
128
|
+
get devsEndpoint(): string;
|
|
129
|
+
get headers(): Record<string, string>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Exception classes for AgentRun SDK
|
|
134
|
+
*
|
|
135
|
+
* 此模块定义 AgentRun SDK 的异常类。
|
|
136
|
+
* This module defines exception classes for AgentRun SDK.
|
|
137
|
+
*/
|
|
138
|
+
/**
|
|
139
|
+
* Base error class for AgentRun SDK
|
|
140
|
+
*/
|
|
141
|
+
declare class AgentRunError extends Error {
|
|
142
|
+
constructor(message: string);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* HTTP error with status code and request ID
|
|
146
|
+
*/
|
|
147
|
+
declare class HTTPError extends AgentRunError {
|
|
148
|
+
readonly statusCode: number;
|
|
149
|
+
readonly requestId?: string;
|
|
150
|
+
readonly errorCode?: string;
|
|
151
|
+
constructor(statusCode: number, message: string, options?: {
|
|
152
|
+
requestId?: string;
|
|
153
|
+
errorCode?: string;
|
|
154
|
+
});
|
|
155
|
+
/**
|
|
156
|
+
* Convert HTTP error to resource-specific error based on status code
|
|
157
|
+
*/
|
|
158
|
+
toResourceError(resourceType: string, resourceId?: string): HTTPError;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Client-side error (4xx status codes)
|
|
162
|
+
*/
|
|
163
|
+
declare class ClientError extends HTTPError {
|
|
164
|
+
constructor(statusCode: number, message: string, options?: {
|
|
165
|
+
requestId?: string;
|
|
166
|
+
errorCode?: string;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Server-side error (5xx status codes)
|
|
171
|
+
*/
|
|
172
|
+
declare class ServerError extends HTTPError {
|
|
173
|
+
constructor(statusCode: number, message: string, options?: {
|
|
174
|
+
requestId?: string;
|
|
175
|
+
errorCode?: string;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Resource not found error
|
|
180
|
+
*/
|
|
181
|
+
declare class ResourceNotExistError extends ClientError {
|
|
182
|
+
readonly resourceType: string;
|
|
183
|
+
readonly resourceId?: string;
|
|
184
|
+
constructor(resourceType: string, resourceId?: string, options?: {
|
|
185
|
+
requestId?: string;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Resource already exists error
|
|
190
|
+
*/
|
|
191
|
+
declare class ResourceAlreadyExistError extends ClientError {
|
|
192
|
+
readonly resourceType: string;
|
|
193
|
+
readonly resourceId?: string;
|
|
194
|
+
constructor(resourceType: string, resourceId?: string, options?: {
|
|
195
|
+
requestId?: string;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Common data models for AgentRun SDK
|
|
201
|
+
*
|
|
202
|
+
* 此模块定义通用的数据模型。
|
|
203
|
+
* This module defines common data models.
|
|
204
|
+
*/
|
|
205
|
+
/**
|
|
206
|
+
* Resource status enum
|
|
207
|
+
*/
|
|
208
|
+
type Status = 'CREATING' | 'CREATE_FAILED' | 'READY' | 'UPDATING' | 'UPDATE_FAILED' | 'DELETING' | 'DELETE_FAILED';
|
|
209
|
+
declare const Status: {
|
|
210
|
+
CREATING: Status;
|
|
211
|
+
CREATE_FAILED: Status;
|
|
212
|
+
READY: Status;
|
|
213
|
+
UPDATING: Status;
|
|
214
|
+
UPDATE_FAILED: Status;
|
|
215
|
+
DELETING: Status;
|
|
216
|
+
DELETE_FAILED: Status;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* Network mode enum
|
|
220
|
+
*/
|
|
221
|
+
type NetworkMode = 'PUBLIC' | 'PRIVATE' | 'PUBLIC_AND_PRIVATE';
|
|
222
|
+
declare const NetworkMode: {
|
|
223
|
+
PUBLIC: NetworkMode;
|
|
224
|
+
PRIVATE: NetworkMode;
|
|
225
|
+
PUBLIC_AND_PRIVATE: NetworkMode;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Pageable input for list operations
|
|
229
|
+
*/
|
|
230
|
+
interface PageableInput {
|
|
231
|
+
pageNumber?: number;
|
|
232
|
+
pageSize?: number;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Network configuration
|
|
236
|
+
*/
|
|
237
|
+
interface NetworkConfig {
|
|
238
|
+
networkMode?: NetworkMode;
|
|
239
|
+
vpcId?: string;
|
|
240
|
+
vSwitchIds?: string[];
|
|
241
|
+
securityGroupId?: string;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Invoke arguments for OpenAI-compatible API
|
|
246
|
+
*/
|
|
247
|
+
interface InvokeArgs {
|
|
248
|
+
/** Chat messages */
|
|
249
|
+
messages: ChatCompletionMessageParam[];
|
|
250
|
+
/** Whether to stream the response */
|
|
251
|
+
stream?: boolean;
|
|
252
|
+
/** Optional config override */
|
|
253
|
+
config?: Config;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Agent Runtime Data Models
|
|
258
|
+
*
|
|
259
|
+
* 此模块定义 Agent Runtime 相关的所有数据模型、枚举和输入输出对象。
|
|
260
|
+
* This module defines all data models, enums, and input/output objects related to Agent Runtime.
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Agent Runtime artifact type
|
|
265
|
+
*/
|
|
266
|
+
type AgentRuntimeArtifact = "Code" | "Container";
|
|
267
|
+
declare const AgentRuntimeArtifact: {
|
|
268
|
+
CODE: AgentRuntimeArtifact;
|
|
269
|
+
CONTAINER: AgentRuntimeArtifact;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Agent Runtime language
|
|
273
|
+
*/
|
|
274
|
+
type AgentRuntimeLanguage = "python3.10" | "python3.12" | "nodejs18" | "nodejs20" | "java8" | "java11";
|
|
275
|
+
declare const AgentRuntimeLanguage: {
|
|
276
|
+
PYTHON310: AgentRuntimeLanguage;
|
|
277
|
+
PYTHON312: AgentRuntimeLanguage;
|
|
278
|
+
NODEJS18: AgentRuntimeLanguage;
|
|
279
|
+
NODEJS20: AgentRuntimeLanguage;
|
|
280
|
+
JAVA8: AgentRuntimeLanguage;
|
|
281
|
+
JAVA11: AgentRuntimeLanguage;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Agent Runtime protocol type
|
|
285
|
+
*/
|
|
286
|
+
type AgentRuntimeProtocolType = "HTTP" | "MCP";
|
|
287
|
+
declare const AgentRuntimeProtocolType: {
|
|
288
|
+
HTTP: AgentRuntimeProtocolType;
|
|
289
|
+
MCP: AgentRuntimeProtocolType;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* Agent Runtime code configuration
|
|
293
|
+
*/
|
|
294
|
+
interface AgentRuntimeCode {
|
|
295
|
+
/** CRC-64 checksum of the code package */
|
|
296
|
+
checksum?: string;
|
|
297
|
+
/** Command to run in the runtime (e.g., ["python"]) */
|
|
298
|
+
command?: string[];
|
|
299
|
+
/** Programming language runtime */
|
|
300
|
+
language?: AgentRuntimeLanguage;
|
|
301
|
+
/** OSS bucket name */
|
|
302
|
+
ossBucketName?: string;
|
|
303
|
+
/** OSS object name */
|
|
304
|
+
ossObjectName?: string;
|
|
305
|
+
/** Base64 encoded ZIP file */
|
|
306
|
+
zipFile?: string;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Agent Runtime container configuration
|
|
310
|
+
*/
|
|
311
|
+
interface AgentRuntimeContainer {
|
|
312
|
+
/** Command to run in the runtime */
|
|
313
|
+
command?: string[];
|
|
314
|
+
/** Container image address */
|
|
315
|
+
image?: string;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Agent Runtime health check configuration
|
|
319
|
+
*/
|
|
320
|
+
interface AgentRuntimeHealthCheckConfig {
|
|
321
|
+
/** Failure threshold before marking unhealthy */
|
|
322
|
+
failureThreshold?: number;
|
|
323
|
+
/** HTTP GET URL for health check */
|
|
324
|
+
httpGetUrl?: string;
|
|
325
|
+
/** Initial delay before first health check (seconds) */
|
|
326
|
+
initialDelaySeconds?: number;
|
|
327
|
+
/** Health check interval (seconds) */
|
|
328
|
+
periodSeconds?: number;
|
|
329
|
+
/** Success threshold before marking healthy */
|
|
330
|
+
successThreshold?: number;
|
|
331
|
+
/** Health check timeout (seconds) */
|
|
332
|
+
timeoutSeconds?: number;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Agent Runtime log configuration
|
|
336
|
+
*/
|
|
337
|
+
interface AgentRuntimeLogConfig {
|
|
338
|
+
/** SLS project name */
|
|
339
|
+
project: string;
|
|
340
|
+
/** SLS logstore name */
|
|
341
|
+
logstore: string;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Agent Runtime protocol configuration
|
|
345
|
+
*/
|
|
346
|
+
interface AgentRuntimeProtocolConfig {
|
|
347
|
+
/** Protocol type */
|
|
348
|
+
type?: AgentRuntimeProtocolType;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Endpoint routing weight configuration
|
|
352
|
+
*/
|
|
353
|
+
interface AgentRuntimeEndpointRoutingWeight {
|
|
354
|
+
/** Version identifier */
|
|
355
|
+
version?: string;
|
|
356
|
+
/** Weight value */
|
|
357
|
+
weight?: number;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Endpoint routing configuration
|
|
361
|
+
*/
|
|
362
|
+
interface AgentRuntimeEndpointRoutingConfig {
|
|
363
|
+
/** Version weights list */
|
|
364
|
+
versionWeights?: AgentRuntimeEndpointRoutingWeight[];
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Agent Runtime create input
|
|
368
|
+
*/
|
|
369
|
+
interface AgentRuntimeCreateInput {
|
|
370
|
+
/** Agent Runtime name */
|
|
371
|
+
agentRuntimeName?: string;
|
|
372
|
+
/** Artifact type (Code or Container) */
|
|
373
|
+
artifactType?: AgentRuntimeArtifact;
|
|
374
|
+
/** Code configuration */
|
|
375
|
+
codeConfiguration?: AgentRuntimeCode;
|
|
376
|
+
/** Container configuration */
|
|
377
|
+
containerConfiguration?: AgentRuntimeContainer;
|
|
378
|
+
/** CPU cores */
|
|
379
|
+
cpu?: number;
|
|
380
|
+
/** Credential name */
|
|
381
|
+
credentialName?: string;
|
|
382
|
+
/** Description */
|
|
383
|
+
description?: string;
|
|
384
|
+
/** Environment variables */
|
|
385
|
+
environmentVariables?: Record<string, string>;
|
|
386
|
+
/** Execution role ARN */
|
|
387
|
+
executionRoleArn?: string;
|
|
388
|
+
/** Health check configuration */
|
|
389
|
+
healthCheckConfiguration?: AgentRuntimeHealthCheckConfig;
|
|
390
|
+
/** Log configuration */
|
|
391
|
+
logConfiguration?: AgentRuntimeLogConfig;
|
|
392
|
+
/** Memory in MB */
|
|
393
|
+
memory?: number;
|
|
394
|
+
/** Network configuration */
|
|
395
|
+
networkConfiguration?: NetworkConfig;
|
|
396
|
+
/** Port number */
|
|
397
|
+
port?: number;
|
|
398
|
+
/** Protocol configuration */
|
|
399
|
+
protocolConfiguration?: AgentRuntimeProtocolConfig;
|
|
400
|
+
/** Session concurrency limit per instance */
|
|
401
|
+
sessionConcurrencyLimitPerInstance?: number;
|
|
402
|
+
/** Session idle timeout in seconds */
|
|
403
|
+
sessionIdleTimeoutSeconds?: number;
|
|
404
|
+
/** Tags */
|
|
405
|
+
tags?: string[];
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Agent Runtime update input
|
|
409
|
+
*/
|
|
410
|
+
interface AgentRuntimeUpdateInput {
|
|
411
|
+
/** Agent Runtime name */
|
|
412
|
+
agentRuntimeName?: string;
|
|
413
|
+
/** Artifact type (Code or Container) */
|
|
414
|
+
artifactType?: AgentRuntimeArtifact;
|
|
415
|
+
/** Code configuration */
|
|
416
|
+
codeConfiguration?: AgentRuntimeCode;
|
|
417
|
+
/** Container configuration */
|
|
418
|
+
containerConfiguration?: AgentRuntimeContainer;
|
|
419
|
+
/** CPU cores */
|
|
420
|
+
cpu?: number;
|
|
421
|
+
/** Credential name */
|
|
422
|
+
credentialName?: string;
|
|
423
|
+
/** Description */
|
|
424
|
+
description?: string;
|
|
425
|
+
/** Environment variables */
|
|
426
|
+
environmentVariables?: Record<string, string>;
|
|
427
|
+
/** Execution role ARN */
|
|
428
|
+
executionRoleArn?: string;
|
|
429
|
+
/** Health check configuration */
|
|
430
|
+
healthCheckConfiguration?: AgentRuntimeHealthCheckConfig;
|
|
431
|
+
/** Log configuration */
|
|
432
|
+
logConfiguration?: AgentRuntimeLogConfig;
|
|
433
|
+
/** Memory in MB */
|
|
434
|
+
memory?: number;
|
|
435
|
+
/** Network configuration */
|
|
436
|
+
networkConfiguration?: NetworkConfig;
|
|
437
|
+
/** Port number */
|
|
438
|
+
port?: number;
|
|
439
|
+
/** Protocol configuration */
|
|
440
|
+
protocolConfiguration?: AgentRuntimeProtocolConfig;
|
|
441
|
+
/** Session concurrency limit per instance */
|
|
442
|
+
sessionConcurrencyLimitPerInstance?: number;
|
|
443
|
+
/** Session idle timeout in seconds */
|
|
444
|
+
sessionIdleTimeoutSeconds?: number;
|
|
445
|
+
/** Tags */
|
|
446
|
+
tags?: string[];
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Agent Runtime list input
|
|
450
|
+
*/
|
|
451
|
+
interface AgentRuntimeListInput extends PageableInput {
|
|
452
|
+
/** Filter by name */
|
|
453
|
+
agentRuntimeName?: string;
|
|
454
|
+
/** Filter by tags (comma separated) */
|
|
455
|
+
tags?: string;
|
|
456
|
+
/** Search mode */
|
|
457
|
+
searchMode?: string;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Agent Runtime endpoint create input
|
|
461
|
+
*/
|
|
462
|
+
interface AgentRuntimeEndpointCreateInput {
|
|
463
|
+
/** Endpoint name */
|
|
464
|
+
agentRuntimeEndpointName?: string;
|
|
465
|
+
/** Description */
|
|
466
|
+
description?: string;
|
|
467
|
+
/** Routing configuration */
|
|
468
|
+
routingConfiguration?: AgentRuntimeEndpointRoutingConfig;
|
|
469
|
+
/** Tags */
|
|
470
|
+
tags?: string[];
|
|
471
|
+
/** Target version */
|
|
472
|
+
targetVersion?: string;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Agent Runtime endpoint update input
|
|
476
|
+
*/
|
|
477
|
+
interface AgentRuntimeEndpointUpdateInput {
|
|
478
|
+
/** Endpoint name */
|
|
479
|
+
agentRuntimeEndpointName?: string;
|
|
480
|
+
/** Description */
|
|
481
|
+
description?: string;
|
|
482
|
+
/** Routing configuration */
|
|
483
|
+
routingConfiguration?: AgentRuntimeEndpointRoutingConfig;
|
|
484
|
+
/** Tags */
|
|
485
|
+
tags?: string[];
|
|
486
|
+
/** Target version */
|
|
487
|
+
targetVersion?: string;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Agent Runtime endpoint list input
|
|
491
|
+
*/
|
|
492
|
+
interface AgentRuntimeEndpointListInput extends PageableInput {
|
|
493
|
+
/** Filter by endpoint name */
|
|
494
|
+
endpointName?: string;
|
|
495
|
+
/** Search mode */
|
|
496
|
+
searchMode?: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Agent Runtime version
|
|
500
|
+
*/
|
|
501
|
+
interface AgentRuntimeVersion {
|
|
502
|
+
/** Agent Runtime ARN */
|
|
503
|
+
agentRuntimeArn?: string;
|
|
504
|
+
/** Agent Runtime ID */
|
|
505
|
+
agentRuntimeId?: string;
|
|
506
|
+
/** Agent Runtime name */
|
|
507
|
+
agentRuntimeName?: string;
|
|
508
|
+
/** Version number */
|
|
509
|
+
agentRuntimeVersion?: string;
|
|
510
|
+
/** Version description */
|
|
511
|
+
description?: string;
|
|
512
|
+
/** Last update timestamp */
|
|
513
|
+
lastUpdatedAt?: string;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Agent Runtime version list input
|
|
517
|
+
*/
|
|
518
|
+
interface AgentRuntimeVersionListInput extends PageableInput {
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Agent Runtime data (internal representation from API)
|
|
522
|
+
*/
|
|
523
|
+
interface AgentRuntimeData {
|
|
524
|
+
agentRuntimeArn?: string;
|
|
525
|
+
agentRuntimeId?: string;
|
|
526
|
+
agentRuntimeName?: string;
|
|
527
|
+
agentRuntimeVersion?: string;
|
|
528
|
+
artifactType?: string;
|
|
529
|
+
codeConfiguration?: AgentRuntimeCode;
|
|
530
|
+
containerConfiguration?: AgentRuntimeContainer;
|
|
531
|
+
cpu?: number;
|
|
532
|
+
createdAt?: string;
|
|
533
|
+
credentialName?: string;
|
|
534
|
+
description?: string;
|
|
535
|
+
environmentVariables?: Record<string, string>;
|
|
536
|
+
executionRoleArn?: string;
|
|
537
|
+
healthCheckConfiguration?: AgentRuntimeHealthCheckConfig;
|
|
538
|
+
lastUpdatedAt?: string;
|
|
539
|
+
logConfiguration?: AgentRuntimeLogConfig;
|
|
540
|
+
memory?: number;
|
|
541
|
+
networkConfiguration?: NetworkConfig;
|
|
542
|
+
port?: number;
|
|
543
|
+
protocolConfiguration?: AgentRuntimeProtocolConfig;
|
|
544
|
+
resourceName?: string;
|
|
545
|
+
sessionConcurrencyLimitPerInstance?: number;
|
|
546
|
+
sessionIdleTimeoutSeconds?: number;
|
|
547
|
+
status?: Status;
|
|
548
|
+
statusReason?: string;
|
|
549
|
+
tags?: string[];
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Agent Runtime endpoint data (internal representation from API)
|
|
553
|
+
*/
|
|
554
|
+
interface AgentRuntimeEndpointData {
|
|
555
|
+
agentRuntimeEndpointArn?: string;
|
|
556
|
+
agentRuntimeEndpointId?: string;
|
|
557
|
+
agentRuntimeEndpointName?: string;
|
|
558
|
+
agentRuntimeId?: string;
|
|
559
|
+
description?: string;
|
|
560
|
+
endpointPublicUrl?: string;
|
|
561
|
+
resourceName?: string;
|
|
562
|
+
routingConfiguration?: AgentRuntimeEndpointRoutingConfig;
|
|
563
|
+
status?: Status;
|
|
564
|
+
statusReason?: string;
|
|
565
|
+
tags?: string[];
|
|
566
|
+
targetVersion?: string;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Agent Runtime Endpoint resource class
|
|
571
|
+
*/
|
|
572
|
+
declare class AgentRuntimeEndpoint implements AgentRuntimeEndpointData {
|
|
573
|
+
agentRuntimeEndpointArn?: string;
|
|
574
|
+
agentRuntimeEndpointId?: string;
|
|
575
|
+
agentRuntimeEndpointName?: string;
|
|
576
|
+
agentRuntimeId?: string;
|
|
577
|
+
description?: string;
|
|
578
|
+
endpointPublicUrl?: string;
|
|
579
|
+
resourceName?: string;
|
|
580
|
+
routingConfiguration?: AgentRuntimeEndpointRoutingConfig;
|
|
581
|
+
status?: Status;
|
|
582
|
+
statusReason?: string;
|
|
583
|
+
tags?: string[];
|
|
584
|
+
targetVersion?: string;
|
|
585
|
+
private _config?;
|
|
586
|
+
private _dataApi?;
|
|
587
|
+
private _agentRuntimeName?;
|
|
588
|
+
constructor(data?: Partial<AgentRuntimeEndpointData>, config?: Config);
|
|
589
|
+
/**
|
|
590
|
+
* Create endpoint from SDK response object
|
|
591
|
+
*/
|
|
592
|
+
static fromInnerObject(obj: $AgentRun.AgentRuntimeEndpoint, config?: Config): AgentRuntimeEndpoint;
|
|
593
|
+
private static getClient;
|
|
594
|
+
/**
|
|
595
|
+
* Create an endpoint by Agent Runtime ID
|
|
596
|
+
*/
|
|
597
|
+
static create(params: {
|
|
598
|
+
agentRuntimeId: string;
|
|
599
|
+
input: AgentRuntimeEndpointCreateInput;
|
|
600
|
+
config?: Config;
|
|
601
|
+
}): Promise<AgentRuntimeEndpoint>;
|
|
602
|
+
/**
|
|
603
|
+
* Delete an endpoint by ID
|
|
604
|
+
*/
|
|
605
|
+
static delete(params: {
|
|
606
|
+
agentRuntimeId: string;
|
|
607
|
+
endpointId: string;
|
|
608
|
+
config?: Config;
|
|
609
|
+
}): Promise<AgentRuntimeEndpoint>;
|
|
610
|
+
/**
|
|
611
|
+
* Update an endpoint by ID
|
|
612
|
+
*/
|
|
613
|
+
static update(params: {
|
|
614
|
+
agentRuntimeId: string;
|
|
615
|
+
endpointId: string;
|
|
616
|
+
input: AgentRuntimeEndpointUpdateInput;
|
|
617
|
+
config?: Config;
|
|
618
|
+
}): Promise<AgentRuntimeEndpoint>;
|
|
619
|
+
/**
|
|
620
|
+
* Get an endpoint by ID
|
|
621
|
+
*/
|
|
622
|
+
static get(params: {
|
|
623
|
+
agentRuntimeId: string;
|
|
624
|
+
endpointId: string;
|
|
625
|
+
config?: Config;
|
|
626
|
+
}): Promise<AgentRuntimeEndpoint>;
|
|
627
|
+
/**
|
|
628
|
+
* List endpoints by Agent Runtime ID
|
|
629
|
+
*/
|
|
630
|
+
static listById(params: {
|
|
631
|
+
agentRuntimeId: string;
|
|
632
|
+
input?: AgentRuntimeEndpointListInput;
|
|
633
|
+
config?: Config;
|
|
634
|
+
}): Promise<AgentRuntimeEndpoint[]>;
|
|
635
|
+
/**
|
|
636
|
+
* Delete this endpoint
|
|
637
|
+
*/
|
|
638
|
+
delete: (params?: {
|
|
639
|
+
config?: Config;
|
|
640
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
641
|
+
/**
|
|
642
|
+
* Update this endpoint
|
|
643
|
+
*/
|
|
644
|
+
update: (params: {
|
|
645
|
+
input: AgentRuntimeEndpointUpdateInput;
|
|
646
|
+
config?: Config;
|
|
647
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
648
|
+
/**
|
|
649
|
+
* Refresh this endpoint's data
|
|
650
|
+
*/
|
|
651
|
+
refresh: (params?: {
|
|
652
|
+
config?: Config;
|
|
653
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
654
|
+
/**
|
|
655
|
+
* Wait until the endpoint is ready
|
|
656
|
+
*/
|
|
657
|
+
waitUntilReady: (options?: {
|
|
658
|
+
timeoutSeconds?: number;
|
|
659
|
+
intervalSeconds?: number;
|
|
660
|
+
beforeCheck?: (endpoint: AgentRuntimeEndpoint) => void;
|
|
661
|
+
}, config?: Config) => Promise<AgentRuntimeEndpoint>;
|
|
662
|
+
/**
|
|
663
|
+
* Invoke agent runtime using OpenAI-compatible API through this endpoint
|
|
664
|
+
*
|
|
665
|
+
* This method provides an OpenAI-compatible interface to invoke the agent runtime
|
|
666
|
+
* through this specific endpoint.
|
|
667
|
+
*
|
|
668
|
+
* @param args - Invocation arguments
|
|
669
|
+
* @returns OpenAI chat completion response
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* ```typescript
|
|
673
|
+
* const endpoint = await AgentRuntimeEndpoint.get({
|
|
674
|
+
* agentRuntimeId: "runtime-id",
|
|
675
|
+
* endpointId: "endpoint-id"
|
|
676
|
+
* });
|
|
677
|
+
* const response = await endpoint.invokeOpenai({
|
|
678
|
+
* messages: [{ role: "user", content: "Hello" }],
|
|
679
|
+
* stream: false
|
|
680
|
+
* });
|
|
681
|
+
* ```
|
|
682
|
+
*/
|
|
683
|
+
invokeOpenai: (args: InvokeArgs) => Promise<(openai_core_streaming.Stream<openai_resources.ChatCompletionChunk> & {
|
|
684
|
+
_request_id?: string | null;
|
|
685
|
+
}) | (openai_resources.ChatCompletion & {
|
|
686
|
+
_request_id?: string | null;
|
|
687
|
+
})>;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Agent Runtime resource class
|
|
692
|
+
*/
|
|
693
|
+
declare class AgentRuntime implements AgentRuntimeData {
|
|
694
|
+
agentRuntimeArn?: string;
|
|
695
|
+
agentRuntimeId?: string;
|
|
696
|
+
agentRuntimeName?: string;
|
|
697
|
+
agentRuntimeVersion?: string;
|
|
698
|
+
artifactType?: string;
|
|
699
|
+
codeConfiguration?: AgentRuntimeCode;
|
|
700
|
+
containerConfiguration?: AgentRuntimeContainer;
|
|
701
|
+
cpu?: number;
|
|
702
|
+
createdAt?: string;
|
|
703
|
+
credentialName?: string;
|
|
704
|
+
description?: string;
|
|
705
|
+
environmentVariables?: Record<string, string>;
|
|
706
|
+
executionRoleArn?: string;
|
|
707
|
+
healthCheckConfiguration?: AgentRuntimeHealthCheckConfig;
|
|
708
|
+
lastUpdatedAt?: string;
|
|
709
|
+
logConfiguration?: AgentRuntimeLogConfig;
|
|
710
|
+
memory?: number;
|
|
711
|
+
networkConfiguration?: NetworkConfig;
|
|
712
|
+
port?: number;
|
|
713
|
+
protocolConfiguration?: AgentRuntimeProtocolConfig;
|
|
714
|
+
resourceName?: string;
|
|
715
|
+
sessionConcurrencyLimitPerInstance?: number;
|
|
716
|
+
sessionIdleTimeoutSeconds?: number;
|
|
717
|
+
status?: Status;
|
|
718
|
+
statusReason?: string;
|
|
719
|
+
tags?: string[];
|
|
720
|
+
private _config?;
|
|
721
|
+
private _dataApiCache;
|
|
722
|
+
constructor(data?: Partial<AgentRuntimeData>, config?: Config);
|
|
723
|
+
/**
|
|
724
|
+
* Create runtime from SDK response object
|
|
725
|
+
*/
|
|
726
|
+
static fromInnerObject(obj: $AgentRun.AgentRuntime, config?: Config): AgentRuntime;
|
|
727
|
+
private static getClient;
|
|
728
|
+
/**
|
|
729
|
+
* Create a new Agent Runtime
|
|
730
|
+
*/
|
|
731
|
+
static create(params: {
|
|
732
|
+
input: AgentRuntimeCreateInput;
|
|
733
|
+
config?: Config;
|
|
734
|
+
}): Promise<AgentRuntime>;
|
|
735
|
+
/**
|
|
736
|
+
* Delete an Agent Runtime by ID
|
|
737
|
+
*/
|
|
738
|
+
static delete(params: {
|
|
739
|
+
id: string;
|
|
740
|
+
config?: Config;
|
|
741
|
+
}): Promise<AgentRuntime>;
|
|
742
|
+
/**
|
|
743
|
+
* Update an Agent Runtime by ID
|
|
744
|
+
*/
|
|
745
|
+
static update(params: {
|
|
746
|
+
id: string;
|
|
747
|
+
input: AgentRuntimeUpdateInput;
|
|
748
|
+
config?: Config;
|
|
749
|
+
}): Promise<AgentRuntime>;
|
|
750
|
+
/**
|
|
751
|
+
* Get an Agent Runtime by ID
|
|
752
|
+
*/
|
|
753
|
+
static get(params: {
|
|
754
|
+
id: string;
|
|
755
|
+
config?: Config;
|
|
756
|
+
}): Promise<AgentRuntime>;
|
|
757
|
+
/**
|
|
758
|
+
* List Agent Runtimes
|
|
759
|
+
*/
|
|
760
|
+
static list(input?: AgentRuntimeListInput, config?: Config): Promise<AgentRuntime[]>;
|
|
761
|
+
/**
|
|
762
|
+
* List all Agent Runtimes (with pagination)
|
|
763
|
+
*/
|
|
764
|
+
static listAll(options?: {
|
|
765
|
+
agentRuntimeName?: string;
|
|
766
|
+
tags?: string;
|
|
767
|
+
searchMode?: string;
|
|
768
|
+
}, config?: Config): Promise<AgentRuntime[]>;
|
|
769
|
+
/**
|
|
770
|
+
* List Agent Runtime versions by ID
|
|
771
|
+
*/
|
|
772
|
+
static listVersionsById(params: {
|
|
773
|
+
agentRuntimeId: string;
|
|
774
|
+
input?: AgentRuntimeVersionListInput;
|
|
775
|
+
config?: Config;
|
|
776
|
+
}): Promise<AgentRuntimeVersion[]>;
|
|
777
|
+
/**
|
|
778
|
+
* Delete this runtime
|
|
779
|
+
*/
|
|
780
|
+
delete: (params?: {
|
|
781
|
+
config?: Config;
|
|
782
|
+
}) => Promise<AgentRuntime>;
|
|
783
|
+
/**
|
|
784
|
+
* Update this runtime
|
|
785
|
+
*/
|
|
786
|
+
update: (params: {
|
|
787
|
+
input: AgentRuntimeUpdateInput;
|
|
788
|
+
config?: Config;
|
|
789
|
+
}) => Promise<AgentRuntime>;
|
|
790
|
+
/**
|
|
791
|
+
* Refresh this runtime's data
|
|
792
|
+
*/
|
|
793
|
+
refresh: (params?: {
|
|
794
|
+
config?: Config;
|
|
795
|
+
}) => Promise<AgentRuntime>;
|
|
796
|
+
/**
|
|
797
|
+
* Create an endpoint for this runtime
|
|
798
|
+
*/
|
|
799
|
+
createEndpoint: (params: {
|
|
800
|
+
input: AgentRuntimeEndpointCreateInput;
|
|
801
|
+
config?: Config;
|
|
802
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
803
|
+
/**
|
|
804
|
+
* Delete an endpoint from this runtime
|
|
805
|
+
*/
|
|
806
|
+
deleteEndpoint: (params: {
|
|
807
|
+
endpointId: string;
|
|
808
|
+
config?: Config;
|
|
809
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
810
|
+
/**
|
|
811
|
+
* Update an endpoint of this runtime
|
|
812
|
+
*/
|
|
813
|
+
updateEndpoint: (params: {
|
|
814
|
+
endpointId: string;
|
|
815
|
+
input: AgentRuntimeEndpointUpdateInput;
|
|
816
|
+
config?: Config;
|
|
817
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
818
|
+
/**
|
|
819
|
+
* Get an endpoint of this runtime
|
|
820
|
+
*/
|
|
821
|
+
getEndpoint: (params: {
|
|
822
|
+
endpointId: string;
|
|
823
|
+
config?: Config;
|
|
824
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
825
|
+
/**
|
|
826
|
+
* List endpoints of this runtime
|
|
827
|
+
*/
|
|
828
|
+
listEndpoints: (params?: {
|
|
829
|
+
config?: Config;
|
|
830
|
+
}) => Promise<AgentRuntimeEndpoint[]>;
|
|
831
|
+
/**
|
|
832
|
+
* List versions of this runtime
|
|
833
|
+
*/
|
|
834
|
+
listVersions: (params?: {
|
|
835
|
+
config?: Config;
|
|
836
|
+
}) => Promise<AgentRuntimeVersion[]>;
|
|
837
|
+
/**
|
|
838
|
+
* Wait until the runtime is ready
|
|
839
|
+
*/
|
|
840
|
+
waitUntilReady: (options?: {
|
|
841
|
+
timeoutSeconds?: number;
|
|
842
|
+
intervalSeconds?: number;
|
|
843
|
+
beforeCheck?: (runtime: AgentRuntime) => void;
|
|
844
|
+
}, config?: Config) => Promise<AgentRuntime>;
|
|
845
|
+
/**
|
|
846
|
+
* Wait until agent runtime reaches READY or any FAILED state
|
|
847
|
+
* Similar to waitUntilReady but does not throw on FAILED states
|
|
848
|
+
* Compatible with Python SDK's wait_until_ready_or_failed method
|
|
849
|
+
*/
|
|
850
|
+
waitUntilReadyOrFailed: (options?: {
|
|
851
|
+
timeoutSeconds?: number;
|
|
852
|
+
intervalSeconds?: number;
|
|
853
|
+
beforeCheck?: (runtime: AgentRuntime) => void;
|
|
854
|
+
}, config?: Config) => Promise<AgentRuntime>;
|
|
855
|
+
/**
|
|
856
|
+
* Invoke agent runtime using OpenAI-compatible API
|
|
857
|
+
*
|
|
858
|
+
* This method provides an OpenAI-compatible interface to invoke the agent runtime.
|
|
859
|
+
* It creates a Data API client and forwards the invocation request.
|
|
860
|
+
*
|
|
861
|
+
* @param args - Invocation arguments
|
|
862
|
+
* @returns OpenAI chat completion response
|
|
863
|
+
*
|
|
864
|
+
* @example
|
|
865
|
+
* ```typescript
|
|
866
|
+
* const runtime = await AgentRuntime.get({ id: "runtime-id" });
|
|
867
|
+
* const response = await runtime.invokeOpenai({
|
|
868
|
+
* agentRuntimeEndpointName: "Default",
|
|
869
|
+
* messages: [{ role: "user", content: "Hello" }],
|
|
870
|
+
* stream: false
|
|
871
|
+
* });
|
|
872
|
+
* ```
|
|
873
|
+
*/
|
|
874
|
+
invokeOpenai: (args: InvokeArgs & {
|
|
875
|
+
agentRuntimeEndpointName?: string;
|
|
876
|
+
}) => Promise<(openai_core_streaming.Stream<openai_resources.ChatCompletionChunk> & {
|
|
877
|
+
_request_id?: string | null;
|
|
878
|
+
}) | (openai_resources.ChatCompletion & {
|
|
879
|
+
_request_id?: string | null;
|
|
880
|
+
})>;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Agent Runtime Client
|
|
885
|
+
*
|
|
886
|
+
* 提供 Agent Runtime 的创建、删除、更新、查询和端点管理功能。
|
|
887
|
+
* Provides create, delete, update, query and endpoint management functions for Agent Runtime.
|
|
888
|
+
*/
|
|
889
|
+
declare class AgentRuntimeClient {
|
|
890
|
+
private config?;
|
|
891
|
+
private controlApi;
|
|
892
|
+
constructor(config?: Config);
|
|
893
|
+
/**
|
|
894
|
+
* Create an Agent Runtime
|
|
895
|
+
*/
|
|
896
|
+
create: (params: {
|
|
897
|
+
input: AgentRuntimeCreateInput;
|
|
898
|
+
config?: Config;
|
|
899
|
+
}) => Promise<AgentRuntime>;
|
|
900
|
+
/**
|
|
901
|
+
* Delete an Agent Runtime
|
|
902
|
+
*/
|
|
903
|
+
delete: (params: {
|
|
904
|
+
id: string;
|
|
905
|
+
config?: Config;
|
|
906
|
+
}) => Promise<AgentRuntime>;
|
|
907
|
+
/**
|
|
908
|
+
* Update an Agent Runtime
|
|
909
|
+
*/
|
|
910
|
+
update: (params: {
|
|
911
|
+
id: string;
|
|
912
|
+
input: AgentRuntimeUpdateInput;
|
|
913
|
+
config?: Config;
|
|
914
|
+
}) => Promise<AgentRuntime>;
|
|
915
|
+
/**
|
|
916
|
+
* Get an Agent Runtime
|
|
917
|
+
*/
|
|
918
|
+
get: (params: {
|
|
919
|
+
id: string;
|
|
920
|
+
config?: Config;
|
|
921
|
+
}) => Promise<AgentRuntime>;
|
|
922
|
+
/**
|
|
923
|
+
* List Agent Runtimes
|
|
924
|
+
*/
|
|
925
|
+
list: (params?: {
|
|
926
|
+
input?: AgentRuntimeListInput;
|
|
927
|
+
config?: Config;
|
|
928
|
+
}) => Promise<AgentRuntime[]>;
|
|
929
|
+
/**
|
|
930
|
+
* List all Agent Runtimes (with pagination)
|
|
931
|
+
*/
|
|
932
|
+
listAll: (params?: {
|
|
933
|
+
options?: {
|
|
934
|
+
agentRuntimeName?: string;
|
|
935
|
+
tags?: string;
|
|
936
|
+
searchMode?: string;
|
|
937
|
+
};
|
|
938
|
+
config?: Config;
|
|
939
|
+
}) => Promise<AgentRuntime[]>;
|
|
940
|
+
/**
|
|
941
|
+
* Create an endpoint for an Agent Runtime
|
|
942
|
+
*/
|
|
943
|
+
createEndpoint: (params: {
|
|
944
|
+
agentRuntimeId: string;
|
|
945
|
+
input: AgentRuntimeEndpointCreateInput;
|
|
946
|
+
config?: Config;
|
|
947
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
948
|
+
/**
|
|
949
|
+
* Delete an endpoint
|
|
950
|
+
*/
|
|
951
|
+
deleteEndpoint: (params: {
|
|
952
|
+
agentRuntimeId: string;
|
|
953
|
+
endpointId: string;
|
|
954
|
+
config?: Config;
|
|
955
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
956
|
+
/**
|
|
957
|
+
* Update an endpoint
|
|
958
|
+
*/
|
|
959
|
+
updateEndpoint: (params: {
|
|
960
|
+
agentRuntimeId: string;
|
|
961
|
+
endpointId: string;
|
|
962
|
+
input: AgentRuntimeEndpointUpdateInput;
|
|
963
|
+
config?: Config;
|
|
964
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
965
|
+
/**
|
|
966
|
+
* Get an endpoint
|
|
967
|
+
*/
|
|
968
|
+
getEndpoint: (params: {
|
|
969
|
+
agentRuntimeId: string;
|
|
970
|
+
endpointId: string;
|
|
971
|
+
config?: Config;
|
|
972
|
+
}) => Promise<AgentRuntimeEndpoint>;
|
|
973
|
+
/**
|
|
974
|
+
* List endpoints for an Agent Runtime
|
|
975
|
+
*/
|
|
976
|
+
listEndpoints: (params: {
|
|
977
|
+
agentRuntimeId: string;
|
|
978
|
+
input?: AgentRuntimeEndpointListInput;
|
|
979
|
+
config?: Config;
|
|
980
|
+
}) => Promise<AgentRuntimeEndpoint[]>;
|
|
981
|
+
/**
|
|
982
|
+
* List versions for an Agent Runtime
|
|
983
|
+
*/
|
|
984
|
+
listVersions: (params: {
|
|
985
|
+
agentRuntimeId: string;
|
|
986
|
+
input?: AgentRuntimeVersionListInput;
|
|
987
|
+
config?: Config;
|
|
988
|
+
}) => Promise<AgentRuntimeVersion[]>;
|
|
989
|
+
/**
|
|
990
|
+
* Invoke agent runtime using OpenAI-compatible API
|
|
991
|
+
*
|
|
992
|
+
* This method provides an OpenAI-compatible interface to invoke the agent runtime.
|
|
993
|
+
*
|
|
994
|
+
* @param params - Parameters including agent runtime name, endpoint name, and invocation args
|
|
995
|
+
* @returns OpenAI chat completion response
|
|
996
|
+
*
|
|
997
|
+
* @example
|
|
998
|
+
* ```typescript
|
|
999
|
+
* const client = new AgentRuntimeClient();
|
|
1000
|
+
* const response = await client.invokeOpenai({
|
|
1001
|
+
* agentRuntimeName: "my-runtime",
|
|
1002
|
+
* agentRuntimeEndpointName: "Default",
|
|
1003
|
+
* messages: [{ role: "user", content: "Hello" }],
|
|
1004
|
+
* stream: false
|
|
1005
|
+
* });
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
invokeOpenai: (params: {
|
|
1009
|
+
agentRuntimeName: string;
|
|
1010
|
+
agentRuntimeEndpointName?: string;
|
|
1011
|
+
} & InvokeArgs) => Promise<(openai_core_streaming.Stream<openai_resources.ChatCompletionChunk> & {
|
|
1012
|
+
_request_id?: string | null;
|
|
1013
|
+
}) | (openai_resources.ChatCompletion & {
|
|
1014
|
+
_request_id?: string | null;
|
|
1015
|
+
})>;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Control API Base Module
|
|
1020
|
+
*
|
|
1021
|
+
* 此模块定义控制链路 API 的基类。
|
|
1022
|
+
* This module defines the base class for control API.
|
|
1023
|
+
*/
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Base class for Control API clients
|
|
1027
|
+
*
|
|
1028
|
+
* 提供控制链路和 DevS API 客户端的获取功能。
|
|
1029
|
+
* Provides functionality to get control API and DevS API clients.
|
|
1030
|
+
*/
|
|
1031
|
+
declare class ControlAPI {
|
|
1032
|
+
protected config?: Config;
|
|
1033
|
+
constructor(config?: Config);
|
|
1034
|
+
/**
|
|
1035
|
+
* Get the underlying AgentRun client instance
|
|
1036
|
+
*/
|
|
1037
|
+
getClient(config?: Config): $AgentRun__default;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
/**
|
|
1041
|
+
* This file is auto generated by the code generation script.
|
|
1042
|
+
* Do not modify this file manually.
|
|
1043
|
+
* Use the `bun run codegen` command to regenerate.
|
|
1044
|
+
*
|
|
1045
|
+
* 当前文件为自动生成的控制 API 客户端代码。请勿手动修改此文件。
|
|
1046
|
+
* 使用 `bun run codegen` 命令重新生成。
|
|
1047
|
+
*/
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Agent Runtime Control API
|
|
1051
|
+
*/
|
|
1052
|
+
declare class AgentRuntimeControlAPI extends ControlAPI {
|
|
1053
|
+
constructor(config?: Config);
|
|
1054
|
+
/**
|
|
1055
|
+
* Create Agent Runtime
|
|
1056
|
+
*
|
|
1057
|
+
* @param params - Method parameters
|
|
1058
|
+
* @param params.input - Agent Runtime configuration
|
|
1059
|
+
* @param params.headers - Custom request headers
|
|
1060
|
+
* @param params.config - Optional config override
|
|
1061
|
+
* @returns Created Runtime object
|
|
1062
|
+
*/
|
|
1063
|
+
createAgentRuntime: (params: {
|
|
1064
|
+
input: $AgentRun.CreateAgentRuntimeInput;
|
|
1065
|
+
headers?: Record<string, string>;
|
|
1066
|
+
config?: Config;
|
|
1067
|
+
}) => Promise<$AgentRun.AgentRuntime>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Delete Agent Runtime
|
|
1070
|
+
*
|
|
1071
|
+
* @param params - Method parameters
|
|
1072
|
+
* @param params.agentId - Agent Runtime ID
|
|
1073
|
+
* @param params.headers - Custom request headers
|
|
1074
|
+
* @param params.config - Optional config override
|
|
1075
|
+
* @returns Deleted Runtime object
|
|
1076
|
+
*/
|
|
1077
|
+
deleteAgentRuntime: (params: {
|
|
1078
|
+
agentId: string;
|
|
1079
|
+
headers?: Record<string, string>;
|
|
1080
|
+
config?: Config;
|
|
1081
|
+
}) => Promise<$AgentRun.AgentRuntime>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Update Agent Runtime
|
|
1084
|
+
*
|
|
1085
|
+
* @param params - Method parameters
|
|
1086
|
+
* @param params.agentId - Agent Runtime ID
|
|
1087
|
+
* @param params.input - Agent Runtime configuration
|
|
1088
|
+
* @param params.headers - Custom request headers
|
|
1089
|
+
* @param params.config - Optional config override
|
|
1090
|
+
* @returns Updated Runtime object
|
|
1091
|
+
*/
|
|
1092
|
+
updateAgentRuntime: (params: {
|
|
1093
|
+
agentId: string;
|
|
1094
|
+
input: $AgentRun.UpdateAgentRuntimeInput;
|
|
1095
|
+
headers?: Record<string, string>;
|
|
1096
|
+
config?: Config;
|
|
1097
|
+
}) => Promise<$AgentRun.AgentRuntime>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Get Agent Runtime
|
|
1100
|
+
*
|
|
1101
|
+
* @param params - Method parameters
|
|
1102
|
+
* @param params.agentId - Agent Runtime ID
|
|
1103
|
+
* @param params.request - Get request options
|
|
1104
|
+
* @param params.headers - Custom request headers
|
|
1105
|
+
* @param params.config - Optional config override
|
|
1106
|
+
* @returns Runtime object
|
|
1107
|
+
*/
|
|
1108
|
+
getAgentRuntime: (params: {
|
|
1109
|
+
agentId: string;
|
|
1110
|
+
request?: $AgentRun.GetAgentRuntimeRequest;
|
|
1111
|
+
headers?: Record<string, string>;
|
|
1112
|
+
config?: Config;
|
|
1113
|
+
}) => Promise<$AgentRun.AgentRuntime>;
|
|
1114
|
+
/**
|
|
1115
|
+
* List Agent Runtimes
|
|
1116
|
+
*
|
|
1117
|
+
* @param params - Method parameters
|
|
1118
|
+
* @param params.input - List options
|
|
1119
|
+
* @param params.headers - Custom request headers
|
|
1120
|
+
* @param params.config - Optional config override
|
|
1121
|
+
* @returns List of Runtime objects
|
|
1122
|
+
*/
|
|
1123
|
+
listAgentRuntimes: (params: {
|
|
1124
|
+
input: $AgentRun.ListAgentRuntimesRequest;
|
|
1125
|
+
headers?: Record<string, string>;
|
|
1126
|
+
config?: Config;
|
|
1127
|
+
}) => Promise<$AgentRun.ListAgentRuntimesOutput>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Create Agent Runtime Endpoint
|
|
1130
|
+
*
|
|
1131
|
+
* @param params - Method parameters
|
|
1132
|
+
* @param params.agentId - Agent Runtime ID
|
|
1133
|
+
* @param params.input - Endpoint configuration
|
|
1134
|
+
* @param params.headers - Custom request headers
|
|
1135
|
+
* @param params.config - Optional config override
|
|
1136
|
+
* @returns Created Endpoint object
|
|
1137
|
+
*/
|
|
1138
|
+
createAgentRuntimeEndpoint: (params: {
|
|
1139
|
+
agentId: string;
|
|
1140
|
+
input: $AgentRun.CreateAgentRuntimeEndpointInput;
|
|
1141
|
+
headers?: Record<string, string>;
|
|
1142
|
+
config?: Config;
|
|
1143
|
+
}) => Promise<$AgentRun.AgentRuntimeEndpoint>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Delete Agent Runtime Endpoint
|
|
1146
|
+
*
|
|
1147
|
+
* @param params - Method parameters
|
|
1148
|
+
* @param params.agentId - Agent Runtime ID
|
|
1149
|
+
* @param params.endpointId - Endpoint ID
|
|
1150
|
+
* @param params.headers - Custom request headers
|
|
1151
|
+
* @param params.config - Optional config override
|
|
1152
|
+
* @returns Deleted Endpoint object
|
|
1153
|
+
*/
|
|
1154
|
+
deleteAgentRuntimeEndpoint: (params: {
|
|
1155
|
+
agentId: string;
|
|
1156
|
+
endpointId: string;
|
|
1157
|
+
headers?: Record<string, string>;
|
|
1158
|
+
config?: Config;
|
|
1159
|
+
}) => Promise<$AgentRun.AgentRuntimeEndpoint>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Update Agent Runtime Endpoint
|
|
1162
|
+
*
|
|
1163
|
+
* @param params - Method parameters
|
|
1164
|
+
* @param params.agentId - Agent Runtime ID
|
|
1165
|
+
* @param params.endpointId - Endpoint ID
|
|
1166
|
+
* @param params.input - Endpoint configuration
|
|
1167
|
+
* @param params.headers - Custom request headers
|
|
1168
|
+
* @param params.config - Optional config override
|
|
1169
|
+
* @returns Updated Endpoint object
|
|
1170
|
+
*/
|
|
1171
|
+
updateAgentRuntimeEndpoint: (params: {
|
|
1172
|
+
agentId: string;
|
|
1173
|
+
endpointId: string;
|
|
1174
|
+
input: $AgentRun.UpdateAgentRuntimeEndpointInput;
|
|
1175
|
+
headers?: Record<string, string>;
|
|
1176
|
+
config?: Config;
|
|
1177
|
+
}) => Promise<$AgentRun.AgentRuntimeEndpoint>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Get Agent Runtime Endpoint
|
|
1180
|
+
*
|
|
1181
|
+
* @param params - Method parameters
|
|
1182
|
+
* @param params.agentId - Agent Runtime ID
|
|
1183
|
+
* @param params.endpointId - Endpoint ID
|
|
1184
|
+
* @param params.headers - Custom request headers
|
|
1185
|
+
* @param params.config - Optional config override
|
|
1186
|
+
* @returns Endpoint object
|
|
1187
|
+
*/
|
|
1188
|
+
getAgentRuntimeEndpoint: (params: {
|
|
1189
|
+
agentId: string;
|
|
1190
|
+
endpointId: string;
|
|
1191
|
+
headers?: Record<string, string>;
|
|
1192
|
+
config?: Config;
|
|
1193
|
+
}) => Promise<$AgentRun.AgentRuntimeEndpoint>;
|
|
1194
|
+
/**
|
|
1195
|
+
* List Agent Runtime Endpoints
|
|
1196
|
+
*
|
|
1197
|
+
* @param params - Method parameters
|
|
1198
|
+
* @param params.agentId - Agent Runtime ID
|
|
1199
|
+
* @param params.input - List options
|
|
1200
|
+
* @param params.headers - Custom request headers
|
|
1201
|
+
* @param params.config - Optional config override
|
|
1202
|
+
* @returns List of Endpoint objects
|
|
1203
|
+
*/
|
|
1204
|
+
listAgentRuntimeEndpoints: (params: {
|
|
1205
|
+
agentId: string;
|
|
1206
|
+
input: $AgentRun.ListAgentRuntimeEndpointsRequest;
|
|
1207
|
+
headers?: Record<string, string>;
|
|
1208
|
+
config?: Config;
|
|
1209
|
+
}) => Promise<$AgentRun.ListAgentRuntimeEndpointsOutput>;
|
|
1210
|
+
/**
|
|
1211
|
+
* List Agent Runtime Versions
|
|
1212
|
+
*
|
|
1213
|
+
* @param params - Method parameters
|
|
1214
|
+
* @param params.agentId - Agent Runtime ID
|
|
1215
|
+
* @param params.input - List options
|
|
1216
|
+
* @param params.headers - Custom request headers
|
|
1217
|
+
* @param params.config - Optional config override
|
|
1218
|
+
* @returns List of Version objects
|
|
1219
|
+
*/
|
|
1220
|
+
listAgentRuntimeVersions: (params: {
|
|
1221
|
+
agentId: string;
|
|
1222
|
+
input: $AgentRun.ListAgentRuntimeVersionsRequest;
|
|
1223
|
+
headers?: Record<string, string>;
|
|
1224
|
+
config?: Config;
|
|
1225
|
+
}) => Promise<$AgentRun.ListAgentRuntimeVersionsOutput>;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
资源基类模板 / Resource Base Template
|
|
1230
|
+
|
|
1231
|
+
此模板用于生成资源对象的基类代码。
|
|
1232
|
+
This template is used to generate base class code for resource objects.
|
|
1233
|
+
*/
|
|
1234
|
+
|
|
1235
|
+
declare abstract class ResourceBase {
|
|
1236
|
+
status?: Status;
|
|
1237
|
+
protected _config?: Config;
|
|
1238
|
+
abstract get(params?: {
|
|
1239
|
+
config?: Config;
|
|
1240
|
+
}): Promise<any>;
|
|
1241
|
+
abstract delete(params?: {
|
|
1242
|
+
config?: Config;
|
|
1243
|
+
}): Promise<any>;
|
|
1244
|
+
static list(_params: {
|
|
1245
|
+
input?: PageableInput;
|
|
1246
|
+
config?: Config;
|
|
1247
|
+
}): Promise<ThisType<ResourceBase>[]>;
|
|
1248
|
+
static listAll(params: {
|
|
1249
|
+
uniqIdCallback: (item: any) => string;
|
|
1250
|
+
input?: Record<string, any>;
|
|
1251
|
+
config?: Config;
|
|
1252
|
+
}): Promise<any[]>;
|
|
1253
|
+
waitUntil: (params: {
|
|
1254
|
+
checkFinishedCallback: (resource: ResourceBase) => Promise<boolean>;
|
|
1255
|
+
intervalSeconds?: number;
|
|
1256
|
+
timeoutSeconds?: number;
|
|
1257
|
+
}) => Promise<ResourceBase>;
|
|
1258
|
+
waitUntilReadyOrFailed: (params: {
|
|
1259
|
+
callback: (resource: ResourceBase) => Promise<void>;
|
|
1260
|
+
intervalSeconds?: number;
|
|
1261
|
+
timeoutSeconds?: number;
|
|
1262
|
+
}) => Promise<ResourceBase>;
|
|
1263
|
+
delete_and_wait_until_finished: (params: {
|
|
1264
|
+
callback: (resource: ResourceBase) => Promise<void>;
|
|
1265
|
+
intervalSeconds?: number;
|
|
1266
|
+
timeoutSeconds?: number;
|
|
1267
|
+
}) => Promise<ResourceBase | undefined>;
|
|
1268
|
+
refresh: (params?: {
|
|
1269
|
+
config?: Config;
|
|
1270
|
+
}) => Promise<any>;
|
|
1271
|
+
/**
|
|
1272
|
+
* 更新实例自身的属性 / Update instance properties
|
|
1273
|
+
*
|
|
1274
|
+
* @param source - 源对象 / Source object
|
|
1275
|
+
*/
|
|
1276
|
+
updateSelf(source: any): void;
|
|
1277
|
+
/**
|
|
1278
|
+
* 列出所有资源(带去重)/ List all resources (with deduplication)
|
|
1279
|
+
*
|
|
1280
|
+
* @param uniqIdCallback - 唯一ID回调函数 / Unique ID callback function
|
|
1281
|
+
* @param config - 配置 / Configuration
|
|
1282
|
+
* @param kwargs - 其他查询参数 / Other query parameters
|
|
1283
|
+
* @returns 资源列表 / Resource list
|
|
1284
|
+
*/
|
|
1285
|
+
protected static listAllResources(uniqIdCallback: (item: any) => string, config?: Config, kwargs?: Record<string, any>): Promise<any[]>;
|
|
1286
|
+
setConfig: (config: Config) => this;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/** 凭证认证类型 / Credential Authentication Types */
|
|
1290
|
+
type CredentialAuthType = 'jwt' | 'api_key' | 'basic' | 'aksk' | 'custom_header';
|
|
1291
|
+
/** 凭证来源类型 / Credential Source Types */
|
|
1292
|
+
type CredentialSourceType = 'external_llm' | 'external_tool' | 'internal';
|
|
1293
|
+
/**
|
|
1294
|
+
* Credential basic authentication configuration
|
|
1295
|
+
*/
|
|
1296
|
+
interface CredentialBasicAuth {
|
|
1297
|
+
/** Username */
|
|
1298
|
+
username?: string;
|
|
1299
|
+
/** Password */
|
|
1300
|
+
password?: string;
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* Related resource for credential
|
|
1304
|
+
*/
|
|
1305
|
+
interface RelatedResource {
|
|
1306
|
+
/** 资源 IDj*/
|
|
1307
|
+
resourceId?: string;
|
|
1308
|
+
/** 资源名称j*/
|
|
1309
|
+
resourceName?: string;
|
|
1310
|
+
/** 资源类型j*/
|
|
1311
|
+
resourceType?: string;
|
|
1312
|
+
}
|
|
1313
|
+
interface CredentialConfigInterface {
|
|
1314
|
+
/** 凭证认证类型 */
|
|
1315
|
+
credentialAuthType?: CredentialAuthType;
|
|
1316
|
+
/** 凭证来源类型 */
|
|
1317
|
+
credentialSourceType?: CredentialSourceType;
|
|
1318
|
+
/** 凭证公共配置 */
|
|
1319
|
+
credentialPublicConfig?: Record<string, any>;
|
|
1320
|
+
/** 凭证密钥 */
|
|
1321
|
+
credentialSecret?: string;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* 凭证配置 / Credential configuration
|
|
1325
|
+
*/
|
|
1326
|
+
declare class CredentialConfig implements CredentialConfigInterface {
|
|
1327
|
+
constructor(data?: CredentialConfigInterface);
|
|
1328
|
+
/** 配置访问 AgentRun 的 api key 凭证 */
|
|
1329
|
+
static inboundApiKey(params: {
|
|
1330
|
+
apiKey: string;
|
|
1331
|
+
headerKey?: string;
|
|
1332
|
+
}): CredentialConfig;
|
|
1333
|
+
/** 配置访问 AgentRun 的静态 JWKS 凭证 */
|
|
1334
|
+
static inboundStaticJwt(params: {
|
|
1335
|
+
jwks: string;
|
|
1336
|
+
}): CredentialConfig;
|
|
1337
|
+
/** 配置访问 AgentRun 的远程 JWT 凭证 */
|
|
1338
|
+
static inboundRemoteJwt(uri: string, timeout?: number, ttl?: number, publicConfig?: Record<string, any>): CredentialConfig;
|
|
1339
|
+
/** 配置访问 AgentRun 的 Basic 凭证 */
|
|
1340
|
+
static inboundBasic(params: {
|
|
1341
|
+
users: CredentialBasicAuth[];
|
|
1342
|
+
}): CredentialConfig;
|
|
1343
|
+
/** 配置访问第三方工具的 api key 凭证 */
|
|
1344
|
+
static outboundLLMApiKey(params: {
|
|
1345
|
+
apiKey: string;
|
|
1346
|
+
provider: string;
|
|
1347
|
+
}): CredentialConfig;
|
|
1348
|
+
/** 配置访问第三方工具的 ak/sk 凭证 */
|
|
1349
|
+
static outboundLLMAKSK(provider: string, accessKeyId: string, accessKeySecret: string, accountId: string): CredentialConfig;
|
|
1350
|
+
/** 配置访问第三方工具的自定义凭证 */
|
|
1351
|
+
static outboundToolAKSKCustom(params: {
|
|
1352
|
+
authConfig: Record<string, string>;
|
|
1353
|
+
}): CredentialConfig;
|
|
1354
|
+
/** 配置访问第三方工具的自定义 Header 凭证 */
|
|
1355
|
+
static outboundToolCustomHeader(params: {
|
|
1356
|
+
headers: Record<string, string>;
|
|
1357
|
+
}): CredentialConfig;
|
|
1358
|
+
}
|
|
1359
|
+
/** 凭证公共配置 */
|
|
1360
|
+
interface CredentialMutableProps {
|
|
1361
|
+
/** 描述 */
|
|
1362
|
+
description?: string;
|
|
1363
|
+
/** 是否启用 */
|
|
1364
|
+
enabled?: boolean;
|
|
1365
|
+
}
|
|
1366
|
+
interface CredentialImmutableProps {
|
|
1367
|
+
credentialName?: string;
|
|
1368
|
+
}
|
|
1369
|
+
interface CredentialSystemProps {
|
|
1370
|
+
credentialId?: string;
|
|
1371
|
+
createdAt?: string;
|
|
1372
|
+
updatedAt?: string;
|
|
1373
|
+
relatedResources?: RelatedResource[];
|
|
1374
|
+
}
|
|
1375
|
+
interface CredentialCreateInput extends CredentialMutableProps, CredentialImmutableProps {
|
|
1376
|
+
credentialConfig?: CredentialConfig;
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Credential update input
|
|
1380
|
+
*/
|
|
1381
|
+
interface CredentialUpdateInput extends CredentialMutableProps {
|
|
1382
|
+
credentialConfig?: CredentialConfig;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Credential list input
|
|
1386
|
+
*/
|
|
1387
|
+
interface CredentialListInput extends PageableInput {
|
|
1388
|
+
credentialAuthType?: CredentialAuthType;
|
|
1389
|
+
credentialName?: string;
|
|
1390
|
+
credentialSourceType?: CredentialSourceType;
|
|
1391
|
+
provider?: string;
|
|
1392
|
+
}
|
|
1393
|
+
declare class CredentialListOutput {
|
|
1394
|
+
createdAt?: string;
|
|
1395
|
+
credentialAuthType?: CredentialAuthType;
|
|
1396
|
+
credentialId?: string;
|
|
1397
|
+
credentialName?: string;
|
|
1398
|
+
credentialSourceType?: CredentialSourceType;
|
|
1399
|
+
enabled?: boolean;
|
|
1400
|
+
relatedResourceCount?: number;
|
|
1401
|
+
updatedAt?: string;
|
|
1402
|
+
constructor(data?: any);
|
|
1403
|
+
toCredential: (params?: {
|
|
1404
|
+
config?: Config;
|
|
1405
|
+
}) => Promise<Credential>;
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Credential resource class
|
|
1409
|
+
*/
|
|
1410
|
+
interface CredentialInterface extends CredentialMutableProps, CredentialImmutableProps, CredentialSystemProps, CredentialConfigInterface {
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Credential Resource
|
|
1415
|
+
*
|
|
1416
|
+
* 此模块定义 Credential 资源类。
|
|
1417
|
+
* This module defines the Credential resource class.
|
|
1418
|
+
*/
|
|
1419
|
+
|
|
1420
|
+
declare class Credential extends ResourceBase implements CredentialInterface {
|
|
1421
|
+
credentialName?: string;
|
|
1422
|
+
/** 描述 */
|
|
1423
|
+
description?: string;
|
|
1424
|
+
/** 是否启用 */
|
|
1425
|
+
enabled?: boolean;
|
|
1426
|
+
credentialId?: string;
|
|
1427
|
+
createdAt?: string;
|
|
1428
|
+
updatedAt?: string;
|
|
1429
|
+
relatedResources?: RelatedResource[];
|
|
1430
|
+
/** 凭证认证类型 */
|
|
1431
|
+
credentialAuthType?: CredentialAuthType;
|
|
1432
|
+
/** 凭证来源类型 */
|
|
1433
|
+
credentialSourceType?: CredentialSourceType;
|
|
1434
|
+
/** 凭证公共配置 */
|
|
1435
|
+
credentialPublicConfig?: Record<string, any>;
|
|
1436
|
+
/** 凭证密钥 */
|
|
1437
|
+
credentialSecret?: string;
|
|
1438
|
+
protected _config?: Config;
|
|
1439
|
+
constructor(data?: CredentialInterface, config?: Config);
|
|
1440
|
+
private static getClient;
|
|
1441
|
+
/**
|
|
1442
|
+
* Create a new Credential
|
|
1443
|
+
*/
|
|
1444
|
+
static create: (paramsOrInput: any) => Promise<Credential>;
|
|
1445
|
+
/**
|
|
1446
|
+
* Delete a Credential by name
|
|
1447
|
+
*/
|
|
1448
|
+
static delete: (paramsOrName: any) => Promise<Credential>;
|
|
1449
|
+
/**
|
|
1450
|
+
* Update a Credential by name
|
|
1451
|
+
*/
|
|
1452
|
+
static update: (paramsOrName: any) => Promise<Credential>;
|
|
1453
|
+
/**
|
|
1454
|
+
* Get a Credential by name
|
|
1455
|
+
*/
|
|
1456
|
+
static get: (paramsOrName: any) => Promise<Credential>;
|
|
1457
|
+
/**
|
|
1458
|
+
* List all Credentials (with pagination)
|
|
1459
|
+
*/
|
|
1460
|
+
static list: (paramsOrUndefined?: any) => Promise<CredentialListOutput[]>;
|
|
1461
|
+
static listAll: (params?: {
|
|
1462
|
+
input?: CredentialListInput;
|
|
1463
|
+
config?: Config;
|
|
1464
|
+
}) => Promise<CredentialListOutput[]>;
|
|
1465
|
+
/**
|
|
1466
|
+
* Delete this credential
|
|
1467
|
+
*/
|
|
1468
|
+
delete: (params?: any) => Promise<this>;
|
|
1469
|
+
/**
|
|
1470
|
+
* Update this credential
|
|
1471
|
+
*/
|
|
1472
|
+
update: (params: any) => Promise<this>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Refresh this credential's data
|
|
1475
|
+
*/
|
|
1476
|
+
get: (params?: any) => Promise<Credential>;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* Credential Client
|
|
1481
|
+
*
|
|
1482
|
+
* 此模块提供 Credential 的客户端 API。
|
|
1483
|
+
* This module provides the client API for Credential.
|
|
1484
|
+
*/
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1487
|
+
* Credential Client
|
|
1488
|
+
*
|
|
1489
|
+
* 提供 Credential 的创建、删除、更新、查询功能。
|
|
1490
|
+
* Provides create, delete, update, query functions for Credential.
|
|
1491
|
+
*/
|
|
1492
|
+
declare class CredentialClient {
|
|
1493
|
+
private config?;
|
|
1494
|
+
private controlApi;
|
|
1495
|
+
constructor(config?: Config);
|
|
1496
|
+
/**
|
|
1497
|
+
* Create a Credential
|
|
1498
|
+
*/
|
|
1499
|
+
create: (params: {
|
|
1500
|
+
input: CredentialCreateInput;
|
|
1501
|
+
config?: Config;
|
|
1502
|
+
}) => Promise<Credential>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Delete a Credential
|
|
1505
|
+
*/
|
|
1506
|
+
delete: (params: {
|
|
1507
|
+
name: string;
|
|
1508
|
+
config?: Config;
|
|
1509
|
+
}) => Promise<Credential>;
|
|
1510
|
+
/**
|
|
1511
|
+
* Update a Credential
|
|
1512
|
+
*/
|
|
1513
|
+
update: (params: {
|
|
1514
|
+
name: string;
|
|
1515
|
+
input: CredentialUpdateInput;
|
|
1516
|
+
config?: Config;
|
|
1517
|
+
}) => Promise<Credential>;
|
|
1518
|
+
/**
|
|
1519
|
+
* Get a Credential
|
|
1520
|
+
*/
|
|
1521
|
+
get: (params: {
|
|
1522
|
+
name: string;
|
|
1523
|
+
config?: Config;
|
|
1524
|
+
}) => Promise<Credential>;
|
|
1525
|
+
/**
|
|
1526
|
+
* List Credentials
|
|
1527
|
+
*/
|
|
1528
|
+
list: (params: {
|
|
1529
|
+
input?: CredentialListInput;
|
|
1530
|
+
config?: Config;
|
|
1531
|
+
}) => Promise<CredentialListOutput[]>;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* This file is auto generated by the code generation script.
|
|
1536
|
+
* Do not modify this file manually.
|
|
1537
|
+
* Use the `bun run codegen` command to regenerate.
|
|
1538
|
+
*
|
|
1539
|
+
* 当前文件为自动生成的控制 API 客户端代码。请勿手动修改此文件。
|
|
1540
|
+
* 使用 `bun run codegen` 命令重新生成。
|
|
1541
|
+
*/
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* Credential Control API
|
|
1545
|
+
*/
|
|
1546
|
+
declare class CredentialControlAPI extends ControlAPI {
|
|
1547
|
+
constructor(config?: Config);
|
|
1548
|
+
/**
|
|
1549
|
+
* Create credential
|
|
1550
|
+
*
|
|
1551
|
+
* @param params - Method parameters
|
|
1552
|
+
* @param params.input - Credential configuration
|
|
1553
|
+
* @param params.headers - Custom request headers
|
|
1554
|
+
* @param params.config - Optional config override
|
|
1555
|
+
* @returns Created credential object
|
|
1556
|
+
*/
|
|
1557
|
+
createCredential: (params: {
|
|
1558
|
+
input: $AgentRun.CreateCredentialInput;
|
|
1559
|
+
headers?: Record<string, string>;
|
|
1560
|
+
config?: Config;
|
|
1561
|
+
}) => Promise<$AgentRun.Credential>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Delete credential
|
|
1564
|
+
*
|
|
1565
|
+
* @param params - Method parameters
|
|
1566
|
+
* @param params.credentialName - Credential name
|
|
1567
|
+
* @param params.headers - Custom request headers
|
|
1568
|
+
* @param params.config - Optional config override
|
|
1569
|
+
* @returns Deleted credential object
|
|
1570
|
+
*/
|
|
1571
|
+
deleteCredential: (params: {
|
|
1572
|
+
credentialName: string;
|
|
1573
|
+
headers?: Record<string, string>;
|
|
1574
|
+
config?: Config;
|
|
1575
|
+
}) => Promise<$AgentRun.Credential>;
|
|
1576
|
+
/**
|
|
1577
|
+
* Update credential
|
|
1578
|
+
*
|
|
1579
|
+
* @param params - Method parameters
|
|
1580
|
+
* @param params.credentialName - Credential name
|
|
1581
|
+
* @param params.input - Credential configuration
|
|
1582
|
+
* @param params.headers - Custom request headers
|
|
1583
|
+
* @param params.config - Optional config override
|
|
1584
|
+
* @returns Updated credential object
|
|
1585
|
+
*/
|
|
1586
|
+
updateCredential: (params: {
|
|
1587
|
+
credentialName: string;
|
|
1588
|
+
input: $AgentRun.UpdateCredentialInput;
|
|
1589
|
+
headers?: Record<string, string>;
|
|
1590
|
+
config?: Config;
|
|
1591
|
+
}) => Promise<$AgentRun.Credential>;
|
|
1592
|
+
/**
|
|
1593
|
+
* Get credential
|
|
1594
|
+
*
|
|
1595
|
+
* @param params - Method parameters
|
|
1596
|
+
* @param params.credentialName - Credential name
|
|
1597
|
+
* @param params.headers - Custom request headers
|
|
1598
|
+
* @param params.config - Optional config override
|
|
1599
|
+
* @returns Credential object
|
|
1600
|
+
*/
|
|
1601
|
+
getCredential: (params: {
|
|
1602
|
+
credentialName: string;
|
|
1603
|
+
headers?: Record<string, string>;
|
|
1604
|
+
config?: Config;
|
|
1605
|
+
}) => Promise<$AgentRun.Credential>;
|
|
1606
|
+
/**
|
|
1607
|
+
* List credentials
|
|
1608
|
+
*
|
|
1609
|
+
* @param params - Method parameters
|
|
1610
|
+
* @param params.input - List options
|
|
1611
|
+
* @param params.headers - Custom request headers
|
|
1612
|
+
* @param params.config - Optional config override
|
|
1613
|
+
* @returns List of credential objects
|
|
1614
|
+
*/
|
|
1615
|
+
listCredentials: (params: {
|
|
1616
|
+
input: $AgentRun.ListCredentialsRequest;
|
|
1617
|
+
headers?: Record<string, string>;
|
|
1618
|
+
config?: Config;
|
|
1619
|
+
}) => Promise<$AgentRun.ListCredentialsOutput>;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* Sandbox Data API Base Class
|
|
1624
|
+
*
|
|
1625
|
+
* This module provides an HTTP client for interacting with the AgentRun Sandbox Data API.
|
|
1626
|
+
* 此模块提供用于与 AgentRun Sandbox Data API 交互的 HTTP 客户端。
|
|
1627
|
+
*/
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* Resource type enum
|
|
1631
|
+
*/
|
|
1632
|
+
declare enum ResourceType {
|
|
1633
|
+
Runtime = "runtime",
|
|
1634
|
+
LiteLLM = "litellm",
|
|
1635
|
+
Tool = "tool",
|
|
1636
|
+
Template = "template",
|
|
1637
|
+
Sandbox = "sandbox"
|
|
1638
|
+
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Sandbox Data API Client
|
|
1641
|
+
*
|
|
1642
|
+
* Provides methods for making HTTP requests to sandbox data API endpoints.
|
|
1643
|
+
*/
|
|
1644
|
+
declare class SandboxDataAPI {
|
|
1645
|
+
protected resourceName: string;
|
|
1646
|
+
protected resourceType: ResourceType;
|
|
1647
|
+
protected namespace: string;
|
|
1648
|
+
protected config: Config;
|
|
1649
|
+
protected accessToken?: string;
|
|
1650
|
+
protected accessTokenMap: Map<string, string>;
|
|
1651
|
+
constructor(params: {
|
|
1652
|
+
sandboxId?: string;
|
|
1653
|
+
templateName?: string;
|
|
1654
|
+
config?: Config;
|
|
1655
|
+
namespace?: string;
|
|
1656
|
+
});
|
|
1657
|
+
/**
|
|
1658
|
+
* Refresh access token for the resource
|
|
1659
|
+
*/
|
|
1660
|
+
protected refreshAccessToken(params: {
|
|
1661
|
+
sandboxId?: string;
|
|
1662
|
+
templateName?: string;
|
|
1663
|
+
config?: Config;
|
|
1664
|
+
}): Promise<void>;
|
|
1665
|
+
/**
|
|
1666
|
+
* Get base URL for data API
|
|
1667
|
+
*/
|
|
1668
|
+
protected getBaseUrl(): string;
|
|
1669
|
+
/**
|
|
1670
|
+
* Construct full URL with path and query parameters
|
|
1671
|
+
*/
|
|
1672
|
+
protected withPath(path: string, query?: Record<string, any>): string;
|
|
1673
|
+
/**
|
|
1674
|
+
* Authentication hook - gets access token for the resource
|
|
1675
|
+
*/
|
|
1676
|
+
protected auth(params: {
|
|
1677
|
+
config?: Config;
|
|
1678
|
+
}): Promise<void>;
|
|
1679
|
+
/**
|
|
1680
|
+
* Mask token for logging
|
|
1681
|
+
*/
|
|
1682
|
+
protected maskToken(token: string): string;
|
|
1683
|
+
/**
|
|
1684
|
+
* Prepare request headers
|
|
1685
|
+
*/
|
|
1686
|
+
protected prepareHeaders(params: {
|
|
1687
|
+
headers?: Record<string, string>;
|
|
1688
|
+
config?: Config;
|
|
1689
|
+
}): Record<string, string>;
|
|
1690
|
+
/**
|
|
1691
|
+
* Make an HTTP request
|
|
1692
|
+
*/
|
|
1693
|
+
protected makeRequest<T = any>(params: {
|
|
1694
|
+
method: string;
|
|
1695
|
+
url: string;
|
|
1696
|
+
data?: any;
|
|
1697
|
+
headers?: Record<string, string>;
|
|
1698
|
+
query?: Record<string, any>;
|
|
1699
|
+
config?: Config;
|
|
1700
|
+
}): Promise<T>;
|
|
1701
|
+
/**
|
|
1702
|
+
* GET request
|
|
1703
|
+
*/
|
|
1704
|
+
get<T = any>(params: {
|
|
1705
|
+
path: string;
|
|
1706
|
+
query?: Record<string, any>;
|
|
1707
|
+
headers?: Record<string, string>;
|
|
1708
|
+
config?: Config;
|
|
1709
|
+
}): Promise<T>;
|
|
1710
|
+
/**
|
|
1711
|
+
* POST request
|
|
1712
|
+
*/
|
|
1713
|
+
post<T = any>(params: {
|
|
1714
|
+
path: string;
|
|
1715
|
+
data?: any;
|
|
1716
|
+
query?: Record<string, any>;
|
|
1717
|
+
headers?: Record<string, string>;
|
|
1718
|
+
config?: Config;
|
|
1719
|
+
}): Promise<T>;
|
|
1720
|
+
/**
|
|
1721
|
+
* PUT request
|
|
1722
|
+
*/
|
|
1723
|
+
put<T = any>(params: {
|
|
1724
|
+
path: string;
|
|
1725
|
+
data?: any;
|
|
1726
|
+
query?: Record<string, any>;
|
|
1727
|
+
headers?: Record<string, string>;
|
|
1728
|
+
config?: Config;
|
|
1729
|
+
}): Promise<T>;
|
|
1730
|
+
/**
|
|
1731
|
+
* PATCH request
|
|
1732
|
+
*/
|
|
1733
|
+
patch<T = any>(params: {
|
|
1734
|
+
path: string;
|
|
1735
|
+
data?: any;
|
|
1736
|
+
query?: Record<string, any>;
|
|
1737
|
+
headers?: Record<string, string>;
|
|
1738
|
+
config?: Config;
|
|
1739
|
+
}): Promise<T>;
|
|
1740
|
+
/**
|
|
1741
|
+
* DELETE request
|
|
1742
|
+
*/
|
|
1743
|
+
delete<T = any>(params: {
|
|
1744
|
+
path: string;
|
|
1745
|
+
query?: Record<string, any>;
|
|
1746
|
+
headers?: Record<string, string>;
|
|
1747
|
+
config?: Config;
|
|
1748
|
+
}): Promise<T>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Check sandbox health
|
|
1751
|
+
*/
|
|
1752
|
+
checkHealth: (params: {
|
|
1753
|
+
sandboxId: string;
|
|
1754
|
+
config?: Config;
|
|
1755
|
+
}) => Promise<{
|
|
1756
|
+
status: string;
|
|
1757
|
+
[key: string]: any;
|
|
1758
|
+
}>;
|
|
1759
|
+
/**
|
|
1760
|
+
* Create sandbox from template
|
|
1761
|
+
*/
|
|
1762
|
+
createSandbox: (params: {
|
|
1763
|
+
templateName: string;
|
|
1764
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
1765
|
+
config?: Config;
|
|
1766
|
+
}) => Promise<any>;
|
|
1767
|
+
/**
|
|
1768
|
+
* Delete sandbox
|
|
1769
|
+
*/
|
|
1770
|
+
deleteSandbox: (params: {
|
|
1771
|
+
sandboxId: string;
|
|
1772
|
+
config?: Config;
|
|
1773
|
+
}) => Promise<any>;
|
|
1774
|
+
/**
|
|
1775
|
+
* Stop sandbox
|
|
1776
|
+
*/
|
|
1777
|
+
stopSandbox: (params: {
|
|
1778
|
+
sandboxId: string;
|
|
1779
|
+
config?: Config;
|
|
1780
|
+
}) => Promise<any>;
|
|
1781
|
+
/**
|
|
1782
|
+
* Get sandbox info
|
|
1783
|
+
*/
|
|
1784
|
+
getSandbox: (params: {
|
|
1785
|
+
sandboxId: string;
|
|
1786
|
+
config?: Config;
|
|
1787
|
+
}) => Promise<any>;
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* Browser Sandbox Data API
|
|
1792
|
+
*
|
|
1793
|
+
* This module provides data API methods for Browser sandboxes.
|
|
1794
|
+
* 此模块提供浏览器沙箱的数据 API 方法。
|
|
1795
|
+
*/
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* Browser Data API
|
|
1799
|
+
*
|
|
1800
|
+
* Provides methods for interacting with Browser sandbox data endpoints.
|
|
1801
|
+
*/
|
|
1802
|
+
declare class BrowserDataAPI extends SandboxDataAPI {
|
|
1803
|
+
protected sandboxId: string;
|
|
1804
|
+
constructor(params: {
|
|
1805
|
+
sandboxId: string;
|
|
1806
|
+
config?: Config;
|
|
1807
|
+
});
|
|
1808
|
+
/**
|
|
1809
|
+
* Generate the WebSocket URL for Chrome DevTools Protocol (CDP) connection
|
|
1810
|
+
*/
|
|
1811
|
+
getCdpUrl(record?: boolean): string;
|
|
1812
|
+
/**
|
|
1813
|
+
* Generate the WebSocket URL for VNC (Virtual Network Computing) live view connection
|
|
1814
|
+
*/
|
|
1815
|
+
getVncUrl(record?: boolean): string;
|
|
1816
|
+
/**
|
|
1817
|
+
* Get Playwright sync wrapper
|
|
1818
|
+
*
|
|
1819
|
+
* Note: Implementation pending - requires playwright integration
|
|
1820
|
+
*/
|
|
1821
|
+
syncPlaywright(params?: {
|
|
1822
|
+
browserType?: string;
|
|
1823
|
+
record?: boolean;
|
|
1824
|
+
config?: Config;
|
|
1825
|
+
}): any;
|
|
1826
|
+
/**
|
|
1827
|
+
* Get Playwright async wrapper
|
|
1828
|
+
*
|
|
1829
|
+
* Note: Implementation pending - requires playwright integration
|
|
1830
|
+
*/
|
|
1831
|
+
asyncPlaywright(params?: {
|
|
1832
|
+
browserType?: string;
|
|
1833
|
+
record?: boolean;
|
|
1834
|
+
config?: Config;
|
|
1835
|
+
}): any;
|
|
1836
|
+
/**
|
|
1837
|
+
* List all recordings
|
|
1838
|
+
*/
|
|
1839
|
+
listRecordings: (params?: {
|
|
1840
|
+
config?: Config;
|
|
1841
|
+
}) => Promise<any>;
|
|
1842
|
+
/**
|
|
1843
|
+
* Delete a recording
|
|
1844
|
+
*/
|
|
1845
|
+
deleteRecording: (params: {
|
|
1846
|
+
filename: string;
|
|
1847
|
+
config?: Config;
|
|
1848
|
+
}) => Promise<any>;
|
|
1849
|
+
/**
|
|
1850
|
+
* Download a recording video file
|
|
1851
|
+
*/
|
|
1852
|
+
downloadRecording: (params: {
|
|
1853
|
+
filename: string;
|
|
1854
|
+
savePath: string;
|
|
1855
|
+
}) => Promise<{
|
|
1856
|
+
savedPath: string;
|
|
1857
|
+
size: number;
|
|
1858
|
+
}>;
|
|
1859
|
+
/**
|
|
1860
|
+
* Helper method to download video file
|
|
1861
|
+
*/
|
|
1862
|
+
protected getVideo(params: {
|
|
1863
|
+
path: string;
|
|
1864
|
+
savePath: string;
|
|
1865
|
+
query?: Record<string, any>;
|
|
1866
|
+
headers?: Record<string, string>;
|
|
1867
|
+
config?: Config;
|
|
1868
|
+
}): Promise<{
|
|
1869
|
+
savedPath: string;
|
|
1870
|
+
size: number;
|
|
1871
|
+
}>;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* Sandbox Data Models
|
|
1876
|
+
*
|
|
1877
|
+
* 此模块定义 Sandbox 相关的所有数据模型。
|
|
1878
|
+
* This module defines all data models related to Sandbox.
|
|
1879
|
+
*/
|
|
1880
|
+
|
|
1881
|
+
/**
|
|
1882
|
+
* Template type enum
|
|
1883
|
+
*/
|
|
1884
|
+
declare enum TemplateType {
|
|
1885
|
+
CODE_INTERPRETER = "CodeInterpreter",
|
|
1886
|
+
BROWSER = "Browser",
|
|
1887
|
+
AIO = "AllInOne"
|
|
1888
|
+
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Sandbox state enum
|
|
1891
|
+
*/
|
|
1892
|
+
declare enum SandboxState {
|
|
1893
|
+
CREATING = "Creating",
|
|
1894
|
+
RUNNING = "Running",
|
|
1895
|
+
READY = "READY",// API返回的就绪状态,等同于Running
|
|
1896
|
+
STOPPED = "Stopped",
|
|
1897
|
+
FAILED = "Failed",
|
|
1898
|
+
DELETING = "Deleting"
|
|
1899
|
+
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Template network mode enum
|
|
1902
|
+
*/
|
|
1903
|
+
declare enum TemplateNetworkMode {
|
|
1904
|
+
PUBLIC = "PUBLIC",
|
|
1905
|
+
PRIVATE = "PRIVATE",
|
|
1906
|
+
PUBLIC_AND_PRIVATE = "PUBLIC_AND_PRIVATE"
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* OSS permission enum
|
|
1910
|
+
*/
|
|
1911
|
+
declare enum TemplateOSSPermission {
|
|
1912
|
+
READ_WRITE = "READ_WRITE",
|
|
1913
|
+
READ_ONLY = "READ_ONLY"
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Code language enum
|
|
1917
|
+
*/
|
|
1918
|
+
declare enum CodeLanguage {
|
|
1919
|
+
PYTHON = "python"
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Template network configuration
|
|
1923
|
+
*/
|
|
1924
|
+
interface TemplateNetworkConfiguration {
|
|
1925
|
+
networkMode?: TemplateNetworkMode;
|
|
1926
|
+
securityGroupId?: string;
|
|
1927
|
+
vpcId?: string;
|
|
1928
|
+
vswitchIds?: string[];
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Template OSS configuration
|
|
1932
|
+
*/
|
|
1933
|
+
interface TemplateOssConfiguration {
|
|
1934
|
+
bucketName: string;
|
|
1935
|
+
mountPoint: string;
|
|
1936
|
+
permission?: TemplateOSSPermission;
|
|
1937
|
+
prefix: string;
|
|
1938
|
+
region: string;
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Template log configuration
|
|
1942
|
+
*/
|
|
1943
|
+
interface TemplateLogConfiguration {
|
|
1944
|
+
project?: string;
|
|
1945
|
+
logstore?: string;
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Template credential configuration
|
|
1949
|
+
*/
|
|
1950
|
+
interface TemplateCredentialConfiguration {
|
|
1951
|
+
credentialName?: string;
|
|
1952
|
+
}
|
|
1953
|
+
/**
|
|
1954
|
+
* Template ARMS configuration
|
|
1955
|
+
*/
|
|
1956
|
+
interface TemplateArmsConfiguration {
|
|
1957
|
+
armsLicenseKey?: string;
|
|
1958
|
+
enableArms: boolean;
|
|
1959
|
+
}
|
|
1960
|
+
/**
|
|
1961
|
+
* Template container configuration
|
|
1962
|
+
*/
|
|
1963
|
+
interface TemplateContainerConfiguration {
|
|
1964
|
+
image?: string;
|
|
1965
|
+
command?: string[];
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Template MCP options
|
|
1969
|
+
*/
|
|
1970
|
+
interface TemplateMcpOptions {
|
|
1971
|
+
enabledTools?: string[];
|
|
1972
|
+
transport?: string;
|
|
1973
|
+
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Template MCP state
|
|
1976
|
+
*/
|
|
1977
|
+
interface TemplateMcpState {
|
|
1978
|
+
accessEndpoint?: string;
|
|
1979
|
+
status?: string;
|
|
1980
|
+
statusReason?: string;
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Template create input
|
|
1984
|
+
*/
|
|
1985
|
+
interface TemplateCreateInput {
|
|
1986
|
+
templateName?: string;
|
|
1987
|
+
templateType: TemplateType;
|
|
1988
|
+
cpu?: number;
|
|
1989
|
+
memory?: number;
|
|
1990
|
+
executionRoleArn?: string;
|
|
1991
|
+
sandboxIdleTimeoutInSeconds?: number;
|
|
1992
|
+
sandboxTtlInSeconds?: number;
|
|
1993
|
+
shareConcurrencyLimitPerSandbox?: number;
|
|
1994
|
+
templateConfiguration?: Record<string, unknown>;
|
|
1995
|
+
description?: string;
|
|
1996
|
+
environmentVariables?: Record<string, string>;
|
|
1997
|
+
networkConfiguration?: TemplateNetworkConfiguration;
|
|
1998
|
+
ossConfiguration?: TemplateOssConfiguration[];
|
|
1999
|
+
logConfiguration?: TemplateLogConfiguration;
|
|
2000
|
+
credentialConfiguration?: TemplateCredentialConfiguration;
|
|
2001
|
+
armsConfiguration?: TemplateArmsConfiguration;
|
|
2002
|
+
containerConfiguration?: TemplateContainerConfiguration;
|
|
2003
|
+
diskSize?: number;
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Template update input
|
|
2007
|
+
*/
|
|
2008
|
+
interface TemplateUpdateInput {
|
|
2009
|
+
cpu?: number;
|
|
2010
|
+
memory?: number;
|
|
2011
|
+
executionRoleArn?: string;
|
|
2012
|
+
sandboxIdleTimeoutInSeconds?: number;
|
|
2013
|
+
sandboxTtlInSeconds?: number;
|
|
2014
|
+
shareConcurrencyLimitPerSandbox?: number;
|
|
2015
|
+
description?: string;
|
|
2016
|
+
environmentVariables?: Record<string, string>;
|
|
2017
|
+
networkConfiguration?: TemplateNetworkConfiguration;
|
|
2018
|
+
ossConfiguration?: TemplateOssConfiguration[];
|
|
2019
|
+
logConfiguration?: TemplateLogConfiguration;
|
|
2020
|
+
credentialConfiguration?: TemplateCredentialConfiguration;
|
|
2021
|
+
armsConfiguration?: TemplateArmsConfiguration;
|
|
2022
|
+
containerConfiguration?: TemplateContainerConfiguration;
|
|
2023
|
+
diskSize?: number;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Template list input
|
|
2027
|
+
*/
|
|
2028
|
+
interface TemplateListInput extends PageableInput {
|
|
2029
|
+
templateType?: TemplateType;
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Sandbox create input
|
|
2033
|
+
*/
|
|
2034
|
+
interface SandboxCreateInput {
|
|
2035
|
+
templateName: string;
|
|
2036
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Sandbox list input
|
|
2040
|
+
*/
|
|
2041
|
+
interface SandboxListInput {
|
|
2042
|
+
maxResults?: number;
|
|
2043
|
+
nextToken?: string;
|
|
2044
|
+
status?: string;
|
|
2045
|
+
templateName?: string;
|
|
2046
|
+
templateType?: TemplateType;
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Template data
|
|
2050
|
+
*/
|
|
2051
|
+
interface TemplateData {
|
|
2052
|
+
templateArn?: string;
|
|
2053
|
+
templateId?: string;
|
|
2054
|
+
templateName?: string;
|
|
2055
|
+
templateType?: TemplateType;
|
|
2056
|
+
cpu?: number;
|
|
2057
|
+
memory?: number;
|
|
2058
|
+
createdAt?: string;
|
|
2059
|
+
description?: string;
|
|
2060
|
+
executionRoleArn?: string;
|
|
2061
|
+
lastUpdatedAt?: string;
|
|
2062
|
+
resourceName?: string;
|
|
2063
|
+
sandboxIdleTimeoutInSeconds?: number;
|
|
2064
|
+
sandboxTtlInSeconds?: number;
|
|
2065
|
+
shareConcurrencyLimitPerSandbox?: number;
|
|
2066
|
+
status?: Status;
|
|
2067
|
+
statusReason?: string;
|
|
2068
|
+
diskSize?: number;
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Sandbox data
|
|
2072
|
+
*/
|
|
2073
|
+
interface SandboxData {
|
|
2074
|
+
sandboxId?: string;
|
|
2075
|
+
sandboxName?: string;
|
|
2076
|
+
templateId?: string;
|
|
2077
|
+
templateName?: string;
|
|
2078
|
+
state?: SandboxState;
|
|
2079
|
+
stateReason?: string;
|
|
2080
|
+
createdAt?: string;
|
|
2081
|
+
lastUpdatedAt?: string;
|
|
2082
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2083
|
+
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Code execution result
|
|
2086
|
+
*/
|
|
2087
|
+
interface ExecuteCodeResult {
|
|
2088
|
+
stdout?: string;
|
|
2089
|
+
stderr?: string;
|
|
2090
|
+
exitCode?: number;
|
|
2091
|
+
error?: string;
|
|
2092
|
+
}
|
|
2093
|
+
/**
|
|
2094
|
+
* File info
|
|
2095
|
+
*/
|
|
2096
|
+
interface FileInfo {
|
|
2097
|
+
name: string;
|
|
2098
|
+
path: string;
|
|
2099
|
+
size?: number;
|
|
2100
|
+
isDirectory?: boolean;
|
|
2101
|
+
modifiedAt?: string;
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* Base Sandbox Resource
|
|
2106
|
+
*
|
|
2107
|
+
* 此模块定义基础 Sandbox 资源类。
|
|
2108
|
+
* This module defines the base Sandbox resource class.
|
|
2109
|
+
*/
|
|
2110
|
+
|
|
2111
|
+
/**
|
|
2112
|
+
* Base Sandbox resource class
|
|
2113
|
+
*/
|
|
2114
|
+
declare class Sandbox implements SandboxData {
|
|
2115
|
+
sandboxId?: string;
|
|
2116
|
+
sandboxName?: string;
|
|
2117
|
+
templateId?: string;
|
|
2118
|
+
templateName?: string;
|
|
2119
|
+
state?: SandboxState;
|
|
2120
|
+
stateReason?: string;
|
|
2121
|
+
createdAt?: string;
|
|
2122
|
+
lastUpdatedAt?: string;
|
|
2123
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2124
|
+
protected _config?: Config;
|
|
2125
|
+
constructor(data?: Partial<SandboxData>, config?: Config);
|
|
2126
|
+
/**
|
|
2127
|
+
* Create sandbox from SDK response object
|
|
2128
|
+
*/
|
|
2129
|
+
static fromInnerObject(obj: any, config?: Config): Sandbox;
|
|
2130
|
+
protected static getClient(config?: Config): $AgentRun.default;
|
|
2131
|
+
/**
|
|
2132
|
+
* Create a new Sandbox
|
|
2133
|
+
*/
|
|
2134
|
+
static create(input: SandboxCreateInput, config?: Config): Promise<Sandbox>;
|
|
2135
|
+
/**
|
|
2136
|
+
* Delete a Sandbox by ID
|
|
2137
|
+
*/
|
|
2138
|
+
static delete(params: {
|
|
2139
|
+
id: string;
|
|
2140
|
+
config?: Config;
|
|
2141
|
+
}): Promise<Sandbox>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Stop a Sandbox by ID
|
|
2144
|
+
*/
|
|
2145
|
+
static stop(params: {
|
|
2146
|
+
id: string;
|
|
2147
|
+
config?: Config;
|
|
2148
|
+
}): Promise<Sandbox>;
|
|
2149
|
+
/**
|
|
2150
|
+
* Get a Sandbox by ID
|
|
2151
|
+
*/
|
|
2152
|
+
static get(params: {
|
|
2153
|
+
id: string;
|
|
2154
|
+
config?: Config;
|
|
2155
|
+
}): Promise<Sandbox>;
|
|
2156
|
+
/**
|
|
2157
|
+
* List Sandboxes
|
|
2158
|
+
*/
|
|
2159
|
+
static list(input?: SandboxListInput, config?: Config): Promise<Sandbox[]>;
|
|
2160
|
+
/**
|
|
2161
|
+
* Handle API errors
|
|
2162
|
+
*/
|
|
2163
|
+
protected static handleError(error: unknown): never;
|
|
2164
|
+
/**
|
|
2165
|
+
* Delete this sandbox
|
|
2166
|
+
*/
|
|
2167
|
+
delete: (params?: {
|
|
2168
|
+
config?: Config;
|
|
2169
|
+
}) => Promise<Sandbox>;
|
|
2170
|
+
/**
|
|
2171
|
+
* Stop this sandbox
|
|
2172
|
+
*/
|
|
2173
|
+
stop: (params?: {
|
|
2174
|
+
config?: Config;
|
|
2175
|
+
}) => Promise<Sandbox>;
|
|
2176
|
+
/**
|
|
2177
|
+
* Refresh this sandbox's data
|
|
2178
|
+
*/
|
|
2179
|
+
refresh: (params?: {
|
|
2180
|
+
config?: Config;
|
|
2181
|
+
}) => Promise<Sandbox>;
|
|
2182
|
+
/**
|
|
2183
|
+
* Wait until the sandbox is running
|
|
2184
|
+
*/
|
|
2185
|
+
waitUntilRunning: (options?: {
|
|
2186
|
+
timeoutSeconds?: number;
|
|
2187
|
+
intervalSeconds?: number;
|
|
2188
|
+
beforeCheck?: (sandbox: Sandbox) => void;
|
|
2189
|
+
}, config?: Config) => Promise<Sandbox>;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Browser Sandbox
|
|
2194
|
+
*
|
|
2195
|
+
* High-level API for browser sandboxes with CDP/VNC connectivity
|
|
2196
|
+
* and recording management.
|
|
2197
|
+
*/
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* Browser Sandbox
|
|
2201
|
+
*
|
|
2202
|
+
* High-level API for interacting with browser sandboxes.
|
|
2203
|
+
*/
|
|
2204
|
+
declare class BrowserSandbox extends Sandbox {
|
|
2205
|
+
static templateType: TemplateType;
|
|
2206
|
+
/**
|
|
2207
|
+
* Create a Browser Sandbox from template
|
|
2208
|
+
*/
|
|
2209
|
+
static createFromTemplate(templateName: string, options?: {
|
|
2210
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2211
|
+
}, config?: Config): Promise<BrowserSandbox>;
|
|
2212
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
2213
|
+
private _dataApi?;
|
|
2214
|
+
/**
|
|
2215
|
+
* Get data API client
|
|
2216
|
+
*/
|
|
2217
|
+
get dataApi(): BrowserDataAPI;
|
|
2218
|
+
/**
|
|
2219
|
+
* Check sandbox health
|
|
2220
|
+
*/
|
|
2221
|
+
checkHealth: (params?: {
|
|
2222
|
+
config?: Config;
|
|
2223
|
+
}) => Promise<{
|
|
2224
|
+
status: string;
|
|
2225
|
+
[key: string]: any;
|
|
2226
|
+
}>;
|
|
2227
|
+
/**
|
|
2228
|
+
* Wait for browser sandbox to be ready (polls health check)
|
|
2229
|
+
*/
|
|
2230
|
+
waitUntilReady: (params?: {
|
|
2231
|
+
maxRetries?: number;
|
|
2232
|
+
retryIntervalMs?: number;
|
|
2233
|
+
}) => Promise<void>;
|
|
2234
|
+
/**
|
|
2235
|
+
* Get CDP WebSocket URL for browser automation
|
|
2236
|
+
*/
|
|
2237
|
+
getCdpUrl(record?: boolean): string;
|
|
2238
|
+
/**
|
|
2239
|
+
* Get VNC WebSocket URL for live view
|
|
2240
|
+
*/
|
|
2241
|
+
getVncUrl(record?: boolean): string;
|
|
2242
|
+
/**
|
|
2243
|
+
* Get Playwright sync wrapper
|
|
2244
|
+
*
|
|
2245
|
+
* Note: Implementation pending - requires playwright integration
|
|
2246
|
+
*/
|
|
2247
|
+
syncPlaywright(params?: {
|
|
2248
|
+
browserType?: string;
|
|
2249
|
+
record?: boolean;
|
|
2250
|
+
config?: Config;
|
|
2251
|
+
}): any;
|
|
2252
|
+
/**
|
|
2253
|
+
* Get Playwright async wrapper
|
|
2254
|
+
*
|
|
2255
|
+
* Note: Implementation pending - requires playwright integration
|
|
2256
|
+
*/
|
|
2257
|
+
asyncPlaywright(params?: {
|
|
2258
|
+
browserType?: string;
|
|
2259
|
+
record?: boolean;
|
|
2260
|
+
config?: Config;
|
|
2261
|
+
}): any;
|
|
2262
|
+
/**
|
|
2263
|
+
* List all recordings
|
|
2264
|
+
*/
|
|
2265
|
+
listRecordings: (params?: {
|
|
2266
|
+
config?: Config;
|
|
2267
|
+
}) => Promise<any>;
|
|
2268
|
+
/**
|
|
2269
|
+
* Download a recording video file
|
|
2270
|
+
*/
|
|
2271
|
+
downloadRecording: (params: {
|
|
2272
|
+
filename: string;
|
|
2273
|
+
savePath: string;
|
|
2274
|
+
}) => Promise<{
|
|
2275
|
+
savedPath: string;
|
|
2276
|
+
size: number;
|
|
2277
|
+
}>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Delete a recording
|
|
2280
|
+
*/
|
|
2281
|
+
deleteRecording: (params: {
|
|
2282
|
+
filename: string;
|
|
2283
|
+
config?: Config;
|
|
2284
|
+
}) => Promise<any>;
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
/**
|
|
2288
|
+
* Code Interpreter Sandbox Data API
|
|
2289
|
+
*
|
|
2290
|
+
* This module provides data API methods for Code Interpreter sandboxes.
|
|
2291
|
+
* 此模块提供代码解释器沙箱的数据 API 方法。
|
|
2292
|
+
*/
|
|
2293
|
+
|
|
2294
|
+
/**
|
|
2295
|
+
* Code Interpreter Data API
|
|
2296
|
+
*
|
|
2297
|
+
* Provides methods for interacting with Code Interpreter sandbox data endpoints.
|
|
2298
|
+
*/
|
|
2299
|
+
declare class CodeInterpreterDataAPI extends SandboxDataAPI {
|
|
2300
|
+
constructor(params: {
|
|
2301
|
+
sandboxId: string;
|
|
2302
|
+
config?: Config;
|
|
2303
|
+
});
|
|
2304
|
+
/**
|
|
2305
|
+
* List directory contents
|
|
2306
|
+
*/
|
|
2307
|
+
listDirectory(params?: {
|
|
2308
|
+
path?: string;
|
|
2309
|
+
depth?: number;
|
|
2310
|
+
config?: Config;
|
|
2311
|
+
}): Promise<any>;
|
|
2312
|
+
/**
|
|
2313
|
+
* Get file/directory stats
|
|
2314
|
+
*/
|
|
2315
|
+
stat(params: {
|
|
2316
|
+
path: string;
|
|
2317
|
+
config?: Config;
|
|
2318
|
+
}): Promise<any>;
|
|
2319
|
+
/**
|
|
2320
|
+
* Create directory
|
|
2321
|
+
*/
|
|
2322
|
+
mkdir(params: {
|
|
2323
|
+
path: string;
|
|
2324
|
+
parents?: boolean;
|
|
2325
|
+
mode?: string;
|
|
2326
|
+
config?: Config;
|
|
2327
|
+
}): Promise<any>;
|
|
2328
|
+
/**
|
|
2329
|
+
* Move file or directory
|
|
2330
|
+
*/
|
|
2331
|
+
moveFile(params: {
|
|
2332
|
+
source: string;
|
|
2333
|
+
destination: string;
|
|
2334
|
+
config?: Config;
|
|
2335
|
+
}): Promise<any>;
|
|
2336
|
+
/**
|
|
2337
|
+
* Remove file or directory
|
|
2338
|
+
*/
|
|
2339
|
+
removeFile(params: {
|
|
2340
|
+
path: string;
|
|
2341
|
+
config?: Config;
|
|
2342
|
+
}): Promise<any>;
|
|
2343
|
+
/**
|
|
2344
|
+
* List code execution contexts
|
|
2345
|
+
*/
|
|
2346
|
+
listContexts(params?: {
|
|
2347
|
+
config?: Config;
|
|
2348
|
+
}): Promise<any>;
|
|
2349
|
+
/**
|
|
2350
|
+
* Create a new code execution context
|
|
2351
|
+
*/
|
|
2352
|
+
createContext(params?: {
|
|
2353
|
+
language?: CodeLanguage;
|
|
2354
|
+
cwd?: string;
|
|
2355
|
+
config?: Config;
|
|
2356
|
+
}): Promise<any>;
|
|
2357
|
+
/**
|
|
2358
|
+
* Get context details
|
|
2359
|
+
*/
|
|
2360
|
+
getContext(params: {
|
|
2361
|
+
contextId: string;
|
|
2362
|
+
config?: Config;
|
|
2363
|
+
}): Promise<any>;
|
|
2364
|
+
/**
|
|
2365
|
+
* Execute code in a context
|
|
2366
|
+
*/
|
|
2367
|
+
executeCode(params: {
|
|
2368
|
+
code: string;
|
|
2369
|
+
contextId?: string;
|
|
2370
|
+
language?: CodeLanguage;
|
|
2371
|
+
timeout?: number;
|
|
2372
|
+
config?: Config;
|
|
2373
|
+
}): Promise<any>;
|
|
2374
|
+
/**
|
|
2375
|
+
* Delete a context
|
|
2376
|
+
*/
|
|
2377
|
+
deleteContext(params: {
|
|
2378
|
+
contextId: string;
|
|
2379
|
+
config?: Config;
|
|
2380
|
+
}): Promise<any>;
|
|
2381
|
+
/**
|
|
2382
|
+
* Read file contents
|
|
2383
|
+
*/
|
|
2384
|
+
readFile(params: {
|
|
2385
|
+
path: string;
|
|
2386
|
+
config?: Config;
|
|
2387
|
+
}): Promise<any>;
|
|
2388
|
+
/**
|
|
2389
|
+
* Write file contents
|
|
2390
|
+
*/
|
|
2391
|
+
writeFile(params: {
|
|
2392
|
+
path: string;
|
|
2393
|
+
content: string;
|
|
2394
|
+
mode?: string;
|
|
2395
|
+
encoding?: string;
|
|
2396
|
+
createDir?: boolean;
|
|
2397
|
+
config?: Config;
|
|
2398
|
+
}): Promise<any>;
|
|
2399
|
+
/**
|
|
2400
|
+
* Upload file to sandbox
|
|
2401
|
+
*/
|
|
2402
|
+
uploadFile(params: {
|
|
2403
|
+
localFilePath: string;
|
|
2404
|
+
targetFilePath: string;
|
|
2405
|
+
config?: Config;
|
|
2406
|
+
}): Promise<any>;
|
|
2407
|
+
/**
|
|
2408
|
+
* Download file from sandbox
|
|
2409
|
+
*/
|
|
2410
|
+
downloadFile(params: {
|
|
2411
|
+
path: string;
|
|
2412
|
+
savePath: string;
|
|
2413
|
+
config?: Config;
|
|
2414
|
+
}): Promise<{
|
|
2415
|
+
savedPath: string;
|
|
2416
|
+
size: number;
|
|
2417
|
+
}>;
|
|
2418
|
+
/**
|
|
2419
|
+
* Execute shell command
|
|
2420
|
+
*/
|
|
2421
|
+
cmd(params: {
|
|
2422
|
+
command: string;
|
|
2423
|
+
cwd: string;
|
|
2424
|
+
timeout?: number;
|
|
2425
|
+
config?: Config;
|
|
2426
|
+
}): Promise<any>;
|
|
2427
|
+
/**
|
|
2428
|
+
* List running processes
|
|
2429
|
+
*/
|
|
2430
|
+
listProcesses(params?: {
|
|
2431
|
+
config?: Config;
|
|
2432
|
+
}): Promise<any>;
|
|
2433
|
+
/**
|
|
2434
|
+
* Get process details
|
|
2435
|
+
*/
|
|
2436
|
+
getProcess(params: {
|
|
2437
|
+
pid: string;
|
|
2438
|
+
config?: Config;
|
|
2439
|
+
}): Promise<any>;
|
|
2440
|
+
/**
|
|
2441
|
+
* Kill a process
|
|
2442
|
+
*/
|
|
2443
|
+
killProcess(params: {
|
|
2444
|
+
pid: string;
|
|
2445
|
+
config?: Config;
|
|
2446
|
+
}): Promise<any>;
|
|
2447
|
+
/**
|
|
2448
|
+
* Helper method to upload file using multipart/form-data
|
|
2449
|
+
*/
|
|
2450
|
+
protected postFile(params: {
|
|
2451
|
+
path: string;
|
|
2452
|
+
localFilePath: string;
|
|
2453
|
+
targetFilePath: string;
|
|
2454
|
+
formData?: Record<string, any>;
|
|
2455
|
+
query?: Record<string, any>;
|
|
2456
|
+
headers?: Record<string, string>;
|
|
2457
|
+
config?: Config;
|
|
2458
|
+
}): Promise<any>;
|
|
2459
|
+
/**
|
|
2460
|
+
* Helper method to download file
|
|
2461
|
+
*/
|
|
2462
|
+
protected getFile(params: {
|
|
2463
|
+
path: string;
|
|
2464
|
+
savePath: string;
|
|
2465
|
+
query?: Record<string, any>;
|
|
2466
|
+
headers?: Record<string, string>;
|
|
2467
|
+
config?: Config;
|
|
2468
|
+
}): Promise<{
|
|
2469
|
+
savedPath: string;
|
|
2470
|
+
size: number;
|
|
2471
|
+
}>;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
/**
|
|
2475
|
+
* Code Interpreter Sandbox
|
|
2476
|
+
*
|
|
2477
|
+
* High-level API for code interpreter sandboxes with file, filesystem,
|
|
2478
|
+
* context, and process management operations.
|
|
2479
|
+
*/
|
|
2480
|
+
|
|
2481
|
+
/**
|
|
2482
|
+
* File upload/download operations
|
|
2483
|
+
*/
|
|
2484
|
+
declare class FileOperations {
|
|
2485
|
+
private sandbox;
|
|
2486
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
2487
|
+
/**
|
|
2488
|
+
* Read a file from the code interpreter
|
|
2489
|
+
*/
|
|
2490
|
+
read: (params: {
|
|
2491
|
+
path: string;
|
|
2492
|
+
}) => Promise<any>;
|
|
2493
|
+
/**
|
|
2494
|
+
* Write a file to the code interpreter
|
|
2495
|
+
*/
|
|
2496
|
+
write: (params: {
|
|
2497
|
+
path: string;
|
|
2498
|
+
content: string;
|
|
2499
|
+
mode?: string;
|
|
2500
|
+
encoding?: string;
|
|
2501
|
+
createDir?: boolean;
|
|
2502
|
+
}) => Promise<any>;
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* File system operations (list, move, remove, stat, mkdir)
|
|
2506
|
+
*/
|
|
2507
|
+
declare class FileSystemOperations {
|
|
2508
|
+
private sandbox;
|
|
2509
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
2510
|
+
/**
|
|
2511
|
+
* List directory contents
|
|
2512
|
+
*/
|
|
2513
|
+
list: (params?: {
|
|
2514
|
+
path?: string;
|
|
2515
|
+
depth?: number;
|
|
2516
|
+
}) => Promise<any>;
|
|
2517
|
+
/**
|
|
2518
|
+
* Move a file or directory
|
|
2519
|
+
*/
|
|
2520
|
+
move: (params: {
|
|
2521
|
+
source: string;
|
|
2522
|
+
destination: string;
|
|
2523
|
+
}) => Promise<any>;
|
|
2524
|
+
/**
|
|
2525
|
+
* Remove a file or directory
|
|
2526
|
+
*/
|
|
2527
|
+
remove: (params: {
|
|
2528
|
+
path: string;
|
|
2529
|
+
}) => Promise<any>;
|
|
2530
|
+
/**
|
|
2531
|
+
* Get file or directory statistics
|
|
2532
|
+
*/
|
|
2533
|
+
stat: (params: {
|
|
2534
|
+
path: string;
|
|
2535
|
+
}) => Promise<any>;
|
|
2536
|
+
/**
|
|
2537
|
+
* Create a directory
|
|
2538
|
+
*/
|
|
2539
|
+
mkdir: (params: {
|
|
2540
|
+
path: string;
|
|
2541
|
+
parents?: boolean;
|
|
2542
|
+
mode?: string;
|
|
2543
|
+
}) => Promise<any>;
|
|
2544
|
+
/**
|
|
2545
|
+
* Upload a file to the code interpreter
|
|
2546
|
+
*/
|
|
2547
|
+
upload: (params: {
|
|
2548
|
+
localFilePath: string;
|
|
2549
|
+
targetFilePath: string;
|
|
2550
|
+
}) => Promise<any>;
|
|
2551
|
+
/**
|
|
2552
|
+
* Download a file from the code interpreter
|
|
2553
|
+
*/
|
|
2554
|
+
download: (params: {
|
|
2555
|
+
path: string;
|
|
2556
|
+
savePath: string;
|
|
2557
|
+
}) => Promise<{
|
|
2558
|
+
savedPath: string;
|
|
2559
|
+
size: number;
|
|
2560
|
+
}>;
|
|
2561
|
+
}
|
|
2562
|
+
/**
|
|
2563
|
+
* Process management operations
|
|
2564
|
+
*/
|
|
2565
|
+
declare class ProcessOperations {
|
|
2566
|
+
private sandbox;
|
|
2567
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
2568
|
+
/**
|
|
2569
|
+
* Execute a command in the code interpreter
|
|
2570
|
+
*/
|
|
2571
|
+
cmd: (params: {
|
|
2572
|
+
command: string;
|
|
2573
|
+
cwd: string;
|
|
2574
|
+
timeout?: number;
|
|
2575
|
+
}) => Promise<any>;
|
|
2576
|
+
/**
|
|
2577
|
+
* List all processes
|
|
2578
|
+
*/
|
|
2579
|
+
list: (params?: {
|
|
2580
|
+
config?: Config;
|
|
2581
|
+
}) => Promise<any>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Get a specific process by PID
|
|
2584
|
+
*/
|
|
2585
|
+
get: (params: {
|
|
2586
|
+
pid: string;
|
|
2587
|
+
}) => Promise<any>;
|
|
2588
|
+
/**
|
|
2589
|
+
* Kill a specific process by PID
|
|
2590
|
+
*/
|
|
2591
|
+
kill: (params: {
|
|
2592
|
+
pid: string;
|
|
2593
|
+
}) => Promise<any>;
|
|
2594
|
+
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Context management operations
|
|
2597
|
+
*/
|
|
2598
|
+
declare class ContextOperations {
|
|
2599
|
+
private sandbox;
|
|
2600
|
+
private _contextId?;
|
|
2601
|
+
private _language?;
|
|
2602
|
+
private _cwd?;
|
|
2603
|
+
constructor(sandbox: CodeInterpreterSandbox);
|
|
2604
|
+
/**
|
|
2605
|
+
* Get the current context ID
|
|
2606
|
+
*/
|
|
2607
|
+
get contextId(): string | undefined;
|
|
2608
|
+
/**
|
|
2609
|
+
* List all contexts
|
|
2610
|
+
*/
|
|
2611
|
+
list: (params?: {
|
|
2612
|
+
config?: Config;
|
|
2613
|
+
}) => Promise<any>;
|
|
2614
|
+
/**
|
|
2615
|
+
* Create a new context and save its ID
|
|
2616
|
+
*/
|
|
2617
|
+
create: (params?: {
|
|
2618
|
+
language?: CodeLanguage;
|
|
2619
|
+
cwd?: string;
|
|
2620
|
+
}) => Promise<ContextOperations>;
|
|
2621
|
+
/**
|
|
2622
|
+
* Get a specific context by ID
|
|
2623
|
+
*/
|
|
2624
|
+
get: (params?: {
|
|
2625
|
+
contextId?: string;
|
|
2626
|
+
}) => Promise<ContextOperations>;
|
|
2627
|
+
/**
|
|
2628
|
+
* Execute code in a context
|
|
2629
|
+
*/
|
|
2630
|
+
execute: (params: {
|
|
2631
|
+
code: string;
|
|
2632
|
+
language?: CodeLanguage;
|
|
2633
|
+
contextId?: string;
|
|
2634
|
+
timeout?: number;
|
|
2635
|
+
}) => Promise<any>;
|
|
2636
|
+
/**
|
|
2637
|
+
* Delete a context
|
|
2638
|
+
*/
|
|
2639
|
+
delete: (params?: {
|
|
2640
|
+
contextId?: string;
|
|
2641
|
+
}) => Promise<any>;
|
|
2642
|
+
}
|
|
2643
|
+
/**
|
|
2644
|
+
* Code Interpreter Sandbox
|
|
2645
|
+
*
|
|
2646
|
+
* High-level API for interacting with code interpreter sandboxes.
|
|
2647
|
+
*/
|
|
2648
|
+
declare class CodeInterpreterSandbox extends Sandbox {
|
|
2649
|
+
static templateType: TemplateType;
|
|
2650
|
+
/**
|
|
2651
|
+
* Create a Code Interpreter Sandbox from template
|
|
2652
|
+
*/
|
|
2653
|
+
static createFromTemplate(templateName: string, options?: {
|
|
2654
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2655
|
+
}, config?: Config): Promise<CodeInterpreterSandbox>;
|
|
2656
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
2657
|
+
private _dataApi?;
|
|
2658
|
+
private _file?;
|
|
2659
|
+
private _fileSystem?;
|
|
2660
|
+
private _context?;
|
|
2661
|
+
private _process?;
|
|
2662
|
+
/**
|
|
2663
|
+
* Get data API client
|
|
2664
|
+
*/
|
|
2665
|
+
get dataApi(): CodeInterpreterDataAPI;
|
|
2666
|
+
/**
|
|
2667
|
+
* Access file upload/download operations
|
|
2668
|
+
*/
|
|
2669
|
+
get file(): FileOperations;
|
|
2670
|
+
/**
|
|
2671
|
+
* Access file system operations
|
|
2672
|
+
*/
|
|
2673
|
+
get fileSystem(): FileSystemOperations;
|
|
2674
|
+
/**
|
|
2675
|
+
* Access context management operations
|
|
2676
|
+
*/
|
|
2677
|
+
get context(): ContextOperations;
|
|
2678
|
+
/**
|
|
2679
|
+
* Access process management operations
|
|
2680
|
+
*/
|
|
2681
|
+
get process(): ProcessOperations;
|
|
2682
|
+
/**
|
|
2683
|
+
* Check sandbox health
|
|
2684
|
+
*/
|
|
2685
|
+
checkHealth: (params?: {
|
|
2686
|
+
config?: Config;
|
|
2687
|
+
}) => Promise<{
|
|
2688
|
+
status: string;
|
|
2689
|
+
[key: string]: any;
|
|
2690
|
+
}>;
|
|
2691
|
+
/**
|
|
2692
|
+
* Wait for sandbox to be ready (polls health check)
|
|
2693
|
+
*/
|
|
2694
|
+
waitUntilReady: (params?: {
|
|
2695
|
+
maxRetries?: number;
|
|
2696
|
+
retryIntervalMs?: number;
|
|
2697
|
+
}) => Promise<void>;
|
|
2698
|
+
/**
|
|
2699
|
+
* Execute code (convenience method delegating to context.execute)
|
|
2700
|
+
*/
|
|
2701
|
+
execute: (params: {
|
|
2702
|
+
code: string;
|
|
2703
|
+
language?: CodeLanguage;
|
|
2704
|
+
contextId?: string;
|
|
2705
|
+
timeout?: number;
|
|
2706
|
+
}) => Promise<any>;
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
/**
|
|
2710
|
+
* Template Resource
|
|
2711
|
+
*
|
|
2712
|
+
* 此模块定义 Template 资源类。
|
|
2713
|
+
* This module defines the Template resource class.
|
|
2714
|
+
*/
|
|
2715
|
+
|
|
2716
|
+
/**
|
|
2717
|
+
* Template resource class
|
|
2718
|
+
*/
|
|
2719
|
+
declare class Template implements TemplateData {
|
|
2720
|
+
templateArn?: string;
|
|
2721
|
+
templateId?: string;
|
|
2722
|
+
templateName?: string;
|
|
2723
|
+
templateType?: TemplateType;
|
|
2724
|
+
cpu?: number;
|
|
2725
|
+
memory?: number;
|
|
2726
|
+
createdAt?: string;
|
|
2727
|
+
description?: string;
|
|
2728
|
+
executionRoleArn?: string;
|
|
2729
|
+
lastUpdatedAt?: string;
|
|
2730
|
+
resourceName?: string;
|
|
2731
|
+
sandboxIdleTimeoutInSeconds?: number;
|
|
2732
|
+
sandboxTtlInSeconds?: number;
|
|
2733
|
+
shareConcurrencyLimitPerSandbox?: number;
|
|
2734
|
+
status?: Status;
|
|
2735
|
+
statusReason?: string;
|
|
2736
|
+
diskSize?: number;
|
|
2737
|
+
private _config?;
|
|
2738
|
+
constructor(data?: Partial<TemplateData>, config?: Config);
|
|
2739
|
+
/**
|
|
2740
|
+
* Create template from SDK response object
|
|
2741
|
+
*/
|
|
2742
|
+
static fromInnerObject(obj: $AgentRun.Template, config?: Config): Template;
|
|
2743
|
+
private static getClient;
|
|
2744
|
+
/**
|
|
2745
|
+
* Create a new Template
|
|
2746
|
+
*/
|
|
2747
|
+
static create(params: {
|
|
2748
|
+
input: TemplateCreateInput;
|
|
2749
|
+
config?: Config;
|
|
2750
|
+
}): Promise<Template>;
|
|
2751
|
+
/**
|
|
2752
|
+
* Get defaults based on template type
|
|
2753
|
+
*/
|
|
2754
|
+
private static getDefaults;
|
|
2755
|
+
/**
|
|
2756
|
+
* Validate template configuration
|
|
2757
|
+
*/
|
|
2758
|
+
private static validate;
|
|
2759
|
+
/**
|
|
2760
|
+
* Delete a Template by name
|
|
2761
|
+
*/
|
|
2762
|
+
static delete(params: {
|
|
2763
|
+
name: string;
|
|
2764
|
+
config?: Config;
|
|
2765
|
+
}): Promise<Template>;
|
|
2766
|
+
/**
|
|
2767
|
+
* Update a Template by name
|
|
2768
|
+
*/
|
|
2769
|
+
static update(params: {
|
|
2770
|
+
name: string;
|
|
2771
|
+
input: TemplateUpdateInput;
|
|
2772
|
+
config?: Config;
|
|
2773
|
+
}): Promise<Template>;
|
|
2774
|
+
/**
|
|
2775
|
+
* Get a Template by name
|
|
2776
|
+
*/
|
|
2777
|
+
static get(params: {
|
|
2778
|
+
name: string;
|
|
2779
|
+
config?: Config;
|
|
2780
|
+
}): Promise<Template>;
|
|
2781
|
+
/**
|
|
2782
|
+
* List Templates
|
|
2783
|
+
*/
|
|
2784
|
+
static list(input?: TemplateListInput, config?: Config): Promise<Template[]>;
|
|
2785
|
+
/**
|
|
2786
|
+
* List all Templates (with pagination)
|
|
2787
|
+
*/
|
|
2788
|
+
static listAll(options?: {
|
|
2789
|
+
templateType?: TemplateType;
|
|
2790
|
+
}, config?: Config): Promise<Template[]>;
|
|
2791
|
+
/**
|
|
2792
|
+
* Handle API errors
|
|
2793
|
+
*/
|
|
2794
|
+
private static handleError;
|
|
2795
|
+
/**
|
|
2796
|
+
* Delete this template
|
|
2797
|
+
*/
|
|
2798
|
+
delete: (params?: {
|
|
2799
|
+
config?: Config;
|
|
2800
|
+
}) => Promise<Template>;
|
|
2801
|
+
/**
|
|
2802
|
+
* Update this template
|
|
2803
|
+
*/
|
|
2804
|
+
update: (params: {
|
|
2805
|
+
input: TemplateUpdateInput;
|
|
2806
|
+
config?: Config;
|
|
2807
|
+
}) => Promise<Template>;
|
|
2808
|
+
/**
|
|
2809
|
+
* Refresh this template's data
|
|
2810
|
+
*/
|
|
2811
|
+
refresh: (params?: {
|
|
2812
|
+
config?: Config;
|
|
2813
|
+
}) => Promise<Template>;
|
|
2814
|
+
/**
|
|
2815
|
+
* Wait until the template is ready
|
|
2816
|
+
*/
|
|
2817
|
+
waitUntilReady: (options?: {
|
|
2818
|
+
timeoutSeconds?: number;
|
|
2819
|
+
intervalSeconds?: number;
|
|
2820
|
+
beforeCheck?: (template: Template) => void;
|
|
2821
|
+
}, config?: Config) => Promise<Template>;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
/**
|
|
2825
|
+
* Sandbox Client
|
|
2826
|
+
*
|
|
2827
|
+
* 此模块提供 Sandbox 的客户端 API。
|
|
2828
|
+
* This module provides the client API for Sandbox.
|
|
2829
|
+
*/
|
|
2830
|
+
|
|
2831
|
+
/**
|
|
2832
|
+
* Sandbox Client
|
|
2833
|
+
*
|
|
2834
|
+
* 提供 Sandbox 和 Template 的管理功能。
|
|
2835
|
+
*/
|
|
2836
|
+
declare class SandboxClient {
|
|
2837
|
+
private config?;
|
|
2838
|
+
constructor(config?: Config);
|
|
2839
|
+
/**
|
|
2840
|
+
* Create a Template
|
|
2841
|
+
*/
|
|
2842
|
+
createTemplate: (params: {
|
|
2843
|
+
input: TemplateCreateInput;
|
|
2844
|
+
config?: Config;
|
|
2845
|
+
}) => Promise<Template>;
|
|
2846
|
+
/**
|
|
2847
|
+
* Delete a Template
|
|
2848
|
+
*/
|
|
2849
|
+
deleteTemplate: (params: {
|
|
2850
|
+
name: string;
|
|
2851
|
+
config?: Config;
|
|
2852
|
+
}) => Promise<Template>;
|
|
2853
|
+
/**
|
|
2854
|
+
* Update a Template
|
|
2855
|
+
*/
|
|
2856
|
+
updateTemplate: (params: {
|
|
2857
|
+
name: string;
|
|
2858
|
+
input: TemplateUpdateInput;
|
|
2859
|
+
config?: Config;
|
|
2860
|
+
}) => Promise<Template>;
|
|
2861
|
+
/**
|
|
2862
|
+
* Get a Template
|
|
2863
|
+
*/
|
|
2864
|
+
getTemplate: (params: {
|
|
2865
|
+
name: string;
|
|
2866
|
+
config?: Config;
|
|
2867
|
+
}) => Promise<Template>;
|
|
2868
|
+
/**
|
|
2869
|
+
* List Templates
|
|
2870
|
+
*/
|
|
2871
|
+
listTemplates: (params?: {
|
|
2872
|
+
input?: TemplateListInput;
|
|
2873
|
+
config?: Config;
|
|
2874
|
+
}) => Promise<Template[]>;
|
|
2875
|
+
/**
|
|
2876
|
+
* List all Templates
|
|
2877
|
+
*/
|
|
2878
|
+
listAllTemplates: (params?: {
|
|
2879
|
+
options?: {
|
|
2880
|
+
templateType?: TemplateType;
|
|
2881
|
+
};
|
|
2882
|
+
config?: Config;
|
|
2883
|
+
}) => Promise<Template[]>;
|
|
2884
|
+
/**
|
|
2885
|
+
* Create a Sandbox
|
|
2886
|
+
*/
|
|
2887
|
+
createSandbox: (params: {
|
|
2888
|
+
input: SandboxCreateInput;
|
|
2889
|
+
config?: Config;
|
|
2890
|
+
}) => Promise<Sandbox>;
|
|
2891
|
+
/**
|
|
2892
|
+
* Create a Code Interpreter Sandbox
|
|
2893
|
+
*/
|
|
2894
|
+
createCodeInterpreterSandbox: (params: {
|
|
2895
|
+
templateName: string;
|
|
2896
|
+
options?: {
|
|
2897
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2898
|
+
};
|
|
2899
|
+
config?: Config;
|
|
2900
|
+
}) => Promise<CodeInterpreterSandbox>;
|
|
2901
|
+
/**
|
|
2902
|
+
* Create a Browser Sandbox
|
|
2903
|
+
*/
|
|
2904
|
+
createBrowserSandbox: (params: {
|
|
2905
|
+
templateName: string;
|
|
2906
|
+
options?: {
|
|
2907
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
2908
|
+
};
|
|
2909
|
+
config?: Config;
|
|
2910
|
+
}) => Promise<BrowserSandbox>;
|
|
2911
|
+
/**
|
|
2912
|
+
* Delete a Sandbox
|
|
2913
|
+
*/
|
|
2914
|
+
deleteSandbox: (params: {
|
|
2915
|
+
id: string;
|
|
2916
|
+
config?: Config;
|
|
2917
|
+
}) => Promise<Sandbox>;
|
|
2918
|
+
/**
|
|
2919
|
+
* Stop a Sandbox
|
|
2920
|
+
*/
|
|
2921
|
+
stopSandbox: (params: {
|
|
2922
|
+
id: string;
|
|
2923
|
+
config?: Config;
|
|
2924
|
+
}) => Promise<Sandbox>;
|
|
2925
|
+
/**
|
|
2926
|
+
* Get a Sandbox
|
|
2927
|
+
*/
|
|
2928
|
+
getSandbox: (params: {
|
|
2929
|
+
id: string;
|
|
2930
|
+
config?: Config;
|
|
2931
|
+
}) => Promise<Sandbox>;
|
|
2932
|
+
/**
|
|
2933
|
+
* List Sandboxes
|
|
2934
|
+
*/
|
|
2935
|
+
listSandboxes: (params?: {
|
|
2936
|
+
input?: SandboxListInput;
|
|
2937
|
+
config?: Config;
|
|
2938
|
+
}) => Promise<Sandbox[]>;
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
/**
|
|
2942
|
+
* AIO (All-In-One) Sandbox Data API
|
|
2943
|
+
*
|
|
2944
|
+
* This module provides a combined data API that includes both Code Interpreter
|
|
2945
|
+
* and Browser sandbox functionalities.
|
|
2946
|
+
* 此模块提供包含代码解释器和浏览器沙箱功能的组合数据 API。
|
|
2947
|
+
*/
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* AIO Data API
|
|
2951
|
+
*
|
|
2952
|
+
* Combines both Code Interpreter and Browser data API methods.
|
|
2953
|
+
*/
|
|
2954
|
+
declare class AioDataAPI extends CodeInterpreterDataAPI {
|
|
2955
|
+
private browserAPI;
|
|
2956
|
+
constructor(params: {
|
|
2957
|
+
sandboxId: string;
|
|
2958
|
+
config?: Config;
|
|
2959
|
+
});
|
|
2960
|
+
/**
|
|
2961
|
+
* Get CDP WebSocket URL for browser automation
|
|
2962
|
+
*/
|
|
2963
|
+
getCdpUrl(record?: boolean): string;
|
|
2964
|
+
/**
|
|
2965
|
+
* Get VNC WebSocket URL for live view
|
|
2966
|
+
*/
|
|
2967
|
+
getVncUrl(record?: boolean): string;
|
|
2968
|
+
/**
|
|
2969
|
+
* List browser recordings
|
|
2970
|
+
*/
|
|
2971
|
+
listRecordings: (params?: {
|
|
2972
|
+
config?: Config;
|
|
2973
|
+
}) => Promise<any>;
|
|
2974
|
+
/**
|
|
2975
|
+
* Delete a recording
|
|
2976
|
+
*/
|
|
2977
|
+
deleteRecording: (params: {
|
|
2978
|
+
filename: string;
|
|
2979
|
+
config?: Config;
|
|
2980
|
+
}) => Promise<any>;
|
|
2981
|
+
/**
|
|
2982
|
+
* Download a recording
|
|
2983
|
+
*/
|
|
2984
|
+
downloadRecording: (params: {
|
|
2985
|
+
filename: string;
|
|
2986
|
+
savePath: string;
|
|
2987
|
+
}) => Promise<{
|
|
2988
|
+
savedPath: string;
|
|
2989
|
+
size: number;
|
|
2990
|
+
}>;
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
/**
|
|
2994
|
+
* AIO (All-In-One) Sandbox
|
|
2995
|
+
*
|
|
2996
|
+
* Combines both Code Interpreter and Browser sandbox functionalities
|
|
2997
|
+
* into a single unified interface.
|
|
2998
|
+
*/
|
|
2999
|
+
|
|
3000
|
+
/**
|
|
3001
|
+
* File upload/download operations
|
|
3002
|
+
*/
|
|
3003
|
+
declare class AioFileOperations {
|
|
3004
|
+
private sandbox;
|
|
3005
|
+
constructor(sandbox: AioSandbox);
|
|
3006
|
+
/**
|
|
3007
|
+
* Read a file from the sandbox
|
|
3008
|
+
*/
|
|
3009
|
+
read: (path: string) => Promise<any>;
|
|
3010
|
+
/**
|
|
3011
|
+
* Write a file to the sandbox
|
|
3012
|
+
*/
|
|
3013
|
+
write: (params: {
|
|
3014
|
+
path: string;
|
|
3015
|
+
content: string;
|
|
3016
|
+
mode?: string;
|
|
3017
|
+
encoding?: string;
|
|
3018
|
+
createDir?: boolean;
|
|
3019
|
+
}) => Promise<any>;
|
|
3020
|
+
}
|
|
3021
|
+
/**
|
|
3022
|
+
* File system operations (list, move, remove, stat, mkdir)
|
|
3023
|
+
*/
|
|
3024
|
+
declare class AioFileSystemOperations {
|
|
3025
|
+
private sandbox;
|
|
3026
|
+
constructor(sandbox: AioSandbox);
|
|
3027
|
+
/**
|
|
3028
|
+
* List directory contents
|
|
3029
|
+
*/
|
|
3030
|
+
list: (params?: {
|
|
3031
|
+
path?: string;
|
|
3032
|
+
depth?: number;
|
|
3033
|
+
}) => Promise<any>;
|
|
3034
|
+
/**
|
|
3035
|
+
* Move a file or directory
|
|
3036
|
+
*/
|
|
3037
|
+
move: (params: {
|
|
3038
|
+
source: string;
|
|
3039
|
+
destination: string;
|
|
3040
|
+
}) => Promise<any>;
|
|
3041
|
+
/**
|
|
3042
|
+
* Remove a file or directory
|
|
3043
|
+
*/
|
|
3044
|
+
remove: (params: {
|
|
3045
|
+
path: string;
|
|
3046
|
+
}) => Promise<any>;
|
|
3047
|
+
/**
|
|
3048
|
+
* Get file or directory statistics
|
|
3049
|
+
*/
|
|
3050
|
+
stat: (params: {
|
|
3051
|
+
path: string;
|
|
3052
|
+
}) => Promise<any>;
|
|
3053
|
+
/**
|
|
3054
|
+
* Create a directory
|
|
3055
|
+
*/
|
|
3056
|
+
mkdir: (params: {
|
|
3057
|
+
path: string;
|
|
3058
|
+
parents?: boolean;
|
|
3059
|
+
mode?: string;
|
|
3060
|
+
}) => Promise<any>;
|
|
3061
|
+
/**
|
|
3062
|
+
* Upload a file to the sandbox
|
|
3063
|
+
*/
|
|
3064
|
+
upload: (params: {
|
|
3065
|
+
localFilePath: string;
|
|
3066
|
+
targetFilePath: string;
|
|
3067
|
+
}) => Promise<any>;
|
|
3068
|
+
/**
|
|
3069
|
+
* Download a file from the sandbox
|
|
3070
|
+
*/
|
|
3071
|
+
download: (params: {
|
|
3072
|
+
path: string;
|
|
3073
|
+
savePath: string;
|
|
3074
|
+
}) => Promise<{
|
|
3075
|
+
savedPath: string;
|
|
3076
|
+
size: number;
|
|
3077
|
+
}>;
|
|
3078
|
+
}
|
|
3079
|
+
/**
|
|
3080
|
+
* Process management operations
|
|
3081
|
+
*/
|
|
3082
|
+
declare class AioProcessOperations {
|
|
3083
|
+
private sandbox;
|
|
3084
|
+
constructor(sandbox: AioSandbox);
|
|
3085
|
+
/**
|
|
3086
|
+
* Execute a command in the sandbox
|
|
3087
|
+
*/
|
|
3088
|
+
cmd: (params: {
|
|
3089
|
+
command: string;
|
|
3090
|
+
cwd: string;
|
|
3091
|
+
timeout?: number;
|
|
3092
|
+
}) => Promise<any>;
|
|
3093
|
+
/**
|
|
3094
|
+
* List all processes
|
|
3095
|
+
*/
|
|
3096
|
+
list: (params?: {
|
|
3097
|
+
config?: Config;
|
|
3098
|
+
}) => Promise<any>;
|
|
3099
|
+
/**
|
|
3100
|
+
* Get a specific process by PID
|
|
3101
|
+
*/
|
|
3102
|
+
get: (params: {
|
|
3103
|
+
pid: string;
|
|
3104
|
+
}) => Promise<any>;
|
|
3105
|
+
/**
|
|
3106
|
+
* Kill a specific process by PID
|
|
3107
|
+
*/
|
|
3108
|
+
kill: (params: {
|
|
3109
|
+
pid: string;
|
|
3110
|
+
}) => Promise<any>;
|
|
3111
|
+
}
|
|
3112
|
+
/**
|
|
3113
|
+
* Context management operations
|
|
3114
|
+
*/
|
|
3115
|
+
declare class AioContextOperations {
|
|
3116
|
+
private sandbox;
|
|
3117
|
+
private _contextId?;
|
|
3118
|
+
private _language?;
|
|
3119
|
+
private _cwd?;
|
|
3120
|
+
constructor(sandbox: AioSandbox);
|
|
3121
|
+
/**
|
|
3122
|
+
* Get the current context ID
|
|
3123
|
+
*/
|
|
3124
|
+
get contextId(): string | undefined;
|
|
3125
|
+
/**
|
|
3126
|
+
* List all contexts
|
|
3127
|
+
*/
|
|
3128
|
+
list: (params?: {
|
|
3129
|
+
config?: Config;
|
|
3130
|
+
}) => Promise<any>;
|
|
3131
|
+
/**
|
|
3132
|
+
* Create a new context and save its ID
|
|
3133
|
+
*/
|
|
3134
|
+
create: (params?: {
|
|
3135
|
+
language?: CodeLanguage;
|
|
3136
|
+
cwd?: string;
|
|
3137
|
+
}) => Promise<AioContextOperations>;
|
|
3138
|
+
/**
|
|
3139
|
+
* Get a specific context by ID
|
|
3140
|
+
*/
|
|
3141
|
+
get: (params?: {
|
|
3142
|
+
contextId?: string;
|
|
3143
|
+
}) => Promise<AioContextOperations>;
|
|
3144
|
+
/**
|
|
3145
|
+
* Execute code in a context
|
|
3146
|
+
*/
|
|
3147
|
+
execute: (params: {
|
|
3148
|
+
code: string;
|
|
3149
|
+
language?: CodeLanguage;
|
|
3150
|
+
contextId?: string;
|
|
3151
|
+
timeout?: number;
|
|
3152
|
+
}) => Promise<any>;
|
|
3153
|
+
/**
|
|
3154
|
+
* Delete a context
|
|
3155
|
+
*/
|
|
3156
|
+
delete: (params?: {
|
|
3157
|
+
contextId?: string;
|
|
3158
|
+
}) => Promise<any>;
|
|
3159
|
+
}
|
|
3160
|
+
/**
|
|
3161
|
+
* AIO (All-In-One) Sandbox
|
|
3162
|
+
*
|
|
3163
|
+
* Combines both Code Interpreter and Browser sandbox functionalities.
|
|
3164
|
+
*/
|
|
3165
|
+
declare class AioSandbox extends Sandbox {
|
|
3166
|
+
static templateType: TemplateType;
|
|
3167
|
+
/**
|
|
3168
|
+
* Create an AIO Sandbox from template
|
|
3169
|
+
*/
|
|
3170
|
+
static createFromTemplate(templateName: string, options?: {
|
|
3171
|
+
sandboxIdleTimeoutSeconds?: number;
|
|
3172
|
+
}, config?: Config): Promise<AioSandbox>;
|
|
3173
|
+
constructor(sandbox: Sandbox, config?: Config);
|
|
3174
|
+
private _dataApi?;
|
|
3175
|
+
private _file?;
|
|
3176
|
+
private _fileSystem?;
|
|
3177
|
+
private _context?;
|
|
3178
|
+
private _process?;
|
|
3179
|
+
/**
|
|
3180
|
+
* Get data API client
|
|
3181
|
+
*/
|
|
3182
|
+
get dataApi(): AioDataAPI;
|
|
3183
|
+
/**
|
|
3184
|
+
* Access file upload/download operations
|
|
3185
|
+
*/
|
|
3186
|
+
get file(): AioFileOperations;
|
|
3187
|
+
/**
|
|
3188
|
+
* Access file system operations
|
|
3189
|
+
*/
|
|
3190
|
+
get fileSystem(): AioFileSystemOperations;
|
|
3191
|
+
/**
|
|
3192
|
+
* Access context management operations
|
|
3193
|
+
*/
|
|
3194
|
+
get context(): AioContextOperations;
|
|
3195
|
+
/**
|
|
3196
|
+
* Access process management operations
|
|
3197
|
+
*/
|
|
3198
|
+
get process(): AioProcessOperations;
|
|
3199
|
+
/**
|
|
3200
|
+
* Check sandbox health
|
|
3201
|
+
*/
|
|
3202
|
+
checkHealth: (params?: {
|
|
3203
|
+
config?: Config;
|
|
3204
|
+
}) => Promise<{
|
|
3205
|
+
status: string;
|
|
3206
|
+
[key: string]: any;
|
|
3207
|
+
}>;
|
|
3208
|
+
/**
|
|
3209
|
+
* Wait for sandbox to be ready (polls health check)
|
|
3210
|
+
*/
|
|
3211
|
+
waitUntilReady: (params?: {
|
|
3212
|
+
maxRetries?: number;
|
|
3213
|
+
retryIntervalMs?: number;
|
|
3214
|
+
}) => Promise<void>;
|
|
3215
|
+
/**
|
|
3216
|
+
* Get CDP WebSocket URL for browser automation
|
|
3217
|
+
*/
|
|
3218
|
+
getCdpUrl(record?: boolean): string;
|
|
3219
|
+
/**
|
|
3220
|
+
* Get VNC WebSocket URL for live view
|
|
3221
|
+
*/
|
|
3222
|
+
getVncUrl(record?: boolean): string;
|
|
3223
|
+
/**
|
|
3224
|
+
* List all browser recordings
|
|
3225
|
+
*/
|
|
3226
|
+
listRecordings: (params?: {
|
|
3227
|
+
config?: Config;
|
|
3228
|
+
}) => Promise<any>;
|
|
3229
|
+
/**
|
|
3230
|
+
* Download a recording video file
|
|
3231
|
+
*/
|
|
3232
|
+
downloadRecording: (params: {
|
|
3233
|
+
filename: string;
|
|
3234
|
+
savePath: string;
|
|
3235
|
+
}) => Promise<{
|
|
3236
|
+
savedPath: string;
|
|
3237
|
+
size: number;
|
|
3238
|
+
}>;
|
|
3239
|
+
/**
|
|
3240
|
+
* Delete a recording
|
|
3241
|
+
*/
|
|
3242
|
+
deleteRecording: (params: {
|
|
3243
|
+
filename: string;
|
|
3244
|
+
config?: Config;
|
|
3245
|
+
}) => Promise<any>;
|
|
3246
|
+
}
|
|
3247
|
+
|
|
3248
|
+
/**
|
|
3249
|
+
* Model Service Data Models
|
|
3250
|
+
*
|
|
3251
|
+
* 此模块定义 Model Service 相关的所有数据模型。
|
|
3252
|
+
* This module defines all data models related to Model Service.
|
|
3253
|
+
*/
|
|
3254
|
+
|
|
3255
|
+
/**
|
|
3256
|
+
* Backend type enum
|
|
3257
|
+
*/
|
|
3258
|
+
type BackendType = 'proxy' | 'service';
|
|
3259
|
+
declare const BackendType: {
|
|
3260
|
+
PROXY: BackendType;
|
|
3261
|
+
SERVICE: BackendType;
|
|
3262
|
+
};
|
|
3263
|
+
/**
|
|
3264
|
+
* Model type enum
|
|
3265
|
+
*/
|
|
3266
|
+
type ModelType = 'llm' | 'text-embedding' | 'speech2text' | 'tts' | 'rerank' | 'moderation';
|
|
3267
|
+
declare const ModelType: {
|
|
3268
|
+
LLM: ModelType;
|
|
3269
|
+
TEXT_EMBEDDING: ModelType;
|
|
3270
|
+
SPEECH2TEXT: ModelType;
|
|
3271
|
+
TTS: ModelType;
|
|
3272
|
+
RERANK: ModelType;
|
|
3273
|
+
MODERATION: ModelType;
|
|
3274
|
+
};
|
|
3275
|
+
/**
|
|
3276
|
+
* Provider enum
|
|
3277
|
+
*/
|
|
3278
|
+
type Provider = 'openai' | 'anthropic' | 'baichuan' | 'deepseek' | 'gemini' | 'hunyuan' | 'minimax' | 'moonshot' | 'spark' | 'stepfun' | 'tongyi' | 'vertex_ai' | 'wenxin' | 'yi' | 'zhipuai' | 'custom';
|
|
3279
|
+
declare const Provider: {
|
|
3280
|
+
OPENAI: Provider;
|
|
3281
|
+
ANTHROPIC: Provider;
|
|
3282
|
+
BAICHUAN: Provider;
|
|
3283
|
+
DEEPSEEK: Provider;
|
|
3284
|
+
GEMINI: Provider;
|
|
3285
|
+
HUNYUAN: Provider;
|
|
3286
|
+
MINIMAX: Provider;
|
|
3287
|
+
MOONSHOT: Provider;
|
|
3288
|
+
SPARK: Provider;
|
|
3289
|
+
STEPFUN: Provider;
|
|
3290
|
+
TONGYI: Provider;
|
|
3291
|
+
VERTEX_AI: Provider;
|
|
3292
|
+
WENXIN: Provider;
|
|
3293
|
+
YI: Provider;
|
|
3294
|
+
ZHIPUAI: Provider;
|
|
3295
|
+
CUSTOM: Provider;
|
|
3296
|
+
};
|
|
3297
|
+
type ProxyMode = 'single' | 'multi';
|
|
3298
|
+
declare const ProxyMode: {
|
|
3299
|
+
SINGLE: ProxyMode;
|
|
3300
|
+
MULTI: ProxyMode;
|
|
3301
|
+
};
|
|
3302
|
+
/**
|
|
3303
|
+
* Provider settings
|
|
3304
|
+
*/
|
|
3305
|
+
interface ProviderSettings {
|
|
3306
|
+
apiKey?: string;
|
|
3307
|
+
baseUrl?: string;
|
|
3308
|
+
modelNames?: string[];
|
|
3309
|
+
}
|
|
3310
|
+
/**
|
|
3311
|
+
* Model features
|
|
3312
|
+
*/
|
|
3313
|
+
interface ModelFeatures {
|
|
3314
|
+
agentThought?: boolean;
|
|
3315
|
+
multiToolCall?: boolean;
|
|
3316
|
+
streamToolCall?: boolean;
|
|
3317
|
+
toolCall?: boolean;
|
|
3318
|
+
vision?: boolean;
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Model properties
|
|
3322
|
+
*/
|
|
3323
|
+
interface ModelProperties {
|
|
3324
|
+
contextSize?: number;
|
|
3325
|
+
}
|
|
3326
|
+
/**
|
|
3327
|
+
* Model parameter rule
|
|
3328
|
+
*/
|
|
3329
|
+
interface ModelParameterRule {
|
|
3330
|
+
default?: unknown;
|
|
3331
|
+
max?: number;
|
|
3332
|
+
min?: number;
|
|
3333
|
+
name?: string;
|
|
3334
|
+
required?: boolean;
|
|
3335
|
+
type?: string;
|
|
3336
|
+
}
|
|
3337
|
+
/**
|
|
3338
|
+
* Model info config
|
|
3339
|
+
*/
|
|
3340
|
+
interface ModelInfoConfig {
|
|
3341
|
+
modelName?: string;
|
|
3342
|
+
modelFeatures?: ModelFeatures;
|
|
3343
|
+
modelProperties?: ModelProperties;
|
|
3344
|
+
modelParameterRules?: ModelParameterRule[];
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* Proxy config endpoint
|
|
3348
|
+
*/
|
|
3349
|
+
interface ProxyConfigEndpoint {
|
|
3350
|
+
baseUrl?: string;
|
|
3351
|
+
modelNames?: string[];
|
|
3352
|
+
modelServiceName?: string;
|
|
3353
|
+
weight?: number;
|
|
3354
|
+
}
|
|
3355
|
+
/**
|
|
3356
|
+
* Proxy config fallback
|
|
3357
|
+
*/
|
|
3358
|
+
interface ProxyConfigFallback {
|
|
3359
|
+
modelName?: string;
|
|
3360
|
+
modelServiceName?: string;
|
|
3361
|
+
}
|
|
3362
|
+
interface ProxyConfigTokenRateLimiter {
|
|
3363
|
+
tps?: number;
|
|
3364
|
+
tpm?: number;
|
|
3365
|
+
tph?: number;
|
|
3366
|
+
tpd?: number;
|
|
3367
|
+
}
|
|
3368
|
+
interface ProxyConfigAIGuardrailConfig {
|
|
3369
|
+
checkRequest?: boolean;
|
|
3370
|
+
checkResponse?: boolean;
|
|
3371
|
+
}
|
|
3372
|
+
/**
|
|
3373
|
+
* Proxy config policies
|
|
3374
|
+
*/
|
|
3375
|
+
interface ProxyConfigPolicies {
|
|
3376
|
+
cache?: boolean;
|
|
3377
|
+
concurrencyLimit?: number;
|
|
3378
|
+
fallbacks?: ProxyConfigFallback[];
|
|
3379
|
+
numRetries?: number;
|
|
3380
|
+
requestTimeout?: number;
|
|
3381
|
+
aiGuardrailConfig?: ProxyConfigAIGuardrailConfig;
|
|
3382
|
+
tokenRateLimiter?: ProxyConfigTokenRateLimiter;
|
|
3383
|
+
}
|
|
3384
|
+
/**
|
|
3385
|
+
* Proxy config
|
|
3386
|
+
*/
|
|
3387
|
+
interface ProxyConfig {
|
|
3388
|
+
endpoints?: ProxyConfigEndpoint[];
|
|
3389
|
+
policies?: ProxyConfigPolicies;
|
|
3390
|
+
}
|
|
3391
|
+
interface CommonModelMutableProps {
|
|
3392
|
+
credentialName?: string;
|
|
3393
|
+
description?: string;
|
|
3394
|
+
networkConfiguration?: NetworkConfig;
|
|
3395
|
+
tags?: string[];
|
|
3396
|
+
}
|
|
3397
|
+
interface CommonModelImmutableProps {
|
|
3398
|
+
modelType?: ModelType;
|
|
3399
|
+
}
|
|
3400
|
+
interface CommonModelSystemProps {
|
|
3401
|
+
createdAt?: string;
|
|
3402
|
+
lastUpdatedAt?: string;
|
|
3403
|
+
status?: Status;
|
|
3404
|
+
}
|
|
3405
|
+
interface ModelServiceMutableProps extends CommonModelMutableProps {
|
|
3406
|
+
providerSettings?: ProviderSettings;
|
|
3407
|
+
}
|
|
3408
|
+
interface ModelServiceImmutableProps extends CommonModelImmutableProps {
|
|
3409
|
+
modelInfoConfigs?: ModelInfoConfig[];
|
|
3410
|
+
modelServiceName?: string;
|
|
3411
|
+
provider?: string;
|
|
3412
|
+
}
|
|
3413
|
+
interface ModelServiceSystemProps extends CommonModelSystemProps {
|
|
3414
|
+
modelServiceId?: string;
|
|
3415
|
+
}
|
|
3416
|
+
interface ModelProxyMutableProps extends CommonModelMutableProps {
|
|
3417
|
+
cpu?: number;
|
|
3418
|
+
litellmVersion?: string;
|
|
3419
|
+
memory?: number;
|
|
3420
|
+
modelProxyName?: string;
|
|
3421
|
+
proxyModel?: ProxyMode;
|
|
3422
|
+
serviceRegionId?: string;
|
|
3423
|
+
proxyConfig?: ProxyConfig;
|
|
3424
|
+
executionRoleArn?: string;
|
|
3425
|
+
}
|
|
3426
|
+
interface ModelProxyImmutableProps extends CommonModelImmutableProps {
|
|
3427
|
+
}
|
|
3428
|
+
interface ModelProxySystemProps extends CommonModelSystemProps {
|
|
3429
|
+
endpoint?: string;
|
|
3430
|
+
functionName?: string;
|
|
3431
|
+
modelProxyId?: string;
|
|
3432
|
+
}
|
|
3433
|
+
interface ModelServiceCreateInput extends ModelServiceImmutableProps, ModelServiceMutableProps {
|
|
3434
|
+
}
|
|
3435
|
+
interface ModelServiceUpdateInput extends ModelServiceMutableProps {
|
|
3436
|
+
}
|
|
3437
|
+
interface ModelServiceListInput extends PageableInput {
|
|
3438
|
+
modelServiceName?: string;
|
|
3439
|
+
modelType?: ModelType;
|
|
3440
|
+
provider?: string;
|
|
3441
|
+
}
|
|
3442
|
+
/**
|
|
3443
|
+
* Model proxy create input
|
|
3444
|
+
*/
|
|
3445
|
+
interface ModelProxyCreateInput extends ModelServiceImmutableProps, ModelProxyMutableProps {
|
|
3446
|
+
}
|
|
3447
|
+
/**
|
|
3448
|
+
* Model proxy update input
|
|
3449
|
+
*/
|
|
3450
|
+
interface ModelProxyUpdateInput extends ModelServiceMutableProps {
|
|
3451
|
+
proxyModel?: string;
|
|
3452
|
+
executionRoleArn?: string;
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Model proxy list input
|
|
3456
|
+
*/
|
|
3457
|
+
interface ModelProxyListInput extends PageableInput {
|
|
3458
|
+
modelProxyName?: string;
|
|
3459
|
+
proxyMode?: string;
|
|
3460
|
+
status?: Status;
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
/**
|
|
3464
|
+
* Model Proxy 高层 API / Model Proxy High-Level API
|
|
3465
|
+
*
|
|
3466
|
+
* 此模块定义模型代理资源的高级API。
|
|
3467
|
+
* This module defines the high-level API for model proxy resources.
|
|
3468
|
+
*/
|
|
3469
|
+
|
|
3470
|
+
/**
|
|
3471
|
+
* 模型代理 / Model Proxy
|
|
3472
|
+
*/
|
|
3473
|
+
declare class ModelProxy extends ResourceBase implements ModelProxyImmutableProps, ModelProxyMutableProps, ModelProxySystemProps {
|
|
3474
|
+
modelType?: ModelProxyImmutableProps['modelType'];
|
|
3475
|
+
credentialName?: string;
|
|
3476
|
+
description?: string;
|
|
3477
|
+
networkConfiguration?: ModelProxyMutableProps['networkConfiguration'];
|
|
3478
|
+
tags?: string[];
|
|
3479
|
+
cpu?: number;
|
|
3480
|
+
litellmVersion?: string;
|
|
3481
|
+
memory?: number;
|
|
3482
|
+
modelProxyName?: string;
|
|
3483
|
+
proxyModel?: ProxyMode;
|
|
3484
|
+
serviceRegionId?: string;
|
|
3485
|
+
proxyConfig?: ModelProxyMutableProps['proxyConfig'];
|
|
3486
|
+
executionRoleArn?: string;
|
|
3487
|
+
endpoint?: string;
|
|
3488
|
+
functionName?: string;
|
|
3489
|
+
modelProxyId?: string;
|
|
3490
|
+
createdAt?: string;
|
|
3491
|
+
lastUpdatedAt?: string;
|
|
3492
|
+
status?: ModelProxySystemProps['status'];
|
|
3493
|
+
/**
|
|
3494
|
+
* 获取客户端 / Get client
|
|
3495
|
+
*
|
|
3496
|
+
* @returns ModelClient 实例
|
|
3497
|
+
*/
|
|
3498
|
+
private static getClient;
|
|
3499
|
+
/**
|
|
3500
|
+
* 创建模型代理 / Create model proxy
|
|
3501
|
+
*
|
|
3502
|
+
* @param params - 参数 / Parameters
|
|
3503
|
+
* @returns 创建的模型代理对象 / Created model proxy object
|
|
3504
|
+
*/
|
|
3505
|
+
static create(params: {
|
|
3506
|
+
input: ModelProxyCreateInput;
|
|
3507
|
+
config?: Config;
|
|
3508
|
+
}): Promise<ModelProxy>;
|
|
3509
|
+
/**
|
|
3510
|
+
* 根据名称删除模型代理 / Delete model proxy by name
|
|
3511
|
+
*
|
|
3512
|
+
* @param params - 参数 / Parameters
|
|
3513
|
+
* @returns 删除的模型代理对象 / Deleted model proxy object
|
|
3514
|
+
*/
|
|
3515
|
+
static delete(params: {
|
|
3516
|
+
name: string;
|
|
3517
|
+
config?: Config;
|
|
3518
|
+
}): Promise<ModelProxy>;
|
|
3519
|
+
/**
|
|
3520
|
+
* 根据名称更新模型代理 / Update model proxy by name
|
|
3521
|
+
*
|
|
3522
|
+
* @param params - 参数 / Parameters
|
|
3523
|
+
* @returns 更新后的模型代理对象 / Updated model proxy object
|
|
3524
|
+
*/
|
|
3525
|
+
static update(params: {
|
|
3526
|
+
name: string;
|
|
3527
|
+
input: ModelProxyUpdateInput;
|
|
3528
|
+
config?: Config;
|
|
3529
|
+
}): Promise<ModelProxy>;
|
|
3530
|
+
/**
|
|
3531
|
+
* 根据名称获取模型代理 / Get model proxy by name
|
|
3532
|
+
*
|
|
3533
|
+
* @param params - 参数 / Parameters
|
|
3534
|
+
* @returns 模型代理对象 / Model proxy object
|
|
3535
|
+
*/
|
|
3536
|
+
static get(params: {
|
|
3537
|
+
name: string;
|
|
3538
|
+
config?: Config;
|
|
3539
|
+
}): Promise<ModelProxy>;
|
|
3540
|
+
/**
|
|
3541
|
+
* 列出模型代理(分页)/ List model proxies (paginated)
|
|
3542
|
+
*
|
|
3543
|
+
* @param pageInput - 分页参数 / Pagination parameters
|
|
3544
|
+
* @param config - 配置 / Configuration
|
|
3545
|
+
* @param kwargs - 其他查询参数 / Other query parameters
|
|
3546
|
+
* @returns 模型代理列表 / Model proxy list
|
|
3547
|
+
*/
|
|
3548
|
+
protected static listPage(pageInput: PageableInput, config?: Config, kwargs?: Partial<ModelProxyListInput>): Promise<ModelProxy[]>;
|
|
3549
|
+
/**
|
|
3550
|
+
* 列出所有模型代理 / List all model proxies
|
|
3551
|
+
*
|
|
3552
|
+
* @param options - 查询选项 / Query options
|
|
3553
|
+
* @param config - 配置 / Configuration
|
|
3554
|
+
* @returns 模型代理列表 / Model proxy list
|
|
3555
|
+
*/
|
|
3556
|
+
static listAll(options?: {
|
|
3557
|
+
proxyMode?: string;
|
|
3558
|
+
status?: Status;
|
|
3559
|
+
config?: Config;
|
|
3560
|
+
}): Promise<ModelProxy[]>;
|
|
3561
|
+
/**
|
|
3562
|
+
* 更新模型代理 / Update model proxy
|
|
3563
|
+
*
|
|
3564
|
+
* @param input - 模型代理更新输入参数 / Model proxy update input parameters
|
|
3565
|
+
* @param config - 配置 / Configuration
|
|
3566
|
+
* @returns 更新后的模型代理对象 / Updated model proxy object
|
|
3567
|
+
*/
|
|
3568
|
+
update: (params: {
|
|
3569
|
+
input: ModelProxyUpdateInput;
|
|
3570
|
+
config?: Config;
|
|
3571
|
+
}) => Promise<ModelProxy>;
|
|
3572
|
+
/**
|
|
3573
|
+
* 删除模型代理 / Delete model proxy
|
|
3574
|
+
*
|
|
3575
|
+
* @param params - 参数 / Parameters
|
|
3576
|
+
* @returns 删除的模型代理对象 / Deleted model proxy object
|
|
3577
|
+
*/
|
|
3578
|
+
delete: (params?: {
|
|
3579
|
+
config?: Config;
|
|
3580
|
+
}) => Promise<ModelProxy>;
|
|
3581
|
+
/**
|
|
3582
|
+
* 刷新模型代理信息 / Refresh model proxy information
|
|
3583
|
+
*
|
|
3584
|
+
* @param params - 参数 / Parameters
|
|
3585
|
+
* @returns 刷新后的模型代理对象 / Refreshed model proxy object
|
|
3586
|
+
*/
|
|
3587
|
+
get: (params?: {
|
|
3588
|
+
config?: Config;
|
|
3589
|
+
}) => Promise<ModelProxy>;
|
|
3590
|
+
/**
|
|
3591
|
+
* 获取模型信息 / Get model information
|
|
3592
|
+
*
|
|
3593
|
+
* @param params - 参数 / Parameters
|
|
3594
|
+
* @param params.config - 配置 / Configuration
|
|
3595
|
+
* @returns 模型基本信息 / Model base information
|
|
3596
|
+
*/
|
|
3597
|
+
modelInfo: (params?: {
|
|
3598
|
+
config?: Config;
|
|
3599
|
+
}) => Promise<{
|
|
3600
|
+
apiKey: string;
|
|
3601
|
+
baseUrl: string;
|
|
3602
|
+
model?: string;
|
|
3603
|
+
headers?: Record<string, string>;
|
|
3604
|
+
}>;
|
|
3605
|
+
/**
|
|
3606
|
+
* 调用模型完成 / Call model completion
|
|
3607
|
+
*
|
|
3608
|
+
* @param params - 参数 / Parameters
|
|
3609
|
+
* @returns 完成结果 / Completion result
|
|
3610
|
+
*/
|
|
3611
|
+
completions: (params: {
|
|
3612
|
+
messages: any[];
|
|
3613
|
+
model?: string;
|
|
3614
|
+
stream?: boolean;
|
|
3615
|
+
config?: Config;
|
|
3616
|
+
[key: string]: any;
|
|
3617
|
+
}) => Promise<any>;
|
|
3618
|
+
/**
|
|
3619
|
+
* 获取响应 / Get responses
|
|
3620
|
+
*
|
|
3621
|
+
* @param params - 参数 / Parameters
|
|
3622
|
+
* @returns 响应结果 / Response result
|
|
3623
|
+
*/
|
|
3624
|
+
responses: (params: {
|
|
3625
|
+
messages: any[];
|
|
3626
|
+
model?: string;
|
|
3627
|
+
stream?: boolean;
|
|
3628
|
+
config?: Config;
|
|
3629
|
+
[key: string]: any;
|
|
3630
|
+
}) => Promise<any>;
|
|
3631
|
+
/**
|
|
3632
|
+
* 等待模型代理就绪 / Wait until model proxy is ready
|
|
3633
|
+
*
|
|
3634
|
+
* @param options - 选项 / Options
|
|
3635
|
+
* @param config - 配置 / Configuration
|
|
3636
|
+
* @returns 模型代理对象 / Model proxy object
|
|
3637
|
+
*/
|
|
3638
|
+
waitUntilReady: (options?: {
|
|
3639
|
+
timeoutSeconds?: number;
|
|
3640
|
+
intervalSeconds?: number;
|
|
3641
|
+
beforeCheck?: (proxy: ModelProxy) => void;
|
|
3642
|
+
}, config?: Config) => Promise<ModelProxy>;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
/**
|
|
3646
|
+
* Model Service 高层 API / Model Service High-Level API
|
|
3647
|
+
*
|
|
3648
|
+
* 此模块定义模型服务资源的高级API。
|
|
3649
|
+
* This module defines the high-level API for model service resources.
|
|
3650
|
+
*/
|
|
3651
|
+
|
|
3652
|
+
/**
|
|
3653
|
+
* 模型服务 / Model Service
|
|
3654
|
+
*/
|
|
3655
|
+
declare class ModelService extends ResourceBase implements ModelServiceImmutableProps, ModelServiceMutableProps, ModelServiceSystemProps {
|
|
3656
|
+
modelInfoConfigs?: ModelServiceImmutableProps['modelInfoConfigs'];
|
|
3657
|
+
modelServiceName?: string;
|
|
3658
|
+
provider?: string;
|
|
3659
|
+
credentialName?: string;
|
|
3660
|
+
description?: string;
|
|
3661
|
+
networkConfiguration?: ModelServiceMutableProps['networkConfiguration'];
|
|
3662
|
+
tags?: string[];
|
|
3663
|
+
providerSettings?: ModelServiceMutableProps['providerSettings'];
|
|
3664
|
+
modelServiceId?: string;
|
|
3665
|
+
createdAt?: string;
|
|
3666
|
+
lastUpdatedAt?: string;
|
|
3667
|
+
status?: ModelServiceSystemProps['status'];
|
|
3668
|
+
modelType?: ModelServiceImmutableProps['modelType'];
|
|
3669
|
+
/**
|
|
3670
|
+
* 获取客户端 / Get client
|
|
3671
|
+
*
|
|
3672
|
+
* @returns ModelClient 实例
|
|
3673
|
+
*/
|
|
3674
|
+
private static getClient;
|
|
3675
|
+
/**
|
|
3676
|
+
* 创建模型服务 / Create model service
|
|
3677
|
+
*
|
|
3678
|
+
* @param params - 参数 / Parameters
|
|
3679
|
+
* @returns 创建的模型服务对象 / Created model service object
|
|
3680
|
+
*/
|
|
3681
|
+
static create(params: {
|
|
3682
|
+
input: ModelServiceCreateInput;
|
|
3683
|
+
config?: Config;
|
|
3684
|
+
}): Promise<ModelService>;
|
|
3685
|
+
/**
|
|
3686
|
+
* 根据名称删除模型服务 / Delete model service by name
|
|
3687
|
+
*
|
|
3688
|
+
* @param params - 参数 / Parameters
|
|
3689
|
+
* @returns 删除的模型服务对象 / Deleted model service object
|
|
3690
|
+
*/
|
|
3691
|
+
static delete(params: {
|
|
3692
|
+
name: string;
|
|
3693
|
+
config?: Config;
|
|
3694
|
+
}): Promise<ModelService>;
|
|
3695
|
+
/**
|
|
3696
|
+
* 根据名称更新模型服务 / Update model service by name
|
|
3697
|
+
*
|
|
3698
|
+
* @param params - 参数 / Parameters
|
|
3699
|
+
* @returns 更新后的模型服务对象 / Updated model service object
|
|
3700
|
+
*/
|
|
3701
|
+
static update(params: {
|
|
3702
|
+
name: string;
|
|
3703
|
+
input: ModelServiceUpdateInput;
|
|
3704
|
+
config?: Config;
|
|
3705
|
+
}): Promise<ModelService>;
|
|
3706
|
+
/**
|
|
3707
|
+
* 根据名称获取模型服务 / Get model service by name
|
|
3708
|
+
*
|
|
3709
|
+
* @param params - 参数 / Parameters
|
|
3710
|
+
* @returns 模型服务对象 / Model service object
|
|
3711
|
+
*/
|
|
3712
|
+
static get(params: {
|
|
3713
|
+
name: string;
|
|
3714
|
+
config?: Config;
|
|
3715
|
+
}): Promise<ModelService>;
|
|
3716
|
+
/**
|
|
3717
|
+
* 列出模型服务(分页)/ List model services (paginated)
|
|
3718
|
+
*
|
|
3719
|
+
* @param pageInput - 分页参数 / Pagination parameters
|
|
3720
|
+
* @param config - 配置 / Configuration
|
|
3721
|
+
* @param kwargs - 其他查询参数 / Other query parameters
|
|
3722
|
+
* @returns 模型服务列表 / Model service list
|
|
3723
|
+
*/
|
|
3724
|
+
protected static listPage(pageInput: PageableInput, config?: Config, kwargs?: Partial<ModelServiceListInput>): Promise<ModelService[]>;
|
|
3725
|
+
/**
|
|
3726
|
+
* 列出所有模型服务 / List all model services
|
|
3727
|
+
*
|
|
3728
|
+
* @param options - 查询选项 / Query options
|
|
3729
|
+
* @param config - 配置 / Configuration
|
|
3730
|
+
* @returns 模型服务列表 / Model service list
|
|
3731
|
+
*/
|
|
3732
|
+
static listAll(options?: {
|
|
3733
|
+
modelType?: ModelType;
|
|
3734
|
+
provider?: string;
|
|
3735
|
+
config?: Config;
|
|
3736
|
+
}): Promise<ModelService[]>;
|
|
3737
|
+
/**
|
|
3738
|
+
* 更新模型服务 / Update model service
|
|
3739
|
+
*
|
|
3740
|
+
* @param params - 参数 / Parameters
|
|
3741
|
+
* @returns 更新后的模型服务对象 / Updated model service object
|
|
3742
|
+
*/
|
|
3743
|
+
update: (params: {
|
|
3744
|
+
input: ModelServiceUpdateInput;
|
|
3745
|
+
config?: Config;
|
|
3746
|
+
}) => Promise<ModelService>;
|
|
3747
|
+
/**
|
|
3748
|
+
* 删除模型服务 / Delete model service
|
|
3749
|
+
*
|
|
3750
|
+
* @param config - 配置 / Configuration
|
|
3751
|
+
* @returns 删除的模型服务对象 / Deleted model service object
|
|
3752
|
+
*/
|
|
3753
|
+
delete: (params?: {
|
|
3754
|
+
config?: Config;
|
|
3755
|
+
}) => Promise<ModelService>;
|
|
3756
|
+
/**
|
|
3757
|
+
* 刷新模型服务信息 / Refresh model service information
|
|
3758
|
+
*
|
|
3759
|
+
* @param config - 配置 / Configuration
|
|
3760
|
+
* @returns 刷新后的模型服务对象 / Refreshed model service object
|
|
3761
|
+
*/
|
|
3762
|
+
get: (params?: {
|
|
3763
|
+
config?: Config;
|
|
3764
|
+
}) => Promise<ModelService>;
|
|
3765
|
+
/**
|
|
3766
|
+
* 获取模型信息 / Get model information
|
|
3767
|
+
*
|
|
3768
|
+
* @param params - 参数 / Parameters
|
|
3769
|
+
* @param params.config - 配置 / Configuration
|
|
3770
|
+
* @returns 模型基本信息 / Model base information
|
|
3771
|
+
*/
|
|
3772
|
+
modelInfo: (params?: {
|
|
3773
|
+
config?: Config;
|
|
3774
|
+
}) => Promise<{
|
|
3775
|
+
apiKey: string;
|
|
3776
|
+
baseUrl: string;
|
|
3777
|
+
model?: string;
|
|
3778
|
+
headers?: Record<string, string>;
|
|
3779
|
+
provider?: string;
|
|
3780
|
+
}>;
|
|
3781
|
+
/**
|
|
3782
|
+
* 调用模型完成 / Call model completion
|
|
3783
|
+
*
|
|
3784
|
+
* @param messages - 消息列表 / Message list
|
|
3785
|
+
* @param model - 模型名称(可选)/ Model name (optional)
|
|
3786
|
+
* @param stream - 是否流式输出 / Whether to stream output
|
|
3787
|
+
* @param kwargs - 其他参数 / Other parameters
|
|
3788
|
+
* @returns 完成结果 / Completion result
|
|
3789
|
+
*/
|
|
3790
|
+
completions: (params: {
|
|
3791
|
+
messages: any[];
|
|
3792
|
+
model?: string;
|
|
3793
|
+
stream?: boolean;
|
|
3794
|
+
config?: Config;
|
|
3795
|
+
[key: string]: any;
|
|
3796
|
+
}) => Promise<any>;
|
|
3797
|
+
/**
|
|
3798
|
+
* 获取响应 / Get responses
|
|
3799
|
+
*
|
|
3800
|
+
* @param input - 输入 / Input
|
|
3801
|
+
* @param model - 模型名称(可选)/ Model name (optional)
|
|
3802
|
+
* @param stream - 是否流式输出 / Whether to stream output
|
|
3803
|
+
* @param kwargs - 其他参数 / Other parameters
|
|
3804
|
+
* @returns 响应结果 / Response result
|
|
3805
|
+
*/
|
|
3806
|
+
responses: (params: {
|
|
3807
|
+
input: string | any;
|
|
3808
|
+
model?: string;
|
|
3809
|
+
stream?: boolean;
|
|
3810
|
+
config?: Config;
|
|
3811
|
+
[key: string]: any;
|
|
3812
|
+
}) => Promise<any>;
|
|
3813
|
+
/**
|
|
3814
|
+
* 等待模型服务就绪 / Wait until model service is ready
|
|
3815
|
+
*
|
|
3816
|
+
* @param options - 选项 / Options
|
|
3817
|
+
* @param config - 配置 / Configuration
|
|
3818
|
+
* @returns 模型服务对象 / Model service object
|
|
3819
|
+
*/
|
|
3820
|
+
waitUntilReady: (options?: {
|
|
3821
|
+
timeoutSeconds?: number;
|
|
3822
|
+
intervalSeconds?: number;
|
|
3823
|
+
beforeCheck?: (service: ModelService) => void;
|
|
3824
|
+
}, config?: Config) => Promise<ModelService>;
|
|
3825
|
+
}
|
|
3826
|
+
|
|
3827
|
+
/**
|
|
3828
|
+
* Model Service 客户端 / Model Service Client
|
|
3829
|
+
*
|
|
3830
|
+
* 此模块提供模型服务和模型代理的客户端API。
|
|
3831
|
+
* This module provides the client API for model services and model proxies.
|
|
3832
|
+
*/
|
|
3833
|
+
|
|
3834
|
+
/**
|
|
3835
|
+
* Model Service 客户端 / Model Service Client
|
|
3836
|
+
*
|
|
3837
|
+
* 提供模型服务和模型代理的创建、删除、更新和查询功能。
|
|
3838
|
+
* Provides create, delete, update and query functions for model services and model proxies.
|
|
3839
|
+
*/
|
|
3840
|
+
declare class ModelClient {
|
|
3841
|
+
private controlApi;
|
|
3842
|
+
private config?;
|
|
3843
|
+
/**
|
|
3844
|
+
* 初始化客户端 / Initialize client
|
|
3845
|
+
*
|
|
3846
|
+
* @param config - 配置对象,可选 / Configuration object, optional
|
|
3847
|
+
*/
|
|
3848
|
+
constructor(config?: Config);
|
|
3849
|
+
/**
|
|
3850
|
+
* 创建模型服务
|
|
3851
|
+
* Create model service
|
|
3852
|
+
*
|
|
3853
|
+
* @param params - 参数 / Parameters
|
|
3854
|
+
* @returns 创建的对象 / Created object
|
|
3855
|
+
*/
|
|
3856
|
+
create: (params: {
|
|
3857
|
+
input: ModelServiceCreateInput | ModelProxyCreateInput;
|
|
3858
|
+
config?: Config;
|
|
3859
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
3860
|
+
/**
|
|
3861
|
+
* 删除模型服务
|
|
3862
|
+
* Delete model service
|
|
3863
|
+
*
|
|
3864
|
+
* @param params - 参数 / Parameters
|
|
3865
|
+
* @returns 删除的对象 / Deleted object
|
|
3866
|
+
*
|
|
3867
|
+
* @throws ResourceNotExistError - 模型服务不存在 / Model service does not exist
|
|
3868
|
+
*/
|
|
3869
|
+
delete: (params: {
|
|
3870
|
+
name: string;
|
|
3871
|
+
backendType?: BackendType;
|
|
3872
|
+
config?: Config;
|
|
3873
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
3874
|
+
/**
|
|
3875
|
+
* 更新模型服务
|
|
3876
|
+
* Update model service
|
|
3877
|
+
*
|
|
3878
|
+
* @param params - 参数 / Parameters
|
|
3879
|
+
* @returns 更新后的模型服务对象 / Updated model service object
|
|
3880
|
+
*
|
|
3881
|
+
* @throws ResourceNotExistError - 模型服务不存在 / Model service does not exist
|
|
3882
|
+
*/
|
|
3883
|
+
update: (params: {
|
|
3884
|
+
name: string;
|
|
3885
|
+
input: ModelServiceUpdateInput | ModelProxyUpdateInput;
|
|
3886
|
+
config?: Config;
|
|
3887
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
3888
|
+
/**
|
|
3889
|
+
* 获取模型服务
|
|
3890
|
+
* Get model service
|
|
3891
|
+
*
|
|
3892
|
+
* @param params - 参数 / Parameters
|
|
3893
|
+
* @returns 模型服务对象 / Model service object
|
|
3894
|
+
*
|
|
3895
|
+
* @throws ResourceNotExistError - 模型服务不存在 / Model service does not exist
|
|
3896
|
+
*/
|
|
3897
|
+
get: (params: {
|
|
3898
|
+
name: string;
|
|
3899
|
+
backendType?: BackendType;
|
|
3900
|
+
config?: Config;
|
|
3901
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
3902
|
+
/**
|
|
3903
|
+
* 列出模型服务
|
|
3904
|
+
* List model services
|
|
3905
|
+
*
|
|
3906
|
+
* @param params - 参数 / Parameters
|
|
3907
|
+
* @returns 模型服务列表 / Model service list
|
|
3908
|
+
*/
|
|
3909
|
+
list: (params: {
|
|
3910
|
+
input: ModelServiceListInput | ModelProxyListInput;
|
|
3911
|
+
config?: Config;
|
|
3912
|
+
}) => Promise<ModelService[] | ModelProxy[]>;
|
|
3913
|
+
}
|
|
3914
|
+
|
|
3915
|
+
/**
|
|
3916
|
+
* ToolSet Models
|
|
3917
|
+
*
|
|
3918
|
+
* ToolSet 相关的数据模型。
|
|
3919
|
+
* Data models for ToolSet.
|
|
3920
|
+
*/
|
|
3921
|
+
|
|
3922
|
+
/**
|
|
3923
|
+
* ToolSet schema type
|
|
3924
|
+
*/
|
|
3925
|
+
declare enum ToolSetSchemaType {
|
|
3926
|
+
OPENAPI = "OpenAPI",
|
|
3927
|
+
MCP = "MCP"
|
|
3928
|
+
}
|
|
3929
|
+
/**
|
|
3930
|
+
* ToolSet schema
|
|
3931
|
+
*/
|
|
3932
|
+
interface ToolSetSchema {
|
|
3933
|
+
/**
|
|
3934
|
+
* Schema type (OpenAPI, MCP)
|
|
3935
|
+
*/
|
|
3936
|
+
type?: ToolSetSchemaType;
|
|
3937
|
+
/**
|
|
3938
|
+
* Schema detail (URL or inline definition)
|
|
3939
|
+
*/
|
|
3940
|
+
detail?: string;
|
|
3941
|
+
}
|
|
3942
|
+
/**
|
|
3943
|
+
* ToolSet authorization configuration
|
|
3944
|
+
*/
|
|
3945
|
+
interface ToolSetAuthorization {
|
|
3946
|
+
/**
|
|
3947
|
+
* Authorization type
|
|
3948
|
+
*/
|
|
3949
|
+
type?: string;
|
|
3950
|
+
/**
|
|
3951
|
+
* API Key header name
|
|
3952
|
+
*/
|
|
3953
|
+
apiKeyHeaderName?: string;
|
|
3954
|
+
/**
|
|
3955
|
+
* API Key value
|
|
3956
|
+
*/
|
|
3957
|
+
apiKeyValue?: string;
|
|
3958
|
+
}
|
|
3959
|
+
/**
|
|
3960
|
+
* ToolSet specification
|
|
3961
|
+
*/
|
|
3962
|
+
interface ToolSetSpec {
|
|
3963
|
+
/**
|
|
3964
|
+
* Schema configuration
|
|
3965
|
+
*/
|
|
3966
|
+
schema?: ToolSetSchema;
|
|
3967
|
+
/**
|
|
3968
|
+
* Authorization configuration
|
|
3969
|
+
*/
|
|
3970
|
+
authConfig?: ToolSetAuthorization;
|
|
3971
|
+
}
|
|
3972
|
+
/**
|
|
3973
|
+
* MCP Tool meta
|
|
3974
|
+
*/
|
|
3975
|
+
interface MCPToolMeta {
|
|
3976
|
+
/**
|
|
3977
|
+
* Tool name
|
|
3978
|
+
*/
|
|
3979
|
+
name?: string;
|
|
3980
|
+
/**
|
|
3981
|
+
* Tool description
|
|
3982
|
+
*/
|
|
3983
|
+
description?: string;
|
|
3984
|
+
}
|
|
3985
|
+
/**
|
|
3986
|
+
* ToolSet status outputs
|
|
3987
|
+
*/
|
|
3988
|
+
interface ToolSetStatusOutputs {
|
|
3989
|
+
/**
|
|
3990
|
+
* MCP server configuration
|
|
3991
|
+
*/
|
|
3992
|
+
mcpServerConfig?: {
|
|
3993
|
+
url?: string;
|
|
3994
|
+
transport?: string;
|
|
3995
|
+
};
|
|
3996
|
+
/**
|
|
3997
|
+
* Tools list
|
|
3998
|
+
*/
|
|
3999
|
+
tools?: MCPToolMeta[];
|
|
4000
|
+
/**
|
|
4001
|
+
* URLs
|
|
4002
|
+
*/
|
|
4003
|
+
urls?: {
|
|
4004
|
+
cdpUrl?: string;
|
|
4005
|
+
liveViewUrl?: string;
|
|
4006
|
+
streamUrl?: string;
|
|
4007
|
+
};
|
|
4008
|
+
}
|
|
4009
|
+
/**
|
|
4010
|
+
* ToolSet status
|
|
4011
|
+
*/
|
|
4012
|
+
interface ToolSetStatus {
|
|
4013
|
+
/**
|
|
4014
|
+
* Current status
|
|
4015
|
+
*/
|
|
4016
|
+
status?: Status;
|
|
4017
|
+
/**
|
|
4018
|
+
* Status reason
|
|
4019
|
+
*/
|
|
4020
|
+
statusReason?: string;
|
|
4021
|
+
/**
|
|
4022
|
+
* Outputs
|
|
4023
|
+
*/
|
|
4024
|
+
outputs?: ToolSetStatusOutputs;
|
|
4025
|
+
}
|
|
4026
|
+
/**
|
|
4027
|
+
* ToolSet data interface
|
|
4028
|
+
*/
|
|
4029
|
+
interface ToolSetData {
|
|
4030
|
+
name?: string;
|
|
4031
|
+
uid?: string;
|
|
4032
|
+
kind?: string;
|
|
4033
|
+
description?: string;
|
|
4034
|
+
createdTime?: string;
|
|
4035
|
+
generation?: number;
|
|
4036
|
+
labels?: Record<string, string>;
|
|
4037
|
+
spec?: ToolSetSpec;
|
|
4038
|
+
status?: ToolSetStatus;
|
|
4039
|
+
}
|
|
4040
|
+
/**
|
|
4041
|
+
* ToolSet create input
|
|
4042
|
+
*/
|
|
4043
|
+
interface ToolSetCreateInput {
|
|
4044
|
+
/**
|
|
4045
|
+
* ToolSet name (required)
|
|
4046
|
+
*/
|
|
4047
|
+
name: string;
|
|
4048
|
+
/**
|
|
4049
|
+
* Description
|
|
4050
|
+
*/
|
|
4051
|
+
description?: string;
|
|
4052
|
+
/**
|
|
4053
|
+
* Labels
|
|
4054
|
+
*/
|
|
4055
|
+
labels?: Record<string, string>;
|
|
4056
|
+
/**
|
|
4057
|
+
* Spec configuration
|
|
4058
|
+
*/
|
|
4059
|
+
spec?: ToolSetSpec;
|
|
4060
|
+
}
|
|
4061
|
+
/**
|
|
4062
|
+
* ToolSet update input
|
|
4063
|
+
*/
|
|
4064
|
+
interface ToolSetUpdateInput {
|
|
4065
|
+
/**
|
|
4066
|
+
* Description
|
|
4067
|
+
*/
|
|
4068
|
+
description?: string;
|
|
4069
|
+
/**
|
|
4070
|
+
* Labels
|
|
4071
|
+
*/
|
|
4072
|
+
labels?: Record<string, string>;
|
|
4073
|
+
/**
|
|
4074
|
+
* Spec configuration
|
|
4075
|
+
*/
|
|
4076
|
+
spec?: ToolSetSpec;
|
|
4077
|
+
}
|
|
4078
|
+
/**
|
|
4079
|
+
* ToolSet list input
|
|
4080
|
+
*/
|
|
4081
|
+
interface ToolSetListInput {
|
|
4082
|
+
/**
|
|
4083
|
+
* Prefix filter
|
|
4084
|
+
*/
|
|
4085
|
+
prefix?: string;
|
|
4086
|
+
/**
|
|
4087
|
+
* Page size
|
|
4088
|
+
*/
|
|
4089
|
+
pageSize?: number;
|
|
4090
|
+
/**
|
|
4091
|
+
* Next token for pagination
|
|
4092
|
+
*/
|
|
4093
|
+
nextToken?: string;
|
|
4094
|
+
/**
|
|
4095
|
+
* Labels filter
|
|
4096
|
+
*/
|
|
4097
|
+
labels?: Record<string, string>;
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
/**
|
|
4101
|
+
* ToolSet Resource Class
|
|
4102
|
+
*
|
|
4103
|
+
* ToolSet 资源类,用于管理 ToolSet 资源。
|
|
4104
|
+
* Resource class for managing ToolSet resources.
|
|
4105
|
+
*/
|
|
4106
|
+
|
|
4107
|
+
/**
|
|
4108
|
+
* ToolSet resource class
|
|
4109
|
+
*/
|
|
4110
|
+
declare class ToolSet implements ToolSetData {
|
|
4111
|
+
name?: string;
|
|
4112
|
+
uid?: string;
|
|
4113
|
+
kind?: string;
|
|
4114
|
+
description?: string;
|
|
4115
|
+
createdTime?: string;
|
|
4116
|
+
generation?: number;
|
|
4117
|
+
labels?: Record<string, string>;
|
|
4118
|
+
spec?: ToolSetSpec;
|
|
4119
|
+
status?: ToolSetStatus;
|
|
4120
|
+
private _config?;
|
|
4121
|
+
constructor(data?: Partial<ToolSetData>, config?: Config);
|
|
4122
|
+
/**
|
|
4123
|
+
* Get ToolSet name (alias for name)
|
|
4124
|
+
*/
|
|
4125
|
+
get toolSetName(): string | undefined;
|
|
4126
|
+
/**
|
|
4127
|
+
* Get ToolSet ID (alias for uid)
|
|
4128
|
+
*/
|
|
4129
|
+
get toolSetId(): string | undefined;
|
|
4130
|
+
/**
|
|
4131
|
+
* Check if the toolset is ready
|
|
4132
|
+
*/
|
|
4133
|
+
get isReady(): boolean;
|
|
4134
|
+
/**
|
|
4135
|
+
* Create toolset from SDK response object
|
|
4136
|
+
*/
|
|
4137
|
+
static fromInnerObject(obj: $Devs.Toolset, config?: Config): ToolSet;
|
|
4138
|
+
/**
|
|
4139
|
+
* Get DevS client
|
|
4140
|
+
*/
|
|
4141
|
+
private static getClient;
|
|
4142
|
+
/**
|
|
4143
|
+
* Create a new ToolSet
|
|
4144
|
+
*/
|
|
4145
|
+
static create(params: {
|
|
4146
|
+
input: ToolSetCreateInput;
|
|
4147
|
+
config?: Config;
|
|
4148
|
+
}): Promise<ToolSet>;
|
|
4149
|
+
/**
|
|
4150
|
+
* Delete a ToolSet by Name
|
|
4151
|
+
*/
|
|
4152
|
+
static delete(params: {
|
|
4153
|
+
name: string;
|
|
4154
|
+
config?: Config;
|
|
4155
|
+
}): Promise<ToolSet>;
|
|
4156
|
+
/**
|
|
4157
|
+
* Get a ToolSet by Name
|
|
4158
|
+
*/
|
|
4159
|
+
static get(params: {
|
|
4160
|
+
name: string;
|
|
4161
|
+
config?: Config;
|
|
4162
|
+
}): Promise<ToolSet>;
|
|
4163
|
+
/**
|
|
4164
|
+
* List ToolSets
|
|
4165
|
+
*/
|
|
4166
|
+
static list(input?: ToolSetListInput, config?: Config): Promise<ToolSet[]>;
|
|
4167
|
+
/**
|
|
4168
|
+
* List all ToolSets with pagination
|
|
4169
|
+
*/
|
|
4170
|
+
static listAll(options?: {
|
|
4171
|
+
prefix?: string;
|
|
4172
|
+
labels?: Record<string, string>;
|
|
4173
|
+
}, config?: Config): Promise<ToolSet[]>;
|
|
4174
|
+
/**
|
|
4175
|
+
* Update a ToolSet by Name
|
|
4176
|
+
*/
|
|
4177
|
+
static update(params: {
|
|
4178
|
+
name: string;
|
|
4179
|
+
input: ToolSetUpdateInput;
|
|
4180
|
+
config?: Config;
|
|
4181
|
+
}): Promise<ToolSet>;
|
|
4182
|
+
/**
|
|
4183
|
+
* Handle API errors
|
|
4184
|
+
*/
|
|
4185
|
+
private static handleError;
|
|
4186
|
+
/**
|
|
4187
|
+
* Delete this toolset
|
|
4188
|
+
*/
|
|
4189
|
+
delete: (params?: {
|
|
4190
|
+
config?: Config;
|
|
4191
|
+
}) => Promise<ToolSet>;
|
|
4192
|
+
/**
|
|
4193
|
+
* Update this toolset
|
|
4194
|
+
*/
|
|
4195
|
+
update: (params: {
|
|
4196
|
+
input: ToolSetUpdateInput;
|
|
4197
|
+
config?: Config;
|
|
4198
|
+
}) => Promise<ToolSet>;
|
|
4199
|
+
/**
|
|
4200
|
+
* Refresh this toolset's data
|
|
4201
|
+
*/
|
|
4202
|
+
refresh: (params?: {
|
|
4203
|
+
config?: Config;
|
|
4204
|
+
}) => Promise<ToolSet>;
|
|
4205
|
+
/**
|
|
4206
|
+
* Wait until the toolset is ready
|
|
4207
|
+
*/
|
|
4208
|
+
waitUntilReady: (options?: {
|
|
4209
|
+
timeoutSeconds?: number;
|
|
4210
|
+
intervalSeconds?: number;
|
|
4211
|
+
beforeCheck?: (toolset: ToolSet) => void;
|
|
4212
|
+
}, config?: Config) => Promise<ToolSet>;
|
|
4213
|
+
/**
|
|
4214
|
+
* Get toolset type
|
|
4215
|
+
* 获取工具集类型
|
|
4216
|
+
*/
|
|
4217
|
+
type(): string | undefined;
|
|
4218
|
+
/**
|
|
4219
|
+
* List tools (async)
|
|
4220
|
+
* 异步获取工具列表,返回统一的 ToolInfo 列表
|
|
4221
|
+
*/
|
|
4222
|
+
listToolsAsync: (params?: {
|
|
4223
|
+
config?: Config;
|
|
4224
|
+
}) => Promise<any[]>;
|
|
4225
|
+
/**
|
|
4226
|
+
* List tools (sync wrapper)
|
|
4227
|
+
* 同步获取工具列表,返回统一的 ToolInfo 列表
|
|
4228
|
+
*/
|
|
4229
|
+
listTools: (config?: Config) => Promise<any[]>;
|
|
4230
|
+
/**
|
|
4231
|
+
* Call tool (async)
|
|
4232
|
+
* 异步调用工具,统一使用 ApiSet 实现
|
|
4233
|
+
*/
|
|
4234
|
+
callToolAsync: (name: string, args?: Record<string, unknown>, config?: Config) => Promise<any>;
|
|
4235
|
+
/**
|
|
4236
|
+
* Call tool (sync wrapper)
|
|
4237
|
+
* 同步调用工具,统一使用 ApiSet 实现
|
|
4238
|
+
*/
|
|
4239
|
+
callTool: (name: string, args?: Record<string, unknown>, config?: Config) => Promise<any>;
|
|
4240
|
+
/**
|
|
4241
|
+
* Convert ToolSet to unified ApiSet object
|
|
4242
|
+
* 将 ToolSet 转换为统一的 ApiSet 对象
|
|
4243
|
+
*/
|
|
4244
|
+
toApiSet: (params?: {
|
|
4245
|
+
config?: Config;
|
|
4246
|
+
}) => Promise<any>;
|
|
4247
|
+
/**
|
|
4248
|
+
* Get OpenAPI authentication defaults
|
|
4249
|
+
* 获取 OpenAPI 认证默认值
|
|
4250
|
+
*/
|
|
4251
|
+
private _getOpenAPIAuthDefaults;
|
|
4252
|
+
/**
|
|
4253
|
+
* Get OpenAPI base URL
|
|
4254
|
+
* 获取 OpenAPI 基础 URL
|
|
4255
|
+
*/
|
|
4256
|
+
private _getOpenAPIBaseUrl;
|
|
4257
|
+
}
|
|
4258
|
+
|
|
4259
|
+
/**
|
|
4260
|
+
* ToolSet Client
|
|
4261
|
+
*
|
|
4262
|
+
* ToolSet 客户端,提供 ToolSet 的管理功能。
|
|
4263
|
+
* Client for managing ToolSet resources.
|
|
4264
|
+
*/
|
|
4265
|
+
|
|
4266
|
+
/**
|
|
4267
|
+
* ToolSet Client
|
|
4268
|
+
*
|
|
4269
|
+
* 提供 ToolSet 的管理功能。
|
|
4270
|
+
*/
|
|
4271
|
+
declare class ToolSetClient {
|
|
4272
|
+
private config?;
|
|
4273
|
+
constructor(config?: Config);
|
|
4274
|
+
/**
|
|
4275
|
+
* Create a ToolSet
|
|
4276
|
+
*/
|
|
4277
|
+
createToolSet: (params: {
|
|
4278
|
+
input: ToolSetCreateInput;
|
|
4279
|
+
config?: Config;
|
|
4280
|
+
}) => Promise<ToolSet>;
|
|
4281
|
+
/**
|
|
4282
|
+
* Delete a ToolSet by name
|
|
4283
|
+
*/
|
|
4284
|
+
deleteToolSet: (params: {
|
|
4285
|
+
name: string;
|
|
4286
|
+
config?: Config;
|
|
4287
|
+
}) => Promise<ToolSet>;
|
|
4288
|
+
/**
|
|
4289
|
+
* Get a ToolSet by name
|
|
4290
|
+
*/
|
|
4291
|
+
getToolSet: (params: {
|
|
4292
|
+
name: string;
|
|
4293
|
+
config?: Config;
|
|
4294
|
+
}) => Promise<ToolSet>;
|
|
4295
|
+
/**
|
|
4296
|
+
* Update a ToolSet by name
|
|
4297
|
+
*/
|
|
4298
|
+
updateToolSet: (params: {
|
|
4299
|
+
name: string;
|
|
4300
|
+
input: ToolSetUpdateInput;
|
|
4301
|
+
config?: Config;
|
|
4302
|
+
}) => Promise<ToolSet>;
|
|
4303
|
+
/**
|
|
4304
|
+
* List ToolSets
|
|
4305
|
+
*/
|
|
4306
|
+
listToolSets: (params?: {
|
|
4307
|
+
input?: ToolSetListInput;
|
|
4308
|
+
config?: Config;
|
|
4309
|
+
}) => Promise<ToolSet[]>;
|
|
4310
|
+
/**
|
|
4311
|
+
* List all ToolSets with pagination
|
|
4312
|
+
*/
|
|
4313
|
+
listAllToolSets: (params?: {
|
|
4314
|
+
options?: {
|
|
4315
|
+
prefix?: string;
|
|
4316
|
+
labels?: Record<string, string>;
|
|
4317
|
+
};
|
|
4318
|
+
config?: Config;
|
|
4319
|
+
}) => Promise<ToolSet[]>;
|
|
4320
|
+
}
|
|
4321
|
+
|
|
4322
|
+
/**
|
|
4323
|
+
* Server Data Models
|
|
4324
|
+
*
|
|
4325
|
+
* 此模块定义 Server 相关的所有数据模型。
|
|
4326
|
+
* This module defines all data models related to Server.
|
|
4327
|
+
*/
|
|
4328
|
+
/**
|
|
4329
|
+
* Message role enum
|
|
4330
|
+
*/
|
|
4331
|
+
declare enum MessageRole {
|
|
4332
|
+
SYSTEM = "system",
|
|
4333
|
+
USER = "user",
|
|
4334
|
+
ASSISTANT = "assistant",
|
|
4335
|
+
TOOL = "tool"
|
|
4336
|
+
}
|
|
4337
|
+
/**
|
|
4338
|
+
* Event type enum for AgentEvent (Protocol agnostic)
|
|
4339
|
+
*
|
|
4340
|
+
* 定义核心事件类型,框架会自动转换为对应协议格式(OpenAI、AG-UI 等)。
|
|
4341
|
+
*/
|
|
4342
|
+
declare enum EventType {
|
|
4343
|
+
TEXT = "TEXT",// 文本内容块
|
|
4344
|
+
TOOL_CALL = "TOOL_CALL",// 完整工具调用(含 id, name, args)
|
|
4345
|
+
TOOL_CALL_CHUNK = "TOOL_CALL_CHUNK",// 工具调用参数片段(流式场景)
|
|
4346
|
+
TOOL_RESULT = "TOOL_RESULT",// 工具执行结果
|
|
4347
|
+
TOOL_RESULT_CHUNK = "TOOL_RESULT_CHUNK",// 工具执行结果片段(流式输出场景)
|
|
4348
|
+
ERROR = "ERROR",// 错误事件
|
|
4349
|
+
STATE = "STATE",// 状态更新(快照或增量)
|
|
4350
|
+
HITL = "HITL",// Human-in-the-Loop,请求人类介入
|
|
4351
|
+
CUSTOM = "CUSTOM",// 自定义事件
|
|
4352
|
+
RAW = "RAW"
|
|
4353
|
+
}
|
|
4354
|
+
/**
|
|
4355
|
+
* Tool call definition
|
|
4356
|
+
*/
|
|
4357
|
+
interface ToolCall$1 {
|
|
4358
|
+
id: string;
|
|
4359
|
+
type?: string;
|
|
4360
|
+
function: {
|
|
4361
|
+
name: string;
|
|
4362
|
+
arguments: string;
|
|
4363
|
+
};
|
|
4364
|
+
}
|
|
4365
|
+
/**
|
|
4366
|
+
* Tool definition
|
|
4367
|
+
*/
|
|
4368
|
+
interface Tool {
|
|
4369
|
+
type: string;
|
|
4370
|
+
function: {
|
|
4371
|
+
name: string;
|
|
4372
|
+
description?: string;
|
|
4373
|
+
parameters?: Record<string, unknown>;
|
|
4374
|
+
};
|
|
4375
|
+
}
|
|
4376
|
+
/**
|
|
4377
|
+
* Message in a conversation
|
|
4378
|
+
*/
|
|
4379
|
+
interface Message {
|
|
4380
|
+
id?: string;
|
|
4381
|
+
role: MessageRole;
|
|
4382
|
+
content?: string | Array<Record<string, unknown>>;
|
|
4383
|
+
name?: string;
|
|
4384
|
+
toolCalls?: ToolCall$1[];
|
|
4385
|
+
toolCallId?: string;
|
|
4386
|
+
}
|
|
4387
|
+
/**
|
|
4388
|
+
* Agent request
|
|
4389
|
+
*/
|
|
4390
|
+
interface AgentRequest {
|
|
4391
|
+
/** Protocol name */
|
|
4392
|
+
protocol?: string;
|
|
4393
|
+
/** Messages in the conversation */
|
|
4394
|
+
messages: Message[];
|
|
4395
|
+
/** Whether to stream the response */
|
|
4396
|
+
stream?: boolean;
|
|
4397
|
+
/** Model to use */
|
|
4398
|
+
model?: string;
|
|
4399
|
+
/** Available tools */
|
|
4400
|
+
tools?: Tool[];
|
|
4401
|
+
/** Additional metadata */
|
|
4402
|
+
metadata?: Record<string, unknown>;
|
|
4403
|
+
/** Raw HTTP request (for accessing headers, etc.) */
|
|
4404
|
+
rawRequest?: unknown;
|
|
4405
|
+
}
|
|
4406
|
+
/**
|
|
4407
|
+
* Merge options for addition field
|
|
4408
|
+
*/
|
|
4409
|
+
interface MergeOptions {
|
|
4410
|
+
noNewField?: boolean;
|
|
4411
|
+
concatList?: boolean;
|
|
4412
|
+
ignoreEmptyList?: boolean;
|
|
4413
|
+
}
|
|
4414
|
+
/**
|
|
4415
|
+
* Agent event (for streaming)
|
|
4416
|
+
*
|
|
4417
|
+
* 标准化的事件结构,协议无关设计。
|
|
4418
|
+
* 框架层会自动将 AgentEvent 转换为对应协议的格式(OpenAI、AG-UI 等)。
|
|
4419
|
+
*/
|
|
4420
|
+
interface AgentEvent {
|
|
4421
|
+
/** Event type */
|
|
4422
|
+
event: EventType;
|
|
4423
|
+
/** Event data */
|
|
4424
|
+
data?: Record<string, unknown>;
|
|
4425
|
+
/** Additional fields for protocol extension */
|
|
4426
|
+
addition?: Record<string, unknown>;
|
|
4427
|
+
/** Merge options for addition */
|
|
4428
|
+
additionMergeOptions?: MergeOptions;
|
|
4429
|
+
}
|
|
4430
|
+
/**
|
|
4431
|
+
* Agent result (alias for AgentEvent)
|
|
4432
|
+
*/
|
|
4433
|
+
type AgentResult = AgentEvent;
|
|
4434
|
+
/**
|
|
4435
|
+
* Protocol configuration base
|
|
4436
|
+
*/
|
|
4437
|
+
interface ProtocolConfig {
|
|
4438
|
+
prefix?: string;
|
|
4439
|
+
enable?: boolean;
|
|
4440
|
+
}
|
|
4441
|
+
/**
|
|
4442
|
+
* OpenAI protocol configuration
|
|
4443
|
+
*/
|
|
4444
|
+
interface OpenAIProtocolConfig extends ProtocolConfig {
|
|
4445
|
+
modelName?: string;
|
|
4446
|
+
}
|
|
4447
|
+
/**
|
|
4448
|
+
* AG-UI protocol configuration
|
|
4449
|
+
*/
|
|
4450
|
+
interface AGUIProtocolConfig extends ProtocolConfig {
|
|
4451
|
+
}
|
|
4452
|
+
/**
|
|
4453
|
+
* Server configuration
|
|
4454
|
+
*/
|
|
4455
|
+
interface ServerConfig {
|
|
4456
|
+
/** OpenAI protocol config */
|
|
4457
|
+
openai?: OpenAIProtocolConfig;
|
|
4458
|
+
/** AG-UI protocol config */
|
|
4459
|
+
agui?: AGUIProtocolConfig;
|
|
4460
|
+
/** CORS origins */
|
|
4461
|
+
corsOrigins?: string[];
|
|
4462
|
+
/** Port to listen on */
|
|
4463
|
+
port?: number;
|
|
4464
|
+
/** Host to listen on */
|
|
4465
|
+
host?: string;
|
|
4466
|
+
}
|
|
4467
|
+
|
|
4468
|
+
/**
|
|
4469
|
+
* AgentRun HTTP Server
|
|
4470
|
+
*
|
|
4471
|
+
* 基于 Node.js 的 HTTP 服务器实现。
|
|
4472
|
+
* HTTP server implementation based on Node.js.
|
|
4473
|
+
*/
|
|
4474
|
+
|
|
4475
|
+
/**
|
|
4476
|
+
* Agent invoke handler type
|
|
4477
|
+
*/
|
|
4478
|
+
type InvokeAgentHandler = (request: AgentRequest) => Promise<string | AgentResult | AsyncIterable<string | AgentResult>> | string | AgentResult | AsyncIterable<string | AgentResult>;
|
|
4479
|
+
/**
|
|
4480
|
+
* AgentRun HTTP Server
|
|
4481
|
+
*
|
|
4482
|
+
* 提供 HTTP 服务器功能,支持 OpenAI 和 AG-UI 协议。
|
|
4483
|
+
*/
|
|
4484
|
+
declare class AgentRunServer {
|
|
4485
|
+
private invokeAgent;
|
|
4486
|
+
private config;
|
|
4487
|
+
private server?;
|
|
4488
|
+
private aguiHandler;
|
|
4489
|
+
constructor(options: {
|
|
4490
|
+
invokeAgent: InvokeAgentHandler;
|
|
4491
|
+
config?: ServerConfig;
|
|
4492
|
+
});
|
|
4493
|
+
/**
|
|
4494
|
+
* Start the HTTP server
|
|
4495
|
+
*/
|
|
4496
|
+
start(options?: {
|
|
4497
|
+
host?: string;
|
|
4498
|
+
port?: number;
|
|
4499
|
+
}): void;
|
|
4500
|
+
/**
|
|
4501
|
+
* Stop the HTTP server
|
|
4502
|
+
*/
|
|
4503
|
+
stop(): Promise<void>;
|
|
4504
|
+
/**
|
|
4505
|
+
* Handle CORS headers
|
|
4506
|
+
*/
|
|
4507
|
+
private handleCors;
|
|
4508
|
+
/**
|
|
4509
|
+
* Handle HTTP request
|
|
4510
|
+
*/
|
|
4511
|
+
private handleRequest;
|
|
4512
|
+
/**
|
|
4513
|
+
* Handle AG-UI endpoint
|
|
4514
|
+
*/
|
|
4515
|
+
private handleAGUI;
|
|
4516
|
+
/**
|
|
4517
|
+
* Handle OpenAI chat completions endpoint
|
|
4518
|
+
*/
|
|
4519
|
+
private handleChatCompletions;
|
|
4520
|
+
/**
|
|
4521
|
+
* Parse request body
|
|
4522
|
+
*/
|
|
4523
|
+
private parseBody;
|
|
4524
|
+
/**
|
|
4525
|
+
* Check if value is async iterable
|
|
4526
|
+
*/
|
|
4527
|
+
private isAsyncIterable;
|
|
4528
|
+
/**
|
|
4529
|
+
* Convert result to async iterable
|
|
4530
|
+
*/
|
|
4531
|
+
private toAsyncIterable;
|
|
4532
|
+
}
|
|
4533
|
+
|
|
4534
|
+
/**
|
|
4535
|
+
* Adapter Interface Definition
|
|
4536
|
+
*
|
|
4537
|
+
* 定义统一的适配器接口,所有框架适配器都实现这些接口。
|
|
4538
|
+
* Defines unified adapter interfaces that all framework adapters implement.
|
|
4539
|
+
*/
|
|
4540
|
+
/**
|
|
4541
|
+
* 标准消息格式 (OpenAI 兼容)
|
|
4542
|
+
* Canonical message format (OpenAI compatible)
|
|
4543
|
+
*/
|
|
4544
|
+
interface CanonicalMessage {
|
|
4545
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
4546
|
+
content: string | null;
|
|
4547
|
+
name?: string;
|
|
4548
|
+
toolCalls?: ToolCall[];
|
|
4549
|
+
toolCallId?: string;
|
|
4550
|
+
}
|
|
4551
|
+
/**
|
|
4552
|
+
* 工具调用
|
|
4553
|
+
* Tool call
|
|
4554
|
+
*/
|
|
4555
|
+
interface ToolCall {
|
|
4556
|
+
id: string;
|
|
4557
|
+
type: "function";
|
|
4558
|
+
function: {
|
|
4559
|
+
name: string;
|
|
4560
|
+
arguments: string;
|
|
4561
|
+
};
|
|
4562
|
+
}
|
|
4563
|
+
/**
|
|
4564
|
+
* 标准工具定义
|
|
4565
|
+
* Canonical tool definition
|
|
4566
|
+
*/
|
|
4567
|
+
interface CanonicalTool {
|
|
4568
|
+
name: string;
|
|
4569
|
+
description: string;
|
|
4570
|
+
parameters?: Record<string, unknown>;
|
|
4571
|
+
func?: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
4572
|
+
}
|
|
4573
|
+
/**
|
|
4574
|
+
* 通用模型配置
|
|
4575
|
+
* Common model configuration
|
|
4576
|
+
*/
|
|
4577
|
+
interface CommonModelConfig {
|
|
4578
|
+
/** 模型端点 URL */
|
|
4579
|
+
endpoint?: string;
|
|
4580
|
+
/** API Key */
|
|
4581
|
+
apiKey?: string;
|
|
4582
|
+
/** 模型名称 */
|
|
4583
|
+
modelName?: string;
|
|
4584
|
+
/** 温度参数 */
|
|
4585
|
+
temperature?: number;
|
|
4586
|
+
/** 最大 tokens */
|
|
4587
|
+
maxTokens?: number;
|
|
4588
|
+
/** 超时时间 (毫秒) */
|
|
4589
|
+
timeout?: number;
|
|
4590
|
+
}
|
|
4591
|
+
/**
|
|
4592
|
+
* 消息适配器接口
|
|
4593
|
+
* Message adapter interface
|
|
4594
|
+
*
|
|
4595
|
+
* 用于在不同框架消息格式之间进行转换。
|
|
4596
|
+
* Used to convert between different framework message formats.
|
|
4597
|
+
*/
|
|
4598
|
+
interface MessageAdapter<TFrameworkMessage = unknown> {
|
|
4599
|
+
/**
|
|
4600
|
+
* 将框架消息转换为标准格式
|
|
4601
|
+
* Convert framework messages to canonical format
|
|
4602
|
+
*/
|
|
4603
|
+
toCanonical(messages: TFrameworkMessage[]): CanonicalMessage[];
|
|
4604
|
+
/**
|
|
4605
|
+
* 将标准消息转换为框架格式
|
|
4606
|
+
* Convert canonical messages to framework format
|
|
4607
|
+
*/
|
|
4608
|
+
fromCanonical(messages: CanonicalMessage[]): TFrameworkMessage[];
|
|
4609
|
+
}
|
|
4610
|
+
/**
|
|
4611
|
+
* 工具适配器接口
|
|
4612
|
+
* Tool adapter interface
|
|
4613
|
+
*
|
|
4614
|
+
* 用于将标准工具定义转换为框架特定格式。
|
|
4615
|
+
* Used to convert canonical tool definitions to framework-specific format.
|
|
4616
|
+
*/
|
|
4617
|
+
interface ToolAdapter<TFrameworkTool = unknown> {
|
|
4618
|
+
/**
|
|
4619
|
+
* 将标准工具转换为框架格式
|
|
4620
|
+
* Convert canonical tools to framework format
|
|
4621
|
+
*/
|
|
4622
|
+
fromCanonical(tools: CanonicalTool[]): TFrameworkTool[];
|
|
4623
|
+
/**
|
|
4624
|
+
* 将框架工具转换为标准格式 (可选)
|
|
4625
|
+
* Convert framework tools to canonical format (optional)
|
|
4626
|
+
*/
|
|
4627
|
+
toCanonical?(tools: TFrameworkTool[]): CanonicalTool[];
|
|
4628
|
+
}
|
|
4629
|
+
/**
|
|
4630
|
+
* 模型适配器接口
|
|
4631
|
+
* Model adapter interface
|
|
4632
|
+
*
|
|
4633
|
+
* 用于包装框架模型,使其能够与 AgentRun 协同工作。
|
|
4634
|
+
* Used to wrap framework models to work with AgentRun.
|
|
4635
|
+
*/
|
|
4636
|
+
interface ModelAdapter<TFrameworkModel = unknown> {
|
|
4637
|
+
/**
|
|
4638
|
+
* 使用 AgentRun 模型配置创建框架模型
|
|
4639
|
+
* Create framework model with AgentRun model configuration
|
|
4640
|
+
*/
|
|
4641
|
+
createModel(config: CommonModelConfig): TFrameworkModel;
|
|
4642
|
+
}
|
|
4643
|
+
/**
|
|
4644
|
+
* 框架集成适配器
|
|
4645
|
+
* Framework integration adapter
|
|
4646
|
+
*
|
|
4647
|
+
* 组合消息、工具和模型适配器的完整框架集成。
|
|
4648
|
+
* Complete framework integration combining message, tool, and model adapters.
|
|
4649
|
+
*/
|
|
4650
|
+
interface FrameworkAdapter<TMessage = unknown, TTool = unknown, TModel = unknown> {
|
|
4651
|
+
name: string;
|
|
4652
|
+
message: MessageAdapter<TMessage>;
|
|
4653
|
+
tool: ToolAdapter<TTool>;
|
|
4654
|
+
model: ModelAdapter<TModel>;
|
|
4655
|
+
}
|
|
4656
|
+
/**
|
|
4657
|
+
* 将 JSON Schema 类型转换为 TypeScript 类型
|
|
4658
|
+
* Convert JSON Schema type to TypeScript type
|
|
4659
|
+
*/
|
|
4660
|
+
declare function schemaToType(schema: Record<string, unknown>): string;
|
|
4661
|
+
|
|
4662
|
+
/**
|
|
4663
|
+
* Mastra Types
|
|
4664
|
+
*
|
|
4665
|
+
* Mastra 框架相关的类型定义。
|
|
4666
|
+
* Type definitions for Mastra framework.
|
|
4667
|
+
*/
|
|
4668
|
+
/**
|
|
4669
|
+
* Mastra 消息格式
|
|
4670
|
+
* Mastra message format
|
|
4671
|
+
*/
|
|
4672
|
+
interface MastraMessage {
|
|
4673
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
4674
|
+
content: string | null;
|
|
4675
|
+
name?: string;
|
|
4676
|
+
tool_call_id?: string;
|
|
4677
|
+
tool_calls?: MastraToolCall[];
|
|
4678
|
+
}
|
|
4679
|
+
/**
|
|
4680
|
+
* Mastra 工具调用
|
|
4681
|
+
* Mastra tool call
|
|
4682
|
+
*/
|
|
4683
|
+
interface MastraToolCall {
|
|
4684
|
+
id: string;
|
|
4685
|
+
type: "function";
|
|
4686
|
+
function: {
|
|
4687
|
+
name: string;
|
|
4688
|
+
arguments: string;
|
|
4689
|
+
};
|
|
4690
|
+
}
|
|
4691
|
+
/**
|
|
4692
|
+
* Mastra 工具定义
|
|
4693
|
+
* Mastra tool definition
|
|
4694
|
+
*/
|
|
4695
|
+
interface MastraTool {
|
|
4696
|
+
name: string;
|
|
4697
|
+
description: string;
|
|
4698
|
+
inputSchema?: Record<string, unknown>;
|
|
4699
|
+
execute?: (...args: unknown[]) => Promise<unknown>;
|
|
4700
|
+
}
|
|
4701
|
+
/**
|
|
4702
|
+
* Mastra 模型配置
|
|
4703
|
+
* Mastra model configuration
|
|
4704
|
+
*/
|
|
4705
|
+
interface MastraModelConfig {
|
|
4706
|
+
provider: string;
|
|
4707
|
+
modelId: string;
|
|
4708
|
+
apiKey?: string;
|
|
4709
|
+
baseUrl?: string;
|
|
4710
|
+
temperature?: number;
|
|
4711
|
+
maxTokens?: number;
|
|
4712
|
+
}
|
|
4713
|
+
/**
|
|
4714
|
+
* Mastra Agent 配置
|
|
4715
|
+
* Mastra agent configuration
|
|
4716
|
+
*/
|
|
4717
|
+
interface MastraAgentConfig {
|
|
4718
|
+
name: string;
|
|
4719
|
+
instructions?: string;
|
|
4720
|
+
model: MastraModelConfig;
|
|
4721
|
+
tools?: MastraTool[];
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
/**
|
|
4725
|
+
* Mastra Adapter
|
|
4726
|
+
*
|
|
4727
|
+
* Mastra 框架的集成适配器。
|
|
4728
|
+
* Integration adapter for Mastra framework.
|
|
4729
|
+
*/
|
|
4730
|
+
|
|
4731
|
+
/**
|
|
4732
|
+
* Mastra 消息适配器
|
|
4733
|
+
* Mastra message adapter
|
|
4734
|
+
*/
|
|
4735
|
+
declare class MastraMessageAdapter implements MessageAdapter<MastraMessage> {
|
|
4736
|
+
/**
|
|
4737
|
+
* 将 Mastra 消息转换为标准格式
|
|
4738
|
+
*/
|
|
4739
|
+
toCanonical(messages: MastraMessage[]): CanonicalMessage[];
|
|
4740
|
+
/**
|
|
4741
|
+
* 将标准消息转换为 Mastra 格式
|
|
4742
|
+
*/
|
|
4743
|
+
fromCanonical(messages: CanonicalMessage[]): MastraMessage[];
|
|
4744
|
+
}
|
|
4745
|
+
/**
|
|
4746
|
+
* Mastra 工具适配器
|
|
4747
|
+
* Mastra tool adapter
|
|
4748
|
+
*/
|
|
4749
|
+
declare class MastraToolAdapter implements ToolAdapter<MastraTool> {
|
|
4750
|
+
/**
|
|
4751
|
+
* 将标准工具转换为 Mastra 格式
|
|
4752
|
+
*/
|
|
4753
|
+
fromCanonical(tools: CanonicalTool[]): MastraTool[];
|
|
4754
|
+
/**
|
|
4755
|
+
* 将 Mastra 工具转换为标准格式
|
|
4756
|
+
*/
|
|
4757
|
+
toCanonical(tools: MastraTool[]): CanonicalTool[];
|
|
4758
|
+
}
|
|
4759
|
+
/**
|
|
4760
|
+
* Mastra 模型适配器
|
|
4761
|
+
* Mastra model adapter
|
|
4762
|
+
*/
|
|
4763
|
+
declare class MastraModelAdapter implements ModelAdapter<MastraModelConfig> {
|
|
4764
|
+
/**
|
|
4765
|
+
* 使用 AgentRun 配置创建 Mastra 模型配置
|
|
4766
|
+
*/
|
|
4767
|
+
createModel(config: CommonModelConfig): MastraModelConfig;
|
|
4768
|
+
/**
|
|
4769
|
+
* 检测模型提供商
|
|
4770
|
+
*/
|
|
4771
|
+
private detectProvider;
|
|
4772
|
+
}
|
|
4773
|
+
/**
|
|
4774
|
+
* Mastra 完整框架适配器
|
|
4775
|
+
* Mastra complete framework adapter
|
|
4776
|
+
*/
|
|
4777
|
+
declare class MastraAdapter implements FrameworkAdapter<MastraMessage, MastraTool, MastraModelConfig> {
|
|
4778
|
+
readonly name = "mastra";
|
|
4779
|
+
readonly message: MastraMessageAdapter;
|
|
4780
|
+
readonly tool: MastraToolAdapter;
|
|
4781
|
+
readonly model: MastraModelAdapter;
|
|
4782
|
+
}
|
|
4783
|
+
/**
|
|
4784
|
+
* 创建 Mastra 适配器实例
|
|
4785
|
+
* Create Mastra adapter instance
|
|
4786
|
+
*/
|
|
4787
|
+
declare function createMastraAdapter(): MastraAdapter;
|
|
4788
|
+
/**
|
|
4789
|
+
* 将 AgentRun 工具包装为 Mastra 工具
|
|
4790
|
+
* Wrap AgentRun tools as Mastra tools
|
|
4791
|
+
*/
|
|
4792
|
+
declare function wrapTools(tools: CanonicalTool[]): MastraTool[];
|
|
4793
|
+
/**
|
|
4794
|
+
* 将 AgentRun 模型配置转换为 Mastra 模型配置
|
|
4795
|
+
* Convert AgentRun model config to Mastra model config
|
|
4796
|
+
*/
|
|
4797
|
+
declare function wrapModel(config: CommonModelConfig): MastraModelConfig;
|
|
4798
|
+
/**
|
|
4799
|
+
* Agent 包装器配置参数
|
|
4800
|
+
* Agent wrapper configuration parameters
|
|
4801
|
+
*/
|
|
4802
|
+
interface WrapAgentParams {
|
|
4803
|
+
/** Agent 名称 */
|
|
4804
|
+
name: string;
|
|
4805
|
+
/** Agent 指令/系统提示词 */
|
|
4806
|
+
instructions?: string;
|
|
4807
|
+
/** 模型配置 */
|
|
4808
|
+
modelConfig: CommonModelConfig;
|
|
4809
|
+
/** 工具列表 */
|
|
4810
|
+
tools?: CanonicalTool[];
|
|
4811
|
+
}
|
|
4812
|
+
/**
|
|
4813
|
+
* 将 AgentRun 组件包装为完整的 Mastra Agent 配置
|
|
4814
|
+
* Wrap AgentRun components as complete Mastra agent configuration
|
|
4815
|
+
*
|
|
4816
|
+
* @param params - Agent 包装器配置参数
|
|
4817
|
+
* @returns Mastra Agent 配置对象
|
|
4818
|
+
*
|
|
4819
|
+
* @example
|
|
4820
|
+
* ```typescript
|
|
4821
|
+
* const agentConfig = wrapAgent({
|
|
4822
|
+
* name: "MyAssistant",
|
|
4823
|
+
* instructions: "You are a helpful assistant",
|
|
4824
|
+
* modelConfig: {
|
|
4825
|
+
* endpoint: "https://api.openai.com/v1",
|
|
4826
|
+
* apiKey: "sk-...",
|
|
4827
|
+
* modelName: "gpt-4"
|
|
4828
|
+
* },
|
|
4829
|
+
* tools: [calculatorTool, weatherTool]
|
|
4830
|
+
* });
|
|
4831
|
+
* ```
|
|
4832
|
+
*/
|
|
4833
|
+
declare function wrapAgent(params: WrapAgentParams): MastraAgentConfig;
|
|
4834
|
+
|
|
4835
|
+
/**
|
|
4836
|
+
* AgentRun SDK for Node.js
|
|
4837
|
+
*
|
|
4838
|
+
* AgentRun SDK 是阿里云 AgentRun 服务的 Node.js 客户端库。
|
|
4839
|
+
* Provides simple and easy-to-use APIs for managing AI Agent runtime environments,
|
|
4840
|
+
* model services, sandbox environments, etc.
|
|
4841
|
+
*
|
|
4842
|
+
* @packageDocumentation
|
|
4843
|
+
*/
|
|
4844
|
+
declare const VERSION = "0.0.1";
|
|
4845
|
+
|
|
4846
|
+
export { type AgentRequest, type AgentResult, AgentRunError, AgentRunServer, AgentRuntime, AgentRuntimeArtifact, AgentRuntimeClient, type AgentRuntimeCode, type AgentRuntimeContainer, AgentRuntimeControlAPI, type AgentRuntimeCreateInput, AgentRuntimeEndpoint, type AgentRuntimeEndpointCreateInput, type AgentRuntimeEndpointListInput, type AgentRuntimeEndpointRoutingConfig, type AgentRuntimeEndpointRoutingWeight, type AgentRuntimeEndpointUpdateInput, type AgentRuntimeHealthCheckConfig, AgentRuntimeLanguage, type AgentRuntimeListInput, type AgentRuntimeLogConfig, type AgentRuntimeProtocolConfig, AgentRuntimeProtocolType, type AgentRuntimeUpdateInput, type AgentRuntimeVersion, AioDataAPI, AioSandbox, BackendType, BrowserDataAPI, BrowserSandbox, type CanonicalMessage, type CanonicalTool, ClientError, CodeInterpreterDataAPI, CodeInterpreterSandbox, CodeLanguage, type CommonModelConfig, Config, type ConfigOptions, Credential, type CredentialBasicAuth, CredentialClient, CredentialConfig, CredentialControlAPI, type CredentialCreateInput, type CredentialListInput, type CredentialUpdateInput, EventType, type ExecuteCodeResult, type FileInfo, type FrameworkAdapter, HTTPError, type MCPToolMeta, MastraAdapter, type MastraAgentConfig, type MastraMessage, MastraMessageAdapter, MastraModelAdapter, type MastraModelConfig, type MastraTool, MastraToolAdapter, type MastraToolCall, type Message, type MessageAdapter, MessageRole, type ModelAdapter, ModelClient, ControlAPI as ModelControlAPI, type ModelFeatures, type ModelInfoConfig, type ModelParameterRule, type ModelProperties, ModelProxy, type ModelProxyCreateInput, type ModelProxyListInput, type ModelProxyUpdateInput, ModelService, type ModelServiceCreateInput, type ModelServiceListInput, type ModelServiceUpdateInput, ModelType, Provider, type ProviderSettings, type ProxyConfig, type ProxyConfigEndpoint, type ProxyConfigFallback, type ProxyConfigPolicies, type RelatedResource, ResourceAlreadyExistError, ResourceNotExistError, Sandbox, SandboxClient, type SandboxCreateInput, type SandboxData, SandboxDataAPI, type SandboxListInput, SandboxState, type ServerConfig, ServerError, Status, Template, type TemplateArmsConfiguration, type TemplateContainerConfiguration, type TemplateCreateInput, type TemplateCredentialConfiguration, type TemplateData, type TemplateListInput, type TemplateLogConfiguration, type TemplateMcpOptions, type TemplateMcpState, type TemplateNetworkConfiguration, TemplateNetworkMode, TemplateOSSPermission, type TemplateOssConfiguration, TemplateType, type TemplateUpdateInput, type ToolAdapter, type ToolCall, ToolSet, type ToolSetAuthorization, ToolSetClient, type ToolSetCreateInput, type ToolSetData, type ToolSetListInput, type ToolSetSchema, ToolSetSchemaType, type ToolSetSpec, type ToolSetStatus, type ToolSetStatusOutputs, type ToolSetUpdateInput, VERSION, type WrapAgentParams, createMastraAdapter, schemaToType, wrapAgent, wrapModel, wrapTools };
|