From 0597a03dae006325dea61b8852193b8007718277 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Fri, 20 Nov 2026 19:53:39 -0500 Subject: [PATCH] feat(types): jambonz turn detection, aicoustics noise isolation; schema 0.4.46 - turnDetection accepts 'jambonz' (shorthand and mode) - noiseIsolation accepts 'kugelaudio' and 'aicoustics', plus label/auth - bump @jambonz/schema to ^0.4.46 and sync the types the drift test then requires: agent emotion, phonic_s2s verb, eight recognizer vendor option blocks Co-Authored-By: Claude Fable 5.2 --- typescript/package-lock.json | 8 +++--- typescript/package.json | 2 +- typescript/src/types/components.ts | 8 ++++++ typescript/src/types/verbs.ts | 41 +++++++++++++++++++++++++---- typescript/src/verb-builder.ts | 4 +++ typescript/src/websocket/session.ts | 1 + 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/typescript/package-lock.json b/typescript/package-lock.json index f515227..6c9cc18 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -9,7 +9,7 @@ "version": "0.12.1", "license": "MIT", "dependencies": { - "@jambonz/schema": "^0.4.36", + "@jambonz/schema": "^0.4.46", "ajv": "^8.17.1", "pino": "^9.14.0", "ws": "^8.18.0" @@ -583,9 +583,9 @@ } }, "node_modules/@jambonz/schema": { - "version": "0.4.36", - "resolved": "https://registry.npmjs.org/@jambonz/schema/-/schema-0.4.36.tgz", - "integrity": "sha512-KB/h+lfjflT60dkKEvABJBeYSt0jNv7cftnOVNo/QD2Zg3Vk6uPnyfWeEr/xvB0Cz2jTRxOVYNNlkQPXM4uc9A==", + "version": "0.4.46", + "resolved": "https://registry.npmjs.org/@jambonz/schema/-/schema-0.4.46.tgz", + "integrity": "sha512-LDS43NWf08kApNgaAn6YqUV0ohFeQbl0H7BymZBl3ppI7xgfP07FVtANjOE2lmUkHo77QnRSWHHTOSSZf8XHVg==", "license": "MIT", "dependencies": { "ajv": "^8.17.1", diff --git a/typescript/package.json b/typescript/package.json index 46b89b6..6885e46 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -105,7 +105,7 @@ "postpublish": "npm run clean-docs" }, "dependencies": { - "@jambonz/schema": "^0.4.36", + "@jambonz/schema": "^0.4.46", "ajv": "^8.17.1", "pino": "^9.14.0", "ws": "^8.18.0" diff --git a/typescript/src/types/components.ts b/typescript/src/types/components.ts index 5d90015..124ac13 100644 --- a/typescript/src/types/components.ts +++ b/typescript/src/types/components.ts @@ -151,6 +151,14 @@ export interface Recognizer { mistralOptions?: Record; modulateOptions?: Record; zoomOptions?: Record; + azureopenaiOptions?: Record; + gnaniOptions?: Record; + inworldOptions?: Record; + kugelaudioOptions?: Record; + metaOptions?: Record; + saidwireOptions?: Record; + sarvamOptions?: Record; + smallestaiOptions?: Record; /** Paxa Labs options; only when the recognizer vendor is 'paxa'. */ paxaOptions?: Record; customOptions?: Record; diff --git a/typescript/src/types/verbs.ts b/typescript/src/types/verbs.ts index d4ec5c0..8091837 100644 --- a/typescript/src/types/verbs.ts +++ b/typescript/src/types/verbs.ts @@ -297,6 +297,10 @@ export interface VoiceliveS2sVerb extends LlmBaseOptions { verb: 'voicelive_s2s'; } +export interface PhonicS2sVerb extends LlmBaseOptions { + verb: 'phonic_s2s'; +} + export interface DialogflowVerb { verb: 'dialogflow'; /** The deployment to use (CES). Omit to use the app's default. */ @@ -352,6 +356,9 @@ export interface DialogflowVerb { }; } +/** Voice styles the agent verb's emotion option can use. */ +export type AgentEmotion = 'neutral' | 'happy' | 'excited' | 'calm' | 'empathetic' | 'sad' | 'serious' | 'surprised' | 'curious' | 'angry'; + export interface AgentVerb { verb: 'agent'; id?: string; @@ -359,10 +366,12 @@ export interface AgentVerb { stt?: Recognizer; /** TTS configuration. Optional — can be set at the application level. */ tts?: Synthesizer; - /** Turn detection strategy. String shorthand ('stt' or 'krisp') or object with tunable params. */ - turnDetection?: 'stt' | 'krisp' | { - mode: 'krisp'; + /** Turn detection strategy. String shorthand ('stt', 'krisp' or 'jambonz') or object with tunable params. 'jambonz' is the jambonz acoustic end-of-turn model; it runs in the media server and needs no vendor key. */ + turnDetection?: 'stt' | 'krisp' | 'jambonz' | { + mode: 'krisp' | 'jambonz'; + /** End-of-turn confidence threshold (0-1). Default: 0.5 for krisp; 0.9 for jambonz, where it is the starting value of a threshold that falls to 0 over 1.6 s of silence. */ threshold?: number; + /** Krisp model name override (krisp only). */ model?: string; }; /** Barge-in configuration — controls user interruption of assistant speech. */ @@ -370,7 +379,7 @@ export interface AgentVerb { enable?: boolean; /** How interruptions are detected. 'vad' (default): speech onset tentatively interrupts the assistant and is confirmed after minSpeechDuration of sustained speech, otherwise the assistant resumes. 'interruptPrediction': an ML model scores whether caller speech is a genuine interruption attempt vs backchannel (e.g. 'uh-huh'), so the assistant is never tentatively paused and backchannel does not cut it off; requires a provisioned vendor API key. */ strategy?: 'vad' | 'interruptPrediction'; - /** Detection vendor for strategy 'interruptPrediction'; defaults to 'krisp' (currently the only option). Not used with strategy 'vad'. */ + /** Detection vendor for strategy 'interruptPrediction'; 'krisp' (default) or 'jambonz'. It must match turnDetection when that is 'krisp' or 'jambonz' (they share one session). Not used with strategy 'vad'. */ vendor?: string; /** Probability threshold for interruptPrediction (0-1). Higher values require stronger evidence before interrupting the assistant. Default: 0.5. */ threshold?: number; @@ -410,11 +419,32 @@ export interface AgentVerb { speak?: boolean; /** Keep stage-direction-only paragraphs ('(silence)', '[No response needed]', '*pauses*') and // blocks out of TTS. History and events keep the raw text. Default: true. */ speechCleanup?: boolean; + /** Emotion-aware voice: the caller's tone is passed to the LLM, and the LLM may change the voice style with directives that are rendered as the TTS vendor's own style tags. Omit to leave the agent unchanged. */ + emotion?: { + /** Where the caller's tone comes from: the STT vendor's label, the LLM's reading of the words, or both ('auto'). Default: 'auto'. */ + listen?: 'auto' | 'stt' | 'llm' | 'off'; + /** Let the LLM change the voice style. Ignored when the TTS model has no style control. Default: true. */ + speak?: boolean; + /** Allow-list of emotions the LLM may use. Default: every emotion the TTS model supports. */ + emotions?: AgentEmotion[]; + /** Allow non-speech sounds (e.g. laugh), all or a list. Default: false. */ + sounds?: boolean | Array<'laugh' | 'sigh' | 'breath' | 'pause'>; + /** Drop STT emotion labels whose confidence is below this. Default: 0.5. */ + minConfidence?: number; + /** The style every reply starts in. Default: 'neutral'. */ + default?: AgentEmotion; + }; /** Enable server-side noise isolation to reduce background noise on call audio. Defaults to inbound (caller) audio; set direction to 'write' for outbound. */ - noiseIsolation?: 'krisp' | 'rnnoise' | { + noiseIsolation?: 'krisp' | 'rnnoise' | 'kugelaudio' | 'aicoustics' | { + /** Vendor: 'krisp', 'rnnoise', 'kugelaudio' or 'aicoustics'. */ mode: string; + /** Label of the speech credential to use, for vendors that need one (kugelaudio). */ + label?: string; + /** Inline credentials for vendors that need them (kugelaudio). When omitted, the speech credential is looked up by vendor and label. */ + auth?: { apiKey?: string; apiUri?: string }; level?: number; direction?: 'read' | 'write'; + /** Model name override. For aicoustics, a model file name in the media server's model directory. */ model?: string; }; /** External MCP servers that provide tools to the LLM. */ @@ -995,6 +1025,7 @@ export type Verb = | NovaS2sVerb | RimeS2sVerb | VoiceliveS2sVerb + | PhonicS2sVerb | DialogflowVerb | AgentVerb | ConferenceVerb diff --git a/typescript/src/verb-builder.ts b/typescript/src/verb-builder.ts index 07f51a6..1481516 100644 --- a/typescript/src/verb-builder.ts +++ b/typescript/src/verb-builder.ts @@ -119,6 +119,10 @@ export class VerbBuilder { return this.addVerb({ verb: 'voicelive_s2s', ...opts }); } + phonic_s2s(opts: Omit): this { + return this.addVerb({ verb: 'phonic_s2s', ...opts }); + } + /** Shortcut for s2s with vendor='google'. */ google_s2s(opts: Omit): this { return this.addVerb({ verb: 'google_s2s', ...opts }); diff --git a/typescript/src/websocket/session.ts b/typescript/src/websocket/session.ts index 0b68586..93c56dd 100644 --- a/typescript/src/websocket/session.ts +++ b/typescript/src/websocket/session.ts @@ -124,6 +124,7 @@ export class Session extends EventEmitter { nova_s2s(opts: Parameters[0]): this { this.builder.nova_s2s(opts); return this; } rime_s2s(opts: Parameters[0]): this { this.builder.rime_s2s(opts); return this; } voicelive_s2s(opts: Parameters[0]): this { this.builder.voicelive_s2s(opts); return this; } + phonic_s2s(opts: Parameters[0]): this { this.builder.phonic_s2s(opts); return this; } /** Shortcut for s2s with vendor='google'. */ google_s2s(opts: Parameters[0]): this { this.builder.google_s2s(opts); return this; } /** Shortcut for s2s with vendor='elevenlabs'. */