@tencent-ai/cloud-agent-sdk 0.2.7 → 0.2.11-next.173794d.20260201

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
@@ -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
  }
@@ -202,7 +208,7 @@ interface FileChangeInfo {
202
208
  deletions: number;
203
209
  /** Unified diff format content
204
210
  * https://unifiedjs.com/explore/package/unified-diff/
205
- */
211
+ */
206
212
  diff?: string;
207
213
  /** File language */
208
214
  language?: string;
@@ -262,12 +268,6 @@ interface AgentCapabilities extends AgentCapabilities$1 {
262
268
  } | null;
263
269
  }
264
270
  //#endregion
265
- //#region ../agent-client-protocol/lib/common/client/questions.d.ts
266
- /**
267
- * User's answers to questions
268
- */
269
- type QuestionAnswers = Record<string, string | string[]>;
270
- //#endregion
271
271
  //#region ../agent-client-protocol/lib/common/client/types.d.ts
272
272
  /**
273
273
  * Client connection states
@@ -333,225 +333,946 @@ interface ClientEvents extends Record<string, unknown> {
333
333
  checkpointUpdated: CheckpointInfo;
334
334
  }
335
335
  //#endregion
336
- //#region ../agent-provider/lib/common/providers/local-agent-provider/acp/types.d.ts
337
- /**
338
- * Widget Channel 接口
339
- * 定义 Widget 与 Agent Manager 的通信抽象
340
- * 面向 ACP 协议设计,使用 sessionId 作为主要标识符
341
- */
342
- interface IWidgetChannel {
343
- /**
344
- * 发送通知到指定 session(fire-and-forget)
345
- * Channel 层负责路由到正确的 window
346
- * 不需要等待响应时使用此方法
347
- *
348
- * @param sessionId ACP 会话 ID
349
- * @param message 消息内容
350
- * @returns 是否发送成功
351
- */
352
- sendNotification(sessionId: string, message: any): Promise<boolean>;
353
- /**
354
- * 调用远程方法并等待响应
355
- * 需要响应时使用此方法(推荐)
356
- *
357
- * @param sessionId ACP 会话 ID
358
- * @param message 消息内容
359
- * @param timeoutMs 超时时间(毫秒,默认 5000)
360
- * @returns Promise 包含响应数据
361
- */
362
- callMethod(sessionId: string, message: any, timeoutMs?: number): Promise<any>;
363
- /**
364
- * 绑定 session 到 window
365
- * 用于创建新对话时建立 sessionId → windowId 映射
366
- *
367
- * @param sessionId ACP 会话 ID
368
- * @param windowId 窗口 ID
369
- */
370
- bindSession?(sessionId: string, windowId: number): void;
371
- /**
372
- * 解除 session 绑定
373
- *
374
- * @param sessionId ACP 会话 ID
375
- */
376
- unbindSession?(sessionId: string): void;
377
- /** 注册事件监听器 */
378
- on(event: string, handler: (data?: any) => void): void;
379
- /** 注销事件监听器 */
380
- off(event: string, handler: (data?: any) => void): void;
381
- /** 触发事件(向外部发送事件) */
382
- emit(event: string, data?: any): void;
383
- /** 清除所有事件监听器 */
384
- clear?(): void;
385
- }
336
+ //#region ../agent-client-protocol/lib/common/client/questions.d.ts
386
337
  /**
387
- * 可用命令定义 (符合 ACP 协议)
388
- * 参考: https://agentclientprotocol.com/protocol/slash-commands
338
+ * User's answers to questions
389
339
  */
390
- interface AvailableCommand {
391
- /** 命令名称 (如 "web", "test", "plan") */
392
- readonly name: string;
393
- /** 人类可读的命令描述 */
394
- readonly description: string;
395
- /** 可选的输入规范 */
396
- readonly input?: {
397
- /** 输入提示,当用户未提供输入时显示 */readonly hint?: string;
398
- };
399
- }
340
+ type QuestionAnswers = Record<string, string | string[]>;
400
341
  //#endregion
401
- //#region ../agent-provider/lib/common/types.d.ts
402
- /**
403
- * Base options for filesystem operations
404
- * 对齐 e2b SDK FilesystemRequestOpts
405
- */
406
- interface FilesystemRequestOpts {
407
- user?: string;
408
- requestTimeoutMs?: number;
409
- }
342
+ //#region ../agent-provider/lib/backend/types.d.ts
410
343
  /**
411
- * Options for list operation
412
- * 对齐 e2b SDK FilesystemListOpts
344
+ * Backend Provider 类型定义
345
+ *
346
+ * 定义 IBackendProvider 接口和配置
413
347
  */
414
- interface FilesystemListOpts extends FilesystemRequestOpts {
415
- depth?: number;
416
- }
417
348
  /**
418
- * Options for watchDir operation
419
- * 对齐 e2b SDK WatchOpts
349
+ * 账号版本类型
420
350
  */
421
- interface WatchOpts extends FilesystemRequestOpts {
422
- timeoutMs?: number;
423
- onExit?: (err?: Error) => void | Promise<void>;
424
- recursive?: boolean;
425
- }
351
+ type Edition = 'pro' | 'personal' | 'ultimate' | 'exclusive';
426
352
  /**
427
- * Entry for batch write operation
428
- * 对齐 e2b SDK WriteEntry
353
+ * 版本展示类型(用于 UI 展示)
354
+ * - free: 免费版(个人版未订阅 Pro)
355
+ * - pro: Pro 版(个人版已订阅 Pro)
356
+ * - ultimate: 旗舰版(团队版)
357
+ * - exclusive: 专享版(企业版)
429
358
  */
430
- type WriteEntry = {
431
- path: string;
432
- data: string | ArrayBuffer | Blob | ReadableStream;
433
- };
359
+ type EditionDisplayType = 'free' | 'pro' | 'ultimate' | 'exclusive';
434
360
  /**
435
- * E2B Sandbox connection information
436
- * 与 e2b SDK 的 ConnectionOpts 对齐
361
+ * 部署状态
437
362
  */
438
- interface E2BSandboxConnectionInfo {
439
- /** Sandbox ID */
440
- sandboxId: string;
441
- /** API key for authentication (e2b_ 开头的 key) */
442
- apiKey?: string;
443
- /** Access token for authentication (JWT 格式的 token) */
444
- accessToken?: string;
445
- /** Domain for the API (不带 https://) */
446
- domain?: string;
447
- /** API URL override (internal) */
448
- apiUrl?: string;
449
- /** Request timeout in milliseconds */
450
- requestTimeoutMs?: number;
451
- /** Debug mode */
452
- debug?: boolean;
453
- /**
454
- * Additional headers to send with the request.
455
- */
456
- headers?: Record<string, string>;
363
+ interface DeployStatus {
364
+ statusCode: number;
365
+ statusMsg: string;
366
+ detailMsg: string;
457
367
  }
458
368
  /**
459
- * Filesystem resource interface
460
- * Mirrors e2b SDK Filesystem API
461
- * 完全对齐 e2b SDK 的 Filesystem 类
369
+ * 套餐代码
462
370
  */
463
- interface FilesResource {
464
- /** Read file content as text (default) */
465
- read(path: string, opts?: FilesystemRequestOpts & {
466
- format?: 'text';
467
- }): Promise<string>;
468
- /** Read file content as bytes */
469
- read(path: string, opts: FilesystemRequestOpts & {
470
- format: 'bytes';
471
- }): Promise<Uint8Array>;
472
- /** Read file content as blob */
473
- read(path: string, opts: FilesystemRequestOpts & {
474
- format: 'blob';
475
- }): Promise<Blob>;
476
- /** Read file content as stream */
477
- read(path: string, opts: FilesystemRequestOpts & {
478
- format: 'stream';
479
- }): Promise<ReadableStream<Uint8Array>>;
480
- /** Write content to a single file */
481
- write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: FilesystemRequestOpts): Promise<WriteInfo>;
482
- /** Write multiple files in batch */
483
- write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<WriteInfo[]>;
484
- /** List directory contents with optional depth */
485
- list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo$1[]>;
486
- /** Check if path exists */
487
- exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
488
- /** Create directory */
489
- makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
490
- /** Remove file or directory */
491
- remove(path: string, opts?: FilesystemRequestOpts): Promise<void>;
492
- /** Rename/move file or directory */
493
- rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo$1>;
494
- /** Get file or directory information */
495
- getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo$1>;
496
- /** Watch directory for changes */
497
- watchDir(path: string, onEvent: (event: FilesystemEvent) => void | Promise<void>, opts?: WatchOpts & {
498
- onExit?: (err?: Error) => void | Promise<void>;
499
- }): Promise<WatchHandle>;
500
- }
501
371
  /**
502
- * Filesystem provider interface - implemented by Provider
372
+ * TCACA_code_001_PqouKr6QWV CodeBuddy海外版免费包
373
+ * TCACA_code_002_AkiJS3ZHF5 CodeBuddy海外版Pro版本包-包月/CodeBuddy Pro Plan - Monthly:
374
+ * TCACA_code_006_DbXS0lrypC CodeBuddy海外版一次性免费赠送2周的Pro版本包/CodeBuddy One-time Free 2-Week Pro Plan Trial
375
+ * TCACA_code_007_nzdH5h4Nl0 CodeBuddy海外版运营裂变包/CodeBuddy Growth Plan
376
+ * TCACA_code_003_FAnt7lcmRT CodeBuddy海外版Pro版本包-包年/CodeBuddy Pro Plan - Yearly
377
+ * TCACA_code_008_cfWoLwvjU4 赠送月包
503
378
  */
