@convai/web-sdk 1.7.0-beta.2 → 1.8.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.
Files changed (43) hide show
  1. package/dist/core/ConvaiClient.d.ts +40 -1
  2. package/dist/core/ConvaiClient.d.ts.map +1 -1
  3. package/dist/core/ConvaiClient.js +276 -167
  4. package/dist/core/ConvaiClient.js.map +1 -1
  5. package/dist/core/connectRequest.d.ts +1 -1
  6. package/dist/core/connectRequest.d.ts.map +1 -1
  7. package/dist/core/connectRequest.js.map +1 -1
  8. package/dist/core/types.d.ts +50 -2
  9. package/dist/core/types.d.ts.map +1 -1
  10. package/dist/core/types.js.map +1 -1
  11. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +1 -1
  12. package/dist/react/components/rtc-widget/components/AudioVisualizer.js +28 -1
  13. package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +1 -1
  14. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +1 -1
  15. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +93 -49
  16. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +1 -1
  17. package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
  18. package/dist/react/hooks/useConvaiClient.js +1 -0
  19. package/dist/react/hooks/useConvaiClient.js.map +1 -1
  20. package/dist/vanilla/AudioRenderer.d.ts +3 -1
  21. package/dist/vanilla/AudioRenderer.d.ts.map +1 -1
  22. package/dist/vanilla/AudioRenderer.js +2 -2
  23. package/dist/vanilla/AudioRenderer.js.map +1 -1
  24. package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
  25. package/dist/vanilla/ConvaiWidget.js +575 -111
  26. package/dist/vanilla/ConvaiWidget.js.map +1 -1
  27. package/dist/vanilla/icons.d.ts.map +1 -1
  28. package/dist/vanilla/icons.js +62 -15
  29. package/dist/vanilla/icons.js.map +1 -1
  30. package/dist/vanilla/index.d.ts +1 -1
  31. package/dist/vanilla/index.d.ts.map +1 -1
  32. package/dist/vanilla/index.js.map +1 -1
  33. package/dist/vanilla/styles.d.ts +18 -1
  34. package/dist/vanilla/styles.d.ts.map +1 -1
  35. package/dist/vanilla/styles.js +105 -29
  36. package/dist/vanilla/styles.js.map +1 -1
  37. package/dist/vanilla/types.d.ts +74 -0
  38. package/dist/vanilla/types.d.ts.map +1 -1
  39. package/dist/vanilla/types.js.map +1 -1
  40. package/dist/version.d.ts +1 -1
  41. package/dist/version.js +1 -1
  42. package/dist/version.js.map +1 -1
  43. package/package.json +14 -7
@@ -1,4 +1,6 @@
1
1
  import type { IConvaiClient, ChatMessage } from '../core/types';
2
+ /** Where the widget anchors itself. `inline` renders it in normal document flow. */
3
+ export type WidgetPlacement = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'inline';
2
4
  /**
3
5
  * Options for creating a vanilla ConvaiWidget
4
6
  *
@@ -15,6 +17,14 @@ export interface VanillaWidgetOptions {
15
17
  convaiClient?: IConvaiClient & {
16
18
  activity?: string;
17
19
  chatMessages: ChatMessage[];
20
+ /**
21
+ * Present on the real `ConvaiClient` (it extends `EventEmitter`) and on
22
+ * the test stubs; absent only if a caller hand-rolls a minimal
23
+ * `IConvaiClient`. Optional so that case still type-checks -- the widget
24
+ * calls it defensively (`client.emit?.(...)`) to surface mic-permission
25
+ * failures on the same `error` channel `ConvaiClient` already uses.
26
+ */
27
+ emit?: (event: string, ...args: any[]) => void;
18
28
  };
19
29
  /** Option 2: Pass connection config directly (convenience shortcut). Either apiKey or authToken is required. */
20
30
  apiKey?: string;
