@memberjunction/ai-gemini 6.2.0-edge.0 → 6.2.0-edge.1
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/geminiRealtime.js +8 -8
- package/package.json +4 -4
package/dist/geminiRealtime.js
CHANGED
|
@@ -722,7 +722,7 @@ class GeminiRealtimeSession {
|
|
|
722
722
|
* {@link RegisterTools} compares against it to no-op identical re-registrations.
|
|
723
723
|
* Defaults to the empty set's fingerprint for sessions started without tools.
|
|
724
724
|
*/
|
|
725
|
-
this.connectTimeToolsFingerprint = GeminiRealtimeSession.
|
|
725
|
+
this.connectTimeToolsFingerprint = GeminiRealtimeSession.toolSetFingerprint([]);
|
|
726
726
|
/**
|
|
727
727
|
* Whether a model turn is currently being generated. Minimal turn tracking mirroring the
|
|
728
728
|
* client driver: set when model output arrives (Gemini has no `response.created`-style frame,
|
|
@@ -808,7 +808,7 @@ class GeminiRealtimeSession {
|
|
|
808
808
|
RealtimeDiagLog('[GeminiRealtime][diag] meeting: activityStart — opened input window on first audio (now accumulating room audio)');
|
|
809
809
|
}
|
|
810
810
|
const audio = {
|
|
811
|
-
data: GeminiRealtimeSession.
|
|
811
|
+
data: GeminiRealtimeSession.arrayBufferToBase64(chunk),
|
|
812
812
|
mimeType: GEMINI_INPUT_AUDIO_MIME_TYPE,
|
|
813
813
|
};
|
|
814
814
|
live.sendRealtimeInput({ audio });
|
|
@@ -826,7 +826,7 @@ class GeminiRealtimeSession {
|
|
|
826
826
|
* without making the tools callable).
|
|
827
827
|
*/
|
|
828
828
|
async RegisterTools(tools) {
|
|
829
|
-
if (GeminiRealtimeSession.
|
|
829
|
+
if (GeminiRealtimeSession.toolSetFingerprint(tools) === this.connectTimeToolsFingerprint) {
|
|
830
830
|
return; // identical to the connect-time set — silent no-op
|
|
831
831
|
}
|
|
832
832
|
console.warn('GeminiRealtimeSession.RegisterTools: Gemini Live binds its tool set at connect time and cannot ' +
|
|
@@ -838,10 +838,10 @@ class GeminiRealtimeSession {
|
|
|
838
838
|
* apply the contract's idempotency rule. Called by {@link GeminiRealtime.StartSession}.
|
|
839
839
|
*/
|
|
840
840
|
SetConnectTimeTools(tools) {
|
|
841
|
-
this.connectTimeToolsFingerprint = GeminiRealtimeSession.
|
|
841
|
+
this.connectTimeToolsFingerprint = GeminiRealtimeSession.toolSetFingerprint(tools);
|
|
842
842
|
}
|
|
843
843
|
/** Canonical, order-insensitive fingerprint of a tool set for identity comparison. */
|
|
844
|
-
static
|
|
844
|
+
static toolSetFingerprint(tools) {
|
|
845
845
|
return JSON.stringify([...tools]
|
|
846
846
|
.sort((a, b) => a.Name.localeCompare(b.Name))
|
|
847
847
|
.map((t) => ({ Name: t.Name, Description: t.Description, ParametersSchema: t.ParametersSchema })));
|
|
@@ -1134,7 +1134,7 @@ class GeminiRealtimeSession {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
const data = part.inlineData?.data;
|
|
1136
1136
|
if (data) {
|
|
1137
|
-
this.outputHandler(GeminiRealtimeSession.
|
|
1137
|
+
this.outputHandler(GeminiRealtimeSession.base64ToArrayBuffer(data));
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
@@ -1251,11 +1251,11 @@ class GeminiRealtimeSession {
|
|
|
1251
1251
|
return this.live;
|
|
1252
1252
|
}
|
|
1253
1253
|
/** Encodes an `ArrayBuffer` of raw bytes to a base64 string for Gemini's `Blob.data`. */
|
|
1254
|
-
static
|
|
1254
|
+
static arrayBufferToBase64(buffer) {
|
|
1255
1255
|
return Buffer.from(new Uint8Array(buffer)).toString('base64');
|
|
1256
1256
|
}
|
|
1257
1257
|
/** Decodes a base64 `Blob.data` string from Gemini into a raw `ArrayBuffer`. */
|
|
1258
|
-
static
|
|
1258
|
+
static base64ToArrayBuffer(base64) {
|
|
1259
1259
|
const bytes = Buffer.from(base64, 'base64');
|
|
1260
1260
|
// Copy into a freshly-allocated ArrayBuffer so we never leak the surrounding Node pool buffer
|
|
1261
1261
|
// (and so the result is a plain ArrayBuffer, not ArrayBufferLike).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai-gemini",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.2.0-edge.
|
|
4
|
+
"version": "6.2.0-edge.1",
|
|
5
5
|
"description": "MemberJunction Wrapper for Google Gemini AI Models",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"author": "MemberJunction.com",
|
|
12
12
|
"license": "BUSL-1.1",
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@memberjunction/unit-testing": "6.2.0-edge.
|
|
14
|
+
"@memberjunction/unit-testing": "6.2.0-edge.1",
|
|
15
15
|
"ts-node-dev": "^2.0.0",
|
|
16
16
|
"typescript": "^5.9.3"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@memberjunction/ai": "6.2.0-edge.
|
|
20
|
-
"@memberjunction/global": "6.2.0-edge.
|
|
19
|
+
"@memberjunction/ai": "6.2.0-edge.1",
|
|
20
|
+
"@memberjunction/global": "6.2.0-edge.1",
|
|
21
21
|
"@google/genai": "^2.8.0"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|