@convai/web-sdk 1.8.0-beta.5 → 1.8.0-beta.7
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/README.md +333 -13
- package/dist/core/CharacterRoster.d.ts +84 -0
- package/dist/core/CharacterRoster.d.ts.map +1 -0
- package/dist/core/CharacterRoster.js +348 -0
- package/dist/core/CharacterRoster.js.map +1 -0
- package/dist/core/ConvaiClient.d.ts +152 -2
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +1036 -49
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/ConvaiRoomError.d.ts +48 -0
- package/dist/core/ConvaiRoomError.d.ts.map +1 -0
- package/dist/core/ConvaiRoomError.js +111 -0
- package/dist/core/ConvaiRoomError.js.map +1 -0
- package/dist/core/MessageHandler.d.ts +25 -0
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +431 -30
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/SSESession.d.ts +15 -0
- package/dist/core/SSESession.d.ts.map +1 -1
- package/dist/core/SSESession.js +92 -3
- package/dist/core/SSESession.js.map +1 -1
- package/dist/core/connectRequest.d.ts +38 -2
- package/dist/core/connectRequest.d.ts.map +1 -1
- package/dist/core/connectRequest.js +57 -0
- package/dist/core/connectRequest.js.map +1 -1
- package/dist/core/index.d.ts +6 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/logicalTurn.d.ts +4 -1
- package/dist/core/logicalTurn.d.ts.map +1 -1
- package/dist/core/logicalTurn.js +35 -4
- package/dist/core/logicalTurn.js.map +1 -1
- package/dist/core/modelOutput.d.ts +40 -0
- package/dist/core/modelOutput.d.ts.map +1 -0
- package/dist/core/modelOutput.js +187 -0
- package/dist/core/modelOutput.js.map +1 -0
- package/dist/core/publishedChat.d.ts +9 -0
- package/dist/core/publishedChat.d.ts.map +1 -0
- package/dist/core/publishedChat.js +13 -0
- package/dist/core/publishedChat.js.map +1 -0
- package/dist/core/rosterRequest.d.ts +57 -0
- package/dist/core/rosterRequest.d.ts.map +1 -0
- package/dist/core/rosterRequest.js +210 -0
- package/dist/core/rosterRequest.js.map +1 -0
- package/dist/core/types.d.ts +667 -10
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/embed/ConvaiChatElement.d.ts +27 -0
- package/dist/embed/ConvaiChatElement.d.ts.map +1 -0
- package/dist/embed/ConvaiChatElement.js +300 -0
- package/dist/embed/ConvaiChatElement.js.map +1 -0
- package/dist/embed/browser.d.ts +3 -0
- package/dist/embed/browser.d.ts.map +1 -0
- package/dist/embed/browser.js +5 -0
- package/dist/embed/browser.js.map +1 -0
- package/dist/embed/chat-embed-v1.js +100 -0
- package/dist/embed/chat-embed-v1.js.map +7 -0
- package/dist/embed/index.d.ts +9 -0
- package/dist/embed/index.d.ts.map +1 -0
- package/dist/embed/index.js +9 -0
- package/dist/embed/index.js.map +1 -0
- package/dist/embed/publicationApi.d.ts +23 -0
- package/dist/embed/publicationApi.d.ts.map +1 -0
- package/dist/embed/publicationApi.js +141 -0
- package/dist/embed/publicationApi.js.map +1 -0
- package/dist/react/components/ConvaiWidget.d.ts +11 -1
- package/dist/react/components/ConvaiWidget.d.ts.map +1 -1
- package/dist/react/components/ConvaiWidget.js +67 -11
- package/dist/react/components/ConvaiWidget.js.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +39 -44
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +2 -2
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +1 -1
- package/dist/react/hooks/useConvaiClient.d.ts +2 -0
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
- package/dist/react/hooks/useConvaiClient.js +16 -0
- package/dist/react/hooks/useConvaiClient.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/utils/inlineMarkdown.d.ts +38 -0
- package/dist/utils/inlineMarkdown.d.ts.map +1 -0
- package/dist/utils/inlineMarkdown.js +106 -0
- package/dist/utils/inlineMarkdown.js.map +1 -0
- package/dist/vanilla/AudioRenderer.d.ts.map +1 -1
- package/dist/vanilla/AudioRenderer.js +6 -0
- package/dist/vanilla/AudioRenderer.js.map +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +224 -89
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts +15 -0
- package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +1 -0
- package/dist/vanilla/WidgetEventSubscriptions.js +37 -0
- package/dist/vanilla/WidgetEventSubscriptions.js.map +1 -0
- package/dist/vanilla/index.d.ts +2 -1
- package/dist/vanilla/index.d.ts.map +1 -1
- package/dist/vanilla/index.js +2 -1
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vanilla/types.d.ts +8 -1
- package/dist/vanilla/types.d.ts.map +1 -1
- package/dist/vanilla/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +19 -6
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type WidgetEventListener = (...args: unknown[]) => void;
|
|
2
|
+
type SubscribeToWidgetEvent = (listener: WidgetEventListener) => (() => void) | void;
|
|
3
|
+
/**
|
|
4
|
+
* Owns widget event listeners so a destroyed widget cannot mutate detached DOM
|
|
5
|
+
* or notify its host when a client event arrives late.
|
|
6
|
+
*/
|
|
7
|
+
export declare class WidgetEventSubscriptions {
|
|
8
|
+
private readonly isDestroyed;
|
|
9
|
+
private readonly unsubscribes;
|
|
10
|
+
constructor(isDestroyed: () => boolean);
|
|
11
|
+
register(subscribe: SubscribeToWidgetEvent, listener: WidgetEventListener): void;
|
|
12
|
+
unsubscribeAll(): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=WidgetEventSubscriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WidgetEventSubscriptions.d.ts","sourceRoot":"","sources":["../../src/vanilla/WidgetEventSubscriptions.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AACxD,KAAK,sBAAsB,GAAG,CAAC,QAAQ,EAAE,mBAAmB,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;AAErF;;;GAGG;AACH,qBAAa,wBAAwB;IAGvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAFxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyB;gBAEzB,WAAW,EAAE,MAAM,OAAO;IAEvD,QAAQ,CACN,SAAS,EAAE,sBAAsB,EACjC,QAAQ,EAAE,mBAAmB,GAC5B,IAAI;IAuBP,cAAc,IAAI,IAAI;CAKvB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owns widget event listeners so a destroyed widget cannot mutate detached DOM
|
|
3
|
+
* or notify its host when a client event arrives late.
|
|
4
|
+
*/
|
|
5
|
+
export class WidgetEventSubscriptions {
|
|
6
|
+
constructor(isDestroyed) {
|
|
7
|
+
this.isDestroyed = isDestroyed;
|
|
8
|
+
this.unsubscribes = [];
|
|
9
|
+
}
|
|
10
|
+
register(subscribe, listener) {
|
|
11
|
+
if (this.isDestroyed())
|
|
12
|
+
return;
|
|
13
|
+
const unsubscribe = subscribe((...args) => {
|
|
14
|
+
if (!this.isDestroyed()) {
|
|
15
|
+
listener(...args);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
// A hand-rolled IConvaiClient (the vanilla types allow one) may return
|
|
19
|
+
// nothing from on(); there is then nothing to tear down, and that is not
|
|
20
|
+
// an error -- the isDestroyed gate above still silences its listener.
|
|
21
|
+
if (typeof unsubscribe !== "function")
|
|
22
|
+
return;
|
|
23
|
+
// The browser event loop cannot interleave normal synchronous code, but
|
|
24
|
+
// preserve the lifecycle boundary for unusual synchronous subscriptions.
|
|
25
|
+
if (this.isDestroyed()) {
|
|
26
|
+
unsubscribe();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.unsubscribes.push(unsubscribe);
|
|
30
|
+
}
|
|
31
|
+
unsubscribeAll() {
|
|
32
|
+
for (const unsubscribe of this.unsubscribes.splice(0)) {
|
|
33
|
+
unsubscribe();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=WidgetEventSubscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WidgetEventSubscriptions.js","sourceRoot":"","sources":["../../src/vanilla/WidgetEventSubscriptions.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAGnC,YAA6B,WAA0B;QAA1B,gBAAW,GAAX,WAAW,CAAe;QAFtC,iBAAY,GAAsB,EAAE,CAAC;IAEI,CAAC;IAE3D,QAAQ,CACN,SAAiC,EACjC,QAA6B;QAE7B,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO;QAE/B,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE;YACxC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACxB,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,uEAAuE;QACvE,yEAAyE;QACzE,sEAAsE;QACtE,IAAI,OAAO,WAAW,KAAK,UAAU;YAAE,OAAO;QAE9C,wEAAwE;QACxE,yEAAyE;QACzE,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,WAAW,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED,cAAc;QACZ,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACtD,WAAW,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;CACF","sourcesContent":["type WidgetEventListener = (...args: unknown[]) => void;\ntype SubscribeToWidgetEvent = (listener: WidgetEventListener) => (() => void) | void;\n\n/**\n * Owns widget event listeners so a destroyed widget cannot mutate detached DOM\n * or notify its host when a client event arrives late.\n */\nexport class WidgetEventSubscriptions {\n private readonly unsubscribes: Array<() => void> = [];\n\n constructor(private readonly isDestroyed: () => boolean) {}\n\n register(\n subscribe: SubscribeToWidgetEvent,\n listener: WidgetEventListener,\n ): void {\n if (this.isDestroyed()) return;\n\n const unsubscribe = subscribe((...args) => {\n if (!this.isDestroyed()) {\n listener(...args);\n }\n });\n\n // A hand-rolled IConvaiClient (the vanilla types allow one) may return\n // nothing from on(); there is then nothing to tear down, and that is not\n // an error -- the isDestroyed gate above still silences its listener.\n if (typeof unsubscribe !== \"function\") return;\n\n // The browser event loop cannot interleave normal synchronous code, but\n // preserve the lifecycle boundary for unusual synchronous subscriptions.\n if (this.isDestroyed()) {\n unsubscribe();\n return;\n }\n this.unsubscribes.push(unsubscribe);\n }\n\n unsubscribeAll(): void {\n for (const unsubscribe of this.unsubscribes.splice(0)) {\n unsubscribe();\n }\n }\n}\n"]}
|
package/dist/vanilla/index.d.ts
CHANGED
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
* // - client.audioControls, videoControls, etc.
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
export { ConvaiClient } from '../core/ConvaiClient.js';
|
|
31
|
+
export { ActionResultAckError, ConvaiClient } from '../core/ConvaiClient.js';
|
|
32
32
|
export { CharacterVersionManager, CharacterApiError } from '../core/CharacterVersionManager.js';
|
|
33
|
+
export { ConvaiRoomError } from '../core/ConvaiRoomError.js';
|
|
33
34
|
export { AudioRenderer } from './AudioRenderer.js';
|
|
34
35
|
export { createConvaiWidget, destroyConvaiWidget } from './ConvaiWidget.js';
|
|
35
36
|
export * from '../core/types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGzE,cAAc,eAAe,CAAC;AAG9B,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,eAAe,GAChB,MAAM,SAAS,CAAC"}
|
package/dist/vanilla/index.js
CHANGED
|
@@ -29,8 +29,9 @@
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
// Main client for managing connections
|
|
32
|
-
export { ConvaiClient } from '../core/ConvaiClient.js';
|
|
32
|
+
export { ActionResultAckError, ConvaiClient } from '../core/ConvaiClient.js';
|
|
33
33
|
export { CharacterVersionManager, CharacterApiError } from '../core/CharacterVersionManager.js';
|
|
34
|
+
export { ConvaiRoomError } from '../core/ConvaiRoomError.js';
|
|
34
35
|
// AudioRenderer for custom UI builders (handles audio playback)
|
|
35
36
|
export { AudioRenderer } from './AudioRenderer.js';
|
|
36
37
|
// Vanilla widget - complete UI solution
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vanilla/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,uCAAuC;AACvC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,gEAAgE;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,wCAAwC;AACxC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,0DAA0D;AAC1D,cAAc,eAAe,CAAC","sourcesContent":["/**\n * Convai Web SDK - Vanilla JavaScript/TypeScript Export\n * \n * This module provides vanilla JS/TS exports for the Convai SDK.\n * Use this for non-React applications.\n * \n * @example\n * ```typescript\n * import { ConvaiClient, createConvaiWidget } from '@convai/web-sdk/vanilla';\n * \n * // Pass config to constructor (same pattern as React's useConvaiClient)\n * const client = new ConvaiClient({\n * apiKey: 'your-api-key',\n * characterId: 'your-character-id',\n * enableVideo: true,\n * });\n * \n * // Create widget - auto-connects on first click\n * const widget = createConvaiWidget(document.body, {\n * convaiClient: client\n * });\n * \n * // Client has all functions for advanced usage:\n * // - client.connect() - manual connection\n * // - client.disconnect() - disconnect\n * // - client.reconnect() - reconnect\n * // - client.sendUserTextMessage() - send messages\n * // - client.audioControls, videoControls, etc.\n * ```\n */\n\n// Main client for managing connections\nexport { ActionResultAckError, ConvaiClient } from '../core/ConvaiClient';\nexport { CharacterVersionManager, CharacterApiError } from '../core/CharacterVersionManager';\nexport { ConvaiRoomError } from '../core/ConvaiRoomError';\n\n// AudioRenderer for custom UI builders (handles audio playback)\nexport { AudioRenderer } from './AudioRenderer';\n\n// Vanilla widget - complete UI solution\nexport { createConvaiWidget, destroyConvaiWidget } from './ConvaiWidget';\n\n// Re-export ALL core types for complete parity with React\nexport * from '../core/types';\n\n// Widget-specific types\nexport type {\n VanillaWidget,\n VanillaWidgetOptions,\n WidgetPlacement,\n} from './types';\n\n"]}
|
package/dist/vanilla/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { IConvaiClient, ChatMessage } from '../core/types.js';
|
|
1
|
+
import type { IConvaiClient, ChatMessage, PublishedChatConnectOptions } from '../core/types.js';
|
|
2
|
+
import type { PublishedChatDescriptor } from '../embed/publicationApi.js';
|
|
2
3
|
/** Where the widget anchors itself. `inline` renders it in normal document flow. */
|
|
3
4
|
export type WidgetPlacement = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'inline';
|
|
4
5
|
/**
|
|
@@ -67,6 +68,12 @@ export interface VanillaWidgetOptions {
|
|
|
67
68
|
* When true, the widget will open directly in voice mode with microphone enabled.
|
|
68
69
|
*/
|
|
69
70
|
defaultVoiceMode?: boolean;
|
|
71
|
+
/** Mint a fresh single-use grant when a published-chat session is reopened. */
|
|
72
|
+
requestPublicationGrant?: () => Promise<string>;
|
|
73
|
+
/** Core endpoint override used with requestPublicationGrant. */
|
|
74
|
+
publishedChatConnectOptions?: PublishedChatConnectOptions;
|
|
75
|
+
/** Public descriptor used to label a credential-free published session. */
|
|
76
|
+
publishedChatDescriptor?: Pick<PublishedChatDescriptor, 'display_name' | 'image_url'>;
|
|
70
77
|
/**
|
|
71
78
|
* Where the widget's `<style>` and `@keyframes` nodes are injected.
|
|
72
79
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IConvaiClient,\n ChatMessage,\n PublishedChatConnectOptions,\n} from '../core/types';\nimport type { PublishedChatDescriptor } from '../embed/publicationApi';\n\n/** Where the widget anchors itself. `inline` renders it in normal document flow. */\nexport type WidgetPlacement =\n | 'bottom-right'\n | 'bottom-left'\n | 'top-right'\n | 'top-left'\n | 'inline';\n\n/**\n * Options for creating a vanilla ConvaiWidget\n * \n * You can either:\n * 1. Pass an existing convaiClient instance, OR\n * 2. Pass connection config (apiKey, characterId, etc.) directly\n */\nexport interface VanillaWidgetOptions {\n /** \n * Option 1: Pass an existing Convai client instance.\n * Should be initialized with config: new ConvaiClient({ apiKey, characterId, ... })\n * The widget will auto-connect on first click.\n */\n convaiClient?: IConvaiClient & {\n activity?: string;\n chatMessages: ChatMessage[];\n /**\n * Present on the real `ConvaiClient` (it extends `EventEmitter`) and on\n * the test stubs; absent only if a caller hand-rolls a minimal\n * `IConvaiClient`. Optional so that case still type-checks -- the widget\n * calls it defensively (`client.emit?.(...)`) to surface mic-permission\n * failures on the same `error` channel `ConvaiClient` already uses.\n */\n emit?: (event: string, ...args: any[]) => void;\n };\n \n /** Option 2: Pass connection config directly (convenience shortcut). Either apiKey or authToken is required. */\n apiKey?: string;\n /** Auth token for realtime API (alternative to apiKey). See https://realtime-api.convai.com/docs */\n authToken?: string;\n characterId?: string;\n enableVideo?: boolean;\n startWithVideoOn?: boolean;\n /** Enable lipsync/facial animation blendshapes (default: false) */\n enableLipsync?: boolean;\n /** Enable emotion detection and bot-emotion updates (default: false) */\n enableEmotion?: boolean;\n /** Log incoming and outgoing decoded RTVI data messages to the browser console (default: true) */\n logRtviMessages?: boolean;\n /** Blendshape configuration for facial animation format */\n blendshapeConfig?: {\n /** Format of blendshapes: \"arkit\" or \"mha\" (Meta Human Animation, default: \"mha\") */\n format?: \"arkit\" | \"mha\";\n /** Custom mapper function to transform incoming blendshapes */\n customMapper?: (input: number[] | Float32Array) => Float32Array;\n /** Indexed NeuroSync ahead-delivery. Defaults to true; set false for the legacy paced path. */\n deliver_chunks_ahead?: boolean;\n /** Ahead-delivery timeline FPS override; ignored when deliver_chunks_ahead is false. */\n output_fps?: number;\n /** Seconds the server buffers blendshapes before releasing them. */\n frames_buffer_duration?: number;\n };\n \n /** \n * Show video toggle button in settings (default: true).\n * Only works if connection type is \"video\". If false, hides the video button.\n */\n showVideo?: boolean;\n /** \n * Show screen share toggle button in settings (default: true).\n * Only works if connection type is \"video\". If false, hides the screen share button.\n */\n showScreenShare?: boolean;\n /**\n * Start in voice mode by default when widget opens (default: true).\n * When true, the widget will open directly in voice mode with microphone enabled.\n */\n defaultVoiceMode?: boolean;\n /** Mint a fresh single-use grant when a published-chat session is reopened. */\n requestPublicationGrant?: () => Promise<string>;\n /** Core endpoint override used with requestPublicationGrant. */\n publishedChatConnectOptions?: PublishedChatConnectOptions;\n /** Public descriptor used to label a credential-free published session. */\n publishedChatDescriptor?: Pick<\n PublishedChatDescriptor,\n 'display_name' | 'image_url'\n >;\n \n /**\n * Where the widget's `<style>` and `@keyframes` nodes are injected.\n *\n * Omit it and the target is derived from `container.getRootNode()` at\n * construction time — correct only when the container is *already* inside\n * its final root. A custom element that builds its subtree first and appends\n * it to its shadow root afterwards (the usual pattern) constructs the widget\n * while the container is still detached, so the derivation sees the\n * document and the shadow root never receives the stylesheet or the `popIn`\n * keyframes — silently, with no error. Pass the shadow root here in that\n * case; when supplied it is used verbatim and no derivation happens.\n */\n styleTarget?: Document | ShadowRoot;\n\n /** Corner to anchor to, or `inline` for normal flow. Default `bottom-right`. */\n placement?: WidgetPlacement;\n\n /** Optional callbacks */\n onConnect?: () => void;\n onDisconnect?: () => void;\n onMessage?: (message: ChatMessage) => void;\n}\n\n/**\n * Vanilla ConvaiWidget instance with cleanup method\n */\nexport interface VanillaWidget {\n /** Root DOM element of the widget */\n element: HTMLElement;\n /** Cleanup and destroy the widget */\n destroy: () => void;\n /** The Convai client instance */\n client: IConvaiClient & {\n activity?: string;\n chatMessages: ChatMessage[];\n emit?: (event: string, ...args: any[]) => void;\n };\n /** Update widget state (for future extensions) */\n update?: (options: Partial<VanillaWidgetOptions>) => void;\n\n /**\n * Open the panel. Drives the same internal open path as the launcher\n * click (connect-on-first-open, then the morph to the panel). Idempotent:\n * calling `open()` while already open — or while a first open is still\n * waiting on `connect()` — is a no-op. It will not re-run the morph\n * animation, and it will not start a second connect.\n */\n open: () => void;\n /**\n * Close the panel. Drives the same internal path as the header's close\n * button. Idempotent: calling `close()` while already closed is a no-op.\n *\n * Called while a first open is still connecting, it *cancels* that open:\n * the connect completes (the client ends up connected) but the panel stays\n * collapsed rather than popping open once the promise resolves.\n */\n close: () => void;\n /**\n * Toggle the panel open or closed, per the current {@link isOpen} state.\n * Mid-connect this closes — i.e. a second click cancels the open in flight,\n * rather than queueing a second one.\n */\n toggle: () => void;\n /**\n * Whether the panel is open, or is opening. This is *requested* state, and\n * it updates synchronously: `widget.open(); widget.isOpen` is always `true`,\n * including on a cold client where the panel is only committed once\n * `connect()` resolves seconds later. Cancelling that open (via `close()`,\n * `toggle()`, or a second launcher click) returns it to `false`\n * immediately.\n *\n * The distinction matters only for the first open on a disconnected client;\n * every other transition is synchronous, so rendered and requested state\n * coincide. Consumers reconciling their own open/close events against this\n * flag get the answer that matches the user's last instruction, not the\n * animation frame.\n */\n readonly isOpen: boolean;\n /**\n * Insert a message into the transcript locally, without sending it to the\n * character. Use this for client-side lines — e.g. a greeting — that must\n * appear in the chat but must never reach the LLM and must never be billed\n * as a turn. This is not `sendUserTextMessage`: nothing is transmitted.\n */\n appendMessage: (message: { sender: \"user\" | \"bot\"; content: string }) => void;\n}\n"]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.8.0-beta.
|
|
1
|
+
export declare const SDK_VERSION = "1.8.0-beta.7";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC","sourcesContent":["// GENERATED by scripts/sync-version.mjs — do not edit by hand.\n// Regenerated from package.json on every build.\nexport const SDK_VERSION = \"1.8.0-beta.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC","sourcesContent":["// GENERATED by scripts/sync-version.mjs — do not edit by hand.\n// Regenerated from package.json on every build.\nexport const SDK_VERSION = \"1.8.0-beta.7\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@convai/web-sdk",
|
|
3
|
-
"version": "1.8.0-beta.
|
|
3
|
+
"version": "1.8.0-beta.7",
|
|
4
4
|
"description": "Build web apps with lifelike AI characters. The Convai Web SDK gives you real-time voice, lipsync, emotions, and dynamic context — with first-class support for React and vanilla TypeScript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
"import": "./dist/vanilla/websocket.js",
|
|
25
25
|
"types": "./dist/vanilla/websocket.d.ts"
|
|
26
26
|
},
|
|
27
|
+
"./embed": {
|
|
28
|
+
"import": "./dist/embed/index.js",
|
|
29
|
+
"types": "./dist/embed/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./embed/browser": {
|
|
32
|
+
"import": "./dist/embed/chat-embed-v1.js",
|
|
33
|
+
"types": "./dist/embed/browser.d.ts"
|
|
34
|
+
},
|
|
27
35
|
"./react": {
|
|
28
36
|
"import": "./dist/react/index.js",
|
|
29
37
|
"types": "./dist/react/index.d.ts"
|
|
@@ -35,23 +43,28 @@
|
|
|
35
43
|
"./package.json": "./package.json"
|
|
36
44
|
},
|
|
37
45
|
"sideEffects": [
|
|
46
|
+
"./dist/embed/browser.js",
|
|
47
|
+
"./dist/embed/chat-embed-v1.js",
|
|
38
48
|
"./dist/vanilla/websocket.js",
|
|
49
|
+
"./src/embed/browser.ts",
|
|
39
50
|
"./src/vanilla/websocket.ts"
|
|
40
51
|
],
|
|
41
52
|
"publishConfig": {
|
|
42
53
|
"access": "public"
|
|
43
54
|
},
|
|
44
55
|
"scripts": {
|
|
45
|
-
"build": "node scripts/sync-version.mjs && tsc -p tsconfig.build.json && node scripts/fix-dist-extensions.mjs && pnpm typecheck:downstream",
|
|
46
|
-
"build:fast": "node scripts/sync-version.mjs && tsc -p tsconfig.build.json && node scripts/fix-dist-extensions.mjs",
|
|
47
|
-
"build:prod": "node scripts/sync-version.mjs && NODE_ENV=production tsc -p tsconfig.build.json && node scripts/fix-dist-extensions.mjs && pnpm typecheck:downstream",
|
|
56
|
+
"build": "node scripts/sync-version.mjs && tsc -p tsconfig.build.json && node scripts/fix-dist-extensions.mjs && pnpm build:embed && pnpm typecheck:downstream",
|
|
57
|
+
"build:fast": "node scripts/sync-version.mjs && tsc -p tsconfig.build.json && node scripts/fix-dist-extensions.mjs && pnpm build:embed",
|
|
58
|
+
"build:prod": "node scripts/sync-version.mjs && NODE_ENV=production tsc -p tsconfig.build.json && node scripts/fix-dist-extensions.mjs && pnpm build:embed && pnpm typecheck:downstream",
|
|
59
|
+
"build:embed": "esbuild src/embed/browser.ts --bundle --format=esm --platform=browser --target=es2020 --outfile=dist/embed/chat-embed-v1.js --minify --sourcemap",
|
|
48
60
|
"dev": "tsc -p tsconfig.build.json --watch",
|
|
49
61
|
"clean": "rimraf dist",
|
|
50
62
|
"fix:ext": "node scripts/fix-dist-extensions.mjs",
|
|
51
63
|
"typecheck": "tsc --noEmit",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:protocol": "tsc && node --test tests/modelOutput.test.mjs tests/actionResultAck.test.mjs tests/visionPromptMode.test.mjs",
|
|
52
66
|
"typecheck:downstream": "pnpm -r --filter './examples/**' exec tsc -b --noEmit && pnpm -r --filter './doc-tests/**' exec tsc --noEmit",
|
|
53
67
|
"typecheck:all": "pnpm typecheck && pnpm typecheck:downstream",
|
|
54
|
-
"test": "vitest run",
|
|
55
68
|
"test:watch": "vitest",
|
|
56
69
|
"verify": "vitest run && tsc && tsc -p tsconfig.build.json && pnpm -r --filter './doc-tests/**' exec tsc --noEmit",
|
|
57
70
|
"test:lipsync": "tsc && node scripts/test-neurosync-ahead.mjs",
|
|
@@ -129,7 +142,7 @@
|
|
|
129
142
|
"happy-dom": "^15.11.7",
|
|
130
143
|
"rimraf": "^5.0.0",
|
|
131
144
|
"typescript": "^5.7.3",
|
|
132
|
-
"vitest": "^2.
|
|
145
|
+
"vitest": "^3.2.4"
|
|
133
146
|
},
|
|
134
147
|
"files": [
|
|
135
148
|
"dist",
|