@tencent-ai/cloud-agent-sdk 0.2.6 → 0.2.7-next.8d34e3c.20260128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -72,7 +72,7 @@ interface TasksArtifact extends BaseArtifact<'tasks'> {
72
72
  /**
73
73
  * Media content type (auxiliary classification)
74
74
  */
75
- type MediaContentType = 'image' | 'video' | 'document' | 'spreadsheet';
75
+ type MediaContentType = 'image' | 'video' | 'audio' | 'document' | 'spreadsheet' | 'presentation' | 'diagram' | 'code';
76
76
  /**
77
77
  * Media Artifact - Media files
78
78
  * Supports images, videos, documents and other browser-renderable files
@@ -142,8 +142,14 @@ interface QuestionRequest {
142
142
  sessionId: string;
143
143
  /** Associated tool call ID (links extMethod to tool_call for UI) */
144
144
  toolCallId: string;
145
- /** Questions to ask (1-4) */
146
- questions: UserQuestion[];
145
+ /** Input type */
146
+ inputType?: string;
147
+ /** Schema containing questions */
148
+ schema?: {
149
+ /** Questions to ask (1-4) */questions: UserQuestion[];
150
+ };
151
+ /** Questions to ask (1-4) - legacy format */
152
+ questions?: UserQuestion[];
147
153
  /** Request timeout in ms */
148
154
  timeout?: number;
149
155
  }
@@ -552,6 +558,7 @@ interface Session {
552
558
  interface CreateSessionParams {
553
559
  cwd: string;
554
560
  mcpServers?: McpServerConfig[];
561
+ _meta?: Record<string, unknown>;
555
562
  }
556
563
  /**
557
564
  * Parameters for loading an existing session
@@ -627,6 +634,10 @@ interface ConnectionEvents extends ClientEvents {
627
634
  questionTimeout: {
628
635
  toolCallId: string;
629
636
  };
637
+ command: {
638
+ action: string;
639
+ params?: Record<string, unknown>;
640
+ };
630
641
  }
631
642
  /**
632
643
  * Event listener type
@@ -1054,6 +1065,7 @@ interface CreateSessionParams$1 {
1054
1065
  cwd: string;
1055
1066
  /** MCP server configurations */
1056
1067
  mcpServers?: McpServerConfig[];
1068
+ _meta?: Record<string, unknown>;
1057
1069
  }
1058
1070
  /**
1059
1071
  * Parameters for loading an existing session
@@ -1174,6 +1186,11 @@ interface SessionEvents {
1174
1186
  checkpointCreated: CheckpointInfo;
1175
1187
  /** Emitted when a checkpoint is updated */
1176
1188
  checkpointUpdated: CheckpointInfo;
1189
+ /** Emitted when a command is received */
1190
+ command: {
1191
+ action: string;
1192
+ params?: Record<string, unknown>;
1193
+ };
1177
1194
  /** Emitted when connected to agent */
1178
1195
  connected: void;
1179
1196
  /** Emitted when disconnected from agent */
@@ -1326,6 +1343,16 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
1326
1343
  rename?(agentId: string, title: string): Promise<{
1327
1344
  id: string;
1328
1345
  }>;
1346
+ /**
1347
+ * Move an agent by ID (optional)
1348
+ * Used by LocalAgentProvider for moving Playground sessions to Workspace
1349
+ *
1350
+ * @param agentId - Agent ID to move
1351
+ * @returns Object containing the moved agent ID
1352
+ */
1353
+ move?(agentId: string): Promise<{
1354
+ id: string;
1355
+ }>;
1329
1356
  /** Filesystem provider (optional - some providers may not support filesystem operations) */
1330
1357
  readonly filesystem?: FilesystemProvider;
1331
1358
  /**
@@ -1450,6 +1477,14 @@ interface ClientSessionsResource {
1450
1477
  rename(sessionId: string, title: string): Promise<{
1451
1478
  id: string;
1452
1479
  }>;
1480
+ /**
1481
+ * Move a session (Playground → Workspace)
1482
+ * @param sessionId - Session ID to move
1483
+ * @returns Object containing the moved session ID
1484
+ */
1485
+ move(sessionId: string): Promise<{
1486
+ id: string;
1487
+ }>;
1453
1488
  /** Initialize a workspace for future sessions */
1454
1489
  initializeWorkspace(params: InitializeWorkspaceParams): Promise<InitializeWorkspaceResponse>;
1455
1490
  /** Models resource for getting available models */
@@ -2405,127 +2440,12 @@ declare class SessionManager {
2405
2440
  loadSession(params: LoadSessionParams$1): Promise<ActiveSession>;
2406
2441
  }
2407
2442
  //#endregion
2408
- //#region ../agent-provider/lib/backend/agent-api.d.ts
2443
+ //#region ../agent-provider/lib/backend/types.d.ts
2409
2444
  /**
2410
- * Cloud Agent API 类型定义
2445
+ * Backend Provider 类型定义
2411
2446
  *
2412
- * 定义与 /v2/cloudagent/agentmgmt/agents API 相关的数据结构
2447
+ * 定义 IBackendProvider 接口和配置
2413
2448
  */
