@craftedxp/voice-js 0.9.0 → 0.10.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/README.md CHANGED
@@ -210,7 +210,9 @@ interface NodeCall extends Call {
210
210
 
211
211
  `sendClientEvent(text)` pushes a short advisory context line to the live call (e.g. a browser action the user just took). The server buffers these and shows them to the LLM ahead of the next turn — they never trigger a response by themselves. Text is trimmed and truncated to 400 chars. Returns `false` if the WS isn't open yet or text is empty.
212
212
 
213
- `sendText(text)` sends a typed user turn — `{type:'user_text', text}` — for text/multimodal sessions opened with a `channel:'text'` token. The server accepts `user_text` only on text-channel sessions and rejects it on voice calls (anti-injection), so on a voice call this is a no-op beyond the frame being ignored server-side. Text is trimmed. Returns `false` (and sends nothing) if the WS isn't open or text is empty/whitespace. Never throws.
213
+ `sendText(text)` sends a typed user turn — `{type:'user_text', text}` — for text/multimodal sessions opened with a `channel:'text'` OR `channel:'multimodal'` token. The server accepts `user_text` only on text-channel sessions and rejects it on voice calls (anti-injection), so on a voice call this is a no-op beyond the frame being ignored server-side. Text is trimmed. Returns `false` (and sends nothing) if the WS isn't open or text is empty/whitespace. Never throws.
214
+
215
+ `sendImage(data, mimeType)` sends an image — `{type:'user_image', mimeType, data}` — for multimodal sessions opened with a `channel:'multimodal'` token. `data` can be a base64 string (used as-is) or a buffer (base64-encoded by the SDK). Supported MIME types: `image/png`, `image/jpeg`, `image/webp`, `image/gif`. Returns `false` (and sends nothing) if the WS isn't open, data is empty, mimeType is unsupported, or base64-encoded size exceeds 5 MB. Never throws.
214
216
 
215
217
  ### Stable types
216
218
 
@@ -420,7 +422,8 @@ Renders a floating call button with a Shadow-DOM transcript panel. Pre-mint the
420
422
 
421
423
  ## Status
422
424
 
423
- - **0.9.0** (current) — `sendText(text)` on `NodeCall`: typed user turns for `channel:'text'` WS sessions (`user_text` frame). Server accepts `user_text` only on text-channel sessions and rejects it on voice-channel sessions (anti-injection). Text is trimmed; returns `false` (and sends nothing) if the WS isn't open or text is empty/whitespace, never throws. Additive — drop-in for 0.8.0 consumers.
425
+ - **0.10.0** (current) — `sendImage(data, mimeType)` on `NodeCall`: image input for `channel:'multimodal'` sessions (`user_image` frame). `data` can be a base64 string or buffer; `mimeType` must be one of `image/png`, `image/jpeg`, `image/webp`, `image/gif`. Returns `false` (and sends nothing) if the WS isn't open, data is empty, mimeType is unsupported, or base64-encoded size exceeds 5 MB; never throws. Also updates `sendText` doc to note it works on both `channel:'text'` and `channel:'multimodal'` sessions. Additive — drop-in for 0.9.0 consumers.
426
+ - 0.9.0 — `sendText(text)` on `NodeCall`: typed user turns for `channel:'text'` WS sessions (`user_text` frame). Server accepts `user_text` only on text-channel sessions and rejects it on voice-channel sessions (anti-injection). Text is trimmed; returns `false` (and sends nothing) if the WS isn't open or text is empty/whitespace, never throws. Additive — drop-in for 0.8.0 consumers.
424
427
  - 0.8.0 — `sendClientEvent(text)` on `NodeCall`: advisory context lines for live calls (`client_event` frame). Server buffers these and prepends them to the next turn's context; never triggers a response by itself. Text is trimmed and truncated to 400 chars; returns `false` if the WS isn't open yet or text is empty. Additive — drop-in for 0.7.0 consumers.
425
428
  - 0.7.0 — Per-type entry points + LiveKit goes optional. New subpaths `@craftedxp/voice-js/assistant`, `/room`, `/transcribe` (plus the existing `/node`); import the one matching your [agent `type`](https://www.npmjs.com/package/@craftedxp/sdk-node). `livekit-client` moved from `dependencies` to an **optional peerDependency** — assistant / transcribe consumers no longer download it, and the embed widget dropped from ~854 KB to ~100 KB. `joinRoom` lazy-`import()`s LiveKit and throws an actionable error if it isn't installed, so the deprecated barrel keeps working for non-room consumers. **Breaking for room consumers:** add `npm install livekit-client`. Non-room consumers are drop-in (prefer migrating barrel imports to `/assistant`).
426
429
  - 0.6.0 — Text chat sessions. `startTextSession({ token, agentId, … })` opens an HTTP+SSE chat against a `channel: 'text'` token — no microphone / audio. Exposed from the assistant entry. Additive; voice consumers see no change.