@craftedxp/sdk-node 0.20.0 → 0.20.1

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 (2) hide show
  1. package/README.md +22 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -198,6 +198,7 @@ const job = await client.speech.enqueue({
198
198
  agentId: 'agt_…',
199
199
  context: { goals: ['run 5k'], weather: 'sunny, 18°C' },
200
200
  instructions: '60–90 seconds, upbeat, finish by handing over to the live conversation',
201
+ emotion: 'hype', // emotional delivery on emotion-capable voices (see below)
201
202
  idempotencyKey: `${deviceId}:${alarmId}:${yyyymmdd}`,
202
203
  userTags: ['premium'],
203
204
  ttlSeconds: 6 * 3600,
@@ -209,7 +210,11 @@ const job = await client.speech.enqueue({
209
210
 
210
211
  // Sync path for short clips / dev: resolves with the ready asset.
211
212
  try {
212
- const asset = await client.speech.synthesize({ agentId: 'agt_…', text: 'Good morning!' })
213
+ const asset = await client.speech.synthesize({
214
+ agentId: 'agt_…',
215
+ text: 'Good morning!',
216
+ emotion: 'hype',
217
+ })
213
218
  console.log(asset.url, asset.durationMs)
214
219
  } catch (err) {
215
220
  if (err instanceof PlatformError && err.code === 'accepted') {
@@ -220,6 +225,21 @@ try {
220
225
 
221
226
  Webhooks: `speech.ready` (`data: SpeechAsset`) and `speech.failed` (`data: SpeechJob`). Subscribe them on the agent's webhook like any other event. `format: 'ogg'` is reserved (400 today); `sampleRate` 24k/48k are upsampled from the provider's 16 kHz.
222
227
 
228
+ ### Emotion (0.20.0+)
229
+
230
+ Pass an `emotion` preset on `synthesize()` / `enqueue()` to control delivery:
231
+
232
+ ```ts
233
+ type Emotion = 'hype' | 'shout' | 'disappointed' | 'warm' | 'calm'
234
+
235
+ await client.speech.enqueue({ agentId: 'agt_…', text: 'Wake up — big day!', emotion: 'hype' })
236
+ ```
237
+
238
+ - Applies to **emotion-capable voices** (IndexTTS2, Hume); other voices silently ignore it (no error).
239
+ - The emotion is applied **consistently across the whole message** (every sentence), so a long briefing keeps one delivery style.
240
+ - Optional and backward-compatible — omit it for neutral delivery.
241
+ - Typical use: pre-generate an emotional wake / notification message with `enqueue()` ahead of the trigger time, then play the ready asset. Add new presets server-side without an SDK change.
242
+
223
243
  ## Webhook signature verification
224
244
 
225
245
  ```ts
@@ -283,6 +303,7 @@ for await (const call of client.calls.listAll({ agentId })) {
283
303
 
284
304
  ## Changelog
285
305
 
306
+ - **0.20.1** — docs: added the "Emotion" usage section + examples to the README (no API change; the `emotion` field ships from 0.20.0).
286
307
  - **0.20.0** — `speech.synthesize()` / `enqueue()` accept an `emotion` preset (`hype | shout | disappointed | warm | calm`) for emotional TTS voices.
287
308
  - **0.19.0** — type-only: `CallTokenMintResult.transport` widened to `'ws' | 'webrtc' | 'livekit'` (server returns `'livekit'` when the platform media edge is LiveKit Cloud; client SDKs that don't know it fall back to `'ws'`); `CallRecord.transport` added. No runtime change; drop-in for 0.18.0 consumers.
288
309
  - **Unreleased** _(forward-looking)_ — `isPersonal?: boolean` on `Agent` and `AgentCreateInput` (and so on `AgentUpdateInput`). Assistant-only: when `true`, the learning tools (`remember_fact`, `add_correction`, `add_skill_hint`) are live on every `ct_`-token call rather than only on `mode=learning`. Server-side field — no runtime change in this package.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@craftedxp/sdk-node",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Node.js / TypeScript SDK for the voice agent platform. Server-side API client — mint call tokens, manage agents, query calls, upload knowledge-base docs.",
5
5
  "author": "Crafted XP",
6
6
  "license": "MIT",