@firebase/ai 2.7.0-canary.691a506ec → 2.7.0-canary.8123231a1
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/ai-public.d.ts +15 -1
- package/dist/ai.d.ts +15 -1
- package/dist/esm/index.esm.js +22 -2
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/methods/live-session.d.ts +2 -2
- package/dist/esm/src/types/responses.d.ts +13 -0
- package/dist/index.cjs.js +22 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +22 -2
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +22 -2
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/methods/live-session.d.ts +2 -2
- package/dist/src/types/responses.d.ts +13 -0
- package/package.json +8 -8
package/dist/index.node.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
var name = "@firebase/ai";
|
|
11
|
-
var version = "2.7.0-canary.
|
|
11
|
+
var version = "2.7.0-canary.8123231a1";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -490,7 +490,8 @@ const URLRetrievalStatus = {
|
|
|
490
490
|
const LiveResponseType = {
|
|
491
491
|
SERVER_CONTENT: 'serverContent',
|
|
492
492
|
TOOL_CALL: 'toolCall',
|
|
493
|
-
TOOL_CALL_CANCELLATION: 'toolCallCancellation'
|
|
493
|
+
TOOL_CALL_CANCELLATION: 'toolCallCancellation',
|
|
494
|
+
GOING_AWAY_NOTICE: 'goingAwayNotice'
|
|
494
495
|
};
|
|
495
496
|
|
|
496
497
|
/**
|
|
@@ -2844,6 +2845,13 @@ class LiveSession {
|
|
|
2844
2845
|
...message.toolCallCancellation
|
|
2845
2846
|
};
|
|
2846
2847
|
}
|
|
2848
|
+
else if ('goAway' in message) {
|
|
2849
|
+
const notice = message.goAway;
|
|
2850
|
+
yield {
|
|
2851
|
+
type: LiveResponseType.GOING_AWAY_NOTICE,
|
|
2852
|
+
timeLeft: parseDuration(notice.timeLeft)
|
|
2853
|
+
};
|
|
2854
|
+
}
|
|
2847
2855
|
else {
|
|
2848
2856
|
logger.warn(`Received an unknown message type from the server: ${JSON.stringify(message)}`);
|
|
2849
2857
|
}
|
|
@@ -2922,6 +2930,18 @@ class LiveSession {
|
|
|
2922
2930
|
}
|
|
2923
2931
|
}
|
|
2924
2932
|
}
|
|
2933
|
+
/**
|
|
2934
|
+
* Parses a duration string (e.g. "3.000000001s") into a number of seconds.
|
|
2935
|
+
*
|
|
2936
|
+
* @param duration - The duration string to parse.
|
|
2937
|
+
* @returns The duration in seconds.
|
|
2938
|
+
*/
|
|
2939
|
+
function parseDuration(duration) {
|
|
2940
|
+
if (!duration || !duration.endsWith('s')) {
|
|
2941
|
+
return 0;
|
|
2942
|
+
}
|
|
2943
|
+
return Number(duration.slice(0, -1)); // slice removes the trailing 's'.
|
|
2944
|
+
}
|
|
2925
2945
|
|
|
2926
2946
|
/**
|
|
2927
2947
|
* @license
|