@mastra/voice-google-gemini-live 0.14.13 → 0.14.14
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/dist/_types/@internal_voice/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +536 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +14 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -6
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1526,6 +1526,7 @@ var GeminiLiveVoice = class GeminiLiveVoice extends MastraVoice {
|
|
|
1526
1526
|
sessionStartTime;
|
|
1527
1527
|
isResuming = false;
|
|
1528
1528
|
sessionDurationTimeout;
|
|
1529
|
+
sessionExpiringTimeout;
|
|
1529
1530
|
tools;
|
|
1530
1531
|
requestContext;
|
|
1531
1532
|
processedToolCallIds = /* @__PURE__ */ new Set();
|
|
@@ -1807,10 +1808,7 @@ var GeminiLiveVoice = class GeminiLiveVoice extends MastraVoice {
|
|
|
1807
1808
|
return;
|
|
1808
1809
|
}
|
|
1809
1810
|
this.emit("session", { state: "disconnecting" });
|
|
1810
|
-
|
|
1811
|
-
clearTimeout(this.sessionDurationTimeout);
|
|
1812
|
-
this.sessionDurationTimeout = void 0;
|
|
1813
|
-
}
|
|
1811
|
+
this.clearSessionTimers();
|
|
1814
1812
|
if (this.ws) {
|
|
1815
1813
|
this.connectionManager.close();
|
|
1816
1814
|
this.ws = void 0;
|
|
@@ -2271,9 +2269,9 @@ var GeminiLiveVoice = class GeminiLiveVoice extends MastraVoice {
|
|
|
2271
2269
|
this.log("Invalid session duration format", { duration: this.options.sessionConfig.maxDuration });
|
|
2272
2270
|
return;
|
|
2273
2271
|
}
|
|
2274
|
-
|
|
2272
|
+
this.clearSessionTimers();
|
|
2275
2273
|
const warningTime = durationMs - 300 * 1e3;
|
|
2276
|
-
if (warningTime > 0) setTimeout(() => {
|
|
2274
|
+
if (warningTime > 0) this.sessionExpiringTimeout = setTimeout(() => {
|
|
2277
2275
|
this.emit("sessionExpiring", {
|
|
2278
2276
|
expiresIn: 300 * 1e3,
|
|
2279
2277
|
sessionId: this.sessionId
|
|
@@ -2285,6 +2283,30 @@ var GeminiLiveVoice = class GeminiLiveVoice extends MastraVoice {
|
|
|
2285
2283
|
}, durationMs);
|
|
2286
2284
|
}
|
|
2287
2285
|
/**
|
|
2286
|
+
* Clear the session expiry and expiry-warning timers
|
|
2287
|
+
* @private
|
|
2288
|
+
*/
|
|
2289
|
+
clearSessionTimers() {
|
|
2290
|
+
if (this.sessionDurationTimeout) {
|
|
2291
|
+
clearTimeout(this.sessionDurationTimeout);
|
|
2292
|
+
this.sessionDurationTimeout = void 0;
|
|
2293
|
+
}
|
|
2294
|
+
if (this.sessionExpiringTimeout) {
|
|
2295
|
+
clearTimeout(this.sessionExpiringTimeout);
|
|
2296
|
+
this.sessionExpiringTimeout = void 0;
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Release per-session resources when the socket goes away without disconnect().
|
|
2301
|
+
* disconnect() returns early once state is 'disconnected', so the socket close and
|
|
2302
|
+
* error handlers have to end speaker streams and clear session timers themselves.
|
|
2303
|
+
* @private
|
|
2304
|
+
*/
|
|
2305
|
+
releaseSessionResources() {
|
|
2306
|
+
this.clearSessionTimers();
|
|
2307
|
+
this.audioStreamManager.cleanupSpeakerStreams();
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2288
2310
|
* Parse duration string to milliseconds
|
|
2289
2311
|
* @private
|
|
2290
2312
|
*/
|
|
@@ -2322,6 +2344,7 @@ var GeminiLiveVoice = class GeminiLiveVoice extends MastraVoice {
|
|
|
2322
2344
|
reason: reasonText
|
|
2323
2345
|
});
|
|
2324
2346
|
this.state = "disconnected";
|
|
2347
|
+
this.releaseSessionResources();
|
|
2325
2348
|
this.emit("session", {
|
|
2326
2349
|
state: "disconnected",
|
|
2327
2350
|
code,
|
|
@@ -2339,6 +2362,7 @@ var GeminiLiveVoice = class GeminiLiveVoice extends MastraVoice {
|
|
|
2339
2362
|
this.ws.on("error", (error) => {
|
|
2340
2363
|
this.log("WebSocket error", error);
|
|
2341
2364
|
this.state = "disconnected";
|
|
2365
|
+
this.releaseSessionResources();
|
|
2342
2366
|
this.emit("session", { state: "disconnected" });
|
|
2343
2367
|
this.emit("error", {
|
|
2344
2368
|
message: error.message,
|