@cloudbase/manager-node 4.11.0-alpha.1 → 4.11.0-alpha.11
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/.claude/settings.local.json +9 -0
- package/jest.config.js +1 -0
- package/lib/agent/index.js +607 -16
- package/lib/agent/type.js +1 -0
- package/lib/cloudApp/index.js +243 -0
- package/lib/cloudApp/types.js +10 -0
- package/lib/database/index.js +79 -0
- package/lib/docs/index.js +288 -0
- package/lib/docs/types.js +2 -0
- package/lib/env/index.js +92 -0
- package/lib/environment.js +20 -0
- package/lib/function/index.js +97 -33
- package/lib/index.js +34 -0
- package/lib/interfaces/cloudApp.interface.js +20 -0
- package/lib/interfaces/index.js +1 -0
- package/lib/log/index.js +105 -0
- package/lib/log/types.js +24 -0
- package/lib/mysql/index.js +551 -0
- package/lib/mysql/types/account.js +2 -0
- package/lib/mysql/types/backup.js +2 -0
- package/lib/mysql/types/base.js +2 -0
- package/lib/mysql/types/index.js +19 -0
- package/lib/permission/index.js +310 -0
- package/lib/permission/types.js +2 -0
- package/lib/storage/index.js +424 -10
- package/lib/user/index.js +200 -0
- package/package.json +1 -1
- package/types/agent/index.d.ts +115 -5
- package/types/agent/type.d.ts +389 -0
- package/types/cloudApp/index.d.ts +73 -0
- package/types/cloudApp/types.d.ts +325 -0
- package/types/database/index.d.ts +112 -0
- package/types/docs/index.d.ts +37 -0
- package/types/docs/types.d.ts +24 -0
- package/types/env/index.d.ts +39 -1
- package/types/env/type.d.ts +187 -0
- package/types/environment.d.ts +12 -0
- package/types/function/index.d.ts +34 -5
- package/types/index.d.ts +26 -0
- package/types/interfaces/cloudApp.interface.d.ts +4 -0
- package/types/interfaces/index.d.ts +1 -0
- package/types/log/index.d.ts +53 -0
- package/types/log/types.d.ts +177 -0
- package/types/mysql/index.d.ts +261 -0
- package/types/mysql/types/account.d.ts +160 -0
- package/types/mysql/types/backup.d.ts +161 -0
- package/types/mysql/types/base.d.ts +579 -0
- package/types/mysql/types/index.d.ts +3 -0
- package/types/permission/index.d.ts +31 -0
- package/types/permission/types.d.ts +127 -0
- package/types/storage/index.d.ts +151 -3
- package/types/user/index.d.ts +17 -1
- package/types/user/types.d.ts +62 -0
package/types/agent/index.d.ts
CHANGED
|
@@ -1,17 +1,127 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
|
-
import { ICreateFunctionAgentParams } from './type';
|
|
2
|
+
import { ICreateFunctionAgentParams, ICreateAgentParams, ICreateTcbrAgentByImageParams, ICreateTcbrAgentByPackageParams, ICreateTcbrAgentByCodeParams, IDescribeAgentListParams, IDescribeAgentListResponse, IDescribeAgentResponse, IDeleteAgentParams, IDescribeCloudBaseBuildServiceParams, IDescribeCloudBaseBuildServiceResponse, ICreateAgentResponse, IDeleteAgentResponse, ICommonResponse, IUpdateAgentParams, IUpdateScfAgentParams, IUpdateScfAgentResponse, IUpdateTcbrAgentParams, IGetAgentLogsParams } from './type';
|
|
3
3
|
/**
|
|
4
4
|
* Agent 管理类
|
|
5
|
+
* 支持三种部署方式:
|
|
6
|
+
* - SCF 云函数:轻量级、按需计费
|
|
7
|
+
* - TCBR 云托管-镜像:容器化部署
|
|
8
|
+
* - TCBR 云托管-代码包:源码部署
|
|
5
9
|
*/
|
|
6
10
|
export declare class AgentService {
|
|
7
11
|
private environment;
|
|
8
12
|
private tcbService;
|
|
9
13
|
constructor(environment: Environment);
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* 创建 Agent
|
|
16
|
+
* 支持两种方式:
|
|
17
|
+
* 1. 传入 cwd 代码目录,自动打包上传
|
|
18
|
+
* 2. 传入 ZipFile / CosBucketRegion + TempCosObjectName,直接上传
|
|
19
|
+
* @param params 创建参数
|
|
20
|
+
* @returns Agent 创建结果
|
|
21
|
+
*/
|
|
22
|
+
createAgent(params: ICreateAgentParams): Promise<ICreateAgentResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* 查询 Agent 列表
|
|
25
|
+
* @param params 查询参数
|
|
26
|
+
* @returns Agent 列表
|
|
27
|
+
*/
|
|
28
|
+
describeAgentList(params?: IDescribeAgentListParams): Promise<IDescribeAgentListResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* 查询单个 Agent 详情(包含可用状态)
|
|
31
|
+
* @param agentId Agent ID
|
|
32
|
+
* @returns Agent 详情,IsReady 表示是否可用
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const result = await agentService.describeAgent('agent-xxx')
|
|
36
|
+
* if (result.IsReady) {
|
|
37
|
+
* console.log('Agent 已就绪,可以调用')
|
|
38
|
+
* } else {
|
|
39
|
+
* console.log('Agent 不可用:', result.NotReadyReason)
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
describeAgent(agentId: string): Promise<IDescribeAgentResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* 删除 Agent
|
|
46
|
+
* 先删除 Agent 记录,再尝试删除底层的云函数或云托管服务
|
|
47
|
+
* @param params 删除参数
|
|
48
|
+
* @returns 操作结果,包含 Agent 和底层资源的删除状态
|
|
49
|
+
*/
|
|
50
|
+
deleteAgent(params: IDeleteAgentParams): Promise<IDeleteAgentResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* 更新 Agent(自动判断类型)
|
|
53
|
+
* 先查询 Agent 类型,然后调用对应的更新方法
|
|
54
|
+
* @param params 更新参数
|
|
55
|
+
* @returns 操作结果
|
|
56
|
+
*/
|
|
57
|
+
updateAgent(params: IUpdateAgentParams): Promise<IUpdateScfAgentResponse>;
|
|
58
|
+
/**
|
|
59
|
+
* 更新 SCF Agent(云函数)
|
|
60
|
+
* 支持两种方式:本地代码目录、ZIP 文件
|
|
61
|
+
* @param params 更新参数
|
|
62
|
+
* @returns 更新结果,包含耗时信息
|
|
63
|
+
*/
|
|
64
|
+
updateScfAgent(params: IUpdateScfAgentParams): Promise<IUpdateScfAgentResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* 获取 Agent 调用日志(自动判断类型)
|
|
67
|
+
* @param params 查询参数
|
|
68
|
+
* @returns 日志结果,根据 Agent 类型返回不同结构:
|
|
69
|
+
* - SCF: IFunctionLogDetailRes[]
|
|
70
|
+
* - TCBR: ISearchClsLogResponse
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const logs = await agentService.getAgentLogs({
|
|
74
|
+
* AgentId: 'agent-xxx',
|
|
75
|
+
* limit: 20,
|
|
76
|
+
* startTime: '2025-01-01 00:00:00',
|
|
77
|
+
* endTime: '2025-01-01 23:59:59'
|
|
78
|
+
* })
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getAgentLogs(params: IGetAgentLogsParams): Promise<any>;
|
|
82
|
+
/**
|
|
83
|
+
* 通过镜像创建 TCBR Agent
|
|
84
|
+
* @internal 暂不对外暴露,后续版本开放
|
|
85
|
+
* @param params 创建参数
|
|
86
|
+
* @returns Agent 创建结果
|
|
87
|
+
*/
|
|
88
|
+
createTcbrAgentByImage(params: ICreateTcbrAgentByImageParams): Promise<ICreateAgentResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* 获取代码包上传信息
|
|
91
|
+
* @internal 暂不对外暴露,后续版本开放
|
|
92
|
+
* @param params 查询参数
|
|
93
|
+
* @returns 上传信息
|
|
94
|
+
*/
|
|
95
|
+
describeCloudBaseBuildService(params: IDescribeCloudBaseBuildServiceParams): Promise<IDescribeCloudBaseBuildServiceResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* 通过代码包信息创建 TCBR Agent(已上传代码包)
|
|
98
|
+
* @internal 暂不对外暴露,后续版本开放
|
|
99
|
+
* @param params 创建参数
|
|
100
|
+
* @returns Agent 创建结果
|
|
101
|
+
*/
|
|
102
|
+
createTcbrAgentByPackage(params: ICreateTcbrAgentByPackageParams): Promise<ICreateAgentResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* 通过本地代码创建 TCBR Agent(自动打包上传)
|
|
105
|
+
* @internal 暂不对外暴露,后续版本开放
|
|
106
|
+
* @param cwd 代码目录,默认当前工作目录
|
|
107
|
+
* @param params 创建参数
|
|
108
|
+
* @returns Agent 创建结果
|
|
109
|
+
*/
|
|
110
|
+
createTcbrAgentByCode(cwd: string, params: ICreateTcbrAgentByCodeParams): Promise<ICreateAgentResponse>;
|
|
111
|
+
/**
|
|
112
|
+
* 更新 TCBR Agent(云托管)
|
|
113
|
+
* 支持两种方式:本地代码目录、镜像
|
|
114
|
+
* @internal 暂不对外暴露,后续版本开放
|
|
115
|
+
* @param params 更新参数
|
|
116
|
+
* @returns 操作结果
|
|
117
|
+
*/
|
|
118
|
+
updateTcbrAgent(params: IUpdateTcbrAgentParams): Promise<ICommonResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated 请使用 createTcbrAgentByCode
|
|
121
|
+
* 创建函数型 Agent(旧版)
|
|
122
|
+
* @param cwd 工作目录
|
|
123
|
+
* @param agentInfo Agent 信息
|
|
124
|
+
* @returns Agent 创建结果
|
|
15
125
|
*/
|
|
16
126
|
createFunctionAgent(cwd: string, agentInfo: ICreateFunctionAgentParams): Promise<{
|
|
17
127
|
BotId: string;
|
package/types/agent/type.d.ts
CHANGED
|
@@ -1,3 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent 类型
|
|
3
|
+
*/
|
|
4
|
+
export type AgentType = 'scf' | 'tcbr';
|
|
5
|
+
/**
|
|
6
|
+
* 运行时版本
|
|
7
|
+
*/
|
|
8
|
+
export type RuntimeVersion = 'Nodejs20.19' | 'Nodejs18.15' | 'Nodejs16.13' | 'Nodejs14.18' | 'Python3.10' | 'Python3.9' | 'Python3.7' | 'Php8.0' | 'Php7.4' | 'Go1' | 'Java11' | 'Java8';
|
|
9
|
+
/**
|
|
10
|
+
* 会话来源
|
|
11
|
+
*/
|
|
12
|
+
export type SessionSource = 'HEADER' | 'COOKIE' | 'QUERY_STRING';
|
|
13
|
+
/**
|
|
14
|
+
* 会话配置
|
|
15
|
+
*/
|
|
16
|
+
export interface ISessionConfig {
|
|
17
|
+
/** 会话来源,默认 'HEADER' */
|
|
18
|
+
SessionSource?: SessionSource;
|
|
19
|
+
/** 会话名称,5-40字符,字母开头 */
|
|
20
|
+
SessionName?: string;
|
|
21
|
+
/** 单实例并发会话数,1-100,默认 1 */
|
|
22
|
+
MaximumConcurrencySessionPerInstance?: number;
|
|
23
|
+
/** 会话最长生命周期(秒),1-604800,默认 21600 */
|
|
24
|
+
MaximumTTLInSeconds?: number;
|
|
25
|
+
/** 会话最长空闲时间(秒),不超过 TTL,默认 1800 */
|
|
26
|
+
MaximumIdleTimeInSeconds?: number;
|
|
27
|
+
/** 单实例最大并发数,1-100,默认 50 */
|
|
28
|
+
MaxConcurrency?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 创建 Agent 的参数
|
|
32
|
+
* 支持两种方式:
|
|
33
|
+
* 1. 传入 cwd 代码目录,自动打包上传
|
|
34
|
+
* 2. 传入 ZipFile / CosBucketRegion + TempCosObjectName,直接上传
|
|
35
|
+
*/
|
|
36
|
+
export interface ICreateAgentParams {
|
|
37
|
+
/** Agent 名称 */
|
|
38
|
+
Name: string;
|
|
39
|
+
/** Agent ID,不传则自动生成 */
|
|
40
|
+
AgentId?: string;
|
|
41
|
+
/** 环境变量 */
|
|
42
|
+
envVariables?: Record<string, string>;
|
|
43
|
+
/** 运行时版本 */
|
|
44
|
+
Runtime: RuntimeVersion;
|
|
45
|
+
/** 超时时间(秒),1-900,默认 3 */
|
|
46
|
+
Timeout?: number;
|
|
47
|
+
/** 函数运行时内存大小(MB),可选 64、128-3072(128为阶梯),默认 128 */
|
|
48
|
+
MemorySize?: number;
|
|
49
|
+
/** 是否自动安装依赖,默认 false */
|
|
50
|
+
InstallDependency?: boolean;
|
|
51
|
+
/** 会话配置 */
|
|
52
|
+
SessionConfig?: ISessionConfig;
|
|
53
|
+
/** 代码目录路径 */
|
|
54
|
+
cwd?: string;
|
|
55
|
+
/** 忽略的文件模式 */
|
|
56
|
+
ignore?: string | string[];
|
|
57
|
+
/** 部署方式:zip(直接上传)或 cos(COS 上传,大文件推荐) */
|
|
58
|
+
deployMode?: 'zip' | 'cos';
|
|
59
|
+
/** Base64 编码的 ZIP 文件内容 */
|
|
60
|
+
ZipFile?: string;
|
|
61
|
+
/** COS Bucket 区域 */
|
|
62
|
+
CosBucketRegion?: string;
|
|
63
|
+
/** COS 临时对象名称 */
|
|
64
|
+
TempCosObjectName?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 仓库信息
|
|
68
|
+
*/
|
|
69
|
+
export interface IRepoInfo {
|
|
70
|
+
/** Git 仓库地址或模板下载地址 */
|
|
71
|
+
Repo: string;
|
|
72
|
+
/** 来源标识,如 'template' */
|
|
73
|
+
Source: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 通过镜像创建 TCBR Agent 的参数
|
|
77
|
+
*/
|
|
78
|
+
export interface ICreateTcbrAgentByImageParams {
|
|
79
|
+
/** Agent 名称 */
|
|
80
|
+
Name: string;
|
|
81
|
+
/** Agent ID */
|
|
82
|
+
AgentId: string;
|
|
83
|
+
/** 模板标识符 */
|
|
84
|
+
Template: string;
|
|
85
|
+
/** 环境变量 */
|
|
86
|
+
envVariables?: Record<string, string>;
|
|
87
|
+
/** Docker 镜像 URL */
|
|
88
|
+
ImageUrl: string;
|
|
89
|
+
/** 仓库信息 */
|
|
90
|
+
RepoInfo: IRepoInfo;
|
|
91
|
+
/** 头像 URL */
|
|
92
|
+
Avatar?: string;
|
|
93
|
+
/** 简介 */
|
|
94
|
+
Introduction?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 通过代码包创建 TCBR Agent 的参数
|
|
98
|
+
*/
|
|
99
|
+
export interface ICreateTcbrAgentByPackageParams {
|
|
100
|
+
/** Agent 名称 */
|
|
101
|
+
Name: string;
|
|
102
|
+
/** Agent ID */
|
|
103
|
+
AgentId: string;
|
|
104
|
+
/** 模板标识符 */
|
|
105
|
+
Template: string;
|
|
106
|
+
/** 环境变量 */
|
|
107
|
+
envVariables?: Record<string, string>;
|
|
108
|
+
/** 代码包名称(上传后获取) */
|
|
109
|
+
PackageName: string;
|
|
110
|
+
/** 代码包版本(上传后获取) */
|
|
111
|
+
PackageVersion: string;
|
|
112
|
+
/** 来源标识,如 'aiAgentWithConfigYaml' */
|
|
113
|
+
Source?: string;
|
|
114
|
+
/** 头像 URL */
|
|
115
|
+
Avatar?: string;
|
|
116
|
+
/** 简介 */
|
|
117
|
+
Introduction?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 通过本地代码创建 TCBR Agent 的参数(自动上传)
|
|
121
|
+
*/
|
|
122
|
+
export interface ICreateTcbrAgentByCodeParams {
|
|
123
|
+
/** Agent 名称 */
|
|
124
|
+
Name: string;
|
|
125
|
+
/** Agent ID */
|
|
126
|
+
AgentId: string;
|
|
127
|
+
/** 模板标识符 */
|
|
128
|
+
Template: string;
|
|
129
|
+
/** 环境变量 */
|
|
130
|
+
envVariables?: Record<string, string>;
|
|
131
|
+
/** 来源标识 */
|
|
132
|
+
Source?: string;
|
|
133
|
+
/** 头像 URL */
|
|
134
|
+
Avatar?: string;
|
|
135
|
+
/** 简介 */
|
|
136
|
+
Introduction?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 查询 Agent 列表的参数
|
|
140
|
+
*/
|
|
141
|
+
export interface IDescribeAgentListParams {
|
|
142
|
+
/** 每页数量,默认 20 */
|
|
143
|
+
PageSize?: number;
|
|
144
|
+
/** 页码,默认 1 */
|
|
145
|
+
PageNumber?: number;
|
|
146
|
+
/** 指定 Agent ID(查询单个) */
|
|
147
|
+
AgentId?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Agent 信息
|
|
151
|
+
*/
|
|
152
|
+
export interface IAgentInfo {
|
|
153
|
+
/** Agent ID */
|
|
154
|
+
AgentId: string;
|
|
155
|
+
/** Agent 名称 */
|
|
156
|
+
Name: string;
|
|
157
|
+
/** Agent 类型 */
|
|
158
|
+
AgentType: AgentType;
|
|
159
|
+
/** 简介 */
|
|
160
|
+
Introduction?: string;
|
|
161
|
+
/** 头像 */
|
|
162
|
+
Avatar?: string;
|
|
163
|
+
/** 背景图 */
|
|
164
|
+
Background?: string;
|
|
165
|
+
/** 标签 */
|
|
166
|
+
Tags?: string[];
|
|
167
|
+
/** 创建时间 */
|
|
168
|
+
CreateTime?: string;
|
|
169
|
+
/** 更新时间 */
|
|
170
|
+
UpdateTime?: string;
|
|
171
|
+
/** 状态 */
|
|
172
|
+
Status?: string;
|
|
173
|
+
/** 服务 ID */
|
|
174
|
+
ServiceId?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Agent 列表响应
|
|
178
|
+
*/
|
|
179
|
+
export interface IDescribeAgentListResponse {
|
|
180
|
+
/** Agent 列表 */
|
|
181
|
+
AgentList: IAgentInfo[];
|
|
182
|
+
/** 总数 */
|
|
183
|
+
Total: number;
|
|
184
|
+
/** 请求 ID */
|
|
185
|
+
RequestId: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Agent 详情响应(包含底层资源状态)
|
|
189
|
+
*/
|
|
190
|
+
export interface IDescribeAgentResponse {
|
|
191
|
+
/** Agent 基本信息 */
|
|
192
|
+
AgentInfo: IAgentInfo | null;
|
|
193
|
+
/** Agent 是否已部署完成且可用 */
|
|
194
|
+
IsReady: boolean;
|
|
195
|
+
/** 不可用时的原因说明 */
|
|
196
|
+
NotReadyReason?: string;
|
|
197
|
+
/** 请求 ID */
|
|
198
|
+
RequestId: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 删除 Agent 的参数
|
|
202
|
+
*/
|
|
203
|
+
export interface IDeleteAgentParams {
|
|
204
|
+
/** Agent ID */
|
|
205
|
+
AgentId: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* 更新 Agent 的参数(通用)
|
|
209
|
+
* 会自动判断 Agent 类型并调用对应的更新方法
|
|
210
|
+
*/
|
|
211
|
+
export interface IUpdateAgentParams {
|
|
212
|
+
/** Agent ID(必填) */
|
|
213
|
+
AgentId: string;
|
|
214
|
+
/** 代码目录路径(可选,不传则不更新代码) */
|
|
215
|
+
cwd?: string;
|
|
216
|
+
/** Base64 编码的 ZIP 文件内容(与 cwd 二选一,仅 SCF 类型) */
|
|
217
|
+
ZipFile?: string;
|
|
218
|
+
/** 环境变量 */
|
|
219
|
+
envVariables?: Record<string, string>;
|
|
220
|
+
/** 运行时版本 */
|
|
221
|
+
Runtime?: RuntimeVersion;
|
|
222
|
+
/** 超时时间(秒),1-900 */
|
|
223
|
+
Timeout?: number;
|
|
224
|
+
/** 函数运行时内存大小(MB),可选 64、128-3072(128为阶梯) */
|
|
225
|
+
MemorySize?: number;
|
|
226
|
+
/** 是否自动安装依赖 */
|
|
227
|
+
InstallDependency?: boolean;
|
|
228
|
+
/** 忽略的文件模式(仅 cwd 方式有效,SCF 类型) */
|
|
229
|
+
Ignore?: string | string[];
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 更新 SCF Agent 的参数
|
|
233
|
+
*/
|
|
234
|
+
export interface IUpdateScfAgentParams {
|
|
235
|
+
/** Agent ID */
|
|
236
|
+
AgentId: string;
|
|
237
|
+
/** 代码目录路径(与 ZipFile 二选一) */
|
|
238
|
+
cwd?: string;
|
|
239
|
+
/** Base64 编码的 ZIP 文件内容(与 cwd 二选一) */
|
|
240
|
+
ZipFile?: string;
|
|
241
|
+
/** 环境变量 */
|
|
242
|
+
envVariables?: Record<string, string>;
|
|
243
|
+
/** 运行时版本 */
|
|
244
|
+
Runtime?: RuntimeVersion;
|
|
245
|
+
/** 函数超时时间(秒),1-900 */
|
|
246
|
+
Timeout?: number;
|
|
247
|
+
/** 函数运行时内存大小(MB),可选 64、128-3072(128为阶梯) */
|
|
248
|
+
MemorySize?: number;
|
|
249
|
+
/** 是否自动安装依赖 */
|
|
250
|
+
InstallDependency?: boolean;
|
|
251
|
+
/** 忽略的文件模式(仅 cwd 方式有效) */
|
|
252
|
+
Ignore?: string | string[];
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* 更新 SCF Agent 的返回结果
|
|
256
|
+
*/
|
|
257
|
+
export interface IUpdateScfAgentResponse {
|
|
258
|
+
/** 请求 ID */
|
|
259
|
+
RequestId: string;
|
|
260
|
+
/** 总耗时(毫秒) */
|
|
261
|
+
elapsedTime: number;
|
|
262
|
+
/** 结果消息 */
|
|
263
|
+
message: string;
|
|
264
|
+
/** 详细步骤信息 */
|
|
265
|
+
details: string[];
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* 更新 TCBR Agent 的参数
|
|
269
|
+
*/
|
|
270
|
+
export interface IUpdateTcbrAgentParams {
|
|
271
|
+
/** Agent ID */
|
|
272
|
+
AgentId: string;
|
|
273
|
+
/** 代码目录路径(与 ImageUrl 二选一) */
|
|
274
|
+
cwd?: string;
|
|
275
|
+
/** Docker 镜像 URL */
|
|
276
|
+
ImageUrl?: string;
|
|
277
|
+
/** 环境变量 */
|
|
278
|
+
envVariables?: Record<string, string>;
|
|
279
|
+
/** 是否安装依赖,默认 true(仅代码包部署时有效) */
|
|
280
|
+
InstallDependency?: boolean;
|
|
281
|
+
/** CPU 规格(核),如 0.25、0.5、1、2 */
|
|
282
|
+
Cpu?: number;
|
|
283
|
+
/** 内存规格(GB),如 0.5、1、2、4 */
|
|
284
|
+
Mem?: number;
|
|
285
|
+
/** 最小副本数 */
|
|
286
|
+
MinNum?: number;
|
|
287
|
+
/** 最大副本数 */
|
|
288
|
+
MaxNum?: number;
|
|
289
|
+
/** 服务端口 */
|
|
290
|
+
Port?: number;
|
|
291
|
+
/** 延迟检测时间(秒) */
|
|
292
|
+
InitialDelaySeconds?: number;
|
|
293
|
+
/** 日志采集路径,如 "stdout" */
|
|
294
|
+
CustomLogs?: string;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* 获取上传信息的参数
|
|
298
|
+
*/
|
|
299
|
+
export interface IDescribeCloudBaseBuildServiceParams {
|
|
300
|
+
/** 服务名(即 AgentId) */
|
|
301
|
+
ServiceName: string;
|
|
302
|
+
/** build 类型 */
|
|
303
|
+
CIBusiness?: 'cloudbaserun' | 'framework-ci';
|
|
304
|
+
/** 服务版本 */
|
|
305
|
+
ServiceVersion?: string;
|
|
306
|
+
/** 文件后缀 */
|
|
307
|
+
Suffix?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* 上传信息响应
|
|
311
|
+
*/
|
|
312
|
+
export interface IDescribeCloudBaseBuildServiceResponse {
|
|
313
|
+
/** 上传 URL */
|
|
314
|
+
UploadUrl: string;
|
|
315
|
+
/** 上传请求头 */
|
|
316
|
+
UploadHeaders: Array<{
|
|
317
|
+
Key: string;
|
|
318
|
+
Value: string;
|
|
319
|
+
}>;
|
|
320
|
+
/** 包名 */
|
|
321
|
+
PackageName: string;
|
|
322
|
+
/** 包版本 */
|
|
323
|
+
PackageVersion: string;
|
|
324
|
+
/** 下载链接 */
|
|
325
|
+
DownloadUrl?: string;
|
|
326
|
+
/** 下载链接是否过期 */
|
|
327
|
+
OutDate?: boolean;
|
|
328
|
+
/** 请求 ID */
|
|
329
|
+
RequestId: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* 创建 Agent 响应
|
|
333
|
+
*/
|
|
334
|
+
export interface ICreateAgentResponse {
|
|
335
|
+
/** Agent ID */
|
|
336
|
+
AgentId: string;
|
|
337
|
+
/** 请求 ID */
|
|
338
|
+
RequestId: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* 通用操作响应
|
|
342
|
+
*/
|
|
343
|
+
export interface ICommonResponse {
|
|
344
|
+
/** 请求 ID */
|
|
345
|
+
RequestId: string;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* 删除 Agent 响应
|
|
349
|
+
*/
|
|
350
|
+
export interface IDeleteAgentResponse {
|
|
351
|
+
/** 请求 ID */
|
|
352
|
+
RequestId: string;
|
|
353
|
+
/** Agent 记录是否删除成功 */
|
|
354
|
+
AgentDeleted: boolean;
|
|
355
|
+
/** 底层资源删除结果,无底层资源时为 undefined */
|
|
356
|
+
ResourceResult?: {
|
|
357
|
+
/** 资源类型 */
|
|
358
|
+
Type: 'scf' | 'tcbr';
|
|
359
|
+
/** 资源名称 */
|
|
360
|
+
Name: string;
|
|
361
|
+
/** 是否删除成功 */
|
|
362
|
+
Deleted: boolean;
|
|
363
|
+
/** 删除失败时的错误信息 */
|
|
364
|
+
Error?: string;
|
|
365
|
+
/** 删除失败时的清理提示 */
|
|
366
|
+
CleanupHint?: string;
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* 获取 Agent 日志的参数
|
|
371
|
+
*/
|
|
372
|
+
export interface IGetAgentLogsParams {
|
|
373
|
+
/** Agent ID */
|
|
374
|
+
AgentId: string;
|
|
375
|
+
/** 偏移量,默认 0 */
|
|
376
|
+
offset?: number;
|
|
377
|
+
/** 返回数量,默认 10 */
|
|
378
|
+
limit?: number;
|
|
379
|
+
/** 开始时间,如 "2024-01-01 00:00:00" */
|
|
380
|
+
startTime?: string;
|
|
381
|
+
/** 结束时间,如 "2024-01-01 23:59:59" */
|
|
382
|
+
endTime?: string;
|
|
383
|
+
/** 按 RequestId 筛选(仅 SCF Agent) */
|
|
384
|
+
requestId?: string;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* @deprecated 请使用 ICreateTcbrAgentByCodeParams
|
|
388
|
+
* 创建函数型 Agent 的参数(旧版)
|
|
389
|
+
*/
|
|
1
390
|
export interface ICreateFunctionAgentParams {
|
|
2
391
|
/**
|
|
3
392
|
* 智能体名称
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Environment } from '../environment';
|
|
2
|
+
import { ICreateCloudAppParams, ICreateCloudAppResult, IDescribeCloudAppListParams, IDescribeCloudAppListResult, IDescribeCloudAppInfoParams, IDescribeCloudAppInfoResult, IDeleteCloudAppParams, IDeleteCloudAppResult, IDescribeCloudAppVersionParams, IDescribeCloudAppVersionResult, IDescribeCloudAppVersionListParams, IDescribeCloudAppVersionListResult, IDeleteCloudAppVersionParams, IDeleteCloudAppVersionResult, IDescribeCloudAppCosInfoParams, IDescribeCloudAppCosInfoResult, IUploadCloudAppCodeParams, IUploadCloudAppCodeResult } from './types';
|
|
3
|
+
export * from './types';
|
|
4
|
+
/**
|
|
5
|
+
* CloudApp 统一部署服务
|
|
6
|
+
* 提供 Web 应用的创建、查询、删除、版本管理等功能
|
|
7
|
+
*/
|
|
8
|
+
export declare class CloudAppService {
|
|
9
|
+
private tcbService;
|
|
10
|
+
private environment;
|
|
11
|
+
constructor(environment: Environment);
|
|
12
|
+
/**
|
|
13
|
+
* 创建/更新 CloudApp 应用
|
|
14
|
+
* @param params 创建参数
|
|
15
|
+
*/
|
|
16
|
+
createApp(params: ICreateCloudAppParams): Promise<ICreateCloudAppResult>;
|
|
17
|
+
/**
|
|
18
|
+
* 获取 CloudApp 应用列表
|
|
19
|
+
* @param params 查询参数
|
|
20
|
+
*/
|
|
21
|
+
describeAppList(params: IDescribeCloudAppListParams): Promise<IDescribeCloudAppListResult>;
|
|
22
|
+
/**
|
|
23
|
+
* 获取 CloudApp 应用详情
|
|
24
|
+
* @param params 查询参数
|
|
25
|
+
*/
|
|
26
|
+
describeAppInfo(params: IDescribeCloudAppInfoParams): Promise<IDescribeCloudAppInfoResult>;
|
|
27
|
+
/**
|
|
28
|
+
* 删除 CloudApp 应用
|
|
29
|
+
* @param params 删除参数
|
|
30
|
+
*/
|
|
31
|
+
deleteApp(params: IDeleteCloudAppParams): Promise<IDeleteCloudAppResult>;
|
|
32
|
+
/**
|
|
33
|
+
* 获取 CloudApp 版本详情
|
|
34
|
+
* 不指定 versionName 或 buildId 时返回最新版本
|
|
35
|
+
* @param params 查询参数
|
|
36
|
+
*/
|
|
37
|
+
describeAppVersion(params: IDescribeCloudAppVersionParams): Promise<IDescribeCloudAppVersionResult>;
|
|
38
|
+
/**
|
|
39
|
+
* 获取 CloudApp 版本列表
|
|
40
|
+
* @param params 查询参数
|
|
41
|
+
*/
|
|
42
|
+
describeAppVersionList(params: IDescribeCloudAppVersionListParams): Promise<IDescribeCloudAppVersionListResult>;
|
|
43
|
+
/**
|
|
44
|
+
* 删除 CloudApp 版本
|
|
45
|
+
* @param params 删除参数
|
|
46
|
+
*/
|
|
47
|
+
deleteAppVersion(params: IDeleteCloudAppVersionParams): Promise<IDeleteCloudAppVersionResult>;
|
|
48
|
+
/**
|
|
49
|
+
* 获取 CloudApp COS 上传信息(预签名 URL)
|
|
50
|
+
* @param params 查询参数
|
|
51
|
+
*/
|
|
52
|
+
describeCosInfo(params: IDescribeCloudAppCosInfoParams): Promise<IDescribeCloudAppCosInfoResult>;
|
|
53
|
+
/**
|
|
54
|
+
* 上传本地代码到 COS
|
|
55
|
+
* 自动打包 ZIP 并上传到预签名 URL
|
|
56
|
+
*
|
|
57
|
+
* 注意:此方法不依赖应用是否已创建,可在创建应用前调用
|
|
58
|
+
* 返回的 cosTimestamp 用于 createApp 时传入 staticConfig.cosTimestamp
|
|
59
|
+
*
|
|
60
|
+
* @param params 上传参数
|
|
61
|
+
*/
|
|
62
|
+
uploadCode(params: IUploadCloudAppCodeParams): Promise<IUploadCloudAppCodeResult>;
|
|
63
|
+
/**
|
|
64
|
+
* 获取环境信息
|
|
65
|
+
*/
|
|
66
|
+
private getEnvInfo;
|
|
67
|
+
/**
|
|
68
|
+
* 校验必填参数
|
|
69
|
+
* @param params 参数对象
|
|
70
|
+
* @param fields 必填字段列表
|
|
71
|
+
*/
|
|
72
|
+
private validateRequiredParams;
|
|
73
|
+
}
|