2414
- /**
2415
- * 过滤条件
2416
- */
2417
- interface AgentFilter {
2418
- /** 过滤字段 */
2419
- field: string;
2420
- /** 过滤值 */
2421
- value: string;
2422
- }
2423
- /**
2424
- * 排序条件
2425
- */
2426
- interface SortCondition {
2427
- /** 排序方向: asc | desc */
2428
- order: 'asc' | 'desc';
2429
- /** 排序字段 */
2430
- orderBy: string;
2431
- }
2432
- /**
2433
- * 获取 Agent 列表请求参数
2434
- */
2435
- interface GetAgentsRequest {
2436
- /** 时间范围(天) */
2437
- dayRange?: number;
2438
- /** 过滤条件列表 */
2439
- filters?: AgentFilter[];
2440
- /** 页码 */
2441
- page?: number;
2442
- /** 每页大小 */
2443
- size?: number;
2444
- /** 排序条件 */
2445
- sort?: SortCondition;
2446
- }
2447
- /**
2448
- * Agent 来源信息
2449
- */
2450
- interface CloudAgentSource {
2451
- /** 提供商: github, gitlab 等 */
2452
- provider: string;
2453
- /** 分支/引用 */
2454
- ref: string;
2455
- /** 仓库路径 */
2456
- repository: string;
2457
- }
2458
- /**
2459
- * Agent 目标信息
2460
- */
2461
- interface CloudAgentTarget$1 {
2462
- /** 是否自动创建 PR */
2463
- autoCreatePr: boolean;
2464
- /** 分支名称 */
2465
- branchName?: string;
2466
- /** PR URL */
2467
- prUrl?: string;
2468
- /** Agent URL */
2469
- url?: string;
2470
- }
2471
- /**
2472
- * Agent 状态
2473
- */
2474
- type CloudAgentStatus = 'CREATING' | 'RUNNING' | 'STOPPED' | 'FAILED' | 'DELETING';
2475
- /**
2476
- * Agent 可见性
2477
- */
2478
- type CloudAgentVisibility$1 = 'PRIVATE' | 'PUBLIC' | 'TEAM';
2479
- /**
2480
- * Cloud Agent 信息
2481
- * 重命名为 CloudAgent 以避免与 ACP SDK 的 Agent 类型冲突
2482
- */
2483
- interface CloudAgent {
2484
- /** 创建时间 (ISO 8601) */
2485
- createdAt: string;
2486
- /** Agent ID */
2487
- id: string;
2488
- /** Agent 名称 */
2489
- name: string;
2490
- /** 来源信息 */
2491
- source: CloudAgentSource;
2492
- /** 状态 */
2493
- status: CloudAgentStatus;
2494
- /** 摘要 */
2495
- summary?: string;
2496
- /** 目标信息 */
2497
- target: CloudAgentTarget$1;
2498
- /** 可见性 */
2499
- visibility: CloudAgentVisibility$1;
2500
- }
2501
- /**
2502
- * 分页信息
2503
- */
2504
- interface Pagination {
2505
- /** 是否有下一页 */
2506
- hasNext: boolean;
2507
- /** 是否有上一页 */
2508
- hasPrev: boolean;
2509
- /** 当前页码 */
2510
- page: number;
2511
- /** 每页大小 */
2512
- size: number;
2513
- /** 总数 */
2514
- total: number;
2515
- /** 总页数 */
2516
- totalPages: number;
2517
- }
2518
- /**
2519
- * 获取 Agent 列表响应
2520
- */
2521
- interface GetAgentsResponse {
2522
- /** Agent 列表 */
2523
- agents: CloudAgent[];
2524
- /** 分页信息 */
2525
- pagination: Pagination;
2526
- }
2527
- //#endregion
2528
- //#region ../agent-provider/lib/backend/types.d.ts
2529
2449
  /**
2530
2450
  * 账号版本类型
2531
2451
  */
@@ -2569,6 +2489,29 @@ declare enum CommodityCode {
2569
2489
  // free
2570
2490
  extra = "TCACA_code_009_0XmEQc2xOf"
2571
2491
  }
2492
+ /**
2493
+ * 套餐资源项(用于展示列表)
2494
+ */
2495
+ interface PlanResource {
2496
+ /** 资源 ID */
2497
+ id: string;
2498
+ /** 套餐名称(i18n key) */
2499
+ name: string;
2500
+ /** 套餐代码 */
2501
+ packageCode: CommodityCode;
2502
+ /** 是否是每日刷新的套餐 */
2503
+ isDaily: boolean;
2504
+ /** 总量 */
2505
+ total: number;
2506
+ /** 已用 */
2507
+ used: number;
2508
+ /** 剩余 */
2509
+ left: number;
2510
+ /** 到期时间戳 */
2511
+ expireAt?: number;
2512
+ /** 刷新时间戳 */
2513
+ refreshAt?: number;
2514
+ }
2572
2515
  /**
2573
2516
  * 账号套餐信息
2574
2517
  */
@@ -2588,6 +2531,8 @@ interface AccountPlan {
2588
2531
  usageTotal?: string;
2589
2532
  usageUsed?: string;
2590
2533
  usageLeft?: string;
2534
+ /** 所有套餐资源列表 */
2535
+ resources?: PlanResource[];
2591
2536
  }
2592
2537
  /**
2593
2538
  * 账号信息
@@ -2619,6 +2564,8 @@ interface Account {
2619
2564
  isPro?: boolean;
2620
2565
  /** 到期时间戳 */
2621
2566
  expireAt?: string | number;
2567
+ /** 刷新时间(年套餐下、本周期结束日期) */
2568
+ refreshAt?: number;
2622
2569
  /** 自动续费标志 0-关闭 1-开启 */
2623
2570
  renewFlag?: 0 | 1;
2624
2571
  /** 套餐代码 */
@@ -2626,6 +2573,14 @@ interface Account {
2626
2573
  /** 套餐名称 */
2627
2574
  name?: string;
2628
2575
  email?: string;
2576
+ /** 套餐总用量 */
2577
+ usageTotal?: string;
2578
+ /** 套餐已用量 */
2579
+ usageUsed?: string;
2580
+ /** 套餐剩余用量 */
2581
+ usageLeft?: string;
2582
+ /** 所有套餐资源列表(个人用户) */
2583
+ resources?: PlanResource[];
2629
2584
  }