@@ -57,6 +67,21 @@ export interface VanillaWidgetOptions {
57
67
  * When true, the widget will open directly in voice mode with microphone enabled.
58
68
  */
59
69
  defaultVoiceMode?: boolean;
70
+ /**
71
+ * Where the widget's `<style>` and `@keyframes` nodes are injected.
72
+ *
73
+ * Omit it and the target is derived from `container.getRootNode()` at
74
+ * construction time — correct only when the container is *already* inside
75
+ * its final root. A custom element that builds its subtree first and appends
76
+ * it to its shadow root afterwards (the usual pattern) constructs the widget
77
+ * while the container is still detached, so the derivation sees the
78
+ * document and the shadow root never receives the stylesheet or the `popIn`
79
+ * keyframes — silently, with no error. Pass the shadow root here in that
80
+ * case; when supplied it is used verbatim and no derivation happens.
81
+ */
82
+ styleTarget?: Document | ShadowRoot;
83
+ /** Corner to anchor to, or `inline` for normal flow. Default `bottom-right`. */
84
+ placement?: WidgetPlacement;
60
85
  /** Optional callbacks */
61
86
  onConnect?: () => void;
62
87
  onDisconnect?: () => void;
@@ -74,8 +99,57 @@ export interface VanillaWidget {
74
99
  client: IConvaiClient & {
75
100
  activity?: string;
76
101
  chatMessages: ChatMessage[];
102
+ emit?: (event: string, ...args: any[]) => void;
77
103
  };
78
104
  /** Update widget state (for future extensions) */
79
105
  update?: (options: Partial<VanillaWidgetOptions>) => void;
106
+ /**
107
+ * Open the panel. Drives the same internal open path as the launcher
108
+ * click (connect-on-first-open, then the morph to the panel). Idempotent:
109
+ * calling `open()` while already open — or while a first open is still
110
+ * waiting on `connect()` — is a no-op. It will not re-run the morph
111
+ * animation, and it will not start a second connect.
112
+ */
113
+ open: () => void;
114
+ /**
115
+ * Close the panel. Drives the same internal path as the header's close
116
+ * button. Idempotent: calling `close()` while already closed is a no-op.
117
+ *
118
+ * Called while a first open is still connecting, it *cancels* that open:
119
+ * the connect completes (the client ends up connected) but the panel stays
120
+ * collapsed rather than popping open once the promise resolves.
121
+ */
122
+ close: () => void;
123
+ /**
124
+ * Toggle the panel open or closed, per the current {@link isOpen} state.
125
+ * Mid-connect this closes — i.e. a second click cancels the open in flight,
126
+ * rather than queueing a second one.
127
+ */
128
+ toggle: () => void;
129
+ /**
130
+ * Whether the panel is open, or is opening. This is *requested* state, and
131
+ * it updates synchronously: `widget.open(); widget.isOpen` is always `true`,
132
+ * including on a cold client where the panel is only committed once
133
+ * `connect()` resolves seconds later. Cancelling that open (via `close()`,
134
+ * `toggle()`, or a second launcher click) returns it to `false`
135
+ * immediately.
136
+ *
137
+ * The distinction matters only for the first open on a disconnected client;
138
+ * every other transition is synchronous, so rendered and requested state
139
+ * coincide. Consumers reconciling their own open/close events against this
140
+ * flag get the answer that matches the user's last instruction, not the
141
+ * animation frame.
142
+ */
143
+ readonly isOpen: boolean;
144
+ /**
145
+ * Insert a message into the transcript locally, without sending it to the
146
+ * character. Use this for client-side lines — e.g. a greeting — that must
147
+ * appear in the chat but must never reach the LLM and must never be billed
148
+ * as a turn. This is not `sendUserTextMessage`: nothing is transmitted.
149
+ */
150
+ appendMessage: (message: {
151
+ sender: "user" | "bot";
152
+ content: string;
153
+ }) => void;
80
154
  }
81
155
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,CAAA;KAAE,CAAC;IAElF,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kGAAkG;IAClG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE;QACjB,qFAAqF;QACrF,MAAM,CAAC,EAAE,OAAO,GAA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E,QAAQ,GAAG,UAAU,CAAC;IAEpC,gFAAgF;IAChF,SAAS,CAAC,EAAE,eAAe,CAAC;IAE5B,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,OAAO,EAAE,WAAW,CAAC;IACrB,qCAAqC;IACrC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iCAAiC;IACjC,MAAM,EAAE,aAAa,GAAG;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,WAAW,EAAE,CAAC;QAC5B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;KAChD,CAAC;IACF,kDAAkD;IAClD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IAE1D;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IConvaiClient, ChatMessage } from '../core/types';\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 & { activity?: string; chatMessages: ChatMessage[] };\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 \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 & { activity?: string; chatMessages: ChatMessage[] };\n /** Update widget state (for future extensions) */\n update?: (options: Partial<VanillaWidgetOptions>) => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { IConvaiClient, ChatMessage } from '../core/types';\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 \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.7.0-beta.2";
1
+ export declare const SDK_VERSION = "1.8.0-beta.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // GENERATED by scripts/sync-version.mjs — do not edit by hand.
2
2
  // Regenerated from package.json on every build.
