gemini-cli-leo 0.1.30-pre.3 → 0.1.30-pre.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/gemini.mjs +249 -116
- package/package.json +1 -1
package/gemini.mjs
CHANGED
|
@@ -174783,8 +174783,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
174783
174783
|
var init_git_commit = __esm({
|
|
174784
174784
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
174785
174785
|
"use strict";
|
|
174786
|
-
GIT_COMMIT_INFO = "
|
|
174787
|
-
CLI_VERSION = "0.1.30-pre.
|
|
174786
|
+
GIT_COMMIT_INFO = "d2dc1cf";
|
|
174787
|
+
CLI_VERSION = "0.1.30-pre.4";
|
|
174788
174788
|
}
|
|
174789
174789
|
});
|
|
174790
174790
|
|
|
@@ -318256,7 +318256,7 @@ function getVersion() {
|
|
|
318256
318256
|
}
|
|
318257
318257
|
versionPromise = (async () => {
|
|
318258
318258
|
const pkgJson = await getPackageJson(__dirname4);
|
|
318259
|
-
return "0.1.30-pre.
|
|
318259
|
+
return "0.1.30-pre.4";
|
|
318260
318260
|
})();
|
|
318261
318261
|
return versionPromise;
|
|
318262
318262
|
}
|
|
@@ -320154,9 +320154,12 @@ var init_baseLlmClient = __esm({
|
|
|
320154
320154
|
}
|
|
320155
320155
|
async _generateWithRetry(options, shouldRetryOnContent, errorContext, role = LlmRole.UTILITY_TOOL) {
|
|
320156
320156
|
const { modelConfigKey, contents, systemInstruction, abortSignal, promptId, maxAttempts, additionalProperties } = options;
|
|
320157
|
+
const requestRole = role;
|
|
320158
|
+
const requestPromptId = promptId;
|
|
320157
320159
|
const { model, config: generateContentConfig, maxAttempts: availabilityMaxAttempts } = applyModelSelection(this.config, modelConfigKey);
|
|
320158
320160
|
let currentModel = model;
|
|
320159
320161
|
let currentGenerateContentConfig = generateContentConfig;
|
|
320162
|
+
let currentAvailabilityMaxAttempts = availabilityMaxAttempts;
|
|
320160
320163
|
const getAvailabilityContext = createAvailabilityContextProvider(this.config, () => currentModel);
|
|
320161
320164
|
let initialActiveModel = this.config.getActiveModel();
|
|
320162
320165
|
let isFirstAttempt = true;
|
|
@@ -320173,12 +320176,14 @@ var init_baseLlmClient = __esm({
|
|
|
320173
320176
|
});
|
|
320174
320177
|
currentModel = resolvedModel;
|
|
320175
320178
|
currentGenerateContentConfig = generateContentConfig2;
|
|
320179
|
+
currentAvailabilityMaxAttempts = void 0;
|
|
320176
320180
|
} else if (!firstAttempt && (this.config.getModelAvailabilityService?.()?.snapshot(currentModel)?.available ?? true) === false) {
|
|
320177
|
-
const { model: reselectedModel, config: reselectedConfig } = applyModelSelection(this.config, modelConfigKey);
|
|
320181
|
+
const { model: reselectedModel, config: reselectedConfig, maxAttempts: reselectedMaxAttempts } = applyModelSelection(this.config, modelConfigKey);
|
|
320178
320182
|
currentModel = reselectedModel;
|
|
320179
320183
|
if (reselectedConfig) {
|
|
320180
320184
|
currentGenerateContentConfig = reselectedConfig;
|
|
320181
320185
|
}
|
|
320186
|
+
currentAvailabilityMaxAttempts = reselectedMaxAttempts;
|
|
320182
320187
|
initialActiveModel = this.config.getActiveModel();
|
|
320183
320188
|
}
|
|
320184
320189
|
const finalConfig = {
|
|
@@ -320192,7 +320197,7 @@ var init_baseLlmClient = __esm({
|
|
|
320192
320197
|
config: finalConfig,
|
|
320193
320198
|
contents
|
|
320194
320199
|
};
|
|
320195
|
-
return this.contentGenerator.generateContent(requestParams,
|
|
320200
|
+
return this.contentGenerator.generateContent(requestParams, requestPromptId, requestRole);
|
|
320196
320201
|
};
|
|
320197
320202
|
return await retryWithBackoff(apiCall, {
|
|
320198
320203
|
shouldRetryOnContent,
|
|
@@ -320203,7 +320208,7 @@ var init_baseLlmClient = __esm({
|
|
|
320203
320208
|
retryFetchErrors: this.config.getRetryFetchErrors(),
|
|
320204
320209
|
signal: abortSignal,
|
|
320205
320210
|
onRetry: (attempt, error40, delayMs) => {
|
|
320206
|
-
const actualMaxAttempts = getAvailabilityContext()?.policy.maxAttempts ?? maxAttempts ?? DEFAULT_MAX_ATTEMPTS2;
|
|
320211
|
+
const actualMaxAttempts = getAvailabilityContext()?.policy.maxAttempts ?? currentAvailabilityMaxAttempts ?? maxAttempts ?? DEFAULT_MAX_ATTEMPTS2;
|
|
320207
320212
|
const modelName = getDisplayString(currentModel);
|
|
320208
320213
|
const errorType = getRetryErrorType(error40);
|
|
320209
320214
|
coreEvents.emitRetryAttempt({
|
|
@@ -320213,7 +320218,9 @@ var init_baseLlmClient = __esm({
|
|
|
320213
320218
|
error: errorType,
|
|
320214
320219
|
model: modelName,
|
|
320215
320220
|
status: getErrorStatus(error40),
|
|
320216
|
-
sessionId: this.config.getSessionId?.()
|
|
320221
|
+
sessionId: this.config.getSessionId?.(),
|
|
320222
|
+
role: requestRole,
|
|
320223
|
+
promptId: requestPromptId
|
|
320217
320224
|
});
|
|
320218
320225
|
logNetworkRetryAttempt(this.config, new NetworkRetryAttemptEvent(attempt, actualMaxAttempts, errorType, delayMs, modelName));
|
|
320219
320226
|
}
|
|
@@ -325135,11 +325142,15 @@ function createSafeAgent(options) {
|
|
|
325135
325142
|
connect
|
|
325136
325143
|
});
|
|
325137
325144
|
}
|
|
325138
|
-
function updateGlobalFetchTimeouts(timeoutMs) {
|
|
325145
|
+
function updateGlobalFetchTimeouts(timeoutMs, bodyTimeoutMs) {
|
|
325139
325146
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
325140
325147
|
throw new RangeError(`Invalid timeout value: ${timeoutMs}. Must be a positive finite number.`);
|
|
325141
325148
|
}
|
|
325149
|
+
if (bodyTimeoutMs !== void 0 && (!Number.isFinite(bodyTimeoutMs) || bodyTimeoutMs <= 0)) {
|
|
325150
|
+
throw new RangeError(`Invalid body timeout value: ${bodyTimeoutMs}. Must be a positive finite number.`);
|
|
325151
|
+
}
|
|
325142
325152
|
defaultHeadersTimeout = timeoutMs;
|
|
325153
|
+
defaultBodyTimeout = bodyTimeoutMs ?? Math.max(DEFAULT_BODY_TIMEOUT, timeoutMs);
|
|
325143
325154
|
defaultSafeAgent = createSafeAgent({
|
|
325144
325155
|
headersTimeout: defaultHeadersTimeout,
|
|
325145
325156
|
bodyTimeout: defaultBodyTimeout
|
|
@@ -325312,7 +325323,14 @@ async function fetchWithTimeout(url4, timeout2, options) {
|
|
|
325312
325323
|
}
|
|
325313
325324
|
function setGlobalProxy(proxy2) {
|
|
325314
325325
|
const trimmedProxy = proxy2.trim();
|
|
325315
|
-
currentProxy = trimmedProxy;
|
|
325326
|
+
currentProxy = trimmedProxy || void 0;
|
|
325327
|
+
if (!currentProxy) {
|
|
325328
|
+
undici.setGlobalDispatcher(new undici.Agent({
|
|
325329
|
+
headersTimeout: defaultHeadersTimeout,
|
|
325330
|
+
bodyTimeout: defaultBodyTimeout
|
|
325331
|
+
}));
|
|
325332
|
+
return;
|
|
325333
|
+
}
|
|
325316
325334
|
const noProxy = (process.env["NO_PROXY"] ?? process.env["no_proxy"] ?? "")?.trim();
|
|
325317
325335
|
undici.setGlobalDispatcher(new undici.EnvHttpProxyAgent({
|
|
325318
325336
|
httpProxy: trimmedProxy,
|
|
@@ -325322,7 +325340,7 @@ function setGlobalProxy(proxy2) {
|
|
|
325322
325340
|
bodyTimeout: defaultBodyTimeout
|
|
325323
325341
|
}));
|
|
325324
325342
|
}
|
|
325325
|
-
var undici, import_ipaddr, FetchError3, PrivateIpError, defaultHeadersTimeout, defaultBodyTimeout, currentProxy, defaultSafeAgent, IANA_BENCHMARK_RANGE;
|
|
325343
|
+
var undici, import_ipaddr, FetchError3, PrivateIpError, DEFAULT_HEADERS_TIMEOUT, DEFAULT_BODY_TIMEOUT, defaultHeadersTimeout, defaultBodyTimeout, currentProxy, defaultSafeAgent, IANA_BENCHMARK_RANGE;
|
|
325326
325344
|
var init_fetch = __esm({
|
|
325327
325345
|
"packages/core/dist/src/utils/fetch.js"() {
|
|
325328
325346
|
"use strict";
|
|
@@ -325343,8 +325361,10 @@ var init_fetch = __esm({
|
|
|
325343
325361
|
this.name = "PrivateIpError";
|
|
325344
325362
|
}
|
|
325345
325363
|
};
|
|
325346
|
-
|
|
325347
|
-
|
|
325364
|
+
DEFAULT_HEADERS_TIMEOUT = 6e4;
|
|
325365
|
+
DEFAULT_BODY_TIMEOUT = 3e5;
|
|
325366
|
+
defaultHeadersTimeout = DEFAULT_HEADERS_TIMEOUT;
|
|
325367
|
+
defaultBodyTimeout = DEFAULT_BODY_TIMEOUT;
|
|
325348
325368
|
currentProxy = void 0;
|
|
325349
325369
|
defaultSafeAgent = createSafeAgent();
|
|
325350
325370
|
undici.setGlobalDispatcher(new undici.Agent({
|
|
@@ -351216,6 +351236,7 @@ var init_web_fetch = __esm({
|
|
|
351216
351236
|
init_tool_names();
|
|
351217
351237
|
init_debugLogger();
|
|
351218
351238
|
init_events();
|
|
351239
|
+
init_promptIdContext();
|
|
351219
351240
|
init_retry();
|
|
351220
351241
|
init_coreTools();
|
|
351221
351242
|
init_resolver();
|
|
@@ -351244,7 +351265,9 @@ var init_web_fetch = __esm({
|
|
|
351244
351265
|
delayMs,
|
|
351245
351266
|
error: errorType,
|
|
351246
351267
|
model: modelName,
|
|
351247
|
-
sessionId: this.context.config.getSessionId?.()
|
|
351268
|
+
sessionId: this.context.config.getSessionId?.(),
|
|
351269
|
+
role: LlmRole.UTILITY_TOOL,
|
|
351270
|
+
promptId: promptIdContext.getStore()
|
|
351248
351271
|
});
|
|
351249
351272
|
logNetworkRetryAttempt(this.context.config, new NetworkRetryAttemptEvent(attempt, maxAttempts, errorType, delayMs, modelName));
|
|
351250
351273
|
}
|
|
@@ -353267,7 +353290,9 @@ var init_geminiChat = __esm({
|
|
|
353267
353290
|
error: errorType,
|
|
353268
353291
|
model,
|
|
353269
353292
|
status: getErrorStatus(error40),
|
|
353270
|
-
sessionId: this.context.config.getSessionId?.()
|
|
353293
|
+
sessionId: this.context.config.getSessionId?.(),
|
|
353294
|
+
role,
|
|
353295
|
+
promptId: prompt_id
|
|
353271
353296
|
});
|
|
353272
353297
|
await new Promise((res) => setTimeout(res, delayMs));
|
|
353273
353298
|
continue;
|
|
@@ -353418,6 +353443,7 @@ var init_geminiChat = __esm({
|
|
|
353418
353443
|
const contentsForPreviewModel = this.ensureActiveLoopHasThoughtSignatures(requestContents);
|
|
353419
353444
|
const { model: availabilityFinalModel, config: newAvailabilityConfig, maxAttempts: availabilityMaxAttempts } = applyModelSelection(this.context.config, modelConfigKey);
|
|
353420
353445
|
let lastModelToUse = availabilityFinalModel;
|
|
353446
|
+
let currentAvailabilityMaxAttempts = availabilityMaxAttempts;
|
|
353421
353447
|
let currentGenerateContentConfig = newAvailabilityConfig;
|
|
353422
353448
|
let lastConfig = currentGenerateContentConfig;
|
|
353423
353449
|
let lastContentsToUse = [...requestContents];
|
|
@@ -353436,12 +353462,14 @@ var init_geminiChat = __esm({
|
|
|
353436
353462
|
if (this.context.config.getActiveModel() !== initialActiveModel) {
|
|
353437
353463
|
initialActiveModel = this.context.config.getActiveModel();
|
|
353438
353464
|
modelToUse = resolveModel(initialActiveModel, useGemini3_1, useCustomToolModel, hasAccessToPreview, this.context.config, useLatestFlash, useLatestFlashLite);
|
|
353465
|
+
currentAvailabilityMaxAttempts = void 0;
|
|
353439
353466
|
} else if (!firstAttempt && (this.context.config.getModelAvailabilityService?.()?.snapshot(modelToUse)?.available ?? true) === false) {
|
|
353440
|
-
const { model: reselectedModel, config: reselectedConfig } = applyModelSelection(this.context.config, modelConfigKey);
|
|
353467
|
+
const { model: reselectedModel, config: reselectedConfig, maxAttempts: reselectedMaxAttempts } = applyModelSelection(this.context.config, modelConfigKey);
|
|
353441
353468
|
modelToUse = resolveModel(reselectedModel, useGemini3_1, useCustomToolModel, hasAccessToPreview, this.context.config, useLatestFlash, useLatestFlashLite);
|
|
353442
353469
|
if (reselectedConfig) {
|
|
353443
353470
|
currentGenerateContentConfig = reselectedConfig;
|
|
353444
353471
|
}
|
|
353472
|
+
currentAvailabilityMaxAttempts = reselectedMaxAttempts;
|
|
353445
353473
|
initialActiveModel = this.context.config.getActiveModel();
|
|
353446
353474
|
}
|
|
353447
353475
|
if (modelToUse !== lastModelToUse) {
|
|
@@ -353555,14 +353583,17 @@ var init_geminiChat = __esm({
|
|
|
353555
353583
|
maxAttempts: availabilityMaxAttempts ?? this.context.config.getMaxAttempts(),
|
|
353556
353584
|
getAvailabilityContext,
|
|
353557
353585
|
onRetry: (attempt, error40, delayMs) => {
|
|
353586
|
+
const actualMaxAttempts = getAvailabilityContext()?.policy.maxAttempts ?? currentAvailabilityMaxAttempts ?? this.context.config.getMaxAttempts();
|
|
353558
353587
|
coreEvents.emitRetryAttempt({
|
|
353559
353588
|
attempt,
|
|
353560
|
-
maxAttempts:
|
|
353589
|
+
maxAttempts: actualMaxAttempts,
|
|
353561
353590
|
delayMs,
|
|
353562
353591
|
error: error40 instanceof Error ? error40.message : String(error40),
|
|
353563
353592
|
model: lastModelToUse,
|
|
353564
353593
|
status: getErrorStatus(error40),
|
|
353565
|
-
sessionId: this.context.config.getSessionId?.()
|
|
353594
|
+
sessionId: this.context.config.getSessionId?.(),
|
|
353595
|
+
role,
|
|
353596
|
+
promptId: prompt_id
|
|
353566
353597
|
});
|
|
353567
353598
|
}
|
|
353568
353599
|
});
|
|
@@ -354423,13 +354454,42 @@ function tokenLimit(model) {
|
|
|
354423
354454
|
return DEFAULT_TOKEN_LIMIT;
|
|
354424
354455
|
}
|
|
354425
354456
|
}
|
|
354426
|
-
|
|
354457
|
+
function outputTokenLimit(model) {
|
|
354458
|
+
switch (model) {
|
|
354459
|
+
case PREVIEW_GEMINI_MODEL:
|
|
354460
|
+
case PREVIEW_GEMINI_3_1_MODEL:
|
|
354461
|
+
case PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL:
|
|
354462
|
+
case PREVIEW_GEMINI_FLASH_MODEL:
|
|
354463
|
+
case DEFAULT_GEMINI_MODEL:
|
|
354464
|
+
case DEFAULT_GEMINI_FLASH_MODEL:
|
|
354465
|
+
case DEFAULT_GEMINI_FLASH_LITE_MODEL:
|
|
354466
|
+
case BASE_GEMINI_FLASH_MODEL:
|
|
354467
|
+
case LATEST_GEMINI_FLASH_MODEL:
|
|
354468
|
+
case LEGACY_CCPA_FLASH_MODEL:
|
|
354469
|
+
case BASE_GEMINI_FLASH_LITE_MODEL:
|
|
354470
|
+
case LATEST_GEMINI_FLASH_LITE_MODEL:
|
|
354471
|
+
case "gemini-2.5-flash":
|
|
354472
|
+
case "gemini-2.5-flash-lite":
|
|
354473
|
+
case "gemini-3.1-flash-lite-preview":
|
|
354474
|
+
case GEMINI_MODEL_ALIAS_AUTO:
|
|
354475
|
+
case PREVIEW_GEMINI_MODEL_AUTO:
|
|
354476
|
+
case DEFAULT_GEMINI_MODEL_AUTO:
|
|
354477
|
+
case GEMINI_MODEL_ALIAS_PRO:
|
|
354478
|
+
case GEMINI_MODEL_ALIAS_FLASH:
|
|
354479
|
+
case GEMINI_MODEL_ALIAS_FLASH_LITE:
|
|
354480
|
+
return DEFAULT_OUTPUT_TOKEN_LIMIT;
|
|
354481
|
+
default:
|
|
354482
|
+
return void 0;
|
|
354483
|
+
}
|
|
354484
|
+
}
|
|
354485
|
+
var DEFAULT_TOKEN_LIMIT, DEFAULT_OUTPUT_TOKEN_LIMIT, GEMMA_4_TOKEN_LIMIT;
|
|
354427
354486
|
var init_tokenLimits = __esm({
|
|
354428
354487
|
"packages/core/dist/src/core/tokenLimits.js"() {
|
|
354429
354488
|
"use strict";
|
|
354430
354489
|
init_models();
|
|
354431
354490
|
init_contextWindow();
|
|
354432
354491
|
DEFAULT_TOKEN_LIMIT = 1048576;
|
|
354492
|
+
DEFAULT_OUTPUT_TOKEN_LIMIT = 65536;
|
|
354433
354493
|
GEMMA_4_TOKEN_LIMIT = 256e3;
|
|
354434
354494
|
}
|
|
354435
354495
|
});
|
|
@@ -372687,6 +372747,7 @@ var init_client3 = __esm({
|
|
|
372687
372747
|
init_models();
|
|
372688
372748
|
init_partUtils();
|
|
372689
372749
|
init_events();
|
|
372750
|
+
init_promptIdContext();
|
|
372690
372751
|
init_initializer();
|
|
372691
372752
|
MAX_TURNS = 100;
|
|
372692
372753
|
GeminiClient = class {
|
|
@@ -373346,6 +373407,8 @@ ${responseText}` : responseText;
|
|
|
373346
373407
|
return turn;
|
|
373347
373408
|
}
|
|
373348
373409
|
async generateContent(modelConfigKey, contents, abortSignal, role) {
|
|
373410
|
+
const requestPromptId = promptIdContext.getStore() ?? this.lastPromptId;
|
|
373411
|
+
const requestRole = role;
|
|
373349
373412
|
const desiredModelConfig = this.config.modelConfigService.getResolvedConfig(modelConfigKey);
|
|
373350
373413
|
let { model: currentAttemptModel, generateContentConfig: currentAttemptGenerateContentConfig } = desiredModelConfig;
|
|
373351
373414
|
try {
|
|
@@ -373356,6 +373419,7 @@ ${responseText}` : responseText;
|
|
|
373356
373419
|
if (newConfig) {
|
|
373357
373420
|
currentAttemptGenerateContentConfig = newConfig;
|
|
373358
373421
|
}
|
|
373422
|
+
let currentAvailabilityMaxAttempts = availabilityMaxAttempts;
|
|
373359
373423
|
const getAvailabilityContext = createAvailabilityContextProvider(this.config, () => currentAttemptModel);
|
|
373360
373424
|
let initialActiveModel = this.config.getActiveModel();
|
|
373361
373425
|
let isFirstAttempt = true;
|
|
@@ -373371,12 +373435,14 @@ ${responseText}` : responseText;
|
|
|
373371
373435
|
});
|
|
373372
373436
|
currentAttemptModel = resolvedModel;
|
|
373373
373437
|
currentAttemptGenerateContentConfig = generateContentConfig;
|
|
373438
|
+
currentAvailabilityMaxAttempts = void 0;
|
|
373374
373439
|
} else if (!firstAttempt && (this.config.getModelAvailabilityService?.()?.snapshot(currentAttemptModel)?.available ?? true) === false) {
|
|
373375
|
-
const { model: reselectedModel, config: reselectedConfig } = applyModelSelection(this.config, modelConfigKey);
|
|
373440
|
+
const { model: reselectedModel, config: reselectedConfig, maxAttempts: reselectedMaxAttempts } = applyModelSelection(this.config, modelConfigKey);
|
|
373376
373441
|
currentAttemptModel = reselectedModel;
|
|
373377
373442
|
if (reselectedConfig) {
|
|
373378
373443
|
currentAttemptGenerateContentConfig = reselectedConfig;
|
|
373379
373444
|
}
|
|
373445
|
+
currentAvailabilityMaxAttempts = reselectedMaxAttempts;
|
|
373380
373446
|
initialActiveModel = this.config.getActiveModel();
|
|
373381
373447
|
}
|
|
373382
373448
|
const requestConfig = {
|
|
@@ -373388,7 +373454,7 @@ ${responseText}` : responseText;
|
|
|
373388
373454
|
model: currentAttemptModel,
|
|
373389
373455
|
config: requestConfig,
|
|
373390
373456
|
contents
|
|
373391
|
-
},
|
|
373457
|
+
}, requestPromptId, requestRole);
|
|
373392
373458
|
};
|
|
373393
373459
|
const onPersistent429Callback = async (authType, error40) => (
|
|
373394
373460
|
// Pass the captured model to the centralized handler.
|
|
@@ -373412,14 +373478,17 @@ ${responseText}` : responseText;
|
|
|
373412
373478
|
retryFetchErrors: this.config.getRetryFetchErrors(),
|
|
373413
373479
|
getAvailabilityContext,
|
|
373414
373480
|
onRetry: (attempt, error40, delayMs) => {
|
|
373481
|
+
const actualMaxAttempts = getAvailabilityContext()?.policy.maxAttempts ?? currentAvailabilityMaxAttempts ?? this.config.getMaxAttempts();
|
|
373415
373482
|
coreEvents.emitRetryAttempt({
|
|
373416
373483
|
attempt,
|
|
373417
|
-
maxAttempts:
|
|
373484
|
+
maxAttempts: actualMaxAttempts,
|
|
373418
373485
|
delayMs,
|
|
373419
373486
|
error: error40 instanceof Error ? error40.message : String(error40),
|
|
373420
373487
|
model: getDisplayString(currentAttemptModel),
|
|
373421
373488
|
status: getErrorStatus(error40),
|
|
373422
|
-
sessionId: this.config.getSessionId?.()
|
|
373489
|
+
sessionId: this.config.getSessionId?.(),
|
|
373490
|
+
role: requestRole,
|
|
373491
|
+
promptId: requestPromptId
|
|
373423
373492
|
});
|
|
373424
373493
|
}
|
|
373425
373494
|
});
|
|
@@ -428185,6 +428254,7 @@ __export(dist_exports, {
|
|
|
428185
428254
|
DEFAULT_MEMORY_FILE_FILTERING_OPTIONS: () => DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
|
428186
428255
|
DEFAULT_MODEL_CONFIGS: () => DEFAULT_MODEL_CONFIGS,
|
|
428187
428256
|
DEFAULT_OTLP_ENDPOINT: () => DEFAULT_OTLP_ENDPOINT,
|
|
428257
|
+
DEFAULT_OUTPUT_TOKEN_LIMIT: () => DEFAULT_OUTPUT_TOKEN_LIMIT,
|
|
428188
428258
|
DEFAULT_POLICY_TIER: () => DEFAULT_POLICY_TIER,
|
|
428189
428259
|
DEFAULT_QUERY_STRING: () => DEFAULT_QUERY_STRING,
|
|
428190
428260
|
DEFAULT_TELEMETRY_TARGET: () => DEFAULT_TELEMETRY_TARGET,
|
|
@@ -429090,6 +429160,7 @@ __export(dist_exports, {
|
|
|
429090
429160
|
normalizeUrl: () => normalizeUrl,
|
|
429091
429161
|
openBrowserSecurely: () => openBrowserSecurely,
|
|
429092
429162
|
openDiff: () => openDiff,
|
|
429163
|
+
outputTokenLimit: () => outputTokenLimit,
|
|
429093
429164
|
parseAgentMarkdown: () => parseAgentMarkdown,
|
|
429094
429165
|
parseAndFormatApiError: () => parseAndFormatApiError,
|
|
429095
429166
|
parseBashCommandDetails: () => parseBashCommandDetails,
|
|
@@ -511263,6 +511334,76 @@ var init_gemma = __esm({
|
|
|
511263
511334
|
}
|
|
511264
511335
|
});
|
|
511265
511336
|
|
|
511337
|
+
// packages/cli/src/config/auth.ts
|
|
511338
|
+
function isOpenAiEndpointConfigured() {
|
|
511339
|
+
loadEnvironment(loadSettings().merged, process.cwd());
|
|
511340
|
+
const hasBaseUrl = hasOpenAiBaseUrl();
|
|
511341
|
+
const hasModelId = Boolean(
|
|
511342
|
+
process.env[OPENAI_MODEL_ID_ENV] || process.env[OPENAI_MODEL_ID_FALLBACK_ENV]
|
|
511343
|
+
);
|
|
511344
|
+
if (hasBaseUrl && hasModelId) {
|
|
511345
|
+
return true;
|
|
511346
|
+
}
|
|
511347
|
+
return hasResolvableOpenAiProvider({ ...process.env });
|
|
511348
|
+
}
|
|
511349
|
+
function hasOpenAiBaseUrl() {
|
|
511350
|
+
loadEnvironment(loadSettings().merged, process.cwd());
|
|
511351
|
+
return Boolean(
|
|
511352
|
+
process.env[OPENAI_BASE_URL_ENV] || process.env[OPENAI_BASE_URL_FALLBACK_ENV]
|
|
511353
|
+
);
|
|
511354
|
+
}
|
|
511355
|
+
async function validateAuthMethod(authMethod) {
|
|
511356
|
+
loadEnvironment(loadSettings().merged, process.cwd());
|
|
511357
|
+
if (authMethod === AuthType2.LOGIN_WITH_GOOGLE || authMethod === AuthType2.COMPUTE_ADC) {
|
|
511358
|
+
return null;
|
|
511359
|
+
}
|
|
511360
|
+
if (authMethod === AuthType2.USE_GEMINI) {
|
|
511361
|
+
const key = process.env["GEMINI_API_KEY"] || await loadApiKey();
|
|
511362
|
+
if (!key) {
|
|
511363
|
+
return "When using Gemini API, you must specify the GEMINI_API_KEY environment variable.\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
511364
|
+
}
|
|
511365
|
+
return null;
|
|
511366
|
+
}
|
|
511367
|
+
if (authMethod === AuthType2.USE_VERTEX_AI) {
|
|
511368
|
+
const hasVertexProjectLocationConfig = !!process.env["GOOGLE_CLOUD_PROJECT"] && !!process.env["GOOGLE_CLOUD_LOCATION"];
|
|
511369
|
+
const hasGoogleApiKey = !!process.env["GOOGLE_API_KEY"];
|
|
511370
|
+
if (!hasVertexProjectLocationConfig && !hasGoogleApiKey) {
|
|
511371
|
+
return "When using Vertex AI, you must specify either:\n\u2022 GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables.\n\u2022 GOOGLE_API_KEY environment variable (if using express mode).\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
511372
|
+
}
|
|
511373
|
+
return null;
|
|
511374
|
+
}
|
|
511375
|
+
if (authMethod === AuthType2.USE_OPENAI) {
|
|
511376
|
+
if (hasResolvableOpenAiProvider({ ...process.env })) {
|
|
511377
|
+
try {
|
|
511378
|
+
parseHeaderJson(process.env["GEMINI_OPENAI_HEADERS"]);
|
|
511379
|
+
} catch (error40) {
|
|
511380
|
+
return error40 instanceof Error ? error40.message : String(error40);
|
|
511381
|
+
}
|
|
511382
|
+
return null;
|
|
511383
|
+
}
|
|
511384
|
+
if (!process.env["GEMINI_OPENAI_BASE_URL"] && !process.env["GOOGLE_GEMINI_BASE_URL"]) {
|
|
511385
|
+
return "When using an OpenAI-compatible API, you must specify the GEMINI_OPENAI_BASE_URL environment variable.\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
511386
|
+
}
|
|
511387
|
+
if (!process.env["GEMINI_OPENAI_MODELID"] && !process.env["GEMINI_MODEL"]) {
|
|
511388
|
+
return "When using an OpenAI-compatible API, you must specify the GEMINI_OPENAI_MODELID environment variable.\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
511389
|
+
}
|
|
511390
|
+
try {
|
|
511391
|
+
parseHeaderJson(process.env["GEMINI_OPENAI_HEADERS"]);
|
|
511392
|
+
} catch (error40) {
|
|
511393
|
+
return error40 instanceof Error ? error40.message : String(error40);
|
|
511394
|
+
}
|
|
511395
|
+
return null;
|
|
511396
|
+
}
|
|
511397
|
+
return "Invalid auth method selected.";
|
|
511398
|
+
}
|
|
511399
|
+
var init_auth3 = __esm({
|
|
511400
|
+
"packages/cli/src/config/auth.ts"() {
|
|
511401
|
+
"use strict";
|
|
511402
|
+
init_dist4();
|
|
511403
|
+
init_settings();
|
|
511404
|
+
}
|
|
511405
|
+
});
|
|
511406
|
+
|
|
511266
511407
|
// packages/cli/src/acp/acpUtils.ts
|
|
511267
511408
|
function hasMeta(obj) {
|
|
511268
511409
|
return typeof obj === "object" && obj !== null && "_meta" in obj;
|
|
@@ -511465,7 +511606,7 @@ function buildAvailableModels(config2, settings) {
|
|
|
511465
511606
|
const useGemini31 = config2.getGemini31LaunchedSync?.() ?? false;
|
|
511466
511607
|
const useLatestFlash = config2.hasLatestFlashGAAccess?.() ?? false;
|
|
511467
511608
|
const useLatestFlashLite = config2.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
511468
|
-
const selectedAuthType = settings.merged.security
|
|
511609
|
+
const selectedAuthType = settings.merged.security?.auth?.selectedType ?? config2.getContentGeneratorConfig?.()?.authType;
|
|
511469
511610
|
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType2.USE_GEMINI;
|
|
511470
511611
|
if (config2.getExperimentalDynamicModelConfiguration?.() === true && config2.getModelConfigService) {
|
|
511471
511612
|
const options = config2.getModelConfigService().getAvailableModelOptions({
|
|
@@ -511526,6 +511667,14 @@ function buildAvailableModels(config2, settings) {
|
|
|
511526
511667
|
}
|
|
511527
511668
|
manualOptions.unshift(...previewOptions);
|
|
511528
511669
|
}
|
|
511670
|
+
const seen = /* @__PURE__ */ new Set();
|
|
511671
|
+
const uniqueManualOptions = manualOptions.filter((option2) => {
|
|
511672
|
+
if (seen.has(option2.value)) {
|
|
511673
|
+
return false;
|
|
511674
|
+
}
|
|
511675
|
+
seen.add(option2.value);
|
|
511676
|
+
return true;
|
|
511677
|
+
});
|
|
511529
511678
|
const scaleOptions = (options) => options.map((o3) => ({
|
|
511530
511679
|
modelId: o3.value,
|
|
511531
511680
|
name: o3.title,
|
|
@@ -511534,7 +511683,7 @@ function buildAvailableModels(config2, settings) {
|
|
|
511534
511683
|
return {
|
|
511535
511684
|
availableModels: [
|
|
511536
511685
|
...scaleOptions(mainOptions),
|
|
511537
|
-
...scaleOptions(
|
|
511686
|
+
...scaleOptions(uniqueManualOptions)
|
|
511538
511687
|
],
|
|
511539
511688
|
currentModelId: preferredModel
|
|
511540
511689
|
};
|
|
@@ -511574,7 +511723,7 @@ function getModelListings(config2, settings) {
|
|
|
511574
511723
|
const { availableModels } = buildAvailableModels(config2, settings);
|
|
511575
511724
|
return (availableModels ?? []).map((m3) => {
|
|
511576
511725
|
const inputTokens = tokenLimit(m3.modelId) ?? DEFAULT_TOKEN_LIMIT;
|
|
511577
|
-
const outputTokens =
|
|
511726
|
+
const outputTokens = outputTokenLimit(m3.modelId);
|
|
511578
511727
|
return {
|
|
511579
511728
|
modelId: m3.modelId,
|
|
511580
511729
|
id: m3.modelId,
|
|
@@ -511583,7 +511732,7 @@ function getModelListings(config2, settings) {
|
|
|
511583
511732
|
description: m3.description ?? "",
|
|
511584
511733
|
contextLimits: {
|
|
511585
511734
|
inputTokens,
|
|
511586
|
-
outputTokens
|
|
511735
|
+
...outputTokens !== void 0 ? { outputTokens } : {}
|
|
511587
511736
|
}
|
|
511588
511737
|
};
|
|
511589
511738
|
});
|
|
@@ -511593,7 +511742,8 @@ async function handleList3(options) {
|
|
|
511593
511742
|
const settings = options?.loadedSettings ?? loadSettings(workspaceDir);
|
|
511594
511743
|
const argv = {
|
|
511595
511744
|
...DEFAULT_CLI_ARGS,
|
|
511596
|
-
...options?.argv
|
|
511745
|
+
...options?.argv,
|
|
511746
|
+
isCommand: true
|
|
511597
511747
|
};
|
|
511598
511748
|
const config2 = await loadCliConfig(
|
|
511599
511749
|
settings.merged,
|
|
@@ -511607,6 +511757,33 @@ async function handleList3(options) {
|
|
|
511607
511757
|
);
|
|
511608
511758
|
initializeOutputListenersAndFlush(config2);
|
|
511609
511759
|
await config2.storage.initialize();
|
|
511760
|
+
const authConfig = settings.merged.security?.auth;
|
|
511761
|
+
const authType = authConfig?.selectedType || getAuthTypeFromEnv();
|
|
511762
|
+
const enforcedType = authConfig?.enforcedType;
|
|
511763
|
+
if (enforcedType && authType !== enforcedType) {
|
|
511764
|
+
const message = authType ? `The enforced authentication type is '${enforcedType}', but the current type is '${authType}'. Please re-authenticate with the correct type.` : `The auth type '${enforcedType}' is enforced, but no authentication is configured.`;
|
|
511765
|
+
throw new Error(message);
|
|
511766
|
+
}
|
|
511767
|
+
if (authType && !authConfig?.useExternal) {
|
|
511768
|
+
try {
|
|
511769
|
+
if (authType !== AuthType2.GATEWAY) {
|
|
511770
|
+
const authError = await validateAuthMethod(authType);
|
|
511771
|
+
if (authError) {
|
|
511772
|
+
throw new Error(authError);
|
|
511773
|
+
}
|
|
511774
|
+
}
|
|
511775
|
+
config2.isBrowserLaunchSuppressed = () => true;
|
|
511776
|
+
await config2.refreshAuth(authType);
|
|
511777
|
+
} catch (e3) {
|
|
511778
|
+
if (enforcedType) {
|
|
511779
|
+
throw e3;
|
|
511780
|
+
}
|
|
511781
|
+
debugLogger.debug(
|
|
511782
|
+
"Failed to refresh auth for models list, falling back to default catalog:",
|
|
511783
|
+
e3
|
|
511784
|
+
);
|
|
511785
|
+
}
|
|
511786
|
+
}
|
|
511610
511787
|
const models = getModelListings(config2, settings);
|
|
511611
511788
|
if (options?.outputFormat === "json") {
|
|
511612
511789
|
process.stdout.write(JSON.stringify(models, null, 2) + "\n");
|
|
@@ -511620,8 +511797,9 @@ async function handleList3(options) {
|
|
|
511620
511797
|
process.stdout.write(` Description: ${model.description}
|
|
511621
511798
|
`);
|
|
511622
511799
|
}
|
|
511800
|
+
const outputLimitText = model.contextLimits.outputTokens !== void 0 ? ` / ${model.contextLimits.outputTokens.toLocaleString()} output tokens` : "";
|
|
511623
511801
|
process.stdout.write(
|
|
511624
|
-
` Context limit: ${model.contextLimits.inputTokens.toLocaleString()} input tokens
|
|
511802
|
+
` Context limit: ${model.contextLimits.inputTokens.toLocaleString()} input tokens${outputLimitText}
|
|
511625
511803
|
|
|
511626
511804
|
`
|
|
511627
511805
|
);
|
|
@@ -511634,6 +511812,7 @@ var init_list4 = __esm({
|
|
|
511634
511812
|
init_dist4();
|
|
511635
511813
|
import_chalk19 = __toESM(require_source(), 1);
|
|
511636
511814
|
init_settings();
|
|
511815
|
+
init_auth3();
|
|
511637
511816
|
init_config6();
|
|
511638
511817
|
init_acpUtils();
|
|
511639
511818
|
init_utils9();
|
|
@@ -511681,6 +511860,7 @@ var init_list4 = __esm({
|
|
|
511681
511860
|
}),
|
|
511682
511861
|
handler: async (argv) => {
|
|
511683
511862
|
const outputFormat = argv["output-format"] === "json" ? "json" : "text";
|
|
511863
|
+
let exitCode;
|
|
511684
511864
|
try {
|
|
511685
511865
|
await handleList3({
|
|
511686
511866
|
outputFormat,
|
|
@@ -511692,8 +511872,13 @@ var init_list4 = __esm({
|
|
|
511692
511872
|
"Error: " + (error40 instanceof Error ? error40.stack || error40.message : String(error40)) + "\n"
|
|
511693
511873
|
);
|
|
511694
511874
|
process.exitCode = 1;
|
|
511875
|
+
exitCode = 1;
|
|
511695
511876
|
} finally {
|
|
511696
|
-
|
|
511877
|
+
if (exitCode !== void 0) {
|
|
511878
|
+
await exitCli(exitCode);
|
|
511879
|
+
} else {
|
|
511880
|
+
await exitCli();
|
|
511881
|
+
}
|
|
511697
511882
|
}
|
|
511698
511883
|
}
|
|
511699
511884
|
};
|
|
@@ -520727,7 +520912,7 @@ var GIT_COMMIT_INFO2;
|
|
|
520727
520912
|
var init_git_commit2 = __esm({
|
|
520728
520913
|
"packages/cli/src/generated/git-commit.ts"() {
|
|
520729
520914
|
"use strict";
|
|
520730
|
-
GIT_COMMIT_INFO2 = "
|
|
520915
|
+
GIT_COMMIT_INFO2 = "d2dc1cf";
|
|
520731
520916
|
}
|
|
520732
520917
|
});
|
|
520733
520918
|
|
|
@@ -593918,7 +594103,7 @@ async function performInitialAuth(config2, authType) {
|
|
|
593918
594103
|
}
|
|
593919
594104
|
return { authError: null, accountSuspensionInfo: null };
|
|
593920
594105
|
}
|
|
593921
|
-
var
|
|
594106
|
+
var init_auth4 = __esm({
|
|
593922
594107
|
"packages/cli/src/core/auth.ts"() {
|
|
593923
594108
|
"use strict";
|
|
593924
594109
|
init_dist4();
|
|
@@ -593981,81 +594166,11 @@ var init_initializer2 = __esm({
|
|
|
593981
594166
|
"use strict";
|
|
593982
594167
|
init_dist4();
|
|
593983
594168
|
init_settings();
|
|
593984
|
-
|
|
594169
|
+
init_auth4();
|
|
593985
594170
|
init_theme2();
|
|
593986
594171
|
}
|
|
593987
594172
|
});
|
|
593988
594173
|
|
|
593989
|
-
// packages/cli/src/config/auth.ts
|
|
593990
|
-
function isOpenAiEndpointConfigured() {
|
|
593991
|
-
loadEnvironment(loadSettings().merged, process.cwd());
|
|
593992
|
-
const hasBaseUrl = hasOpenAiBaseUrl();
|
|
593993
|
-
const hasModelId = Boolean(
|
|
593994
|
-
process.env[OPENAI_MODEL_ID_ENV] || process.env[OPENAI_MODEL_ID_FALLBACK_ENV]
|
|
593995
|
-
);
|
|
593996
|
-
if (hasBaseUrl && hasModelId) {
|
|
593997
|
-
return true;
|
|
593998
|
-
}
|
|
593999
|
-
return hasResolvableOpenAiProvider({ ...process.env });
|
|
594000
|
-
}
|
|
594001
|
-
function hasOpenAiBaseUrl() {
|
|
594002
|
-
loadEnvironment(loadSettings().merged, process.cwd());
|
|
594003
|
-
return Boolean(
|
|
594004
|
-
process.env[OPENAI_BASE_URL_ENV] || process.env[OPENAI_BASE_URL_FALLBACK_ENV]
|
|
594005
|
-
);
|
|
594006
|
-
}
|
|
594007
|
-
async function validateAuthMethod(authMethod) {
|
|
594008
|
-
loadEnvironment(loadSettings().merged, process.cwd());
|
|
594009
|
-
if (authMethod === AuthType2.LOGIN_WITH_GOOGLE || authMethod === AuthType2.COMPUTE_ADC) {
|
|
594010
|
-
return null;
|
|
594011
|
-
}
|
|
594012
|
-
if (authMethod === AuthType2.USE_GEMINI) {
|
|
594013
|
-
const key = process.env["GEMINI_API_KEY"] || await loadApiKey();
|
|
594014
|
-
if (!key) {
|
|
594015
|
-
return "When using Gemini API, you must specify the GEMINI_API_KEY environment variable.\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
594016
|
-
}
|
|
594017
|
-
return null;
|
|
594018
|
-
}
|
|
594019
|
-
if (authMethod === AuthType2.USE_VERTEX_AI) {
|
|
594020
|
-
const hasVertexProjectLocationConfig = !!process.env["GOOGLE_CLOUD_PROJECT"] && !!process.env["GOOGLE_CLOUD_LOCATION"];
|
|
594021
|
-
const hasGoogleApiKey = !!process.env["GOOGLE_API_KEY"];
|
|
594022
|
-
if (!hasVertexProjectLocationConfig && !hasGoogleApiKey) {
|
|
594023
|
-
return "When using Vertex AI, you must specify either:\n\u2022 GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION environment variables.\n\u2022 GOOGLE_API_KEY environment variable (if using express mode).\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
594024
|
-
}
|
|
594025
|
-
return null;
|
|
594026
|
-
}
|
|
594027
|
-
if (authMethod === AuthType2.USE_OPENAI) {
|
|
594028
|
-
if (hasResolvableOpenAiProvider({ ...process.env })) {
|
|
594029
|
-
try {
|
|
594030
|
-
parseHeaderJson(process.env["GEMINI_OPENAI_HEADERS"]);
|
|
594031
|
-
} catch (error40) {
|
|
594032
|
-
return error40 instanceof Error ? error40.message : String(error40);
|
|
594033
|
-
}
|
|
594034
|
-
return null;
|
|
594035
|
-
}
|
|
594036
|
-
if (!process.env["GEMINI_OPENAI_BASE_URL"] && !process.env["GOOGLE_GEMINI_BASE_URL"]) {
|
|
594037
|
-
return "When using an OpenAI-compatible API, you must specify the GEMINI_OPENAI_BASE_URL environment variable.\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
594038
|
-
}
|
|
594039
|
-
if (!process.env["GEMINI_OPENAI_MODELID"] && !process.env["GEMINI_MODEL"]) {
|
|
594040
|
-
return "When using an OpenAI-compatible API, you must specify the GEMINI_OPENAI_MODELID environment variable.\nUpdate your environment and try again (no reload needed if using .env)!";
|
|
594041
|
-
}
|
|
594042
|
-
try {
|
|
594043
|
-
parseHeaderJson(process.env["GEMINI_OPENAI_HEADERS"]);
|
|
594044
|
-
} catch (error40) {
|
|
594045
|
-
return error40 instanceof Error ? error40.message : String(error40);
|
|
594046
|
-
}
|
|
594047
|
-
return null;
|
|
594048
|
-
}
|
|
594049
|
-
return "Invalid auth method selected.";
|
|
594050
|
-
}
|
|
594051
|
-
var init_auth4 = __esm({
|
|
594052
|
-
"packages/cli/src/config/auth.ts"() {
|
|
594053
|
-
"use strict";
|
|
594054
|
-
init_dist4();
|
|
594055
|
-
init_settings();
|
|
594056
|
-
}
|
|
594057
|
-
});
|
|
594058
|
-
|
|
594059
594174
|
// node_modules/@agentclientprotocol/sdk/dist/schema/index.js
|
|
594060
594175
|
var AGENT_METHODS, CLIENT_METHODS, PROTOCOL_VERSION;
|
|
594061
594176
|
var init_schema2 = __esm({
|
|
@@ -598391,7 +598506,7 @@ var init_validateNonInterActiveAuth = __esm({
|
|
|
598391
598506
|
"use strict";
|
|
598392
598507
|
init_dist4();
|
|
598393
598508
|
init_settings();
|
|
598394
|
-
|
|
598509
|
+
init_auth3();
|
|
598395
598510
|
init_errors6();
|
|
598396
598511
|
init_cleanup2();
|
|
598397
598512
|
}
|
|
@@ -612002,7 +612117,7 @@ var init_useAuth = __esm({
|
|
|
612002
612117
|
init_dist4();
|
|
612003
612118
|
init_dist4();
|
|
612004
612119
|
init_types21();
|
|
612005
|
-
|
|
612120
|
+
init_auth3();
|
|
612006
612121
|
useAuthCommand = (settings, config2, initialAuthError = null, initialAccountSuspensionInfo = null) => {
|
|
612007
612122
|
const [authState, setAuthState] = (0, import_react138.useState)(
|
|
612008
612123
|
initialAuthError ? "updating" /* Updating */ : "unauthenticated" /* Unauthenticated */
|
|
@@ -612352,7 +612467,7 @@ var init_AuthDialog = __esm({
|
|
|
612352
612467
|
init_useKeypress();
|
|
612353
612468
|
init_types21();
|
|
612354
612469
|
init_useAuth();
|
|
612355
|
-
|
|
612470
|
+
init_auth3();
|
|
612356
612471
|
init_processUtils();
|
|
612357
612472
|
import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1);
|
|
612358
612473
|
}
|
|
@@ -615614,7 +615729,7 @@ var init_DialogManager = __esm({
|
|
|
615614
615729
|
init_BannedAccountDialog();
|
|
615615
615730
|
init_ApiAuthDialog();
|
|
615616
615731
|
init_openai2();
|
|
615617
|
-
|
|
615732
|
+
init_auth3();
|
|
615618
615733
|
init_ProviderDialogs();
|
|
615619
615734
|
init_EditorSettingsDialog();
|
|
615620
615735
|
init_PrivacyNotice();
|
|
@@ -626645,6 +626760,8 @@ var init_useGeminiStream = __esm({
|
|
|
626645
626760
|
);
|
|
626646
626761
|
const cancelPromiseRef = (0, import_react197.useRef)(Promise.resolve());
|
|
626647
626762
|
const activeQueryIdRef = (0, import_react197.useRef)(null);
|
|
626763
|
+
const lastQueryRef = (0, import_react197.useRef)(null);
|
|
626764
|
+
const lastPromptIdRef = (0, import_react197.useRef)(null);
|
|
626648
626765
|
const previousApprovalModeRef = (0, import_react197.useRef)(
|
|
626649
626766
|
config2.getApprovalMode()
|
|
626650
626767
|
);
|
|
@@ -626664,7 +626781,7 @@ var init_useGeminiStream = __esm({
|
|
|
626664
626781
|
}, [config2]);
|
|
626665
626782
|
(0, import_react197.useEffect)(() => {
|
|
626666
626783
|
const handleRetryAttempt = (payload) => {
|
|
626667
|
-
if (turnCancelledRef.current || !isRespondingRef.current) {
|
|
626784
|
+
if (turnCancelledRef.current || !isRespondingRef.current || payload.role !== LlmRole.MAIN || !lastPromptIdRef.current || payload.promptId !== lastPromptIdRef.current) {
|
|
626668
626785
|
return;
|
|
626669
626786
|
}
|
|
626670
626787
|
setRetryStatus(payload);
|
|
@@ -626962,8 +627079,6 @@ var init_useGeminiStream = __esm({
|
|
|
626962
627079
|
backgroundTasks,
|
|
626963
627080
|
settings.merged.ui?.compactToolOutput
|
|
626964
627081
|
]);
|
|
626965
|
-
const lastQueryRef = (0, import_react197.useRef)(null);
|
|
626966
|
-
const lastPromptIdRef = (0, import_react197.useRef)(null);
|
|
626967
627082
|
const loopDetectedRef = (0, import_react197.useRef)(false);
|
|
626968
627083
|
const autoNudgeAttemptCountRef = (0, import_react197.useRef)(0);
|
|
626969
627084
|
const MAX_AUTO_NUDGE_ATTEMPTS = 2;
|
|
@@ -627390,6 +627505,7 @@ var init_useGeminiStream = __esm({
|
|
|
627390
627505
|
);
|
|
627391
627506
|
const handleThoughtEvent = (0, import_react197.useCallback)(
|
|
627392
627507
|
(eventValue, _userMessageTimestamp) => {
|
|
627508
|
+
setRetryStatus(null);
|
|
627393
627509
|
setThought(eventValue);
|
|
627394
627510
|
if (getInlineThinkingMode(settings) === "full") {
|
|
627395
627511
|
addItem({
|
|
@@ -627718,6 +627834,7 @@ var init_useGeminiStream = __esm({
|
|
|
627718
627834
|
);
|
|
627719
627835
|
break;
|
|
627720
627836
|
case GeminiEventType.ToolCallRequest:
|
|
627837
|
+
setRetryStatus(null);
|
|
627721
627838
|
toolCallRequests.push(event.value);
|
|
627722
627839
|
pendingToolCallRequestsRef.current.push(event.value);
|
|
627723
627840
|
break;
|
|
@@ -627905,10 +628022,11 @@ var init_useGeminiStream = __esm({
|
|
|
627905
628022
|
startNewPrompt();
|
|
627906
628023
|
setThought(null);
|
|
627907
628024
|
}
|
|
627908
|
-
setIsResponding(true);
|
|
627909
|
-
setInitError(null);
|
|
627910
628025
|
lastQueryRef.current = queryToSend;
|
|
627911
628026
|
lastPromptIdRef.current = prompt_id;
|
|
628027
|
+
setRetryStatus(null);
|
|
628028
|
+
setIsResponding(true);
|
|
628029
|
+
setInitError(null);
|
|
627912
628030
|
try {
|
|
627913
628031
|
const stream2 = geminiClient.sendMessageStream(
|
|
627914
628032
|
queryToSend,
|
|
@@ -629610,7 +629728,7 @@ var init_useLoadingIndicator = __esm({
|
|
|
629610
629728
|
const prevStreamingStateRef = (0, import_react200.useRef)(null);
|
|
629611
629729
|
const [prevRetryStatus, setPrevRetryStatus] = (0, import_react200.useState)(null);
|
|
629612
629730
|
const [countdownSeconds, setCountdownSeconds] = (0, import_react200.useState)(null);
|
|
629613
|
-
const isSameRetry = retryStatus === prevRetryStatus || retryStatus !== null && prevRetryStatus !== null && retryStatus.attempt === prevRetryStatus.attempt && retryStatus.delayMs === prevRetryStatus.delayMs && retryStatus.model === prevRetryStatus.model && retryStatus.status === prevRetryStatus.status && retryStatus.error === prevRetryStatus.error;
|
|
629731
|
+
const isSameRetry = retryStatus === prevRetryStatus || retryStatus !== null && prevRetryStatus !== null && retryStatus.attempt === prevRetryStatus.attempt && retryStatus.maxAttempts === prevRetryStatus.maxAttempts && retryStatus.delayMs === prevRetryStatus.delayMs && retryStatus.model === prevRetryStatus.model && retryStatus.status === prevRetryStatus.status && retryStatus.error === prevRetryStatus.error && retryStatus.role === prevRetryStatus.role && retryStatus.promptId === prevRetryStatus.promptId;
|
|
629614
629732
|
if (!isSameRetry) {
|
|
629615
629733
|
setPrevRetryStatus(retryStatus);
|
|
629616
629734
|
setCountdownSeconds(
|
|
@@ -629622,6 +629740,8 @@ var init_useLoadingIndicator = __esm({
|
|
|
629622
629740
|
const attempt = retryStatus?.attempt ?? 0;
|
|
629623
629741
|
const delayMs = retryStatus?.delayMs ?? 0;
|
|
629624
629742
|
const model = retryStatus?.model ?? "";
|
|
629743
|
+
const role = retryStatus?.role;
|
|
629744
|
+
const promptId = retryStatus?.promptId;
|
|
629625
629745
|
(0, import_react200.useEffect)(() => {
|
|
629626
629746
|
if (!isTimerActive || !isRateLimit || countdownSeconds === null || countdownSeconds <= 1) {
|
|
629627
629747
|
return;
|
|
@@ -629637,7 +629757,16 @@ var init_useLoadingIndicator = __esm({
|
|
|
629637
629757
|
return () => {
|
|
629638
629758
|
clearInterval(intervalId);
|
|
629639
629759
|
};
|
|
629640
|
-
}, [
|
|
629760
|
+
}, [
|
|
629761
|
+
attempt,
|
|
629762
|
+
delayMs,
|
|
629763
|
+
model,
|
|
629764
|
+
role,
|
|
629765
|
+
promptId,
|
|
629766
|
+
isTimerActive,
|
|
629767
|
+
isRateLimit,
|
|
629768
|
+
countdownSeconds
|
|
629769
|
+
]);
|
|
629641
629770
|
(0, import_react200.useEffect)(() => {
|
|
629642
629771
|
if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
|
|
629643
629772
|
setTimerResetKey((prevKey) => prevKey + 1);
|
|
@@ -633831,6 +633960,11 @@ function useSessionResume({
|
|
|
633831
633960
|
}
|
|
633832
633961
|
setIsResuming(true);
|
|
633833
633962
|
try {
|
|
633963
|
+
const client = config2.getGeminiClient();
|
|
633964
|
+
if (!client) {
|
|
633965
|
+
throw new Error("Gemini client is not initialized");
|
|
633966
|
+
}
|
|
633967
|
+
await client.resumeChat(clientHistory, resumedData);
|
|
633834
633968
|
setQuittingMessages(null);
|
|
633835
633969
|
historyManagerRef.current.loadHistory(toHistoryItemsWithIds(uiHistory));
|
|
633836
633970
|
refreshStaticRef.current();
|
|
@@ -633838,7 +633972,6 @@ function useSessionResume({
|
|
|
633838
633972
|
const workspaceContext = config2.getWorkspaceContext();
|
|
633839
633973
|
workspaceContext.addDirectories(resumedData.conversation.directories);
|
|
633840
633974
|
}
|
|
633841
|
-
await config2.getGeminiClient()?.resumeChat(clientHistory, resumedData);
|
|
633842
633975
|
} catch (error40) {
|
|
633843
633976
|
coreEvents.emitFeedback(
|
|
633844
633977
|
"error",
|
|
@@ -634926,7 +635059,7 @@ var init_AppContainer = __esm({
|
|
|
634926
635059
|
init_MouseContext();
|
|
634927
635060
|
init_ScrollProvider();
|
|
634928
635061
|
init_dist4();
|
|
634929
|
-
|
|
635062
|
+
init_auth3();
|
|
634930
635063
|
init_useHistoryManager();
|
|
634931
635064
|
init_useMemoryMonitor();
|
|
634932
635065
|
init_useThemeCommand();
|
|
@@ -638475,7 +638608,7 @@ var init_gemini = __esm({
|
|
|
638475
638608
|
init_worktreeSetup();
|
|
638476
638609
|
init_sessionCleanup();
|
|
638477
638610
|
init_initializer2();
|
|
638478
|
-
|
|
638611
|
+
init_auth3();
|
|
638479
638612
|
init_acpStdioTransport();
|
|
638480
638613
|
init_validateNonInterActiveAuth();
|
|
638481
638614
|
init_events2();
|