@convai/web-sdk 1.9.0-beta.1 → 1.9.0-beta.2
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/core/AudioManager.d.ts +3 -3
- package/dist/core/AudioManager.js +1 -1
- package/dist/core/CharacterRoster.d.ts +1 -1
- package/dist/core/CharacterVersionManager.d.ts +2 -2
- package/dist/core/CharacterVersionManager.js +1 -1
- package/dist/core/ConnectionStateHandler.d.ts +1 -1
- package/dist/core/ConvaiClient.d.ts +6 -6
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +34 -28
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/MemoryManager.d.ts +1 -1
- package/dist/core/MessageHandler.d.ts +7 -4
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +68 -43
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/SSESession.d.ts +7 -8
- package/dist/core/SSESession.d.ts.map +1 -1
- package/dist/core/SSESession.js +225 -11
- package/dist/core/SSESession.js.map +1 -1
- package/dist/core/ScreenShareManager.d.ts +2 -2
- package/dist/core/ScreenShareManager.js +2 -2
- package/dist/core/VideoManager.d.ts +2 -2
- package/dist/core/VideoManager.js +3 -3
- package/dist/core/connectRequest.d.ts +1 -1
- package/dist/core/contextUpdateRequest.d.ts +1 -1
- package/dist/core/index.d.ts +25 -23
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +19 -18
- package/dist/core/index.js.map +1 -1
- package/dist/core/modelOutput.d.ts +2 -2
- package/dist/core/publishedChat.d.ts +1 -1
- package/dist/core/rosterRequest.d.ts +1 -1
- package/dist/core/rosterRequest.js +1 -1
- package/dist/core/rtviEnvelope.d.ts +6 -0
- package/dist/core/rtviEnvelope.d.ts.map +1 -0
- package/dist/core/rtviEnvelope.js +10 -0
- package/dist/core/rtviEnvelope.js.map +1 -0
- package/dist/core/types.d.ts +27 -9
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/videoSourceState.d.ts +1 -1
- package/dist/core/visionRequest.d.ts +1 -1
- package/dist/embed/ConvaiChatElement.js +2 -2
- package/dist/embed/browser.d.ts +2 -2
- package/dist/embed/browser.js +3 -3
- package/dist/embed/chat-embed-v1.js +14 -14
- package/dist/embed/chat-embed-v1.js.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +2 -2
- package/dist/lipsync-helpers/createBlendshapeQueue.js +2 -2
- package/dist/lipsync-helpers/declarativeMapping.d.ts +1 -1
- package/dist/lipsync-helpers/declarativeMapping.js +2 -2
- package/dist/lipsync-helpers/index.d.ts +12 -12
- package/dist/lipsync-helpers/index.js +9 -9
- package/dist/lipsync-helpers/mhaLimitDrivers.js +2 -2
- package/dist/lipsync-helpers/naturalness/processor.d.ts +1 -1
- package/dist/lipsync-helpers/naturalness/processor.js +1 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts +1 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.js +1 -1
- package/dist/lipsync-helpers/presetMappers.d.ts +1 -1
- package/dist/react/components/ConvaiWidget.d.ts +11 -2
- package/dist/react/components/ConvaiWidget.d.ts.map +1 -1
- package/dist/react/components/ConvaiWidget.js +7 -7
- package/dist/react/components/ConvaiWidget.js.map +1 -1
- package/dist/react/components/index.d.ts +1 -1
- package/dist/react/components/index.js +1 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +1 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +4 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.js +5 -5
- package/dist/react/components/rtc-widget/components/ConviMessage.js.map +1 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.js +3 -3
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +7 -0
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +13 -9
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.js +1 -1
- package/dist/react/components/rtc-widget/components/MessageList.d.ts +5 -2
- package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/MessageList.js +6 -6
- package/dist/react/components/rtc-widget/components/MessageList.js.map +1 -1
- package/dist/react/components/rtc-widget/components/SiteCard.d.ts +15 -0
- package/dist/react/components/rtc-widget/components/SiteCard.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/SiteCard.js +35 -0
- package/dist/react/components/rtc-widget/components/SiteCard.js.map +1 -0
- package/dist/react/components/rtc-widget/components/UserMessage.js +3 -3
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +4 -4
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +3 -3
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +4 -4
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +3 -3
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +3 -3
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +5 -5
- package/dist/react/components/rtc-widget/components/conviComponents/index.js +5 -5
- package/dist/react/components/rtc-widget/components/index.d.ts +8 -8
- package/dist/react/components/rtc-widget/components/index.js +9 -9
- package/dist/react/components/rtc-widget/index.d.ts +5 -5
- package/dist/react/components/rtc-widget/index.js +3 -3
- package/dist/react/components/rtc-widget/styles/icons.d.ts +1 -1
- package/dist/react/components/rtc-widget/styles/icons.js +1 -1
- package/dist/react/components/rtc-widget/styles/index.d.ts +5 -5
- package/dist/react/components/rtc-widget/styles/index.js +4 -4
- package/dist/react/components/rtc-widget/styles/styledComponents.js +1 -1
- package/dist/react/hooks/index.d.ts +3 -3
- package/dist/react/hooks/index.js +3 -3
- package/dist/react/hooks/useCharacterInfo.js +1 -1
- package/dist/react/hooks/useConvaiClient.d.ts +1 -1
- package/dist/react/hooks/useConvaiClient.js +1 -1
- package/dist/react/index.d.ts +13 -11
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +10 -9
- package/dist/react/index.js.map +1 -1
- package/dist/utils/lightbox.js +2 -2
- package/dist/utils/linkPresentation.d.ts +7 -0
- package/dist/utils/linkPresentation.d.ts.map +1 -1
- package/dist/utils/linkPresentation.js +58 -1
- package/dist/utils/linkPresentation.js.map +1 -1
- package/dist/utils/linkPreview.d.ts +46 -0
- package/dist/utils/linkPreview.d.ts.map +1 -0
- package/dist/utils/linkPreview.js +72 -0
- package/dist/utils/linkPreview.js.map +1 -0
- package/dist/vanilla/AudioRenderer.js +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +76 -9
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/WebSocketSession.d.ts +1 -1
- package/dist/vanilla/WebSocketSession.js +1 -1
- package/dist/vanilla/index.d.ts +13 -11
- package/dist/vanilla/index.d.ts.map +1 -1
- package/dist/vanilla/index.js +9 -8
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vanilla/types.d.ts +11 -2
- package/dist/vanilla/types.d.ts.map +1 -1
- package/dist/vanilla/types.js.map +1 -1
- package/dist/vanilla/websocket.d.ts +1 -1
- package/dist/vanilla/websocket.js +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* await memoryManager.deleteAllMemories();
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
import { MemoryAddResponse, MemoryListResponse, MemoryGetResponse, MemoryDeleteResponse, MemoryDeleteAllResponse } from './types
|
|
30
|
+
import { MemoryAddResponse, MemoryListResponse, MemoryGetResponse, MemoryDeleteResponse, MemoryDeleteAllResponse } from './types';
|
|
31
31
|
/**
|
|
32
32
|
* MemoryManager class for handling Convai Memory API operations.
|
|
33
33
|
* Provides methods to add, list, get, and delete memories for a character.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Room } from "livekit-client";
|
|
2
|
-
import { ChatMessage } from "./types
|
|
3
|
-
import { EventEmitter } from "./EventEmitter
|
|
4
|
-
import { BlendshapeQueue } from "./BlendshapeQueue
|
|
2
|
+
import { ChatMessage, SSERequestContext } from "./types";
|
|
3
|
+
import { EventEmitter } from "./EventEmitter";
|
|
4
|
+
import { BlendshapeQueue } from "./BlendshapeQueue";
|
|
5
5
|
/**
|
|
6
6
|
* Handles incoming messages from Convai
|
|
7
7
|
* Processes various message types from the AI assistant and updates chat history
|
|
@@ -90,6 +90,9 @@ export declare class MessageHandler extends EventEmitter {
|
|
|
90
90
|
* Handle incoming data message
|
|
91
91
|
*/
|
|
92
92
|
private handleDataReceived;
|
|
93
|
+
private _handleTurnCompleted;
|
|
94
|
+
private _handleNoResponse;
|
|
95
|
+
private _handleServerResponse;
|
|
93
96
|
private _handleActionResponse;
|
|
94
97
|
private _handleModelOutput;
|
|
95
98
|
private _clearModelOutputReplayLedger;
|
|
@@ -100,7 +103,7 @@ export declare class MessageHandler extends EventEmitter {
|
|
|
100
103
|
/**
|
|
101
104
|
* Public entry point for WebSocket transport to inject messages into the same pipeline.
|
|
102
105
|
*/
|
|
103
|
-
handleDataReceivedPublic(payload: Uint8Array, transport?: "websocket" | "sse"): void;
|
|
106
|
+
handleDataReceivedPublic(payload: Uint8Array, transport?: "websocket" | "sse", sseRequest?: SSERequestContext): void;
|
|
104
107
|
/** Append a submitted text message without waiting for a server echo. */
|
|
105
108
|
addUserTextMessage(text: string): void;
|
|
106
109
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/core/MessageHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAa,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,WAAW,
|
|
1
|
+
{"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/core/MessageHandler.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RoomEvent } from "livekit-client";
|
|
2
|
-
import { EventEmitter } from "./EventEmitter
|
|
3
|
-
import { extractModelOutputPayload, parseModelOutputMessage, } from "./modelOutput
|
|
4
|
-
import { isValidLogicalTurnId, isValidOutputId } from "./logicalTurn
|
|
5
|
-
import {
|
|
2
|
+
import { EventEmitter } from "./EventEmitter";
|
|
3
|
+
import { extractModelOutputPayload, parseModelOutputMessage, } from "./modelOutput";
|
|
4
|
+
import { isValidLogicalTurnId, isValidOutputId } from "./logicalTurn";
|
|
5
|
+
import { unwrapRTVIEvent } from "./rtviEnvelope";
|
|
6
|
+
import { BlendshapeQueue, } from "./BlendshapeQueue";
|
|
6
7
|
function stableJsonFingerprint(value) {
|
|
7
8
|
if (Array.isArray(value)) {
|
|
8
9
|
return `[${value.map(stableJsonFingerprint).join(",")}]`;
|
|
@@ -192,7 +193,7 @@ export class MessageHandler extends EventEmitter {
|
|
|
192
193
|
/**
|
|
193
194
|
* Handle incoming data message
|
|
194
195
|
*/
|
|
195
|
-
handleDataReceived(payload, _participant, transport = "livekit") {
|
|
196
|
+
handleDataReceived(payload, _participant, transport = "livekit", sseRequest) {
|
|
196
197
|
let messageString = "";
|
|
197
198
|
let parsed = false;
|
|
198
199
|
try {
|
|
@@ -505,15 +506,12 @@ export class MessageHandler extends EventEmitter {
|
|
|
505
506
|
// separate event: a completed REST turn must not be represented as a
|
|
506
507
|
// synthetic bot-llm-stopped message.
|
|
507
508
|
case "bot-turn-completed": {
|
|
508
|
-
|
|
509
|
-
if (finalizedMessages.length > 0) {
|
|
510
|
-
this.emit("messagesChange", this.chatMessages, undefined, finalizedMessages);
|
|
511
|
-
}
|
|
512
|
-
this.isBotResponding = false;
|
|
513
|
-
this.emit("botRespondingChange", false);
|
|
514
|
-
this.emit("botTurnCompleted", messageData.data ?? {});
|
|
509
|
+
this._handleTurnCompleted(messageData.data ?? {}, transport, sseRequest);
|
|
515
510
|
break;
|
|
516
511
|
}
|
|
512
|
+
case "llm-no-response":
|
|
513
|
+
this._handleNoResponse(timestamp, transport, sseRequest);
|
|
514
|
+
break;
|
|
517
515
|
// User Transcription Messages
|
|
518
516
|
case "user-transcription":
|
|
519
517
|
if (messageData.data?.text) {
|
|
@@ -788,14 +786,10 @@ export class MessageHandler extends EventEmitter {
|
|
|
788
786
|
break;
|
|
789
787
|
}
|
|
790
788
|
case "llm-no-response":
|
|
791
|
-
this.
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
content: "",
|
|
796
|
-
timestamp,
|
|
797
|
-
});
|
|
798
|
-
this.emit("messagesChange", this.chatMessages);
|
|
789
|
+
this._handleNoResponse(timestamp, transport, sseRequest);
|
|
790
|
+
break;
|
|
791
|
+
case "bot-turn-completed":
|
|
792
|
+
this._handleTurnCompleted(unwrapRTVIEvent("server-message", serverData).data, transport, sseRequest);
|
|
799
793
|
break;
|
|
800
794
|
// Action Response (WebSocket/RTVI path — wrapped in server-message)
|
|
801
795
|
case "action-response":
|
|
@@ -803,17 +797,7 @@ export class MessageHandler extends EventEmitter {
|
|
|
803
797
|
break;
|
|
804
798
|
// Server acknowledgment — arrives wrapped in server-message envelope
|
|
805
799
|
case "server-response": {
|
|
806
|
-
|
|
807
|
-
// "Unknown message type" error for it which is expected and harmless.
|
|
808
|
-
if (serverData.event_type === "client-ready")
|
|
809
|
-
break;
|
|
810
|
-
const serverResponse = {
|
|
811
|
-
event_type: serverData.event_type ?? "unknown",
|
|
812
|
-
status: serverData.status ?? "error",
|
|
813
|
-
message: serverData.message ?? null,
|
|
814
|
-
extras: serverData.extras ?? null,
|
|
815
|
-
};
|
|
816
|
-
this.emit("serverResponse", serverResponse);
|
|
800
|
+
this._handleServerResponse(serverData, transport === "sse" ? sseRequest : undefined);
|
|
817
801
|
break;
|
|
818
802
|
}
|
|
819
803
|
/**
|
|
@@ -857,17 +841,9 @@ export class MessageHandler extends EventEmitter {
|
|
|
857
841
|
}
|
|
858
842
|
}
|
|
859
843
|
break;
|
|
860
|
-
//
|
|
844
|
+
// SSE carries the acknowledgement in data; legacy realtime may flatten it.
|
|
861
845
|
case "server-response": {
|
|
862
|
-
|
|
863
|
-
break;
|
|
864
|
-
const serverResponse = {
|
|
865
|
-
event_type: messageData.event_type ?? "unknown",
|
|
866
|
-
status: messageData.status ?? "error",
|
|
867
|
-
message: messageData.message ?? null,
|
|
868
|
-
extras: messageData.extras ?? null,
|
|
869
|
-
};
|
|
870
|
-
this.emit("serverResponse", serverResponse);
|
|
846
|
+
this._handleServerResponse(messageData, transport === "sse" ? sseRequest : undefined);
|
|
871
847
|
break;
|
|
872
848
|
}
|
|
873
849
|
// Silently ignore other message types
|
|
@@ -883,6 +859,55 @@ export class MessageHandler extends EventEmitter {
|
|
|
883
859
|
// Silently handle parse errors
|
|
884
860
|
}
|
|
885
861
|
}
|
|
862
|
+
_handleTurnCompleted(data, transport, request) {
|
|
863
|
+
const finalizedMessages = this.finalizeStreamingBotMessages(transport === "sse");
|
|
864
|
+
if (finalizedMessages.length > 0) {
|
|
865
|
+
this.emit("messagesChange", this.chatMessages, undefined, finalizedMessages);
|
|
866
|
+
}
|
|
867
|
+
this.isBotResponding = false;
|
|
868
|
+
this.emit("botRespondingChange", false);
|
|
869
|
+
this.emit("botTurnCompleted", data, transport === "sse" ? request : undefined);
|
|
870
|
+
}
|
|
871
|
+
_handleNoResponse(timestamp, transport, request) {
|
|
872
|
+
// SSE abstention is the request terminal. Realtime keeps its existing
|
|
873
|
+
// independently-delivered lifecycle/streaming cleanup behavior.
|
|
874
|
+
const finalizedMessages = transport === "sse" ? this.finalizeStreamingBotMessages(true) : [];
|
|
875
|
+
if (transport === "sse") {
|
|
876
|
+
this.isBotResponding = false;
|
|
877
|
+
this.emit("botRespondingChange", false);
|
|
878
|
+
}
|
|
879
|
+
if (transport === "sse")
|
|
880
|
+
this.emit("llmNoResponse", request);
|
|
881
|
+
else
|
|
882
|
+
this.emit("llmNoResponse");
|
|
883
|
+
this.chatMessages.push({
|
|
884
|
+
id: `llm-no-response-${Date.now()}-${Math.random()}`,
|
|
885
|
+
type: "llm-no-response", content: "", timestamp,
|
|
886
|
+
});
|
|
887
|
+
if (transport === "sse")
|
|
888
|
+
this.emit("messagesChange", this.chatMessages, undefined, finalizedMessages);
|
|
889
|
+
else
|
|
890
|
+
this.emit("messagesChange", this.chatMessages);
|
|
891
|
+
}
|
|
892
|
+
_handleServerResponse(envelope, request) {
|
|
893
|
+
const response = envelope.data !== null && typeof envelope.data === "object"
|
|
894
|
+
&& !Array.isArray(envelope.data)
|
|
895
|
+
? envelope.data
|
|
896
|
+
: envelope;
|
|
897
|
+
// client-ready is an internal RTVI handshake whose rejection is harmless.
|
|
898
|
+
if (response.event_type === "client-ready")
|
|
899
|
+
return;
|
|
900
|
+
const serverResponse = {
|
|
901
|
+
event_type: response.event_type ?? "unknown",
|
|
902
|
+
status: response.status ?? "error",
|
|
903
|
+
message: response.message ?? null,
|
|
904
|
+
extras: response.extras ?? null,
|
|
905
|
+
};
|
|
906
|
+
if (request)
|
|
907
|
+
this.emit("serverResponse", serverResponse, request);
|
|
908
|
+
else
|
|
909
|
+
this.emit("serverResponse", serverResponse);
|
|
910
|
+
}
|
|
886
911
|
_handleActionResponse(actions, messageId, timestamp) {
|
|
887
912
|
// model-output v2 is canonical. action-response remains a compatibility
|
|
888
913
|
// projection and executing both would duplicate the same operation.
|
|
@@ -986,8 +1011,8 @@ export class MessageHandler extends EventEmitter {
|
|
|
986
1011
|
/**
|
|
987
1012
|
* Public entry point for WebSocket transport to inject messages into the same pipeline.
|
|
988
1013
|
*/
|
|
989
|
-
handleDataReceivedPublic(payload, transport = "websocket") {
|
|
990
|
-
this.handleDataReceived(payload, null, transport);
|
|
1014
|
+
handleDataReceivedPublic(payload, transport = "websocket", sseRequest) {
|
|
1015
|
+
this.handleDataReceived(payload, null, transport, sseRequest);
|
|
991
1016
|
}
|
|
992
1017
|
/** Append a submitted text message without waiting for a server echo. */
|
|
993
1018
|
addUserTextMessage(text) {
|