@google/gemini-cli-a2a-server 0.54.0-preview.1 → 0.54.4
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/a2a-server.mjs +97 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -54912,7 +54912,7 @@ var require_jsonfile = __commonJS({
|
|
|
54912
54912
|
await universalify.fromCallback(fs88.writeFile)(file, str2, options);
|
|
54913
54913
|
}
|
|
54914
54914
|
var writeFile9 = universalify.fromPromise(_writeFile);
|
|
54915
|
-
function
|
|
54915
|
+
function writeFileSync8(file, obj, options = {}) {
|
|
54916
54916
|
const fs88 = options.fs || _fs;
|
|
54917
54917
|
const str2 = stringify5(obj, options);
|
|
54918
54918
|
return fs88.writeFileSync(file, str2, options);
|
|
@@ -54921,7 +54921,7 @@ var require_jsonfile = __commonJS({
|
|
|
54921
54921
|
readFile: readFile12,
|
|
54922
54922
|
readFileSync: readFileSync10,
|
|
54923
54923
|
writeFile: writeFile9,
|
|
54924
|
-
writeFileSync:
|
|
54924
|
+
writeFileSync: writeFileSync8
|
|
54925
54925
|
};
|
|
54926
54926
|
}
|
|
54927
54927
|
});
|
|
@@ -220939,8 +220939,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
220939
220939
|
var init_git_commit = __esm({
|
|
220940
220940
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
220941
220941
|
"use strict";
|
|
220942
|
-
GIT_COMMIT_INFO = "
|
|
220943
|
-
CLI_VERSION = "0.54.
|
|
220942
|
+
GIT_COMMIT_INFO = "10944dcc4";
|
|
220943
|
+
CLI_VERSION = "0.54.4";
|
|
220944
220944
|
}
|
|
220945
220945
|
});
|
|
220946
220946
|
|
|
@@ -292296,7 +292296,10 @@ var init_chatRecordingService = __esm({
|
|
|
292296
292296
|
}
|
|
292297
292297
|
this.updateMetadata({ sessionId: this.sessionId });
|
|
292298
292298
|
} else {
|
|
292299
|
-
|
|
292299
|
+
debugLogger.warn("Failed to reload resumed session data from file; falling back to the in-memory conversation.");
|
|
292300
|
+
this.cachedConversation = resumedSessionData.conversation;
|
|
292301
|
+
this.projectHash = this.cachedConversation.projectHash;
|
|
292302
|
+
this.rewriteConversationFile(this.cachedConversation);
|
|
292300
292303
|
}
|
|
292301
292304
|
} else {
|
|
292302
292305
|
this.sessionId = this.context.promptId;
|
|
@@ -292366,6 +292369,57 @@ var init_chatRecordingService = __esm({
|
|
|
292366
292369
|
}
|
|
292367
292370
|
}
|
|
292368
292371
|
}
|
|
292372
|
+
/**
|
|
292373
|
+
* Rewrites the session file from an in-memory record. Any existing
|
|
292374
|
+
* (unreadable) file is preserved alongside rather than destroyed, and the
|
|
292375
|
+
* new file is written atomically (temp file + rename).
|
|
292376
|
+
*/
|
|
292377
|
+
rewriteConversationFile(conversation) {
|
|
292378
|
+
if (!this.conversationFile)
|
|
292379
|
+
return;
|
|
292380
|
+
if (this.conversationFile.endsWith(".json")) {
|
|
292381
|
+
this.conversationFile = this.conversationFile + "l";
|
|
292382
|
+
}
|
|
292383
|
+
const { messages, memoryScratchpad, ...metadata2 } = conversation;
|
|
292384
|
+
const lines = [JSON.stringify(metadata2)];
|
|
292385
|
+
for (const msg of messages) {
|
|
292386
|
+
lines.push(JSON.stringify(msg));
|
|
292387
|
+
}
|
|
292388
|
+
if (memoryScratchpad) {
|
|
292389
|
+
lines.push(JSON.stringify({ $set: { memoryScratchpad } }));
|
|
292390
|
+
}
|
|
292391
|
+
const content = lines.join("\n") + "\n";
|
|
292392
|
+
try {
|
|
292393
|
+
fs34.mkdirSync(path28.dirname(this.conversationFile), { recursive: true });
|
|
292394
|
+
if (fs34.existsSync(this.conversationFile)) {
|
|
292395
|
+
const backup = `${this.conversationFile}.unreadable-${Date.now()}`;
|
|
292396
|
+
try {
|
|
292397
|
+
fs34.renameSync(this.conversationFile, backup);
|
|
292398
|
+
debugLogger.warn(`Preserved the unreadable session file at ${backup}.`);
|
|
292399
|
+
} catch (backupError) {
|
|
292400
|
+
debugLogger.error("Failed to preserve the unreadable session file.", backupError);
|
|
292401
|
+
}
|
|
292402
|
+
}
|
|
292403
|
+
const tempFile = `${this.conversationFile}.tmp-${process.pid}`;
|
|
292404
|
+
try {
|
|
292405
|
+
fs34.writeFileSync(tempFile, content);
|
|
292406
|
+
fs34.renameSync(tempFile, this.conversationFile);
|
|
292407
|
+
} catch (error2) {
|
|
292408
|
+
try {
|
|
292409
|
+
fs34.unlinkSync(tempFile);
|
|
292410
|
+
} catch {
|
|
292411
|
+
}
|
|
292412
|
+
throw error2;
|
|
292413
|
+
}
|
|
292414
|
+
} catch (error2) {
|
|
292415
|
+
if (isNodeError(error2) && error2.code === "ENOSPC") {
|
|
292416
|
+
this.conversationFile = null;
|
|
292417
|
+
debugLogger.warn(ENOSPC_WARNING_MESSAGE);
|
|
292418
|
+
} else {
|
|
292419
|
+
throw error2;
|
|
292420
|
+
}
|
|
292421
|
+
}
|
|
292422
|
+
}
|
|
292369
292423
|
updateMetadata(updates) {
|
|
292370
292424
|
if (!this.cachedConversation)
|
|
292371
292425
|
return;
|
|
@@ -336586,7 +336640,7 @@ function getVersion() {
|
|
|
336586
336640
|
}
|
|
336587
336641
|
versionPromise = (async () => {
|
|
336588
336642
|
const pkgJson = await getPackageJson(__dirname4);
|
|
336589
|
-
return "0.54.
|
|
336643
|
+
return "0.54.4";
|
|
336590
336644
|
})();
|
|
336591
336645
|
return versionPromise;
|
|
336592
336646
|
}
|
|
@@ -366183,16 +366237,29 @@ function stripThoughts2(history) {
|
|
|
366183
366237
|
if (!hasThought)
|
|
366184
366238
|
return turn;
|
|
366185
366239
|
const nonThoughtParts = turn.content.parts.filter((p2) => p2 && !p2.thought);
|
|
366240
|
+
let patchedFirstCall = false;
|
|
366241
|
+
const finalParts = turn.content.role === "model" ? nonThoughtParts.map((p2) => {
|
|
366242
|
+
if (!patchedFirstCall && p2.functionCall) {
|
|
366243
|
+
patchedFirstCall = true;
|
|
366244
|
+
if (!p2.thoughtSignature) {
|
|
366245
|
+
return {
|
|
366246
|
+
...p2,
|
|
366247
|
+
thoughtSignature: SYNTHETIC_THOUGHT_SIGNATURE2
|
|
366248
|
+
};
|
|
366249
|
+
}
|
|
366250
|
+
}
|
|
366251
|
+
return p2;
|
|
366252
|
+
}) : nonThoughtParts;
|
|
366186
366253
|
return {
|
|
366187
366254
|
...turn,
|
|
366188
366255
|
content: {
|
|
366189
366256
|
...turn.content,
|
|
366190
|
-
parts:
|
|
366257
|
+
parts: finalParts
|
|
366191
366258
|
}
|
|
366192
366259
|
};
|
|
366193
366260
|
}).filter((turn) => !turn.content.parts || turn.content.parts.length > 0);
|
|
366194
366261
|
}
|
|
366195
|
-
var StreamEventType, MID_STREAM_RETRY_OPTIONS, SYNTHETIC_THOUGHT_SIGNATURE2, InvalidStreamError, AgentExecutionStoppedError, AgentExecutionBlockedError, GeminiChat;
|
|
366262
|
+
var StreamEventType, MID_STREAM_RETRY_OPTIONS, SYNTHETIC_THOUGHT_SIGNATURE2, INTERRUPTED_RESPONSE_PLACEHOLDER, InvalidStreamError, AgentExecutionStoppedError, AgentExecutionBlockedError, GeminiChat;
|
|
366196
366263
|
var init_geminiChat = __esm({
|
|
366197
366264
|
"packages/core/dist/src/core/geminiChat.js"() {
|
|
366198
366265
|
"use strict";
|
|
@@ -366227,6 +366294,7 @@ var init_geminiChat = __esm({
|
|
|
366227
366294
|
useExponentialBackoff: true
|
|
366228
366295
|
};
|
|
366229
366296
|
SYNTHETIC_THOUGHT_SIGNATURE2 = "skip_thought_signature_validator";
|
|
366297
|
+
INTERRUPTED_RESPONSE_PLACEHOLDER = "[The previous response was interrupted before it completed.]";
|
|
366230
366298
|
InvalidStreamError = class extends Error {
|
|
366231
366299
|
type;
|
|
366232
366300
|
constructor(message, type2) {
|
|
@@ -366343,6 +366411,9 @@ var init_geminiChat = __esm({
|
|
|
366343
366411
|
this.sendPromise = streamDonePromise;
|
|
366344
366412
|
let userContent = createUserContent(message);
|
|
366345
366413
|
const isOriginalFunctionResponse = isFunctionResponse(userContent);
|
|
366414
|
+
if (!isOriginalFunctionResponse) {
|
|
366415
|
+
this.closeUnansweredToolResponseTurn();
|
|
366416
|
+
}
|
|
366346
366417
|
const { model } = this.context.config.modelConfigService.getResolvedConfig(modelConfigKey);
|
|
366347
366418
|
const isContextManagementEnabled = this.context.config.isContextManagementEnabled();
|
|
366348
366419
|
if (!isOriginalFunctionResponse) {
|
|
@@ -366510,6 +366581,24 @@ var init_geminiChat = __esm({
|
|
|
366510
366581
|
};
|
|
366511
366582
|
return streamWithRetries.call(this);
|
|
366512
366583
|
}
|
|
366584
|
+
/**
|
|
366585
|
+
* Appends a closing model turn when history ends with an unanswered tool
|
|
366586
|
+
* response, so the next user message stays a turn of its own.
|
|
366587
|
+
*/
|
|
366588
|
+
closeUnansweredToolResponseTurn() {
|
|
366589
|
+
const turns = this.agentHistory.get();
|
|
366590
|
+
const last2 = turns[turns.length - 1];
|
|
366591
|
+
if (last2?.content.role !== "user" || !last2.content.parts?.some((part) => !!part.functionResponse)) {
|
|
366592
|
+
return;
|
|
366593
|
+
}
|
|
366594
|
+
this.agentHistory.push({
|
|
366595
|
+
id: randomUUID8(),
|
|
366596
|
+
content: {
|
|
366597
|
+
role: "model",
|
|
366598
|
+
parts: [{ text: INTERRUPTED_RESPONSE_PLACEHOLDER }]
|
|
366599
|
+
}
|
|
366600
|
+
});
|
|
366601
|
+
}
|
|
366513
366602
|
extractBinaryInjections(parts2) {
|
|
366514
366603
|
const binaryParts = [];
|
|
366515
366604
|
if (parts2) {
|