@mastra/voice-google-gemini-live 0.0.0-add-libsql-changeset-20250910154739
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/CHANGELOG.md +159 -0
- package/LICENSE.md +15 -0
- package/README.md +459 -0
- package/dist/index.cjs +2788 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +436 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2786 -0
- package/dist/index.js.map +1 -0
- package/dist/managers/AudioStreamManager.d.ts +207 -0
- package/dist/managers/AudioStreamManager.d.ts.map +1 -0
- package/dist/managers/AuthManager.d.ts +57 -0
- package/dist/managers/AuthManager.d.ts.map +1 -0
- package/dist/managers/ConnectionManager.d.ts +57 -0
- package/dist/managers/ConnectionManager.d.ts.map +1 -0
- package/dist/managers/ContextManager.d.ts +73 -0
- package/dist/managers/ContextManager.d.ts.map +1 -0
- package/dist/managers/EventManager.d.ts +64 -0
- package/dist/managers/EventManager.d.ts.map +1 -0
- package/dist/managers/SessionManager.d.ts +84 -0
- package/dist/managers/SessionManager.d.ts.map +1 -0
- package/dist/managers/index.d.ts +12 -0
- package/dist/managers/index.d.ts.map +1 -0
- package/dist/types.d.ts +319 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/errors.d.ts +17 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/package.json +66 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Google Gemini Live API integration
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Available Gemini Live API models
|
|
6
|
+
*/
|
|
7
|
+
export type GeminiVoiceModel = 'gemini-2.0-flash-exp' | 'gemini-2.0-flash-exp-image-generation' | 'gemini-2.0-flash-live-001' | 'gemini-live-2.5-flash-preview-native-audio' | 'gemini-2.5-flash-exp-native-audio-thinking-dialog' | 'gemini-live-2.5-flash-preview' | 'gemini-2.6.flash-preview-tts';
|
|
8
|
+
/**
|
|
9
|
+
* Available voice options for Gemini Live API
|
|
10
|
+
*/
|
|
11
|
+
export type GeminiVoiceName = 'Puck' | 'Charon' | 'Kore' | 'Fenrir';
|
|
12
|
+
/**
|
|
13
|
+
* Tool configuration for Gemini Live API
|
|
14
|
+
*/
|
|
15
|
+
export interface GeminiToolConfig {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
parameters: {
|
|
19
|
+
type: 'object';
|
|
20
|
+
properties: Record<string, any>;
|
|
21
|
+
required?: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Session configuration for connection management
|
|
26
|
+
*/
|
|
27
|
+
export interface GeminiSessionConfig {
|
|
28
|
+
/** Enable session resumption after network interruptions */
|
|
29
|
+
enableResumption?: boolean;
|
|
30
|
+
/** Maximum session duration (e.g., '24h', '2h') */
|
|
31
|
+
maxDuration?: string;
|
|
32
|
+
/** Enable automatic context compression */
|
|
33
|
+
contextCompression?: boolean;
|
|
34
|
+
/** Voice Activity Detection settings */
|
|
35
|
+
vad?: {
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
sensitivity?: number;
|
|
38
|
+
silenceDurationMs?: number;
|
|
39
|
+
};
|
|
40
|
+
/** Interrupt handling configuration */
|
|
41
|
+
interrupts?: {
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
allowUserInterruption?: boolean;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Configuration options for GeminiLiveVoice
|
|
48
|
+
*/
|
|
49
|
+
export interface GeminiLiveVoiceConfig {
|
|
50
|
+
/** Google API key */
|
|
51
|
+
apiKey?: string;
|
|
52
|
+
/** Model to use for the Live API */
|
|
53
|
+
model?: GeminiVoiceModel;
|
|
54
|
+
/** Voice to use for speech synthesis */
|
|
55
|
+
speaker?: GeminiVoiceName;
|
|
56
|
+
/** Use Vertex AI instead of Gemini API */
|
|
57
|
+
vertexAI?: boolean;
|
|
58
|
+
/** Google Cloud project ID (required for Vertex AI) */
|
|
59
|
+
project?: string;
|
|
60
|
+
/** Token expiration time in seconds (defaults to 50 minutes) */
|
|
61
|
+
tokenExpirationTime?: number;
|
|
62
|
+
/** Google Cloud region (defaults to us-central1) */
|
|
63
|
+
location?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Path to service account JSON key file for Vertex AI authentication.
|
|
66
|
+
* If not provided, will use Application Default Credentials (ADC).
|
|
67
|
+
*/
|
|
68
|
+
serviceAccountKeyFile?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Service account email for impersonation.
|
|
71
|
+
* Useful when you want to use a specific service account without a key file.
|
|
72
|
+
*/
|
|
73
|
+
serviceAccountEmail?: string;
|
|
74
|
+
/** System instructions for the model */
|
|
75
|
+
instructions?: string;
|
|
76
|
+
/** Tools available to the model */
|
|
77
|
+
tools?: GeminiToolConfig[];
|
|
78
|
+
/** Session configuration */
|
|
79
|
+
sessionConfig?: GeminiSessionConfig;
|
|
80
|
+
/** Audio configuration for input/output */
|
|
81
|
+
audioConfig?: Partial<AudioConfig>;
|
|
82
|
+
/** Enable debug logging */
|
|
83
|
+
debug?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Runtime options that can be passed to methods
|
|
87
|
+
*/
|
|
88
|
+
export interface GeminiLiveVoiceOptions {
|
|
89
|
+
/** Override the default speaker */
|
|
90
|
+
speaker?: GeminiVoiceName;
|
|
91
|
+
/** Language code for the response */
|
|
92
|
+
languageCode?: string;
|
|
93
|
+
/** Response modalities (audio, text, or both) */
|
|
94
|
+
responseModalities?: ('AUDIO' | 'TEXT')[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Event types emitted by GeminiLiveVoice
|
|
98
|
+
* Extends the base VoiceEventMap with Gemini Live specific events
|
|
99
|
+
*/
|
|
100
|
+
export interface GeminiLiveEventMap {
|
|
101
|
+
/** Audio response from the model - compatible with base VoiceEventMap */
|
|
102
|
+
speaker: NodeJS.ReadableStream;
|
|
103
|
+
/** Audio response with additional metadata */
|
|
104
|
+
speaking: {
|
|
105
|
+
audio?: string;
|
|
106
|
+
audioData?: Int16Array;
|
|
107
|
+
sampleRate?: number;
|
|
108
|
+
};
|
|
109
|
+
/** Text response or transcription - compatible with base VoiceEventMap */
|
|
110
|
+
writing: {
|
|
111
|
+
text: string;
|
|
112
|
+
role: 'assistant' | 'user';
|
|
113
|
+
};
|
|
114
|
+
/** Error events - compatible with base VoiceEventMap */
|
|
115
|
+
error: {
|
|
116
|
+
message: string;
|
|
117
|
+
code?: string;
|
|
118
|
+
details?: unknown;
|
|
119
|
+
};
|
|
120
|
+
/** Session state changes */
|
|
121
|
+
session: {
|
|
122
|
+
state: 'connecting' | 'connected' | 'disconnected' | 'disconnecting' | 'error' | 'updated';
|
|
123
|
+
config?: Record<string, unknown>;
|
|
124
|
+
};
|
|
125
|
+
/** Tool calls from the model */
|
|
126
|
+
toolCall: {
|
|
127
|
+
name: string;
|
|
128
|
+
args: Record<string, any>;
|
|
129
|
+
id: string;
|
|
130
|
+
};
|
|
131
|
+
/** Voice activity detection events */
|
|
132
|
+
vad: {
|
|
133
|
+
type: 'start' | 'end';
|
|
134
|
+
timestamp: number;
|
|
135
|
+
};
|
|
136
|
+
/** Interrupt events */
|
|
137
|
+
interrupt: {
|
|
138
|
+
type: 'user' | 'model';
|
|
139
|
+
timestamp: number;
|
|
140
|
+
};
|
|
141
|
+
/** Token usage information */
|
|
142
|
+
usage: {
|
|
143
|
+
inputTokens: number;
|
|
144
|
+
outputTokens: number;
|
|
145
|
+
totalTokens: number;
|
|
146
|
+
modality: 'audio' | 'text' | 'video';
|
|
147
|
+
};
|
|
148
|
+
/** Session resumption handle */
|
|
149
|
+
sessionHandle: {
|
|
150
|
+
handle: string;
|
|
151
|
+
expiresAt: Date;
|
|
152
|
+
};
|
|
153
|
+
/** Session expiring warning */
|
|
154
|
+
sessionExpiring: {
|
|
155
|
+
expiresIn: number;
|
|
156
|
+
sessionId?: string;
|
|
157
|
+
};
|
|
158
|
+
/** Turn completion event */
|
|
159
|
+
turnComplete: {
|
|
160
|
+
timestamp: number;
|
|
161
|
+
};
|
|
162
|
+
/** Allow any additional string keys for extensibility */
|
|
163
|
+
[key: string]: unknown;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* WebSocket message types for the Live API
|
|
167
|
+
*/
|
|
168
|
+
export interface GeminiLiveMessage {
|
|
169
|
+
type: string;
|
|
170
|
+
data?: unknown;
|
|
171
|
+
metadata?: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Configuration for audio processing
|
|
175
|
+
*/
|
|
176
|
+
export interface AudioConfig {
|
|
177
|
+
/** Input sample rate (16kHz for input) */
|
|
178
|
+
inputSampleRate: number;
|
|
179
|
+
/** Output sample rate (24kHz for output) */
|
|
180
|
+
outputSampleRate: number;
|
|
181
|
+
/** Audio encoding format */
|
|
182
|
+
encoding: 'pcm16' | 'pcm24';
|
|
183
|
+
/** Number of audio channels */
|
|
184
|
+
channels: 1;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Video configuration options
|
|
188
|
+
*/
|
|
189
|
+
export interface VideoConfig {
|
|
190
|
+
/** Video resolution (e.g., '1024x1024') */
|
|
191
|
+
resolution: string;
|
|
192
|
+
/** Video format */
|
|
193
|
+
format: 'jpeg' | 'png';
|
|
194
|
+
/** Frame rate */
|
|
195
|
+
frameRate: number;
|
|
196
|
+
}
|
|
197
|
+
export interface GeminiLiveServerMessage {
|
|
198
|
+
usageMetadata?: {
|
|
199
|
+
promptTokenCount?: number;
|
|
200
|
+
cachedContentTokenCount?: number;
|
|
201
|
+
responseTokenCount?: number;
|
|
202
|
+
toolUsePromptTokenCount?: number;
|
|
203
|
+
thoughtsTokenCount?: number;
|
|
204
|
+
totalTokenCount?: number;
|
|
205
|
+
promptTokensDetails?: Array<{
|
|
206
|
+
modality?: string;
|
|
207
|
+
tokenCount?: number;
|
|
208
|
+
}>;
|
|
209
|
+
cacheTokensDetails?: Array<{
|
|
210
|
+
modality?: string;
|
|
211
|
+
tokenCount?: number;
|
|
212
|
+
}>;
|
|
213
|
+
responseTokensDetails?: Array<{
|
|
214
|
+
modality?: string;
|
|
215
|
+
tokenCount?: number;
|
|
216
|
+
}>;
|
|
217
|
+
};
|
|
218
|
+
setup?: {
|
|
219
|
+
sessionHandle?: string;
|
|
220
|
+
};
|
|
221
|
+
setupComplete?: Record<string, unknown>;
|
|
222
|
+
serverContent?: {
|
|
223
|
+
modelTurn?: {
|
|
224
|
+
parts?: Array<{
|
|
225
|
+
text?: string;
|
|
226
|
+
inlineData?: {
|
|
227
|
+
mimeType?: string;
|
|
228
|
+
data?: string;
|
|
229
|
+
};
|
|
230
|
+
}>;
|
|
231
|
+
};
|
|
232
|
+
turnComplete?: boolean;
|
|
233
|
+
};
|
|
234
|
+
toolCall?: {
|
|
235
|
+
name?: string;
|
|
236
|
+
args?: Record<string, unknown>;
|
|
237
|
+
id?: string;
|
|
238
|
+
};
|
|
239
|
+
sessionEnd?: {
|
|
240
|
+
reason?: string;
|
|
241
|
+
};
|
|
242
|
+
error?: {
|
|
243
|
+
code?: string;
|
|
244
|
+
message?: string;
|
|
245
|
+
details?: unknown;
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
export interface AuthOptions {
|
|
249
|
+
scopes: string[];
|
|
250
|
+
projectId?: string;
|
|
251
|
+
keyFilename?: string;
|
|
252
|
+
tokenExpirationTime?: number;
|
|
253
|
+
clientOptions?: {
|
|
254
|
+
subject?: string;
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
export declare enum GeminiLiveErrorCode {
|
|
258
|
+
CONNECTION_FAILED = "connection_failed",
|
|
259
|
+
CONNECTION_NOT_ESTABLISHED = "connection_not_established",
|
|
260
|
+
AUTHENTICATION_FAILED = "authentication_failed",
|
|
261
|
+
API_KEY_MISSING = "api_key_missing",
|
|
262
|
+
PROJECT_ID_MISSING = "project_id_missing",
|
|
263
|
+
WEBSOCKET_ERROR = "websocket_error",
|
|
264
|
+
AUDIO_PROCESSING_ERROR = "audio_processing_error",
|
|
265
|
+
AUDIO_STREAM_ERROR = "audio_stream_error",
|
|
266
|
+
SPEAKER_STREAM_ERROR = "speaker_stream_error",
|
|
267
|
+
TRANSCRIPTION_TIMEOUT = "transcription_timeout",
|
|
268
|
+
TRANSCRIPTION_FAILED = "transcription_failed",
|
|
269
|
+
TOOL_EXECUTION_ERROR = "tool_execution_error",
|
|
270
|
+
TOOL_NOT_FOUND = "tool_not_found",
|
|
271
|
+
SESSION_CONFIG_UPDATE_FAILED = "session_config_update_failed",
|
|
272
|
+
SESSION_RESUMPTION_FAILED = "session_resumption_failed",
|
|
273
|
+
INVALID_AUDIO_FORMAT = "invalid_audio_format",
|
|
274
|
+
STREAM_LIMIT_EXCEEDED = "stream_limit_exceeded",
|
|
275
|
+
NOT_CONNECTED = "not_connected",
|
|
276
|
+
INVALID_STATE = "invalid_state",
|
|
277
|
+
UNKNOWN_ERROR = "unknown_error"
|
|
278
|
+
}
|
|
279
|
+
export interface UpdateMessage {
|
|
280
|
+
type: string;
|
|
281
|
+
session: {
|
|
282
|
+
generation_config?: {
|
|
283
|
+
/** Which modalities the model should respond with for this turn */
|
|
284
|
+
response_modalities?: ('AUDIO' | 'TEXT')[];
|
|
285
|
+
speech_config?: {
|
|
286
|
+
/** Optional language code for synthesized speech */
|
|
287
|
+
language_code?: string;
|
|
288
|
+
voice_config?: {
|
|
289
|
+
prebuilt_voice_config?: {
|
|
290
|
+
voice_name: string;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
system_instruction?: {
|
|
296
|
+
parts: Array<{
|
|
297
|
+
text: string;
|
|
298
|
+
}>;
|
|
299
|
+
};
|
|
300
|
+
tools?: Array<{
|
|
301
|
+
function_declarations: Array<{
|
|
302
|
+
name: string;
|
|
303
|
+
description?: string;
|
|
304
|
+
parameters?: unknown;
|
|
305
|
+
}>;
|
|
306
|
+
}>;
|
|
307
|
+
vad?: {
|
|
308
|
+
enabled: boolean;
|
|
309
|
+
sensitivity?: number;
|
|
310
|
+
silence_duration_ms?: number;
|
|
311
|
+
};
|
|
312
|
+
interrupts?: {
|
|
313
|
+
enabled: boolean;
|
|
314
|
+
allow_user_interruption?: boolean;
|
|
315
|
+
};
|
|
316
|
+
context_compression?: boolean;
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,sBAAsB,GACtB,uCAAuC,GACvC,2BAA2B,GAC3B,4CAA4C,GAC5C,mDAAmD,GACnD,+BAA+B,GAC/B,8BAA8B,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,wCAAwC;IACxC,GAAG,CAAC,EAAE;QACJ,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,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AkB,CAAC,EAAE;YACnB,KAAK,EAAE,KAAK,CAAC;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,CAAC,CAAC;SAChC,CAAC;QACF,KAAK,CAAC,EAAE,KAAK,CAAC;YACZ,qBAAqB,EAAE,KAAK,CAAC;gBAC3B,IAAI,EAAE,MAAM,CAAC;gBACb,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,UAAU,CAAC,EAAE,OAAO,CAAC;aACtB,CAAC,CAAC;SACJ,CAAC,CAAC;QACH,GAAG,CAAC,EAAE;YACJ,OAAO,EAAE,OAAO,CAAC;YACjB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;SAC9B,CAAC;QACF,UAAU,CAAC,EAAE;YACX,OAAO,EAAE,OAAO,CAAC;YACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;SACnC,CAAC;QACF,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,CAAC;CACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GeminiLiveErrorCode } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper class for consistent error handling across managers and provider
|
|
4
|
+
*/
|
|
5
|
+
export declare class GeminiLiveError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly details?: unknown;
|
|
8
|
+
readonly timestamp: number;
|
|
9
|
+
constructor(code: GeminiLiveErrorCode | string, message: string, details?: unknown);
|
|
10
|
+
toEventData(): {
|
|
11
|
+
message: string;
|
|
12
|
+
code: string;
|
|
13
|
+
details: unknown;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAEtB,IAAI,EAAE,mBAAmB,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;IAQlF,WAAW;;;;;;CAQZ"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mastra/voice-google-gemini-live",
|
|
3
|
+
"version": "0.0.0-add-libsql-changeset-20250910154739",
|
|
4
|
+
"description": "Mastra Google Gemini Live API integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"CHANGELOG.md"
|
|
9
|
+
],
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@google/genai": "latest",
|
|
28
|
+
"google-auth-library": "^10.2.1",
|
|
29
|
+
"ws": "^8.18.3",
|
|
30
|
+
"zod": "^3.25.76",
|
|
31
|
+
"zod-to-json-schema": "^3.24.6"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^20.19.0",
|
|
35
|
+
"@types/ws": "^8.18.1",
|
|
36
|
+
"eslint": "^9.30.1",
|
|
37
|
+
"tsup": "^8.5.0",
|
|
38
|
+
"tsx": "latest",
|
|
39
|
+
"typescript": "^5.8.3",
|
|
40
|
+
"vitest": "^3.2.4",
|
|
41
|
+
"@internal/lint": "0.0.0-add-libsql-changeset-20250910154739",
|
|
42
|
+
"@mastra/core": "0.0.0-add-libsql-changeset-20250910154739"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"zod": "^3.0.0",
|
|
46
|
+
"@mastra/core": "0.0.0-add-libsql-changeset-20250910154739"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://mastra.ai",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
52
|
+
"directory": "voice/google-gemini-live-api"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsup --silent --config tsup.config.ts",
|
|
59
|
+
"build:watch": "tsup --watch --silent --config tsup.config.ts",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:simple": "npx tsx src/test.ts simple",
|
|
62
|
+
"test:comprehensive": "npx tsx src/test.ts comprehensive",
|
|
63
|
+
"test:tts": "npx tsx src/test.ts",
|
|
64
|
+
"lint": "eslint ."
|
|
65
|
+
}
|
|
66
|
+
}
|