@waniwani/sdk 0.22.0-beta.4 → 0.22.0-beta.6

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.
@@ -3,6 +3,16 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ContentBlock } from '@modelcontextprotocol/sdk/types.js';
4
4
  import * as react from 'react';
5
5
 
6
+ /** A document the visitor uploaded through the chat widget, already stored by the platform. */
7
+ interface AttachedDocument {
8
+ /** Pass to `documents.extract({ documentId, schema })` to read it. */
9
+ documentId: string;
10
+ /** Name the visitor's file had */
11
+ filename: string;
12
+ /** MIME type the browser declared on upload */
13
+ mediaType: string;
14
+ }
15
+
6
16
  interface SearchResult {
7
17
  source: string;
8
18
  heading: string;
@@ -879,10 +889,18 @@ interface ChatTransportContext {
879
889
  /** The chat's HTTP transport to `api`. */
880
890
  fallback: ai.ChatTransport<ai.UIMessage>;
881
891
  headers: () => Record<string, string> | undefined;
882
- /** The channel and visitor a turn is attributed to. */
892
+ /** The channel, visitor and MCP `extra` a turn is attributed to. */
883
893
  body: () => Record<string, unknown>;
884
- /** True while the thread needs what only `fallback` carries: attachments, model context, saved history. */
885
- needsFallback: () => boolean;
894
+ /** Whether the chat keeps saved threads, whose messages the chat restores itself. */
895
+ threadHistory: () => boolean;
896
+ /** The active saved thread, started if there is none. Undefined without saved threads. */
897
+ threadId: () => string | undefined;
898
+ /** Whether the chat already shows messages the transport did not restore. */
899
+ hasMessages: () => boolean;
900
+ /** The documents attached to the message being sent, handed over once. */
901
+ takeTurnInput: () => {
902
+ documents?: AttachedDocument[];
903
+ };
886
904
  onSession: (sessionId: string) => void;
887
905
  }
888
906
  /** Optional hooks the chat calls on a transport. */
@@ -893,6 +911,10 @@ interface ChatTransportLifecycle {
893
911
  restore?(): Promise<ai.UIMessage[]>;
894
912
  /** The visitor started a new conversation. */
895
913
  reset?(): void;
914
+ /** A saved thread was deleted. */
915
+ forget?(threadId: string): void;
916
+ /** Whether a page load brings the session back, which the New chat button needs. */
917
+ keepsSession?(): boolean;
896
918
  dispose?(): void;
897
919
  }
898
920
  type ChatTransportFactory = (context: ChatTransportContext) => ai.ChatTransport<ai.UIMessage> & ChatTransportLifecycle;