3
- export const SDK_VERSION = "1.7.0-beta.2";
3
+ export const SDK_VERSION = "1.8.0-beta.0";
4
4
  //# sourceMappingURL=version.js.map
@@ -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.7.0-beta.2\";\n"]}
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.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convai/web-sdk",
3
- "version": "1.7.0-beta.2",
3
+ "version": "1.8.0-beta.0",
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",
@@ -42,14 +42,18 @@
42
42
  "access": "public"
43
43
  },
44
44
  "scripts": {
45
- "build": "node scripts/sync-version.mjs && tsc && pnpm typecheck:downstream",
46
- "build:fast": "node scripts/sync-version.mjs && tsc",
47
- "build:prod": "node scripts/sync-version.mjs && NODE_ENV=production tsc && pnpm typecheck:downstream",
48
- "dev": "tsc --watch",
45
+ "build": "node scripts/sync-version.mjs && tsc -p tsconfig.build.json && pnpm typecheck:downstream",
46
+ "build:fast": "node scripts/sync-version.mjs && tsc -p tsconfig.build.json",
47
+ "build:prod": "node scripts/sync-version.mjs && NODE_ENV=production tsc -p tsconfig.build.json && pnpm typecheck:downstream",
48
+ "dev": "tsc -p tsconfig.build.json --watch",
49
49
  "clean": "rimraf dist",
50
50
  "typecheck": "tsc --noEmit",
51
51
  "typecheck:downstream": "pnpm -r --filter './examples/**' exec tsc -b --noEmit && pnpm -r --filter './doc-tests/**' exec tsc --noEmit",
52
52
  "typecheck:all": "pnpm typecheck && pnpm typecheck:downstream",
53
+ "test": "vitest run",
54
+ "test:watch": "vitest",
55
+ "verify": "vitest run && tsc && tsc -p tsconfig.build.json && pnpm -r --filter './doc-tests/**' exec tsc --noEmit",
56
+ "test:lipsync": "tsc && node scripts/test-neurosync-ahead.mjs",
53
57
  "prepublishOnly": "npm run clean && npm run build:prod",
54
58
  "changeset": "changeset",
55
59
  "version": "changeset version",
@@ -75,7 +79,8 @@
75
79
  "verify:release": "node scripts/verify-release.mjs",
76
80
  "check:docs": "node scripts/check-docs.mjs",
77
81
  "check:contract": "node scripts/check-api-contract.mjs",
78
- "check:packaging": "node scripts/check-packaging.mjs"
82
+ "check:packaging": "node scripts/check-packaging.mjs",
83
+ "check:hosts": "node scripts/check-hosts.mjs"
79
84
  },
80
85
  "keywords": [
81
86
  "convai",
@@ -120,8 +125,10 @@
120
125
  "@types/react-dom": "^18.3.5",
121
126
  "@types/styled-components": "^5.1.34",
122
127
  "esbuild": "^0.28.2",
128
+ "happy-dom": "^15.11.7",
123
129
  "rimraf": "^5.0.0",
124
- "typescript": "^5.7.3"
130
+ "typescript": "^5.7.3",
131
+ "vitest": "^2.1.9"
125
132
  },
126
133
  "files": [
127
134
  "dist",