2630
2585
  /**
2631
2586
  * 推理配置
@@ -2672,18 +2627,295 @@ interface ModelInfo {
2672
2627
  descriptionZh: string;
2673
2628
  }
2674
2629
  /**
2675
- * GetModels 请求参数
2630
+ * 用户连接器信息
2631
+ */
2632
+ interface UserConnector {
2633
+ /** 用户ID */
2634
+ user_id: string;
2635
+ /** 连接器名称 */
2636
+ name: 'github' | 'gongfeng';
2637
+ displayName: string;
2638
+ /** 连接时间 */
2639
+ connect_at: string;
2640
+ /** 连接状态,0未连接,1已连接 */
2641
+ connectStatus: 0 | 1;
2642
+ /** 勾选仓库列表,逗号分隔 */
2643
+ repos: string;
2644
+ /** 激活状态,0未激活,1已激活 */
2645
+ activeStatus: 0 | 1;
2646
+ /** 提示词 */
2647
+ prompt: string;
2648
+ /** 跳转URL */
2649
+ url: string;
2650
+ /** 描述 */
2651
+ description: string;
2652
+ /** OAuth Client ID */
2653
+ oauthClientId: string;
2654
+ /** OAuth 重定向 URL */
2655
+ oauthRedirectUrl: string;
2656
+ }
2657
+ /**
2658
+ * 获取用户连接器列表响应
2676
2659
  */
