@hamsa-ai/voice-agents-sdk 0.6.0-beta.2 → 0.6.0-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamsa-ai/voice-agents-sdk",
3
- "version": "0.6.0-beta.2",
3
+ "version": "0.6.0-beta.4",
4
4
  "description": "Hamsa AI - Voice Agents JavaScript SDK",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -500,7 +500,16 @@ export declare class LiveKitToolRegistry extends EventEmitter {
500
500
  * Synthesizes a stable id when the source segment lacks one so consumers can
501
501
  * still key the message, and stamps the observation time.
502
502
  */
503
+ private buildReceivedMessage;
503
504
  private emitMessageReceived;
505
+ /**
506
+ * Emits a chat message originating from the {@link LIVEKIT_CHAT_TOPIC} stream.
507
+ *
508
+ * Fires the dedicated `chatMessageReceived` event — which fires only for real
509
+ * chat messages, never voice transcriptions — and, for backward
510
+ * compatibility, the generic `messageReceived` event with the same payload.
511
+ */
512
+ private emitChatMessage;
504
513
  /**
505
514
  * Returns the count of currently registered tools
506
515
  *
package/types/main.d.ts CHANGED
@@ -216,8 +216,23 @@ type HamsaVoiceAgentEvents = {
216
216
  * with structured, streaming-aware metadata (id, role, isFinal, timestamp).
217
217
  * Use this to drive a chat UI; prefer it over the plain-string
218
218
  * `answerReceived`/`transcriptionReceived` events when rendering message bubbles.
219
+ *
220
+ * Note: this is dual-sourced (chat text streams AND voice transcriptions).
221
+ * For a chat-only integration, prefer {@link chatMessageReceived}.
219
222
  */
220
223
  messageReceived: (message: ReceivedMessage) => void;
224
+ /**
225
+ * Emitted only for chat messages received on the chat text-stream channel
226
+ * (`lk.chat`) — agent replies and the greeting in chat-only sessions.
227
+ * Same `ReceivedMessage` shape (stable id for in-place updates, streaming
228
+ * partials with `isFinal: false` followed by a final `isFinal: true`).
229
+ *
230
+ * Unlike {@link messageReceived}, this never fires for voice transcriptions,
231
+ * so it is the deterministic event for chat UIs. Pair with `agentStateChanged`
232
+ * for a typing indicator. In chat-only sessions, `answerReceived`,
233
+ * `transcriptionReceived`, and audio events do not fire.
234
+ */
235
+ chatMessageReceived: (message: ReceivedMessage) => void;
221
236
  /** Emitted when agent starts speaking */
222
237
  speaking: () => void;
223
238
  /** Emitted when agent is listening */