@google/gemini-cli 0.41.0-preview.3 → 0.41.0
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/bundle/{chunk-2XTQTWI6.js → chunk-4CB5QYON.js} +1 -1
- package/bundle/{chunk-HEEHAPEL.js → chunk-5ECQHX5C.js} +2 -2
- package/bundle/{chunk-DHIYDJUL.js → chunk-5ZVQP4WN.js} +1 -1
- package/bundle/{chunk-E2QAQW3I.js → chunk-7LNZOOC7.js} +6 -6
- package/bundle/{chunk-ZEIIZSJZ.js → chunk-B2LNN6KY.js} +4 -4
- package/bundle/{chunk-6XQBPKE2.js → chunk-CSDNDSTO.js} +4 -4
- package/bundle/{chunk-SNNRBUKE.js → chunk-CWJ5KY34.js} +1 -1
- package/bundle/{chunk-LZNYOS5U.js → chunk-CZW4D4RQ.js} +1 -1
- package/bundle/{chunk-HRMW37XV.js → chunk-F6MNV4SZ.js} +6 -6
- package/bundle/{chunk-4OVVS5FK.js → chunk-G2G5UOIR.js} +2 -2
- package/bundle/{chunk-AZPVBKRA.js → chunk-GLO32GZ3.js} +12456 -6676
- package/bundle/{chunk-TQTDR3T2.js → chunk-J7E7PI4S.js} +2 -2
- package/bundle/{chunk-SNU5LJTH.js → chunk-KHDD5ZQT.js} +1 -1
- package/bundle/{chunk-QFA7YCIS.js → chunk-KMY2ICHB.js} +1 -1
- package/bundle/{chunk-F3ZVPM4S.js → chunk-KYES7RJ6.js} +54 -67
- package/bundle/{chunk-6HALERSC.js → chunk-RVECIZP6.js} +1 -1
- package/bundle/{chunk-WGF4IHWH.js → chunk-TOU7GDCS.js} +3 -3
- package/bundle/{chunk-RMXTIDND.js → chunk-V7GQYOIO.js} +12 -14
- package/bundle/{cleanup-ROUPI6PW.js → cleanup-KMEBTV6K.js} +2 -2
- package/bundle/{cleanup-GBVTVKLA.js → cleanup-OJM7LXCH.js} +2 -2
- package/bundle/{cleanup-GC5KHVP3.js → cleanup-PMJYRELA.js} +3 -3
- package/bundle/{core-RR2C5DU4.js → core-4PBU56P6.js} +1 -1
- package/bundle/{dist-QBYFIZZI.js → core-MMHOAGLI.js} +2 -2
- package/bundle/{devtoolsService-KHVNVBBE.js → devtoolsService-ARI22QWG.js} +2 -2
- package/bundle/{devtoolsService-FEQD4TFU.js → devtoolsService-BDOWEGHR.js} +4 -5
- package/bundle/{devtoolsService-6UWXBYSZ.js → devtoolsService-YPN2GRY7.js} +2 -2
- package/bundle/{dist-2V43KQFH.js → dist-V6XXY2AS.js} +1 -1
- package/bundle/{gemini-3EY5U3GH.js → gemini-GSCVWK7Y.js} +175 -191
- package/bundle/{gemini-EOOBHOT7.js → gemini-LDARUG77.js} +12 -12
- package/bundle/{gemini-FX4GAVHU.js → gemini-RGSMPB6F.js} +12 -12
- package/bundle/gemini.js +3 -3
- package/bundle/{interactiveCli-44QQRQFM.js → interactiveCli-5JCJD3F5.js} +6 -6
- package/bundle/{interactiveCli-MX3XGM22.js → interactiveCli-KSSJ4M5C.js} +6 -6
- package/bundle/{interactiveCli-HW4YWEAQ.js → interactiveCli-ZNAMZNEE.js} +272 -290
- package/bundle/{liteRtServerManager-KL7MAZ5X.js → liteRtServerManager-I6PXKOCJ.js} +3 -3
- package/bundle/{liteRtServerManager-NILBXAVA.js → liteRtServerManager-PG57YSDR.js} +3 -3
- package/bundle/{liteRtServerManager-AD5OLMNO.js → liteRtServerManager-QZCLWSIV.js} +4 -4
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-LZ7NU7ZH.js → oauth2-provider-356MTA5N.js} +1 -1
- package/bundle/{oauth2-provider-MXRZTMEV.js → oauth2-provider-MV6Q65XJ.js} +1 -1
- package/bundle/{oauth2-provider-VV252NYN.js → oauth2-provider-SWABWSBH.js} +73 -39
- package/bundle/{start-VKZA44K4.js → start-FWXRAXKY.js} +5 -5
- package/bundle/{start-KTHCOJMD.js → start-MWJKRZPA.js} +6 -6
- package/bundle/{start-MSGMQRMD.js → start-S2GPZKGW.js} +5 -5
- package/package.json +1 -1
- package/bundle/chunk-5GNAKSYI.js +0 -80034
- package/bundle/chunk-HIKQORHN.js +0 -118
- package/bundle/chunk-MPCJF2FJ.js +0 -156
- package/bundle/chunk-TK336BKU.js +0 -1571
- package/bundle/chunk-UWQLSUAM.js +0 -17656
- package/bundle/chunk-ZJCDIA3Q.js +0 -354496
- package/bundle/cleanup-IOXAJLSM.js +0 -33
- package/bundle/devtoolsService-IDBTYEA7.js +0 -857
- package/bundle/dist-TMQSX4TL.js +0 -2068
- package/bundle/gemini-ISRYY45M.js +0 -15988
- package/bundle/interactiveCli-5F2MHT43.js +0 -35052
- package/bundle/liteRtServerManager-YT5WSAHP.js +0 -65
- package/bundle/oauth2-provider-YUJLPZXD.js +0 -237
- package/bundle/start-O2KCVHVN.js +0 -18
|
@@ -42,18 +42,18 @@ import {
|
|
|
42
42
|
updateAllUpdatableExtensions,
|
|
43
43
|
updateExtension,
|
|
44
44
|
validateAuthMethod
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-KYES7RJ6.js";
|
|
46
46
|
import {
|
|
47
47
|
appEvents
|
|
48
48
|
} from "./chunk-5PS3AYFU.js";
|
|
49
49
|
import {
|
|
50
50
|
startCommand,
|
|
51
51
|
startServer
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-5ECQHX5C.js";
|
|
53
53
|
import {
|
|
54
54
|
exitCli,
|
|
55
55
|
require_source
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-KHDD5ZQT.js";
|
|
57
57
|
import {
|
|
58
58
|
DEFAULT_PORT,
|
|
59
59
|
GEMMA_MODEL_NAME,
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
readServerProcessInfo,
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-V7GQYOIO.js";
|
|
91
91
|
import {
|
|
92
92
|
cleanupCheckpoints,
|
|
93
93
|
registerCleanup,
|
|
@@ -96,44 +96,32 @@ import {
|
|
|
96
96
|
runExitCleanup,
|
|
97
97
|
runSyncCleanup,
|
|
98
98
|
setupSignalHandlers
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-G2G5UOIR.js";
|
|
100
100
|
import {
|
|
101
101
|
AuthType,
|
|
102
102
|
ChatRecordingService,
|
|
103
103
|
Client,
|
|
104
104
|
Config,
|
|
105
|
-
CoreToolCallStatus,
|
|
106
105
|
ExitCodes,
|
|
107
106
|
FileDiscoveryService,
|
|
108
107
|
FolderTrustDiscoveryService,
|
|
109
|
-
GeminiEventType,
|
|
110
108
|
IdeClient,
|
|
111
|
-
IntegrityStatus,
|
|
112
109
|
InvalidStreamError,
|
|
113
110
|
JsonFormatter,
|
|
114
|
-
JsonStreamEventType,
|
|
115
111
|
LegacyAgentSession,
|
|
116
|
-
LlmRole,
|
|
117
112
|
Logger,
|
|
118
113
|
MCPServerConfig,
|
|
119
|
-
MCPServerStatus,
|
|
120
|
-
OutputFormat,
|
|
121
114
|
PolicyIntegrityManager,
|
|
122
115
|
ROOT_SCHEDULER_ID,
|
|
123
116
|
ReadManyFilesTool,
|
|
124
117
|
Scheduler,
|
|
125
|
-
SessionEndReason,
|
|
126
|
-
SessionStartSource,
|
|
127
118
|
ShellExecutionService,
|
|
128
|
-
StreamEventType,
|
|
129
119
|
StreamJsonFormatter,
|
|
130
120
|
ToolCallEvent,
|
|
131
|
-
TrustLevel,
|
|
132
121
|
UserAccountManager,
|
|
133
122
|
UserPromptEvent,
|
|
134
123
|
ValidationCancelledError,
|
|
135
124
|
ValidationRequiredError,
|
|
136
|
-
WarningPriority,
|
|
137
125
|
addMemory,
|
|
138
126
|
applyAdminAllowlist,
|
|
139
127
|
applyRequiredServers,
|
|
@@ -195,11 +183,9 @@ import {
|
|
|
195
183
|
updatePolicy,
|
|
196
184
|
writeToStderr,
|
|
197
185
|
writeToStdout
|
|
198
|
-
} from "./chunk-
|
|
186
|
+
} from "./chunk-GLO32GZ3.js";
|
|
199
187
|
import {
|
|
200
188
|
ASK_USER_TOOL_NAME,
|
|
201
|
-
ApprovalMode,
|
|
202
|
-
CoreEvent,
|
|
203
189
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
204
190
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
205
191
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -219,7 +205,6 @@ import {
|
|
|
219
205
|
FatalUntrustedWorkspaceError,
|
|
220
206
|
GEMINI_DIR,
|
|
221
207
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
222
|
-
Kind,
|
|
223
208
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
224
209
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
225
210
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -229,7 +214,6 @@ import {
|
|
|
229
214
|
REFERENCE_CONTENT_START,
|
|
230
215
|
Storage,
|
|
231
216
|
ToolConfirmationOutcome,
|
|
232
|
-
ToolErrorType,
|
|
233
217
|
coreEvents,
|
|
234
218
|
debugLogger,
|
|
235
219
|
external_exports,
|
|
@@ -243,7 +227,7 @@ import {
|
|
|
243
227
|
loadServerHierarchicalMemory,
|
|
244
228
|
resolveToRealPath,
|
|
245
229
|
setGeminiMdFilename
|
|
246
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-XRLFHCHC.js";
|
|
247
231
|
import "./chunk-664ZODQF.js";
|
|
248
232
|
import "./chunk-RJTRUG2J.js";
|
|
249
233
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5373,7 +5357,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5373
5357
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5374
5358
|
const isStdio = !!config.command;
|
|
5375
5359
|
if (isStdio && !isTrusted) {
|
|
5376
|
-
return
|
|
5360
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5377
5361
|
}
|
|
5378
5362
|
const client = new Client({
|
|
5379
5363
|
name: "mcp-test-client",
|
|
@@ -5409,7 +5393,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5409
5393
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5410
5394
|
} catch {
|
|
5411
5395
|
await client.close();
|
|
5412
|
-
return
|
|
5396
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5413
5397
|
}
|
|
5414
5398
|
try {
|
|
5415
5399
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5423,10 +5407,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5423
5407
|
);
|
|
5424
5408
|
}
|
|
5425
5409
|
await client.close();
|
|
5426
|
-
return
|
|
5410
|
+
return "connected" /* CONNECTED */;
|
|
5427
5411
|
} catch {
|
|
5428
5412
|
await transport.close();
|
|
5429
|
-
return
|
|
5413
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5430
5414
|
}
|
|
5431
5415
|
}
|
|
5432
5416
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5439,9 +5423,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5439
5423
|
});
|
|
5440
5424
|
if (!loadResult.allowed) {
|
|
5441
5425
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5442
|
-
return
|
|
5426
|
+
return "blocked" /* BLOCKED */;
|
|
5443
5427
|
}
|
|
5444
|
-
return
|
|
5428
|
+
return "disabled" /* DISABLED */;
|
|
5445
5429
|
}
|
|
5446
5430
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5447
5431
|
}
|
|
@@ -5475,23 +5459,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5475
5459
|
let statusIndicator = "";
|
|
5476
5460
|
let statusText = "";
|
|
5477
5461
|
switch (status) {
|
|
5478
|
-
case
|
|
5462
|
+
case "connected" /* CONNECTED */:
|
|
5479
5463
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5480
5464
|
statusText = "Connected";
|
|
5481
5465
|
break;
|
|
5482
|
-
case
|
|
5466
|
+
case "connecting" /* CONNECTING */:
|
|
5483
5467
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5484
5468
|
statusText = "Connecting";
|
|
5485
5469
|
break;
|
|
5486
|
-
case
|
|
5470
|
+
case "blocked" /* BLOCKED */:
|
|
5487
5471
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5488
5472
|
statusText = "Blocked";
|
|
5489
5473
|
break;
|
|
5490
|
-
case
|
|
5474
|
+
case "disabled" /* DISABLED */:
|
|
5491
5475
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5492
5476
|
statusText = "Disabled";
|
|
5493
5477
|
break;
|
|
5494
|
-
case
|
|
5478
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5495
5479
|
default:
|
|
5496
5480
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5497
5481
|
statusText = "Disconnected";
|
|
@@ -5777,7 +5761,7 @@ async function handleInstall(args) {
|
|
|
5777
5761
|
);
|
|
5778
5762
|
if (confirmed) {
|
|
5779
5763
|
const trustedFolders = loadTrustedFolders();
|
|
5780
|
-
await trustedFolders.setValue(realPath,
|
|
5764
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5781
5765
|
} else {
|
|
5782
5766
|
throw new Error(
|
|
5783
5767
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7822,7 +7806,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7822
7806
|
}
|
|
7823
7807
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7824
7808
|
const packageJson = await getPackageJson(__dirname3);
|
|
7825
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.41.0
|
|
7809
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.41.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7826
7810
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7827
7811
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7828
7812
|
}
|
|
@@ -7881,9 +7865,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7881
7865
|
cwd,
|
|
7882
7866
|
potentialWorkspacePoliciesDir
|
|
7883
7867
|
);
|
|
7884
|
-
if (integrityResult.status ===
|
|
7868
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7885
7869
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7886
|
-
} else if (integrityResult.status ===
|
|
7870
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7887
7871
|
workspacePoliciesDir = void 0;
|
|
7888
7872
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7889
7873
|
policyUpdateConfirmationRequest = {
|
|
@@ -8314,23 +8298,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8314
8298
|
if (rawApprovalMode) {
|
|
8315
8299
|
switch (rawApprovalMode) {
|
|
8316
8300
|
case "yolo":
|
|
8317
|
-
approvalMode =
|
|
8301
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8318
8302
|
break;
|
|
8319
8303
|
case "auto_edit":
|
|
8320
|
-
approvalMode =
|
|
8304
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8321
8305
|
break;
|
|
8322
8306
|
case "plan":
|
|
8323
8307
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8324
8308
|
debugLogger.warn(
|
|
8325
8309
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8326
8310
|
);
|
|
8327
|
-
approvalMode =
|
|
8311
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8328
8312
|
} else {
|
|
8329
|
-
approvalMode =
|
|
8313
|
+
approvalMode = "plan" /* PLAN */;
|
|
8330
8314
|
}
|
|
8331
8315
|
break;
|
|
8332
8316
|
case "default":
|
|
8333
|
-
approvalMode =
|
|
8317
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8334
8318
|
break;
|
|
8335
8319
|
default:
|
|
8336
8320
|
throw new Error(
|
|
@@ -8338,10 +8322,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8338
8322
|
);
|
|
8339
8323
|
}
|
|
8340
8324
|
} else {
|
|
8341
|
-
approvalMode =
|
|
8325
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8342
8326
|
}
|
|
8343
8327
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8344
|
-
if (approvalMode ===
|
|
8328
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8345
8329
|
if (settings.admin?.secureModeEnabled) {
|
|
8346
8330
|
debugLogger.error(
|
|
8347
8331
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8359,16 +8343,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8359
8343
|
)
|
|
8360
8344
|
);
|
|
8361
8345
|
}
|
|
8362
|
-
} else if (approvalMode ===
|
|
8346
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8363
8347
|
debugLogger.warn(
|
|
8364
8348
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8365
8349
|
);
|
|
8366
8350
|
}
|
|
8367
|
-
if (!trustedFolder && approvalMode !==
|
|
8351
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8368
8352
|
debugLogger.warn(
|
|
8369
8353
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8370
8354
|
);
|
|
8371
|
-
approvalMode =
|
|
8355
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8372
8356
|
}
|
|
8373
8357
|
let telemetrySettings;
|
|
8374
8358
|
try {
|
|
@@ -9772,7 +9756,7 @@ import path9 from "node:path";
|
|
|
9772
9756
|
import process4 from "node:process";
|
|
9773
9757
|
var homeDirectoryCheck = {
|
|
9774
9758
|
id: "home-directory",
|
|
9775
|
-
priority:
|
|
9759
|
+
priority: "low" /* Low */,
|
|
9776
9760
|
check: async (workspaceRoot, settings) => {
|
|
9777
9761
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9778
9762
|
return null;
|
|
@@ -9796,7 +9780,7 @@ var homeDirectoryCheck = {
|
|
|
9796
9780
|
};
|
|
9797
9781
|
var rootDirectoryCheck = {
|
|
9798
9782
|
id: "root-directory",
|
|
9799
|
-
priority:
|
|
9783
|
+
priority: "high" /* High */,
|
|
9800
9784
|
check: async (workspaceRoot, _settings) => {
|
|
9801
9785
|
try {
|
|
9802
9786
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9812,7 +9796,7 @@ var rootDirectoryCheck = {
|
|
|
9812
9796
|
};
|
|
9813
9797
|
var folderTrustCheck = {
|
|
9814
9798
|
id: "folder-trust",
|
|
9815
|
-
priority:
|
|
9799
|
+
priority: "high" /* High */,
|
|
9816
9800
|
check: async (workspaceRoot, settings) => {
|
|
9817
9801
|
if (!isFolderTrustEnabled(settings)) {
|
|
9818
9802
|
return null;
|
|
@@ -10002,12 +9986,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10002
9986
|
error,
|
|
10003
9987
|
config.getContentGeneratorConfig()?.authType
|
|
10004
9988
|
);
|
|
10005
|
-
if (config.getOutputFormat() ===
|
|
9989
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10006
9990
|
const streamFormatter = new StreamJsonFormatter();
|
|
10007
9991
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10008
9992
|
const metrics = uiTelemetryService.getMetrics();
|
|
10009
9993
|
streamFormatter.emitEvent({
|
|
10010
|
-
type:
|
|
9994
|
+
type: "result" /* RESULT */,
|
|
10011
9995
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10012
9996
|
status: "error",
|
|
10013
9997
|
error: {
|
|
@@ -10018,7 +10002,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10018
10002
|
});
|
|
10019
10003
|
runSyncCleanup();
|
|
10020
10004
|
process.exit(getNumericExitCode(errorCode));
|
|
10021
|
-
} else if (config.getOutputFormat() ===
|
|
10005
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10022
10006
|
const formatter = new JsonFormatter();
|
|
10023
10007
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10024
10008
|
const formattedError = formatter.formatError(
|
|
@@ -10038,11 +10022,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10038
10022
|
const isFatal = isFatalToolError(errorType);
|
|
10039
10023
|
if (isFatal) {
|
|
10040
10024
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10041
|
-
if (config.getOutputFormat() ===
|
|
10025
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10042
10026
|
const streamFormatter = new StreamJsonFormatter();
|
|
10043
10027
|
const metrics = uiTelemetryService.getMetrics();
|
|
10044
10028
|
streamFormatter.emitEvent({
|
|
10045
|
-
type:
|
|
10029
|
+
type: "result" /* RESULT */,
|
|
10046
10030
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10047
10031
|
status: "error",
|
|
10048
10032
|
error: {
|
|
@@ -10051,7 +10035,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10051
10035
|
},
|
|
10052
10036
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10053
10037
|
});
|
|
10054
|
-
} else if (config.getOutputFormat() ===
|
|
10038
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10055
10039
|
const formatter = new JsonFormatter();
|
|
10056
10040
|
const formattedError = formatter.formatError(
|
|
10057
10041
|
toolExecutionError,
|
|
@@ -10069,11 +10053,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10069
10053
|
}
|
|
10070
10054
|
function handleCancellationError(config) {
|
|
10071
10055
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10072
|
-
if (config.getOutputFormat() ===
|
|
10056
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10073
10057
|
const streamFormatter = new StreamJsonFormatter();
|
|
10074
10058
|
const metrics = uiTelemetryService.getMetrics();
|
|
10075
10059
|
streamFormatter.emitEvent({
|
|
10076
|
-
type:
|
|
10060
|
+
type: "result" /* RESULT */,
|
|
10077
10061
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10078
10062
|
status: "error",
|
|
10079
10063
|
error: {
|
|
@@ -10084,7 +10068,7 @@ function handleCancellationError(config) {
|
|
|
10084
10068
|
});
|
|
10085
10069
|
runSyncCleanup();
|
|
10086
10070
|
process.exit(cancellationError.exitCode);
|
|
10087
|
-
} else if (config.getOutputFormat() ===
|
|
10071
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10088
10072
|
const formatter = new JsonFormatter();
|
|
10089
10073
|
const formattedError = formatter.formatError(
|
|
10090
10074
|
cancellationError,
|
|
@@ -10104,11 +10088,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10104
10088
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10105
10089
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10106
10090
|
);
|
|
10107
|
-
if (config.getOutputFormat() ===
|
|
10091
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10108
10092
|
const streamFormatter = new StreamJsonFormatter();
|
|
10109
10093
|
const metrics = uiTelemetryService.getMetrics();
|
|
10110
10094
|
streamFormatter.emitEvent({
|
|
10111
|
-
type:
|
|
10095
|
+
type: "result" /* RESULT */,
|
|
10112
10096
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10113
10097
|
status: "error",
|
|
10114
10098
|
error: {
|
|
@@ -10119,7 +10103,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10119
10103
|
});
|
|
10120
10104
|
runSyncCleanup();
|
|
10121
10105
|
process.exit(maxTurnsError.exitCode);
|
|
10122
|
-
} else if (config.getOutputFormat() ===
|
|
10106
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10123
10107
|
const formatter = new JsonFormatter();
|
|
10124
10108
|
const formattedError = formatter.formatError(
|
|
10125
10109
|
maxTurnsError,
|
|
@@ -10199,7 +10183,7 @@ async function runNonInteractive({
|
|
|
10199
10183
|
}
|
|
10200
10184
|
});
|
|
10201
10185
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10202
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10186
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-BDOWEGHR.js");
|
|
10203
10187
|
setupInitialActivityLogger(config);
|
|
10204
10188
|
}
|
|
10205
10189
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10215,7 +10199,7 @@ async function runNonInteractive({
|
|
|
10215
10199
|
}
|
|
10216
10200
|
};
|
|
10217
10201
|
const startTime = Date.now();
|
|
10218
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10202
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10219
10203
|
const abortController = new AbortController();
|
|
10220
10204
|
let isAborting = false;
|
|
10221
10205
|
let cancelMessageTimer = null;
|
|
@@ -10268,13 +10252,13 @@ async function runNonInteractive({
|
|
|
10268
10252
|
};
|
|
10269
10253
|
try {
|
|
10270
10254
|
consolePatcher.patch();
|
|
10271
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10255
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10272
10256
|
process.stderr.write(
|
|
10273
10257
|
"[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
|
|
10274
10258
|
);
|
|
10275
10259
|
}
|
|
10276
10260
|
setupStdinCancellation();
|
|
10277
|
-
coreEvents.on(
|
|
10261
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10278
10262
|
coreEvents.drainBacklogs();
|
|
10279
10263
|
process.stdout.on("error", (err) => {
|
|
10280
10264
|
if (err.code === "EPIPE") {
|
|
@@ -10300,7 +10284,7 @@ async function runNonInteractive({
|
|
|
10300
10284
|
}
|
|
10301
10285
|
if (streamFormatter) {
|
|
10302
10286
|
streamFormatter.emitEvent({
|
|
10303
|
-
type:
|
|
10287
|
+
type: "init" /* INIT */,
|
|
10304
10288
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10305
10289
|
session_id: config.getSessionId(),
|
|
10306
10290
|
model: config.getModel()
|
|
@@ -10338,7 +10322,7 @@ async function runNonInteractive({
|
|
|
10338
10322
|
}
|
|
10339
10323
|
if (streamFormatter) {
|
|
10340
10324
|
streamFormatter.emitEvent({
|
|
10341
|
-
type:
|
|
10325
|
+
type: "message" /* MESSAGE */,
|
|
10342
10326
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10343
10327
|
role: "user",
|
|
10344
10328
|
content: input
|
|
@@ -10377,12 +10361,12 @@ async function runNonInteractive({
|
|
|
10377
10361
|
const metrics = uiTelemetryService.getMetrics();
|
|
10378
10362
|
const durationMs = Date.now() - startTime;
|
|
10379
10363
|
streamFormatter.emitEvent({
|
|
10380
|
-
type:
|
|
10364
|
+
type: "result" /* RESULT */,
|
|
10381
10365
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10382
10366
|
status: "success",
|
|
10383
10367
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10384
10368
|
});
|
|
10385
|
-
} else if (config.getOutputFormat() ===
|
|
10369
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10386
10370
|
const formatter = new JsonFormatter();
|
|
10387
10371
|
const stats = uiTelemetryService.getMetrics();
|
|
10388
10372
|
textOutput.write(
|
|
@@ -10468,13 +10452,13 @@ async function runNonInteractive({
|
|
|
10468
10452
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10469
10453
|
if (streamFormatter) {
|
|
10470
10454
|
streamFormatter.emitEvent({
|
|
10471
|
-
type:
|
|
10455
|
+
type: "message" /* MESSAGE */,
|
|
10472
10456
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10473
10457
|
role: "assistant",
|
|
10474
10458
|
content: output,
|
|
10475
10459
|
delta: true
|
|
10476
10460
|
});
|
|
10477
|
-
} else if (config.getOutputFormat() ===
|
|
10461
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10478
10462
|
responseText += output;
|
|
10479
10463
|
} else {
|
|
10480
10464
|
if (part.text) {
|
|
@@ -10487,13 +10471,13 @@ async function runNonInteractive({
|
|
|
10487
10471
|
break;
|
|
10488
10472
|
}
|
|
10489
10473
|
case "tool_request": {
|
|
10490
|
-
if (config.getOutputFormat() ===
|
|
10474
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10491
10475
|
preToolResponseText = responseText || preToolResponseText;
|
|
10492
10476
|
responseText = "";
|
|
10493
10477
|
}
|
|
10494
10478
|
if (streamFormatter) {
|
|
10495
10479
|
streamFormatter.emitEvent({
|
|
10496
|
-
type:
|
|
10480
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10497
10481
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10498
10482
|
tool_name: event.name,
|
|
10499
10483
|
tool_id: event.requestId,
|
|
@@ -10509,7 +10493,7 @@ async function runNonInteractive({
|
|
|
10509
10493
|
const displayText = displayContentToString(display);
|
|
10510
10494
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10511
10495
|
streamFormatter.emitEvent({
|
|
10512
|
-
type:
|
|
10496
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10513
10497
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10514
10498
|
tool_id: event.requestId,
|
|
10515
10499
|
status: event.isError ? "error" : "success",
|
|
@@ -10524,17 +10508,17 @@ async function runNonInteractive({
|
|
|
10524
10508
|
const display = event.display?.result;
|
|
10525
10509
|
const displayText = displayContentToString(display);
|
|
10526
10510
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10527
|
-
if (event.data?.["errorType"] ===
|
|
10528
|
-
if (config.getOutputFormat() ===
|
|
10511
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
10512
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
10529
10513
|
responseText = preToolResponseText;
|
|
10530
10514
|
}
|
|
10531
10515
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10532
|
-
if (config.getOutputFormat() ===
|
|
10516
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10533
10517
|
process.stderr.write(`${stopMessage}
|
|
10534
10518
|
`);
|
|
10535
10519
|
}
|
|
10536
10520
|
}
|
|
10537
|
-
if (event.data?.["errorType"] ===
|
|
10521
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
10538
10522
|
throw new FatalToolExecutionError(
|
|
10539
10523
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10540
10524
|
);
|
|
@@ -10555,20 +10539,20 @@ async function runNonInteractive({
|
|
|
10555
10539
|
}
|
|
10556
10540
|
const errorCode = event._meta?.["code"];
|
|
10557
10541
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10558
|
-
if (config.getOutputFormat() ===
|
|
10542
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10559
10543
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10560
10544
|
`);
|
|
10561
10545
|
}
|
|
10562
10546
|
break;
|
|
10563
10547
|
}
|
|
10564
10548
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10565
|
-
if (config.getOutputFormat() ===
|
|
10549
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10566
10550
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10567
10551
|
`);
|
|
10568
10552
|
}
|
|
10569
10553
|
if (streamFormatter) {
|
|
10570
10554
|
streamFormatter.emitEvent({
|
|
10571
|
-
type:
|
|
10555
|
+
type: "error" /* ERROR */,
|
|
10572
10556
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10573
10557
|
severity,
|
|
10574
10558
|
message: event.message
|
|
@@ -10587,7 +10571,7 @@ async function runNonInteractive({
|
|
|
10587
10571
|
);
|
|
10588
10572
|
} else if (streamFormatter) {
|
|
10589
10573
|
streamFormatter.emitEvent({
|
|
10590
|
-
type:
|
|
10574
|
+
type: "error" /* ERROR */,
|
|
10591
10575
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10592
10576
|
severity: "error",
|
|
10593
10577
|
message: "Maximum session turns exceeded"
|
|
@@ -10595,7 +10579,7 @@ async function runNonInteractive({
|
|
|
10595
10579
|
}
|
|
10596
10580
|
}
|
|
10597
10581
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10598
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10582
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10599
10583
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10600
10584
|
`);
|
|
10601
10585
|
}
|
|
@@ -10625,7 +10609,7 @@ async function runNonInteractive({
|
|
|
10625
10609
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10626
10610
|
scheduler?.dispose();
|
|
10627
10611
|
consolePatcher.cleanup();
|
|
10628
|
-
coreEvents.off(
|
|
10612
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10629
10613
|
}
|
|
10630
10614
|
if (errorToHandle) {
|
|
10631
10615
|
handleError(errorToHandle, config);
|
|
@@ -10650,7 +10634,7 @@ async function runNonInteractive2(params) {
|
|
|
10650
10634
|
}
|
|
10651
10635
|
});
|
|
10652
10636
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10653
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10637
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-BDOWEGHR.js");
|
|
10654
10638
|
setupInitialActivityLogger(config);
|
|
10655
10639
|
}
|
|
10656
10640
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10666,7 +10650,7 @@ async function runNonInteractive2(params) {
|
|
|
10666
10650
|
}
|
|
10667
10651
|
};
|
|
10668
10652
|
const startTime = Date.now();
|
|
10669
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10653
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10670
10654
|
const abortController = new AbortController();
|
|
10671
10655
|
let isAborting = false;
|
|
10672
10656
|
let cancelMessageTimer = null;
|
|
@@ -10717,13 +10701,13 @@ async function runNonInteractive2(params) {
|
|
|
10717
10701
|
let scheduler;
|
|
10718
10702
|
try {
|
|
10719
10703
|
consolePatcher.patch();
|
|
10720
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10704
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10721
10705
|
process.stderr.write(
|
|
10722
10706
|
"[WARNING] --raw-output is enabled. Model output is not sanitized and may contain harmful ANSI sequences (e.g. for phishing or command injection). Use --accept-raw-output-risk to suppress this warning.\n"
|
|
10723
10707
|
);
|
|
10724
10708
|
}
|
|
10725
10709
|
setupStdinCancellation();
|
|
10726
|
-
coreEvents.on(
|
|
10710
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10727
10711
|
coreEvents.drainBacklogs();
|
|
10728
10712
|
process.stdout.on("error", (err) => {
|
|
10729
10713
|
if (err.code === "EPIPE") {
|
|
@@ -10747,7 +10731,7 @@ async function runNonInteractive2(params) {
|
|
|
10747
10731
|
}
|
|
10748
10732
|
if (streamFormatter) {
|
|
10749
10733
|
streamFormatter.emitEvent({
|
|
10750
|
-
type:
|
|
10734
|
+
type: "init" /* INIT */,
|
|
10751
10735
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10752
10736
|
session_id: config.getSessionId(),
|
|
10753
10737
|
model: config.getModel()
|
|
@@ -10785,7 +10769,7 @@ async function runNonInteractive2(params) {
|
|
|
10785
10769
|
}
|
|
10786
10770
|
if (streamFormatter) {
|
|
10787
10771
|
streamFormatter.emitEvent({
|
|
10788
|
-
type:
|
|
10772
|
+
type: "message" /* MESSAGE */,
|
|
10789
10773
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10790
10774
|
role: "user",
|
|
10791
10775
|
content: input
|
|
@@ -10812,28 +10796,28 @@ async function runNonInteractive2(params) {
|
|
|
10812
10796
|
if (abortController.signal.aborted) {
|
|
10813
10797
|
handleCancellationError(config);
|
|
10814
10798
|
}
|
|
10815
|
-
if (event.type ===
|
|
10799
|
+
if (event.type === "content" /* Content */) {
|
|
10816
10800
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10817
10801
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10818
10802
|
if (streamFormatter) {
|
|
10819
10803
|
streamFormatter.emitEvent({
|
|
10820
|
-
type:
|
|
10804
|
+
type: "message" /* MESSAGE */,
|
|
10821
10805
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10822
10806
|
role: "assistant",
|
|
10823
10807
|
content: output,
|
|
10824
10808
|
delta: true
|
|
10825
10809
|
});
|
|
10826
|
-
} else if (config.getOutputFormat() ===
|
|
10810
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10827
10811
|
responseText += output;
|
|
10828
10812
|
} else {
|
|
10829
10813
|
if (event.value) {
|
|
10830
10814
|
textOutput.write(output);
|
|
10831
10815
|
}
|
|
10832
10816
|
}
|
|
10833
|
-
} else if (event.type ===
|
|
10817
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10834
10818
|
if (streamFormatter) {
|
|
10835
10819
|
streamFormatter.emitEvent({
|
|
10836
|
-
type:
|
|
10820
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10837
10821
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10838
10822
|
tool_name: event.value.name,
|
|
10839
10823
|
tool_id: event.value.callId,
|
|
@@ -10841,29 +10825,29 @@ async function runNonInteractive2(params) {
|
|
|
10841
10825
|
});
|
|
10842
10826
|
}
|
|
10843
10827
|
toolCallRequests.push(event.value);
|
|
10844
|
-
} else if (event.type ===
|
|
10828
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10845
10829
|
if (streamFormatter) {
|
|
10846
10830
|
streamFormatter.emitEvent({
|
|
10847
|
-
type:
|
|
10831
|
+
type: "error" /* ERROR */,
|
|
10848
10832
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10849
10833
|
severity: "warning",
|
|
10850
10834
|
message: "Loop detected, stopping execution"
|
|
10851
10835
|
});
|
|
10852
10836
|
}
|
|
10853
|
-
} else if (event.type ===
|
|
10837
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10854
10838
|
if (streamFormatter) {
|
|
10855
10839
|
streamFormatter.emitEvent({
|
|
10856
|
-
type:
|
|
10840
|
+
type: "error" /* ERROR */,
|
|
10857
10841
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10858
10842
|
severity: "error",
|
|
10859
10843
|
message: "Maximum session turns exceeded"
|
|
10860
10844
|
});
|
|
10861
10845
|
}
|
|
10862
|
-
} else if (event.type ===
|
|
10846
|
+
} else if (event.type === "error" /* Error */) {
|
|
10863
10847
|
throw event.value.error;
|
|
10864
|
-
} else if (event.type ===
|
|
10848
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10865
10849
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10866
|
-
if (config.getOutputFormat() ===
|
|
10850
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10867
10851
|
process.stderr.write(`${stopMessage}
|
|
10868
10852
|
`);
|
|
10869
10853
|
}
|
|
@@ -10871,7 +10855,7 @@ async function runNonInteractive2(params) {
|
|
|
10871
10855
|
const metrics = uiTelemetryService.getMetrics();
|
|
10872
10856
|
const durationMs = Date.now() - startTime;
|
|
10873
10857
|
streamFormatter.emitEvent({
|
|
10874
|
-
type:
|
|
10858
|
+
type: "result" /* RESULT */,
|
|
10875
10859
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10876
10860
|
status: "success",
|
|
10877
10861
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10881,9 +10865,9 @@ async function runNonInteractive2(params) {
|
|
|
10881
10865
|
});
|
|
10882
10866
|
}
|
|
10883
10867
|
return;
|
|
10884
|
-
} else if (event.type ===
|
|
10868
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
10885
10869
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10886
|
-
if (config.getOutputFormat() ===
|
|
10870
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10887
10871
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10888
10872
|
`);
|
|
10889
10873
|
}
|
|
@@ -10901,7 +10885,7 @@ async function runNonInteractive2(params) {
|
|
|
10901
10885
|
const requestInfo = completedToolCall.request;
|
|
10902
10886
|
if (streamFormatter) {
|
|
10903
10887
|
streamFormatter.emitEvent({
|
|
10904
|
-
type:
|
|
10888
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10905
10889
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10906
10890
|
tool_id: requestInfo.callId,
|
|
10907
10891
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -10935,11 +10919,11 @@ async function runNonInteractive2(params) {
|
|
|
10935
10919
|
);
|
|
10936
10920
|
}
|
|
10937
10921
|
const stopExecutionTool = completedToolCalls.find(
|
|
10938
|
-
(tc) => tc.response.errorType ===
|
|
10922
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
10939
10923
|
);
|
|
10940
10924
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
10941
10925
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
10942
|
-
if (config.getOutputFormat() ===
|
|
10926
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10943
10927
|
process.stderr.write(`${stopMessage}
|
|
10944
10928
|
`);
|
|
10945
10929
|
}
|
|
@@ -10947,7 +10931,7 @@ async function runNonInteractive2(params) {
|
|
|
10947
10931
|
const metrics = uiTelemetryService.getMetrics();
|
|
10948
10932
|
const durationMs = Date.now() - startTime;
|
|
10949
10933
|
streamFormatter.emitEvent({
|
|
10950
|
-
type:
|
|
10934
|
+
type: "result" /* RESULT */,
|
|
10951
10935
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10952
10936
|
status: "success",
|
|
10953
10937
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10955,7 +10939,7 @@ async function runNonInteractive2(params) {
|
|
|
10955
10939
|
durationMs
|
|
10956
10940
|
)
|
|
10957
10941
|
});
|
|
10958
|
-
} else if (config.getOutputFormat() ===
|
|
10942
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10959
10943
|
const formatter = new JsonFormatter();
|
|
10960
10944
|
const stats = uiTelemetryService.getMetrics();
|
|
10961
10945
|
textOutput.write(
|
|
@@ -10972,12 +10956,12 @@ async function runNonInteractive2(params) {
|
|
|
10972
10956
|
const metrics = uiTelemetryService.getMetrics();
|
|
10973
10957
|
const durationMs = Date.now() - startTime;
|
|
10974
10958
|
streamFormatter.emitEvent({
|
|
10975
|
-
type:
|
|
10959
|
+
type: "result" /* RESULT */,
|
|
10976
10960
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10977
10961
|
status: "success",
|
|
10978
10962
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10979
10963
|
});
|
|
10980
|
-
} else if (config.getOutputFormat() ===
|
|
10964
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10981
10965
|
const formatter = new JsonFormatter();
|
|
10982
10966
|
const stats = uiTelemetryService.getMetrics();
|
|
10983
10967
|
textOutput.write(
|
|
@@ -10995,7 +10979,7 @@ async function runNonInteractive2(params) {
|
|
|
10995
10979
|
cleanupStdinCancellation();
|
|
10996
10980
|
scheduler?.dispose();
|
|
10997
10981
|
consolePatcher.cleanup();
|
|
10998
|
-
coreEvents.off(
|
|
10982
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10999
10983
|
}
|
|
11000
10984
|
if (errorToHandle) {
|
|
11001
10985
|
handleError(errorToHandle, config);
|
|
@@ -13466,12 +13450,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13466
13450
|
this.clientCapabilities = args.clientCapabilities;
|
|
13467
13451
|
const authMethods = [
|
|
13468
13452
|
{
|
|
13469
|
-
id:
|
|
13453
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
13470
13454
|
name: "Log in with Google",
|
|
13471
13455
|
description: "Log in with your Google account"
|
|
13472
13456
|
},
|
|
13473
13457
|
{
|
|
13474
|
-
id:
|
|
13458
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
13475
13459
|
name: "Gemini API key",
|
|
13476
13460
|
description: "Use an API key with Gemini Developer API",
|
|
13477
13461
|
_meta: {
|
|
@@ -13481,12 +13465,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13481
13465
|
}
|
|
13482
13466
|
},
|
|
13483
13467
|
{
|
|
13484
|
-
id:
|
|
13468
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
13485
13469
|
name: "Vertex AI",
|
|
13486
13470
|
description: "Use an API key with Vertex AI GenAI API"
|
|
13487
13471
|
},
|
|
13488
13472
|
{
|
|
13489
|
-
id:
|
|
13473
|
+
id: "gateway" /* GATEWAY */,
|
|
13490
13474
|
name: "AI API Gateway",
|
|
13491
13475
|
description: "Use a custom AI API Gateway",
|
|
13492
13476
|
_meta: {
|
|
@@ -13581,7 +13565,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13581
13565
|
mcpServers,
|
|
13582
13566
|
loadedSettings
|
|
13583
13567
|
);
|
|
13584
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
13568
|
+
const authType = loadedSettings.merged.security.auth.selectedType || "gemini-api-key" /* USE_GEMINI */;
|
|
13585
13569
|
let isAuthenticated = false;
|
|
13586
13570
|
let authErrorMessage = "";
|
|
13587
13571
|
try {
|
|
@@ -13593,7 +13577,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13593
13577
|
);
|
|
13594
13578
|
isAuthenticated = true;
|
|
13595
13579
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
13596
|
-
if (authType ===
|
|
13580
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
13597
13581
|
isAuthenticated = false;
|
|
13598
13582
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
13599
13583
|
}
|
|
@@ -13903,7 +13887,7 @@ ${thought.description}`;
|
|
|
13903
13887
|
await this.sendUpdate({
|
|
13904
13888
|
sessionUpdate: "tool_call",
|
|
13905
13889
|
toolCallId: toolCall.id,
|
|
13906
|
-
status: toolCall.status ===
|
|
13890
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
13907
13891
|
title: toolCall.displayName || toolCall.name,
|
|
13908
13892
|
content: toolCallContent,
|
|
13909
13893
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -13956,7 +13940,7 @@ ${thought.description}`;
|
|
|
13956
13940
|
while (nextMessage !== null) {
|
|
13957
13941
|
if (pendingSend.signal.aborted) {
|
|
13958
13942
|
chat.addHistory(nextMessage);
|
|
13959
|
-
return { stopReason:
|
|
13943
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
13960
13944
|
}
|
|
13961
13945
|
const functionCalls = [];
|
|
13962
13946
|
try {
|
|
@@ -13976,7 +13960,7 @@ ${thought.description}`;
|
|
|
13976
13960
|
nextMessage?.parts ?? [],
|
|
13977
13961
|
promptId,
|
|
13978
13962
|
pendingSend.signal,
|
|
13979
|
-
|
|
13963
|
+
"main" /* MAIN */
|
|
13980
13964
|
);
|
|
13981
13965
|
nextMessage = null;
|
|
13982
13966
|
let turnInputTokens = 0;
|
|
@@ -13984,16 +13968,16 @@ ${thought.description}`;
|
|
|
13984
13968
|
let turnModelId = model;
|
|
13985
13969
|
for await (const resp of responseStream) {
|
|
13986
13970
|
if (pendingSend.signal.aborted) {
|
|
13987
|
-
return { stopReason:
|
|
13971
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
13988
13972
|
}
|
|
13989
|
-
if (resp.type ===
|
|
13973
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
13990
13974
|
turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
|
|
13991
13975
|
turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
|
|
13992
13976
|
if (resp.value.modelVersion) {
|
|
13993
13977
|
turnModelId = resp.value.modelVersion;
|
|
13994
13978
|
}
|
|
13995
13979
|
}
|
|
13996
|
-
if (resp.type ===
|
|
13980
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
13997
13981
|
const candidate = resp.value.candidates[0];
|
|
13998
13982
|
for (const part of candidate.content?.parts ?? []) {
|
|
13999
13983
|
if (!part.text) {
|
|
@@ -14009,7 +13993,7 @@ ${thought.description}`;
|
|
|
14009
13993
|
});
|
|
14010
13994
|
}
|
|
14011
13995
|
}
|
|
14012
|
-
if (resp.type ===
|
|
13996
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
14013
13997
|
functionCalls.push(...resp.value.functionCalls);
|
|
14014
13998
|
}
|
|
14015
13999
|
}
|
|
@@ -14025,7 +14009,7 @@ ${thought.description}`;
|
|
|
14025
14009
|
modelUsageMap.set(turnModelId, existing);
|
|
14026
14010
|
}
|
|
14027
14011
|
if (pendingSend.signal.aborted) {
|
|
14028
|
-
return { stopReason:
|
|
14012
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
14029
14013
|
}
|
|
14030
14014
|
} catch (error) {
|
|
14031
14015
|
if (getErrorStatus(error) === 429) {
|
|
@@ -14035,7 +14019,7 @@ ${thought.description}`;
|
|
|
14035
14019
|
);
|
|
14036
14020
|
}
|
|
14037
14021
|
if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
|
|
14038
|
-
return { stopReason:
|
|
14022
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
14039
14023
|
}
|
|
14040
14024
|
if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL")) {
|
|
14041
14025
|
return {
|
|
@@ -14199,7 +14183,7 @@ ${thought.description}`;
|
|
|
14199
14183
|
const output = RequestPermissionResponseSchema.parse(
|
|
14200
14184
|
await this.connection.requestPermission(params)
|
|
14201
14185
|
);
|
|
14202
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14186
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14203
14187
|
await confirmationDetails.onConfirm(outcome);
|
|
14204
14188
|
await updatePolicy(
|
|
14205
14189
|
tool,
|
|
@@ -14210,16 +14194,16 @@ ${thought.description}`;
|
|
|
14210
14194
|
invocation
|
|
14211
14195
|
);
|
|
14212
14196
|
switch (outcome) {
|
|
14213
|
-
case
|
|
14197
|
+
case "cancel" /* Cancel */:
|
|
14214
14198
|
return errorResponse(
|
|
14215
14199
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14216
14200
|
);
|
|
14217
|
-
case
|
|
14218
|
-
case
|
|
14219
|
-
case
|
|
14220
|
-
case
|
|
14221
|
-
case
|
|
14222
|
-
case
|
|
14201
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14202
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14203
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14204
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14205
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14206
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14223
14207
|
break;
|
|
14224
14208
|
default: {
|
|
14225
14209
|
const resultOutcome = outcome;
|
|
@@ -14267,7 +14251,7 @@ ${thought.description}`;
|
|
|
14267
14251
|
);
|
|
14268
14252
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14269
14253
|
{
|
|
14270
|
-
status:
|
|
14254
|
+
status: "success" /* Success */,
|
|
14271
14255
|
request: {
|
|
14272
14256
|
callId,
|
|
14273
14257
|
name: fc.name,
|
|
@@ -14312,7 +14296,7 @@ ${thought.description}`;
|
|
|
14312
14296
|
});
|
|
14313
14297
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14314
14298
|
{
|
|
14315
|
-
status:
|
|
14299
|
+
status: "error" /* Error */,
|
|
14316
14300
|
request: {
|
|
14317
14301
|
callId,
|
|
14318
14302
|
name: fc.name,
|
|
@@ -14427,12 +14411,12 @@ ${thought.description}`;
|
|
|
14427
14411
|
sessionId: this.id,
|
|
14428
14412
|
options: [
|
|
14429
14413
|
{
|
|
14430
|
-
optionId:
|
|
14414
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14431
14415
|
name: "Allow once",
|
|
14432
14416
|
kind: "allow_once"
|
|
14433
14417
|
},
|
|
14434
14418
|
{
|
|
14435
|
-
optionId:
|
|
14419
|
+
optionId: "cancel" /* Cancel */,
|
|
14436
14420
|
name: "Deny",
|
|
14437
14421
|
kind: "reject_once"
|
|
14438
14422
|
}
|
|
@@ -14457,8 +14441,8 @@ ${thought.description}`;
|
|
|
14457
14441
|
const output = RequestPermissionResponseSchema.parse(
|
|
14458
14442
|
await this.connection.requestPermission(params)
|
|
14459
14443
|
);
|
|
14460
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14461
|
-
if (outcome ===
|
|
14444
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14445
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
14462
14446
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14463
14447
|
validationError = null;
|
|
14464
14448
|
} else {
|
|
@@ -14835,12 +14819,12 @@ function toToolCallContent(toolResult) {
|
|
|
14835
14819
|
}
|
|
14836
14820
|
var basicPermissionOptions = [
|
|
14837
14821
|
{
|
|
14838
|
-
optionId:
|
|
14822
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14839
14823
|
name: "Allow",
|
|
14840
14824
|
kind: "allow_once"
|
|
14841
14825
|
},
|
|
14842
14826
|
{
|
|
14843
|
-
optionId:
|
|
14827
|
+
optionId: "cancel" /* Cancel */,
|
|
14844
14828
|
name: "Reject",
|
|
14845
14829
|
kind: "reject_once"
|
|
14846
14830
|
}
|
|
@@ -14852,13 +14836,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14852
14836
|
switch (confirmation.type) {
|
|
14853
14837
|
case "edit":
|
|
14854
14838
|
options.push({
|
|
14855
|
-
optionId:
|
|
14839
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14856
14840
|
name: "Allow for this session",
|
|
14857
14841
|
kind: "allow_always"
|
|
14858
14842
|
});
|
|
14859
14843
|
if (enablePermanentToolApproval) {
|
|
14860
14844
|
options.push({
|
|
14861
|
-
optionId:
|
|
14845
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14862
14846
|
name: "Allow for this file in all future sessions",
|
|
14863
14847
|
kind: "allow_always"
|
|
14864
14848
|
});
|
|
@@ -14866,13 +14850,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14866
14850
|
break;
|
|
14867
14851
|
case "exec":
|
|
14868
14852
|
options.push({
|
|
14869
|
-
optionId:
|
|
14853
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14870
14854
|
name: "Allow for this session",
|
|
14871
14855
|
kind: "allow_always"
|
|
14872
14856
|
});
|
|
14873
14857
|
if (enablePermanentToolApproval) {
|
|
14874
14858
|
options.push({
|
|
14875
|
-
optionId:
|
|
14859
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14876
14860
|
name: "Allow this command for all future sessions",
|
|
14877
14861
|
kind: "allow_always"
|
|
14878
14862
|
});
|
|
@@ -14881,19 +14865,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14881
14865
|
case "mcp":
|
|
14882
14866
|
options.push(
|
|
14883
14867
|
{
|
|
14884
|
-
optionId:
|
|
14868
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14885
14869
|
name: "Allow all server tools for this session",
|
|
14886
14870
|
kind: "allow_always"
|
|
14887
14871
|
},
|
|
14888
14872
|
{
|
|
14889
|
-
optionId:
|
|
14873
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14890
14874
|
name: "Allow tool for this session",
|
|
14891
14875
|
kind: "allow_always"
|
|
14892
14876
|
}
|
|
14893
14877
|
);
|
|
14894
14878
|
if (enablePermanentToolApproval) {
|
|
14895
14879
|
options.push({
|
|
14896
|
-
optionId:
|
|
14880
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14897
14881
|
name: "Allow tool for all future sessions",
|
|
14898
14882
|
kind: "allow_always"
|
|
14899
14883
|
});
|
|
@@ -14901,13 +14885,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14901
14885
|
break;
|
|
14902
14886
|
case "info":
|
|
14903
14887
|
options.push({
|
|
14904
|
-
optionId:
|
|
14888
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14905
14889
|
name: "Allow for this session",
|
|
14906
14890
|
kind: "allow_always"
|
|
14907
14891
|
});
|
|
14908
14892
|
if (enablePermanentToolApproval) {
|
|
14909
14893
|
options.push({
|
|
14910
|
-
optionId:
|
|
14894
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14911
14895
|
name: "Allow for all future sessions",
|
|
14912
14896
|
kind: "allow_always"
|
|
14913
14897
|
});
|
|
@@ -14939,21 +14923,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14939
14923
|
}
|
|
14940
14924
|
function toAcpToolKind(kind) {
|
|
14941
14925
|
switch (kind) {
|
|
14942
|
-
case
|
|
14943
|
-
case
|
|
14944
|
-
case
|
|
14945
|
-
case
|
|
14946
|
-
case
|
|
14947
|
-
case
|
|
14948
|
-
case
|
|
14949
|
-
case
|
|
14950
|
-
case
|
|
14951
|
-
case
|
|
14926
|
+
case "read" /* Read */:
|
|
14927
|
+
case "edit" /* Edit */:
|
|
14928
|
+
case "execute" /* Execute */:
|
|
14929
|
+
case "search" /* Search */:
|
|
14930
|
+
case "delete" /* Delete */:
|
|
14931
|
+
case "move" /* Move */:
|
|
14932
|
+
case "think" /* Think */:
|
|
14933
|
+
case "fetch" /* Fetch */:
|
|
14934
|
+
case "switch_mode" /* SwitchMode */:
|
|
14935
|
+
case "other" /* Other */:
|
|
14952
14936
|
return kind;
|
|
14953
|
-
case
|
|
14937
|
+
case "agent" /* Agent */:
|
|
14954
14938
|
return "think";
|
|
14955
|
-
case
|
|
14956
|
-
case
|
|
14939
|
+
case "plan" /* Plan */:
|
|
14940
|
+
case "communicate" /* Communicate */:
|
|
14957
14941
|
default:
|
|
14958
14942
|
return "other";
|
|
14959
14943
|
}
|
|
@@ -14961,24 +14945,24 @@ function toAcpToolKind(kind) {
|
|
|
14961
14945
|
function buildAvailableModes(isPlanEnabled) {
|
|
14962
14946
|
const modes = [
|
|
14963
14947
|
{
|
|
14964
|
-
id:
|
|
14948
|
+
id: "default" /* DEFAULT */,
|
|
14965
14949
|
name: "Default",
|
|
14966
14950
|
description: "Prompts for approval"
|
|
14967
14951
|
},
|
|
14968
14952
|
{
|
|
14969
|
-
id:
|
|
14953
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
14970
14954
|
name: "Auto Edit",
|
|
14971
14955
|
description: "Auto-approves edit tools"
|
|
14972
14956
|
},
|
|
14973
14957
|
{
|
|
14974
|
-
id:
|
|
14958
|
+
id: "yolo" /* YOLO */,
|
|
14975
14959
|
name: "YOLO",
|
|
14976
14960
|
description: "Auto-approves all tools"
|
|
14977
14961
|
}
|
|
14978
14962
|
];
|
|
14979
14963
|
if (isPlanEnabled) {
|
|
14980
14964
|
modes.push({
|
|
14981
|
-
id:
|
|
14965
|
+
id: "plan" /* PLAN */,
|
|
14982
14966
|
name: "Plan",
|
|
14983
14967
|
description: "Read-only mode"
|
|
14984
14968
|
});
|
|
@@ -14991,7 +14975,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14991
14975
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14992
14976
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
14993
14977
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14994
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14978
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
14995
14979
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14996
14980
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14997
14981
|
useGemini3_1: useGemini31,
|
|
@@ -15089,7 +15073,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15089
15073
|
}
|
|
15090
15074
|
return authType;
|
|
15091
15075
|
} catch (error) {
|
|
15092
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15076
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
15093
15077
|
handleError(
|
|
15094
15078
|
error instanceof Error ? error : new Error(String(error)),
|
|
15095
15079
|
nonInteractiveConfig,
|
|
@@ -15285,10 +15269,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15285
15269
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15286
15270
|
}
|
|
15287
15271
|
start() {
|
|
15288
|
-
coreEvents.on(
|
|
15272
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15289
15273
|
}
|
|
15290
15274
|
stop() {
|
|
15291
|
-
coreEvents.off(
|
|
15275
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15292
15276
|
if (this.flushTimeout) {
|
|
15293
15277
|
clearTimeout(this.flushTimeout);
|
|
15294
15278
|
this.flushTimeout = null;
|
|
@@ -15511,7 +15495,7 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
|
|
|
15511
15495
|
}
|
|
15512
15496
|
}
|
|
15513
15497
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15514
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15498
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-ZNAMZNEE.js");
|
|
15515
15499
|
await doStartUI(
|
|
15516
15500
|
config,
|
|
15517
15501
|
settings,
|
|
@@ -15612,12 +15596,12 @@ async function main() {
|
|
|
15612
15596
|
dns.setDefaultResultOrder(
|
|
15613
15597
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15614
15598
|
);
|
|
15615
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15599
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
15616
15600
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15617
15601
|
settings.setValue(
|
|
15618
15602
|
"User" /* User */,
|
|
15619
15603
|
"security.auth.selectedType",
|
|
15620
|
-
|
|
15604
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
15621
15605
|
);
|
|
15622
15606
|
}
|
|
15623
15607
|
}
|
|
@@ -15715,7 +15699,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15715
15699
|
await config.storage.initialize();
|
|
15716
15700
|
adminControlsListner.setConfig(config);
|
|
15717
15701
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15718
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
15702
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-BDOWEGHR.js");
|
|
15719
15703
|
setupInitialActivityLogger(config);
|
|
15720
15704
|
}
|
|
15721
15705
|
registerTelemetryConfig(config);
|
|
@@ -15723,7 +15707,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15723
15707
|
const messageBus = config.getMessageBus();
|
|
15724
15708
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
15725
15709
|
registerCleanup(async () => {
|
|
15726
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
15710
|
+
await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
15727
15711
|
});
|
|
15728
15712
|
if (!config.getAcpMode()) {
|
|
15729
15713
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -15774,7 +15758,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15774
15758
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
15775
15759
|
const initializationResult = await initializeApp(config, settings);
|
|
15776
15760
|
initAppHandle?.end();
|
|
15777
|
-
import("./liteRtServerManager-
|
|
15761
|
+
import("./liteRtServerManager-QZCLWSIV.js").then(({ LiteRtServerManager }) => {
|
|
15778
15762
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
15779
15763
|
if (!mergedGemma) return;
|
|
15780
15764
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -15784,7 +15768,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15784
15768
|
autoStartServer: userGemma?.autoStartServer
|
|
15785
15769
|
});
|
|
15786
15770
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
15787
|
-
if (settings.merged.security.auth.selectedType ===
|
|
15771
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
15788
15772
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
15789
15773
|
}
|
|
15790
15774
|
if (config.getAcpMode()) {
|
|
@@ -15800,7 +15784,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15800
15784
|
...rawStartupWarnings.map((message) => ({
|
|
15801
15785
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
15802
15786
|
message,
|
|
15803
|
-
priority:
|
|
15787
|
+
priority: "high" /* High */
|
|
15804
15788
|
})),
|
|
15805
15789
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
15806
15790
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -15837,7 +15821,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15837
15821
|
${input}` : stdinData;
|
|
15838
15822
|
}
|
|
15839
15823
|
}
|
|
15840
|
-
const sessionStartSource = resumedSessionData ?
|
|
15824
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
15841
15825
|
const hookSystem = config?.getHookSystem();
|
|
15842
15826
|
if (hookSystem) {
|
|
15843
15827
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -15894,16 +15878,16 @@ ${input}` : wrappedContext;
|
|
|
15894
15878
|
}
|
|
15895
15879
|
}
|
|
15896
15880
|
function initializeOutputListenersAndFlush() {
|
|
15897
|
-
if (coreEvents.listenerCount(
|
|
15898
|
-
coreEvents.on(
|
|
15881
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
15882
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
15899
15883
|
if (payload.isStderr) {
|
|
15900
15884
|
writeToStderr(payload.chunk, payload.encoding);
|
|
15901
15885
|
} else {
|
|
15902
15886
|
writeToStdout(payload.chunk, payload.encoding);
|
|
15903
15887
|
}
|
|
15904
15888
|
});
|
|
15905
|
-
if (coreEvents.listenerCount(
|
|
15906
|
-
coreEvents.on(
|
|
15889
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
15890
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
15907
15891
|
if (payload.type === "error" || payload.type === "warn") {
|
|
15908
15892
|
writeToStderr(payload.content + "\n");
|
|
15909
15893
|
} else {
|
|
@@ -15911,8 +15895,8 @@ function initializeOutputListenersAndFlush() {
|
|
|
15911
15895
|
}
|
|
15912
15896
|
});
|
|
15913
15897
|
}
|
|
15914
|
-
if (coreEvents.listenerCount(
|
|
15915
|
-
coreEvents.on(
|
|
15898
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
15899
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
15916
15900
|
writeToStderr(payload.message + "\n");
|
|
15917
15901
|
});
|
|
15918
15902
|
}
|