@iflow-ai/iflow-cli-sdk 0.1.9-beta.2 → 0.2.0-beta.0

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.ts CHANGED
@@ -258,10 +258,12 @@ export interface AuthMethodInfo {
258
258
  export interface IFlowOptions {
259
259
  url?: string;
260
260
  cwd?: string;
261
+ sessionId?: string;
261
262
  timeout?: number;
262
263
  logLevel?: keyof typeof LogLevel;
263
264
  processStartPort?: number;
264
265
  autoStartProcess?: boolean;
266
+ stream?: boolean;
265
267
  authMethodId?: string;
266
268
  authMethodInfo?: AuthMethodInfo;
267
269
  mcpServers?: MCPServerConfigs;
@@ -386,7 +388,13 @@ export declare enum MessageType {
386
388
  /** ERROR - 错误消息 */
387
389
  ERROR = "error",
388
390
  /** TASK_FINISH - 任务完成消息 */
389
- TASK_FINISH = "task_finish"
391
+ TASK_FINISH = "task_finish",
392
+ /** ASK_USER_QUESTIONS - 询问用户问题 */
393
+ ASK_USER_QUESTIONS = "ask_user_questions",
394
+ /** EXIT_PLAN_MODE - 退出计划模式 */
395
+ EXIT_PLAN_MODE = "exit_plan_mode",
396
+ /** PERMISSION_REQUEST - 权限请求 */
397
+ PERMISSION_REQUEST = "permission_request"
390
398
  }
391
399
  /**
392
400
  * 代理信息接口
@@ -473,7 +481,7 @@ export interface ToolCallMessage {
473
481
  content?: ToolCallContent;
474
482
  locations?: ToolCallLocation[];
475
483
  confirmation?: ToolCallConfirmation;
476
- args?: any;
484
+ args?: unknown;
477
485
  output?: string;
478
486
  agentId?: string;
479
487
  agentInfo?: AgentInfo;
@@ -482,13 +490,43 @@ export interface ErrorMessage {
482
490
  type: `${MessageType.ERROR}`;
483
491
  code: number;
484
492
  message: string;
485
- details?: Record<string, any>;
493
+ details?: Record<string, unknown>;
486
494
  }
487
495
  export interface TaskFinishMessage {
488
496
  type: `${MessageType.TASK_FINISH}`;
489
497
  stopReason?: `${StopReason}`;
490
498
  }
491
- export type Message = PlanMessage | UserMessage | AssistantMessage | ToolCallMessage | ErrorMessage | TaskFinishMessage;
499
+ export interface QuestionOption {
500
+ label: string;
501
+ description: string;
502
+ }
503
+ export interface Question {
504
+ question: string;
505
+ header: string;
506
+ options: QuestionOption[];
507
+ multiSelect: boolean;
508
+ }
509
+ export interface AskUserQuestionsMessage {
510
+ type: `${MessageType.ASK_USER_QUESTIONS}`;
511
+ questions: Question[];
512
+ }
513
+ export interface ExitPlanModeMessage {
514
+ type: `${MessageType.EXIT_PLAN_MODE}`;
515
+ plan: string;
516
+ }
517
+ export interface PermissionRequestMessage {
518
+ type: `${MessageType.PERMISSION_REQUEST}`;
519
+ requestId: number | string;
520
+ sessionId?: string;
521
+ toolCall: {
522
+ type?: string;
523
+ title?: string;
524
+ };
525
+ options: Array<{
526
+ optionId: string;
527
+ }>;
528
+ }
529
+ export type Message = PlanMessage | UserMessage | AssistantMessage | ToolCallMessage | ErrorMessage | TaskFinishMessage | AskUserQuestionsMessage | ExitPlanModeMessage | PermissionRequestMessage;
492
530
  export interface RawMessage {
493
531
  isControl: boolean;
494
532
  messageType: string;
@@ -497,77 +535,82 @@ export interface RawMessage {
497
535
  parsedMessage?: Message;
498
536
  timestamp: number;
499
537
  }
538
+ export type ACPRequestId = number | string;
500
539
  /**
501
- * 日志记录器配置选项
540
+ * 模式信息接口
502
541
  */
503
- export interface LoggerOptions {
504
- /** 日志级别,默认为 INFO */
505
- level?: keyof typeof LogLevel;
542
+ export interface ModeInfo {
543
+ id: string;
544
+ name: string;
545
+ description: string;
506
546
  }
507
- declare class Logger {
508
- private readonly level;
509
- constructor(options?: Partial<LoggerOptions>);
510
- debug(message: string): void;
511
- info(message: string): void;
512
- warn(message: string): void;
513
- error(message: string, error?: Error): void;
514
- private log;
547
+ /**
548
+ * 模式集合接口
549
+ */
550
+ export interface Modes {
551
+ currentModeId: string;
552
+ availableModes: ModeInfo[];
515
553
  }
516
554
  /**
517
- * Transport 类构造选项
555
+ * 模型信息接口
518
556
  */
519
- export interface TransportOptions {
520
- /** WebSocket 连接 URL */
521
- url: string;
522
- /** 日志记录器实例 */
523
- logger?: Logger;
524
- /** 连接超时时间(毫秒),默认 300000ms (5分钟) */
525
- timeout?: number;
557
+ export interface ModelInfo {
558
+ id: string;
559
+ name: string;
560
+ description: string;
526
561
  }
527
- declare class Transport {
528
- private readonly url;
529
- private readonly logger;
530
- private readonly timeout;
531
- private ws;
532
- private connected;
533
- constructor(options: TransportOptions);
534
- get isConnected(): boolean;
535
- private checkConnected;
536
- connect(): Promise<void>;
537
- close(): Promise<void>;
538
- send(data: string | object): Promise<void>;
539
- receive(): AsyncGenerator<string>;
540
- private receiveRawData;
562
+ /**
563
+ * 模型集合接口
564
+ */
565
+ export interface Models {
566
+ currentModelId: string;
567
+ availableModels: ModelInfo[];
541
568
  }
542
569
  /**
543
- * FileHandler 类构造选项
570
+ * 命令信息接口
544
571
  */
545
- export interface FileHandlerOptions {
546
- /** 工作目录,默认为当前进程工作目录 */
547
- cwd?: string;
548
- /** 日志记录器实例 */
549
- logger?: Logger;
550
- /** 只读模式,禁止写入操作 */
551
- readOnly?: boolean;
552
- /** 最大文件大小限制(字节),默认 10MB */
553
- maxFileSize?: number;
554
- /** 允许访问的目录列表,为空则允许访问所有目录 */
555
- allowedDirs?: string[];
572
+ export interface CommandInfo {
573
+ name: string;
574
+ description: string;
575
+ input?: {
576
+ hint: string;
577
+ };
578
+ _meta?: {
579
+ scope: "user" | "project";
580
+ };
556
581
  }
557
- declare class FileHandler {
558
- private readonly cwd;
559
- private readonly logger;
560
- private readonly readOnly;
561
- private readonly maxFileSize;
562
- private readonly allowedDirs;
563
- constructor(options?: FileHandlerOptions);
564
- private isPathAllowed;
565
- readFile(filePath: string, line?: number, limit?: number): Promise<string>;
566
- writeFile(filePath: string, content: string): Promise<void>;
567
- addAllowedDir(dir: string): Promise<void>;
568
- removeAllowedDir(dir: string): void;
582
+ /**
583
+ * 可用代理信息接口
584
+ */
585
+ export interface AvailableAgent {
586
+ name: string;
587
+ description: string;
588
+ _meta?: {
589
+ scope: "user" | "project";
590
+ };
591
+ }
592
+ /**
593
+ * 技能信息接口
594
+ */
595
+ export interface SkillInfo {
596
+ name: string;
597
+ description: string;
598
+ _meta?: {
599
+ scope: "user" | "project";
600
+ };
601
+ }
602
+ /**
603
+ * MCP 服务器信息接口
604
+ */
605
+ export interface McpServerInfo {
606
+ name: string;
607
+ command: string;
608
+ args: string[];
609
+ env: string[];
610
+ _meta?: {
611
+ scope: "user" | "project";
612
+ };
569
613
  }
570
- export type ACPRequestId = number | string;
571
614
  declare enum ACPSessionUpdateType {
572
615
  PLAN = "plan",
573
616
  TOOL_CALL = "tool_call",
@@ -580,6 +623,17 @@ export interface ACPInitializeResult {
580
623
  protocolVersion: number;
581
624
  isAuthenticated?: boolean;
582
625
  }
626
+ export interface ACPCreateSessionResult {
627
+ sessionId: string;
628
+ modes?: Modes;
629
+ _meta?: {
630
+ models?: Models;
631
+ availableCommands?: CommandInfo[];
632
+ availableAgents?: AvailableAgent[];
633
+ availableSkills?: SkillInfo[];
634
+ availableMcpServers?: McpServerInfo[];
635
+ };
636
+ }
583
637
  export type ACPSessionUpdateData = ACPSessionUpdatePlanData | ACPSessionUpdateToolCallData | ACPSessionUpdateToolCallUpdateData | ACPSessionUpdateUserMessageChunkData | ACPSessionUpdateAgentMessageChunkData | ACPSessionUpdateAgentThoughtChunkData;
584
638
  export interface ACPSessionUpdatePlanData {
585
639
  sessionUpdate: `${ACPSessionUpdateType.PLAN}`;
@@ -591,7 +645,7 @@ export interface ACPSessionUpdateToolCallData {
591
645
  title?: string;
592
646
  status?: `${ToolCallStatus}`;
593
647
  toolName?: string;
594
- args?: any;
648
+ args?: unknown;
595
649
  agentId?: string;
596
650
  }
597
651
  export interface ACPSessionUpdateToolCallUpdateData {
@@ -600,7 +654,7 @@ export interface ACPSessionUpdateToolCallUpdateData {
600
654
  title?: string;
601
655
  status?: `${ToolCallStatus}`;
602
656
  toolName?: string;
603
- args?: any;
657
+ args?: unknown;
604
658
  agentId?: string;
605
659
  content?: Array<{
606
660
  type: "content";
@@ -631,14 +685,129 @@ export interface ACPSessionUpdateAgentThoughtChunkData {
631
685
  text?: string;
632
686
  };
633
687
  }
634
- export interface ACPRequestPermissionParams {
635
- toolCall?: {
636
- type?: string;
637
- title?: string;
638
- };
639
- options?: Array<{
640
- optionId: string;
641
- }>;
688
+ export interface ACPQuestionOption {
689
+ label: string;
690
+ description: string;
691
+ }
692
+ export interface ACPQuestion {
693
+ question: string;
694
+ header: string;
695
+ options: ACPQuestionOption[];
696
+ multiSelect: boolean;
697
+ }
698
+ export interface ACPAskUserQuestionsParams {
699
+ sessionId: string;
700
+ questions: ACPQuestion[];
701
+ }
702
+ export interface ACPExitPlanModeParams {
703
+ sessionId: string;
704
+ plan: string;
705
+ }
706
+ /**
707
+ * setThink 操作的请求参数
708
+ */
709
+ export interface ACPSetThinkParams {
710
+ sessionId: string;
711
+ thinkEnabled: boolean;
712
+ thinkConfig?: string;
713
+ }
714
+ /**
715
+ * setThink 操作的服务器响应结果
716
+ */
717
+ export interface ACPSetThinkResult {
718
+ success: boolean;
719
+ currentThinkEnabled: boolean;
720
+ currentThinkConfig?: string;
721
+ }
722
+ /**
723
+ * IFlowClient.setThink 方法的参数类型
724
+ */
725
+ export interface SetThinkParams {
726
+ /** 是否启用思考模式 */
727
+ enabled: boolean;
728
+ /** 思考配置级别,可选值: 'think', 'megathink', 'ultrathink' */
729
+ config?: string;
730
+ }
731
+ /**
732
+ * IFlowClient.setThink 方法的返回类型
733
+ */
734
+ export interface SetThinkResult {
735
+ /** 操作是否成功 */
736
+ success: boolean;
737
+ /** 当前思考模式是否启用 */
738
+ currentThinkEnabled: boolean;
739
+ /** 当前思考配置级别 */
740
+ currentThinkConfig?: string;
741
+ }
742
+ /**
743
+ * 日志记录器配置选项
744
+ */
745
+ export interface LoggerOptions {
746
+ /** 日志级别,默认为 INFO */
747
+ level?: keyof typeof LogLevel;
748
+ }
749
+ declare class Logger {
750
+ private readonly level;
751
+ constructor(options?: Partial<LoggerOptions>);
752
+ debug(message: string): void;
753
+ info(message: string): void;
754
+ warn(message: string): void;
755
+ error(message: string, error?: Error): void;
756
+ private log;
757
+ }
758
+ /**
759
+ * Transport 类构造选项
760
+ */
761
+ export interface TransportOptions {
762
+ /** WebSocket 连接 URL */
763
+ url: string;
764
+ /** 日志记录器实例 */
765
+ logger?: Logger;
766
+ /** 连接超时时间(毫秒),默认 300000ms (5分钟) */
767
+ timeout?: number;
768
+ }
769
+ declare class Transport {
770
+ private readonly url;
771
+ private readonly logger;
772
+ private readonly timeout;
773
+ private ws;
774
+ private connected;
775
+ constructor(options: TransportOptions);
776
+ get isConnected(): boolean;
777
+ private checkConnected;
778
+ connect(): Promise<void>;
779
+ close(): Promise<void>;
780
+ send(data: string | object): Promise<void>;
781
+ receive(): AsyncGenerator<string>;
782
+ private receiveRawData;
783
+ }
784
+ /**
785
+ * FileHandler 类构造选项
786
+ */
787
+ export interface FileHandlerOptions {
788
+ /** 工作目录,默认为当前进程工作目录 */
789
+ cwd?: string;
790
+ /** 日志记录器实例 */
791
+ logger?: Logger;
792
+ /** 只读模式,禁止写入操作 */
793
+ readOnly?: boolean;
794
+ /** 最大文件大小限制(字节),默认 10MB */
795
+ maxFileSize?: number;
796
+ /** 允许访问的目录列表,为空则允许访问所有目录 */
797
+ allowedDirs?: string[];
798
+ }
799
+ declare class FileHandler {
800
+ private readonly cwd;
801
+ private readonly logger;
802
+ private readonly readOnly;
803
+ private readonly maxFileSize;
804
+ private readonly allowedDirs;
805
+ constructor(options?: FileHandlerOptions);
806
+ private isPathAllowed;
807
+ readFile(filePath: string, line?: number, limit?: number): Promise<string>;
808
+ writeFile(filePath: string, content: string): Promise<void>;
809
+ addAllowedDir(dir: string): Promise<void>;
810
+ removeAllowedDir(dir: string): void;
642
811
  }
643
812
  declare enum ProtocolMessageType {
644
813
  ERROR = "error",
@@ -648,8 +817,10 @@ declare enum ProtocolMessageType {
648
817
  SESSION_UPDATE = "session_update",
649
818
  TOOL_CALL = "tool_call",
650
819
  TOOL_UPDATE = "tool_update",
651
- TOOL_CONFIRMATION = "tool_confirmation",
652
820
  TASK_FINISH = "task_finish",
821
+ ASK_USER_QUESTIONS = "ask_user_questions",
822
+ EXIT_PLAN_MODE = "exit_plan_mode",
823
+ PERMISSION_REQUEST = "permission_request",
653
824
  UNKNOWN = "unknown"
654
825
  }
655
826
  export interface ProtocolErrorMessage {
@@ -661,7 +832,7 @@ export interface ProtocolErrorMessage {
661
832
  export interface ProtocolResponseMessage {
662
833
  type: `${ProtocolMessageType.RESPONSE}`;
663
834
  id: ACPRequestId;
664
- result: any;
835
+ result: unknown;
665
836
  }
666
837
  export interface ProtocolFileReadMessage {
667
838
  type: `${ProtocolMessageType.FILE_READ}`;
@@ -678,35 +849,48 @@ export interface ProtocolSessionUpdateMessage {
678
849
  sessionId: string;
679
850
  updateData: ACPSessionUpdateData;
680
851
  }
681
- export interface ProtocolToolConfirmationMessage {
682
- type: `${ProtocolMessageType.TOOL_CONFIRMATION}`;
683
- params: ACPRequestPermissionParams;
684
- response: {
685
- outcome: {
686
- outcome: string;
687
- optionId?: string;
688
- };
689
- };
690
- }
691
852
  export interface ProtocolToolCallMessage {
692
853
  type: `${ProtocolMessageType.TOOL_CALL}`;
693
854
  id: string;
694
- params: any;
855
+ params: unknown;
695
856
  }
696
857
  export interface ProtocolToolUpdateMessage {
697
858
  type: `${ProtocolMessageType.TOOL_UPDATE}`;
698
- params: any;
859
+ params: unknown;
699
860
  }
700
861
  export interface ProtocolTaskFinishMessage {
701
862
  type: `${ProtocolMessageType.TASK_FINISH}`;
702
- params: any;
863
+ params: unknown;
864
+ }
865
+ export interface ProtocolAskUserQuestionsMessage {
866
+ type: `${ProtocolMessageType.ASK_USER_QUESTIONS}`;
867
+ requestId: ACPRequestId;
868
+ params: ACPAskUserQuestionsParams;
869
+ }
870
+ export interface ProtocolExitPlanModeMessage {
871
+ type: `${ProtocolMessageType.EXIT_PLAN_MODE}`;
872
+ requestId: ACPRequestId;
873
+ params: ACPExitPlanModeParams;
703
874
  }
704
875
  export interface ProtocolUnknownMessage {
705
876
  type: `${ProtocolMessageType.UNKNOWN}`;
706
877
  method: string;
707
- params: any;
878
+ params: unknown;
879
+ }
880
+ export interface ProtocolPermissionRequestMessage {
881
+ type: `${ProtocolMessageType.PERMISSION_REQUEST}`;
882
+ requestId: ACPRequestId;
883
+ sessionId?: string;
884
+ toolCall: {
885
+ type?: string;
886
+ title?: string;
887
+ };
888
+ options: Array<{
889
+ optionId: string;
890
+ }>;
891
+ needsUserResponse: boolean;
708
892
  }
709
- export type ProtocolMessage = ProtocolErrorMessage | ProtocolResponseMessage | ProtocolFileReadMessage | ProtocolFileWriteMessage | ProtocolSessionUpdateMessage | ProtocolToolCallMessage | ProtocolToolUpdateMessage | ProtocolToolConfirmationMessage | ProtocolTaskFinishMessage | ProtocolUnknownMessage;
893
+ export type ProtocolMessage = ProtocolErrorMessage | ProtocolResponseMessage | ProtocolFileReadMessage | ProtocolFileWriteMessage | ProtocolSessionUpdateMessage | ProtocolToolCallMessage | ProtocolToolUpdateMessage | ProtocolTaskFinishMessage | ProtocolAskUserQuestionsMessage | ProtocolExitPlanModeMessage | ProtocolUnknownMessage | ProtocolPermissionRequestMessage;
710
894
  export interface TextPrompt {
711
895
  type: "text";
712
896
  text: string;
@@ -729,6 +913,16 @@ export interface ResourceLinkPrompt {
729
913
  size: number;
730
914
  }
731
915
  export type Prompt = TextPrompt | ImagePrompt | AudioPrompt | ResourceLinkPrompt;
916
+ export type FilePath = string;
917
+ export interface Selection {
918
+ type: "selection";
919
+ data: string;
920
+ uri: string;
921
+ line: {
922
+ start: number;
923
+ end: number;
924
+ };
925
+ }
732
926
  /**
733
927
  * Protocol 类构造选项
734
928
  */
@@ -753,6 +947,9 @@ declare class Protocol {
753
947
  private requestId;
754
948
  private initialized;
755
949
  private authenticated;
950
+ private pendingPermissionRequests;
951
+ private readonly maxPendingRequests;
952
+ private readonly requestTtl;
756
953
  constructor(options: ProtocolOptions);
757
954
  private nextRequestId;
758
955
  private checkAuthenticated;
@@ -777,7 +974,7 @@ declare class Protocol {
777
974
  commands?: CommandConfigs;
778
975
  agents?: SubAgentConfigs;
779
976
  settings?: SessionSettings;
780
- }): Promise<string>;
977
+ }): Promise<ACPCreateSessionResult>;
781
978
  loadSession(params: {
782
979
  sessionId: string;
783
980
  cwd?: string;
@@ -790,6 +987,19 @@ declare class Protocol {
790
987
  cancelSession(params: {
791
988
  sessionId: string;
792
989
  }): Promise<void>;
990
+ setMode(params: {
991
+ sessionId: string;
992
+ modeId: string;
993
+ }): Promise<string>;
994
+ setModel(params: {
995
+ sessionId: string;
996
+ modelId: string;
997
+ }): Promise<string>;
998
+ setThink(params: ACPSetThinkParams): Promise<ACPSetThinkResult>;
999
+ respondToAskUserQuestions(requestId: ACPRequestId, answers: Record<string, string | string[]>): Promise<void>;
1000
+ respondToExitPlanMode(requestId: ACPRequestId, approved: boolean): Promise<void>;
1001
+ sendPermissionResponse(requestId: ACPRequestId, optionId: string): Promise<void>;
1002
+ cancelPermissionResponse(requestId: ACPRequestId): Promise<void>;
793
1003
  handleMessages(): AsyncGenerator<ProtocolMessage>;
794
1004
  private handleClientMessage;
795
1005
  private handleReadTextFile;
@@ -799,6 +1009,8 @@ declare class Protocol {
799
1009
  private handlePushToolCall;
800
1010
  private handleUpdateToolCall;
801
1011
  private handleNotifyTaskFinish;
1012
+ private handleAskUserQuestions;
1013
+ private handleExitPlanMode;
802
1014
  private handleUnknownMessage;
803
1015
  }
804
1016
  /**
@@ -860,6 +1072,14 @@ export declare class IFlowClient {
860
1072
  private messageQueue;
861
1073
  /** 待处理的工具调用映射表,key 为工具调用 ID */
862
1074
  private pendingToolCalls;
1075
+ /** 待处理的 ask_user_questions 请求 ID */
1076
+ private pendingAskUserQuestionsRequestId;
1077
+ /** 待处理的问题列表,用于验证答案 */
1078
+ private pendingQuestions;
1079
+ /** 待处理的 exit_plan_mode 请求 ID */
1080
+ private pendingExitPlanModeRequestId;
1081
+ /** 待处理的权限请求映射表,key 为 requestId,value 为权限请求信息 */
1082
+ private pendingPermissionRequests;
863
1083
  /** WebSocket 连接 URL */
864
1084
  private url;
865
1085
  /** 当前会话 ID */
@@ -868,6 +1088,18 @@ export declare class IFlowClient {
868
1088
  private processManager;
869
1089
  /** 进程启动状态标识 */
870
1090
  private processStarted;
1091
+ /** 会话模式数据 */
1092
+ private modes;
1093
+ /** 会话模型数据 */
1094
+ private models;
1095
+ /** 可用命令列表 */
1096
+ private availableCommands;
1097
+ /** 可用代理列表 */
1098
+ private availableAgents;
1099
+ /** 可用技能列表 */
1100
+ private availableSkills;
1101
+ /** 可用 MCP 服务器列表 */
1102
+ private availableMcpServers;
871
1103
  /**
872
1104
  * 构造函数 - 创建 IFlowClient 实例
873
1105
  *
@@ -877,11 +1109,46 @@ export declare class IFlowClient {
877
1109
  connect(): Promise<void>;
878
1110
  loadSession(sessionId: string): Promise<void>;
879
1111
  disconnect(): Promise<void>;
880
- sendMessage(text: string, files?: string[]): Promise<void>;
1112
+ sendMessage(text: string, files?: Array<FilePath | ImagePrompt | Selection>): Promise<void>;
881
1113
  interrupt(): Promise<void>;
882
1114
  receiveMessages(): AsyncGenerator<Message>;
1115
+ /**
1116
+ * @deprecated 此方法已弃用。请使用 respondToToolConfirmation 方法来处理工具权限确认。
1117
+ * 该方法不会实际影响工具执行,仅从本地状态中移除记录。
1118
+ */
883
1119
  approveToolCall(toolId: string, outcome?: `${ToolCallConfirmationOutcome}`): Promise<void>;
1120
+ /**
1121
+ * @deprecated 此方法已弃用。请使用 cancelToolConfirmation 方法来处理工具权限确认。
1122
+ * 该方法不会实际影响工具执行,仅从本地状态中移除记录。
1123
+ */
884
1124
  rejectToolCall(toolId: string): Promise<void>;
1125
+ respondToAskUserQuestions(answers: Record<string, string | string[]>): Promise<void>;
1126
+ respondToExitPlanMode(approved: boolean): Promise<void>;
1127
+ respondToToolConfirmation(requestId: number | string, optionId: string): Promise<void>;
1128
+ cancelToolConfirmation(requestId: number | string): Promise<void>;
1129
+ /**
1130
+ * 配置管理器,支持获取和设置会话配置
1131
+ */
1132
+ readonly config: {
1133
+ /**
1134
+ * 获取配置值
1135
+ * @param key 配置键,支持: models, model, modes, mode, commands, agents, skills, mcpServers
1136
+ * @returns 配置值
1137
+ */
1138
+ get: <T>(key: string) => Promise<T>;
1139
+ /**
1140
+ * 设置配置值
1141
+ * @param key 配置键,支持: model, mode
1142
+ * @param value 配置值
1143
+ */
1144
+ set: <T>(key: string, value: T) => Promise<void>;
1145
+ };
1146
+ /**
1147
+ * 设置思考模式配置
1148
+ * @param params 思考配置参数
1149
+ * @returns 返回设置后的配置信息
1150
+ */
1151
+ setThink(params: SetThinkParams): Promise<SetThinkResult>;
885
1152
  protected handleMessages(): Promise<void>;
886
1153
  protected processProtocolMessage(protocolMessage: ProtocolMessage): Message | null;
887
1154
  }