@memberjunction/ai 5.41.0 → 5.43.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.
|
@@ -75,6 +75,18 @@ export type JSONObject = {
|
|
|
75
75
|
*
|
|
76
76
|
* @abstract
|
|
77
77
|
*/
|
|
78
|
+
/**
|
|
79
|
+
* Emits a realtime-driver diagnostic line, but ONLY when verbose logging is enabled
|
|
80
|
+
* (`MJ_VERBOSE=true|1|yes`). These traces — turn boundaries, activity windows, response gating,
|
|
81
|
+
* barge-in — are invaluable when debugging a live session but far too chatty for normal operation,
|
|
82
|
+
* so they stay dark unless verbose mode is explicitly turned on. Shared here so every realtime driver
|
|
83
|
+
* and its session twin (OpenAI, Gemini, …) gate diagnostics through one consistent switch. The truthy
|
|
84
|
+
* set matches `@memberjunction/core`'s `IsVerboseLoggingEnabled` so a single `MJ_VERBOSE` flag governs
|
|
85
|
+
* verbose output across the whole stack.
|
|
86
|
+
*
|
|
87
|
+
* @param message The diagnostic message, already prefixed by the caller (e.g. `[GeminiRealtime][diag] …`).
|
|
88
|
+
*/
|
|
89
|
+
export declare function RealtimeDiagLog(message: string): void;
|
|
78
90
|
export declare abstract class BaseRealtimeModel extends BaseModel {
|
|
79
91
|
/**
|
|
80
92
|
* Opens a stateful duplex session with the provider.
|
|
@@ -121,7 +133,47 @@ export declare abstract class BaseRealtimeModel extends BaseModel {
|
|
|
121
133
|
* @throws Always, unless overridden by a provider that supports client-direct sessions.
|
|
122
134
|
*/
|
|
123
135
|
CreateClientSession(_params: RealtimeSessionParams): Promise<ClientRealtimeSessionConfig>;
|
|
136
|
+
/**
|
|
137
|
+
* Whether this driver's sessions carry a **video** track in addition to audio — i.e. the model
|
|
138
|
+
* accepts video input (it can "see" the user's camera) and/or emits video output (a talking-head
|
|
139
|
+
* avatar / generated video), in sync with audio.
|
|
140
|
+
*
|
|
141
|
+
* Defaults to `false` (audio-only — today's realtime models). Video-capable drivers (a native
|
|
142
|
+
* multimodal realtime model, or an avatar provider) override this to `true`. The session's media
|
|
143
|
+
* plane is media-tagged ({@link IRealtimeSession.SendInput} takes a {@link RealtimeMediaKind};
|
|
144
|
+
* {@link IRealtimeSession.OnVideoOutput} delivers video-out), so a video session reuses the entire
|
|
145
|
+
* realtime contract — only the media frames gain a `video` kind. Resolution prefers a video-capable
|
|
146
|
+
* model when an agent requests video, and degrades to audio-only otherwise.
|
|
147
|
+
*
|
|
148
|
+
* @returns `true` if sessions can carry video; `false` (audio-only) otherwise.
|
|
149
|
+
*/
|
|
150
|
+
get SupportsVideo(): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* The provider-native voice ids this model can speak with (e.g. OpenAI `alloy`/`echo`/`shimmer`). The
|
|
153
|
+
* model/driver is the authoritative owner of "what voices do I support", so each driver declares its
|
|
154
|
+
* own — used to populate the dev voice picker. Default empty (a driver that hasn't declared voices
|
|
155
|
+
* yields no picker options, falling back to the configured/default voice).
|
|
156
|
+
*
|
|
157
|
+
* NOTE: this is the near-term, driver-owned source of truth. Long term this should move to metadata so
|
|
158
|
+
* providers that let users add their OWN voices (e.g. ElevenLabs) can be enumerated dynamically.
|
|
159
|
+
*
|
|
160
|
+
* @returns The supported voice ids (id + human label), or `[]` when none are declared.
|
|
161
|
+
*/
|
|
162
|
+
get SupportedVoices(): RealtimeVoiceOption[];
|
|
163
|
+
}
|
|
164
|
+
/** A selectable provider-native voice — `ID` is sent to the provider, `Name` is the human label. */
|
|
165
|
+
export interface RealtimeVoiceOption {
|
|
166
|
+
/** The provider-native voice id (e.g. `echo`) — what gets written to the session config. */
|
|
167
|
+
ID: string;
|
|
168
|
+
/** The human-friendly label for the picker (e.g. `Echo`). */
|
|
169
|
+
Name: string;
|
|
124
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* The media plane a realtime frame belongs to. The realtime contract is otherwise media-agnostic — a
|
|
173
|
+
* `video` session reuses every method (tools, transcript, usage, turn-taking); only the media frames
|
|
174
|
+
* carry this tag so audio and video can be disambiguated on the same session.
|
|
175
|
+
*/
|
|
176
|
+
export type RealtimeMediaKind = 'audio' | 'video';
|
|
125
177
|
/**
|
|
126
178
|
* The server-minted configuration a browser needs to open a **client-direct** realtime session.
|
|
127
179
|
*
|
|
@@ -165,6 +217,24 @@ export interface ClientRealtimeSessionConfig {
|
|
|
165
217
|
*/
|
|
166
218
|
SessionConfig: JSONObject;
|
|
167
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Static capability flags of a live {@link IRealtimeSession}, for container introspection (the realtime-
|
|
222
|
+
* session analogue of `IBridgeProviderFeatures`). Grow this as providers gain runtime abilities — each new
|
|
223
|
+
* flag defaults to "unsupported" for any driver that hasn't declared it, so the container stays safe.
|
|
224
|
+
*/
|
|
225
|
+
export interface RealtimeSessionCapabilities {
|
|
226
|
+
/**
|
|
227
|
+
* Whether the session can change its turn-taking / auto-response mode on a **live** socket (no
|
|
228
|
+
* reconnect) via {@link IRealtimeSession.Reconfigure}. `true` for providers with a runtime-mutable
|
|
229
|
+
* session config (OpenAI `session.update`); `false` where it's fixed at connect (Gemini Live).
|
|
230
|
+
*/
|
|
231
|
+
CanReconfigureTurnMode: boolean;
|
|
232
|
+
}
|
|
233
|
+
/** Parameters for {@link IRealtimeSession.Reconfigure} — a live turn-taking change. */
|
|
234
|
+
export interface RealtimeReconfigureParams {
|
|
235
|
+
/** Switch the model's blind auto-response OFF (meeting mode) or ON (1:1). */
|
|
236
|
+
DisableAutoResponse?: boolean;
|
|
237
|
+
}
|
|
168
238
|
/**
|
|
169
239
|
* A long-lived, full-duplex session handle returned by {@link BaseRealtimeModel.StartSession}.
|
|
170
240
|
*
|
|
@@ -174,13 +244,31 @@ export interface ClientRealtimeSessionConfig {
|
|
|
174
244
|
*/
|
|
175
245
|
export interface IRealtimeSession {
|
|
176
246
|
/**
|
|
177
|
-
*
|
|
247
|
+
* The PCM sample rate (Hz) this model **consumes** on {@link IRealtimeSession.SendInput} — its audio
|
|
248
|
+
* INPUT format. Optional; consumers default to 24000 (OpenAI Realtime). **Gemini Live = 16000.** A
|
|
249
|
+
* server-bridged host (LiveKit/Zoom/Teams) MUST resample inbound room audio to this rate or the model
|
|
250
|
+
* receives mis-rated audio it can't parse (the symptom: the agent never responds on the bridge while
|
|
251
|
+
* the same model works client-direct, where the browser negotiates the rate itself).
|
|
252
|
+
*/
|
|
253
|
+
InputSampleRate?: number;
|
|
254
|
+
/**
|
|
255
|
+
* The PCM sample rate (Hz) this model **emits** on {@link IRealtimeSession.OnOutput} — its audio OUTPUT
|
|
256
|
+
* format. Optional; consumers default to 24000 (both OpenAI and Gemini Live emit 24 kHz today).
|
|
257
|
+
*/
|
|
258
|
+
OutputSampleRate?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Sends a client media frame to the model.
|
|
178
261
|
*
|
|
179
|
-
* Fire-and-forget: frames are streamed straight to the provider with no JSON intermediation.
|
|
262
|
+
* Fire-and-forget: frames are streamed straight to the provider with no JSON intermediation. The
|
|
263
|
+
* optional `kind` tags the media plane — `'audio'` (default, back-compatible: existing callers and
|
|
264
|
+
* audio-only drivers need not pass or read it) or `'video'` for a camera frame to a video-capable
|
|
265
|
+
* model (one that {@link BaseRealtimeModel.SupportsVideo}). Audio-only drivers ignore `'video'`
|
|
266
|
+
* frames.
|
|
180
267
|
*
|
|
181
268
|
* @param chunk A raw media frame as an `ArrayBuffer`.
|
|
269
|
+
* @param kind The media plane the frame belongs to. Defaults to `'audio'`.
|
|
182
270
|
*/
|
|
183
|
-
SendInput(chunk: ArrayBuffer): void;
|
|
271
|
+
SendInput(chunk: ArrayBuffer, kind?: RealtimeMediaKind): void;
|
|
184
272
|
/**
|
|
185
273
|
* Registers the set of tools the model may call, translating them into the provider's
|
|
186
274
|
* native function-calling format.
|
|
@@ -207,11 +295,23 @@ export interface IRealtimeSession {
|
|
|
207
295
|
*/
|
|
208
296
|
RegisterTools(tools: RealtimeToolDefinition[]): Promise<void>;
|
|
209
297
|
/**
|
|
210
|
-
* Registers a handler for model
|
|
298
|
+
* Registers a handler for model **audio** output frames (the audio media plane).
|
|
211
299
|
*
|
|
212
|
-
* @param handler Invoked with each output
|
|
300
|
+
* @param handler Invoked with each output audio frame as an `ArrayBuffer`.
|
|
213
301
|
*/
|
|
214
302
|
OnOutput(handler: (chunk: ArrayBuffer) => void): void;
|
|
303
|
+
/**
|
|
304
|
+
* Registers a handler for model **video** output frames — the talking-head avatar / generated
|
|
305
|
+
* video a video-capable model emits, in sync with {@link IRealtimeSession.OnOutput}'s audio.
|
|
306
|
+
*
|
|
307
|
+
* Optional: audio-only drivers (the default) don't implement it, and consumers must call it
|
|
308
|
+
* null-safely (`session.OnVideoOutput?.(...)`). A video-capable driver
|
|
309
|
+
* ({@link BaseRealtimeModel.SupportsVideo}) implements it; the consumer (bridge / client) maps these
|
|
310
|
+
* frames onto its `video-out` track exactly as it maps audio.
|
|
311
|
+
*
|
|
312
|
+
* @param handler Invoked with each output video frame as an `ArrayBuffer`.
|
|
313
|
+
*/
|
|
314
|
+
OnVideoOutput?(handler: (chunk: ArrayBuffer) => void): void;
|
|
215
315
|
/**
|
|
216
316
|
* Registers a handler for transcript events (the text stream).
|
|
217
317
|
*
|
|
@@ -277,8 +377,32 @@ export interface IRealtimeSession {
|
|
|
277
377
|
* mid-session omit the member, and callers must feature-detect before invoking.
|
|
278
378
|
*
|
|
279
379
|
* @param instructions Instructions for the single spoken update (tone, brevity, content).
|
|
380
|
+
* @returns `true` when a response was actually triggered, `false` when it was skipped (e.g. a response
|
|
381
|
+
* is already in flight). A bridge that claimed the speaking floor for this turn uses this to release the
|
|
382
|
+
* floor immediately on a skip — otherwise a skipped trigger would wedge the room until the safety timer.
|
|
383
|
+
* `void`/`undefined` from legacy drivers is treated as "triggered" for backward compatibility.
|
|
384
|
+
*/
|
|
385
|
+
RequestSpokenUpdate?(instructions: string): boolean | void;
|
|
386
|
+
/**
|
|
387
|
+
* **Capability introspection.** A small, static description of what THIS live session can do, so the
|
|
388
|
+
* container can ask "is it safe to call X?" instead of invoking optional methods that silently no-op (or
|
|
389
|
+
* can't be supported) on some providers — the same role `IBridgeProviderFeatures` plays for bridges and
|
|
390
|
+
* {@link BaseRealtimeModel.SupportsClientDirect} plays for minting. Optional: a driver that hasn't
|
|
391
|
+
* declared its capabilities is treated **conservatively** (everything unsupported). As models gain
|
|
392
|
+
* abilities, drivers just flip a flag — no container changes.
|
|
393
|
+
*/
|
|
394
|
+
Capabilities?: RealtimeSessionCapabilities;
|
|
395
|
+
/**
|
|
396
|
+
* **Optional capability** (gate on {@link RealtimeSessionCapabilities.CanReconfigureTurnMode}) —
|
|
397
|
+
* reconfigures a **live** session's turn-taking without reconnecting: e.g. switch a 1:1 agent to
|
|
398
|
+
* meeting mode (auto-response off) when its room becomes multi-agent. Providers whose runtime config is
|
|
399
|
+
* mutable mid-socket (OpenAI: `session.update`) implement this and report the capability `true`;
|
|
400
|
+
* providers whose turn config is fixed at connect (Gemini Live's activity detection) report `false` and
|
|
401
|
+
* omit the method. The container **must** check the capability before calling — never blind-invoke.
|
|
402
|
+
*
|
|
403
|
+
* @param params The reconfiguration to apply (e.g. `DisableAutoResponse`).
|
|
280
404
|
*/
|
|
281
|
-
|
|
405
|
+
Reconfigure?(params: RealtimeReconfigureParams): void;
|
|
282
406
|
/**
|
|
283
407
|
* Registers a handler for provider-detected interruptions (barge-in).
|
|
284
408
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseRealtime.d.ts","sourceRoot":"","sources":["../../src/generic/baseRealtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,SAAS,GACf,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM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AM,CAAC;IAEpB;;;OAGG;IACH,gBAAgB,EAAE,UAAU,CAAC;CAChC"}
|
|
@@ -61,6 +61,24 @@ import { BaseModel } from "./baseModel.js";
|
|
|
61
61
|
*
|
|
62
62
|
* @abstract
|
|
63
63
|
*/
|
|
64
|
+
/**
|
|
65
|
+
* Emits a realtime-driver diagnostic line, but ONLY when verbose logging is enabled
|
|
66
|
+
* (`MJ_VERBOSE=true|1|yes`). These traces — turn boundaries, activity windows, response gating,
|
|
67
|
+
* barge-in — are invaluable when debugging a live session but far too chatty for normal operation,
|
|
68
|
+
* so they stay dark unless verbose mode is explicitly turned on. Shared here so every realtime driver
|
|
69
|
+
* and its session twin (OpenAI, Gemini, …) gate diagnostics through one consistent switch. The truthy
|
|
70
|
+
* set matches `@memberjunction/core`'s `IsVerboseLoggingEnabled` so a single `MJ_VERBOSE` flag governs
|
|
71
|
+
* verbose output across the whole stack.
|
|
72
|
+
*
|
|
73
|
+
* @param message The diagnostic message, already prefixed by the caller (e.g. `[GeminiRealtime][diag] …`).
|
|
74
|
+
*/
|
|
75
|
+
export function RealtimeDiagLog(message) {
|
|
76
|
+
const v = (process.env.MJ_VERBOSE ?? '').toLowerCase();
|
|
77
|
+
if (v === 'true' || v === '1' || v === 'yes') {
|
|
78
|
+
// eslint-disable-next-line no-console
|
|
79
|
+
console.log(message);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
64
82
|
export class BaseRealtimeModel extends BaseModel {
|
|
65
83
|
/**
|
|
66
84
|
* Whether this driver can mint an ephemeral, server-scoped client credential for a
|
|
@@ -99,5 +117,36 @@ export class BaseRealtimeModel extends BaseModel {
|
|
|
99
117
|
async CreateClientSession(_params) {
|
|
100
118
|
throw new Error(`${this.constructor.name} does not support client-direct realtime sessions`);
|
|
101
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Whether this driver's sessions carry a **video** track in addition to audio — i.e. the model
|
|
122
|
+
* accepts video input (it can "see" the user's camera) and/or emits video output (a talking-head
|
|
123
|
+
* avatar / generated video), in sync with audio.
|
|
124
|
+
*
|
|
125
|
+
* Defaults to `false` (audio-only — today's realtime models). Video-capable drivers (a native
|
|
126
|
+
* multimodal realtime model, or an avatar provider) override this to `true`. The session's media
|
|
127
|
+
* plane is media-tagged ({@link IRealtimeSession.SendInput} takes a {@link RealtimeMediaKind};
|
|
128
|
+
* {@link IRealtimeSession.OnVideoOutput} delivers video-out), so a video session reuses the entire
|
|
129
|
+
* realtime contract — only the media frames gain a `video` kind. Resolution prefers a video-capable
|
|
130
|
+
* model when an agent requests video, and degrades to audio-only otherwise.
|
|
131
|
+
*
|
|
132
|
+
* @returns `true` if sessions can carry video; `false` (audio-only) otherwise.
|
|
133
|
+
*/
|
|
134
|
+
get SupportsVideo() {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The provider-native voice ids this model can speak with (e.g. OpenAI `alloy`/`echo`/`shimmer`). The
|
|
139
|
+
* model/driver is the authoritative owner of "what voices do I support", so each driver declares its
|
|
140
|
+
* own — used to populate the dev voice picker. Default empty (a driver that hasn't declared voices
|
|
141
|
+
* yields no picker options, falling back to the configured/default voice).
|
|
142
|
+
*
|
|
143
|
+
* NOTE: this is the near-term, driver-owned source of truth. Long term this should move to metadata so
|
|
144
|
+
* providers that let users add their OWN voices (e.g. ElevenLabs) can be enumerated dynamically.
|
|
145
|
+
*
|
|
146
|
+
* @returns The supported voice ids (id + human label), or `[]` when none are declared.
|
|
147
|
+
*/
|
|
148
|
+
get SupportedVoices() {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
102
151
|
}
|
|
103
152
|
//# sourceMappingURL=baseRealtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseRealtime.js","sourceRoot":"","sources":["../../src/generic/baseRealtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoBxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QACpB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAW,eAAe;QACtB,OAAO,EAAE,CAAC;IACd,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.43.0",
|
|
5
5
|
"description": "MemberJunction: AI - core components for abstracting LLMs and other AI model types that are usable anywhere without ANY other MJ dependencies past @memberjunction/global which itself has zero additional dependencies.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "MemberJunction.com",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@memberjunction/global": "5.
|
|
20
|
+
"@memberjunction/global": "5.43.0",
|
|
21
21
|
"dotenv": "^17.2.4",
|
|
22
22
|
"rxjs": "^7.8.2"
|
|
23
23
|
},
|