2677
- interface GetModelsRequest {
2678
- /** 仓库路径 */
2679
- repository: string;
2660
+ interface ListUserConnectorResponse {
2661
+ /** 连接器列表 */
2662
+ connectors: UserConnector[];
2663
+ }
2664
+ /**
2665
+ * 修改用户连接器连接状态请求
2666
+ */
2667
+ interface ModifyUserConnectorConnectStatusRequest {
2668
+ /** 连接器名称 */
2669
+ name: 'github' | 'gongfeng';
2670
+ /** 连接状态,0未连接,1已连接 */
2671
+ connectStatus: 0 | 1;
2672
+ /** 激活状态,0未激活,1已激活 */
2673
+ activeStatus?: 0 | 1;
2674
+ /** 勾选仓库列表 */
2675
+ repos?: string[];
2676
+ }
2677
+ /**
2678
+ * 修改用户连接器仓库请求
2679
+ */
2680
+ interface ModifyUserConnectorRepoRequest {
2681
+ /** 连接器名称 */
2682
+ name: 'github' | 'gongfeng';
2683
+ /** 仓库列表 */
2684
+ repo?: string[];
2685
+ }
2686
+ /**
2687
+ * 修改用户连接器激活状态请求
2688
+ */
2689
+ interface ModifyUserConnectorActiveStatusRequest {
2690
+ /** 连接器名称 */
2691
+ name: 'github' | 'gongfeng';
2692
+ /** 激活状态,0未激活,1已激活 */
2693
+ activeStatus: 0 | 1;
2694
+ }
2695
+ /**
2696
+ * 任务连接器信息
2697
+ */
2698
+ interface TaskConnector {
2699
+ /** 用户ID */
2700
+ user_id: string;
2701
+ /** 任务ID */
2702
+ task_id: string;
2703
+ /** 连接器名称(唯一标识,如github/gongfeng/figma/cnb) */
2704
+ name: string;
2705
+ displayName: string;
2706
+ /** 勾选仓库列表,逗号分隔 */
2707
+ repos: string;
2708
+ /** 激活状态:0未激活 / 1已激活 */
2709
+ activeStatus: 0 | 1;
2710
+ /** 创建时间 */
2711
+ created_at: string;
2712
+ /** 更新时间 */
2713
+ updated_at: string;
2714
+ /** 提示词 */
2715
+ prompt: string;
2716
+ /** 跳转URL */
2717
+ url: string;
2718
+ /** 描述 */
2719
+ description: string;
2720
+ /** OAuth Client ID */
2721
+ oauthClientId?: string;
2722
+ /** OAuth 重定向 URL */
2723
+ oauthRedirectUrl?: string;
2724
+ /** 连接时间 */
2725
+ connect_at: string;
2726
+ /** 连接状态,0未连接,1已连接 */
2727
+ connectStatus: 0 | 1;
2728
+ }
2729
+ /**
2730
+ * 添加任务请求
2731
+ */
2732
+ interface AddTaskRequest {
2733
+ /** 任务ID */
2734
+ taskId: string;
2735
+ /** 连接器列表 */
2736
+ connectors?: Array<{
2737
+ name: string;
2738
+ repos: string;
2739
+ activeStatus?: 0 | 1;
2740
+ }>;
2741
+ }
2742
+ /**
2743
+ * 添加任务响应
2744
+ */
2745
+ interface AddTaskResponse {
2746
+ /** 任务ID */
2747
+ taskId: string;
2748
+ }
2749
+ /**
2750
+ * 获取任务连接器列表响应
2751
+ */
2752
+ interface ListTaskConnectorResponse {
2753
+ /** 连接器列表 */
2754
+ connectors: TaskConnector[];
2755
+ }
2756
+ /**
2757
+ * 修改任务连接器激活状态请求
2758
+ */
2759
+ interface ModifyTaskConnectorActiveStatusRequest {
2760
+ /** 任务ID */
2761
+ taskId: string;
2762
+ /** 连接器名称 */
2763
+ name: string;
2764
+ /** 激活状态,0未激活,1已激活 */
2765
+ activeStatus: 0 | 1;
2766
+ }
2767
+ /**
2768
+ * 修改任务连接器激活状态响应
2769
+ */
2770
+ interface ModifyTaskConnectorActiveStatusResponse {
2771
+ /** 任务ID */
2772
+ taskId: string;
2773
+ }
2774
+ /**
2775
+ * 修改任务连接器仓库请求
2776
+ */
2777
+ interface ModifyTaskConnectorRepoRequest {
2778
+ /** 任务ID */
2779
+ taskId: string;
2780
+ /** 连接器名称 */
2781
+ name: string;
2782
+ /** 仓库列表 */
2783
+ repo: string[];
2784
+ }
2785
+ /**
2786
+ * 修改任务连接器仓库响应
2787
+ */
2788
+ interface ModifyTaskConnectorRepoResponse {
2789
+ /** 任务ID */
2790
+ taskId: string;
2791
+ }
2792
+ /**
2793
+ * oauth回调请求参数
2794
+ */
2795
+ interface SaveOauthTokenRequest {
2796
+ /** 连接器名称 */
2797
+ name: 'github' | 'gongfeng';
2798
+ /** 第三方回调code */
2799
+ authorizationCode: string;
2800
+ }
2801
+ /**
2802
+ * 获取仓库列表请求参数
2803
+ */
2804
+ interface GetRepoListRequest {
2805
+ /** 连接器名称 */
2806
+ name: 'github' | 'gongfeng';
2807
+ }
2808
+ /**
2809
+ * 撤销所有OAuth连接请求参数
2810
+ */
2811
+ interface RevokeAllRequest {
2812
+ /** 连接器名称 */
2813
+ name: 'github' | 'gongfeng';
2814
+ /** 安装ID列表(可选,如果不传则撤销所有) */
2815
+ installationIds?: string[];
2816
+ }
2817
+ /**
2818
+ * GitHub 仓库所有者信息
2819
+ */
2820
+ interface OauthGitHubRepoOwner {
2821
+ login: string;
2822
+ avatar_url: string;
2823
+ url: string;
2824
+ html_url: string;
2825
+ followers_url: string;
2826
+ starred_url: string;
2827
+ repos_url: string;
2828
+ events_url: string;
2829
+ }
2830
+ /**
2831
+ * GitHub 仓库信息
2832
+ */
2833
+ interface OauthGitHubRepo {
2834
+ name: string;
2835
+ full_name: string;
2836
+ private: boolean;
2837
+ html_url: string;
2838
+ url: string;
2839
+ teams_url: string;
2840
+ hooks_url: string;
2841
+ events_url: string;
2842
+ branches_url: string;
2843
+ git_commits_url: string;
2844
+ merges_url: string;
2845
+ pulls_url: string;
2846
+ git_url: string;
2847
+ clone_url: string;
2848
+ svn_url: string;
2849
+ downloads_url: string;
2850
+ description: string;
2851
+ owner: OauthGitHubRepoOwner;
2852
+ forks_count: number;
2853
+ }
2854
+ /**
2855
+ * 工蜂仓库信息
2856
+ */
2857
+ interface OauthGongfengRepo {
2858
+ id: number;
2859
+ description: string;
2860
+ public: boolean;
2861
+ archived: boolean;
2862
+ visibility_level: number;
2863
+ public_visibility: number;
2864
+ namespace: {
2865
+ name: string;
2866
+ description: string;
2867
+ path: string;
2868
+ };
2869
+ owner: {
2870
+ username: string;
2871
+ web_url: string;
2872
+ name: string;
2873
+ state: string;
2874
+ avatar_url: string;
2875
+ };
2876
+ name: string;
2877
+ name_with_namespace: string;
2878
+ path: string;
2879
+ path_with_namespace: string;
2880
+ type: string;
2881
+ default_branch: string;
2882
+ ssh_url_to_repo: string;
2883
+ http_url_to_repo: string;
2884
+ https_url_to_repo: string;
2885
+ web_url: string;
2886
+ avatar_url: string;
2680
2887
  }
2681
2888
  /**
2682
- * GetModels 响应
2889
+ * 获取仓库列表响应
2683
2890
  */
2684
- interface GetModelsResponse {
2685
- /** 模型列表 */
2686
- models: ModelInfo[];
2891
+ interface GetRepoListResponse {
2892
+ github_repos?: {
2893
+ [key: string | number]: OauthGitHubRepo[];
2894
+ };
2895
+ gongfeng_repos?: OauthGongfengRepo[];
2896
+ }
2897
+ /**
2898
+ * OAuth 用户信息
2899
+ */
2900
+ interface OauthUserInfo {
2901
+ /** 头像 URL */
2902
+ avatarUrl: string;
2903
+ /** 用户名 */
2904
+ name: string;
2905
+ }
2906
+ /**
2907
+ * 获取 OAuth 用户信息请求参数
2908
+ */
2909
+ interface GetOauthUserRequest {
2910
+ /** 连接器名称 */
2911
+ name: 'github' | 'gongfeng';
2912
+ }
2913
+ /**
2914
+ * 获取 OAuth 用户信息响应
2915
+ */
2916
+ interface GetOauthUserResponse {
2917
+ /** 用户信息 */
2918
+ user: OauthUserInfo;
2687
2919
  }
2688
2920
  /**
2689
2921
  * Backend Provider 配置选项
@@ -2694,29 +2926,110 @@ interface BackendProviderConfig {
2694
2926
  /** 认证 Token */
2695
2927
  authToken?: string;
2696
2928
  }
2929
+ /**
2930
+ * 企业用户用量信息
2931
+ */
2932
+ interface EnterpriseUsage {
2933
+ /** 已使用 credit */
2934
+ credit: number;
2935
+ /** 周期开始时间 */
2936
+ cycleStartTime: string;
2937
+ /** 周期结束时间 */
2938
+ cycleEndTime: string;
2939
+ /** 周期重置时间 */
2940
+ cycleResetTime: string;
2941
+ /** 限额数量 */
2942
+ limitNum: number;
2943
+ }
2697
2944
  /**
2698
2945
  * IBackendProvider 接口
2699
2946
  *
2700
2947
  * 定义与后端 API 交互的抽象接口
2948
+ *
2949
+ * 注意:getAgents 和 getModels 方法已废弃并移除,
2950
+ * 请使用 IAgentAdapter 中的对应方法
2701
2951
  */
2702
2952
  interface IBackendProvider {
2703
2953
  /**
2704
- * 获取 Agent 列表
2954
+ * 获取当前账号信息
2955
+ * @returns Promise<Account | null> 账号信息,未登录时返回 null
2956
+ */
2957
+ getAccount(): Promise<Account | null>;
2958
+ /**
2959
+ * 获取用户连接器列表
2960
+ * @returns Promise<ListUserConnectorResponse | null> 用户连接器列表,失败时返回 null
2961
+ */
2962
+ getUserConnector(): Promise<ListUserConnectorResponse>;
2963
+ /**
2964
+ * 修改用户连接器连接状态
2705
2965
  * @param request 请求参数
2706
- * @returns Promise<GetAgentsResponse> Agent 列表响应
2966
+ * @returns Promise<void>
2707
2967
  */
2708
- getAgents(request: GetAgentsRequest): Promise<GetAgentsResponse>;
2968
+ modifyUserConnectorConnectStatus(request: ModifyUserConnectorConnectStatusRequest): Promise<void>;
2709
2969
  /**
2710
- * 获取可用模型列表
2711
- * @param request 请求参数(包含仓库路径)
2712
- * @returns Promise<GetModelsResponse> 模型列表响应
2970
+ * 修改用户连接器仓库
2971
+ * @param request 请求参数
2972
+ * @returns Promise<void>
2713
2973
  */
2714
- getModels(request: GetModelsRequest): Promise<GetModelsResponse>;
2974
+ modifyUserConnectorRepo(request: ModifyUserConnectorRepoRequest): Promise<void>;
2715
2975
  /**
2716
- * 获取当前账号信息
2717
- * @returns Promise<Account | null> 账号信息,未登录时返回 null
2976
+ * 修改用户连接器激活状态
2977
+ * @param request 请求参数
2978
+ * @returns Promise<void>
2718
2979
  */
2719
- getAccount(): Promise<Account | null>;
2980
+ modifyUserConnectorActiveStatus(request: ModifyUserConnectorActiveStatusRequest): Promise<void>;
2981
+ /**
2982
+ * 删除用户连接器
2983
+ * @param name 连接器名称
2984
+ * @returns Promise<void>
2985
+ */
2986
+ deleteUserConnector(name: 'github' | 'gongfeng'): Promise<void>;
2987
+ /**
2988
+ * 添加任务
2989
+ * @param request 请求参数
2990
+ * @returns Promise<AddTaskResponse>
2991
+ */
2992
+ addConnectorTask(request: AddTaskRequest): Promise<AddTaskResponse>;
2993
+ /**
2994
+ * 获取任务连接器列表
2995
+ * @param taskId 任务ID
2996
+ * @returns Promise<ListTaskConnectorResponse>
2997
+ */
2998
+ getTaskConnector(taskId: string): Promise<ListTaskConnectorResponse>;
2999
+ /**
3000
+ * 修改任务连接器激活状态
3001
+ * @param request 请求参数
3002
+ * @returns Promise<ModifyTaskConnectorActiveStatusResponse>
3003
+ */
3004
+ modifyTaskConnectorActiveStatus(request: ModifyTaskConnectorActiveStatusRequest): Promise<ModifyTaskConnectorActiveStatusResponse>;
3005
+ /**
3006
+ * 修改任务连接器仓库
3007
+ * @param request 请求参数
3008
+ * @returns Promise<ModifyTaskConnectorRepoResponse>
3009
+ */
3010
+ modifyTaskConnectorRepo(request: ModifyTaskConnectorRepoRequest): Promise<ModifyTaskConnectorRepoResponse>;
3011
+ /**
3012
+ * oauth回调,后端用第三方的code换token的
3013
+ */
3014
+ saveOauthToken(request: SaveOauthTokenRequest): Promise<void>;
3015
+ /**
3016
+ * 获取OAuth连接器的仓库列表
3017
+ * @param request 请求参数
3018
+ * @returns Promise<GetRepoListResponse> 仓库列表响应
3019
+ */
3020
+ getRepoList(request: GetRepoListRequest): Promise<GetRepoListResponse>;
3021
+ /**
3022
+ * 撤销OAuth连接器的所有连接
3023
+ * @param request 请求参数
3024
+ * @returns Promise<void>
3025
+ */
3026
+ revokeAll(request: RevokeAllRequest): Promise<void>;
3027
+ /**
3028
+ * 获取 OAuth 用户信息
3029
+ * @param request 请求参数
3030
+ * @returns Promise<GetOauthUserResponse> 用户信息响应
3031
+ */
3032
+ getOauthUser(request: GetOauthUserRequest): Promise<GetOauthUserResponse>;
2720
3033
  /**
2721
3034
  * 触发登录流程
2722
3035
  * - Web 环境: 跳转到登录页面
@@ -2727,6 +3040,25 @@ interface IBackendProvider {
2727
3040
  * 登出账号
2728
3041
  */
2729
3042
  logout(): Promise<void>;
3043
+ /**
3044
+ * 重新加载窗口(可选,仅 IPC 环境支持)
3045
+ * @param params 可选参数,如 locale
3046
+ */
3047
+ reloadWindow?(params?: {
3048
+ locale?: string;
3049
+ }): Promise<void>;
3050
+ /**
3051
+ * 监听事件(可选,用于 IPC 环境)
3052
+ * @param event 事件名称
3053
+ * @param callback 回调函数
3054
+ * @returns 取消订阅函数
3055
+ */
3056
+ on?(event: string, callback: (data?: unknown) => void): () => void;
3057
+ /** 获取企业用户用量信息
3058
+ * @param enterpriseId 企业 ID
3059
+ * @returns Promise<EnterpriseUsage | null> 企业用户用量信息
3060
+ */
3061
+ getEnterpriseUsage?(enterpriseId: string): Promise<EnterpriseUsage | null>;
2730
3062
  }
2731
3063
  //#endregion
2732
3064
  //#region ../agent-provider/lib/backend/backend-provider.d.ts
@@ -2734,26 +3066,16 @@ interface IBackendProvider {
2734
3066
  * Backend Provider 实现类
2735
3067
  *
2736
3068
  * 职责:
2737
- * - 与后端 API 通信(getAgents, getModels, getAccount 等)
2738
3069
  * - 触发登录/登出流程
2739
3070
  * - 获取 account 后自动同步到 accountService
3071
+ *
3072
+ * 注意:getAgents 和 getModels 方法已废弃并移除,
3073
+ * 请使用 IAgentAdapter 中的对应方法
2740
3074
  */
2741
3075
  declare class BackendProvider implements IBackendProvider {
2742
3076
  private readonly baseUrl;
2743
3077
  private readonly authToken?;
2744
3078
  constructor(config: BackendProviderConfig);
2745
- /**
2746
- * 获取 Agent 列表
2747
- * API 端点: GET /v2/cloudagent/agentmgmt/agents
2748
- */
2749
- getAgents(request?: GetAgentsRequest): Promise<GetAgentsResponse>;
2750
- /**
2751
- * 获取可用模型列表
2752
- * API 端点: GET /v2/cloudagent/models (假设)
2753
- *
2754
- * 当前实现: 返回 Mock 数据
2755
- */
2756
- getModels(request: GetModelsRequest): Promise<GetModelsResponse>;
2757
3079
  /**
2758
3080
  * 获取当前账号信息
2759
3081
  * API 端点: GET /console/accounts (返回账号列表)
@@ -2768,12 +3090,82 @@ declare class BackendProvider implements IBackendProvider {
2768
3090
  * 5. 同步到 accountService
2769
3091
  */
2770
3092
  getAccount(): Promise<Account | null>;
3093
+ /**
3094
+ * 获取用户连接器列表
3095
+ * API 端点: GET /console/as/connector/user/
3096
+ */
3097
+ getUserConnector(): Promise<ListUserConnectorResponse>;
3098
+ /**
3099
+ * 修改用户连接器连接状态
3100
+ * API 端点: PATCH /console/as/connector/user/:name/connect_status
3101
+ */
3102
+ modifyUserConnectorConnectStatus(request: ModifyUserConnectorConnectStatusRequest): Promise<void>;
3103
+ /**
3104
+ * 修改用户连接器仓库
3105
+ * API 端点: PATCH /console/as/connector/user/:name/repo/
3106
+ */
3107
+ modifyUserConnectorRepo(request: ModifyUserConnectorRepoRequest): Promise<void>;
3108
+ /**
3109
+ * 修改用户连接器激活状态
3110
+ * API 端点: PATCH /console/as/connector/user/:name/active_status
3111
+ */
3112
+ modifyUserConnectorActiveStatus(request: ModifyUserConnectorActiveStatusRequest): Promise<void>;
3113
+ /**
3114
+ * 删除用户连接器
3115
+ * API 端点: DELETE /console/as/connector/user/:name/
3116
+ */
3117
+ deleteUserConnector(name: 'github' | 'gongfeng'): Promise<void>;
3118
+ /**
3119
+ * 添加任务
3120
+ * API 端点: POST /console/as/connector/task/
3121
+ */
3122
+ addConnectorTask(request: AddTaskRequest): Promise<AddTaskResponse>;
3123
+ /**
3124
+ * 获取任务连接器列表
3125
+ * API 端点: GET /console/as/connector/task/:taskid
3126
+ */
3127
+ getTaskConnector(taskId: string): Promise<ListTaskConnectorResponse>;
3128
+ /**
3129
+ * 修改任务连接器激活状态
3130
+ * API 端点: PATCH /console/as/connector/task/:taskid/active_status
3131
+ */
3132
+ modifyTaskConnectorActiveStatus(request: ModifyTaskConnectorActiveStatusRequest): Promise<ModifyTaskConnectorActiveStatusResponse>;
3133
+ /**
3134
+ * 修改任务连接器仓库
3135
+ * API 端点: PATCH /console/as/connector/task/:taskid/repo
3136
+ */
3137
+ modifyTaskConnectorRepo(request: ModifyTaskConnectorRepoRequest): Promise<ModifyTaskConnectorRepoResponse>;
3138
+ /**
3139
+ * 根据账号类型获取用量信息并合并到账号中
3140
+ * - 企业用户:调用 getEnterpriseUsage 获取月度限额
3141
+ * - 个人用户:调用 getCurrentPlan 获取套餐信息
3142
+ */
3143
+ private enrichAccountWithUsage;
2771
3144
  /**
2772
3145
  * 获取当前套餐信息
2773
3146
  * 从计量计费接口获取用户的套餐信息
2774
3147
  * API: POST /billing/meter/get-user-resource
2775
3148
  */
2776
3149
  private getCurrentPlan;
3150
+ /**
3151
+ * 通过回调code,换token
3152
+ * @param request
3153
+ * @returns
3154
+ */
3155
+ saveOauthToken(request: SaveOauthTokenRequest): Promise<void>;
3156
+ /**
3157
+ * 获取OAuth连接器的仓库列表
3158
+ */
3159
+ getRepoList(request: GetRepoListRequest): Promise<GetRepoListResponse>;
3160
+ /**
3161
+ * 撤销OAuth连接器的所有连接
3162
+ */
3163
+ revokeAll(request: RevokeAllRequest): Promise<void>;
3164
+ /**
3165
+ * 获取 OAuth 用户信息
3166
+ * API 端点: GET /console/as/connector/oauth/:name/oauthuser
3167
+ */
3168
+ getOauthUser(request: GetOauthUserRequest): Promise<GetOauthUserResponse>;
2777
3169
  /**
2778
3170
  * 根据账号类型和 Pro 状态计算版本展示类型
2779
3171
  * - personal + isPro = 'pro'
@@ -2789,9 +3181,14 @@ declare class BackendProvider implements IBackendProvider {
2789
3181
  login(): Promise<void>;
2790
3182
  /**
2791
3183
  * 登出账号
2792
- * Web 环境: 调用登出接口并清除本地状态
3184
+ * Web 环境: 通过 iframe 访问登出 URL 清除 cookie
2793
3185
  */
2794
3186
  logout(): Promise<void>;
3187
+ /**
3188
+ * 获取企业用户用量信息
3189
+ * API: POST /billing/meter/get-enterprise-user-usage
3190
+ */
3191
+ getEnterpriseUsage(enterpriseId: string): Promise<EnterpriseUsage | null>;
2795
3192
  }
2796
3193
  /**
2797
3194
  * 创建 BackendProvider 实例
@@ -2813,7 +3210,7 @@ interface IPCBackendProviderConfig {
2813
3210
  /**
2814
3211
  * IPC Backend Provider 实现类
2815
3212
  *
2816
- * 通过 IWidgetChannel 与后端通信获取 Agent 列表
3213
+ * 通过 IWidgetChannel 与后端通信
2817
3214
  */
2818
3215
  declare class IPCBackendProvider implements IBackendProvider {
2819
3216
  private readonly channel;
@@ -2828,20 +3225,75 @@ declare class IPCBackendProvider implements IBackendProvider {
2828
3225
  */
2829
3226
  private sendBackendRequest;
2830
3227
  /**
2831
- * 获取 Agent 列表
2832
- * 通过 IWidgetChannel 发送请求到后端
3228
+ * 获取当前账号信息
3229
+ * IDE 环境: 通过 IPC 获取账号信息,并同步到 accountService
2833
3230
  */
2834
- getAgents(request?: GetAgentsRequest): Promise<GetAgentsResponse>;
3231
+ getAccount(): Promise<Account | null>;
2835
3232
  /**
2836
- * 获取可用模型列表
2837
- * 通过 IWidgetChannel 发送请求到后端
3233
+ * 获取用户连接器列表
3234
+ * IDE 环境: 通过 IPC 获取用户连接器列表
2838
3235
  */
2839
- getModels(request: GetModelsRequest): Promise<GetModelsResponse>;
3236
+ getUserConnector(): Promise<ListUserConnectorResponse>;
2840
3237
  /**
2841
- * 获取当前账号信息
2842
- * IDE 环境: 通过 IPC 获取账号信息,并同步到 accountService
3238
+ * 修改用户连接器连接状态
3239
+ * IDE 环境: 通过 IPC 修改用户连接器连接状态
2843
3240
  */
2844
- getAccount(): Promise<Account | null>;
3241
+ modifyUserConnectorConnectStatus(request: ModifyUserConnectorConnectStatusRequest): Promise<void>;
3242
+ /**
3243
+ * 修改用户连接器仓库
3244
+ * IDE 环境: 通过 IPC 修改用户连接器仓库
3245
+ */
3246
+ modifyUserConnectorRepo(request: ModifyUserConnectorRepoRequest): Promise<void>;
3247
+ /**
3248
+ * 修改用户连接器激活状态
3249
+ * IDE 环境: 通过 IPC 修改用户连接器激活状态
3250
+ */
3251
+ modifyUserConnectorActiveStatus(request: ModifyUserConnectorActiveStatusRequest): Promise<void>;
3252
+ /**
3253
+ * 删除用户连接器
3254
+ * IDE 环境: 通过 IPC 删除用户连接器
3255
+ */
3256
+ deleteUserConnector(name: 'github' | 'gongfeng'): Promise<void>;
3257
+ /**
3258
+ * 添加任务
3259
+ * IDE 环境: 通过 IPC 添加任务
3260
+ */
3261
+ addConnectorTask(request: AddTaskRequest): Promise<AddTaskResponse>;
3262
+ /**
3263
+ * 获取任务连接器列表
3264
+ * IDE 环境: 通过 IPC 获取任务连接器列表
3265
+ */
3266
+ getTaskConnector(taskId: string): Promise<ListTaskConnectorResponse>;
3267
+ /**
3268
+ * 修改任务连接器激活状态
3269
+ * IDE 环境: 通过 IPC 修改任务连接器激活状态
3270
+ */
3271
+ modifyTaskConnectorActiveStatus(request: ModifyTaskConnectorActiveStatusRequest): Promise<ModifyTaskConnectorActiveStatusResponse>;
3272
+ /**
3273
+ * 修改任务连接器仓库
3274
+ * IDE 环境: 通过 IPC 修改任务连接器仓库
3275
+ */
3276
+ modifyTaskConnectorRepo(request: ModifyTaskConnectorRepoRequest): Promise<ModifyTaskConnectorRepoResponse>;
3277
+ /**
3278
+ * 获取 OAuth 用户信息
3279
+ * IDE 环境: 通过 IPC 获取 OAuth 用户信息
3280
+ */
3281
+ getOauthUser(request: GetOauthUserRequest): Promise<GetOauthUserResponse>;
3282
+ /**
3283
+ * 通过回调code,换token
3284
+ * IDE 环境: 通过 IPC 保存 OAuth Token
3285
+ */
3286
+ saveOauthToken(request: SaveOauthTokenRequest): Promise<void>;
3287
+ /**
3288
+ * 获取OAuth连接器的仓库列表
3289
+ * IDE 环境: 通过 IPC 获取仓库列表
3290
+ */
3291
+ getRepoList(request: GetRepoListRequest): Promise<GetRepoListResponse>;
3292
+ /**
3293
+ * 撤销OAuth连接器的所有连接
3294
+ * IDE 环境: 通过 IPC 撤销所有连接
3295
+ */
3296
+ revokeAll(request: RevokeAllRequest): Promise<void>;
2845
3297
  /**
2846
3298
  * 触发登录流程
2847
3299
  * IDE 环境: 通过 IPC 通知 IDE 打开登录流程
@@ -2852,6 +3304,14 @@ declare class IPCBackendProvider implements IBackendProvider {
2852
3304
  * IDE 环境: 通过 IPC 通知 IDE 登出
2853
3305
  */
2854
3306
  logout(): Promise<void>;
3307
+ /**
3308
+ * 重新加载窗口
3309
+ * IDE 环境: 通过 IPC 通知 IDE 重新加载窗口(用于应用语言设置等)
3310
+ * @param params 可选参数,如 locale
3311
+ */
3312
+ reloadWindow(params?: {
3313
+ locale?: string;
3314
+ }): Promise<void>;
2855
3315
  /**
2856
3316
  * 调试日志
2857
3317
  */
@@ -2862,5 +3322,5 @@ declare class IPCBackendProvider implements IBackendProvider {
2862
3322
  */
2863
3323
  declare function createIPCBackendProvider(config: IPCBackendProviderConfig): IPCBackendProvider;
2864
3324
  //#endregion
2865
- export { type Account, type AccountPlan, type ActiveSession, ActiveSessionImpl, type AgentCapabilities, AgentClient, type AgentClientOptions, type AgentConnection, type Agent as AgentInfo, type AgentProvider, type AgentState, type AgentStateType, type AgentStatus, type AgentTransport, type PromptResponse as ApiPromptResponse, type ArtifactsResource, BackendProvider, type BackendProviderConfig, type BaseAgentState, type BaseConnectionConfig, type CreateSessionParams as ClientCreateSessionParams, type CreateSessionParams, type LoadSessionParams as ClientLoadSessionParams, type LoadSessionParams, type ClientSessionsResource, CloudAgentConnection, CloudAgentProvider, type CloudAgentProviderOptions, type CloudAgentSourceInfo, type CloudAgentState, type CloudAgentTarget, type CloudAgentVisibility, type CloudConnectionConfig, type CommodityCode, type ConnectionEvents, type DeployStatus, E2BFilesystem, type E2BSandboxConnectionInfo, type Edition, type EditionDisplayType, type EntryInfo, type FilesResource, type Filesystem, type FilesystemListOpts, type FilesystemProvider, type FilesystemRequestOpts, type GetModelsRequest, type GetModelsResponse, type IBackendProvider, IPCBackendProvider, type ListAgentFilter, type ListAgentOptions, type ListAgentSort, type Logger, type McpServerConfig, type ModelInfo, type PromptContentBlock, type PromptParams, type PromptsResource, type ReasoningConfig, type Session, type SessionAgentOperations, type SessionConnectionInfo, type SessionEventHandler, type SessionEvents, type SessionInfo, SessionManager, type SessionMode, type WatchOpts, type WriteEntry, createBackendProvider, createIPCBackendProvider, isCloudAgentState };
3325
+ export { type Account, type AccountPlan, type ActiveSession, ActiveSessionImpl, type AgentCapabilities, AgentClient, type AgentClientOptions, type AgentConnection, type Agent as AgentInfo, type AgentProvider, type AgentState, type AgentStateType, type AgentStatus, type AgentTransport, type PromptResponse as ApiPromptResponse, type ArtifactsResource, BackendProvider, type BackendProviderConfig, type BaseAgentState, type BaseConnectionConfig, type CreateSessionParams as ClientCreateSessionParams, type CreateSessionParams, type LoadSessionParams as ClientLoadSessionParams, type LoadSessionParams, type ClientSessionsResource, CloudAgentConnection, CloudAgentProvider, type CloudAgentProviderOptions, type CloudAgentSourceInfo, type CloudAgentState, type CloudAgentTarget, type CloudAgentVisibility, type CloudConnectionConfig, type CommodityCode, type ConnectionEvents, type DeployStatus, E2BFilesystem, type E2BSandboxConnectionInfo, type Edition, type EditionDisplayType, type EntryInfo, type FilesResource, type Filesystem, type FilesystemListOpts, type FilesystemProvider, type FilesystemRequestOpts, type IBackendProvider, IPCBackendProvider, type ListAgentFilter, type ListAgentOptions, type ListAgentSort, type Logger, type McpServerConfig, type ModelInfo, type PromptContentBlock, type PromptParams, type PromptsResource, type ReasoningConfig, type Session, type SessionAgentOperations, type SessionConnectionInfo, type SessionEventHandler, type SessionEvents, type SessionInfo, SessionManager, type SessionMode, type WatchOpts, type WriteEntry, createBackendProvider, createIPCBackendProvider, isCloudAgentState };
2866
3326
  //# sourceMappingURL=index.d.cts.map