@google/gemini-cli-a2a-server 0.53.0-preview.0 → 0.54.0-nightly.20260727.g3818efbbf
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 +107 -67
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -80891,7 +80891,7 @@ var require_gaxios2 = __commonJS({
|
|
|
80891
80891
|
var retry_js_1 = require_retry6();
|
|
80892
80892
|
var stream_1 = __require("stream");
|
|
80893
80893
|
var interceptor_js_1 = require_interceptor2();
|
|
80894
|
-
var
|
|
80894
|
+
var randomUUID24 = async () => globalThis.crypto?.randomUUID() || (await import("crypto")).randomUUID();
|
|
80895
80895
|
var HTTP_STATUS_NO_CONTENT = 204;
|
|
80896
80896
|
var Gaxios = class {
|
|
80897
80897
|
agentCache = /* @__PURE__ */ new Map();
|
|
@@ -81164,7 +81164,7 @@ var require_gaxios2 = __commonJS({
|
|
|
81164
81164
|
*/
|
|
81165
81165
|
["Blob", "File", "FormData"].includes(opts.data?.constructor?.name || "");
|
|
81166
81166
|
if (opts.multipart?.length) {
|
|
81167
|
-
const boundary = await
|
|
81167
|
+
const boundary = await randomUUID24();
|
|
81168
81168
|
preparedHeaders.set("content-type", `multipart/related; boundary=${boundary}`);
|
|
81169
81169
|
opts.body = stream_1.Readable.from(this.getMultipartRequest(opts.multipart, boundary));
|
|
81170
81170
|
} else if (shouldDirectlyPassData) {
|
|
@@ -109138,7 +109138,7 @@ var require_gaxios3 = __commonJS({
|
|
|
109138
109138
|
var retry_js_1 = require_retry7();
|
|
109139
109139
|
var stream_1 = __require("stream");
|
|
109140
109140
|
var interceptor_js_1 = require_interceptor3();
|
|
109141
|
-
var
|
|
109141
|
+
var randomUUID24 = async () => globalThis.crypto?.randomUUID() || (await import("crypto")).randomUUID();
|
|
109142
109142
|
var HTTP_STATUS_NO_CONTENT = 204;
|
|
109143
109143
|
var Gaxios = class {
|
|
109144
109144
|
agentCache = /* @__PURE__ */ new Map();
|
|
@@ -109411,7 +109411,7 @@ var require_gaxios3 = __commonJS({
|
|
|
109411
109411
|
*/
|
|
109412
109412
|
["Blob", "File", "FormData"].includes(opts.data?.constructor?.name || "");
|
|
109413
109413
|
if (opts.multipart?.length) {
|
|
109414
|
-
const boundary = await
|
|
109414
|
+
const boundary = await randomUUID24();
|
|
109415
109415
|
preparedHeaders.set("content-type", `multipart/related; boundary=${boundary}`);
|
|
109416
109416
|
opts.body = stream_1.Readable.from(this.getMultipartRequest(opts.multipart, boundary));
|
|
109417
109417
|
} else if (shouldDirectlyPassData) {
|
|
@@ -220929,8 +220929,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
220929
220929
|
var init_git_commit = __esm({
|
|
220930
220930
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
220931
220931
|
"use strict";
|
|
220932
|
-
GIT_COMMIT_INFO = "
|
|
220933
|
-
CLI_VERSION = "0.
|
|
220932
|
+
GIT_COMMIT_INFO = "3818efbbf";
|
|
220933
|
+
CLI_VERSION = "0.54.0-nightly.20260727.g3818efbbf";
|
|
220934
220934
|
}
|
|
220935
220935
|
});
|
|
220936
220936
|
|
|
@@ -336548,7 +336548,7 @@ function getVersion() {
|
|
|
336548
336548
|
}
|
|
336549
336549
|
versionPromise = (async () => {
|
|
336550
336550
|
const pkgJson = await getPackageJson(__dirname4);
|
|
336551
|
-
return "0.
|
|
336551
|
+
return "0.54.0-nightly.20260727.g3818efbbf";
|
|
336552
336552
|
})();
|
|
336553
336553
|
return versionPromise;
|
|
336554
336554
|
}
|
|
@@ -337009,6 +337009,17 @@ ${errorMessage}`, true);
|
|
|
337009
337009
|
}
|
|
337010
337010
|
});
|
|
337011
337011
|
|
|
337012
|
+
// packages/core/dist/src/utils/session.js
|
|
337013
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
337014
|
+
function createSessionId() {
|
|
337015
|
+
return randomUUID7();
|
|
337016
|
+
}
|
|
337017
|
+
var init_session = __esm({
|
|
337018
|
+
"packages/core/dist/src/utils/session.js"() {
|
|
337019
|
+
"use strict";
|
|
337020
|
+
}
|
|
337021
|
+
});
|
|
337022
|
+
|
|
337012
337023
|
// packages/core/dist/src/utils/secure-browser-launcher.js
|
|
337013
337024
|
import { execFile as execFile6 } from "node:child_process";
|
|
337014
337025
|
import { promisify as promisify10 } from "node:util";
|
|
@@ -337773,6 +337784,7 @@ async function handleUpgrade() {
|
|
|
337773
337784
|
async function processIntent(config2, intent, fallbackModel, failedModel) {
|
|
337774
337785
|
switch (intent) {
|
|
337775
337786
|
case "retry_always":
|
|
337787
|
+
config2.rotateSessionId(createSessionId());
|
|
337776
337788
|
config2.activateFallbackMode(fallbackModel, failedModel);
|
|
337777
337789
|
return true;
|
|
337778
337790
|
case "retry_once":
|
|
@@ -337794,6 +337806,7 @@ var UPGRADE_URL_PAGE;
|
|
|
337794
337806
|
var init_handler = __esm({
|
|
337795
337807
|
"packages/core/dist/src/fallback/handler.js"() {
|
|
337796
337808
|
"use strict";
|
|
337809
|
+
init_session();
|
|
337797
337810
|
init_secure_browser_launcher();
|
|
337798
337811
|
init_debugLogger();
|
|
337799
337812
|
init_errors2();
|
|
@@ -340491,6 +340504,9 @@ var init_server = __esm({
|
|
|
340491
340504
|
this.paidTier = paidTier;
|
|
340492
340505
|
this.config = config2;
|
|
340493
340506
|
}
|
|
340507
|
+
getEffectiveSessionId() {
|
|
340508
|
+
return this.config?.getSessionId() ?? this.sessionId;
|
|
340509
|
+
}
|
|
340494
340510
|
async generateContentStream(req, userPromptId, role) {
|
|
340495
340511
|
const autoUse = this.config ? shouldAutoUseCredits(this.config.getBillingSettings().overageStrategy, getG1CreditBalance(this.paidTier)) : false;
|
|
340496
340512
|
const modelIsEligible = isOverageEligibleModel(req.model);
|
|
@@ -340500,7 +340516,7 @@ var init_server = __esm({
|
|
|
340500
340516
|
coreEvents.emitFeedback("info", "Using AI Credits for this request.");
|
|
340501
340517
|
}
|
|
340502
340518
|
const enabledCreditTypes = shouldEnableCredits ? [G1_CREDIT_TYPE] : void 0;
|
|
340503
|
-
const responses = await this.requestStreamingPost("streamGenerateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.
|
|
340519
|
+
const responses = await this.requestStreamingPost("streamGenerateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.getEffectiveSessionId(), enabledCreditTypes), req.config?.abortSignal);
|
|
340504
340520
|
const streamingLatency = {};
|
|
340505
340521
|
const start2 = Date.now();
|
|
340506
340522
|
let isFirst = true;
|
|
@@ -340514,7 +340530,7 @@ var init_server = __esm({
|
|
|
340514
340530
|
}
|
|
340515
340531
|
streamingLatency.totalLatency = formatProtoJsonDuration(Date.now() - start2);
|
|
340516
340532
|
const translatedResponse = fromGenerateContentResponse(response);
|
|
340517
|
-
await recordConversationOffered(server, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, server.
|
|
340533
|
+
await recordConversationOffered(server, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, server.getEffectiveSessionId());
|
|
340518
340534
|
if (response.consumedCredits) {
|
|
340519
340535
|
for (const credit of response.consumedCredits) {
|
|
340520
340536
|
if (credit.creditType === G1_CREDIT_TYPE && credit.creditAmount) {
|
|
@@ -340540,14 +340556,14 @@ var init_server = __esm({
|
|
|
340540
340556
|
}
|
|
340541
340557
|
async generateContent(req, userPromptId, role) {
|
|
340542
340558
|
const start2 = Date.now();
|
|
340543
|
-
const response = await this.requestPost("generateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.
|
|
340559
|
+
const response = await this.requestPost("generateContent", toGenerateContentRequest(req, userPromptId, this.projectId, this.getEffectiveSessionId(), void 0), req.config?.abortSignal, GENERATE_CONTENT_RETRY_DELAY_IN_MILLISECONDS);
|
|
340544
340560
|
const duration3 = formatProtoJsonDuration(Date.now() - start2);
|
|
340545
340561
|
const streamingLatency = {
|
|
340546
340562
|
totalLatency: duration3,
|
|
340547
340563
|
firstMessageLatency: duration3
|
|
340548
340564
|
};
|
|
340549
340565
|
const translatedResponse = fromGenerateContentResponse(response);
|
|
340550
|
-
await recordConversationOffered(this, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, this.
|
|
340566
|
+
await recordConversationOffered(this, response.traceId, translatedResponse, streamingLatency, req.config?.abortSignal, this.getEffectiveSessionId());
|
|
340551
340567
|
if (response.remainingCredits) {
|
|
340552
340568
|
this.updateCredits(response.remainingCredits);
|
|
340553
340569
|
}
|
|
@@ -365987,7 +366003,7 @@ var init_historyHardening = __esm({
|
|
|
365987
366003
|
});
|
|
365988
366004
|
|
|
365989
366005
|
// packages/core/dist/src/core/geminiChat.js
|
|
365990
|
-
import { randomUUID as
|
|
366006
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
365991
366007
|
function isIndexedPart(part) {
|
|
365992
366008
|
return "callIndex" in part;
|
|
365993
366009
|
}
|
|
@@ -366116,6 +366132,23 @@ function coalesceConsecutiveRoles(history) {
|
|
|
366116
366132
|
}
|
|
366117
366133
|
return result2;
|
|
366118
366134
|
}
|
|
366135
|
+
function stripThoughts2(history) {
|
|
366136
|
+
return history.map((turn) => {
|
|
366137
|
+
if (!turn.content.parts)
|
|
366138
|
+
return turn;
|
|
366139
|
+
const hasThought = turn.content.parts.some((p2) => p2 && p2.thought);
|
|
366140
|
+
if (!hasThought)
|
|
366141
|
+
return turn;
|
|
366142
|
+
const nonThoughtParts = turn.content.parts.filter((p2) => p2 && !p2.thought);
|
|
366143
|
+
return {
|
|
366144
|
+
...turn,
|
|
366145
|
+
content: {
|
|
366146
|
+
...turn.content,
|
|
366147
|
+
parts: nonThoughtParts
|
|
366148
|
+
}
|
|
366149
|
+
};
|
|
366150
|
+
}).filter((turn) => !turn.content.parts || turn.content.parts.length > 0);
|
|
366151
|
+
}
|
|
366119
366152
|
var StreamEventType, MID_STREAM_RETRY_OPTIONS, SYNTHETIC_THOUGHT_SIGNATURE2, InvalidStreamError, AgentExecutionStoppedError, AgentExecutionBlockedError, GeminiChat;
|
|
366120
366153
|
var init_geminiChat = __esm({
|
|
366121
366154
|
"packages/core/dist/src/core/geminiChat.js"() {
|
|
@@ -366197,7 +366230,7 @@ var init_geminiChat = __esm({
|
|
|
366197
366230
|
validateHistory2(history);
|
|
366198
366231
|
let initialHistory;
|
|
366199
366232
|
if (history.length > 0) {
|
|
366200
|
-
initialHistory = history.map((item) => "id" in item && "content" in item ? item : { id:
|
|
366233
|
+
initialHistory = history.map((item) => "id" in item && "content" in item ? item : { id: randomUUID8(), content: item });
|
|
366201
366234
|
} else if (resumedSessionData) {
|
|
366202
366235
|
initialHistory = resumedSessionData.conversation.messages.filter((m3) => m3.type === "user" || m3.type === "gemini").map((m3) => ({
|
|
366203
366236
|
id: m3.id,
|
|
@@ -366472,7 +366505,7 @@ var init_geminiChat = __esm({
|
|
|
366472
366505
|
tools: this.tools,
|
|
366473
366506
|
abortSignal
|
|
366474
366507
|
};
|
|
366475
|
-
let contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
|
|
366508
|
+
let contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
|
|
366476
366509
|
const hookSystem = this.context.config.getHookSystem();
|
|
366477
366510
|
if (hookSystem) {
|
|
366478
366511
|
const beforeModelResult = await hookSystem.fireBeforeModelEvent({
|
|
@@ -366495,7 +366528,7 @@ var init_geminiChat = __esm({
|
|
|
366495
366528
|
if (beforeModelResult.modifiedModel) {
|
|
366496
366529
|
modelToUse = resolveModel(beforeModelResult.modifiedModel, useGemini3_1, false, hasAccessToPreview, this.context.config, this.context.config.hasGemini35FlashGAAccess?.() ?? false);
|
|
366497
366530
|
lastModelToUse = modelToUse;
|
|
366498
|
-
contentsToUse = supportsModernFeatures(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
|
|
366531
|
+
contentsToUse = supportsModernFeatures(modelToUse) || isGemini2Model(modelToUse) ? [...contentsForPreviewModel] : [...requestContents];
|
|
366499
366532
|
}
|
|
366500
366533
|
if (beforeModelResult.modifiedConfig) {
|
|
366501
366534
|
Object.assign(config2, beforeModelResult.modifiedConfig);
|
|
@@ -366592,7 +366625,14 @@ var init_geminiChat = __esm({
|
|
|
366592
366625
|
*/
|
|
366593
366626
|
getHistoryTurns(curated = false) {
|
|
366594
366627
|
const history = curated ? extractCuratedHistory2(this.agentHistory.get()) : [...this.agentHistory.get()];
|
|
366595
|
-
|
|
366628
|
+
if (this.context.config.isContextManagementEnabled()) {
|
|
366629
|
+
return scrubHistory(history);
|
|
366630
|
+
}
|
|
366631
|
+
const model = this.context.config.getModel();
|
|
366632
|
+
if (isGemini2Model(model) || supportsModernFeatures(model)) {
|
|
366633
|
+
return coalesceConsecutiveRoles(stripThoughts2(history));
|
|
366634
|
+
}
|
|
366635
|
+
return history;
|
|
366596
366636
|
}
|
|
366597
366637
|
/**
|
|
366598
366638
|
* Clears the chat history.
|
|
@@ -374154,7 +374194,11 @@ var init_google_credentials_provider = __esm({
|
|
|
374154
374194
|
if (!targetUrl) {
|
|
374155
374195
|
throw new Error("targetUrl must be provided to GoogleCredentialsAuthProvider to determine token audience.");
|
|
374156
374196
|
}
|
|
374157
|
-
const
|
|
374197
|
+
const urlObj = new URL(targetUrl);
|
|
374198
|
+
if (urlObj.protocol !== "https:") {
|
|
374199
|
+
throw new Error(`Protocol "${urlObj.protocol}" is not secure. Google Credential provider requires HTTPS.`);
|
|
374200
|
+
}
|
|
374201
|
+
const hostname3 = urlObj.hostname;
|
|
374158
374202
|
const isRunAppHost = CLOUD_RUN_HOST_REGEX.test(hostname3);
|
|
374159
374203
|
if (isRunAppHost) {
|
|
374160
374204
|
this.useIdToken = true;
|
|
@@ -379789,7 +379833,7 @@ var init_state_manager = __esm({
|
|
|
379789
379833
|
|
|
379790
379834
|
// packages/core/dist/src/scheduler/confirmation.js
|
|
379791
379835
|
import { on as on2 } from "node:events";
|
|
379792
|
-
import { randomUUID as
|
|
379836
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
379793
379837
|
async function awaitConfirmation(messageBus, correlationId, signal) {
|
|
379794
379838
|
if (signal.aborted) {
|
|
379795
379839
|
throw new Error("Operation cancelled");
|
|
@@ -379835,7 +379879,7 @@ async function resolveConfirmation(toolCall, signal, deps) {
|
|
|
379835
379879
|
details.systemMessage = deps.systemMessage;
|
|
379836
379880
|
}
|
|
379837
379881
|
await notifyHooks(deps, details);
|
|
379838
|
-
const correlationId =
|
|
379882
|
+
const correlationId = randomUUID9();
|
|
379839
379883
|
const serializableDetails = details;
|
|
379840
379884
|
lastDetails = serializableDetails;
|
|
379841
379885
|
const ideConfirmation = "ideConfirmation" in details ? details.ideConfirmation : void 0;
|
|
@@ -382010,7 +382054,7 @@ var init_formatNodesForLlm = __esm({
|
|
|
382010
382054
|
});
|
|
382011
382055
|
|
|
382012
382056
|
// packages/core/dist/src/context/utils/snapshotGenerator.js
|
|
382013
|
-
import { randomUUID as
|
|
382057
|
+
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
382014
382058
|
function isStringArray(value) {
|
|
382015
382059
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
382016
382060
|
}
|
|
@@ -382223,7 +382267,7 @@ ${formatNodesForLlm(nodes)}`;
|
|
|
382223
382267
|
const desc = t3["description"];
|
|
382224
382268
|
if (typeof desc === "string" && desc) {
|
|
382225
382269
|
newState.active_tasks.push({
|
|
382226
|
-
id: `task_${
|
|
382270
|
+
id: `task_${randomUUID10().slice(0, 8)}`,
|
|
382227
382271
|
description: desc
|
|
382228
382272
|
});
|
|
382229
382273
|
}
|
|
@@ -382814,7 +382858,7 @@ var init_configLoader = __esm({
|
|
|
382814
382858
|
// packages/core/dist/src/context/tracer.js
|
|
382815
382859
|
import * as fsSync3 from "node:fs";
|
|
382816
382860
|
import * as path71 from "node:path";
|
|
382817
|
-
import { randomUUID as
|
|
382861
|
+
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
382818
382862
|
var ContextTracer;
|
|
382819
382863
|
var init_tracer = __esm({
|
|
382820
382864
|
"packages/core/dist/src/context/tracer.js"() {
|
|
@@ -382871,7 +382915,7 @@ var init_tracer = __esm({
|
|
|
382871
382915
|
if (!this.enabled)
|
|
382872
382916
|
return "asset-recording-disabled";
|
|
382873
382917
|
try {
|
|
382874
|
-
const assetId = `${Date.now()}-${
|
|
382918
|
+
const assetId = `${Date.now()}-${randomUUID11()}-${assetName}.json`;
|
|
382875
382919
|
const assetPath = path71.join(this.assetsDir, assetId);
|
|
382876
382920
|
fsSync3.writeFileSync(assetPath, JSON.stringify(data, null, 2), "utf-8");
|
|
382877
382921
|
this.logEvent(component, `Saved asset: ${assetName}`, { assetId });
|
|
@@ -382935,7 +382979,7 @@ var init_eventBus = __esm({
|
|
|
382935
382979
|
});
|
|
382936
382980
|
|
|
382937
382981
|
// packages/core/dist/src/context/pipeline/inbox.js
|
|
382938
|
-
import { randomUUID as
|
|
382982
|
+
import { randomUUID as randomUUID12 } from "node:crypto";
|
|
382939
382983
|
var LiveInbox, InboxSnapshotImpl;
|
|
382940
382984
|
var init_inbox = __esm({
|
|
382941
382985
|
"packages/core/dist/src/context/pipeline/inbox.js"() {
|
|
@@ -382944,7 +382988,7 @@ var init_inbox = __esm({
|
|
|
382944
382988
|
messages = [];
|
|
382945
382989
|
publish(topic, payload) {
|
|
382946
382990
|
this.messages.push({
|
|
382947
|
-
id:
|
|
382991
|
+
id: randomUUID12(),
|
|
382948
382992
|
topic,
|
|
382949
382993
|
payload,
|
|
382950
382994
|
timestamp: Date.now()
|
|
@@ -384635,7 +384679,7 @@ var init_initializer = __esm({
|
|
|
384635
384679
|
});
|
|
384636
384680
|
|
|
384637
384681
|
// packages/core/dist/src/core/client.js
|
|
384638
|
-
import { randomUUID as
|
|
384682
|
+
import { randomUUID as randomUUID13 } from "node:crypto";
|
|
384639
384683
|
var MAX_TURNS, GeminiClient;
|
|
384640
384684
|
var init_client3 = __esm({
|
|
384641
384685
|
"packages/core/dist/src/core/client.js"() {
|
|
@@ -385037,7 +385081,7 @@ var init_client3 = __esm({
|
|
|
385037
385081
|
if (this.contextManager) {
|
|
385038
385082
|
const rawPendingRequest = createUserContent(request);
|
|
385039
385083
|
const pendingRequest = {
|
|
385040
|
-
id:
|
|
385084
|
+
id: randomUUID13(),
|
|
385041
385085
|
content: rawPendingRequest
|
|
385042
385086
|
};
|
|
385043
385087
|
const { history: newHistory, apiHistory, pendingApiHistory, baseUnits } = await this.contextManager.renderHistory(pendingRequest, void 0, signal);
|
|
@@ -386891,7 +386935,7 @@ var init_scoped_config = __esm({
|
|
|
386891
386935
|
});
|
|
386892
386936
|
|
|
386893
386937
|
// packages/core/dist/src/confirmation-bus/message-bus.js
|
|
386894
|
-
import { randomUUID as
|
|
386938
|
+
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
386895
386939
|
import { EventEmitter as EventEmitter7 } from "node:events";
|
|
386896
386940
|
var MessageBus;
|
|
386897
386941
|
var init_message_bus = __esm({
|
|
@@ -387051,7 +387095,7 @@ var init_message_bus = __esm({
|
|
|
387051
387095
|
* The correlation ID is generated internally and added to the request
|
|
387052
387096
|
*/
|
|
387053
387097
|
async request(request, responseType, timeoutMs = 6e4) {
|
|
387054
|
-
const correlationId =
|
|
387098
|
+
const correlationId = randomUUID14();
|
|
387055
387099
|
return new Promise((resolve23, reject) => {
|
|
387056
387100
|
const timeoutId = setTimeout(() => {
|
|
387057
387101
|
cleanup();
|
|
@@ -387179,7 +387223,7 @@ var init_complete_task = __esm({
|
|
|
387179
387223
|
});
|
|
387180
387224
|
|
|
387181
387225
|
// packages/core/dist/src/agents/local-executor.js
|
|
387182
|
-
import { randomUUID as
|
|
387226
|
+
import { randomUUID as randomUUID15 } from "node:crypto";
|
|
387183
387227
|
function createUnauthorizedToolError(toolName) {
|
|
387184
387228
|
return `Unauthorized tool call: '${toolName}' is not available to this agent.`;
|
|
387185
387229
|
}
|
|
@@ -387352,7 +387396,7 @@ var init_local_executor = __esm({
|
|
|
387352
387396
|
this.compressionService = new ChatCompressionService();
|
|
387353
387397
|
this.parentCallId = parentCallId;
|
|
387354
387398
|
this.cache = new import_lru_cache.default(10);
|
|
387355
|
-
this.agentId =
|
|
387399
|
+
this.agentId = randomUUID15();
|
|
387356
387400
|
}
|
|
387357
387401
|
/**
|
|
387358
387402
|
* Executes a single turn of the agent's logic, from calling the model
|
|
@@ -387732,7 +387776,7 @@ var init_local_executor = __esm({
|
|
|
387732
387776
|
} else if (info2.compressionStatus === CompressionStatus.COMPRESSED) {
|
|
387733
387777
|
if (newHistory) {
|
|
387734
387778
|
const turns = newHistory.map((c2) => ({
|
|
387735
|
-
id:
|
|
387779
|
+
id: randomUUID15(),
|
|
387736
387780
|
content: c2
|
|
387737
387781
|
}));
|
|
387738
387782
|
chat.setHistory(turns);
|
|
@@ -387741,7 +387785,7 @@ var init_local_executor = __esm({
|
|
|
387741
387785
|
} else if (info2.compressionStatus === CompressionStatus.CONTENT_TRUNCATED) {
|
|
387742
387786
|
if (newHistory) {
|
|
387743
387787
|
const turns = newHistory.map((c2) => ({
|
|
387744
|
-
id:
|
|
387788
|
+
id: randomUUID15(),
|
|
387745
387789
|
content: c2
|
|
387746
387790
|
}));
|
|
387747
387791
|
chat.setHistory(turns);
|
|
@@ -388261,7 +388305,7 @@ var init_agent_sanitization_utils = __esm({
|
|
|
388261
388305
|
});
|
|
388262
388306
|
|
|
388263
388307
|
// packages/core/dist/src/agents/local-invocation.js
|
|
388264
|
-
import { randomUUID as
|
|
388308
|
+
import { randomUUID as randomUUID16 } from "node:crypto";
|
|
388265
388309
|
var LocalSubagentInvocation;
|
|
388266
388310
|
var init_local_invocation = __esm({
|
|
388267
388311
|
"packages/core/dist/src/agents/local-invocation.js"() {
|
|
@@ -388336,7 +388380,7 @@ var init_local_invocation = __esm({
|
|
|
388336
388380
|
lastItem.content = sanitizeThoughtContent(text);
|
|
388337
388381
|
} else {
|
|
388338
388382
|
recentActivity.push({
|
|
388339
|
-
id:
|
|
388383
|
+
id: randomUUID16(),
|
|
388340
388384
|
type: "thought",
|
|
388341
388385
|
content: sanitizeThoughtContent(text),
|
|
388342
388386
|
status: SubagentState.RUNNING
|
|
@@ -388354,7 +388398,7 @@ var init_local_invocation = __esm({
|
|
|
388354
388398
|
const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"])) : void 0;
|
|
388355
388399
|
const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
|
|
388356
388400
|
const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
|
|
388357
|
-
const callId = activity.data["callId"] ? String(activity.data["callId"]) :
|
|
388401
|
+
const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID16();
|
|
388358
388402
|
recentActivity.push({
|
|
388359
388403
|
id: callId,
|
|
388360
388404
|
type: "tool_call",
|
|
@@ -388405,7 +388449,7 @@ var init_local_invocation = __esm({
|
|
|
388405
388449
|
}
|
|
388406
388450
|
}
|
|
388407
388451
|
recentActivity.push({
|
|
388408
|
-
id:
|
|
388452
|
+
id: randomUUID16(),
|
|
388409
388453
|
type: "thought",
|
|
388410
388454
|
content: isCancellation || isRejection ? sanitizedError : `Error: ${sanitizedError}`,
|
|
388411
388455
|
status: isCancellation || isRejection ? SubagentState.CANCELLED : SubagentState.ERROR
|
|
@@ -388476,7 +388520,7 @@ ${output.result}`;
|
|
|
388476
388520
|
const lastActivity = recentActivity[recentActivity.length - 1];
|
|
388477
388521
|
if (!lastActivity || lastActivity.status !== SubagentState.ERROR) {
|
|
388478
388522
|
recentActivity.push({
|
|
388479
|
-
id:
|
|
388523
|
+
id: randomUUID16(),
|
|
388480
388524
|
type: "thought",
|
|
388481
388525
|
content: `Error: ${errorMessage}`,
|
|
388482
388526
|
status: SubagentState.ERROR
|
|
@@ -389107,7 +389151,7 @@ var init_agent_session = __esm({
|
|
|
389107
389151
|
});
|
|
389108
389152
|
|
|
389109
389153
|
// packages/core/dist/src/agents/local-subagent-protocol.js
|
|
389110
|
-
import { randomUUID as
|
|
389154
|
+
import { randomUUID as randomUUID17 } from "node:crypto";
|
|
389111
389155
|
function isAbortLikeError(err2) {
|
|
389112
389156
|
return err2 instanceof Error && err2.name === "AbortError";
|
|
389113
389157
|
}
|
|
@@ -389143,7 +389187,7 @@ var init_local_subagent_protocol = __esm({
|
|
|
389143
389187
|
_rawActivityCallback;
|
|
389144
389188
|
_events = [];
|
|
389145
389189
|
_subscribers = /* @__PURE__ */ new Set();
|
|
389146
|
-
_streamId =
|
|
389190
|
+
_streamId = randomUUID17();
|
|
389147
389191
|
_eventCounter = 0;
|
|
389148
389192
|
_agentStartEmitted = false;
|
|
389149
389193
|
_agentEndEmitted = false;
|
|
@@ -389221,7 +389265,7 @@ var init_local_subagent_protocol = __esm({
|
|
|
389221
389265
|
// Core: execution
|
|
389222
389266
|
// ---------------------------------------------------------------------------
|
|
389223
389267
|
_beginNewStream() {
|
|
389224
|
-
this._streamId =
|
|
389268
|
+
this._streamId = randomUUID17();
|
|
389225
389269
|
this._eventCounter = 0;
|
|
389226
389270
|
this._abortController = new AbortController();
|
|
389227
389271
|
this._agentStartEmitted = false;
|
|
@@ -389283,7 +389327,7 @@ var init_local_subagent_protocol = __esm({
|
|
|
389283
389327
|
}
|
|
389284
389328
|
case "TOOL_CALL_START": {
|
|
389285
389329
|
const rawCallId = activity.data["callId"];
|
|
389286
|
-
const callId = String(rawCallId ??
|
|
389330
|
+
const callId = String(rawCallId ?? randomUUID17());
|
|
389287
389331
|
const rawName = activity.data["name"];
|
|
389288
389332
|
const name3 = String(rawName ?? "unknown");
|
|
389289
389333
|
const rawArgs = activity.data["args"];
|
|
@@ -389301,7 +389345,7 @@ var init_local_subagent_protocol = __esm({
|
|
|
389301
389345
|
}
|
|
389302
389346
|
case "TOOL_CALL_END": {
|
|
389303
389347
|
const rawId = activity.data["id"];
|
|
389304
|
-
const requestId = String(rawId ??
|
|
389348
|
+
const requestId = String(rawId ?? randomUUID17());
|
|
389305
389349
|
const rawName = activity.data["name"];
|
|
389306
389350
|
const name3 = String(rawName ?? "unknown");
|
|
389307
389351
|
const rawOutput = activity.data["output"];
|
|
@@ -389427,7 +389471,7 @@ var init_local_subagent_protocol = __esm({
|
|
|
389427
389471
|
});
|
|
389428
389472
|
|
|
389429
389473
|
// packages/core/dist/src/agents/local-session-invocation.js
|
|
389430
|
-
import { randomUUID as
|
|
389474
|
+
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
389431
389475
|
var MAX_RECENT_ACTIVITY, LocalSessionInvocation;
|
|
389432
389476
|
var init_local_session_invocation = __esm({
|
|
389433
389477
|
"packages/core/dist/src/agents/local-session-invocation.js"() {
|
|
@@ -389494,7 +389538,7 @@ var init_local_session_invocation = __esm({
|
|
|
389494
389538
|
lastItem.content = sanitizeThoughtContent(text);
|
|
389495
389539
|
} else {
|
|
389496
389540
|
recentActivity.push({
|
|
389497
|
-
id:
|
|
389541
|
+
id: randomUUID18(),
|
|
389498
389542
|
type: "thought",
|
|
389499
389543
|
content: sanitizeThoughtContent(text),
|
|
389500
389544
|
status: SubagentState.RUNNING
|
|
@@ -389513,7 +389557,7 @@ var init_local_session_invocation = __esm({
|
|
|
389513
389557
|
const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"]).trim()) : void 0;
|
|
389514
389558
|
const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
|
|
389515
389559
|
const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
|
|
389516
|
-
const callId = activity.data["callId"] ? String(activity.data["callId"]) :
|
|
389560
|
+
const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID18();
|
|
389517
389561
|
recentActivity.push({
|
|
389518
389562
|
id: callId,
|
|
389519
389563
|
type: "tool_call",
|
|
@@ -389565,7 +389609,7 @@ var init_local_session_invocation = __esm({
|
|
|
389565
389609
|
}
|
|
389566
389610
|
}
|
|
389567
389611
|
recentActivity.push({
|
|
389568
|
-
id:
|
|
389612
|
+
id: randomUUID18(),
|
|
389569
389613
|
type: "thought",
|
|
389570
389614
|
content: isCancellation || isRejection ? sanitizedError : `Error: ${sanitizedError}`,
|
|
389571
389615
|
status: isCancellation || isRejection ? SubagentState.CANCELLED : SubagentState.ERROR
|
|
@@ -389663,7 +389707,7 @@ ${output.result}`;
|
|
|
389663
389707
|
const lastActivity = recentActivity[recentActivity.length - 1];
|
|
389664
389708
|
if (!lastActivity || lastActivity.status !== SubagentState.ERROR) {
|
|
389665
389709
|
recentActivity.push({
|
|
389666
|
-
id:
|
|
389710
|
+
id: randomUUID18(),
|
|
389667
389711
|
type: "thought",
|
|
389668
389712
|
content: `Error: ${errorMessage}`,
|
|
389669
389713
|
status: SubagentState.ERROR
|
|
@@ -389699,7 +389743,7 @@ ${output.result}`;
|
|
|
389699
389743
|
});
|
|
389700
389744
|
|
|
389701
389745
|
// packages/core/dist/src/agents/remote-subagent-protocol.js
|
|
389702
|
-
import { randomUUID as
|
|
389746
|
+
import { randomUUID as randomUUID19 } from "node:crypto";
|
|
389703
389747
|
function isAbortLikeError2(err2) {
|
|
389704
389748
|
return err2 instanceof Error && err2.name === "AbortError";
|
|
389705
389749
|
}
|
|
@@ -389718,7 +389762,7 @@ var init_remote_subagent_protocol = __esm({
|
|
|
389718
389762
|
context;
|
|
389719
389763
|
_events = [];
|
|
389720
389764
|
_subscribers = /* @__PURE__ */ new Set();
|
|
389721
|
-
_streamId =
|
|
389765
|
+
_streamId = randomUUID19();
|
|
389722
389766
|
_eventCounter = 0;
|
|
389723
389767
|
_agentStartEmitted = false;
|
|
389724
389768
|
_agentEndEmitted = false;
|
|
@@ -389798,7 +389842,7 @@ var init_remote_subagent_protocol = __esm({
|
|
|
389798
389842
|
// Core: A2A streaming
|
|
389799
389843
|
// ---------------------------------------------------------------------------
|
|
389800
389844
|
_beginNewStream() {
|
|
389801
|
-
this._streamId =
|
|
389845
|
+
this._streamId = randomUUID19();
|
|
389802
389846
|
this._eventCounter = 0;
|
|
389803
389847
|
this._abortController = new AbortController();
|
|
389804
389848
|
this._agentStartEmitted = false;
|
|
@@ -391695,7 +391739,7 @@ var init_browserAgentFactory = __esm({
|
|
|
391695
391739
|
});
|
|
391696
391740
|
|
|
391697
391741
|
// packages/core/dist/src/agents/browser/browserAgentInvocation.js
|
|
391698
|
-
import { randomUUID as
|
|
391742
|
+
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
391699
391743
|
var INPUT_PREVIEW_MAX_LENGTH, DESCRIPTION_MAX_LENGTH, MAX_RECENT_ACTIVITY2, BrowserAgentInvocation;
|
|
391700
391744
|
var init_browserAgentInvocation = __esm({
|
|
391701
391745
|
"packages/core/dist/src/agents/browser/browserAgentInvocation.js"() {
|
|
@@ -391764,7 +391808,7 @@ var init_browserAgentInvocation = __esm({
|
|
|
391764
391808
|
const printOutput = updateOutput ? (msg) => {
|
|
391765
391809
|
const sanitizedMsg = sanitizeThoughtContent(msg);
|
|
391766
391810
|
recentActivity.push({
|
|
391767
|
-
id:
|
|
391811
|
+
id: randomUUID20(),
|
|
391768
391812
|
type: "thought",
|
|
391769
391813
|
content: sanitizedMsg,
|
|
391770
391814
|
status: SubagentState.COMPLETED
|
|
@@ -391796,7 +391840,7 @@ var init_browserAgentInvocation = __esm({
|
|
|
391796
391840
|
lastItem.content = sanitizeThoughtContent(text);
|
|
391797
391841
|
} else {
|
|
391798
391842
|
recentActivity.push({
|
|
391799
|
-
id:
|
|
391843
|
+
id: randomUUID20(),
|
|
391800
391844
|
type: "thought",
|
|
391801
391845
|
content: sanitizeThoughtContent(text),
|
|
391802
391846
|
status: SubagentState.RUNNING
|
|
@@ -391810,7 +391854,7 @@ var init_browserAgentInvocation = __esm({
|
|
|
391810
391854
|
const displayName = activity.data["displayName"] ? sanitizeErrorMessage(String(activity.data["displayName"])) : void 0;
|
|
391811
391855
|
const description = activity.data["description"] ? sanitizeErrorMessage(String(activity.data["description"])) : void 0;
|
|
391812
391856
|
const args2 = JSON.stringify(sanitizeToolArgs(activity.data["args"]));
|
|
391813
|
-
const callId = activity.data["callId"] ? String(activity.data["callId"]) :
|
|
391857
|
+
const callId = activity.data["callId"] ? String(activity.data["callId"]) : randomUUID20();
|
|
391814
391858
|
recentActivity.push({
|
|
391815
391859
|
id: callId,
|
|
391816
391860
|
type: "tool_call",
|
|
@@ -391859,7 +391903,7 @@ var init_browserAgentInvocation = __esm({
|
|
|
391859
391903
|
}
|
|
391860
391904
|
const sanitizedError = sanitizeErrorMessage(error2);
|
|
391861
391905
|
recentActivity.push({
|
|
391862
|
-
id:
|
|
391906
|
+
id: randomUUID20(),
|
|
391863
391907
|
type: "thought",
|
|
391864
391908
|
content: isCancellation ? sanitizedError : `Error: ${sanitizedError}`,
|
|
391865
391909
|
status: newStatus
|
|
@@ -406894,7 +406938,7 @@ var init_envExpansion = __esm({
|
|
|
406894
406938
|
// packages/core/dist/src/tools/mcp-client.js
|
|
406895
406939
|
import { basename as basename9 } from "node:path";
|
|
406896
406940
|
import { pathToFileURL } from "node:url";
|
|
406897
|
-
import { randomUUID as
|
|
406941
|
+
import { randomUUID as randomUUID21 } from "node:crypto";
|
|
406898
406942
|
function updateMCPServerStatus(serverName, status2) {
|
|
406899
406943
|
serverStatuses.set(serverName, status2);
|
|
406900
406944
|
for (const listener of statusChangeListeners) {
|
|
@@ -408019,7 +408063,7 @@ var init_mcp_client = __esm({
|
|
|
408019
408063
|
throw new Error("McpCallableTool only supports single function call");
|
|
408020
408064
|
}
|
|
408021
408065
|
const call = functionCalls[0];
|
|
408022
|
-
const progressToken =
|
|
408066
|
+
const progressToken = randomUUID21();
|
|
408023
408067
|
const context2 = getToolCallContext();
|
|
408024
408068
|
if (context2 && this.progressReporter) {
|
|
408025
408069
|
this.progressReporter.registerProgressToken(progressToken, context2.callId);
|
|
@@ -412957,11 +413001,11 @@ var init_rng3 = __esm({
|
|
|
412957
413001
|
});
|
|
412958
413002
|
|
|
412959
413003
|
// packages/core/node_modules/uuid/dist-node/native.js
|
|
412960
|
-
import { randomUUID as
|
|
413004
|
+
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
412961
413005
|
var native_default4;
|
|
412962
413006
|
var init_native2 = __esm({
|
|
412963
413007
|
"packages/core/node_modules/uuid/dist-node/native.js"() {
|
|
412964
|
-
native_default4 = { randomUUID:
|
|
413008
|
+
native_default4 = { randomUUID: randomUUID22 };
|
|
412965
413009
|
}
|
|
412966
413010
|
});
|
|
412967
413011
|
|
|
@@ -414178,6 +414222,9 @@ var init_config4 = __esm({
|
|
|
414178
414222
|
this.refreshSessionScopedPlansDirectory(previousPlansDir);
|
|
414179
414223
|
}
|
|
414180
414224
|
}
|
|
414225
|
+
rotateSessionId(sessionId) {
|
|
414226
|
+
this._sessionId = sessionId;
|
|
414227
|
+
}
|
|
414181
414228
|
resetNewSessionState(sessionId) {
|
|
414182
414229
|
this.setSessionId(sessionId);
|
|
414183
414230
|
}
|
|
@@ -419763,13 +419810,6 @@ ${REFERENCE_CONTENT_END}`;
|
|
|
419763
419810
|
}
|
|
419764
419811
|
});
|
|
419765
419812
|
|
|
419766
|
-
// packages/core/dist/src/utils/session.js
|
|
419767
|
-
var init_session = __esm({
|
|
419768
|
-
"packages/core/dist/src/utils/session.js"() {
|
|
419769
|
-
"use strict";
|
|
419770
|
-
}
|
|
419771
|
-
});
|
|
419772
|
-
|
|
419773
419813
|
// packages/core/dist/src/utils/compatibility.js
|
|
419774
419814
|
var WarningPriority;
|
|
419775
419815
|
var init_compatibility = __esm({
|