@waniwani/sdk 0.21.5 → 0.22.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/chat/embed.js +53 -53
- package/dist/chat/embed.js.map +1 -1
- package/dist/chat/index.d.ts +28 -0
- package/dist/chat/index.js +10 -7
- package/dist/chat/index.js.map +1 -1
- package/package.json +1 -1
package/dist/chat/index.d.ts
CHANGED
|
@@ -590,6 +590,11 @@ interface ChatBaseProps {
|
|
|
590
590
|
apiKey?: string;
|
|
591
591
|
/** Chat API endpoint URL. Defaults to Waniwani hosted endpoint */
|
|
592
592
|
api?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Builds the transport turns are sent through. Defaults to the chat's own
|
|
595
|
+
* HTTP transport to `api`, which it also hands the factory as `fallback`.
|
|
596
|
+
*/
|
|
597
|
+
transport?: ChatTransportFactory;
|
|
593
598
|
/** Pre-loaded messages to display when the chat mounts. */
|
|
594
599
|
initialMessages?: ai.UIMessage[];
|
|
595
600
|
/** Initial greeting shown before user types */
|
|
@@ -869,6 +874,23 @@ interface ChatHandle {
|
|
|
869
874
|
eventId: string;
|
|
870
875
|
}>;
|
|
871
876
|
}
|
|
877
|
+
/** What the chat hands a transport factory. */
|
|
878
|
+
interface ChatTransportContext {
|
|
879
|
+
/** The chat's HTTP transport to `api`. */
|
|
880
|
+
fallback: ai.ChatTransport<ai.UIMessage>;
|
|
881
|
+
headers: () => Record<string, string> | undefined;
|
|
882
|
+
/** The channel and visitor a turn is attributed to. */
|
|
883
|
+
body: () => Record<string, unknown>;
|
|
884
|
+
/** True while the thread needs what only `fallback` carries: attachments, model context, saved history. */
|
|
885
|
+
needsFallback: () => boolean;
|
|
886
|
+
onSession: (sessionId: string) => void;
|
|
887
|
+
}
|
|
888
|
+
/** Optional hooks the chat calls on a transport: ahead of the first message, and on unmount. */
|
|
889
|
+
interface ChatTransportLifecycle {
|
|
890
|
+
prepare?(): void;
|
|
891
|
+
dispose?(): void;
|
|
892
|
+
}
|
|
893
|
+
type ChatTransportFactory = (context: ChatTransportContext) => ai.ChatTransport<ai.UIMessage> & ChatTransportLifecycle;
|
|
872
894
|
|
|
873
895
|
type ModelContextContentBlock = ContentBlock;
|
|
874
896
|
type ModelContextUpdate = {
|
|
@@ -1153,6 +1175,12 @@ interface WaniwaniChatOverrides {
|
|
|
1153
1175
|
api?: string;
|
|
1154
1176
|
/** Override the MCP server URL (rarely needed). */
|
|
1155
1177
|
mcpServerUrl?: string;
|
|
1178
|
+
/**
|
|
1179
|
+
* The app's agent-runtime session route (`/api/mcp/agent/session`). Set,
|
|
1180
|
+
* turns go straight to the agent runtime for a chat the route admits, and
|
|
1181
|
+
* through `api` for one it does not.
|
|
1182
|
+
*/
|
|
1183
|
+
sessionApi?: string;
|
|
1156
1184
|
/**
|
|
1157
1185
|
* AI transparency notice rendered under the input (EU AI Act compliance).
|
|
1158
1186
|
* String overrides the default wording; `false` hides it.
|