@tencent-ai/cloud-agent-sdk 0.2.13 → 0.2.14-next.cb03fb2.20260319
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/e2b-filesystem-4-LU6-jg.cjs +168 -0
- package/dist/e2b-filesystem-4-LU6-jg.cjs.map +1 -0
- package/dist/e2b-filesystem-BNmEfpoW.mjs +162 -0
- package/dist/e2b-filesystem-BNmEfpoW.mjs.map +1 -0
- package/dist/e2b-filesystem-B_WoA22S.cjs +252 -0
- package/dist/e2b-filesystem-B_WoA22S.cjs.map +1 -0
- package/dist/e2b-filesystem-Cac-bpRR.cjs +3 -0
- package/dist/e2b-filesystem-DM_jsT05.mjs +234 -0
- package/dist/e2b-filesystem-DM_jsT05.mjs.map +1 -0
- package/dist/e2b-filesystem-DWj9UkV8.mjs +3 -0
- package/dist/e2b-filesystem-DcVVT_tP.cjs +4 -0
- package/dist/e2b-filesystem-UheQECjB.mjs +3 -0
- package/dist/index.cjs +2177 -383
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1840 -72
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1840 -72
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2169 -376
- package/dist/index.mjs.map +1 -1
- package/dist/legacy/index.cjs +24008 -0
- package/dist/legacy/index.cjs.map +1 -0
- package/dist/legacy/index.d.cts +6387 -0
- package/dist/legacy/index.d.cts.map +1 -0
- package/dist/legacy/index.d.mts +6387 -0
- package/dist/legacy/index.d.mts.map +1 -0
- package/dist/legacy/index.mjs +13284 -0
- package/dist/legacy/index.mjs.map +1 -0
- package/dist/tencent-ai-cloud-agent-sdk-0.2.14-next.cb03fb2.20260319.tgz +0 -0
- package/package.json +44 -7
- package/dist/tencent-ai-cloud-agent-sdk-0.2.13.tgz +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AgentCapabilities as AgentCapabilities$1, ClientCapabilities, InitializeResponse, LoadSessionResponse, NewSessionResponse, PromptResponse as PromptResponse$1, RequestPermissionRequest, RequestPermissionRequest as RequestPermissionRequest$1, SessionNotification, SessionNotification as SessionNotification$1, SetSessionModeResponse, SetSessionModelResponse } from "@agentclientprotocol/sdk";
|
|
2
|
-
import {
|
|
1
|
+
import { AgentCapabilities as AgentCapabilities$1, ClientCapabilities, InitializeResponse, LoadSessionResponse, NewSessionResponse, PromptResponse as PromptResponse$1, RequestPermissionRequest, RequestPermissionRequest as RequestPermissionRequest$1, SessionNotification, SessionNotification as SessionNotification$1, SetSessionModeResponse, SetSessionModelResponse, StopReason } from "@agentclientprotocol/sdk";
|
|
2
|
+
import { Sandbox } from "e2b";
|
|
3
3
|
import "zod";
|
|
4
4
|
|
|
5
5
|
//#region ../agent-client-protocol/lib/common/types.d.ts
|
|
@@ -235,6 +235,12 @@ interface CodebuddyClientMeta {
|
|
|
235
235
|
artifacts?: ArtifactsConfig;
|
|
236
236
|
/** Whether the client supports checkpoint notifications */
|
|
237
237
|
checkpoint?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Whether the client supports handling AskUserQuestion tool via extMethod.
|
|
240
|
+
* When true, AskUserQuestion requests will be sent to the client via
|
|
241
|
+
* the '_codebuddy.ai/question' extMethod instead of being handled locally.
|
|
242
|
+
*/
|
|
243
|
+
question?: boolean;
|
|
238
244
|
}
|
|
239
245
|
/**
|
|
240
246
|
* codebuddy.ai extension capabilities for Agent
|
|
@@ -995,6 +1001,38 @@ interface BackendProviderConfig {
|
|
|
995
1001
|
/** 认证 Token */
|
|
996
1002
|
authToken?: string;
|
|
997
1003
|
}
|
|
1004
|
+
/**
|
|
1005
|
+
* 签到状态响应
|
|
1006
|
+
*/
|
|
1007
|
+
interface CheckinStatusResponse {
|
|
1008
|
+
/** 活动是否开启 */
|
|
1009
|
+
active: boolean;
|
|
1010
|
+
/** 今天是否已签到 */
|
|
1011
|
+
today_checked_in: boolean;
|
|
1012
|
+
/** 当前连续签到天数 */
|
|
1013
|
+
streak_days: number;
|
|
1014
|
+
/** 普通日签 credit 数量 */
|
|
1015
|
+
daily_credit: number;
|
|
1016
|
+
/** 今天签到可获得的 credit 数量 */
|
|
1017
|
+
today_credit: number;
|
|
1018
|
+
/** 今天是否是连续签到奖励日 */
|
|
1019
|
+
is_streak_day: boolean;
|
|
1020
|
+
/** 距离下一个连续签到奖励日还需签到天数(0 表示今天就是) */
|
|
1021
|
+
next_streak_day: number;
|
|
1022
|
+
/** 签到日期列表(yyyy-MM-dd 格式) */
|
|
1023
|
+
checkin_dates: string[];
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* 签到结果响应
|
|
1027
|
+
*/
|
|
1028
|
+
interface CheckinResultResponse {
|
|
1029
|
+
/** 本次签到实际获得的 credit */
|
|
1030
|
+
credit: number;
|
|
1031
|
+
/** 签到后的连续签到天数 */
|
|
1032
|
+
streak_days: number;
|
|
1033
|
+
/** 本次签到是否为连续签到奖励日 */
|
|
1034
|
+
is_streak_day: boolean;
|
|
1035
|
+
}
|
|
998
1036
|
/**
|
|
999
1037
|
* 企业用户用量信息
|
|
1000
1038
|
*/
|
|
@@ -1122,6 +1160,14 @@ interface IBackendProvider {
|
|
|
1122
1160
|
reloadWindow?(params?: {
|
|
1123
1161
|
locale?: string;
|
|
1124
1162
|
}): Promise<void>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Save locale to argv.json without restarting the app (optional, IPC only).
|
|
1165
|
+
* The change takes effect on next manual restart.
|
|
1166
|
+
* @param params locale to save
|
|
1167
|
+
*/
|
|
1168
|
+
saveLocale?(params: {
|
|
1169
|
+
locale: string;
|
|
1170
|
+
}): Promise<void>;
|
|
1125
1171
|
/**
|
|
1126
1172
|
* 关闭 Agent Manager 面板(可选,仅 IPC 环境支持)
|
|
1127
1173
|
* 用于 Local 模式下点击 Logo 返回 IDE
|
|
@@ -1145,6 +1191,22 @@ interface IBackendProvider {
|
|
|
1145
1191
|
* @returns Promise<EnterpriseUsage | null> 企业用户用量信息
|
|
1146
1192
|
*/
|
|
1147
1193
|
getEnterpriseUsage?(enterpriseId: string): Promise<EnterpriseUsage | null>;
|
|
1194
|
+
/**
|
|
1195
|
+
* 获取账号用量信息(积分/Credits)
|
|
1196
|
+
* 实时获取,每次打开菜单时调用,不依赖 getAccount 缓存
|
|
1197
|
+
* @returns Promise<Partial<Account> | null> 包含 usageLeft, usageTotal, refreshAt 等字段
|
|
1198
|
+
*/
|
|
1199
|
+
getAccountUsage?(): Promise<Partial<Account> | null>;
|
|
1200
|
+
/**
|
|
1201
|
+
* 获取每日签到状态
|
|
1202
|
+
* @returns Promise<CheckinStatusResponse | null> 签到状态,失败时返回 null
|
|
1203
|
+
*/
|
|
1204
|
+
getCheckinStatus?(): Promise<CheckinStatusResponse | null>;
|
|
1205
|
+
/**
|
|
1206
|
+
* 执行每日签到
|
|
1207
|
+
* @returns Promise<CheckinResultResponse> 签到结果
|
|
1208
|
+
*/
|
|
1209
|
+
claimDailyCheckin?(): Promise<CheckinResultResponse>;
|
|
1148
1210
|
/**
|
|
1149
1211
|
* 刷新 Token(可选)
|
|
1150
1212
|
* 通过调用 getAccount 刷新 cookie
|
|
@@ -1173,6 +1235,175 @@ interface IBackendProvider {
|
|
|
1173
1235
|
* @returns Promise<ListReposResponse> 仓库列表响应
|
|
1174
1236
|
*/
|
|
1175
1237
|
getRepositories?(connector: OauthConnectorName, page?: number, perPage?: number): Promise<ListReposResponse>;
|
|
1238
|
+
/**
|
|
1239
|
+
* 保存待发送的输入内容到后端(用于跨域登录场景)
|
|
1240
|
+
* API 端点: POST /api/v1/code-id
|
|
1241
|
+
*
|
|
1242
|
+
* @param code 要保存的文本内容
|
|
1243
|
+
* @returns Promise<string | null> 返回 codeId,失败返回 null
|
|
1244
|
+
*/
|
|
1245
|
+
savePendingInput?(code: string): Promise<string | null>;
|
|
1246
|
+
/**
|
|
1247
|
+
* 从后端加载待发送的输入内容(用于跨域登录场景)
|
|
1248
|
+
* API 端点: GET /api/v1/code?id=xxx
|
|
1249
|
+
*
|
|
1250
|
+
* @param codeId 内容 ID
|
|
1251
|
+
* @returns Promise<string | null> 返回保存的文本内容,失败返回 null
|
|
1252
|
+
*/
|
|
1253
|
+
loadPendingInput?(codeId: string): Promise<string | null>;
|
|
1254
|
+
/**
|
|
1255
|
+
* 获取 SkillHub 技能列表(分页)
|
|
1256
|
+
* @param params 分页/过滤参数
|
|
1257
|
+
* @returns Promise<SkillHubListResponse>
|
|
1258
|
+
*/
|
|
1259
|
+
getSkillHubList?(params?: SkillHubListParams): Promise<SkillHubListResponse>;
|
|
1260
|
+
/**
|
|
1261
|
+
* 获取 SkillHub 分类列表
|
|
1262
|
+
* @returns Promise<SkillHubCategoriesResponse>
|
|
1263
|
+
*/
|
|
1264
|
+
getSkillHubCategories?(): Promise<SkillHubCategoriesResponse>;
|
|
1265
|
+
/**
|
|
1266
|
+
* 搜索 SkillHub 技能
|
|
1267
|
+
* @param q 搜索关键词
|
|
1268
|
+
* @param limit 结果数量限制
|
|
1269
|
+
* @returns Promise<SkillHubSearchResponse>
|
|
1270
|
+
*/
|
|
1271
|
+
getSkillHubSearch?(q: string, limit?: number): Promise<SkillHubSearchResponse>;
|
|
1272
|
+
/**
|
|
1273
|
+
* 获取 SkillHub 技能详情
|
|
1274
|
+
* @param slug 技能唯一标识
|
|
1275
|
+
* @returns Promise<SkillHubDetailResponse>
|
|
1276
|
+
*/
|
|
1277
|
+
getSkillHubDetail?(slug: string): Promise<SkillHubDetailResponse>;
|
|
1278
|
+
/**
|
|
1279
|
+
* 批量检查 SkillHub 技能是否存在
|
|
1280
|
+
* @param slugs 技能标识列表
|
|
1281
|
+
* @returns Promise<SkillHubExistsResponse>
|
|
1282
|
+
*/
|
|
1283
|
+
getSkillHubExists?(slugs: string[]): Promise<SkillHubExistsResponse>;
|
|
1284
|
+
/**
|
|
1285
|
+
* 上报 SkillHub 技能统计
|
|
1286
|
+
* @param slug 技能标识
|
|
1287
|
+
* @param inc 增量统计
|
|
1288
|
+
*/
|
|
1289
|
+
reportSkillHubStats?(slug: string, inc: {
|
|
1290
|
+
downloads?: number;
|
|
1291
|
+
installs?: number;
|
|
1292
|
+
stars?: number;
|
|
1293
|
+
}): Promise<void>;
|
|
1294
|
+
/**
|
|
1295
|
+
* 安装 SkillHub 技能(下载 zip → 解压到本地)
|
|
1296
|
+
* @param slug 技能标识
|
|
1297
|
+
* @param version 版本号
|
|
1298
|
+
* @param name 原始显示名称(保留大小写)
|
|
1299
|
+
* @returns Promise<SkillHubInstallResponse>
|
|
1300
|
+
*/
|
|
1301
|
+
installSkillHubSkill?(slug: string, version?: string, name?: string): Promise<SkillHubInstallResponse>;
|
|
1302
|
+
/**
|
|
1303
|
+
* 获取本地已安装的 SkillHub 技能元信息
|
|
1304
|
+
* @returns Promise<SkillHubInstalledMeta[]>
|
|
1305
|
+
*/
|
|
1306
|
+
getSkillHubInstalledMetas?(): Promise<SkillHubInstalledMeta[]>;
|
|
1307
|
+
}
|
|
1308
|
+
interface SkillHubSkill {
|
|
1309
|
+
slug: string;
|
|
1310
|
+
ownerName: string;
|
|
1311
|
+
category: string;
|
|
1312
|
+
name: string;
|
|
1313
|
+
description: string;
|
|
1314
|
+
description_zh: string;
|
|
1315
|
+
version: string;
|
|
1316
|
+
homepage: string;
|
|
1317
|
+
tags: string[];
|
|
1318
|
+
downloads: number;
|
|
1319
|
+
stars: number;
|
|
1320
|
+
installs: number;
|
|
1321
|
+
updated_at: number;
|
|
1322
|
+
score: number;
|
|
1323
|
+
/** Optional source marker used in merged search results */
|
|
1324
|
+
_source?: 'recommend' | 'skillhub';
|
|
1325
|
+
}
|
|
1326
|
+
interface SkillHubListResponse {
|
|
1327
|
+
code: number;
|
|
1328
|
+
message: string;
|
|
1329
|
+
data: {
|
|
1330
|
+
total: number;
|
|
1331
|
+
skills: SkillHubSkill[];
|
|
1332
|
+
};
|
|
1333
|
+
}
|
|
1334
|
+
interface SkillHubCategory {
|
|
1335
|
+
key: string;
|
|
1336
|
+
name: string;
|
|
1337
|
+
nameEn: string;
|
|
1338
|
+
sortOrder: number;
|
|
1339
|
+
active: boolean;
|
|
1340
|
+
}
|
|
1341
|
+
interface SkillHubCategoriesResponse {
|
|
1342
|
+
items: SkillHubCategory[];
|
|
1343
|
+
count: number;
|
|
1344
|
+
}
|
|
1345
|
+
interface SkillHubSearchResult {
|
|
1346
|
+
score: number;
|
|
1347
|
+
slug: string;
|
|
1348
|
+
displayName: string;
|
|
1349
|
+
summary: string;
|
|
1350
|
+
version: string;
|
|
1351
|
+
updatedAt: number;
|
|
1352
|
+
}
|
|
1353
|
+
interface SkillHubSearchResponse {
|
|
1354
|
+
results: SkillHubSearchResult[];
|
|
1355
|
+
}
|
|
1356
|
+
interface SkillHubDetailResponse {
|
|
1357
|
+
skill: {
|
|
1358
|
+
slug: string;
|
|
1359
|
+
category: string;
|
|
1360
|
+
displayName: string;
|
|
1361
|
+
summary: string;
|
|
1362
|
+
summary_zh: string;
|
|
1363
|
+
tags: Record<string, string>;
|
|
1364
|
+
stats: {
|
|
1365
|
+
downloads: number;
|
|
1366
|
+
stars: number;
|
|
1367
|
+
installs: number;
|
|
1368
|
+
versions: number;
|
|
1369
|
+
comments: number;
|
|
1370
|
+
};
|
|
1371
|
+
createdAt: number;
|
|
1372
|
+
updatedAt: number;
|
|
1373
|
+
};
|
|
1374
|
+
latestVersion: {
|
|
1375
|
+
version: string;
|
|
1376
|
+
createdAt: number;
|
|
1377
|
+
changelog: string;
|
|
1378
|
+
};
|
|
1379
|
+
owner: {
|
|
1380
|
+
handle: string;
|
|
1381
|
+
displayName: string;
|
|
1382
|
+
image: string | null;
|
|
1383
|
+
};
|
|
1384
|
+
}
|
|
1385
|
+
interface SkillHubExistsResponse {
|
|
1386
|
+
exists: Record<string, boolean>;
|
|
1387
|
+
count: number;
|
|
1388
|
+
}
|
|
1389
|
+
interface SkillHubInstallResponse {
|
|
1390
|
+
success: boolean;
|
|
1391
|
+
skillName: string;
|
|
1392
|
+
errorMessage?: string;
|
|
1393
|
+
}
|
|
1394
|
+
interface SkillHubInstalledMeta {
|
|
1395
|
+
slug: string;
|
|
1396
|
+
version: string | null;
|
|
1397
|
+
installedAt?: number;
|
|
1398
|
+
}
|
|
1399
|
+
type SkillHubSortBy = 'score' | 'downloads' | 'updated_at' | 'installs';
|
|
1400
|
+
interface SkillHubListParams {
|
|
1401
|
+
page?: number;
|
|
1402
|
+
pageSize?: number;
|
|
1403
|
+
sortBy?: SkillHubSortBy;
|
|
1404
|
+
order?: 'asc' | 'desc';
|
|
1405
|
+
keyword?: string;
|
|
1406
|
+
category?: string;
|
|
1176
1407
|
}
|
|
1177
1408
|
/**
|
|
1178
1409
|
* 场景中的插件信息
|
|
@@ -1186,6 +1417,12 @@ interface ScenePlugin {
|
|
|
1186
1417
|
/** 插件市场名称 */
|
|
1187
1418
|
marketplaceName: string;
|
|
1188
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* 场景模式类型
|
|
1422
|
+
* - coding: 编程相关场景
|
|
1423
|
+
* - working: 工作/通用场景
|
|
1424
|
+
*/
|
|
1425
|
+
type SupportSceneMode = 'coding' | 'working';
|
|
1189
1426
|
/**
|
|
1190
1427
|
* 支持的场景信息
|
|
1191
1428
|
* 用于 Welcome 页面的 QuickActions 快捷操作
|
|
@@ -1200,11 +1437,15 @@ interface SupportScene {
|
|
|
1200
1437
|
plugins: ScenePlugin[];
|
|
1201
1438
|
/** 场景对应的 prompt 列表 */
|
|
1202
1439
|
prompts: string[];
|
|
1440
|
+
/** 场景模式类型 */
|
|
1441
|
+
mode?: SupportSceneMode;
|
|
1203
1442
|
}
|
|
1204
1443
|
/**
|
|
1205
1444
|
* 插件作用域
|
|
1445
|
+
* 使用 agent-craft 的 PluginInstallScope 类型
|
|
1446
|
+
* 注意: 当前后端 API 只支持 user 和 project,暂不支持 project-local
|
|
1206
1447
|
*/
|
|
1207
|
-
type PluginScope = 'user' | 'project';
|
|
1448
|
+
type PluginScope = 'user' | 'project' | 'project-local' | 'local';
|
|
1208
1449
|
/**
|
|
1209
1450
|
* 插件操作类型
|
|
1210
1451
|
*/
|
|
@@ -1314,6 +1555,71 @@ interface AvailableCommand {
|
|
|
1314
1555
|
}
|
|
1315
1556
|
//#endregion
|
|
1316
1557
|
//#region ../agent-provider/lib/common/types.d.ts
|
|
1558
|
+
/**
|
|
1559
|
+
* File type enumeration
|
|
1560
|
+
* Compatible with e2b SDK FileType
|
|
1561
|
+
*/
|
|
1562
|
+
declare enum FileType {
|
|
1563
|
+
FILE = "file",
|
|
1564
|
+
DIR = "dir"
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Filesystem event type enumeration
|
|
1568
|
+
* Compatible with e2b SDK FilesystemEventType
|
|
1569
|
+
*/
|
|
1570
|
+
declare enum FilesystemEventType {
|
|
1571
|
+
CHMOD = "chmod",
|
|
1572
|
+
CREATE = "create",
|
|
1573
|
+
REMOVE = "remove",
|
|
1574
|
+
RENAME = "rename",
|
|
1575
|
+
WRITE = "write"
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* File or directory entry information
|
|
1579
|
+
* Compatible with e2b SDK EntryInfo
|
|
1580
|
+
*/
|
|
1581
|
+
interface EntryInfo {
|
|
1582
|
+
name: string;
|
|
1583
|
+
type: FileType;
|
|
1584
|
+
path: string;
|
|
1585
|
+
size: number;
|
|
1586
|
+
mode: number;
|
|
1587
|
+
permissions: string;
|
|
1588
|
+
owner: string;
|
|
1589
|
+
group: string;
|
|
1590
|
+
modifiedTime?: Date;
|
|
1591
|
+
symlinkTarget?: string;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Write operation result
|
|
1595
|
+
* Compatible with e2b SDK WriteInfo
|
|
1596
|
+
*/
|
|
1597
|
+
interface WriteInfo {
|
|
1598
|
+
path: string;
|
|
1599
|
+
type: FileType;
|
|
1600
|
+
name: string;
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Filesystem watch event
|
|
1604
|
+
* Compatible with e2b SDK FilesystemEvent
|
|
1605
|
+
*/
|
|
1606
|
+
interface FilesystemEvent {
|
|
1607
|
+
name: string;
|
|
1608
|
+
type: FilesystemEventType;
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Handle for stopping a directory watch
|
|
1612
|
+
* Compatible with e2b SDK WatchHandle
|
|
1613
|
+
*/
|
|
1614
|
+
interface WatchHandle {
|
|
1615
|
+
stop(): Promise<void>;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* @deprecated Use the standalone type definitions above instead.
|
|
1619
|
+
* This type alias is kept for backward compatibility with code that
|
|
1620
|
+
* imported `Filesystem` type from this module.
|
|
1621
|
+
*/
|
|
1622
|
+
type Filesystem = FilesResource;
|
|
1317
1623
|
/**
|
|
1318
1624
|
* Base options for filesystem operations
|
|
1319
1625
|
* 对齐 e2b SDK FilesystemRequestOpts
|
|
@@ -1397,7 +1703,7 @@ interface FilesResource {
|
|
|
1397
1703
|
/** Write multiple files in batch */
|
|
1398
1704
|
write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<WriteInfo[]>;
|
|
1399
1705
|
/** List directory contents with optional depth */
|
|
1400
|
-
list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo
|
|
1706
|
+
list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo[]>;
|
|
1401
1707
|
/** Check if path exists */
|
|
1402
1708
|
exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
|
|
1403
1709
|
/** Create directory */
|
|
@@ -1405,9 +1711,9 @@ interface FilesResource {
|
|
|
1405
1711
|
/** Remove file or directory */
|
|
1406
1712
|
remove(path: string, opts?: FilesystemRequestOpts): Promise<void>;
|
|
1407
1713
|
/** Rename/move file or directory */
|
|
1408
|
-
rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo
|
|
1714
|
+
rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo>;
|
|
1409
1715
|
/** Get file or directory information */
|
|
1410
|
-
getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo
|
|
1716
|
+
getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo>;
|
|
1411
1717
|
/** Watch directory for changes */
|
|
1412
1718
|
watchDir(path: string, onEvent: (event: FilesystemEvent) => void | Promise<void>, opts?: WatchOpts & {
|
|
1413
1719
|
onExit?: (err?: Error) => void | Promise<void>;
|
|
@@ -1510,7 +1816,7 @@ type PromptContentBlock = {
|
|
|
1510
1816
|
uri: string;
|
|
1511
1817
|
mimeType?: string | null;
|
|
1512
1818
|
name: string;
|
|
1513
|
-
size?:
|
|
1819
|
+
size?: number | null;
|
|
1514
1820
|
title?: string | null;
|
|
1515
1821
|
_meta?: {
|
|
1516
1822
|
[key: string]: unknown;
|
|
@@ -1616,13 +1922,22 @@ interface AgentConnection {
|
|
|
1616
1922
|
* @param sessionId 会话 ID
|
|
1617
1923
|
* @param toolCallId 工具调用 ID
|
|
1618
1924
|
* @param toolName 工具名称
|
|
1619
|
-
* @param action 操作类型 ('skip' | 'cancel')
|
|
1925
|
+
* @param action 操作类型 ('approve' | 'skip' | 'cancel')
|
|
1620
1926
|
*/
|
|
1621
|
-
toolCallback(sessionId: string, toolCallId: string, toolName: string, action: 'skip' | 'cancel'): Promise<{
|
|
1927
|
+
toolCallback(sessionId: string, toolCallId: string, toolName: string, action: 'approve' | 'skip' | 'cancel'): Promise<{
|
|
1622
1928
|
success: boolean;
|
|
1623
1929
|
error?: string;
|
|
1624
1930
|
}>;
|
|
1625
1931
|
extMethod(method: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
1932
|
+
/**
|
|
1933
|
+
* Report telemetry event through the standard provider chain
|
|
1934
|
+
* - Local: via ACP JSON-RPC → IDE EventService
|
|
1935
|
+
* - Cloud: via StreamableHTTP → cloud telemetry endpoint
|
|
1936
|
+
*
|
|
1937
|
+
* @param eventName - Event name / code
|
|
1938
|
+
* @param payload - Event data (already includes mode)
|
|
1939
|
+
*/
|
|
1940
|
+
reportTelemetry?(eventName: string, payload: Record<string, unknown>): Promise<void>;
|
|
1626
1941
|
}
|
|
1627
1942
|
/**
|
|
1628
1943
|
* Base configuration for connections
|
|
@@ -1830,6 +2145,8 @@ interface BaseAgentState {
|
|
|
1830
2145
|
updatedAt?: Date;
|
|
1831
2146
|
/** 是否为 playground */
|
|
1832
2147
|
isPlayground?: boolean;
|
|
2148
|
+
/** Whether the title is user defined (1 = user defined) */
|
|
2149
|
+
isUserDefinedTitle?: number;
|
|
1833
2150
|
}
|
|
1834
2151
|
/**
|
|
1835
2152
|
* LocalAgentState - 本地 Agent 状态
|
|
@@ -1893,6 +2210,11 @@ interface ListAgentSort {
|
|
|
1893
2210
|
* Local: Client-side filtering and sorting, no pagination (returns all)
|
|
1894
2211
|
*/
|
|
1895
2212
|
interface ListAgentOptions {
|
|
2213
|
+
/**
|
|
2214
|
+
* User ID for filtering sessions (required for multi-user isolation)
|
|
2215
|
+
* If not provided, returns empty list for Local provider
|
|
2216
|
+
*/
|
|
2217
|
+
userId?: string;
|
|
1896
2218
|
/**
|
|
1897
2219
|
* Page number (starts from 1)
|
|
1898
2220
|
* Cloud: Used for API pagination
|
|
@@ -1976,16 +2298,38 @@ interface SessionInfo {
|
|
|
1976
2298
|
cwd?: string;
|
|
1977
2299
|
/** Whether the session is a playground */
|
|
1978
2300
|
isPlayground?: boolean;
|
|
2301
|
+
/** Whether the title is user defined (1 = user defined) */
|
|
2302
|
+
isUserDefinedTitle?: number;
|
|
1979
2303
|
}
|
|
1980
2304
|
/**
|
|
1981
2305
|
* Parameters for creating a new session
|
|
1982
2306
|
*/
|
|
1983
2307
|
interface CreateSessionParams$1 {
|
|
1984
|
-
/** Working directory */
|
|
2308
|
+
/** Working directory (required) */
|
|
1985
2309
|
cwd: string;
|
|
2310
|
+
/** Optional configuration */
|
|
2311
|
+
options?: CreateSessionOptions;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Optional configuration for creating a session
|
|
2315
|
+
*/
|
|
2316
|
+
interface CreateSessionOptions {
|
|
1986
2317
|
/** MCP server configurations */
|
|
1987
2318
|
mcpServers?: McpServerConfig[];
|
|
2319
|
+
/** Initial prompt for the session (Cloud only) */
|
|
2320
|
+
prompt?: string;
|
|
2321
|
+
/** Initial model for the session (Cloud only) */
|
|
2322
|
+
model?: string;
|
|
2323
|
+
/** Mode ID (e.g., 'craft', 'architect') */
|
|
2324
|
+
mode?: string;
|
|
2325
|
+
/** Whether this is a playground session (no cwd) */
|
|
2326
|
+
isPlayground?: boolean;
|
|
2327
|
+
/** Tags for template scenes (Cloud only, format: { scene: 'xxx' }) */
|
|
2328
|
+
tags?: Record<string, string>;
|
|
2329
|
+
/** Additional metadata */
|
|
1988
2330
|
_meta?: Record<string, unknown>;
|
|
2331
|
+
/** Callback when session is prepared (POST succeeded, before WebSocket connect) */
|
|
2332
|
+
onSessionPrepared?: (sessionInfo: SessionInfo) => void;
|
|
1989
2333
|
}
|
|
1990
2334
|
/**
|
|
1991
2335
|
* Parameters for loading an existing session
|
|
@@ -2020,6 +2364,84 @@ interface InitializeWorkspaceResponse {
|
|
|
2020
2364
|
/** Error message (if failed) */
|
|
2021
2365
|
error?: string;
|
|
2022
2366
|
}
|
|
2367
|
+
type AutomationStatus = 'ACTIVE' | 'PAUSED';
|
|
2368
|
+
type AutomationUpdateMode = 'view' | 'suggested create' | 'suggested update';
|
|
2369
|
+
type AutomationRunStatus = 'ACCEPTED' | 'ARCHIVED' | 'PENDING_REVIEW' | 'IN_PROGRESS';
|
|
2370
|
+
interface AutomationDefinition {
|
|
2371
|
+
version: number;
|
|
2372
|
+
id: string;
|
|
2373
|
+
name: string;
|
|
2374
|
+
prompt: string;
|
|
2375
|
+
status: AutomationStatus;
|
|
2376
|
+
rrule: string;
|
|
2377
|
+
cwds: string[];
|
|
2378
|
+
modelId?: string;
|
|
2379
|
+
modelIsThinking?: boolean;
|
|
2380
|
+
created_at: number;
|
|
2381
|
+
updated_at: number;
|
|
2382
|
+
}
|
|
2383
|
+
interface AutomationCwdRunResult {
|
|
2384
|
+
cwd: string;
|
|
2385
|
+
success: boolean;
|
|
2386
|
+
startedAt: number;
|
|
2387
|
+
finishedAt: number;
|
|
2388
|
+
conversationId?: string;
|
|
2389
|
+
output?: string;
|
|
2390
|
+
error?: string;
|
|
2391
|
+
}
|
|
2392
|
+
interface AutomationInboxItem {
|
|
2393
|
+
id: string;
|
|
2394
|
+
automationId: string;
|
|
2395
|
+
automationName: string;
|
|
2396
|
+
status?: AutomationRunStatus;
|
|
2397
|
+
readAt?: number;
|
|
2398
|
+
startedAt: number;
|
|
2399
|
+
finishedAt: number;
|
|
2400
|
+
success: boolean;
|
|
2401
|
+
summary: string;
|
|
2402
|
+
runs: AutomationCwdRunResult[];
|
|
2403
|
+
archived?: boolean;
|
|
2404
|
+
archivedAt?: number;
|
|
2405
|
+
}
|
|
2406
|
+
interface AutomationRuntimeState {
|
|
2407
|
+
lastRunAt?: number;
|
|
2408
|
+
lastError?: string;
|
|
2409
|
+
running?: boolean;
|
|
2410
|
+
runningStartedAt?: number;
|
|
2411
|
+
runningConversationId?: string;
|
|
2412
|
+
}
|
|
2413
|
+
interface AutomationSnapshot {
|
|
2414
|
+
automations: AutomationDefinition[];
|
|
2415
|
+
inbox: AutomationInboxItem[];
|
|
2416
|
+
runtimeState: Record<string, AutomationRuntimeState>;
|
|
2417
|
+
updatedAt: number;
|
|
2418
|
+
}
|
|
2419
|
+
interface AutomationUpdatePayload {
|
|
2420
|
+
mode: AutomationUpdateMode;
|
|
2421
|
+
id?: string;
|
|
2422
|
+
name?: string;
|
|
2423
|
+
prompt?: string;
|
|
2424
|
+
rrule?: string;
|
|
2425
|
+
cwds?: string[] | string;
|
|
2426
|
+
status?: AutomationStatus;
|
|
2427
|
+
modelId?: string;
|
|
2428
|
+
modelIsThinking?: boolean;
|
|
2429
|
+
}
|
|
2430
|
+
interface AutomationUpdateResult {
|
|
2431
|
+
success: boolean;
|
|
2432
|
+
message: string;
|
|
2433
|
+
automation?: AutomationDefinition;
|
|
2434
|
+
snapshot?: AutomationSnapshot;
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* Parameters for getting available commands
|
|
2438
|
+
*/
|
|
2439
|
+
interface GetAvailableCommandsParams {
|
|
2440
|
+
/** Session ID to get commands for (optional, for global commands) */
|
|
2441
|
+
sessionId?: string;
|
|
2442
|
+
/** Workspace path for getting custom commands (optional) */
|
|
2443
|
+
workspacePath?: string;
|
|
2444
|
+
}
|
|
2023
2445
|
/**
|
|
2024
2446
|
* Prompts resource interface (ACP verbs)
|
|
2025
2447
|
* Operations use the current session automatically
|
|
@@ -2057,7 +2479,7 @@ interface ModelsResource {
|
|
|
2057
2479
|
*/
|
|
2058
2480
|
interface PromptResponse {
|
|
2059
2481
|
/** Stop reason */
|
|
2060
|
-
stopReason:
|
|
2482
|
+
stopReason: StopReason;
|
|
2061
2483
|
/** Response metadata */
|
|
2062
2484
|
_meta?: Record<string, unknown>;
|
|
2063
2485
|
}
|
|
@@ -2067,7 +2489,7 @@ interface PromptResponse {
|
|
|
2067
2489
|
interface SessionsResourceEvents {
|
|
2068
2490
|
/** Emitted when the sessions list changes (create, delete, update) */
|
|
2069
2491
|
sessionsChanged: SessionInfo[];
|
|
2070
|
-
/** Emitted when a new session is
|
|
2492
|
+
/** Emitted when a new session is fully connected and ready */
|
|
2071
2493
|
sessionCreated: SessionInfo;
|
|
2072
2494
|
/** Emitted when a session is deleted */
|
|
2073
2495
|
sessionDeleted: {
|
|
@@ -2075,6 +2497,12 @@ interface SessionsResourceEvents {
|
|
|
2075
2497
|
};
|
|
2076
2498
|
/** Emitted when a session is updated (status change, etc.) */
|
|
2077
2499
|
sessionUpdated: SessionInfo;
|
|
2500
|
+
/** Emitted when automation snapshot is updated (pushed from server) */
|
|
2501
|
+
automationSnapshotUpdate: AutomationSnapshot;
|
|
2502
|
+
/** Emitted when plugins or marketplaces change (install/uninstall/add/remove/update) */
|
|
2503
|
+
pluginsChanged: {
|
|
2504
|
+
newMarketplaceName?: string;
|
|
2505
|
+
} | undefined;
|
|
2078
2506
|
}
|
|
2079
2507
|
/**
|
|
2080
2508
|
* Event handler type for sessions resource events
|
|
@@ -2151,6 +2579,8 @@ interface ActiveSession {
|
|
|
2151
2579
|
readonly id: string;
|
|
2152
2580
|
/** Agent ID */
|
|
2153
2581
|
readonly agentId: string;
|
|
2582
|
+
/** Actual workspace path (set after newSession, useful for Playground scenario) */
|
|
2583
|
+
readonly cwd?: string;
|
|
2154
2584
|
/** Agent state (direct access to underlying agent state) */
|
|
2155
2585
|
readonly agentState: AgentState;
|
|
2156
2586
|
/** Agent capabilities (available after connection) */
|
|
@@ -2188,8 +2618,8 @@ interface ActiveSession {
|
|
|
2188
2618
|
answerQuestion(toolCallId: string, answers: QuestionAnswers): boolean;
|
|
2189
2619
|
/** Cancel a question request */
|
|
2190
2620
|
cancelQuestion(toolCallId: string, reason?: string): boolean;
|
|
2191
|
-
/** Callback for tool operations (skip
|
|
2192
|
-
toolCallback(toolCallId: string, toolName: string, action: 'skip' | 'cancel'): Promise<{
|
|
2621
|
+
/** Callback for tool operations (approve / skip / cancel) */
|
|
2622
|
+
toolCallback(toolCallId: string, toolName: string, action: 'approve' | 'skip' | 'cancel'): Promise<{
|
|
2193
2623
|
success: boolean;
|
|
2194
2624
|
error?: string;
|
|
2195
2625
|
}>;
|
|
@@ -2211,6 +2641,12 @@ interface ActiveSession {
|
|
|
2211
2641
|
once<K extends keyof SessionEvents>(event: K, handler: SessionEventHandler<K>): this;
|
|
2212
2642
|
/** Disconnect from the session/agent */
|
|
2213
2643
|
disconnect(): void;
|
|
2644
|
+
/**
|
|
2645
|
+
* Detach the session from connection events without disconnecting the connection.
|
|
2646
|
+
* This should be called when the session is being replaced but the connection is shared.
|
|
2647
|
+
* Unlike disconnect(), this only removes event listeners without closing the connection.
|
|
2648
|
+
*/
|
|
2649
|
+
detach(): void;
|
|
2214
2650
|
/** Symbol.dispose for 'using' keyword support */
|
|
2215
2651
|
[Symbol.dispose](): void;
|
|
2216
2652
|
}
|
|
@@ -2275,6 +2711,17 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2275
2711
|
rename?(agentId: string, title: string): Promise<{
|
|
2276
2712
|
id: string;
|
|
2277
2713
|
}>;
|
|
2714
|
+
/**
|
|
2715
|
+
* Update agent status by ID (optional)
|
|
2716
|
+
* Used by CloudAgentProvider for updating session status
|
|
2717
|
+
*
|
|
2718
|
+
* @param agentId - Agent ID to update
|
|
2719
|
+
* @param status - New status for the agent
|
|
2720
|
+
* @returns Object containing the updated agent ID
|
|
2721
|
+
*/
|
|
2722
|
+
updateStatus?(agentId: string, status: string): Promise<{
|
|
2723
|
+
id: string;
|
|
2724
|
+
}>;
|
|
2278
2725
|
/**
|
|
2279
2726
|
* Move an agent by ID (optional)
|
|
2280
2727
|
* Used by LocalAgentProvider for moving Playground sessions to Workspace
|
|
@@ -2294,6 +2741,34 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2294
2741
|
* @returns Array of model information
|
|
2295
2742
|
*/
|
|
2296
2743
|
getModels?(repo?: string): Promise<ModelInfo[]>;
|
|
2744
|
+
/**
|
|
2745
|
+
* Get product configuration subset (optional)
|
|
2746
|
+
* Returns deploymentType, creditPurchaseActions, links, networkEnvironment, productFeatures
|
|
2747
|
+
*/
|
|
2748
|
+
getProductConfiguration?(): Promise<{
|
|
2749
|
+
deploymentType?: string;
|
|
2750
|
+
creditPurchaseActions?: Record<string, {
|
|
2751
|
+
labelZh: string;
|
|
2752
|
+
labelEn: string;
|
|
2753
|
+
url: string;
|
|
2754
|
+
showButton?: boolean;
|
|
2755
|
+
}>;
|
|
2756
|
+
links?: {
|
|
2757
|
+
craftFeedback?: string;
|
|
2758
|
+
mcpMarketUrl?: string;
|
|
2759
|
+
mcpDocumentUrl?: string;
|
|
2760
|
+
helpDocument?: string;
|
|
2761
|
+
};
|
|
2762
|
+
networkEnvironment?: string;
|
|
2763
|
+
productFeatures?: Record<string, boolean>;
|
|
2764
|
+
}>;
|
|
2765
|
+
/**
|
|
2766
|
+
* Get user info (optional)
|
|
2767
|
+
* Returns enterpriseId from authentication session
|
|
2768
|
+
*/
|
|
2769
|
+
getUserInfo?(): Promise<{
|
|
2770
|
+
enterpriseId?: string;
|
|
2771
|
+
}>;
|
|
2297
2772
|
/**
|
|
2298
2773
|
* Register sessionId → agentId mapping (optional, used by LocalAgentProvider)
|
|
2299
2774
|
* Called after session creation to maintain the mapping for loadSession
|
|
@@ -2309,6 +2784,8 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2309
2784
|
* @returns Response with success status
|
|
2310
2785
|
*/
|
|
2311
2786
|
openWorkspace?(params: InitializeWorkspaceParams): Promise<InitializeWorkspaceResponse>;
|
|
2787
|
+
/** Request yielding after current step for a running session (optional, used by LocalAgentProvider) */
|
|
2788
|
+
requestYieldAfterCurrentStep?(sessionId: string): Promise<boolean>;
|
|
2312
2789
|
/**
|
|
2313
2790
|
* Pick files from file dialog (optional, used by LocalAgentProvider)
|
|
2314
2791
|
*
|
|
@@ -2344,6 +2821,61 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2344
2821
|
* @returns Response with subagent list
|
|
2345
2822
|
*/
|
|
2346
2823
|
getSubagentList?(params: GetSubagentListParams): Promise<GetSubagentListResponse>;
|
|
2824
|
+
/**
|
|
2825
|
+
* Get skill list (optional, used by LocalAgentProvider)
|
|
2826
|
+
*
|
|
2827
|
+
* @param params - Query parameters
|
|
2828
|
+
* @returns Response with skill list
|
|
2829
|
+
*/
|
|
2830
|
+
getSkillList?(params?: GetSkillListParams): Promise<GetSkillListResponse>;
|
|
2831
|
+
/**
|
|
2832
|
+
* Import a skill folder (optional, used by LocalAgentProvider)
|
|
2833
|
+
*
|
|
2834
|
+
* @param params - Import parameters including source location
|
|
2835
|
+
* @returns Response with import result
|
|
2836
|
+
*/
|
|
2837
|
+
importSkill?(params: ImportSkillParams): Promise<ImportSkillResponse>;
|
|
2838
|
+
/**
|
|
2839
|
+
* Get skill content by file path (optional, used by LocalAgentProvider)
|
|
2840
|
+
*
|
|
2841
|
+
* @param params - Parameters including skill file path
|
|
2842
|
+
* @returns Response with skill content
|
|
2843
|
+
*/
|
|
2844
|
+
getSkillContent?(params: GetSkillContentParams): Promise<GetSkillContentResponse>;
|
|
2845
|
+
/**
|
|
2846
|
+
* Get marketplace skills list (optional, used by LocalAgentProvider)
|
|
2847
|
+
*
|
|
2848
|
+
* @returns Response with marketplace skill list
|
|
2849
|
+
*/
|
|
2850
|
+
getMarketplaceSkills?(): Promise<GetMarketplaceSkillsResponse>;
|
|
2851
|
+
/**
|
|
2852
|
+
* Get marketplace skill content (optional, used by LocalAgentProvider)
|
|
2853
|
+
*
|
|
2854
|
+
* @param params - Parameters including skill name
|
|
2855
|
+
* @returns Response with skill content
|
|
2856
|
+
*/
|
|
2857
|
+
getMarketplaceSkillContent?(params: GetMarketplaceSkillContentParams): Promise<GetMarketplaceSkillContentResponse>;
|
|
2858
|
+
/**
|
|
2859
|
+
* Install marketplace skill to user directory (optional, used by LocalAgentProvider)
|
|
2860
|
+
*
|
|
2861
|
+
* @param params - Parameters including skill name
|
|
2862
|
+
* @returns Response with install result
|
|
2863
|
+
*/
|
|
2864
|
+
installMarketplaceSkill?(params: InstallMarketplaceSkillParams): Promise<InstallMarketplaceSkillResponse>;
|
|
2865
|
+
/**
|
|
2866
|
+
* Toggle skill enable/disable state (optional, used by LocalAgentProvider)
|
|
2867
|
+
*
|
|
2868
|
+
* @param params - Toggle parameters including filePath and disable state
|
|
2869
|
+
* @returns Response with toggle result
|
|
2870
|
+
*/
|
|
2871
|
+
toggleSkill?(params: ToggleSkillParams): Promise<ToggleSkillResponse>;
|
|
2872
|
+
/**
|
|
2873
|
+
* Delete a skill (optional, used by LocalAgentProvider)
|
|
2874
|
+
*
|
|
2875
|
+
* @param params - Delete parameters including filePath and name
|
|
2876
|
+
* @returns Response with delete result
|
|
2877
|
+
*/
|
|
2878
|
+
deleteSkill?(params: DeleteSkillParams): Promise<DeleteSkillResponse>;
|
|
2347
2879
|
/**
|
|
2348
2880
|
* Batch toggle plugins (optional, used by LocalAgentProvider)
|
|
2349
2881
|
*
|
|
@@ -2364,6 +2896,9 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2364
2896
|
description?: string;
|
|
2365
2897
|
version?: string;
|
|
2366
2898
|
installScope?: 'user' | 'project';
|
|
2899
|
+
installedScopes?: Array<'user' | 'project' | 'local' | 'project-local'>;
|
|
2900
|
+
installedScopesStatus?: Record<string, boolean>;
|
|
2901
|
+
installId?: string;
|
|
2367
2902
|
}>>;
|
|
2368
2903
|
/**
|
|
2369
2904
|
* Install plugins (optional, used by LocalAgentProvider)
|
|
@@ -2374,7 +2909,7 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2374
2909
|
* @param marketplaceSource - Marketplace source URL (for auto-adding marketplace when not exists)
|
|
2375
2910
|
* @returns Result of the operation
|
|
2376
2911
|
*/
|
|
2377
|
-
installPlugins?(pluginNames: string[], marketplaceName: string, installScope?: 'user' | 'project', marketplaceSource?: string): Promise<{
|
|
2912
|
+
installPlugins?(pluginNames: string[], marketplaceName: string, installScope?: 'user' | 'project', marketplaceSource?: string, workspacePath?: string): Promise<{
|
|
2378
2913
|
success: boolean;
|
|
2379
2914
|
error?: string;
|
|
2380
2915
|
}>;
|
|
@@ -2383,10 +2918,34 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2383
2918
|
* If session.availableCommands has cached values, return them
|
|
2384
2919
|
* Otherwise, fetch from product configuration
|
|
2385
2920
|
*
|
|
2386
|
-
* @param
|
|
2921
|
+
* @param params - Parameters for getting commands
|
|
2387
2922
|
* @returns Array of available commands
|
|
2388
2923
|
*/
|
|
2389
|
-
getAvailableCommands?(
|
|
2924
|
+
getAvailableCommands?(params?: GetAvailableCommandsParams): Promise<AvailableCommand[]>;
|
|
2925
|
+
/**
|
|
2926
|
+
* Get automation snapshot (optional, used by LocalAgentProvider)
|
|
2927
|
+
*/
|
|
2928
|
+
getAutomationSnapshot?(): Promise<AutomationSnapshot>;
|
|
2929
|
+
/**
|
|
2930
|
+
* Create/update automation definition (optional, used by LocalAgentProvider)
|
|
2931
|
+
*/
|
|
2932
|
+
updateAutomation?(payload: AutomationUpdatePayload): Promise<AutomationUpdateResult>;
|
|
2933
|
+
/**
|
|
2934
|
+
* Delete automation definition (optional, used by LocalAgentProvider)
|
|
2935
|
+
*/
|
|
2936
|
+
deleteAutomation?(id: string): Promise<AutomationUpdateResult>;
|
|
2937
|
+
/**
|
|
2938
|
+
* Archive an automation inbox item (optional, used by LocalAgentProvider)
|
|
2939
|
+
*/
|
|
2940
|
+
archiveAutomationInboxItem?(itemId: string): Promise<AutomationUpdateResult>;
|
|
2941
|
+
/**
|
|
2942
|
+
* Delete an automation inbox item (optional, used by LocalAgentProvider)
|
|
2943
|
+
*/
|
|
2944
|
+
deleteAutomationInboxItem?(itemId: string): Promise<AutomationUpdateResult>;
|
|
2945
|
+
/**
|
|
2946
|
+
* Trigger test run for automation (optional, used by LocalAgentProvider)
|
|
2947
|
+
*/
|
|
2948
|
+
testAutomation?(id: string): Promise<AutomationUpdateResult>;
|
|
2390
2949
|
/**
|
|
2391
2950
|
* Register an event listener
|
|
2392
2951
|
* Provider implementations should forward events to the underlying transport
|
|
@@ -2402,6 +2961,131 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
|
|
|
2402
2961
|
* @param handler - Event handler function to remove
|
|
2403
2962
|
*/
|
|
2404
2963
|
off?(event: string, handler: (...args: any[]) => void): void;
|
|
2964
|
+
/**
|
|
2965
|
+
* Report telemetry event through the provider chain
|
|
2966
|
+
* - Local: via ACP JSON-RPC → AcpAgent → IDE EventService
|
|
2967
|
+
* - Cloud: via connection → cloud endpoint
|
|
2968
|
+
*
|
|
2969
|
+
* @param eventName - Event name / code
|
|
2970
|
+
* @param payload - Event data
|
|
2971
|
+
*/
|
|
2972
|
+
reportTelemetry?(eventName: string, payload: Record<string, unknown>): Promise<void>;
|
|
2973
|
+
/**
|
|
2974
|
+
* Respond to MCP Sampling confirmation request (optional, used by LocalAgentProvider)
|
|
2975
|
+
* Called when user confirms/rejects a sampling request
|
|
2976
|
+
*
|
|
2977
|
+
* @param sessionId - Session ID
|
|
2978
|
+
* @param response - Sampling confirmation response
|
|
2979
|
+
*/
|
|
2980
|
+
respondToSampling?(sessionId: string, response: McpSamplingConfirmResponse): Promise<void>;
|
|
2981
|
+
/**
|
|
2982
|
+
* Respond to MCP Roots confirmation request (optional, used by LocalAgentProvider)
|
|
2983
|
+
* Called when user confirms/rejects a roots request
|
|
2984
|
+
*
|
|
2985
|
+
* @param sessionId - Session ID
|
|
2986
|
+
* @param response - Roots confirmation response
|
|
2987
|
+
*/
|
|
2988
|
+
respondToRoots?(sessionId: string, response: McpRootsConfirmResponse): Promise<void>;
|
|
2989
|
+
/**
|
|
2990
|
+
* Subscribe to MCP Sampling confirmation requests (optional, used by LocalAgentProvider)
|
|
2991
|
+
* Called when MCP server initiates a sampling request
|
|
2992
|
+
*
|
|
2993
|
+
* @param serverName - MCP server name
|
|
2994
|
+
* @param callback - Request callback
|
|
2995
|
+
* @returns Unsubscribe function
|
|
2996
|
+
*/
|
|
2997
|
+
subscribeSamplingRequests?(serverName: string, callback: (request: McpSamplingConfirmRequest) => void): () => void;
|
|
2998
|
+
/**
|
|
2999
|
+
* Subscribe to MCP Roots confirmation requests (optional, used by LocalAgentProvider)
|
|
3000
|
+
* Called when MCP server initiates a roots request
|
|
3001
|
+
*
|
|
3002
|
+
* @param serverName - MCP server name
|
|
3003
|
+
* @param callback - Request callback
|
|
3004
|
+
* @returns Unsubscribe function
|
|
3005
|
+
*/
|
|
3006
|
+
subscribeRootsRequests?(serverName: string, callback: (request: McpRootsConfirmRequest) => void): () => void;
|
|
3007
|
+
/**
|
|
3008
|
+
* Get product scenes from ProductManager configuration (optional, for LocalAgentProvider)
|
|
3009
|
+
* 从 ProductManager.waitConfiguration().scenes 获取本地配置的场景数据
|
|
3010
|
+
* @param locale - 可选,语言环境
|
|
3011
|
+
*/
|
|
3012
|
+
getProductScenes?(locale?: string): Promise<Array<{
|
|
3013
|
+
id: number;
|
|
3014
|
+
name: string;
|
|
3015
|
+
plugins: Array<{
|
|
3016
|
+
id: number;
|
|
3017
|
+
name: string;
|
|
3018
|
+
marketplaceName: string;
|
|
3019
|
+
}>;
|
|
3020
|
+
prompts: string[];
|
|
3021
|
+
mode?: 'coding' | 'working';
|
|
3022
|
+
target?: 'local' | 'cloud' | 'all';
|
|
3023
|
+
}>>;
|
|
3024
|
+
/**
|
|
3025
|
+
* Get all MCP servers with their status and tools (optional, used by LocalAgentProvider)
|
|
3026
|
+
* Returns the list of configured MCP servers from McpServerManager
|
|
3027
|
+
*
|
|
3028
|
+
* @returns Array of MCP server information
|
|
3029
|
+
*/
|
|
3030
|
+
getMcpServers?(): Promise<Array<{
|
|
3031
|
+
id: string;
|
|
3032
|
+
name: string;
|
|
3033
|
+
status: 'connecting' | 'connected' | 'disconnected' | 'disabled';
|
|
3034
|
+
description?: string;
|
|
3035
|
+
tools?: Array<{
|
|
3036
|
+
name: string;
|
|
3037
|
+
description?: string;
|
|
3038
|
+
enabled?: boolean;
|
|
3039
|
+
}>;
|
|
3040
|
+
disabled?: boolean;
|
|
3041
|
+
error?: string;
|
|
3042
|
+
logoUrl?: string;
|
|
3043
|
+
officialUrl?: string;
|
|
3044
|
+
configSource?: 'user' | 'project' | 'plugin';
|
|
3045
|
+
}>>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Toggle MCP server enabled/disabled state (optional, used by LocalAgentProvider)
|
|
3048
|
+
*
|
|
3049
|
+
* @param serverName - Name of the MCP server to toggle
|
|
3050
|
+
* @param enabled - Whether to enable (true) or disable (false) the server
|
|
3051
|
+
*/
|
|
3052
|
+
toggleMcpServer?(serverName: string, enabled: boolean): Promise<void>;
|
|
3053
|
+
/**
|
|
3054
|
+
* Reconnect to an MCP server (optional, used by LocalAgentProvider)
|
|
3055
|
+
*
|
|
3056
|
+
* @param serverName - Name of the MCP server to reconnect
|
|
3057
|
+
* @param forceHttpCallback - Force using HTTP callback instead of URL scheme
|
|
3058
|
+
*/
|
|
3059
|
+
reconnectMcpServer?(serverName: string, forceHttpCallback?: boolean): Promise<void>;
|
|
3060
|
+
/**
|
|
3061
|
+
* Delete an MCP server configuration (optional, used by LocalAgentProvider)
|
|
3062
|
+
*
|
|
3063
|
+
* @param serverName - Name of the MCP server to delete
|
|
3064
|
+
*/
|
|
3065
|
+
deleteMcpServer?(serverName: string): Promise<void>;
|
|
3066
|
+
/**
|
|
3067
|
+
* Open the MCP configuration file in editor (optional, used by LocalAgentProvider)
|
|
3068
|
+
* Executes 'codebuddy.openMcpConfig' command
|
|
3069
|
+
*/
|
|
3070
|
+
openMcpConfig?(): Promise<void>;
|
|
3071
|
+
/**
|
|
3072
|
+
* Get MCP configuration file content
|
|
3073
|
+
* @returns File path and content
|
|
3074
|
+
*/
|
|
3075
|
+
getMcpConfigContent?(): Promise<{
|
|
3076
|
+
filePath: string;
|
|
3077
|
+
content: string;
|
|
3078
|
+
}>;
|
|
3079
|
+
/**
|
|
3080
|
+
* Save MCP configuration file content
|
|
3081
|
+
* @param content New configuration content
|
|
3082
|
+
*/
|
|
3083
|
+
saveMcpConfigContent?(content: string): Promise<void>;
|
|
3084
|
+
/**
|
|
3085
|
+
* Read text from clipboard (optional, used by LocalAgentProvider for webview clipboard access)
|
|
3086
|
+
* @returns Clipboard text content
|
|
3087
|
+
*/
|
|
3088
|
+
clipboardReadText?(): Promise<string>;
|
|
2405
3089
|
}
|
|
2406
3090
|
/**
|
|
2407
3091
|
* AgentClient initialization options
|
|
@@ -2459,6 +3143,15 @@ interface ClientSessionsResource {
|
|
|
2459
3143
|
rename(sessionId: string, title: string): Promise<{
|
|
2460
3144
|
id: string;
|
|
2461
3145
|
}>;
|
|
3146
|
+
/**
|
|
3147
|
+
* Update session status
|
|
3148
|
+
* @param sessionId - Session ID to update
|
|
3149
|
+
* @param status - New status for the session
|
|
3150
|
+
* @returns Object containing the updated session ID
|
|
3151
|
+
*/
|
|
3152
|
+
updateStatus(sessionId: string, status: string): Promise<{
|
|
3153
|
+
id: string;
|
|
3154
|
+
}>;
|
|
2462
3155
|
/**
|
|
2463
3156
|
* Move a session (Playground → Workspace)
|
|
2464
3157
|
* @param sessionId - Session ID to move
|
|
@@ -2469,6 +3162,8 @@ interface ClientSessionsResource {
|
|
|
2469
3162
|
}>;
|
|
2470
3163
|
/** Initialize a workspace for future sessions */
|
|
2471
3164
|
initializeWorkspace(params: InitializeWorkspaceParams): Promise<InitializeWorkspaceResponse>;
|
|
3165
|
+
/** Request yielding after current step for a running session */
|
|
3166
|
+
requestYieldAfterCurrentStep(sessionId: string): Promise<boolean>;
|
|
2472
3167
|
/** Models resource for getting available models */
|
|
2473
3168
|
readonly models: ModelsResource;
|
|
2474
3169
|
/** Get current workspaces list */
|
|
@@ -2491,6 +3186,22 @@ interface ClientSessionsResource {
|
|
|
2491
3186
|
searchFile(params: SearchFileParams): Promise<SearchFileResponse>;
|
|
2492
3187
|
/** Get subagent list (for LocalAgentProvider) */
|
|
2493
3188
|
getSubagentList(params: GetSubagentListParams): Promise<GetSubagentListResponse>;
|
|
3189
|
+
/** Get skill list (for LocalAgentProvider) */
|
|
3190
|
+
getSkillList(params?: GetSkillListParams): Promise<GetSkillListResponse>;
|
|
3191
|
+
/** Import a skill folder (for LocalAgentProvider) */
|
|
3192
|
+
importSkill(params: ImportSkillParams): Promise<ImportSkillResponse>;
|
|
3193
|
+
/** Toggle skill enable/disable state (for LocalAgentProvider) */
|
|
3194
|
+
toggleSkill(params: ToggleSkillParams): Promise<ToggleSkillResponse>;
|
|
3195
|
+
/** Delete a skill (for LocalAgentProvider) */
|
|
3196
|
+
deleteSkill(params: DeleteSkillParams): Promise<DeleteSkillResponse>;
|
|
3197
|
+
/** Get skill content by file path (for LocalAgentProvider) */
|
|
3198
|
+
getSkillContent(params: GetSkillContentParams): Promise<GetSkillContentResponse>;
|
|
3199
|
+
/** Get marketplace skills list (for LocalAgentProvider) */
|
|
3200
|
+
getMarketplaceSkills(): Promise<GetMarketplaceSkillsResponse>;
|
|
3201
|
+
/** Get marketplace skill content (for LocalAgentProvider) */
|
|
3202
|
+
getMarketplaceSkillContent(params: GetMarketplaceSkillContentParams): Promise<GetMarketplaceSkillContentResponse>;
|
|
3203
|
+
/** Install marketplace skill to user directory (for LocalAgentProvider) */
|
|
3204
|
+
installMarketplaceSkill(params: InstallMarketplaceSkillParams): Promise<InstallMarketplaceSkillResponse>;
|
|
2494
3205
|
/** Batch toggle plugins (for LocalAgentProvider) */
|
|
2495
3206
|
batchTogglePlugins(request: BatchPluginOperationRequest): Promise<BatchPluginOperationResult>;
|
|
2496
3207
|
/** Get installed plugins (for LocalAgentProvider) */
|
|
@@ -2501,34 +3212,388 @@ interface ClientSessionsResource {
|
|
|
2501
3212
|
description?: string;
|
|
2502
3213
|
version?: string;
|
|
2503
3214
|
installScope?: 'user' | 'project';
|
|
3215
|
+
installedScopes?: Array<'user' | 'project' | 'local' | 'project-local'>;
|
|
3216
|
+
installedScopesStatus?: Record<string, boolean>;
|
|
3217
|
+
installId?: string;
|
|
2504
3218
|
}>>;
|
|
2505
3219
|
/** Install plugins (for LocalAgentProvider) */
|
|
2506
|
-
installPlugins(pluginNames: string[], marketplaceName: string, installScope?: 'user' | 'project', marketplaceSource?: string): Promise<{
|
|
3220
|
+
installPlugins(pluginNames: string[], marketplaceName: string, installScope?: 'user' | 'project', marketplaceSource?: string, workspacePath?: string): Promise<{
|
|
2507
3221
|
success: boolean;
|
|
2508
3222
|
error?: string;
|
|
2509
3223
|
}>;
|
|
2510
|
-
/**
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
3224
|
+
/** Uninstall a plugin (for LocalAgentProvider) */
|
|
3225
|
+
uninstallPlugin?(pluginName: string, marketplaceName: string, scope: 'user' | 'project' | 'project-local'): Promise<{
|
|
3226
|
+
success: boolean;
|
|
3227
|
+
error?: string;
|
|
3228
|
+
}>;
|
|
3229
|
+
/** Update a plugin to the latest version (for LocalAgentProvider) */
|
|
3230
|
+
updatePlugin?(pluginName: string, marketplaceName: string): Promise<{
|
|
3231
|
+
success: boolean;
|
|
3232
|
+
error?: string;
|
|
3233
|
+
}>;
|
|
3234
|
+
/** Get plugin marketplaces list (for LocalAgentProvider) */
|
|
3235
|
+
getPluginMarketplaces?(forceRefresh?: boolean): Promise<Array<{
|
|
3236
|
+
id: string;
|
|
2516
3237
|
name: string;
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
3238
|
+
type: 'github' | 'local' | 'custom';
|
|
3239
|
+
source: {
|
|
3240
|
+
repo?: string;
|
|
3241
|
+
ref?: string;
|
|
3242
|
+
url?: string;
|
|
3243
|
+
};
|
|
3244
|
+
description?: string;
|
|
3245
|
+
isBuiltin?: boolean;
|
|
2523
3246
|
}>>;
|
|
2524
|
-
/**
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
3247
|
+
/** Get plugins from a marketplace (for LocalAgentProvider) */
|
|
3248
|
+
getMarketplacePlugins?(marketplaceName: string, forceRefresh?: boolean, searchText?: string): Promise<Array<{
|
|
3249
|
+
name: string;
|
|
3250
|
+
marketplaceName: string;
|
|
3251
|
+
description?: string;
|
|
3252
|
+
version?: string;
|
|
3253
|
+
author?: string;
|
|
3254
|
+
homepage?: string;
|
|
3255
|
+
iconUrl?: string;
|
|
3256
|
+
tags?: string[];
|
|
3257
|
+
installed?: boolean;
|
|
3258
|
+
status?: 'enabled' | 'disabled' | 'not-installed';
|
|
3259
|
+
installedScopes?: Array<'user' | 'project'>;
|
|
3260
|
+
hasUpdate?: boolean;
|
|
3261
|
+
}>>;
|
|
3262
|
+
/** Get plugin detail (for LocalAgentProvider) */
|
|
3263
|
+
getPluginDetail?(pluginName: string, marketplaceName: string): Promise<{
|
|
3264
|
+
name: string;
|
|
3265
|
+
marketplaceName: string;
|
|
3266
|
+
description?: string;
|
|
3267
|
+
version?: string;
|
|
3268
|
+
author?: string;
|
|
3269
|
+
homepage?: string;
|
|
3270
|
+
readme?: string;
|
|
3271
|
+
tools?: Array<{
|
|
3272
|
+
name: string;
|
|
3273
|
+
description?: string;
|
|
3274
|
+
}>;
|
|
3275
|
+
resources?: Array<{
|
|
3276
|
+
name: string;
|
|
3277
|
+
description?: string;
|
|
3278
|
+
}>;
|
|
3279
|
+
prompts?: Array<{
|
|
3280
|
+
name: string;
|
|
3281
|
+
description?: string;
|
|
3282
|
+
}>;
|
|
3283
|
+
installed?: boolean;
|
|
3284
|
+
status?: 'enabled' | 'disabled' | 'not-installed';
|
|
3285
|
+
} | null>;
|
|
3286
|
+
/** Add a plugin marketplace (for LocalAgentProvider) */
|
|
3287
|
+
addPluginMarketplace?(source: string, name?: string): Promise<{
|
|
3288
|
+
success: boolean;
|
|
3289
|
+
error?: string;
|
|
3290
|
+
marketplace?: {
|
|
3291
|
+
id: string;
|
|
3292
|
+
name: string;
|
|
3293
|
+
type: 'github' | 'local' | 'custom';
|
|
3294
|
+
source: {
|
|
3295
|
+
repo?: string;
|
|
3296
|
+
ref?: string;
|
|
3297
|
+
url?: string;
|
|
3298
|
+
};
|
|
3299
|
+
description?: string;
|
|
3300
|
+
isBuiltin?: boolean;
|
|
3301
|
+
};
|
|
3302
|
+
}>;
|
|
3303
|
+
/** Remove a plugin marketplace (for LocalAgentProvider) */
|
|
3304
|
+
removePluginMarketplace?(marketplaceName: string): Promise<{
|
|
3305
|
+
success: boolean;
|
|
3306
|
+
error?: string;
|
|
3307
|
+
}>;
|
|
3308
|
+
/** Refresh a plugin marketplace (for LocalAgentProvider) */
|
|
3309
|
+
refreshPluginMarketplace?(marketplaceName: string): Promise<{
|
|
3310
|
+
success: boolean;
|
|
3311
|
+
error?: string;
|
|
3312
|
+
plugins?: Array<{
|
|
3313
|
+
name: string;
|
|
3314
|
+
marketplaceName: string;
|
|
3315
|
+
description?: string;
|
|
3316
|
+
version?: string;
|
|
3317
|
+
installed?: boolean;
|
|
3318
|
+
status?: 'enabled' | 'disabled' | 'not-installed';
|
|
3319
|
+
}>;
|
|
3320
|
+
}>;
|
|
3321
|
+
/** Open folder in new window (for LocalAgentProvider) */
|
|
3322
|
+
openFolderInNewWindow?(folderPath: string): Promise<void>;
|
|
3323
|
+
/** Open folder in system file manager (for LocalAgentProvider) */
|
|
3324
|
+
openFolder?(folderPath: string): Promise<boolean>;
|
|
3325
|
+
/**
|
|
3326
|
+
* Get support scenes from backend API (for LocalAgentProvider)
|
|
3327
|
+
* API 端点: GET /v2/as/support/scenes (Local) 或 GET /console/as/support/scenes (Web)
|
|
3328
|
+
* @param locale - 可选,语言环境(如 'zh-CN', 'en-US'),用于获取对应语言的场景数据
|
|
3329
|
+
*/
|
|
3330
|
+
getSupportScenes(locale?: string): Promise<Array<{
|
|
3331
|
+
id: number;
|
|
3332
|
+
name: string;
|
|
3333
|
+
plugins: Array<{
|
|
3334
|
+
id: number;
|
|
3335
|
+
name: string;
|
|
3336
|
+
marketplaceName: string;
|
|
3337
|
+
}>;
|
|
3338
|
+
prompts: string[];
|
|
3339
|
+
mode?: 'coding' | 'working';
|
|
3340
|
+
}>>;
|
|
3341
|
+
/**
|
|
3342
|
+
* Get product scenes from ProductManager configuration (for LocalAgentProvider)
|
|
3343
|
+
* 从 ProductManager.waitConfiguration().scenes 获取本地配置的场景数据
|
|
3344
|
+
* @param locale - 可选,语言环境
|
|
3345
|
+
*/
|
|
3346
|
+
getProductScenes?(locale?: string): Promise<Array<{
|
|
3347
|
+
id: number;
|
|
3348
|
+
name: string;
|
|
3349
|
+
plugins: Array<{
|
|
3350
|
+
id: number;
|
|
3351
|
+
name: string;
|
|
3352
|
+
marketplaceName: string;
|
|
3353
|
+
}>;
|
|
3354
|
+
prompts: string[];
|
|
3355
|
+
mode?: 'coding' | 'working';
|
|
3356
|
+
target?: 'local' | 'cloud' | 'all';
|
|
3357
|
+
}>>;
|
|
3358
|
+
/**
|
|
3359
|
+
* Get available commands for a session
|
|
3360
|
+
* If session.availableCommands has cached values, return them
|
|
3361
|
+
* Otherwise, fetch from provider (for LocalAgentProvider)
|
|
3362
|
+
* @param params - Parameters for getting commands
|
|
3363
|
+
* @returns Promise<AvailableCommand[]> - Array of available commands
|
|
3364
|
+
*/
|
|
3365
|
+
getAvailableCommands(params?: GetAvailableCommandsParams): Promise<AvailableCommand[]>;
|
|
3366
|
+
/**
|
|
3367
|
+
* Get automation snapshot
|
|
3368
|
+
*/
|
|
3369
|
+
getAutomationSnapshot(): Promise<AutomationSnapshot>;
|
|
3370
|
+
/**
|
|
3371
|
+
* Create/update automation definition
|
|
3372
|
+
*/
|
|
3373
|
+
updateAutomation(payload: AutomationUpdatePayload): Promise<AutomationUpdateResult>;
|
|
3374
|
+
/**
|
|
3375
|
+
* Delete automation definition
|
|
3376
|
+
*/
|
|
3377
|
+
deleteAutomation(id: string): Promise<AutomationUpdateResult>;
|
|
3378
|
+
/**
|
|
3379
|
+
* Archive automation inbox item
|
|
3380
|
+
*/
|
|
3381
|
+
archiveAutomationInboxItem(itemId: string): Promise<AutomationUpdateResult>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Delete automation inbox item
|
|
3384
|
+
*/
|
|
3385
|
+
deleteAutomationInboxItem(itemId: string): Promise<AutomationUpdateResult>;
|
|
3386
|
+
/**
|
|
3387
|
+
* Trigger automation test run
|
|
3388
|
+
*/
|
|
3389
|
+
testAutomation(id: string): Promise<AutomationUpdateResult>;
|
|
3390
|
+
/**
|
|
3391
|
+
* Report telemetry event through the provider chain
|
|
3392
|
+
* Delegates to AgentProvider.reportTelemetry()
|
|
3393
|
+
*
|
|
3394
|
+
* @param eventName - Event name / code
|
|
3395
|
+
* @param payload - Event data
|
|
3396
|
+
*/
|
|
3397
|
+
reportTelemetry?(eventName: string, payload: Record<string, unknown>): Promise<void>;
|
|
3398
|
+
/**
|
|
3399
|
+
* Get product configuration subset
|
|
3400
|
+
* Returns deploymentType, creditPurchaseActions, links, productFeatures
|
|
3401
|
+
* Used by agent-ui for error banner credit purchase guidance
|
|
3402
|
+
*/
|
|
3403
|
+
getProductConfiguration?(): Promise<{
|
|
3404
|
+
deploymentType?: string;
|
|
3405
|
+
creditPurchaseActions?: Record<string, {
|
|
3406
|
+
labelZh: string;
|
|
3407
|
+
labelEn: string;
|
|
3408
|
+
url: string;
|
|
3409
|
+
showButton?: boolean;
|
|
3410
|
+
}>;
|
|
3411
|
+
links?: {
|
|
3412
|
+
craftFeedback?: string;
|
|
3413
|
+
mcpMarketUrl?: string;
|
|
3414
|
+
mcpDocumentUrl?: string;
|
|
3415
|
+
helpDocument?: string;
|
|
3416
|
+
};
|
|
3417
|
+
networkEnvironment?: string;
|
|
3418
|
+
productFeatures?: Record<string, boolean>;
|
|
3419
|
+
}>;
|
|
3420
|
+
/**
|
|
3421
|
+
* Get user info
|
|
3422
|
+
* Returns enterpriseId from authentication session
|
|
3423
|
+
* Used by agent-ui for determining personal/enterprise user
|
|
3424
|
+
*/
|
|
3425
|
+
getUserInfo?(): Promise<{
|
|
3426
|
+
enterpriseId?: string;
|
|
3427
|
+
}>;
|
|
3428
|
+
/**
|
|
3429
|
+
* Respond to MCP Sampling confirmation request
|
|
3430
|
+
* Called when user confirms/rejects a sampling request in MCP tool renderer
|
|
3431
|
+
*
|
|
3432
|
+
* @param sessionId - Session ID
|
|
3433
|
+
* @param response - Sampling confirmation response
|
|
3434
|
+
*/
|
|
3435
|
+
respondToSampling?(sessionId: string, response: McpSamplingConfirmResponse): Promise<void>;
|
|
3436
|
+
/**
|
|
3437
|
+
* Respond to MCP Roots confirmation request
|
|
3438
|
+
* Called when user confirms/rejects a roots request in MCP tool renderer
|
|
3439
|
+
*
|
|
3440
|
+
* @param sessionId - Session ID
|
|
3441
|
+
* @param response - Roots confirmation response
|
|
3442
|
+
*/
|
|
3443
|
+
respondToRoots?(sessionId: string, response: McpRootsConfirmResponse): Promise<void>;
|
|
3444
|
+
/**
|
|
3445
|
+
* Subscribe to MCP Sampling confirmation requests
|
|
3446
|
+
* Called when MCP server initiates a sampling request
|
|
3447
|
+
*
|
|
3448
|
+
* @param serverName - MCP server name
|
|
3449
|
+
* @param callback - Request callback
|
|
3450
|
+
* @returns Unsubscribe function
|
|
3451
|
+
*/
|
|
3452
|
+
subscribeSamplingRequests?(serverName: string, callback: (request: McpSamplingConfirmRequest) => void): () => void;
|
|
3453
|
+
/**
|
|
3454
|
+
* Subscribe to MCP Roots confirmation requests
|
|
3455
|
+
* Called when MCP server initiates a roots request
|
|
3456
|
+
*
|
|
3457
|
+
* @param serverName - MCP server name
|
|
3458
|
+
* @param callback - Request callback
|
|
3459
|
+
* @returns Unsubscribe function
|
|
3460
|
+
*/
|
|
3461
|
+
subscribeRootsRequests?(serverName: string, callback: (request: McpRootsConfirmRequest) => void): () => void;
|
|
3462
|
+
/**
|
|
3463
|
+
* Get MCP servers list
|
|
3464
|
+
* Returns the list of configured MCP servers with their status
|
|
3465
|
+
*
|
|
3466
|
+
* @returns Promise<McpServerInfo[]> - Array of MCP server info
|
|
3467
|
+
*/
|
|
3468
|
+
getMcpServers?(): Promise<McpServerInfo[]>;
|
|
3469
|
+
/**
|
|
3470
|
+
* Toggle MCP server enabled/disabled state
|
|
3471
|
+
*
|
|
3472
|
+
* @param serverName - Server name
|
|
3473
|
+
* @param enabled - Whether to enable the server
|
|
3474
|
+
*/
|
|
3475
|
+
toggleMcpServer?(serverName: string, enabled: boolean): Promise<void>;
|
|
3476
|
+
/**
|
|
3477
|
+
* Reconnect to an MCP server
|
|
3478
|
+
*
|
|
3479
|
+
* @param serverName - Server name
|
|
3480
|
+
* @param forceHttpCallback - Force using HTTP callback instead of URL scheme
|
|
3481
|
+
*/
|
|
3482
|
+
reconnectMcpServer?(serverName: string, forceHttpCallback?: boolean): Promise<void>;
|
|
3483
|
+
/**
|
|
3484
|
+
* Delete an MCP server configuration
|
|
3485
|
+
*
|
|
3486
|
+
* @param serverName - Server name
|
|
3487
|
+
*/
|
|
3488
|
+
deleteMcpServer?(serverName: string): Promise<void>;
|
|
3489
|
+
/**
|
|
3490
|
+
* Open MCP configuration file in editor
|
|
3491
|
+
*/
|
|
3492
|
+
openMcpConfig?(): Promise<void>;
|
|
3493
|
+
/**
|
|
3494
|
+
* Get MCP configuration file content
|
|
3495
|
+
* @returns File path and content
|
|
3496
|
+
*/
|
|
3497
|
+
getMcpConfigContent?(): Promise<{
|
|
3498
|
+
filePath: string;
|
|
3499
|
+
content: string;
|
|
3500
|
+
}>;
|
|
3501
|
+
/**
|
|
3502
|
+
* Save MCP configuration file content
|
|
3503
|
+
* @param content New configuration content
|
|
3504
|
+
*/
|
|
3505
|
+
saveMcpConfigContent?(content: string): Promise<void>;
|
|
3506
|
+
/**
|
|
3507
|
+
* Read text from clipboard (optional, used by LocalAgentProvider for webview clipboard access)
|
|
3508
|
+
* @returns Clipboard text content
|
|
3509
|
+
*/
|
|
3510
|
+
clipboardReadText?(): Promise<string>;
|
|
3511
|
+
}
|
|
3512
|
+
/**
|
|
3513
|
+
* MCP Sampling message role
|
|
3514
|
+
*/
|
|
3515
|
+
type McpSamplingRole = 'user' | 'assistant';
|
|
3516
|
+
/**
|
|
3517
|
+
* MCP Sampling message content - text
|
|
3518
|
+
*/
|
|
3519
|
+
interface McpSamplingTextContent {
|
|
3520
|
+
type: 'text';
|
|
3521
|
+
text: string;
|
|
3522
|
+
}
|
|
3523
|
+
/**
|
|
3524
|
+
* MCP Sampling message content - image
|
|
3525
|
+
*/
|
|
3526
|
+
interface McpSamplingImageContent {
|
|
3527
|
+
type: 'image';
|
|
3528
|
+
data: string;
|
|
3529
|
+
mimeType: string;
|
|
3530
|
+
}
|
|
3531
|
+
/**
|
|
3532
|
+
* MCP Sampling message content - audio
|
|
3533
|
+
*/
|
|
3534
|
+
interface McpSamplingAudioContent {
|
|
3535
|
+
type: 'audio';
|
|
3536
|
+
data: string;
|
|
3537
|
+
mimeType: string;
|
|
3538
|
+
}
|
|
3539
|
+
/**
|
|
3540
|
+
* MCP Sampling message content union type
|
|
3541
|
+
*/
|
|
3542
|
+
type McpSamplingContent = McpSamplingTextContent | McpSamplingImageContent | McpSamplingAudioContent;
|
|
3543
|
+
/**
|
|
3544
|
+
* MCP Sampling message
|
|
3545
|
+
*/
|
|
3546
|
+
interface McpSamplingMessage {
|
|
3547
|
+
role: McpSamplingRole;
|
|
3548
|
+
content: McpSamplingContent;
|
|
3549
|
+
}
|
|
3550
|
+
/**
|
|
3551
|
+
* MCP Sampling confirmation request
|
|
3552
|
+
* Sent from backend when MCP server requests sampling
|
|
3553
|
+
*/
|
|
3554
|
+
interface McpSamplingConfirmRequest {
|
|
3555
|
+
id: string;
|
|
3556
|
+
serverName: string;
|
|
3557
|
+
model?: string;
|
|
3558
|
+
messages: McpSamplingMessage[];
|
|
3559
|
+
systemPrompt?: string;
|
|
3560
|
+
maxTokens: number;
|
|
3561
|
+
timestamp: number;
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* MCP Sampling confirmation response
|
|
3565
|
+
* Sent from frontend when user confirms/rejects
|
|
3566
|
+
*/
|
|
3567
|
+
interface McpSamplingConfirmResponse {
|
|
3568
|
+
id: string;
|
|
3569
|
+
approved: boolean;
|
|
3570
|
+
rememberChoice?: boolean;
|
|
3571
|
+
}
|
|
3572
|
+
/**
|
|
3573
|
+
* MCP Root definition
|
|
3574
|
+
*/
|
|
3575
|
+
interface McpRoot {
|
|
3576
|
+
uri: string;
|
|
3577
|
+
name?: string;
|
|
3578
|
+
}
|
|
3579
|
+
/**
|
|
3580
|
+
* MCP Roots confirmation request
|
|
3581
|
+
* Sent from backend when MCP server requests roots access
|
|
3582
|
+
*/
|
|
3583
|
+
interface McpRootsConfirmRequest {
|
|
3584
|
+
id: string;
|
|
3585
|
+
serverName: string;
|
|
3586
|
+
roots: McpRoot[];
|
|
3587
|
+
timestamp: number;
|
|
3588
|
+
}
|
|
3589
|
+
/**
|
|
3590
|
+
* MCP Roots confirmation response
|
|
3591
|
+
* Sent from frontend when user confirms/rejects
|
|
3592
|
+
*/
|
|
3593
|
+
interface McpRootsConfirmResponse {
|
|
3594
|
+
id: string;
|
|
3595
|
+
approved: boolean;
|
|
3596
|
+
rememberChoice?: boolean;
|
|
2532
3597
|
}
|
|
2533
3598
|
/**
|
|
2534
3599
|
* Workspace information (aligned with FolderSelectResult)
|
|
@@ -2594,6 +3659,8 @@ interface PickFolderResponse {
|
|
|
2594
3659
|
interface UploadFileParams {
|
|
2595
3660
|
/** Files to upload - File objects in browser, absolute path strings in IDE */
|
|
2596
3661
|
readonly files: Array<File | string>;
|
|
3662
|
+
/** Optional AbortSignal to cancel the upload */
|
|
3663
|
+
readonly abortSignal?: AbortSignal;
|
|
2597
3664
|
}
|
|
2598
3665
|
/**
|
|
2599
3666
|
* Response from uploading files
|
|
@@ -2607,6 +3674,8 @@ interface UploadFileResponse {
|
|
|
2607
3674
|
readonly expireSeconds?: number;
|
|
2608
3675
|
/** Error message (if upload failed) */
|
|
2609
3676
|
readonly error?: string;
|
|
3677
|
+
/** Whether the upload was cancelled by user */
|
|
3678
|
+
readonly aborted?: boolean;
|
|
2610
3679
|
}
|
|
2611
3680
|
/**
|
|
2612
3681
|
* Mention type for file/folder
|
|
@@ -2703,6 +3772,227 @@ interface GetSubagentListResponse {
|
|
|
2703
3772
|
/** Error message (if failed) */
|
|
2704
3773
|
readonly error?: string;
|
|
2705
3774
|
}
|
|
3775
|
+
/**
|
|
3776
|
+
* Skill info returned from getSkillList
|
|
3777
|
+
*/
|
|
3778
|
+
interface SkillInfo {
|
|
3779
|
+
/** Skill name */
|
|
3780
|
+
name: string;
|
|
3781
|
+
/** File path of the skill */
|
|
3782
|
+
filePath: string;
|
|
3783
|
+
/** Description of the skill */
|
|
3784
|
+
description: string;
|
|
3785
|
+
/** When to use the skill */
|
|
3786
|
+
whenToUse?: string;
|
|
3787
|
+
/** Source of the skill */
|
|
3788
|
+
source: 'localSettings' | 'userSettings' | 'plugin' | 'builtin';
|
|
3789
|
+
/** Skill type */
|
|
3790
|
+
type: 'prompt';
|
|
3791
|
+
/** License information */
|
|
3792
|
+
license?: string;
|
|
3793
|
+
/** Allowed tools */
|
|
3794
|
+
allowedTools?: string[];
|
|
3795
|
+
/** Whether the skill is disabled */
|
|
3796
|
+
disable?: boolean;
|
|
3797
|
+
}
|
|
3798
|
+
/**
|
|
3799
|
+
* Parameters for getting skill list
|
|
3800
|
+
*/
|
|
3801
|
+
interface GetSkillListParams {
|
|
3802
|
+
/** Working directory (optional, for filtering project-level skills) */
|
|
3803
|
+
readonly cwd?: string;
|
|
3804
|
+
/** Whether to use global (backend) channel, defaults to true. When false, uses sendBroadcastRequest. */
|
|
3805
|
+
readonly global?: boolean;
|
|
3806
|
+
/** Whether to exclude plugin skills from the result, defaults to false. */
|
|
3807
|
+
readonly excludePluginSkills?: boolean;
|
|
3808
|
+
/**
|
|
3809
|
+
* 用户级 skill 扫描目录名称列表(相对于 home 目录),按优先级从高到低排列。
|
|
3810
|
+
* 同名 skill 以高优先级目录为准。
|
|
3811
|
+
* 未传入或为空时使用产品默认目录。
|
|
3812
|
+
*/
|
|
3813
|
+
readonly skillScanDirs?: string[];
|
|
3814
|
+
}
|
|
3815
|
+
/**
|
|
3816
|
+
* Response from getting skill list
|
|
3817
|
+
*/
|
|
3818
|
+
interface GetSkillListResponse {
|
|
3819
|
+
/** Skill list */
|
|
3820
|
+
readonly results: SkillInfo[];
|
|
3821
|
+
/** Error message (if failed) */
|
|
3822
|
+
readonly error?: string;
|
|
3823
|
+
}
|
|
3824
|
+
/**
|
|
3825
|
+
* Parameters for importing a skill folder
|
|
3826
|
+
*/
|
|
3827
|
+
interface ImportSkillParams {
|
|
3828
|
+
/** Source location: project-level or user-level */
|
|
3829
|
+
readonly source: 'localSettings' | 'userSettings';
|
|
3830
|
+
/** Working directory (required when source is localSettings). */
|
|
3831
|
+
readonly cwd?: string;
|
|
3832
|
+
}
|
|
3833
|
+
/**
|
|
3834
|
+
* Response from importing a skill folder
|
|
3835
|
+
*/
|
|
3836
|
+
interface ImportSkillResponse {
|
|
3837
|
+
/** Whether the import was successful */
|
|
3838
|
+
readonly success: boolean;
|
|
3839
|
+
/** Error message (if failed) */
|
|
3840
|
+
readonly error?: string;
|
|
3841
|
+
/** Imported skill name */
|
|
3842
|
+
readonly skillName?: string;
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Parameters for toggling skill enable/disable state
|
|
3846
|
+
*/
|
|
3847
|
+
interface ToggleSkillParams {
|
|
3848
|
+
/** File path of the skill to toggle */
|
|
3849
|
+
readonly filePath: string;
|
|
3850
|
+
/** Whether to disable the skill */
|
|
3851
|
+
readonly disable: boolean;
|
|
3852
|
+
}
|
|
3853
|
+
/**
|
|
3854
|
+
* Response from toggling skill state
|
|
3855
|
+
*/
|
|
3856
|
+
interface ToggleSkillResponse {
|
|
3857
|
+
/** Whether the toggle was successful */
|
|
3858
|
+
readonly success: boolean;
|
|
3859
|
+
/** Error message (if failed) */
|
|
3860
|
+
readonly error?: string;
|
|
3861
|
+
}
|
|
3862
|
+
/**
|
|
3863
|
+
* Parameters for deleting a skill
|
|
3864
|
+
*/
|
|
3865
|
+
interface DeleteSkillParams {
|
|
3866
|
+
/** File path of the skill to delete */
|
|
3867
|
+
readonly filePath: string;
|
|
3868
|
+
/** Name of the skill */
|
|
3869
|
+
readonly name: string;
|
|
3870
|
+
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Response from deleting a skill
|
|
3873
|
+
*/
|
|
3874
|
+
interface DeleteSkillResponse {
|
|
3875
|
+
/** Whether the deletion was successful */
|
|
3876
|
+
readonly success: boolean;
|
|
3877
|
+
/** Error message (if failed) */
|
|
3878
|
+
readonly error?: string;
|
|
3879
|
+
}
|
|
3880
|
+
/**
|
|
3881
|
+
* Parameters for getting skill content
|
|
3882
|
+
*/
|
|
3883
|
+
interface GetSkillContentParams {
|
|
3884
|
+
/** File path of the skill */
|
|
3885
|
+
readonly filePath: string;
|
|
3886
|
+
}
|
|
3887
|
+
/**
|
|
3888
|
+
* Response from getting skill content
|
|
3889
|
+
*/
|
|
3890
|
+
interface GetSkillContentResponse {
|
|
3891
|
+
/** Skill file content */
|
|
3892
|
+
readonly content: string;
|
|
3893
|
+
/** Error message (if failed) */
|
|
3894
|
+
readonly error?: string;
|
|
3895
|
+
}
|
|
3896
|
+
/**
|
|
3897
|
+
* Marketplace skill info (simplified structure for UI layer)
|
|
3898
|
+
*/
|
|
3899
|
+
interface MarketplaceSkillInfo {
|
|
3900
|
+
/** Skill name */
|
|
3901
|
+
name: string;
|
|
3902
|
+
/** Skill description */
|
|
3903
|
+
description: string;
|
|
3904
|
+
/** Skill description in Chinese */
|
|
3905
|
+
description_zh?: string;
|
|
3906
|
+
/** Skill description in English */
|
|
3907
|
+
description_en?: string;
|
|
3908
|
+
/** Skill version */
|
|
3909
|
+
version?: string;
|
|
3910
|
+
/** Skill author */
|
|
3911
|
+
author?: string;
|
|
3912
|
+
/** Skill icon URL */
|
|
3913
|
+
iconUrl?: string;
|
|
3914
|
+
/** Skill tags */
|
|
3915
|
+
tags?: string[];
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* Response from getting marketplace skills
|
|
3919
|
+
*/
|
|
3920
|
+
interface GetMarketplaceSkillsResponse {
|
|
3921
|
+
/** Marketplace skill list */
|
|
3922
|
+
readonly results: MarketplaceSkillInfo[];
|
|
3923
|
+
/** Error message (if failed) */
|
|
3924
|
+
readonly error?: string;
|
|
3925
|
+
}
|
|
3926
|
+
/**
|
|
3927
|
+
* Parameters for getting marketplace skill content
|
|
3928
|
+
*/
|
|
3929
|
+
interface GetMarketplaceSkillContentParams {
|
|
3930
|
+
/** Skill name */
|
|
3931
|
+
readonly skillName: string;
|
|
3932
|
+
}
|
|
3933
|
+
/**
|
|
3934
|
+
* Response from getting marketplace skill content
|
|
3935
|
+
*/
|
|
3936
|
+
interface GetMarketplaceSkillContentResponse {
|
|
3937
|
+
/** Skill file content */
|
|
3938
|
+
readonly content: string;
|
|
3939
|
+
/** Error message (if failed) */
|
|
3940
|
+
readonly error?: string;
|
|
3941
|
+
}
|
|
3942
|
+
/**
|
|
3943
|
+
* Parameters for installing marketplace skill
|
|
3944
|
+
*/
|
|
3945
|
+
interface InstallMarketplaceSkillParams {
|
|
3946
|
+
/** Skill name to install */
|
|
3947
|
+
readonly skillName: string;
|
|
3948
|
+
}
|
|
3949
|
+
/**
|
|
3950
|
+
* Response from installing marketplace skill
|
|
3951
|
+
*/
|
|
3952
|
+
interface InstallMarketplaceSkillResponse {
|
|
3953
|
+
/** Whether the install was successful */
|
|
3954
|
+
readonly success: boolean;
|
|
3955
|
+
/** Skill name */
|
|
3956
|
+
readonly skillName: string;
|
|
3957
|
+
/** Error message (if failed) */
|
|
3958
|
+
readonly errorMessage?: string;
|
|
3959
|
+
}
|
|
3960
|
+
/**
|
|
3961
|
+
* MCP Tool information
|
|
3962
|
+
*/
|
|
3963
|
+
interface McpToolInfo {
|
|
3964
|
+
/** Tool name */
|
|
3965
|
+
name: string;
|
|
3966
|
+
/** Tool description */
|
|
3967
|
+
description?: string;
|
|
3968
|
+
/** Whether the tool is enabled */
|
|
3969
|
+
enabled?: boolean;
|
|
3970
|
+
}
|
|
3971
|
+
/**
|
|
3972
|
+
* MCP Server information
|
|
3973
|
+
*/
|
|
3974
|
+
interface McpServerInfo {
|
|
3975
|
+
/** Server ID */
|
|
3976
|
+
id: string;
|
|
3977
|
+
/** Server name */
|
|
3978
|
+
name: string;
|
|
3979
|
+
/** Connection status */
|
|
3980
|
+
status: 'connecting' | 'connected' | 'disconnected' | 'disabled';
|
|
3981
|
+
/** Server description */
|
|
3982
|
+
description?: string;
|
|
3983
|
+
/** Available tools */
|
|
3984
|
+
tools?: McpToolInfo[];
|
|
3985
|
+
/** Whether the server is disabled */
|
|
3986
|
+
disabled?: boolean;
|
|
3987
|
+
/** Error message (if connection failed) */
|
|
3988
|
+
error?: string;
|
|
3989
|
+
/** Logo URL */
|
|
3990
|
+
logoUrl?: string;
|
|
3991
|
+
/** Official website URL */
|
|
3992
|
+
officialUrl?: string;
|
|
3993
|
+
/** Configuration source */
|
|
3994
|
+
configSource?: 'user' | 'project' | 'plugin';
|
|
3995
|
+
}
|
|
2706
3996
|
//#endregion
|
|
2707
3997
|
//#region ../agent-provider/lib/common/providers/cloud-agent-provider/cloud-connection.d.ts
|
|
2708
3998
|
/**
|
|
@@ -2734,6 +4024,17 @@ declare class CloudAgentConnection implements AgentConnection {
|
|
|
2734
4024
|
readonly transport: "cloud";
|
|
2735
4025
|
readonly cwd: string;
|
|
2736
4026
|
constructor(agentId: string, config: CloudConnectionConfig, cwd?: string);
|
|
4027
|
+
/**
|
|
4028
|
+
* Check whether a notification belongs to this connection's own session.
|
|
4029
|
+
*
|
|
4030
|
+
* CloudConnection.createSession() overrides sessionId to agentId, so the
|
|
4031
|
+
* rest of the client stack uses agentId as the canonical session
|
|
4032
|
+
* identifier. Notifications whose sessionId differs from agentId
|
|
4033
|
+
* originate from sub-agent sessions running inside the same sandbox and
|
|
4034
|
+
* should be silently ignored at this layer — the adapter layer handles
|
|
4035
|
+
* sub-agent messages independently via parentToolUseId in _meta.
|
|
4036
|
+
*/
|
|
4037
|
+
private isOwnSessionNotification;
|
|
2737
4038
|
private setupEventForwarding;
|
|
2738
4039
|
on<K extends keyof ConnectionEvents>(event: K, listener: ConnectionEventListener<ConnectionEvents[K]>): this;
|
|
2739
4040
|
off<K extends keyof ConnectionEvents>(event: K, listener: ConnectionEventListener<ConnectionEvents[K]>): this;
|
|
@@ -2767,7 +4068,7 @@ declare class CloudAgentConnection implements AgentConnection {
|
|
|
2767
4068
|
createdAt: number;
|
|
2768
4069
|
}>;
|
|
2769
4070
|
hasPendingQuestions(): boolean;
|
|
2770
|
-
toolCallback(sessionId: string, toolCallId: string, toolName: string, action: 'skip' | 'cancel'): Promise<{
|
|
4071
|
+
toolCallback(sessionId: string, toolCallId: string, toolName: string, action: 'approve' | 'skip' | 'cancel'): Promise<{
|
|
2771
4072
|
success: boolean;
|
|
2772
4073
|
error?: string;
|
|
2773
4074
|
}>;
|
|
@@ -2781,6 +4082,7 @@ declare class CloudAgentConnection implements AgentConnection {
|
|
|
2781
4082
|
* Contains sandboxId, link, token, etc.
|
|
2782
4083
|
*/
|
|
2783
4084
|
get sessionConnectionInfo(): SessionConnectionInfo | undefined;
|
|
4085
|
+
reportTelemetry(eventName: string, payload: Record<string, unknown>): Promise<void>;
|
|
2784
4086
|
extMethod(method: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
2785
4087
|
}
|
|
2786
4088
|
//#endregion
|
|
@@ -2808,6 +4110,13 @@ interface ArchiveConversationResponse {
|
|
|
2808
4110
|
/**
|
|
2809
4111
|
* Configuration for CloudAgentProvider
|
|
2810
4112
|
*/
|
|
4113
|
+
/**
|
|
4114
|
+
* Factory function to create a FilesResource from sandbox connection info.
|
|
4115
|
+
* Used to inject different filesystem implementations (e.g., MiniProgramE2BFilesystem for miniprogram).
|
|
4116
|
+
*/
|
|
4117
|
+
type FilesystemFactory = (info: E2BSandboxConnectionInfo) => Promise<FilesResource & {
|
|
4118
|
+
setReconnectFn?: (fn: () => Promise<E2BSandboxConnectionInfo>) => void;
|
|
4119
|
+
}>;
|
|
2811
4120
|
interface CloudAgentProviderOptions {
|
|
2812
4121
|
/** Base endpoint URL for agent management API (e.g., 'https://api.example.com') */
|
|
2813
4122
|
endpoint: string;
|
|
@@ -2819,6 +4128,12 @@ interface CloudAgentProviderOptions {
|
|
|
2819
4128
|
logger?: Logger;
|
|
2820
4129
|
/** Client capabilities (sent during agent initialization) */
|
|
2821
4130
|
clientCapabilities?: ClientCapabilities$1;
|
|
4131
|
+
/**
|
|
4132
|
+
* Optional filesystem factory for creating FilesResource instances.
|
|
4133
|
+
* If not provided, defaults to E2BFilesystem (requires e2b package).
|
|
4134
|
+
* Set this to MiniProgramE2BFilesystem.connect for miniprogram environments.
|
|
4135
|
+
*/
|
|
4136
|
+
filesystemFactory?: FilesystemFactory;
|
|
2822
4137
|
}
|
|
2823
4138
|
/**
|
|
2824
4139
|
* CloudAgentProvider - Manages cloud-hosted agents via REST API
|
|
@@ -2903,6 +4218,22 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
|
|
|
2903
4218
|
private cosUploadService;
|
|
2904
4219
|
/** Event listeners for provider-level events */
|
|
2905
4220
|
private eventListeners;
|
|
4221
|
+
/** 产品配置缓存(内存),用于存储 deploymentType 和 creditPurchaseActions */
|
|
4222
|
+
private productConfigCache;
|
|
4223
|
+
/**
|
|
4224
|
+
* Plugin marketplace cache (name/id -> marketplace info)
|
|
4225
|
+
* LRU 缓存,容量上限 200
|
|
4226
|
+
* Key: marketplace name 或 id
|
|
4227
|
+
* Value: marketplace 完整信息
|
|
4228
|
+
*/
|
|
4229
|
+
private marketplaceCache;
|
|
4230
|
+
/**
|
|
4231
|
+
* Installed plugin cache (plugin name -> plugin info with install_id)
|
|
4232
|
+
* LRU 缓存,容量上限 2000
|
|
4233
|
+
* Key: plugin name
|
|
4234
|
+
* Value: plugin 完整信息(包含 installId)
|
|
4235
|
+
*/
|
|
4236
|
+
private pluginCache;
|
|
2906
4237
|
constructor(options: CloudAgentProviderOptions);
|
|
2907
4238
|
/**
|
|
2908
4239
|
* Dispose the provider and clean up resources
|
|
@@ -2959,11 +4290,9 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
|
|
|
2959
4290
|
/**
|
|
2960
4291
|
* Create a new conversation
|
|
2961
4292
|
* POST {endpoint}/console/as/conversations
|
|
2962
|
-
* @param params -
|
|
4293
|
+
* @param params - Session params containing cwd and optional configuration
|
|
2963
4294
|
*/
|
|
2964
|
-
create(params
|
|
2965
|
-
_meta?: Record<string, unknown>;
|
|
2966
|
-
}): Promise<string>;
|
|
4295
|
+
create(params: CreateSessionParams$1): Promise<string>;
|
|
2967
4296
|
/**
|
|
2968
4297
|
* Connect to an agent and return the connection
|
|
2969
4298
|
*
|
|
@@ -3015,6 +4344,21 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
|
|
|
3015
4344
|
* ```
|
|
3016
4345
|
*/
|
|
3017
4346
|
rename(agentId: string, title: string): Promise<PatchConversationResponse>;
|
|
4347
|
+
/**
|
|
4348
|
+
* Update conversation status by ID
|
|
4349
|
+
* POST {endpoint}/console/as/conversations/{agentId}
|
|
4350
|
+
*
|
|
4351
|
+
* @param agentId - Conversation ID to update
|
|
4352
|
+
* @param status - New status for the conversation
|
|
4353
|
+
* @returns PatchConversationResponse containing the updated conversation ID
|
|
4354
|
+
*
|
|
4355
|
+
* @example
|
|
4356
|
+
* ```typescript
|
|
4357
|
+
* const result = await provider.updateStatus('agent-123', 'completed');
|
|
4358
|
+
* console.log('Updated conversation status:', result.id);
|
|
4359
|
+
* ```
|
|
4360
|
+
*/
|
|
4361
|
+
updateStatus(agentId: string, status: string): Promise<PatchConversationResponse>;
|
|
3018
4362
|
/**
|
|
3019
4363
|
* Get available models from product configuration
|
|
3020
4364
|
*
|
|
@@ -3027,6 +4371,25 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
|
|
|
3027
4371
|
* @returns Array of ModelInfo with full model details
|
|
3028
4372
|
*/
|
|
3029
4373
|
getModels(repo?: string): Promise<ModelInfo[]>;
|
|
4374
|
+
/**
|
|
4375
|
+
* 获取产品部署类型(从缓存)
|
|
4376
|
+
* 需要先调用 getModels() 初始化缓存
|
|
4377
|
+
*
|
|
4378
|
+
* @returns 部署类型:'SaaS' | 'Cloud-Hosted' | 'Self-Hosted',默认为 'SaaS'
|
|
4379
|
+
*/
|
|
4380
|
+
getDeploymentType(): string;
|
|
4381
|
+
/**
|
|
4382
|
+
* 获取 Credit 购买引导配置(从缓存)
|
|
4383
|
+
* 需要先调用 getModels() 初始化缓存
|
|
4384
|
+
*
|
|
4385
|
+
* @returns Credit 购买引导配置,key 为错误码。如果后端未返回,则使用默认配置
|
|
4386
|
+
*/
|
|
4387
|
+
getCreditPurchaseActions(): Record<string, {
|
|
4388
|
+
labelZh: string;
|
|
4389
|
+
labelEn: string;
|
|
4390
|
+
url: string;
|
|
4391
|
+
showButton?: boolean;
|
|
4392
|
+
}>;
|
|
3030
4393
|
/**
|
|
3031
4394
|
* Generate a unique request ID
|
|
3032
4395
|
*/
|
|
@@ -3049,7 +4412,7 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
|
|
|
3049
4412
|
/**
|
|
3050
4413
|
* Upload files to cloud storage via COS presigned URL
|
|
3051
4414
|
*
|
|
3052
|
-
* @param params - files array (File objects in browser)
|
|
4415
|
+
* @param params - files array (File objects in browser), optional abortSignal
|
|
3053
4416
|
* @returns Response with corresponding cloud URLs
|
|
3054
4417
|
*/
|
|
3055
4418
|
uploadFile(params: UploadFileParams): Promise<UploadFileResponse>;
|
|
@@ -3073,53 +4436,282 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
|
|
|
3073
4436
|
private emitEvent;
|
|
3074
4437
|
/**
|
|
3075
4438
|
* 获取支持的场景列表
|
|
3076
|
-
* API 端点: GET /
|
|
4439
|
+
* API 端点: GET /v2/as/support/scenes (不鉴权)
|
|
3077
4440
|
* 用于 Welcome 页面的 QuickActions 快捷操作
|
|
3078
4441
|
*
|
|
4442
|
+
* @param locale - 可选,语言环境(如 'zh-CN', 'en-US'),用于获取对应语言的场景数据
|
|
3079
4443
|
* @returns Promise<SupportScene[]> 支持的场景列表
|
|
3080
4444
|
*/
|
|
3081
|
-
getSupportScenes(): Promise<SupportScene[]>;
|
|
4445
|
+
getSupportScenes(locale?: string): Promise<SupportScene[]>;
|
|
3082
4446
|
private toAgentState;
|
|
3083
4447
|
/**
|
|
3084
4448
|
* Helper: 将 GET 请求的 body 转换为 URL 查询参数
|
|
3085
4449
|
*/
|
|
3086
4450
|
private buildGetUrl;
|
|
4451
|
+
/**
|
|
4452
|
+
* 获取已安装插件列表
|
|
4453
|
+
* GET /console/as/user/plugins/installed
|
|
4454
|
+
*/
|
|
4455
|
+
getInstalledPlugins(forceRefresh?: boolean): Promise<Array<{
|
|
4456
|
+
name: string;
|
|
4457
|
+
marketplaceName: string;
|
|
4458
|
+
status: string;
|
|
4459
|
+
description?: string;
|
|
4460
|
+
version?: string;
|
|
4461
|
+
installScope?: 'user' | 'project';
|
|
4462
|
+
installedScopes?: Array<'user' | 'project' | 'local' | 'project-local'>;
|
|
4463
|
+
installId?: string;
|
|
4464
|
+
}>>;
|
|
4465
|
+
/**
|
|
4466
|
+
* 安装插件
|
|
4467
|
+
* POST /console/as/user/plugins/install
|
|
4468
|
+
*
|
|
4469
|
+
* @param pluginNames - 插件名称数组
|
|
4470
|
+
* @param marketplaceNameOrId - 市场名称或 ID
|
|
4471
|
+
*/
|
|
4472
|
+
installPlugins(pluginNames: string[], marketplaceNameOrId: string, installScope?: 'user' | 'project' | 'project-local', marketplaceSource?: string, workspacePath?: string): Promise<{
|
|
4473
|
+
success: boolean;
|
|
4474
|
+
error?: string;
|
|
4475
|
+
}>;
|
|
4476
|
+
/**
|
|
4477
|
+
* 卸载插件
|
|
4478
|
+
* POST /console/as/user/plugins/installed/:id/uninstall
|
|
4479
|
+
*
|
|
4480
|
+
* 完整链路:
|
|
4481
|
+
* CloudAgentProvider.uninstallPlugin()
|
|
4482
|
+
* -> HTTP POST /console/as/user/plugins/installed/:id/uninstall
|
|
4483
|
+
* -> agentserver: PluginInstallService.Uninstall()
|
|
4484
|
+
* -> 软删除 DB + 异步同步到活跃沙箱
|
|
4485
|
+
*
|
|
4486
|
+
* @param pluginName - 插件名称
|
|
4487
|
+
* @param marketplaceName - 市场名称(用于标识唯一插件)
|
|
4488
|
+
* @param scope - 卸载范围 ('user' | 'project' | 'project-local')
|
|
4489
|
+
*/
|
|
4490
|
+
uninstallPlugin(pluginName: string, marketplaceName: string, scope: 'user' | 'project' | 'project-local'): Promise<{
|
|
4491
|
+
success: boolean;
|
|
4492
|
+
error?: string;
|
|
4493
|
+
}>;
|
|
4494
|
+
/**
|
|
4495
|
+
* 获取插件市场列表
|
|
4496
|
+
* GET /console/as/marketplace/sources
|
|
4497
|
+
*/
|
|
4498
|
+
getPluginMarketplaces(forceRefresh?: boolean): Promise<Array<{
|
|
4499
|
+
id: string;
|
|
4500
|
+
name: string;
|
|
4501
|
+
type: 'github' | 'local' | 'custom';
|
|
4502
|
+
source: {
|
|
4503
|
+
repo?: string;
|
|
4504
|
+
ref?: string;
|
|
4505
|
+
url?: string;
|
|
4506
|
+
};
|
|
4507
|
+
description?: string;
|
|
4508
|
+
isBuiltin?: boolean;
|
|
4509
|
+
}>>;
|
|
4510
|
+
/**
|
|
4511
|
+
* 获取市场下的插件列表
|
|
4512
|
+
* - 有 searchText: GET /console/as/marketplace/plugins/search (跨所有市场搜索)
|
|
4513
|
+
* - 无 searchText: GET /console/as/marketplace/plugins (指定市场)
|
|
4514
|
+
*
|
|
4515
|
+
* @param marketplaceNameOrId - 市场名称或 ID(优先使用 ID,如果是名称则从缓存查询 ID)
|
|
4516
|
+
* @param forceRefresh - 是否强制刷新
|
|
4517
|
+
* @param searchText - 搜索关键字(如果提供,则跨所有市场搜索)
|
|
4518
|
+
*/
|
|
4519
|
+
getMarketplacePlugins(marketplaceNameOrId: string, forceRefresh?: boolean, searchText?: string): Promise<Array<{
|
|
4520
|
+
name: string;
|
|
4521
|
+
marketplaceName: string;
|
|
4522
|
+
description?: string;
|
|
4523
|
+
version?: string;
|
|
4524
|
+
author?: string;
|
|
4525
|
+
homepage?: string;
|
|
4526
|
+
iconUrl?: string;
|
|
4527
|
+
tags?: string[];
|
|
4528
|
+
installed?: boolean;
|
|
4529
|
+
status?: 'enabled' | 'disabled' | 'not-installed';
|
|
4530
|
+
installedScopes?: Array<'user' | 'project'>;
|
|
4531
|
+
hasUpdate?: boolean;
|
|
4532
|
+
latestVersion?: string;
|
|
4533
|
+
agents?: any;
|
|
4534
|
+
commands?: any;
|
|
4535
|
+
skills?: any;
|
|
4536
|
+
mcpServers?: any;
|
|
4537
|
+
hooks?: any;
|
|
4538
|
+
rules?: any;
|
|
4539
|
+
}>>;
|
|
4540
|
+
/**
|
|
4541
|
+
* 获取插件详情
|
|
4542
|
+
* GET /console/as/marketplace/plugins/:name/detail
|
|
4543
|
+
*
|
|
4544
|
+
* @param pluginName - 插件名称
|
|
4545
|
+
* @param marketplaceNameOrId - 市场名称或 ID(优先使用 ID,如果是名称则从缓存查询 ID)
|
|
4546
|
+
*/
|
|
4547
|
+
getPluginDetail(pluginName: string, marketplaceNameOrId: string): Promise<{
|
|
4548
|
+
name: string;
|
|
4549
|
+
marketplaceName: string;
|
|
4550
|
+
description?: string;
|
|
4551
|
+
version?: string;
|
|
4552
|
+
author?: string;
|
|
4553
|
+
homepage?: string;
|
|
4554
|
+
iconUrl?: string;
|
|
4555
|
+
tags?: string[];
|
|
4556
|
+
installed?: boolean;
|
|
4557
|
+
status?: 'enabled' | 'disabled' | 'not-installed';
|
|
4558
|
+
installedScopes?: Array<'user' | 'project'>;
|
|
4559
|
+
readme?: string;
|
|
4560
|
+
configSchema?: Record<string, unknown>;
|
|
4561
|
+
tools?: Array<{
|
|
4562
|
+
name: string;
|
|
4563
|
+
description?: string;
|
|
4564
|
+
}>;
|
|
4565
|
+
resources?: Array<{
|
|
4566
|
+
name: string;
|
|
4567
|
+
description?: string;
|
|
4568
|
+
}>;
|
|
4569
|
+
prompts?: Array<{
|
|
4570
|
+
name: string;
|
|
4571
|
+
description?: string;
|
|
4572
|
+
}>;
|
|
4573
|
+
downloadCount?: number;
|
|
4574
|
+
lastUpdated?: string;
|
|
4575
|
+
license?: string;
|
|
4576
|
+
repositoryUrl?: string;
|
|
4577
|
+
} | null>;
|
|
4578
|
+
/**
|
|
4579
|
+
* 添加插件市场
|
|
4580
|
+
* POST /console/as/marketplace/sources
|
|
4581
|
+
*/
|
|
4582
|
+
addPluginMarketplace(sourceUrl: string, name?: string): Promise<{
|
|
4583
|
+
success: boolean;
|
|
4584
|
+
error?: string;
|
|
4585
|
+
marketplace?: {
|
|
4586
|
+
id: string;
|
|
4587
|
+
name: string;
|
|
4588
|
+
type: 'github' | 'local' | 'custom';
|
|
4589
|
+
source: {
|
|
4590
|
+
repo?: string;
|
|
4591
|
+
ref?: string;
|
|
4592
|
+
url?: string;
|
|
4593
|
+
};
|
|
4594
|
+
description?: string;
|
|
4595
|
+
isBuiltin?: boolean;
|
|
4596
|
+
};
|
|
4597
|
+
}>;
|
|
4598
|
+
/**
|
|
4599
|
+
* 删除插件市场
|
|
4600
|
+
* POST /console/as/marketplace/sources/:id/delete
|
|
4601
|
+
*/
|
|
4602
|
+
removePluginMarketplace(marketplaceNameOrId: string): Promise<{
|
|
4603
|
+
success: boolean;
|
|
4604
|
+
error?: string;
|
|
4605
|
+
}>;
|
|
4606
|
+
/**
|
|
4607
|
+
* 刷新插件市场
|
|
4608
|
+
* POST /console/as/marketplace/sources/:id/check-updates
|
|
4609
|
+
*/
|
|
4610
|
+
refreshPluginMarketplace(marketplaceNameOrId: string): Promise<{
|
|
4611
|
+
success: boolean;
|
|
4612
|
+
error?: string;
|
|
4613
|
+
plugins?: Array<any>;
|
|
4614
|
+
}>;
|
|
4615
|
+
/**
|
|
4616
|
+
* 批量切换插件启用/禁用状态
|
|
4617
|
+
* POST /console/as/user/plugins/installed/:id/toggle
|
|
4618
|
+
*/
|
|
4619
|
+
batchTogglePlugins(request: BatchPluginOperationRequest): Promise<BatchPluginOperationResult>;
|
|
4620
|
+
/**
|
|
4621
|
+
* 将后端插件数据映射为前端格式
|
|
4622
|
+
*/
|
|
4623
|
+
private mapPluginData;
|
|
4624
|
+
/**
|
|
4625
|
+
* 从缓存中查找插件的 install_id
|
|
4626
|
+
* 如果缓存未命中,则调用 API 获取并缓存
|
|
4627
|
+
*
|
|
4628
|
+
* @param pluginName - 插件名称
|
|
4629
|
+
* @returns install_id 或 null
|
|
4630
|
+
*/
|
|
4631
|
+
private findPluginInstallId;
|
|
4632
|
+
/**
|
|
4633
|
+
* 从缓存中查找 marketplace ID
|
|
4634
|
+
* 如果缓存未命中,则调用 API 获取并缓存
|
|
4635
|
+
*/
|
|
4636
|
+
private findMarketplaceId;
|
|
4637
|
+
/**
|
|
4638
|
+
* 提取 API 错误信息
|
|
4639
|
+
* 从 AxiosError 中提取详细的错误信息,包括 HTTP 状态码、错误码和错误消息
|
|
4640
|
+
*/
|
|
4641
|
+
private extractErrorMessage;
|
|
4642
|
+
/**
|
|
4643
|
+
* 映射后端 source_type 到前端类型
|
|
4644
|
+
*/
|
|
4645
|
+
private mapSourceType;
|
|
4646
|
+
/**
|
|
4647
|
+
* 解析 capabilities JSON 字符串
|
|
4648
|
+
*/
|
|
4649
|
+
private parseCapabilities;
|
|
4650
|
+
/**
|
|
4651
|
+
* 上报 telemetry 事件(Cloud 模式)
|
|
4652
|
+
* 通过 HTTP POST 发送到 /v2/report
|
|
4653
|
+
* 注入用户信息和浏览器环境等公共字段
|
|
4654
|
+
*/
|
|
4655
|
+
reportTelemetry(eventName: string, payload: Record<string, unknown>): Promise<void>;
|
|
3087
4656
|
}
|
|
3088
4657
|
//#endregion
|
|
3089
4658
|
//#region ../agent-provider/lib/common/providers/cloud-agent-provider/e2b-filesystem.d.ts
|
|
3090
4659
|
/**
|
|
3091
|
-
*
|
|
4660
|
+
* Callback to fetch fresh sandbox connection info from backend.
|
|
4661
|
+
* Called when an operation fails with 401/403.
|
|
4662
|
+
*/
|
|
4663
|
+
type ReconnectFn = () => Promise<E2BSandboxConnectionInfo>;
|
|
4664
|
+
/**
|
|
4665
|
+
* E2B Filesystem
|
|
3092
4666
|
*
|
|
3093
|
-
* Wraps E2B Sandbox SDK's filesystem operations to implement FilesResource
|
|
4667
|
+
* Wraps E2B Sandbox SDK's filesystem operations to implement FilesResource.
|
|
4668
|
+
* When `reconnectFn` is provided, automatically reconnects on auth errors.
|
|
3094
4669
|
*
|
|
3095
4670
|
* @example
|
|
3096
4671
|
* ```typescript
|
|
3097
|
-
*
|
|
3098
|
-
*
|
|
3099
|
-
* apiKey: 'e2b_xxx'
|
|
3100
|
-
* });
|
|
4672
|
+
* // Basic usage (no auto-reconnect)
|
|
4673
|
+
* const fs = await E2BFilesystem.connect({ sandboxId: '...' });
|
|
3101
4674
|
*
|
|
3102
|
-
* //
|
|
3103
|
-
* await
|
|
3104
|
-
*
|
|
3105
|
-
*
|
|
3106
|
-
* // Watch for changes
|
|
3107
|
-
* const handle = await fs.watchDir('/workspace', (event) => {
|
|
3108
|
-
* console.log('File changed:', event);
|
|
3109
|
-
* });
|
|
4675
|
+
* // With auto-reconnect on token expiry
|
|
4676
|
+
* const fs = await E2BFilesystem.connect({ sandboxId: '...' });
|
|
4677
|
+
* fs.setReconnectFn(async () => fetchFreshConnectionInfo());
|
|
3110
4678
|
* ```
|
|
3111
4679
|
*/
|
|
3112
4680
|
declare class E2BFilesystem implements FilesResource {
|
|
3113
4681
|
private sandbox;
|
|
4682
|
+
private reconnectFn?;
|
|
4683
|
+
/** Whether a reconnect is currently in-flight */
|
|
4684
|
+
private isReconnecting;
|
|
4685
|
+
/** Callers waiting for the in-flight reconnect to complete */
|
|
4686
|
+
private reconnectSubscribers;
|
|
4687
|
+
/** Timestamp of last reconnect attempt (anti-loop: min 10s between attempts) */
|
|
4688
|
+
private lastReconnectAt;
|
|
4689
|
+
private static readonly MIN_RECONNECT_INTERVAL_MS;
|
|
3114
4690
|
constructor(sandbox: Sandbox);
|
|
3115
4691
|
/**
|
|
3116
4692
|
* Connect to an E2B Sandbox and create filesystem instance
|
|
3117
4693
|
*/
|
|
3118
4694
|
static connect(info: E2BSandboxConnectionInfo): Promise<E2BFilesystem>;
|
|
4695
|
+
/**
|
|
4696
|
+
* Set reconnect callback. When set, auth errors trigger automatic reconnect + retry.
|
|
4697
|
+
*/
|
|
4698
|
+
setReconnectFn(fn: ReconnectFn): void;
|
|
3119
4699
|
/**
|
|
3120
4700
|
* Get the underlying E2B Sandbox instance
|
|
3121
4701
|
*/
|
|
3122
4702
|
getSandbox(): Sandbox;
|
|
4703
|
+
private isAuthError;
|
|
4704
|
+
private canAttemptReconnect;
|
|
4705
|
+
/**
|
|
4706
|
+
* Reconnect with fresh credentials.
|
|
4707
|
+
* Only one reconnect in-flight at a time; concurrent callers share the result.
|
|
4708
|
+
*/
|
|
4709
|
+
private reconnect;
|
|
4710
|
+
/**
|
|
4711
|
+
* Execute an operation. If reconnectFn is set and an auth error occurs,
|
|
4712
|
+
* reconnect and retry once.
|
|
4713
|
+
*/
|
|
4714
|
+
private exec;
|
|
3123
4715
|
read(path: string, opts?: FilesystemRequestOpts & {
|
|
3124
4716
|
format?: 'text';
|
|
3125
4717
|
}): Promise<string>;
|
|
@@ -3134,13 +4726,13 @@ declare class E2BFilesystem implements FilesResource {
|
|
|
3134
4726
|
}): Promise<ReadableStream<Uint8Array>>;
|
|
3135
4727
|
write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: FilesystemRequestOpts): Promise<WriteInfo>;
|
|
3136
4728
|
write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<WriteInfo[]>;
|
|
3137
|
-
list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo
|
|
4729
|
+
list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo[]>;
|
|
3138
4730
|
exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
|
|
3139
4731
|
makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
|
|
3140
4732
|
remove(path: string, opts?: FilesystemRequestOpts): Promise<void>;
|
|
3141
|
-
rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo
|
|
3142
|
-
getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo
|
|
3143
|
-
watchDir(path: string, onEvent: (event: FilesystemEvent
|
|
4733
|
+
rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo>;
|
|
4734
|
+
getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo>;
|
|
4735
|
+
watchDir(path: string, onEvent: (event: FilesystemEvent) => void | Promise<void>, opts?: WatchOpts & {
|
|
3144
4736
|
onExit?: (err?: Error) => void | Promise<void>;
|
|
3145
4737
|
}): Promise<WatchHandle>;
|
|
3146
4738
|
}
|
|
@@ -3262,6 +4854,7 @@ interface ActiveSessionImplOptions {
|
|
|
3262
4854
|
declare class ActiveSessionImpl implements ActiveSession {
|
|
3263
4855
|
private _id;
|
|
3264
4856
|
private _agentId;
|
|
4857
|
+
private _cwd?;
|
|
3265
4858
|
private _availableModes?;
|
|
3266
4859
|
private _currentMode?;
|
|
3267
4860
|
private _availableModels?;
|
|
@@ -3273,6 +4866,7 @@ declare class ActiveSessionImpl implements ActiveSession {
|
|
|
3273
4866
|
private _connectionInfo?;
|
|
3274
4867
|
private listeners;
|
|
3275
4868
|
private onceListeners;
|
|
4869
|
+
private connectionListeners;
|
|
3276
4870
|
/**
|
|
3277
4871
|
* Agent operations namespace
|
|
3278
4872
|
*/
|
|
@@ -3306,6 +4900,14 @@ declare class ActiveSessionImpl implements ActiveSession {
|
|
|
3306
4900
|
* Agent ID
|
|
3307
4901
|
*/
|
|
3308
4902
|
get agentId(): string;
|
|
4903
|
+
/**
|
|
4904
|
+
* Actual workspace path (set from newSession response _meta)
|
|
4905
|
+
*/
|
|
4906
|
+
get cwd(): string | undefined;
|
|
4907
|
+
/**
|
|
4908
|
+
* Set actual workspace path (called by SessionManager after createSession)
|
|
4909
|
+
*/
|
|
4910
|
+
setCwd(cwd: string): void;
|
|
3309
4911
|
/**
|
|
3310
4912
|
* Agent state (live connection state)
|
|
3311
4913
|
* Returns LocalAgentState or CloudAgentState based on transport type
|
|
@@ -3387,12 +4989,12 @@ declare class ActiveSessionImpl implements ActiveSession {
|
|
|
3387
4989
|
*/
|
|
3388
4990
|
cancelQuestion(toolCallId: string, reason?: string): boolean;
|
|
3389
4991
|
/**
|
|
3390
|
-
* Callback for tool operations (skip
|
|
4992
|
+
* Callback for tool operations (approve / skip / cancel)
|
|
3391
4993
|
* @param toolCallId Tool call ID
|
|
3392
4994
|
* @param toolName Tool name
|
|
3393
|
-
* @param action Action to perform ('skip'
|
|
4995
|
+
* @param action Action to perform ('approve' / 'skip' / 'cancel')
|
|
3394
4996
|
*/
|
|
3395
|
-
toolCallback(toolCallId: string, toolName: string, action: 'skip' | 'cancel'): Promise<{
|
|
4997
|
+
toolCallback(toolCallId: string, toolName: string, action: 'approve' | 'skip' | 'cancel'): Promise<{
|
|
3396
4998
|
success: boolean;
|
|
3397
4999
|
error?: string;
|
|
3398
5000
|
}>;
|
|
@@ -3450,6 +5052,12 @@ declare class ActiveSessionImpl implements ActiveSession {
|
|
|
3450
5052
|
* Disconnect from the session/agent
|
|
3451
5053
|
*/
|
|
3452
5054
|
disconnect(): void;
|
|
5055
|
+
/**
|
|
5056
|
+
* Detach the session from connection events without disconnecting the connection.
|
|
5057
|
+
* This should be called when the session is being replaced but the connection is shared.
|
|
5058
|
+
* Unlike disconnect(), this only removes event listeners without closing the connection.
|
|
5059
|
+
*/
|
|
5060
|
+
detach(): void;
|
|
3453
5061
|
/**
|
|
3454
5062
|
* Symbol.dispose for 'using' keyword support
|
|
3455
5063
|
* Automatically disconnects and cleans up when session goes out of scope
|
|
@@ -3464,8 +5072,21 @@ declare class ActiveSessionImpl implements ActiveSession {
|
|
|
3464
5072
|
*/
|
|
3465
5073
|
[Symbol.dispose](): void;
|
|
3466
5074
|
private getConnectionOrThrow;
|
|
5075
|
+
/**
|
|
5076
|
+
* 在 connection 上注册 listener 并保存引用,便于 disconnect 时移除
|
|
5077
|
+
*/
|
|
5078
|
+
private addConnectionListener;
|
|
5079
|
+
/**
|
|
5080
|
+
* 从 connection 上移除所有本 session 注册的 listener
|
|
5081
|
+
*/
|
|
5082
|
+
private removeConnectionListeners;
|
|
3467
5083
|
private setupConnectionEvents;
|
|
3468
5084
|
private mapPromptResponse;
|
|
5085
|
+
/**
|
|
5086
|
+
* 判断 artifact 是否应该转发给当前 session
|
|
5087
|
+
* 所有类型的 artifact 都按 __sessionId 严格隔离
|
|
5088
|
+
*/
|
|
5089
|
+
private shouldForwardArtifact;
|
|
3469
5090
|
}
|
|
3470
5091
|
//#endregion
|
|
3471
5092
|
//#region ../agent-provider/lib/common/client/session-manager.d.ts
|
|
@@ -3570,6 +5191,13 @@ declare class SessionManager {
|
|
|
3570
5191
|
*/
|
|
3571
5192
|
declare class BackendProvider implements IBackendProvider {
|
|
3572
5193
|
constructor(config: BackendProviderConfig);
|
|
5194
|
+
/**
|
|
5195
|
+
* 处理 401 未授权错误
|
|
5196
|
+
* 先尝试刷新 token,失败后再执行登出流程
|
|
5197
|
+
*
|
|
5198
|
+
* @throws 如果 token 刷新失败,抛出错误通知 HttpService 不要重试
|
|
5199
|
+
*/
|
|
5200
|
+
protected handleUnauthorized(): Promise<void>;
|
|
3573
5201
|
/**
|
|
3574
5202
|
* 获取当前账号信息
|
|
3575
5203
|
* API 端点: GET /console/accounts (返回账号列表)
|
|
@@ -3680,9 +5308,21 @@ declare class BackendProvider implements IBackendProvider {
|
|
|
3680
5308
|
login(): Promise<void>;
|
|
3681
5309
|
/**
|
|
3682
5310
|
* 登出账号
|
|
3683
|
-
*
|
|
5311
|
+
*
|
|
5312
|
+
* 策略:
|
|
5313
|
+
* - IOA 企业:用 iframe 走 SSO/SAML SLO 登出链路(涉及跨域重定向),通过轮询 iframe URL 变化检测完成
|
|
5314
|
+
* - 非 IOA 企业:直接用 httpService 请求 /console/logout,速度快
|
|
3684
5315
|
*/
|
|
3685
5316
|
logout(): Promise<void>;
|
|
5317
|
+
/**
|
|
5318
|
+
* IOA 企业登出:通过 iframe 走 SSO/SAML SLO 登出链路
|
|
5319
|
+
* 轮询 iframe URL 变化检测完成,兜底超时 5 秒
|
|
5320
|
+
*/
|
|
5321
|
+
private logoutViaIframe;
|
|
5322
|
+
/**
|
|
5323
|
+
* 非 IOA 企业登出:直接 HTTP 请求 /console/logout
|
|
5324
|
+
*/
|
|
5325
|
+
private logoutViaHttp;
|
|
3686
5326
|
/**
|
|
3687
5327
|
* 批量切换插件状态
|
|
3688
5328
|
* Web 环境不支持此功能
|
|
@@ -3725,6 +5365,41 @@ declare class BackendProvider implements IBackendProvider {
|
|
|
3725
5365
|
* @returns Promise<ListReposResponse> 仓库列表响应
|
|
3726
5366
|
*/
|
|
3727
5367
|
getRepositories(connector: OauthConnectorName, page?: number, perPage?: number): Promise<ListReposResponse>;
|
|
5368
|
+
/**
|
|
5369
|
+
* 保存待发送的输入内容到后端
|
|
5370
|
+
* API 端点: POST /api/v1/code-id
|
|
5371
|
+
*/
|
|
5372
|
+
savePendingInput(code: string): Promise<string | null>;
|
|
5373
|
+
/**
|
|
5374
|
+
* 从后端加载待发送的输入内容
|
|
5375
|
+
* API 端点: GET /api/v1/code?id=xxx
|
|
5376
|
+
*/
|
|
5377
|
+
loadPendingInput(codeId: string): Promise<string | null>;
|
|
5378
|
+
/**
|
|
5379
|
+
* 获取每日签到状态
|
|
5380
|
+
* API 端点: POST /billing/meter/checkin-status
|
|
5381
|
+
*/
|
|
5382
|
+
getCheckinStatus(): Promise<CheckinStatusResponse | null>;
|
|
5383
|
+
/**
|
|
5384
|
+
* 执行每日签到
|
|
5385
|
+
* API 端点: POST /billing/meter/daily-checkin
|
|
5386
|
+
*/
|
|
5387
|
+
claimDailyCheckin(): Promise<CheckinResultResponse>;
|
|
5388
|
+
private static readonly SKILLHUB_BASE_URL;
|
|
5389
|
+
private static readonly SKILLHUB_FETCH_TIMEOUT;
|
|
5390
|
+
private skillHubFetch;
|
|
5391
|
+
getSkillHubList(params?: SkillHubListParams): Promise<SkillHubListResponse>;
|
|
5392
|
+
getSkillHubCategories(): Promise<SkillHubCategoriesResponse>;
|
|
5393
|
+
getSkillHubSearch(q: string, limit?: number): Promise<SkillHubSearchResponse>;
|
|
5394
|
+
getSkillHubDetail(slug: string): Promise<SkillHubDetailResponse>;
|
|
5395
|
+
getSkillHubExists(slugs: string[]): Promise<SkillHubExistsResponse>;
|
|
5396
|
+
reportSkillHubStats(slug: string, inc: {
|
|
5397
|
+
downloads?: number;
|
|
5398
|
+
installs?: number;
|
|
5399
|
+
stars?: number;
|
|
5400
|
+
}): Promise<void>;
|
|
5401
|
+
installSkillHubSkill(_slug: string, _version?: string, _name?: string): Promise<SkillHubInstallResponse>;
|
|
5402
|
+
getSkillHubInstalledMetas(): Promise<SkillHubInstalledMeta[]>;
|
|
3728
5403
|
}
|
|
3729
5404
|
/**
|
|
3730
5405
|
* 创建 BackendProvider 实例
|
|
@@ -3853,6 +5528,14 @@ declare class IPCBackendProvider implements IBackendProvider {
|
|
|
3853
5528
|
reloadWindow(params?: {
|
|
3854
5529
|
locale?: string;
|
|
3855
5530
|
}): Promise<void>;
|
|
5531
|
+
/**
|
|
5532
|
+
* Save locale to argv.json without restarting the app.
|
|
5533
|
+
* The change takes effect on next manual restart.
|
|
5534
|
+
* @param params locale to save
|
|
5535
|
+
*/
|
|
5536
|
+
saveLocale(params: {
|
|
5537
|
+
locale: string;
|
|
5538
|
+
}): Promise<void>;
|
|
3856
5539
|
/**
|
|
3857
5540
|
* 关闭 Agent Manager 面板
|
|
3858
5541
|
* IDE 环境: 通过 IPC 通知 IDE 关闭 Agent Manager(用于返回 IDE)
|
|
@@ -3881,6 +5564,71 @@ declare class IPCBackendProvider implements IBackendProvider {
|
|
|
3881
5564
|
* 4. 返回 SupportScene[] 数据给 agent-ui
|
|
3882
5565
|
*/
|
|
3883
5566
|
getSupportScenes(): Promise<SupportScene[]>;
|
|
5567
|
+
/**
|
|
5568
|
+
* 获取账号用量信息(积分/Credits)
|
|
5569
|
+
* IDE 环境: 通过 IPC 实时获取用量信息,每次打开菜单时调用
|
|
5570
|
+
*
|
|
5571
|
+
* 调用链:
|
|
5572
|
+
* 1. agent-ui: IPCBackendProvider.getAccountUsage()
|
|
5573
|
+
* 2. Agent Manager renderer: BackendService.getAccountUsage()
|
|
5574
|
+
* 3. Main Process: codebuddy:getAccountUsage IPC handler
|
|
5575
|
+
* 4. 返回 { usageLeft, usageTotal, editionType, refreshAt } 等字段
|
|
5576
|
+
*/
|
|
5577
|
+
getAccountUsage(): Promise<Partial<Account> | null>;
|
|
5578
|
+
/**
|
|
5579
|
+
* 获取每日签到状态
|
|
5580
|
+
* IDE 环境: 通过 IPC 获取签到状态
|
|
5581
|
+
*/
|
|
5582
|
+
getCheckinStatus(): Promise<CheckinStatusResponse | null>;
|
|
5583
|
+
/**
|
|
5584
|
+
* 执行每日签到
|
|
5585
|
+
* IDE 环境: 通过 IPC 执行签到
|
|
5586
|
+
*/
|
|
5587
|
+
claimDailyCheckin(): Promise<CheckinResultResponse>;
|
|
5588
|
+
/**
|
|
5589
|
+
* 获取 SkillHub 技能列表
|
|
5590
|
+
* IDE 环境: 通过 IPC 获取技能列表
|
|
5591
|
+
*/
|
|
5592
|
+
getSkillHubList(params?: SkillHubListParams): Promise<SkillHubListResponse>;
|
|
5593
|
+
/**
|
|
5594
|
+
* 获取 SkillHub 分类列表
|
|
5595
|
+
* IDE 环境: 通过 IPC 获取分类列表
|
|
5596
|
+
*/
|
|
5597
|
+
getSkillHubCategories(): Promise<SkillHubCategoriesResponse>;
|
|
5598
|
+
/**
|
|
5599
|
+
* 搜索 SkillHub 技能
|
|
5600
|
+
* IDE 环境: 通过 IPC 搜索技能
|
|
5601
|
+
*/
|
|
5602
|
+
getSkillHubSearch(q: string, limit?: number): Promise<SkillHubSearchResponse>;
|
|
5603
|
+
/**
|
|
5604
|
+
* 获取 SkillHub 技能详情
|
|
5605
|
+
* IDE 环境: 通过 IPC 获取技能详情
|
|
5606
|
+
*/
|
|
5607
|
+
getSkillHubDetail(slug: string): Promise<SkillHubDetailResponse>;
|
|
5608
|
+
/**
|
|
5609
|
+
* 批量检查 SkillHub 技能是否存在
|
|
5610
|
+
* IDE 环境: 通过 IPC 检查技能是否存在
|
|
5611
|
+
*/
|
|
5612
|
+
getSkillHubExists(slugs: string[]): Promise<SkillHubExistsResponse>;
|
|
5613
|
+
/**
|
|
5614
|
+
* 上报 SkillHub 技能统计
|
|
5615
|
+
* IDE 环境: 通过 IPC 上报统计
|
|
5616
|
+
*/
|
|
5617
|
+
reportSkillHubStats(slug: string, inc: {
|
|
5618
|
+
downloads?: number;
|
|
5619
|
+
installs?: number;
|
|
5620
|
+
stars?: number;
|
|
5621
|
+
}): Promise<void>;
|
|
5622
|
+
/**
|
|
5623
|
+
* 安装 SkillHub 技能
|
|
5624
|
+
* IDE 环境: 通过 IPC 安装技能(下载 zip → 解压到本地)
|
|
5625
|
+
*/
|
|
5626
|
+
installSkillHubSkill(slug: string, version?: string, name?: string): Promise<SkillHubInstallResponse>;
|
|
5627
|
+
/**
|
|
5628
|
+
* 获取本地已安装的 SkillHub 技能元信息
|
|
5629
|
+
* IDE 环境: 通过 IPC 获取元信息
|
|
5630
|
+
*/
|
|
5631
|
+
getSkillHubInstalledMetas(): Promise<SkillHubInstalledMeta[]>;
|
|
3884
5632
|
/**
|
|
3885
5633
|
* 调试日志
|
|
3886
5634
|
*/
|
|
@@ -3918,7 +5666,7 @@ type RequestErrorInterceptor = (error: any) => any;
|
|
|
3918
5666
|
/**
|
|
3919
5667
|
* 响应拦截器函数
|
|
3920
5668
|
*/
|
|
3921
|
-
type ResponseInterceptor = (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>;
|
|
5669
|
+
type ResponseInterceptor = (response: AxiosResponse$1) => AxiosResponse$1 | Promise<AxiosResponse$1>;
|
|
3922
5670
|
/**
|
|
3923
5671
|
* 响应错误拦截器函数
|
|
3924
5672
|
*/
|
|
@@ -3935,7 +5683,7 @@ type UnauthorizedCallback = () => void;
|
|
|
3935
5683
|
* 特性:
|
|
3936
5684
|
* - 单例模式,全局唯一实例,延迟初始化(首次使用时自动创建)
|
|
3937
5685
|
* - 支持拦截器注册(其他模块可注入 header)
|
|
3938
|
-
* - 统一 401
|
|
5686
|
+
* - 统一 401 处理(支持自动刷新 token 并重试)
|
|
3939
5687
|
* - 自动携带凭证(withCredentials)
|
|
3940
5688
|
* - 类型安全
|
|
3941
5689
|
*
|
|
@@ -3971,6 +5719,10 @@ declare class HttpService {
|
|
|
3971
5719
|
private axiosInstance;
|
|
3972
5720
|
private unauthorizedCallbacks;
|
|
3973
5721
|
private config;
|
|
5722
|
+
/** 是否正在刷新 token */
|
|
5723
|
+
private isRefreshing;
|
|
5724
|
+
/** 等待 token 刷新完成的请求队列 */
|
|
5725
|
+
private refreshSubscribers;
|
|
3974
5726
|
/**
|
|
3975
5727
|
* 私有构造函数(单例模式)
|
|
3976
5728
|
*/
|
|
@@ -3988,9 +5740,17 @@ declare class HttpService {
|
|
|
3988
5740
|
*/
|
|
3989
5741
|
private registerDefaultRequestInterceptor;
|
|
3990
5742
|
/**
|
|
3991
|
-
* 注册默认响应拦截器(处理 401
|
|
5743
|
+
* 注册默认响应拦截器(处理 401,支持自动重试)
|
|
3992
5744
|
*/
|
|
3993
5745
|
private registerDefaultResponseInterceptor;
|
|
5746
|
+
/**
|
|
5747
|
+
* token 刷新成功,通知所有等待的请求
|
|
5748
|
+
*/
|
|
5749
|
+
private onRefreshSuccess;
|
|
5750
|
+
/**
|
|
5751
|
+
* token 刷新失败,通知所有等待的请求
|
|
5752
|
+
*/
|
|
5753
|
+
private onRefreshFailure;
|
|
3994
5754
|
/**
|
|
3995
5755
|
* 注册请求拦截器
|
|
3996
5756
|
* @param onFulfilled 请求成功拦截器
|
|
@@ -4056,7 +5816,9 @@ declare class HttpService {
|
|
|
4056
5816
|
*/
|
|
4057
5817
|
offUnauthorized(callback: UnauthorizedCallback): void;
|
|
4058
5818
|
/**
|
|
4059
|
-
* 触发所有 401
|
|
5819
|
+
* 触发所有 401 回调并等待完成
|
|
5820
|
+
* @returns Promise,等待所有回调完成
|
|
5821
|
+
* @throws 如果任何回调失败,则抛出错误
|
|
4060
5822
|
*/
|
|
4061
5823
|
private triggerUnauthorizedCallbacks;
|
|
4062
5824
|
/**
|
|
@@ -4107,6 +5869,12 @@ declare class HttpService {
|
|
|
4107
5869
|
* @returns 响应数据
|
|
4108
5870
|
*/
|
|
4109
5871
|
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
5872
|
+
/**
|
|
5873
|
+
* 通用请求方法
|
|
5874
|
+
* @param config axios 请求配置
|
|
5875
|
+
* @returns 原始 AxiosResponse
|
|
5876
|
+
*/
|
|
5877
|
+
request<T = any>(config: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
4110
5878
|
/**
|
|
4111
5879
|
* 获取原始 axios 实例(用于高级场景)
|
|
4112
5880
|
*/
|