Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions typescript/src/types/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ export interface Recognizer {
mistralOptions?: Record<string, unknown>;
modulateOptions?: Record<string, unknown>;
zoomOptions?: Record<string, unknown>;
azureopenaiOptions?: Record<string, unknown>;
gnaniOptions?: Record<string, unknown>;
inworldOptions?: Record<string, unknown>;
kugelaudioOptions?: Record<string, unknown>;
metaOptions?: Record<string, unknown>;
saidwireOptions?: Record<string, unknown>;
sarvamOptions?: Record<string, unknown>;
smallestaiOptions?: Record<string, unknown>;
/** Paxa Labs options; only when the recognizer vendor is 'paxa'. */
paxaOptions?: Record<string, unknown>;
customOptions?: Record<string, unknown>;
Expand Down
41 changes: 36 additions & 5 deletions typescript/src/types/verbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -352,25 +356,30 @@ 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;
/** STT configuration. Optional — can be set at the application level. */
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. */
bargeIn?: {
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;
Expand Down Expand Up @@ -410,11 +419,32 @@ export interface AgentVerb {
speak?: boolean;
/** Keep stage-direction-only paragraphs ('(silence)', '[No response needed]', '*pauses*') and <think>/<thinking>/<reasoning> 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 <voice/> 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. */
Expand Down Expand Up @@ -995,6 +1025,7 @@ export type Verb =
| NovaS2sVerb
| RimeS2sVerb
| VoiceliveS2sVerb
| PhonicS2sVerb
| DialogflowVerb
| AgentVerb
| ConferenceVerb
Expand Down
4 changes: 4 additions & 0 deletions typescript/src/verb-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export class VerbBuilder {
return this.addVerb({ verb: 'voicelive_s2s', ...opts });
}

phonic_s2s(opts: Omit<LlmBaseOptions, 'vendor'>): this {
return this.addVerb({ verb: 'phonic_s2s', ...opts });
}

/** Shortcut for s2s with vendor='google'. */
google_s2s(opts: Omit<LlmBaseOptions, 'vendor'>): this {
return this.addVerb({ verb: 'google_s2s', ...opts });
Expand Down
1 change: 1 addition & 0 deletions typescript/src/websocket/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export class Session extends EventEmitter {
nova_s2s(opts: Parameters<VerbBuilder['nova_s2s']>[0]): this { this.builder.nova_s2s(opts); return this; }
rime_s2s(opts: Parameters<VerbBuilder['rime_s2s']>[0]): this { this.builder.rime_s2s(opts); return this; }
voicelive_s2s(opts: Parameters<VerbBuilder['voicelive_s2s']>[0]): this { this.builder.voicelive_s2s(opts); return this; }
phonic_s2s(opts: Parameters<VerbBuilder['phonic_s2s']>[0]): this { this.builder.phonic_s2s(opts); return this; }
/** Shortcut for s2s with vendor='google'. */
google_s2s(opts: Parameters<VerbBuilder['google_s2s']>[0]): this { this.builder.google_s2s(opts); return this; }
/** Shortcut for s2s with vendor='elevenlabs'. */
Expand Down