@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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { FirebaseError, Deferred, getModularInstance } from '@firebase/util';
|
|
|
4
4
|
import { Logger } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
var name = "@firebase/ai";
|
|
7
|
-
var version = "2.7.0-canary.
|
|
7
|
+
var version = "2.7.0-canary.8123231a1";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -486,7 +486,8 @@ const URLRetrievalStatus = {
|
|
|
486
486
|
const LiveResponseType = {
|
|
487
487
|
SERVER_CONTENT: 'serverContent',
|
|
488
488
|
TOOL_CALL: 'toolCall',
|
|
489
|
-
TOOL_CALL_CANCELLATION: 'toolCallCancellation'
|
|
489
|
+
TOOL_CALL_CANCELLATION: 'toolCallCancellation',
|
|
490
|
+
GOING_AWAY_NOTICE: 'goingAwayNotice'
|
|
490
491
|
};
|
|
491
492
|
|
|
492
493
|
/**
|
|
@@ -2840,6 +2841,13 @@ class LiveSession {
|
|
|
2840
2841
|
...message.toolCallCancellation
|
|
2841
2842
|
};
|
|
2842
2843
|
}
|
|
2844
|
+
else if ('goAway' in message) {
|
|
2845
|
+
const notice = message.goAway;
|
|
2846
|
+
yield {
|
|
2847
|
+
type: LiveResponseType.GOING_AWAY_NOTICE,
|
|
2848
|
+
timeLeft: parseDuration(notice.timeLeft)
|
|
2849
|
+
};
|
|
2850
|
+
}
|
|
2843
2851
|
else {
|
|
2844
2852
|
logger.warn(`Received an unknown message type from the server: ${JSON.stringify(message)}`);
|
|
2845
2853
|
}
|
|
@@ -2918,6 +2926,18 @@ class LiveSession {
|
|
|
2918
2926
|
}
|
|
2919
2927
|
}
|
|
2920
2928
|
}
|
|
2929
|
+
/**
|
|
2930
|
+
* Parses a duration string (e.g. "3.000000001s") into a number of seconds.
|
|
2931
|
+
*
|
|
2932
|
+
* @param duration - The duration string to parse.
|
|
2933
|
+
* @returns The duration in seconds.
|
|
2934
|
+
*/
|
|
2935
|
+
function parseDuration(duration) {
|
|
2936
|
+
if (!duration || !duration.endsWith('s')) {
|
|
2937
|
+
return 0;
|
|
2938
|
+
}
|
|
2939
|
+
return Number(duration.slice(0, -1)); // slice removes the trailing 's'.
|
|
2940
|
+
}
|
|
2921
2941
|
|
|
2922
2942
|
/**
|
|
2923
2943
|
* @license
|