504
- interface FilesystemProvider {
505
- /**
506
- * Get filesystem resource for an agent
507
- * @param agentId - Agent ID (used to get the corresponding sandbox connection)
508
- */
509
- getFilesystem(agentId: string): Promise<FilesResource>;
379
+ declare enum CommodityCode {
380
+ free = "TCACA_code_001_PqouKr6QWV",
381
+ // free
382
+ proMon = "TCACA_code_002_AkiJS3ZHF5",
383
+ proMonPlus = "TCACA_code_005_maRGyrHhw1",
384
+ gift = "TCACA_code_006_DbXS0lrypC",
385
+ activity = "TCACA_code_007_nzdH5h4Nl0",
386
+ proYear = "TCACA_code_003_FAnt7lcmRT",
387
+ freeMon = "TCACA_code_008_cfWoLwvjU4",
388
+ // free
389
+ extra = "TCACA_code_009_0XmEQc2xOf"
510
390
  }
511
391
  /**
512
- * Transport type for agents
513
- */
514
- type AgentTransport = 'cloud' | 'local';
515
- /**
516
- * Agent connection status
517
- */
518
- type AgentStatus = 'disconnected' | 'connecting' | 'connected' | 'initialized' | 'error';
519
- /**
520
- * Agent information
392
+ * 套餐资源项(用于展示列表)
521
393
  */
522
- interface Agent {
394
+ interface PlanResource {
395
+ /** 资源 ID */
523
396
  id: string;
397
+ /** 套餐名称(i18n key) */
524
398
  name: string;
525
- description?: string;
526
- version?: string;
527
- transport: AgentTransport;
528
- status: AgentStatus;
529
- capabilities?: AgentCapabilities;
530
- metadata?: Record<string, unknown>;
399
+ /** 套餐代码 */
400
+ packageCode: CommodityCode;
401
+ /** 是否是每日刷新的套餐 */
402
+ isDaily: boolean;
403
+ /** 总量 */
404
+ total: number;
405
+ /** 已用 */
406
+ used: number;
407
+ /** 剩余 */
408
+ left: number;
409
+ /** 到期时间戳 */
410
+ expireAt?: number;
411
+ /** 刷新时间戳 */
412
+ refreshAt?: number;
531
413
  }
532
414
  /**
533
- * Session mode configuration
415
+ * 账号套餐信息
534
416
  */
535
- interface SessionMode {
536
- id: string;
417
+ interface AccountPlan {
418
+ /** 是否是 Pro 版本 */
419
+ isPro: boolean;
420
+ isTria?: boolean;
421
+ /** 到期时间戳 */
422
+ expireAt?: number;
423
+ refreshAt?: number;
424
+ /** 自动续费标志 0-关闭 1-开启 */
425
+ renewFlag: 0 | 1;
426
+ /** 套餐代码 */
427
+ PackageCode?: CommodityCode;
428
+ /** 套餐名称 */
537
429
  name: string;
538
- description?: string | null;
539
- }
540
- /**
541
- * Session information
542
- */
543
- interface Session {
544
- id: string;
545
- agentId: string;
546
- availableModes?: SessionMode[];
547
- currentMode?: string;
430
+ usageTotal?: string;
431
+ usageUsed?: string;
432
+ usageLeft?: string;
433
+ /** 所有套餐资源列表 */
434
+ resources?: PlanResource[];
548
435
  }
549
436
  /**
550
- * Parameters for creating a new session
437
+ * 账号信息
551
438
  */
552
- interface CreateSessionParams {
553
- cwd: string;
554
- mcpServers?: McpServerConfig[];
439
+ interface Account {
440
+ /** 用户ID(唯一标识) */
441
+ uid: string;
442
+ /** 用户昵称 */
443
+ nickname: string;
444
+ /** 版本类型 */
445
+ type: Edition;
446
+ /** 版本展示类型(用于 UI 展示) */
447
+ editionType: EditionDisplayType;
448
+ /** 是否最后一次登录 */
449
+ lastLogin: boolean;
450
+ /** 企业ID */
451
+ enterpriseId?: string;
452
+ /** 企业名称 */
453
+ enterpriseName?: string;
454
+ /** 企业LOGO */
455
+ enterpriseLogo?: string;
456
+ /** 企业内用户名 */
457
+ enterpriseUserName?: string;
458
+ /** 插件是否启用 */
459
+ pluginEnabled?: boolean;
460
+ /** 部署状态 */
461
+ deployStatus?: DeployStatus;
462
+ /** 是否是 Pro 版本 */
463
+ isPro?: boolean;
464
+ /** 到期时间戳 */
465
+ expireAt?: string | number;
466
+ /** 刷新时间(年套餐下、本周期结束日期) */
467
+ refreshAt?: number;
468
+ /** 自动续费标志 0-关闭 1-开启 */
469
+ renewFlag?: 0 | 1;
470
+ /** 套餐代码 */
471
+ PackageCode?: CommodityCode;
472
+ /** 套餐名称 */
473
+ name?: string;
474
+ email?: string;
475
+ /** 套餐总用量 */
476
+ usageTotal?: string;
477
+ /** 套餐已用量 */
478
+ usageUsed?: string;
479
+ /** 套餐剩余用量 */
480
+ usageLeft?: string;
481
+ /** 所有套餐资源列表(个人用户) */
482
+ resources?: PlanResource[];
483
+ }
484
+ /**
485
+ * 推理配置
486
+ */
487
+ interface ReasoningConfig {
488
+ /** 推理努力程度 */
489
+ effort: 'low' | 'medium' | 'high';
490
+ /** 摘要模式 */
491
+ summary: 'auto' | 'always' | 'never';
492
+ }
493
+ /**
494
+ * 用户连接器信息
495
+ */
496
+ interface UserConnector {
497
+ /** 用户ID */
498
+ user_id: string;
499
+ /** 连接器名称 */
500
+ name: ConnectorType;
501
+ displayName: string;
502
+ /** 连接时间 */
503
+ connect_at: string;
504
+ /** 连接状态,0未连接,1已连接 */
505
+ connectStatus: 0 | 1;
506
+ /** 勾选仓库列表,逗号分隔 */
507
+ repos: string;
508
+ /** 激活状态,0未激活,1已激活 */
509
+ activeStatus: 0 | 1;
510
+ /** 提示词 */
511
+ prompt: string;
512
+ /** 跳转URL */
513
+ url: string;
514
+ /** 描述 */
515
+ description: string;
516
+ /** OAuth Client ID */
517
+ oauthClientId: string;
518
+ /** OAuth 重定向 URL */
519
+ oauthRedirectUrl: string;
520
+ }
521
+ /**
522
+ * 获取用户连接器列表响应
523
+ */
524
+ interface ListUserConnectorResponse {
525
+ /** 连接器列表 */
526
+ connectors: UserConnector[];
527
+ }
528
+ /**
529
+ * 修改用户连接器连接状态请求
530
+ */
531
+ interface ModifyUserConnectorConnectStatusRequest {
532
+ /** 连接器名称 */
533
+ name: ConnectorType;
534
+ /** 连接状态,0未连接,1已连接 */
535
+ connectStatus: 0 | 1;
536
+ /** 激活状态,0未激活,1已激活 */
537
+ activeStatus?: 0 | 1;
538
+ /** 勾选仓库列表 */
539
+ repos?: string[];
540
+ }
541
+ /**
542
+ * 修改用户连接器仓库请求
543
+ */
544
+ interface ModifyUserConnectorRepoRequest {
545
+ /** 连接器名称 */
546
+ name: ConnectorType;
547
+ /** 仓库列表 */
548
+ repo?: string[];
549
+ }
550
+ /**
551
+ * 修改用户连接器激活状态请求
552
+ */
553
+ interface ModifyUserConnectorActiveStatusRequest {
554
+ /** 连接器名称 */
555
+ name: ConnectorType;
556
+ /** 激活状态,0未激活,1已激活 */
557
+ activeStatus: 0 | 1;
558
+ }
559
+ type ConnectorType = 'github' | 'gongfeng' | 'cnb' | 'figma';
560
+ /**
561
+ * 任务连接器信息
562
+ */
563
+ interface TaskConnector {
564
+ /** 用户ID */
565
+ user_id: string;
566
+ /** 任务ID */
567
+ task_id: string;
568
+ /** 连接器名称(唯一标识,如github/gongfeng/figma/cnb) */
569
+ name: string;
570
+ displayName: string;
571
+ /** 勾选仓库列表,逗号分隔 */
572
+ repos: string;
573
+ /** 激活状态:0未激活 / 1已激活 */
574
+ activeStatus: 0 | 1;
575
+ /** 创建时间 */
576
+ created_at: string;
577
+ /** 更新时间 */
578
+ updated_at: string;
579
+ /** 提示词 */
580
+ prompt: string;
581
+ /** 跳转URL */
582
+ url: string;
583
+ /** 描述 */
584
+ description: string;
585
+ /** OAuth Client ID */
586
+ oauthClientId?: string;
587
+ /** OAuth 重定向 URL */
588
+ oauthRedirectUrl?: string;
589
+ /** 连接时间 */
590
+ connect_at: string;
591
+ /** 连接状态,0未连接,1已连接 */
592
+ connectStatus: 0 | 1;
593
+ }
594
+ /**
595
+ * 添加任务请求
596
+ */
597
+ interface AddTaskRequest {
598
+ /** 任务ID */
599
+ taskId: string;
600
+ /** 连接器列表 */
601
+ connectors?: Array<{
602
+ name: string;
603
+ repos: string;
604
+ activeStatus?: 0 | 1;
605
+ }>;
606
+ }
607
+ /**
608
+ * 添加任务响应
609
+ */
610
+ interface AddTaskResponse {
611
+ /** 任务ID */
612
+ taskId: string;
613
+ }
614
+ /**
615
+ * 获取任务连接器列表响应
616
+ */
617
+ interface ListTaskConnectorResponse {
618
+ /** 连接器列表 */
619
+ connectors: TaskConnector[];
620
+ }
621
+ /**
622
+ * 修改任务连接器激活状态请求
623
+ */
624
+ interface ModifyTaskConnectorActiveStatusRequest {
625
+ /** 任务ID */
626
+ taskId: string;
627
+ /** 连接器名称 */
628
+ name: string;
629
+ /** 激活状态,0未激活,1已激活 */
630
+ activeStatus: 0 | 1;
631
+ }
632
+ /**
633
+ * 修改任务连接器激活状态响应
634
+ */
635
+ interface ModifyTaskConnectorActiveStatusResponse {
636
+ /** 任务ID */
637
+ taskId: string;
638
+ }
639
+ /**
640
+ * 修改任务连接器仓库请求
641
+ */
642
+ interface ModifyTaskConnectorRepoRequest {
643
+ /** 任务ID */
644
+ taskId: string;
645
+ /** 连接器名称 */
646
+ name: string;
647
+ /** 仓库列表 */
648
+ repo: string[];
649
+ }
650
+ /**
651
+ * 修改任务连接器仓库响应
652
+ */
653
+ interface ModifyTaskConnectorRepoResponse {
654
+ /** 任务ID */
655
+ taskId: string;
656
+ }
657
+ /**
658
+ * oauth回调请求参数
659
+ */
660
+ interface SaveOauthTokenRequest {
661
+ /** 连接器名称 */
662
+ name: ConnectorType;
663
+ /** 第三方回调code */
664
+ authorizationCode: string;
665
+ }
666
+ /**
667
+ * 获取仓库列表请求参数
668
+ */
669
+ interface GetRepoListRequest {
670
+ /** 连接器名称 */
671
+ name: ConnectorType;
672
+ }
673
+ /**
674
+ * 撤销所有OAuth连接请求参数
675
+ */
676
+ interface RevokeAllRequest {
677
+ /** 连接器名称 */
678
+ name: ConnectorType;
679
+ /** 安装ID列表(可选,如果不传则撤销所有) */
680
+ installationIds?: string[];
681
+ }
682
+ /**
683
+ * GitHub 仓库所有者信息
684
+ */
685
+ interface OauthGitHubRepoOwner {
686
+ login: string;
687
+ avatar_url: string;
688
+ url: string;
689
+ html_url: string;
690
+ followers_url: string;
691
+ starred_url: string;
692
+ repos_url: string;
693
+ events_url: string;
694
+ }
695
+ /**
696
+ * GitHub 仓库信息
697
+ */
698
+ interface OauthGitHubRepo {
699
+ name: string;
700
+ full_name: string;
701
+ private: boolean;
702
+ html_url: string;
703
+ url: string;
704
+ teams_url: string;
705
+ hooks_url: string;
706
+ events_url: string;
707
+ branches_url: string;
708
+ git_commits_url: string;
709
+ merges_url: string;
710
+ pulls_url: string;
711
+ git_url: string;
712
+ clone_url: string;
713
+ svn_url: string;
714
+ downloads_url: string;
715
+ description: string;
716
+ owner: OauthGitHubRepoOwner;
717
+ forks_count: number;
718
+ }
719
+ /**
720
+ * 工蜂仓库信息
721
+ */
722
+ interface OauthGongfengRepo {
723
+ id: number;
724
+ description: string;
725
+ public: boolean;
726
+ archived: boolean;
727
+ visibility_level: number;
728
+ public_visibility: number;
729
+ namespace: {
730
+ name: string;
731
+ description: string;
732
+ path: string;
733
+ };
734
+ owner: {
735
+ username: string;
736
+ web_url: string;
737
+ name: string;
738
+ state: string;
739
+ avatar_url: string;
740
+ };
741
+ name: string;
742
+ name_with_namespace: string;
743
+ path: string;
744
+ path_with_namespace: string;
745
+ type: string;
746
+ default_branch: string;
747
+ ssh_url_to_repo: string;
748
+ http_url_to_repo: string;
749
+ https_url_to_repo: string;
750
+ web_url: string;
751
+ avatar_url: string;
752
+ }
753
+ /**
754
+ * CNB仓库信息
755
+ */
756
+ interface OauthCnbRepo {
757
+ name: string;
758
+ [key: string]: any;
759
+ }
760
+ /**
761
+ * 获取仓库列表响应
762
+ */
763
+ interface GetRepoListResponse {
764
+ github_repos?: {
765
+ [key: string | number]: OauthGitHubRepo[];
766
+ };
767
+ gongfeng_repos?: OauthGongfengRepo[];
768
+ cnb_repos?: OauthCnbRepo[];
769
+ }
770
+ /**
771
+ * OAuth 用户信息
772
+ */
773
+ interface OauthUserInfo {
774
+ /** 头像 URL */
775
+ avatarUrl: string;
776
+ /** 用户名 */
777
+ name: string;
778
+ }
779
+ /**
780
+ * 获取 OAuth 用户信息请求参数
781
+ */
782
+ interface GetOauthUserRequest {
783
+ /** 连接器名称 */
784
+ name: ConnectorType;
785
+ }
786
+ /**
787
+ * 获取 OAuth 用户信息响应
788
+ */
789
+ interface GetOauthUserResponse {
790
+ /** 用户信息 */
791
+ user: OauthUserInfo;
792
+ }
793
+ /**
794
+ * Figma 文件信息
795
+ */
796
+ interface FigmaFileInfo {
797
+ /** 文件名 */
798
+ name: string;
799
+ /** 角色 */
800
+ role: string;
801
+ /** 最后修改时间 */
802
+ lastModified: string;
803
+ /** 编辑器类型 */
804
+ editorType: string;
805
+ /** 缩略图 URL */
806
+ thumbnailUrl: string;
807
+ /** 版本 */
808
+ version: string;
809
+ /** 主文件 Key */
810
+ mainFileKey: string;
811
+ }
812
+ /**
813
+ * 获取文件信息请求参数
814
+ */
815
+ interface GetFileRequest {
816
+ /** 连接器名称 */
817
+ name: ConnectorType;
818
+ /** 文件 URL */
819
+ url: string;
820
+ }
821
+ /**
822
+ * 获取文件信息响应
823
+ */
824
+ interface GetFileResponse {
825
+ /** Figma 文件信息 */
826
+ figmaFileInfo: FigmaFileInfo | null;
827
+ }
828
+ /**
829
+ * Backend Provider 配置选项
830
+ */
831
+ interface BackendProviderConfig {
832
+ /** API 基础 URL (例如: https://api.example.com) */
833
+ baseUrl: string;
834
+ /** 认证 Token */
835
+ authToken?: string;
836
+ }
837
+ /**
838
+ * 企业用户用量信息
839
+ */
840
+ interface EnterpriseUsage {
841
+ /** 已使用 credit */
842
+ credit: number;
843
+ /** 周期开始时间 */
844
+ cycleStartTime: string;
845
+ /** 周期结束时间 */
846
+ cycleEndTime: string;
847
+ /** 周期重置时间 */
848
+ cycleResetTime: string;
849
+ /** 限额数量 */
850
+ limitNum: number;
851
+ }
852
+ /**
853
+ * IBackendProvider 接口
854
+ *
855
+ * 定义与后端 API 交互的抽象接口
856
+ *
857
+ * 注意:getAgents 和 getModels 方法已废弃并移除,
858
+ * 请使用 IAgentAdapter 中的对应方法
859
+ */
860
+ interface IBackendProvider {
861
+ /**
862
+ * 获取当前账号信息
863
+ * @returns Promise<Account | null> 账号信息,未登录时返回 null
864
+ */
865
+ getAccount(): Promise<Account | null>;
866
+ /**
867
+ * 获取用户连接器列表
868
+ * @returns Promise<ListUserConnectorResponse | null> 用户连接器列表,失败时返回 null
869
+ */
870
+ getUserConnector(): Promise<ListUserConnectorResponse>;
871
+ /**
872
+ * 修改用户连接器连接状态
873
+ * @param request 请求参数
874
+ * @returns Promise<void>
875
+ */
876
+ modifyUserConnectorConnectStatus(request: ModifyUserConnectorConnectStatusRequest): Promise<void>;
877
+ /**
878
+ * 修改用户连接器仓库
879
+ * @param request 请求参数
880
+ * @returns Promise<void>
881
+ */
882
+ modifyUserConnectorRepo(request: ModifyUserConnectorRepoRequest): Promise<void>;
883
+ /**
884
+ * 修改用户连接器激活状态
885
+ * @param request 请求参数
886
+ * @returns Promise<void>
887
+ */
888
+ modifyUserConnectorActiveStatus(request: ModifyUserConnectorActiveStatusRequest): Promise<void>;
889
+ /**
890
+ * 删除用户连接器
891
+ * @param name 连接器名称
892
+ * @returns Promise<void>
893
+ */
894
+ deleteUserConnector(name: ConnectorType): Promise<void>;
895
+ /**
896
+ * 添加任务
897
+ * @param request 请求参数
898
+ * @returns Promise<AddTaskResponse>
899
+ */
900
+ addConnectorTask(request: AddTaskRequest): Promise<AddTaskResponse>;
901
+ /**
902
+ * 获取任务连接器列表
903
+ * @param taskId 任务ID
904
+ * @returns Promise<ListTaskConnectorResponse>
905
+ */
906
+ getTaskConnector(taskId: string): Promise<ListTaskConnectorResponse>;
907
+ /**
908
+ * 修改任务连接器激活状态
909
+ * @param request 请求参数
910
+ * @returns Promise<ModifyTaskConnectorActiveStatusResponse>
911
+ */
912
+ modifyTaskConnectorActiveStatus(request: ModifyTaskConnectorActiveStatusRequest): Promise<ModifyTaskConnectorActiveStatusResponse>;
913
+ /**
914
+ * 修改任务连接器仓库
915
+ * @param request 请求参数
916
+ * @returns Promise<ModifyTaskConnectorRepoResponse>
917
+ */
918
+ modifyTaskConnectorRepo(request: ModifyTaskConnectorRepoRequest): Promise<ModifyTaskConnectorRepoResponse>;
919
+ /**
920
+ * oauth回调,后端用第三方的code换token的
921
+ */
922
+ saveOauthToken(request: SaveOauthTokenRequest): Promise<void>;
923
+ /**
924
+ * 获取OAuth连接器的仓库列表
925
+ * @param request 请求参数
926
+ * @returns Promise<GetRepoListResponse> 仓库列表响应
927
+ */
928
+ getRepoList(request: GetRepoListRequest): Promise<GetRepoListResponse>;
929
+ /**
930
+ * 撤销OAuth连接器的所有连接
931
+ * @param request 请求参数
932
+ * @returns Promise<void>
933
+ */
934
+ revokeAll(request: RevokeAllRequest): Promise<void>;
935
+ /**
936
+ * 获取 OAuth 用户信息
937
+ * @param request 请求参数
938
+ * @returns Promise<GetOauthUserResponse> 用户信息响应
939
+ */
940
+ getOauthUser(request: GetOauthUserRequest): Promise<GetOauthUserResponse>;
941
+ /**
942
+ * 获取文件信息
943
+ * @param request 请求参数
944
+ * @returns Promise<GetFileResponse> 文件信息响应
945
+ */
946
+ getFile(request: GetFileRequest): Promise<GetFileResponse>;
947
+ /**
948
+ * 触发登录流程
949
+ * - Web 环境: 跳转到登录页面
950
+ * - IDE 环境: 通过 IPC 通知 IDE 打开登录流程
951
+ */
952
+ login(): Promise<void>;
953
+ /**
954
+ * 登出账号
955
+ */
956
+ logout(): Promise<void>;
957
+ /**
958
+ * 重新加载窗口(可选,仅 IPC 环境支持)
959
+ * @param params 可选参数,如 locale
960
+ */
961
+ reloadWindow?(params?: {
962
+ locale?: string;
963
+ }): Promise<void>;
964
+ /**
965
+ * 关闭 Agent Manager 面板(可选,仅 IPC 环境支持)
966
+ * 用于 Local 模式下点击 Logo 返回 IDE
967
+ */
968
+ closeAgentManager?(): Promise<void>;
969
+ /**
970
+ * 监听事件(可选,用于 IPC 环境)
971
+ * @param event 事件名称
972
+ * @param callback 回调函数
973
+ * @returns 取消订阅函数
974
+ */
975
+ on?(event: string, callback: (data?: unknown) => void): () => void;
976
+ /** 获取企业用户用量信息
977
+ * @param enterpriseId 企业 ID
978
+ * @returns Promise<EnterpriseUsage | null> 企业用户用量信息
979
+ */
980
+ getEnterpriseUsage?(enterpriseId: string): Promise<EnterpriseUsage | null>;
981
+ }
982
+ /**
983
+ * 场景中的插件信息
984
+ * 用于描述场景关联的插件
985
+ */
986
+ interface ScenePlugin {
987
+ /** 插件唯一标识 */
988
+ id: number;
989
+ /** 插件名称 */
990
+ name: string;
991
+ /** 插件市场名称 */
992
+ marketplaceName: string;
993
+ }
994
+ /**
995
+ * 支持的场景信息
996
+ * 用于 Welcome 页面的 QuickActions 快捷操作
997
+ * API 端点: GET /console/as/support/scenes (Web) 或 GET /v2/as/support/scenes (Local)
998
+ */
999
+ interface SupportScene {
1000
+ /** 场景唯一标识 */
1001
+ id: number;
1002
+ /** 场景显示名称 */
1003
+ name: string;
1004
+ /** 场景关联的插件列表 */
1005
+ plugins: ScenePlugin[];
1006
+ /** 场景对应的 prompt 列表 */
1007
+ prompts: string[];
1008
+ }
1009
+ /**
1010
+ * 插件作用域
1011
+ */
1012
+ type PluginScope = 'user' | 'project';
1013
+ /**
1014
+ * 插件操作类型
1015
+ */
1016
+ type PluginOperation = 'enable' | 'disable';
1017
+ /**
1018
+ * 批量插件操作项
1019
+ */
1020
+ interface BatchPluginOperationItem {
1021
+ /** 插件名称 */
1022
+ readonly pluginName: string;
1023
+ /** 市场名称 */
1024
+ readonly marketplaceName: string;
1025
+ /** 作用域 */
1026
+ readonly scope: PluginScope;
1027
+ /** 操作类型 */
1028
+ readonly operation: PluginOperation;
1029
+ }
1030
+ /**
1031
+ * 批量插件操作请求
1032
+ */
1033
+ interface BatchPluginOperationRequest {
1034
+ /** 操作项列表 */
1035
+ readonly items: BatchPluginOperationItem[];
1036
+ }
1037
+ /**
1038
+ * 批量插件操作失败项
1039
+ */
1040
+ interface BatchPluginOperationFailedItem extends BatchPluginOperationItem {
1041
+ /** 错误信息 */
1042
+ readonly error: string;
1043
+ }
1044
+ /**
1045
+ * 批量插件操作结果
1046
+ */
1047
+ interface BatchPluginOperationResult {
1048
+ /** 是否全部成功 */
1049
+ readonly success: boolean;
1050
+ /** 成功的插件列表 */
1051
+ readonly succeededPlugins: BatchPluginOperationItem[];
1052
+ /** 失败的插件列表 */
1053
+ readonly failedPlugins: BatchPluginOperationFailedItem[];
1054
+ }
1055
+ //#endregion
1056
+ //#region ../agent-provider/lib/common/providers/local-agent-provider/acp/types.d.ts
1057
+ /**
1058
+ * Widget Channel 接口
1059
+ * 定义 Widget 与 Agent Manager 的通信抽象
1060
+ * 面向 ACP 协议设计,使用 sessionId 作为主要标识符
1061
+ */
1062
+ interface IWidgetChannel {
1063
+ /**
1064
+ * 发送通知到指定 session(fire-and-forget)
1065
+ * Channel 层负责路由到正确的 window
1066
+ * 不需要等待响应时使用此方法
1067
+ *
1068
+ * @param sessionId ACP 会话 ID
1069
+ * @param message 消息内容
1070
+ * @returns 是否发送成功
1071
+ */
1072
+ sendNotification(sessionId: string, message: any): Promise<boolean>;
1073
+ /**
1074
+ * 调用远程方法并等待响应
1075
+ * 需要响应时使用此方法(推荐)
1076
+ *
1077
+ * @param sessionId ACP 会话 ID
1078
+ * @param message 消息内容
1079
+ * @param timeoutMs 超时时间(毫秒,默认 5000)
1080
+ * @returns Promise 包含响应数据
1081
+ */
1082
+ callMethod(sessionId: string, message: any, timeoutMs?: number): Promise<any>;
1083
+ /**
1084
+ * 绑定 session 到 window
1085
+ * 用于创建新对话时建立 sessionId → windowId 映射
1086
+ *
1087
+ * @param sessionId ACP 会话 ID
1088
+ * @param windowId 窗口 ID
1089
+ */
1090
+ bindSession?(sessionId: string, windowId: number): void;
1091
+ /**
1092
+ * 解除 session 绑定
1093
+ *
1094
+ * @param sessionId ACP 会话 ID
1095
+ */
1096
+ unbindSession?(sessionId: string): void;
1097
+ /** 注册事件监听器 */
1098
+ on(event: string, handler: (data?: any) => void): void;
1099
+ /** 注销事件监听器 */
1100
+ off(event: string, handler: (data?: any) => void): void;
1101
+ /** 触发事件(向外部发送事件) */
1102
+ emit(event: string, data?: any): void;
1103
+ /** 清除所有事件监听器 */
1104
+ clear?(): void;
1105
+ }
1106
+ /**
1107
+ * 可用命令定义 (符合 ACP 协议)
1108
+ * 参考: https://agentclientprotocol.com/protocol/slash-commands
1109
+ */
1110
+ interface AvailableCommand {
1111
+ /** 命令名称 (如 "web", "test", "plan") */
1112
+ readonly name: string;
1113
+ /** 人类可读的命令描述 */
1114
+ readonly description: string;
1115
+ /** 可选的输入规范 */
1116
+ readonly input?: {
1117
+ /** 输入提示,当用户未提供输入时显示 */readonly hint?: string;
1118
+ };
1119
+ }
1120
+ //#endregion
1121
+ //#region ../agent-provider/lib/common/types.d.ts
1122
+ /**
1123
+ * Base options for filesystem operations
1124
+ * 对齐 e2b SDK FilesystemRequestOpts
1125
+ */
1126
+ interface FilesystemRequestOpts {
1127
+ user?: string;
1128
+ requestTimeoutMs?: number;
1129
+ }
1130
+ /**
1131
+ * Options for list operation
1132
+ * 对齐 e2b SDK FilesystemListOpts
1133
+ */
1134
+ interface FilesystemListOpts extends FilesystemRequestOpts {
1135
+ depth?: number;
1136
+ }
1137
+ /**
1138
+ * Options for watchDir operation
1139
+ * 对齐 e2b SDK WatchOpts
1140
+ */
1141
+ interface WatchOpts extends FilesystemRequestOpts {
1142
+ timeoutMs?: number;
1143
+ onExit?: (err?: Error) => void | Promise<void>;
1144
+ recursive?: boolean;
1145
+ }
1146
+ /**
1147
+ * Entry for batch write operation
1148
+ * 对齐 e2b SDK WriteEntry
1149
+ */
1150
+ interface WriteEntry {
1151
+ path: string;
1152
+ data: string | ArrayBuffer | Blob | ReadableStream;
1153
+ }
1154
+ /**
1155
+ * E2B Sandbox connection information
1156
+ * 与 e2b SDK 的 ConnectionOpts 对齐
1157
+ */
1158
+ interface E2BSandboxConnectionInfo {
1159
+ /** Sandbox ID */
1160
+ sandboxId: string;
1161
+ /** API key for authentication (e2b_ 开头的 key) */
1162
+ apiKey?: string;
1163
+ /** Access token for authentication (JWT 格式的 token) */
1164
+ accessToken?: string;
1165
+ /** Domain for the API (不带 https://) */
1166
+ domain?: string;
1167
+ /** API URL override (internal) */
1168
+ apiUrl?: string;
1169
+ /** Request timeout in milliseconds */
1170
+ requestTimeoutMs?: number;
1171
+ /** Debug mode */
1172
+ debug?: boolean;
1173
+ /**
1174
+ * Additional headers to send with the request.
1175
+ */
1176
+ headers?: Record<string, string>;
1177
+ }
1178
+ /**
1179
+ * Filesystem resource interface
1180
+ * Mirrors e2b SDK Filesystem API
1181
+ * 完全对齐 e2b SDK 的 Filesystem 类
1182
+ */
1183
+ interface FilesResource {
1184
+ /** Read file content as text (default) */
1185
+ read(path: string, opts?: FilesystemRequestOpts & {
1186
+ format?: 'text';
1187
+ }): Promise<string>;
1188
+ /** Read file content as bytes */
1189
+ read(path: string, opts: FilesystemRequestOpts & {
1190
+ format: 'bytes';
1191
+ }): Promise<Uint8Array>;
1192
+ /** Read file content as blob */
1193
+ read(path: string, opts: FilesystemRequestOpts & {
1194
+ format: 'blob';
1195
+ }): Promise<Blob>;
1196
+ /** Read file content as stream */
1197
+ read(path: string, opts: FilesystemRequestOpts & {
1198
+ format: 'stream';
1199
+ }): Promise<ReadableStream<Uint8Array>>;
1200
+ /** Write content to a single file */
1201
+ write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: FilesystemRequestOpts): Promise<WriteInfo>;
1202
+ /** Write multiple files in batch */
1203
+ write(files: WriteEntry[], opts?: FilesystemRequestOpts): Promise<WriteInfo[]>;
1204
+ /** List directory contents with optional depth */
1205
+ list(path: string, opts?: FilesystemListOpts): Promise<EntryInfo$1[]>;
1206
+ /** Check if path exists */
1207
+ exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
1208
+ /** Create directory */
1209
+ makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean>;
1210
+ /** Remove file or directory */
1211
+ remove(path: string, opts?: FilesystemRequestOpts): Promise<void>;
1212
+ /** Rename/move file or directory */
1213
+ rename(oldPath: string, newPath: string, opts?: FilesystemRequestOpts): Promise<EntryInfo$1>;
1214
+ /** Get file or directory information */
1215
+ getInfo(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo$1>;
1216
+ /** Watch directory for changes */
1217
+ watchDir(path: string, onEvent: (event: FilesystemEvent) => void | Promise<void>, opts?: WatchOpts & {
1218
+ onExit?: (err?: Error) => void | Promise<void>;
1219
+ }): Promise<WatchHandle>;
1220
+ }
1221
+ /**
1222
+ * Filesystem provider interface - implemented by Provider
1223
+ */
1224
+ interface FilesystemProvider {
1225
+ /**
1226
+ * Get filesystem resource for an agent
1227
+ * @param agentId - Agent ID (used to get the corresponding sandbox connection)
1228
+ */
1229
+ getFilesystem(agentId: string): Promise<FilesResource>;
1230
+ }
1231
+ /**
1232
+ * Transport type for agents
1233
+ */
1234
+ type AgentTransport = 'cloud' | 'local';
1235
+ /**
1236
+ * Agent connection status
1237
+ */
1238
+ type AgentStatus = 'disconnected' | 'connecting' | 'connected' | 'initialized' | 'error';
1239
+ /**
1240
+ * Agent information
1241
+ */
1242
+ interface Agent {
1243
+ id: string;
1244
+ name: string;
1245
+ description?: string;
1246
+ version?: string;
1247
+ transport: AgentTransport;
1248
+ status: AgentStatus;
1249
+ capabilities?: AgentCapabilities;
1250
+ metadata?: Record<string, unknown>;
1251
+ }
1252
+ /**
1253
+ * Session mode configuration
1254
+ */
1255
+ interface SessionMode {
1256
+ id: string;
1257
+ name: string;
1258
+ description?: string | null;
1259
+ }
1260
+ /**
1261
+ * Session information
1262
+ */
1263
+ interface Session {
1264
+ id: string;
1265
+ agentId: string;
1266
+ availableModes?: SessionMode[];
1267
+ currentMode?: string;
1268
+ }
1269
+ /**
1270
+ * Parameters for creating a new session
1271
+ */
1272
+ interface CreateSessionParams {
1273
+ cwd: string;
1274
+ mcpServers?: McpServerConfig[];
1275
+ _meta?: Record<string, unknown>;
555
1276
  }
556
1277
  /**
557
1278
  * Parameters for loading an existing session
@@ -592,6 +1313,13 @@ type PromptContentBlock = {
592
1313
  } | {
593
1314
  type: 'resource';
594
1315
  uri: string;
1316
+ mimeType?: string | null;
1317
+ name: string;
1318
+ size?: bigint | null;
1319
+ title?: string | null;
1320
+ _meta?: {
1321
+ [key: string]: unknown;
1322
+ } | null | undefined;
595
1323
  };
596
1324
  /**
597
1325
  * Parameters for sending a prompt
@@ -627,6 +1355,10 @@ interface ConnectionEvents extends ClientEvents {
627
1355
  questionTimeout: {
628
1356
  toolCallId: string;
629
1357
  };
1358
+ command: {
1359
+ action: string;
1360
+ params?: Record<string, unknown>;
1361
+ };
630
1362
  }
631
1363
  /**
632
1364
  * Event listener type
@@ -746,7 +1478,7 @@ interface ModelReasoning {
746
1478
  /**
747
1479
  * Model information
748
1480
  */
749
- interface ModelInfo$1 {
1481
+ interface ModelInfo {
750
1482
  /** 模型唯一标识符,例如"gpt-3.5-turbo" */
751
1483
  readonly id: string;
752
1484
  /** 可选,模型名称,例如"GPT-3.5 Turbo" */
@@ -901,6 +1633,8 @@ interface BaseAgentState {
901
1633
  createdAt?: Date;
902
1634
  /** When the agent was last updated */
903
1635
  updatedAt?: Date;
1636
+ /** 是否为 playground */
1637
+ isPlayground?: boolean;
904
1638
  }
905
1639
  /**
906
1640
  * LocalAgentState - 本地 Agent 状态
@@ -1045,6 +1779,8 @@ interface SessionInfo {
1045
1779
  lastActivityAt?: Date;
1046
1780
  /** Working directory (for local agents) */
1047
1781
  cwd?: string;
1782
+ /** Whether the session is a playground */
1783
+ isPlayground?: boolean;
1048
1784
  }
1049
1785
  /**
1050
1786
  * Parameters for creating a new session
@@ -1054,6 +1790,7 @@ interface CreateSessionParams$1 {
1054
1790
  cwd: string;
1055
1791
  /** MCP server configurations */
1056
1792
  mcpServers?: McpServerConfig[];
1793
+ _meta?: Record<string, unknown>;
1057
1794
  }
1058
1795
  /**
1059
1796
  * Parameters for loading an existing session
@@ -1065,6 +1802,8 @@ interface LoadSessionParams$1 {
1065
1802
  cwd: string;
1066
1803
  /** MCP server configurations */
1067
1804
  mcpServers?: McpServerConfig[];
1805
+ /** Callback executed right after session instance is created, before connection.loadSession() is called */
1806
+ onSessionCreated?: (session: ActiveSession) => Promise<void> | void;
1068
1807
  }
1069
1808
  /**
1070
1809
  * Parameters for initializing a workspace
@@ -1116,7 +1855,7 @@ interface ArtifactsResource {
1116
1855
  */
1117
1856
  interface ModelsResource {
1118
1857
  /** Get available models for a repository */
1119
- list(repo?: string): Promise<ModelInfo$1[]>;
1858
+ list(repo?: string): Promise<ModelInfo[]>;
1120
1859
  }
1121
1860
  /**
1122
1861
  * Prompt response
@@ -1174,6 +1913,11 @@ interface SessionEvents {
1174
1913
  checkpointCreated: CheckpointInfo;
1175
1914
  /** Emitted when a checkpoint is updated */
1176
1915
  checkpointUpdated: CheckpointInfo;
1916
+ /** Emitted when a command is received */
1917
+ command: {
1918
+ action: string;
1919
+ params?: Record<string, unknown>;
1920
+ };
1177
1921
  /** Emitted when connected to agent */
1178
1922
  connected: void;
1179
1923
  /** Emitted when disconnected from agent */
@@ -1220,6 +1964,10 @@ interface ActiveSession {
1220
1964
  readonly availableModes?: SessionMode[];
1221
1965
  /** Current session mode */
1222
1966
  readonly currentMode?: string;
1967
+ /** Available models for this session */
1968
+ readonly availableModels?: ModelInfo[];
1969
+ /** Current model ID */
1970
+ readonly currentModelId?: string;
1223
1971
  /** Available slash commands (updated via available_commands_update) */
1224
1972
  readonly availableCommands: AvailableCommand[];
1225
1973
  /** Whether the session is active */
@@ -1254,6 +2002,12 @@ interface ActiveSession {
1254
2002
  setMode(modeId: string): Promise<void>;
1255
2003
  /** Set the current session model */
1256
2004
  setSessionModel(modelId: string): Promise<void>;
2005
+ /** Set available commands (called when available_commands_update is received) */
2006
+ setAvailableCommands(commands: AvailableCommand[]): void;
2007
+ /** Set available modes (called after create/load) */
2008
+ setModes(availableModes?: SessionMode[], currentMode?: string): void;
2009
+ /** Set available models (called after create/load) */
2010
+ setModels(availableModels?: ModelInfo[], currentModelId?: string): void;
1257
2011
  /** Subscribe to an event */
1258
2012
  on<K extends keyof SessionEvents>(event: K, handler: SessionEventHandler<K>): this;
1259
2013
  /** Unsubscribe from an event */
@@ -1326,6 +2080,16 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
1326
2080
  rename?(agentId: string, title: string): Promise<{
1327
2081
  id: string;
1328
2082
  }>;
2083
+ /**
2084
+ * Move an agent by ID (optional)
2085
+ * Used by LocalAgentProvider for moving Playground sessions to Workspace
2086
+ *
2087
+ * @param agentId - Agent ID to move
2088
+ * @returns Object containing the moved agent ID
2089
+ */
2090
+ move?(agentId: string): Promise<{
2091
+ id: string;
2092
+ }>;
1329
2093
  /** Filesystem provider (optional - some providers may not support filesystem operations) */
1330
2094
  readonly filesystem?: FilesystemProvider;
1331
2095
  /**
@@ -1334,7 +2098,7 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
1334
2098
  * @param repo - Repository identifier
1335
2099
  * @returns Array of model information
1336
2100
  */
1337
- getModels?(repo?: string): Promise<ModelInfo$1[]>;
2101
+ getModels?(repo?: string): Promise<ModelInfo[]>;
1338
2102
  /**
1339
2103
  * Register sessionId → agentId mapping (optional, used by LocalAgentProvider)
1340
2104
  * Called after session creation to maintain the mapping for loadSession
@@ -1378,6 +2142,39 @@ interface AgentProvider<C extends AgentConnection = AgentConnection> {
1378
2142
  * @returns Response with search results
1379
2143
  */
1380
2144
  searchFile?(params: SearchFileParams): Promise<SearchFileResponse>;
2145
+ /**
2146
+ * Batch toggle plugins (optional, used by LocalAgentProvider)
2147
+ *
2148
+ * @param request - Batch plugin operation request
2149
+ * @returns Batch operation result
2150
+ */
2151
+ batchTogglePlugins?(request: BatchPluginOperationRequest): Promise<BatchPluginOperationResult>;
2152
+ /**
2153
+ * Get installed plugins (optional, used by LocalAgentProvider)
2154
+ *
2155
+ * @param forceRefresh - Whether to force refresh the cache
2156
+ * @returns Array of installed plugins
2157
+ */
2158
+ getInstalledPlugins?(forceRefresh?: boolean): Promise<Array<{
2159
+ name: string;
2160
+ marketplaceName: string;
2161
+ status: string;
2162
+ description?: string;
2163
+ version?: string;
2164
+ installScope?: 'user' | 'project';
2165
+ }>>;
2166
+ /**
2167
+ * Install plugins (optional, used by LocalAgentProvider)
2168
+ *
2169
+ * @param pluginNames - Array of plugin names to install
2170
+ * @param marketplaceName - Marketplace name
2171
+ * @param installScope - Install scope ('user' | 'project')
2172
+ * @returns Result of the operation
2173
+ */
2174
+ installPlugins?(pluginNames: string[], marketplaceName: string, installScope?: 'user' | 'project'): Promise<{
2175
+ success: boolean;
2176
+ error?: string;
2177
+ }>;
1381
2178
  /**
1382
2179
  * Register an event listener
1383
2180
  * Provider implementations should forward events to the underlying transport
@@ -1450,6 +2247,14 @@ interface ClientSessionsResource {
1450
2247
  rename(sessionId: string, title: string): Promise<{
1451
2248
  id: string;
1452
2249
  }>;
2250
+ /**
2251
+ * Move a session (Playground → Workspace)
2252
+ * @param sessionId - Session ID to move
2253
+ * @returns Object containing the moved session ID
2254
+ */
2255
+ move(sessionId: string): Promise<{
2256
+ id: string;
2257
+ }>;
1453
2258
  /** Initialize a workspace for future sessions */
1454
2259
  initializeWorkspace(params: InitializeWorkspaceParams): Promise<InitializeWorkspaceResponse>;
1455
2260
  /** Models resource for getting available models */
@@ -1472,6 +2277,36 @@ interface ClientSessionsResource {
1472
2277
  uploadFile(params: UploadFileParams): Promise<UploadFileResponse>;
1473
2278
  /** Search for files in the workspace (for LocalAgentProvider) */
1474
2279
  searchFile(params: SearchFileParams): Promise<SearchFileResponse>;
2280
+ /** Batch toggle plugins (for LocalAgentProvider) */
2281
+ batchTogglePlugins(request: BatchPluginOperationRequest): Promise<BatchPluginOperationResult>;
2282
+ /** Get installed plugins (for LocalAgentProvider) */
2283
+ getInstalledPlugins?(forceRefresh?: boolean): Promise<Array<{
2284
+ name: string;
2285
+ marketplaceName: string;
2286
+ status: string;
2287
+ description?: string;
2288
+ version?: string;
2289
+ installScope?: 'user' | 'project';
2290
+ }>>;
2291
+ /** Install plugins (for LocalAgentProvider) */
2292
+ installPlugins(pluginNames: string[], marketplaceName: string, installScope?: 'user' | 'project'): Promise<{
2293
+ success: boolean;
2294
+ error?: string;
2295
+ }>;
2296
+ /**
2297
+ * Get support scenes from backend API (for LocalAgentProvider)
2298
+ * API 端点: GET /v2/as/support/scenes (Local) 或 GET /console/as/support/scenes (Web)
2299
+ */
2300
+ getSupportScenes(): Promise<Array<{
2301
+ id: number;
2302
+ name: string;
2303
+ plugins: Array<{
2304
+ id: number;
2305
+ name: string;
2306
+ marketplaceName: string;
2307
+ }>;
2308
+ prompts: string[];
2309
+ }>>;
1475
2310
  }
1476
2311
  /**
1477
2312
  * Workspace information (aligned with FolderSelectResult)
@@ -1683,19 +2518,21 @@ declare class CloudAgentConnection implements AgentConnection {
1683
2518
  //#endregion
1684
2519
  //#region ../agent-provider/lib/common/providers/cloud-agent-provider/api-types.d.ts
1685
2520
  /**
1686
- * Response for archive agent
1687
- * POST /v2/cloudagent/agentmgmt/agents/{id}/archive
2521
+ * Response for update conversation
2522
+ * POST /console/as/conversations/{id}
2523
+ * Required fields: id
1688
2524
  */
1689
- interface ArchiveAgentResponse {
1690
- /** Agent ID */
2525
+ interface PatchConversationResponse {
2526
+ /** Conversation ID (required) */
1691
2527
  id: string;
1692
2528
  }
1693
2529
  /**
1694
- * Response for rename agent
1695
- * PATCH /v2/cloudagent/agentmgmt/agents/{id}
2530
+ * Response for archive conversation
2531
+ * POST /console/as/conversations/{id}/archive
2532
+ * Required fields: id
1696
2533
  */
1697
- interface RenameAgentResponse {
1698
- /** Agent ID */
2534
+ interface ArchiveConversationResponse {
2535
+ /** Conversation ID (required) */
1699
2536
  id: string;
1700
2537
  }
1701
2538
  //#endregion
@@ -1712,21 +2549,21 @@ interface CloudAgentProviderOptions {
1712
2549
  headers?: Record<string, string>;
1713
2550
  /** Logger instance */
1714
2551
  logger?: Logger;
1715
- /** Custom fetch implementation */
1716
- fetch?: typeof fetch;
1717
2552
  /** Client capabilities (sent during agent initialization) */
1718
2553
  clientCapabilities?: ClientCapabilities$1;
1719
2554
  }
1720
2555
  /**
1721
2556
  * CloudAgentProvider - Manages cloud-hosted agents via REST API
1722
2557
  *
1723
- * API Endpoints:
1724
- * - POST {endpoint}/console/cloudagent/agentmgmt/agents - Create new agent
1725
- * - GET {endpoint}/console/cloudagent/agentmgmt/agents/{id} - Get agent data
1726
- * - GET {endpoint}/console/cloudagent/agentmgmt/agents - List all agents
1727
- * - POST {endpoint}/console/cloudagent/agentmgmt/agents/{id}/delete - Delete agent
1728
- * - GET {endpoint}/console/cloudagent/agentmgmt/agents/{id}/session - Get agent session (includes sandboxId)
1729
- * - GET {endpoint}/console/cloudagent/agentmgmt/models - Get available models
2558
+ * API Endpoints (base path: /console/as):
2559
+ * - POST {endpoint}/console/as/conversations - Create new conversation
2560
+ * - GET {endpoint}/console/as/conversations/{id} - Get conversation details
2561
+ * - GET {endpoint}/console/as/conversations - List all conversations
2562
+ * - POST {endpoint}/console/as/conversations/{id}/delete - Delete conversation
2563
+ * - POST {endpoint}/console/as/conversations/{id}/archive - Archive conversation
2564
+ * - POST {endpoint}/console/as/conversations/{id} - Update conversation (rename)
2565
+ * - GET {endpoint}/console/as/conversations/{id}/session - Get conversation session (includes sandboxId)
2566
+ * - GET {endpoint}/console/enterprises/{id}/models - Get available models
1730
2567
  *
1731
2568
  * The provider stores agent endpoint configurations in the cloud backend.
1732
2569
  * When connect() is called, it creates a CloudAgentConnection to the agent's
@@ -1789,7 +2626,7 @@ interface CloudAgentProviderOptions {
1789
2626
  declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>, FilesystemProvider {
1790
2627
  private options;
1791
2628
  private logger?;
1792
- private fetchImpl;
2629
+ private requestInterceptorId;
1793
2630
  /** Cache for filesystem instances (keyed by agentId) */
1794
2631
  private filesystemCache;
1795
2632
  /** Cache for agent connections (keyed by endpoint link) */
@@ -1832,7 +2669,7 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
1832
2669
  /**
1833
2670
  * Get sandbox information from backend
1834
2671
  *
1835
- * Uses GET {endpoint}/console/cloudagent/agentmgmt/agents/{agentId}/session
2672
+ * Uses GET {endpoint}/console/as/conversations/{agentId}/session
1836
2673
  * to retrieve sandbox information. Extracts sandboxId from the session response
1837
2674
  * and constructs the apiUrl for E2B proxy.
1838
2675
  *
@@ -1852,8 +2689,8 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
1852
2689
  */
1853
2690
  list(options?: ListAgentOptions): Promise<ListAgentResult<CloudAgentState>>;
1854
2691
  /**
1855
- * Create a new agent
1856
- * POST {endpoint}/console/cloudagent/agentmgmt/agents
2692
+ * Create a new conversation
2693
+ * POST {endpoint}/console/as/conversations
1857
2694
  */
1858
2695
  create(): Promise<string>;
1859
2696
  /**
@@ -1874,51 +2711,51 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
1874
2711
  */
1875
2712
  connect(agentId: string): Promise<CloudAgentConnection>;
1876
2713
  /**
1877
- * Delete an agent by ID
1878
- * POST {endpoint}/console/cloudagent/agentmgmt/agents/{agentId}/delete
2714
+ * Delete a conversation by ID
2715
+ * POST {endpoint}/console/as/conversations/{agentId}/delete
1879
2716
  */
1880
2717
  delete(agentId: string): Promise<boolean>;
1881
2718
  /**
1882
- * Archive an agent by ID
1883
- * POST {endpoint}/console/cloudagent/agentmgmt/agents/{agentId}/archive
2719
+ * Archive a conversation by ID
2720
+ * POST {endpoint}/console/as/conversations/{agentId}/archive
1884
2721
  *
1885
- * @param agentId - Agent ID to archive
1886
- * @returns ArchiveAgentResponse containing the archived agent ID
2722
+ * @param agentId - Conversation ID to archive
2723
+ * @returns ArchiveConversationResponse containing the archived conversation ID
1887
2724
  *
1888
2725
  * @example
1889
2726
  * ```typescript
1890
2727
  * const result = await provider.archive('agent-123');
1891
- * console.log('Archived agent:', result.id);
2728
+ * console.log('Archived conversation:', result.id);
1892
2729
  * ```
1893
2730
  */
1894
- archive(agentId: string): Promise<ArchiveAgentResponse>;
2731
+ archive(agentId: string): Promise<ArchiveConversationResponse>;
1895
2732
  /**
1896
- * Rename an agent by ID
1897
- * PATCH {endpoint}/v2/cloudagent/agentmgmt/agents/{agentId}
2733
+ * Rename a conversation by ID
2734
+ * POST {endpoint}/console/as/conversations/{agentId}
1898
2735
  *
1899
- * @param agentId - Agent ID to rename
1900
- * @param title - New title for the agent
1901
- * @returns RenameAgentResponse containing the renamed agent ID
2736
+ * @param agentId - Conversation ID to rename
2737
+ * @param title - New title for the conversation
2738
+ * @returns PatchConversationResponse containing the renamed conversation ID
1902
2739
  *
1903
2740
  * @example
1904
2741
  * ```typescript
1905
2742
  * const result = await provider.rename('agent-123', 'New Title');
1906
- * console.log('Renamed agent:', result.id);
2743
+ * console.log('Renamed conversation:', result.id);
1907
2744
  * ```
1908
2745
  */
1909
- rename(agentId: string, title: string): Promise<RenameAgentResponse>;
2746
+ rename(agentId: string, title: string): Promise<PatchConversationResponse>;
1910
2747
  /**
1911
2748
  * Get available models from product configuration
1912
2749
  *
1913
- * GET {endpoint}/v3/config?repos[]={repo}
2750
+ * GET {endpoint}/console/enterprises/{personal|enterpriseId}/models?repos[]={repo}
1914
2751
  *
1915
- * This method fetches the product configuration from /v3/config API
2752
+ * This method fetches the models from /console/enterprises API
1916
2753
  * and extracts the models array from the response.
1917
2754
  *
1918
2755
  * @param repo - Optional repository URL for context-specific config
1919
2756
  * @returns Array of ModelInfo with full model details
1920
2757
  */
1921
- getModels(repo?: string): Promise<ModelInfo$1[]>;
2758
+ getModels(repo?: string): Promise<ModelInfo[]>;
1922
2759
  /**
1923
2760
  * Generate a unique request ID
1924
2761
  */
@@ -1963,8 +2800,19 @@ declare class CloudAgentProvider implements AgentProvider<CloudAgentConnection>,
1963
2800
  * @param args - Event arguments
1964
2801
  */
1965
2802
  private emitEvent;
2803
+ /**
2804
+ * 获取支持的场景列表
2805
+ * API 端点: GET /console/as/support/scenes
2806
+ * 用于 Welcome 页面的 QuickActions 快捷操作
2807
+ *
2808
+ * @returns Promise<SupportScene[]> 支持的场景列表
2809
+ */
2810
+ getSupportScenes(): Promise<SupportScene[]>;
1966
2811
  private toAgentState;
1967
- private request;
2812
+ /**
2813
+ * Helper: 将 GET 请求的 body 转换为 URL 查询参数
2814
+ */
2815
+ private buildGetUrl;
1968
2816
  }
1969
2817
  //#endregion
1970
2818
  //#region ../agent-provider/lib/common/providers/cloud-agent-provider/e2b-filesystem.d.ts
@@ -2145,6 +2993,8 @@ declare class ActiveSessionImpl implements ActiveSession {
2145
2993
  private _agentId;
2146
2994
  private _availableModes?;
2147
2995
  private _currentMode?;
2996
+ private _availableModels?;
2997
+ private _currentModelId?;
2148
2998
  private _availableCommands;
2149
2999
  private logger?;
2150
3000
  private connection;
@@ -2202,6 +3052,14 @@ declare class ActiveSessionImpl implements ActiveSession {
2202
3052
  * Current session mode
2203
3053
  */
2204
3054
  get currentMode(): string | undefined;
3055
+ /**
3056
+ * Available models for this session
3057
+ */
3058
+ get availableModels(): ModelInfo[] | undefined;
3059
+ /**
3060
+ * Current model ID
3061
+ */
3062
+ get currentModelId(): string | undefined;
2205
3063
  /**
2206
3064
  * Available slash commands
2207
3065
  *
@@ -2209,6 +3067,10 @@ declare class ActiveSessionImpl implements ActiveSession {
2209
3067
  * Commands can be accessed directly without waiting for events.
2210
3068
  */
2211
3069
  get availableCommands(): AvailableCommand[];
3070
+ /**
3071
+ * Set available commands (called when available_commands_update is received)
3072
+ */
3073
+ setAvailableCommands(commands: AvailableCommand[]): void;
2212
3074
  /**
2213
3075
  * Check if the session is active
2214
3076
  */
@@ -2222,6 +3084,10 @@ declare class ActiveSessionImpl implements ActiveSession {
2222
3084
  * Set session modes (called after create/load)
2223
3085
  */
2224
3086
  setModes(availableModes?: SessionMode[], currentMode?: string): void;
3087
+ /**
3088
+ * Set available models (called after create/load)
3089
+ */
3090
+ setModels(availableModels?: ModelInfo[], currentModelId?: string): void;
2225
3091
  private createAgentOperations;
2226
3092
  private createPromptsResource;
2227
3093
  private createArtifactsResource;
@@ -2324,271 +3190,87 @@ declare class ActiveSessionImpl implements ActiveSession {
2324
3190
  * // ... use session
2325
3191
  * } // session automatically disposed
2326
3192
  * ```
2327
- */
2328
- [Symbol.dispose](): void;
2329
- private getConnectionOrThrow;
2330
- private setupConnectionEvents;
2331
- private mapPromptResponse;
2332
- }
2333
- //#endregion
2334
- //#region ../agent-provider/lib/common/client/session-manager.d.ts
2335
- /**
2336
- * Options for creating a SessionManager instance
2337
- */
2338
- interface SessionManagerOptions {
2339
- /** Agent provider (required) */
2340
- provider: AgentProvider;
2341
- /** Logger instance */
2342
- logger?: Logger;
2343
- }
2344
- /**
2345
- * SessionManager - Session lifecycle management
2346
- *
2347
- * This class manages the relationship between sessions and agents.
2348
- * Since the backend is agent-centric, SessionManager handles the mapping:
2349
- * - Sessions are views over agents
2350
- * - sessionId may equal agentId in simple cases
2351
- *
2352
- * Features:
2353
- * - Session caching: reuses existing ActiveSession instances
2354
- * - Automatic cleanup on session disconnect
2355
- *
2356
- * @example
2357
- * ```typescript
2358
- * const manager = new SessionManager({ provider, logger });
2359
- *
2360
- * // List sessions
2361
- * const sessions = await manager.listSessions();
2362
- *
2363
- * // Create new session
2364
- * const session = await manager.createSession({ cwd: '/workspace' });
2365
- *
2366
- * // Load existing session (returns cached instance if available)
2367
- * const loaded = await manager.loadSession({ sessionId: 'xxx', cwd: '/workspace' });
2368
- * ```
2369
- */
2370
- declare class SessionManager {
2371
- private provider;
2372
- private logger?;
2373
- constructor(options: SessionManagerOptions);
2374
- /**
2375
- * List all sessions with pagination info (mapped from agents)
2376
- *
2377
- * Each agent maps to a session. The sessionId is derived from the agent.
2378
- * Cloud: Returns server-side filtered/sorted/paginated results
2379
- * Local: Returns client-side filtered/sorted results (synthetic pagination)
2380
- *
2381
- * @param options - Optional query parameters for filtering, sorting, and pagination
2382
- */
2383
- listSessions(options?: ListAgentOptions): Promise<ListAgentResult<SessionInfo>>;
2384
- /**
2385
- * Create a new session
2386
- *
2387
- * Steps:
2388
- * 1. Create new agent (if provider supports it) or use existing
2389
- * 2. Connect to agent
2390
- * 3. Call ACP newSession
2391
- * 4. Register session mapping (for LocalAgentProvider)
2392
- * 5. Return ActiveSession instance
2393
- */
2394
- createSession(params: CreateSessionParams$1): Promise<ActiveSession>;
2395
- /**
2396
- * Load an existing session
2397
- *
2398
- * Steps:
2399
- * 1. Check cache for existing session
2400
- * 2. Find agent by sessionId (sessionId === agentId in current design)
2401
- * 3. Connect to agent
2402
- * 4. Call ACP loadSession
2403
- * 5. Return ActiveSession instance (cached)
2404
- */
2405
- loadSession(params: LoadSessionParams$1): Promise<ActiveSession>;
2406
- }
2407
- //#endregion
2408
- //#region ../agent-provider/lib/backend/types.d.ts
2409
- /**
2410
- * Backend Provider 类型定义
2411
- *
2412
- * 定义 IBackendProvider 接口和配置
2413
- */
2414
- /**
2415
- * 账号版本类型
2416
- */
2417
- type Edition = 'pro' | 'personal' | 'ultimate' | 'exclusive';
2418
- /**
2419
- * 版本展示类型(用于 UI 展示)
2420
- * - free: 免费版(个人版未订阅 Pro)
2421
- * - pro: Pro 版(个人版已订阅 Pro)
2422
- * - ultimate: 旗舰版(团队版)
2423
- * - exclusive: 专享版(企业版)
2424
- */
2425
- type EditionDisplayType = 'free' | 'pro' | 'ultimate' | 'exclusive';
2426
- /**
2427
- * 部署状态
2428
- */
2429
- interface DeployStatus {
2430
- statusCode: number;
2431
- statusMsg: string;
2432
- detailMsg: string;
2433
- }
2434
- /**
2435
- * 套餐代码
2436
- */
2437
- /**
2438
- * TCACA_code_001_PqouKr6QWV CodeBuddy海外版免费包
2439
- * TCACA_code_002_AkiJS3ZHF5 CodeBuddy海外版Pro版本包-包月/CodeBuddy Pro Plan - Monthly:
2440
- * TCACA_code_006_DbXS0lrypC CodeBuddy海外版一次性免费赠送2周的Pro版本包/CodeBuddy One-time Free 2-Week Pro Plan Trial
2441
- * TCACA_code_007_nzdH5h4Nl0 CodeBuddy海外版运营裂变包/CodeBuddy Growth Plan
2442
- * TCACA_code_003_FAnt7lcmRT CodeBuddy海外版Pro版本包-包年/CodeBuddy Pro Plan - Yearly
2443
- * TCACA_code_008_cfWoLwvjU4 赠送月包
2444
- */
2445
- declare enum CommodityCode {
2446
- free = "TCACA_code_001_PqouKr6QWV",
2447
- // free
2448
- proMon = "TCACA_code_002_AkiJS3ZHF5",
2449
- proMonPlus = "TCACA_code_005_maRGyrHhw1",
2450
- gift = "TCACA_code_006_DbXS0lrypC",
2451
- activity = "TCACA_code_007_nzdH5h4Nl0",
2452
- proYear = "TCACA_code_003_FAnt7lcmRT",
2453
- freeMon = "TCACA_code_008_cfWoLwvjU4",
2454
- // free
2455
- extra = "TCACA_code_009_0XmEQc2xOf"
2456
- }
2457
- /**
2458
- * 账号套餐信息
2459
- */
2460
- interface AccountPlan {
2461
- /** 是否是 Pro 版本 */
2462
- isPro: boolean;
2463
- isTria?: boolean;
2464
- /** 到期时间戳 */
2465
- expireAt?: number;
2466
- refreshAt?: number;
2467
- /** 自动续费标志 0-关闭 1-开启 */
2468
- renewFlag: 0 | 1;
2469
- /** 套餐代码 */
2470
- PackageCode?: CommodityCode;
2471
- /** 套餐名称 */
2472
- name: string;
2473
- usageTotal?: string;
2474
- usageUsed?: string;
2475
- usageLeft?: string;
2476
- }
2477
- /**
2478
- * 账号信息
2479
- */
2480
- interface Account {
2481
- /** 用户ID(唯一标识) */
2482
- uid: string;
2483
- /** 用户昵称 */
2484
- nickname: string;
2485
- /** 版本类型 */
2486
- type: Edition;
2487
- /** 版本展示类型(用于 UI 展示) */
2488
- editionType: EditionDisplayType;
2489
- /** 是否最后一次登录 */
2490
- lastLogin: boolean;
2491
- /** 企业ID */
2492
- enterpriseId?: string;
2493
- /** 企业名称 */
2494
- enterpriseName?: string;
2495
- /** 企业LOGO */
2496
- enterpriseLogo?: string;
2497
- /** 企业内用户名 */
2498
- enterpriseUserName?: string;
2499
- /** 插件是否启用 */
2500
- pluginEnabled?: boolean;
2501
- /** 部署状态 */
2502
- deployStatus?: DeployStatus;
2503
- /** 是否是 Pro 版本 */
2504
- isPro?: boolean;
2505
- /** 到期时间戳 */
2506
- expireAt?: string | number;
2507
- /** 自动续费标志 0-关闭 1-开启 */
2508
- renewFlag?: 0 | 1;
2509
- /** 套餐代码 */
2510
- PackageCode?: CommodityCode;
2511
- /** 套餐名称 */
2512
- name?: string;
2513
- email?: string;
2514
- }
2515
- /**
2516
- * 推理配置
2517
- */
2518
- interface ReasoningConfig {
2519
- /** 推理努力程度 */
2520
- effort: 'low' | 'medium' | 'high';
2521
- /** 摘要模式 */
2522
- summary: 'auto' | 'always' | 'never';
2523
- }
2524
- /**
2525
- * 模型信息
2526
- */
2527
- interface ModelInfo {
2528
- /** 模型ID */
2529
- id: string;
2530
- /** 模型名称 */
2531
- name: string;
2532
- /** 供应商 */
2533
- vendor: string;
2534
- /** 最大输出 token 数 */
2535
- maxOutputTokens: number;
2536
- /** 最大输入 token 数 */
2537
- maxInputTokens: number;
2538
- /** 是否支持工具调用 */
2539
- supportsToolCall: boolean;
2540
- /** 是否支持图像 */
2541
- supportsImages: boolean;
2542
- /** 是否禁用多模态 */
2543
- disabledMultimodal: boolean;
2544
- /** 最大允许大小 */
2545
- maxAllowedSize: number;
2546
- /** 是否支持推理 */
2547
- supportsReasoning: boolean;
2548
- /** 是否仅推理模式 */
2549
- onlyReasoning: boolean;
2550
- /** 温度参数 */
2551
- temperature: number;
2552
- /** 推理配置 */
2553
- reasoning: ReasoningConfig;
2554
- /** 英文描述 */
2555
- descriptionEn: string;
2556
- /** 中文描述 */
2557
- descriptionZh: string;
3193
+ */
3194
+ [Symbol.dispose](): void;
3195
+ private getConnectionOrThrow;
3196
+ private setupConnectionEvents;
3197
+ private mapPromptResponse;
2558
3198
  }
3199
+ //#endregion
3200
+ //#region ../agent-provider/lib/common/client/session-manager.d.ts
2559
3201
  /**
2560
- * Backend Provider 配置选项
3202
+ * Options for creating a SessionManager instance
2561
3203
  */
2562
- interface BackendProviderConfig {
2563
- /** API 基础 URL (例如: https://api.example.com) */
2564
- baseUrl: string;
2565
- /** 认证 Token */
2566
- authToken?: string;
3204
+ interface SessionManagerOptions {
3205
+ /** Agent provider (required) */
3206
+ provider: AgentProvider;
3207
+ /** Logger instance */
3208
+ logger?: Logger;
2567
3209
  }
2568
3210
  /**
2569
- * IBackendProvider 接口
3211
+ * SessionManager - Session lifecycle management
2570
3212
  *
2571
- * 定义与后端 API 交互的抽象接口
3213
+ * This class manages the relationship between sessions and agents.
3214
+ * Since the backend is agent-centric, SessionManager handles the mapping:
3215
+ * - Sessions are views over agents
3216
+ * - sessionId may equal agentId in simple cases
2572
3217
  *
2573
- * 注意:getAgents 和 getModels 方法已废弃并移除,
2574
- * 请使用 IAgentAdapter 中的对应方法
3218
+ * Features:
3219
+ * - Session caching: reuses existing ActiveSession instances
3220
+ * - Automatic cleanup on session disconnect
3221
+ *
3222
+ * @example
3223
+ * ```typescript
3224
+ * const manager = new SessionManager({ provider, logger });
3225
+ *
3226
+ * // List sessions
3227
+ * const sessions = await manager.listSessions();
3228
+ *
3229
+ * // Create new session
3230
+ * const session = await manager.createSession({ cwd: '/workspace' });
3231
+ *
3232
+ * // Load existing session (returns cached instance if available)
3233
+ * const loaded = await manager.loadSession({ sessionId: 'xxx', cwd: '/workspace' });
3234
+ * ```
2575
3235
  */
2576
- interface IBackendProvider {
3236
+ declare class SessionManager {
3237
+ private provider;
3238
+ private logger?;
3239
+ constructor(options: SessionManagerOptions);
2577
3240
  /**
2578
- * 获取当前账号信息
2579
- * @returns Promise<Account | null> 账号信息,未登录时返回 null
3241
+ * List all sessions with pagination info (mapped from agents)
3242
+ *
3243
+ * Each agent maps to a session. The sessionId is derived from the agent.
3244
+ * Cloud: Returns server-side filtered/sorted/paginated results
3245
+ * Local: Returns client-side filtered/sorted results (synthetic pagination)
3246
+ *
3247
+ * @param options - Optional query parameters for filtering, sorting, and pagination
2580
3248
  */
2581
- getAccount(): Promise<Account | null>;
3249
+ listSessions(options?: ListAgentOptions): Promise<ListAgentResult<SessionInfo>>;
2582
3250
  /**
2583
- * 触发登录流程
2584
- * - Web 环境: 跳转到登录页面
2585
- * - IDE 环境: 通过 IPC 通知 IDE 打开登录流程
3251
+ * Create a new session
3252
+ *
3253
+ * Steps:
3254
+ * 1. Create new agent (if provider supports it) or use existing
3255
+ * 2. Connect to agent
3256
+ * 3. Call ACP newSession
3257
+ * 4. Register session mapping (for LocalAgentProvider)
3258
+ * 5. Return ActiveSession instance
2586
3259
  */
2587
- login(): Promise<void>;
3260
+ createSession(params: CreateSessionParams$1): Promise<ActiveSession>;
2588
3261
  /**
2589
- * 登出账号
3262
+ * Load an existing session
3263
+ *
3264
+ * Steps:
3265
+ * 1. Check cache for existing session
3266
+ * 2. Find agent by sessionId (sessionId === agentId in current design)
3267
+ * 3. Connect to agent
3268
+ * 4. Create ActiveSession instance
3269
+ * 5. Execute onSessionCreated callback (if provided) to allow early setup (e.g., event listeners)
3270
+ * 6. Call ACP loadSession
3271
+ * 7. Return ActiveSession instance (cached)
2590
3272
  */
2591
- logout(): Promise<void>;
3273
+ loadSession(params: LoadSessionParams$1): Promise<ActiveSession>;
2592
3274
  }
2593
3275
  //#endregion
2594
3276
  //#region ../agent-provider/lib/backend/backend-provider.d.ts
@@ -2598,13 +3280,12 @@ interface IBackendProvider {
2598
3280
  * 职责:
2599
3281
  * - 触发登录/登出流程
2600
3282
  * - 获取 account 后自动同步到 accountService
3283
+ * - 使用单例 httpService 进行所有 HTTP 请求
2601
3284
  *
2602
3285
  * 注意:getAgents 和 getModels 方法已废弃并移除,
2603
3286
  * 请使用 IAgentAdapter 中的对应方法
2604
3287
  */
2605
3288
  declare class BackendProvider implements IBackendProvider {
2606
- private readonly baseUrl;
2607
- private readonly authToken?;
2608
3289
  constructor(config: BackendProviderConfig);
2609
3290
  /**
2610
3291
  * 获取当前账号信息
@@ -2620,12 +3301,87 @@ declare class BackendProvider implements IBackendProvider {
2620
3301
  * 5. 同步到 accountService
2621
3302
  */
2622
3303
  getAccount(): Promise<Account | null>;
3304
+ /**
3305
+ * 获取用户连接器列表
3306
+ * API 端点: GET /console/as/connector/user/
3307
+ */
3308
+ getUserConnector(): Promise<ListUserConnectorResponse>;
3309
+ /**
3310
+ * 修改用户连接器连接状态
3311
+ * API 端点: PATCH /console/as/connector/user/:name/connect_status
3312
+ */
3313
+ modifyUserConnectorConnectStatus(request: ModifyUserConnectorConnectStatusRequest): Promise<void>;
3314
+ /**
3315
+ * 修改用户连接器仓库
3316
+ * API 端点: PATCH /console/as/connector/user/:name/repo/
3317
+ */
3318
+ modifyUserConnectorRepo(request: ModifyUserConnectorRepoRequest): Promise<void>;
3319
+ /**
3320
+ * 修改用户连接器激活状态
3321
+ * API 端点: PATCH /console/as/connector/user/:name/active_status
3322
+ */
3323
+ modifyUserConnectorActiveStatus(request: ModifyUserConnectorActiveStatusRequest): Promise<void>;
3324
+ /**
3325
+ * 删除用户连接器
3326
+ * API 端点: DELETE /console/as/connector/user/:name/
3327
+ */
3328
+ deleteUserConnector(name: 'github' | 'gongfeng'): Promise<void>;
3329
+ /**
3330
+ * 添加任务
3331
+ * API 端点: POST /console/as/connector/task/
3332
+ */
3333
+ addConnectorTask(request: AddTaskRequest): Promise<AddTaskResponse>;
3334
+ /**
3335
+ * 获取任务连接器列表
3336
+ * API 端点: GET /console/as/connector/task/:taskid
3337
+ */
3338
+ getTaskConnector(taskId: string): Promise<ListTaskConnectorResponse>;
3339
+ /**
3340
+ * 修改任务连接器激活状态
3341
+ * API 端点: PATCH /console/as/connector/task/:taskid/active_status
3342
+ */
3343
+ modifyTaskConnectorActiveStatus(request: ModifyTaskConnectorActiveStatusRequest): Promise<ModifyTaskConnectorActiveStatusResponse>;
3344
+ /**
3345
+ * 修改任务连接器仓库
3346
+ * API 端点: PATCH /console/as/connector/task/:taskid/repo
3347
+ */
3348
+ modifyTaskConnectorRepo(request: ModifyTaskConnectorRepoRequest): Promise<ModifyTaskConnectorRepoResponse>;
3349
+ /**
3350
+ * 根据账号类型获取用量信息并合并到账号中
3351
+ * - 企业用户:调用 getEnterpriseUsage 获取月度限额
3352
+ * - 个人用户:调用 getCurrentPlan 获取套餐信息
3353
+ */
3354
+ private enrichAccountWithUsage;
2623
3355
  /**
2624
3356
  * 获取当前套餐信息
2625
3357
  * 从计量计费接口获取用户的套餐信息
2626
3358
  * API: POST /billing/meter/get-user-resource
2627
3359
  */
2628
3360
  private getCurrentPlan;
3361
+ /**
3362
+ * 通过回调code,换token
3363
+ * @param request
3364
+ * @returns
3365
+ */
3366
+ saveOauthToken(request: SaveOauthTokenRequest): Promise<void>;
3367
+ /**
3368
+ * 获取OAuth连接器的仓库列表
3369
+ */
3370
+ getRepoList(request: GetRepoListRequest): Promise<GetRepoListResponse>;
3371
+ /**
3372
+ * 撤销OAuth连接器的所有连接
3373
+ */
3374
+ revokeAll(request: RevokeAllRequest): Promise<void>;
3375
+ /**
3376
+ * 获取 OAuth 用户信息
3377
+ * API 端点: GET /console/as/connector/oauth/:name/oauthuser
3378
+ */
3379
+ getOauthUser(request: GetOauthUserRequest): Promise<GetOauthUserResponse>;
3380
+ /**
3381
+ * 获取文件信息
3382
+ * API 端点: GET /console/as/connector/oauth/:name/file
3383
+ */
3384
+ getFile(request: GetFileRequest): Promise<GetFileResponse>;
2629
3385
  /**
2630
3386
  * 根据账号类型和 Pro 状态计算版本展示类型
2631
3387
  * - personal + isPro = 'pro'
@@ -2641,9 +3397,19 @@ declare class BackendProvider implements IBackendProvider {
2641
3397
  login(): Promise<void>;
2642
3398
  /**
2643
3399
  * 登出账号
2644
- * Web 环境: 调用登出接口并清除本地状态
3400
+ * Web 环境: 通过 iframe 访问登出 URL 清除 cookie
2645
3401
  */
2646
3402
  logout(): Promise<void>;
3403
+ /**
3404
+ * 批量切换插件状态
3405
+ * Web 环境不支持此功能
3406
+ */
3407
+ batchTogglePlugins(request: BatchPluginOperationRequest): Promise<BatchPluginOperationResult>;
3408
+ /**
3409
+ * 获取企业用户用量信息
3410
+ * API: POST /billing/meter/get-enterprise-user-usage
3411
+ */
3412
+ getEnterpriseUsage(enterpriseId: string): Promise<EnterpriseUsage | null>;
2647
3413
  }
2648
3414
  /**
2649
3415
  * 创建 BackendProvider 实例
@@ -2684,6 +3450,76 @@ declare class IPCBackendProvider implements IBackendProvider {
2684
3450
  * IDE 环境: 通过 IPC 获取账号信息,并同步到 accountService
2685
3451
  */
2686
3452
  getAccount(): Promise<Account | null>;
3453
+ /**
3454
+ * 获取用户连接器列表
3455
+ * IDE 环境: 通过 IPC 获取用户连接器列表
3456
+ */
3457
+ getUserConnector(): Promise<ListUserConnectorResponse>;
3458
+ /**
3459
+ * 修改用户连接器连接状态
3460
+ * IDE 环境: 通过 IPC 修改用户连接器连接状态
3461
+ */
3462
+ modifyUserConnectorConnectStatus(request: ModifyUserConnectorConnectStatusRequest): Promise<void>;
3463
+ /**
3464
+ * 修改用户连接器仓库
3465
+ * IDE 环境: 通过 IPC 修改用户连接器仓库
3466
+ */
3467
+ modifyUserConnectorRepo(request: ModifyUserConnectorRepoRequest): Promise<void>;
3468
+ /**
3469
+ * 修改用户连接器激活状态
3470
+ * IDE 环境: 通过 IPC 修改用户连接器激活状态
3471
+ */
3472
+ modifyUserConnectorActiveStatus(request: ModifyUserConnectorActiveStatusRequest): Promise<void>;
3473
+ /**
3474
+ * 删除用户连接器
3475
+ * IDE 环境: 通过 IPC 删除用户连接器
3476
+ */
3477
+ deleteUserConnector(name: 'github' | 'gongfeng'): Promise<void>;
3478
+ /**
3479
+ * 添加任务
3480
+ * IDE 环境: 通过 IPC 添加任务
3481
+ */
3482
+ addConnectorTask(request: AddTaskRequest): Promise<AddTaskResponse>;
3483
+ /**
3484
+ * 获取任务连接器列表
3485
+ * IDE 环境: 通过 IPC 获取任务连接器列表
3486
+ */
3487
+ getTaskConnector(taskId: string): Promise<ListTaskConnectorResponse>;
3488
+ /**
3489
+ * 修改任务连接器激活状态
3490
+ * IDE 环境: 通过 IPC 修改任务连接器激活状态
3491
+ */
3492
+ modifyTaskConnectorActiveStatus(request: ModifyTaskConnectorActiveStatusRequest): Promise<ModifyTaskConnectorActiveStatusResponse>;
3493
+ /**
3494
+ * 修改任务连接器仓库
3495
+ * IDE 环境: 通过 IPC 修改任务连接器仓库
3496
+ */
3497
+ modifyTaskConnectorRepo(request: ModifyTaskConnectorRepoRequest): Promise<ModifyTaskConnectorRepoResponse>;
3498
+ /**
3499
+ * 获取 OAuth 用户信息
3500
+ * IDE 环境: 通过 IPC 获取 OAuth 用户信息
3501
+ */
3502
+ getOauthUser(request: GetOauthUserRequest): Promise<GetOauthUserResponse>;
3503
+ /**
3504
+ * 通过回调code,换token
3505
+ * IDE 环境: 通过 IPC 保存 OAuth Token
3506
+ */
3507
+ saveOauthToken(request: SaveOauthTokenRequest): Promise<void>;
3508
+ /**
3509
+ * 获取OAuth连接器的仓库列表
3510
+ * IDE 环境: 通过 IPC 获取仓库列表
3511
+ */
3512
+ getRepoList(request: GetRepoListRequest): Promise<GetRepoListResponse>;
3513
+ /**
3514
+ * 撤销OAuth连接器的所有连接
3515
+ * IDE 环境: 通过 IPC 撤销所有连接
3516
+ */
3517
+ revokeAll(request: RevokeAllRequest): Promise<void>;
3518
+ /**
3519
+ * 获取文件信息
3520
+ * IDE 环境: 通过 IPC 获取文件信息
3521
+ */
3522
+ getFile(request: GetFileRequest): Promise<GetFileResponse>;
2687
3523
  /**
2688
3524
  * 触发登录流程
2689
3525
  * IDE 环境: 通过 IPC 通知 IDE 打开登录流程
@@ -2694,6 +3530,36 @@ declare class IPCBackendProvider implements IBackendProvider {
2694
3530
  * IDE 环境: 通过 IPC 通知 IDE 登出
2695
3531
  */
2696
3532
  logout(): Promise<void>;
3533
+ /**
3534
+ * 重新加载窗口
3535
+ * IDE 环境: 通过 IPC 通知 IDE 重新加载窗口(用于应用语言设置等)
3536
+ * @param params 可选参数,如 locale
3537
+ */
3538
+ reloadWindow(params?: {
3539
+ locale?: string;
3540
+ }): Promise<void>;
3541
+ /**
3542
+ * 关闭 Agent Manager 面板
3543
+ * IDE 环境: 通过 IPC 通知 IDE 关闭 Agent Manager(用于返回 IDE)
3544
+ */
3545
+ closeAgentManager(): Promise<void>;
3546
+ /**
3547
+ * 批量切换插件状态
3548
+ * IDE 环境: 通过 IPC 调用 Extension Host 的 PluginService
3549
+ */
3550
+ batchTogglePlugins(request: BatchPluginOperationRequest): Promise<BatchPluginOperationResult>;
3551
+ /**
3552
+ * 获取支持的场景列表
3553
+ * IDE 环境: 通过 IPC 调用后端 API
3554
+ * 用于 Welcome 页面的 QuickActions 快捷操作
3555
+ *
3556
+ * 调用链:
3557
+ * 1. agent-ui: IPCBackendProvider.getSupportScenes()
3558
+ * 2. Extension Host: BackendBridgeService.handleGetSupportScenes()
3559
+ * 3. Backend API: GET /v2/as/support/scenes
3560
+ * 4. 返回 SupportScene[] 数据给 agent-ui
3561
+ */
3562
+ getSupportScenes(): Promise<SupportScene[]>;
2697
3563
  /**
2698
3564
  * 调试日志
2699
3565
  */
@@ -2704,5 +3570,248 @@ declare class IPCBackendProvider implements IBackendProvider {
2704
3570
  */
2705
3571
  declare function createIPCBackendProvider(config: IPCBackendProviderConfig): IPCBackendProvider;
2706
3572
  //#endregion
2707
- 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 };
3573
+ //#region ../agent-provider/lib/http/types.d.ts
3574
+ /**
3575
+ * HttpService 配置
3576
+ */
3577
+ interface HttpServiceConfig {
3578
+ /** API 基础 URL(可选,可后续通过 setBaseURL 设置) */
3579
+ baseURL?: string;
3580
+ /** 认证 token(可选) */
3581
+ authToken?: string;
3582
+ /** 请求超时时间(毫秒),默认 60000 */
3583
+ timeout?: number;
3584
+ /** 是否携带凭证,默认 true */
3585
+ withCredentials?: boolean;
3586
+ /** 自定义 headers */
3587
+ headers?: Record<string, string>;
3588
+ }
3589
+ /**
3590
+ * 请求拦截器函数
3591
+ */
3592
+ type RequestInterceptor = (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>;
3593
+ /**
3594
+ * 请求错误拦截器函数
3595
+ */
3596
+ type RequestErrorInterceptor = (error: any) => any;
3597
+ /**
3598
+ * 响应拦截器函数
3599
+ */
3600
+ type ResponseInterceptor = (response: AxiosResponse) => AxiosResponse | Promise<AxiosResponse>;
3601
+ /**
3602
+ * 响应错误拦截器函数
3603
+ */
3604
+ type ResponseErrorInterceptor = (error: AxiosError) => any;
3605
+ /**
3606
+ * 401 未授权回调函数
3607
+ */
3608
+ type UnauthorizedCallback = () => void;
3609
+ //#endregion
3610
+ //#region ../agent-provider/lib/http/http-service.d.ts
3611
+ /**
3612
+ * HttpService - 单例 HTTP 客户端
3613
+ *
3614
+ * 特性:
3615
+ * - 单例模式,全局唯一实例,延迟初始化(首次使用时自动创建)
3616
+ * - 支持拦截器注册(其他模块可注入 header)
3617
+ * - 统一 401/403 处理
3618
+ * - 自动携带凭证(withCredentials)
3619
+ * - 类型安全
3620
+ *
3621
+ * @example
3622
+ * ```typescript
3623
+ * // 直接使用导出的 httpService(首次使用时自动初始化)
3624
+ * import { httpService } from '@genie/agent-provider';
3625
+ *
3626
+ * // 按需设置 baseURL
3627
+ * httpService.setBaseURL('https://api.example.com');
3628
+ *
3629
+ * // 按需设置 authToken
3630
+ * httpService.setAuthToken('your-token');
3631
+ *
3632
+ * // 注册请求拦截器(注入 header)
3633
+ * httpService.registerRequestInterceptor((config) => {
3634
+ * config.headers['X-Enterprise-Id'] = 'enterprise-123';
3635
+ * return config;
3636
+ * });
3637
+ *
3638
+ * // 注册 401 回调
3639
+ * httpService.onUnauthorized(() => {
3640
+ * console.log('User unauthorized');
3641
+ * window.location.href = '/login';
3642
+ * });
3643
+ *
3644
+ * // 发起请求
3645
+ * const data = await httpService.get<Account>('/console/accounts');
3646
+ * ```
3647
+ */
3648
+ declare class HttpService {
3649
+ private static instance;
3650
+ private axiosInstance;
3651
+ private unauthorizedCallbacks;
3652
+ private config;
3653
+ /**
3654
+ * 私有构造函数(单例模式)
3655
+ */
3656
+ private constructor();
3657
+ /**
3658
+ * 获取单例实例(延迟初始化)
3659
+ */
3660
+ static getInstance(): HttpService;
3661
+ /**
3662
+ * 重置单例实例(主要用于测试)
3663
+ */
3664
+ static resetInstance(): void;
3665
+ /**
3666
+ * 注册默认请求拦截器(添加 Authorization header)
3667
+ */
3668
+ private registerDefaultRequestInterceptor;
3669
+ /**
3670
+ * 注册默认响应拦截器(处理 401/403)
3671
+ */
3672
+ private registerDefaultResponseInterceptor;
3673
+ /**
3674
+ * 注册请求拦截器
3675
+ * @param onFulfilled 请求成功拦截器
3676
+ * @param onRejected 请求失败拦截器
3677
+ * @returns 拦截器 ID(用于移除)
3678
+ *
3679
+ * @example
3680
+ * ```typescript
3681
+ * const id = httpService.registerRequestInterceptor((config) => {
3682
+ * config.headers['X-Custom-Header'] = 'value';
3683
+ * return config;
3684
+ * });
3685
+ *
3686
+ * // 移除拦截器
3687
+ * httpService.ejectRequestInterceptor(id);
3688
+ * ```
3689
+ */
3690
+ registerRequestInterceptor(onFulfilled: RequestInterceptor, onRejected?: RequestErrorInterceptor): number;
3691
+ /**
3692
+ * 注册响应拦截器
3693
+ * @param onFulfilled 响应成功拦截器
3694
+ * @param onRejected 响应失败拦截器
3695
+ * @returns 拦截器 ID(用于移除)
3696
+ *
3697
+ * @example
3698
+ * ```typescript
3699
+ * const id = httpService.registerResponseInterceptor((response) => {
3700
+ * console.log('Response:', response.data);
3701
+ * return response;
3702
+ * });
3703
+ *
3704
+ * // 移除拦截器
3705
+ * httpService.ejectResponseInterceptor(id);
3706
+ * ```
3707
+ */
3708
+ registerResponseInterceptor(onFulfilled: ResponseInterceptor, onRejected?: ResponseErrorInterceptor): number;
3709
+ /**
3710
+ * 移除请求拦截器
3711
+ * @param id 拦截器 ID
3712
+ */
3713
+ ejectRequestInterceptor(id: number): void;
3714
+ /**
3715
+ * 移除响应拦截器
3716
+ * @param id 拦截器 ID
3717
+ */
3718
+ ejectResponseInterceptor(id: number): void;
3719
+ /**
3720
+ * 注册 401 未授权回调
3721
+ * @param callback 回调函数
3722
+ *
3723
+ * @example
3724
+ * ```typescript
3725
+ * httpService.onUnauthorized(() => {
3726
+ * console.log('User logged out');
3727
+ * window.location.href = '/login';
3728
+ * });
3729
+ * ```
3730
+ */
3731
+ onUnauthorized(callback: UnauthorizedCallback): void;
3732
+ /**
3733
+ * 移除 401 未授权回调
3734
+ * @param callback 回调函数
3735
+ */
3736
+ offUnauthorized(callback: UnauthorizedCallback): void;
3737
+ /**
3738
+ * 触发所有 401 回调
3739
+ */
3740
+ private triggerUnauthorizedCallbacks;
3741
+ /**
3742
+ * 更新 authToken
3743
+ * @param token 新的 token
3744
+ */
3745
+ setAuthToken(token: string | undefined): void;
3746
+ /**
3747
+ * 更新 baseURL
3748
+ * @param baseURL 新的 baseURL
3749
+ */
3750
+ setBaseURL(baseURL: string): void;
3751
+ /**
3752
+ * GET 请求
3753
+ * @param url 请求路径
3754
+ * @param config axios 配置
3755
+ * @returns 响应数据
3756
+ */
3757
+ get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
3758
+ /**
3759
+ * POST 请求
3760
+ * @param url 请求路径
3761
+ * @param data 请求体
3762
+ * @param config axios 配置
3763
+ * @returns 响应数据
3764
+ */
3765
+ post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
3766
+ /**
3767
+ * PATCH 请求
3768
+ * @param url 请求路径
3769
+ * @param data 请求体
3770
+ * @param config axios 配置
3771
+ * @returns 响应数据
3772
+ */
3773
+ patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
3774
+ /**
3775
+ * DELETE 请求
3776
+ * @param url 请求路径
3777
+ * @param config axios 配置
3778
+ * @returns 响应数据
3779
+ */
3780
+ delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
3781
+ /**
3782
+ * PUT 请求
3783
+ * @param url 请求路径
3784
+ * @param data 请求体
3785
+ * @param config axios 配置
3786
+ * @returns 响应数据
3787
+ */
3788
+ put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
3789
+ /**
3790
+ * 获取原始 axios 实例(用于高级场景)
3791
+ */
3792
+ getAxiosInstance(): AxiosInstance;
3793
+ }
3794
+ //#endregion
3795
+ //#region ../agent-provider/lib/http/index.d.ts
3796
+ /**
3797
+ * 导出 httpService 单例实例
3798
+ * 首次访问时自动初始化,无需手动调用初始化方法
3799
+ *
3800
+ * @example
3801
+ * ```typescript
3802
+ * import { httpService } from '@genie/agent-provider';
3803
+ *
3804
+ * // 按需设置 baseURL
3805
+ * httpService.setBaseURL('https://api.example.com');
3806
+ *
3807
+ * // 按需设置 authToken
3808
+ * httpService.setAuthToken('your-token');
3809
+ *
3810
+ * // 直接使用
3811
+ * const data = await httpService.get('/api/endpoint');
3812
+ * ```
3813
+ */
3814
+ declare const httpService: HttpService;
3815
+ //#endregion
3816
+ 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, HttpService, type HttpServiceConfig, type IBackendProvider, IPCBackendProvider, type ListAgentFilter, type ListAgentOptions, type ListAgentSort, type Logger, type McpServerConfig, type ModelInfo, type PromptContentBlock, type PromptParams, type PromptsResource, type ReasoningConfig, type RequestErrorInterceptor, type RequestInterceptor, type ResponseErrorInterceptor, type ResponseInterceptor, type Session, type SessionAgentOperations, type SessionConnectionInfo, type SessionEventHandler, type SessionEvents, type SessionInfo, SessionManager, type SessionMode, type UnauthorizedCallback, type WatchOpts, type WriteEntry, createBackendProvider, createIPCBackendProvider, httpService, isCloudAgentState };
2708
3817
  //# sourceMappingURL=index.d.cts.map