super-agent-sdk 1.0.12 → 1.0.14

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/widget.d.ts CHANGED
@@ -558,8 +558,8 @@ declare interface SuperAgentSDK {
558
558
  renameConversation(sessionId: string, title: string): Promise<void>;
559
559
  deleteConversation(sessionId: string): Promise<void>;
560
560
  getMessages(sessionId: string): Promise<UIMessage[]>;
561
- /** 响应中断事件(返回 SSE 流,后端继续推送后续事件) */
562
- respondInterrupt(interruptId: string, sessionId: string, response: InterruptResponse, onMessage?: (event: ChatEvent) => void, onError?: (error: Error) => void): Promise<void>;
561
+ /** 响应中断事件(返回 SSE 流,后端继续推送后续事件);signal 供调用方中断续流 */
562
+ respondInterrupt(interruptId: string, sessionId: string, response: InterruptResponse, onMessage?: (event: ChatEvent) => void, onError?: (error: Error) => void, signal?: AbortSignal): Promise<void>;
563
563
  setToken(token: string): void;
564
564
  /** 消息反馈(赞/踩),POST /chat/messages/{messageId}/feedback */
565
565
  feedback(messageId: string, type: "like" | "dislike", options?: {
@@ -705,6 +705,10 @@ declare interface UseChatReturn {
705
705
  stop: () => void;
706
706
  regenerate: () => void;
707
707
  setMessages: (messages: UIMessage[]) => void;
708
+ /** 会话定向展示:优先 live 缓存(in-flight 切回续看),传入 msgs 则作为缓存源(历史拉取路径) */
709
+ showSession: (sessionId: string, msgs?: UIMessage[]) => void;
710
+ /** 目标会话有 in-flight 流时返回 live 缓存(切换时免拉历史),否则 null */
711
+ getLiveMessages: (sessionId: string) => UIMessage[] | null;
708
712
  respondToInterrupt: (interruptId: string, response: InterruptResponse) => void;
709
713
  }
710
714
 
@@ -723,7 +727,9 @@ declare interface UseConversationsReturn {
723
727
  hasMore: boolean;
724
728
  loadConversations: () => Promise<void>;
725
729
  loadMore: () => Promise<void>;
726
- switchConversation: (sessionId: string) => Promise<UIMessage[]>;
730
+ switchConversation: (sessionId: string, opts?: {
731
+ fetchHistory?: boolean;
732
+ }) => Promise<UIMessage[]>;
727
733
  newConversation: () => Promise<void>;
728
734
  deleteConversation: (sessionId: string) => Promise<void>;
729
735
  renameConversation: (sessionId: string, title: string) => Promise<void>;