@google/gemini-cli 0.42.0-preview.0 → 0.42.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-GFPE65Z3.js → chunk-47QC6PWE.js} +7 -7
- package/bundle/{chunk-CBWESCDG.js → chunk-5AFGMGVT.js} +7 -7
- package/bundle/{chunk-NOEPPT4R.js → chunk-5MQ5VMQK.js} +1 -1
- package/bundle/{chunk-6KCFSK2J.js → chunk-66C7JVNE.js} +2 -2
- package/bundle/{chunk-EW6BCPVC.js → chunk-6K3EFSDX.js} +1 -1
- package/bundle/{chunk-J3JE6HQX.js → chunk-7H3CQGS6.js} +1 -1
- package/bundle/{chunk-F7B6HX6S.js → chunk-7LOMS5HP.js} +2 -2
- package/bundle/{chunk-KILMJEVY.js → chunk-A3GDBSEI.js} +9 -8
- package/bundle/{chunk-NQ7WZMXX.js → chunk-A564QXJJ.js} +4 -5
- package/bundle/{chunk-M4GY7DCE.js → chunk-ARLWCFGI.js} +6834 -12733
- package/bundle/{chunk-VUENLVGO.js → chunk-AS4E6DX7.js} +3 -3
- package/bundle/{chunk-4LCWAZQL.js → chunk-BI5ZICGL.js} +1 -1
- package/bundle/{chunk-6QYD32J3.js → chunk-BUJZOWQ7.js} +9 -6
- package/bundle/chunk-BZZHETT5.js +512 -0
- package/bundle/{chunk-Y2QKRHXR.js → chunk-GZ4FSF4B.js} +2 -2
- package/bundle/{chunk-J6LCLN2Y.js → chunk-I5JMJ2LU.js} +1 -1
- package/bundle/chunk-IBIKJW2L.js +17230 -0
- package/bundle/{chunk-HSZC7H6N.js → chunk-KSNNZBTV.js} +2 -2
- package/bundle/{chunk-6BMBSK77.js → chunk-L6GBKGQX.js} +3 -3
- package/bundle/chunk-L7GACEVA.js +118 -0
- package/bundle/chunk-LCB7VVYS.js +356008 -0
- package/bundle/{chunk-WSLK3AUT.js → chunk-LK7LIPO6.js} +1 -1
- package/bundle/{chunk-CLT3IJGB.js → chunk-NHDN46IK.js} +1 -1
- package/bundle/chunk-OGZGOFAJ.js +1571 -0
- package/bundle/{chunk-N3W3RYXN.js → chunk-PBD26LJQ.js} +68 -55
- package/bundle/{chunk-IGYW5IPQ.js → chunk-QZ2JZRLK.js} +3 -4
- package/bundle/chunk-UKCYYERR.js +391 -0
- package/bundle/{chunk-ETRUTVTR.js → chunk-UVBJHP26.js} +1 -1
- package/bundle/{chunk-UO7OO22U.js → chunk-UZZVXATH.js} +1 -1
- package/bundle/chunk-VERP26KN.js +81544 -0
- package/bundle/{chunk-QMK75Y7E.js → chunk-WX6CHISQ.js} +2 -2
- package/bundle/chunk-YDSDSLSO.js +156 -0
- package/bundle/{cleanup-T2HYKF7I.js → cleanup-6PVHIK4C.js} +2 -2
- package/bundle/{cleanup-LH7RU457.js → cleanup-FRS7FPOS.js} +2 -2
- package/bundle/{cleanup-ZBHF7PUC.js → cleanup-NDTUQVOW.js} +3 -3
- package/bundle/cleanup-O4IDJYU2.js +33 -0
- package/bundle/{core-QH4PNJQ3.js → core-RZFMBCSX.js} +1 -1
- package/bundle/{devtoolsService-NXXQULSB.js → devtoolsService-6D355RSX.js} +2 -2
- package/bundle/{devtoolsService-NIEGPNPT.js → devtoolsService-7SBW23VD.js} +5 -4
- package/bundle/devtoolsService-SPV43SGI.js +857 -0
- package/bundle/{devtoolsService-USWJ4OCC.js → devtoolsService-WER5PRLG.js} +2 -2
- package/bundle/{dist-P6VZ5KI4.js → dist-7BJPFNU7.js} +1 -1
- package/bundle/{core-IIB5TH4W.js → dist-DTPIOJ3P.js} +2 -2
- package/bundle/dist-ZZ5HEQGP.js +2096 -0
- package/bundle/{gemini-H26TLDOV.js → gemini-3NXWUDHV.js} +13 -13
- package/bundle/{gemini-NFPXCHZM.js → gemini-GLORNPU2.js} +200 -186
- package/bundle/gemini-HCJBP42A.js +16256 -0
- package/bundle/{gemini-U45ZMNQE.js → gemini-KMMF6AK3.js} +13 -13
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-AT7D6KM5.js → interactiveCli-5UVCH7FM.js} +8 -8
- package/bundle/{interactiveCli-MMM7Z6CJ.js → interactiveCli-BNDKNCVJ.js} +294 -276
- package/bundle/{interactiveCli-O6EFASZD.js → interactiveCli-HBRMSAIT.js} +8 -8
- package/bundle/interactiveCli-TWDP2H52.js +34505 -0
- package/bundle/{liteRtServerManager-G5EHBOWM.js → liteRtServerManager-3YA2HL46.js} +4 -4
- package/bundle/{liteRtServerManager-QB74ZF32.js → liteRtServerManager-BYQVAM6Y.js} +4 -4
- package/bundle/{liteRtServerManager-JCITNPUM.js → liteRtServerManager-IQHHDTUM.js} +5 -5
- package/bundle/liteRtServerManager-RTBP2SLV.js +66 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-V6ROFUMU.js → oauth2-provider-C66JRVDQ.js} +1 -1
- package/bundle/{oauth2-provider-K5IZHYDJ.js → oauth2-provider-OAXWX3Z3.js} +39 -73
- package/bundle/{oauth2-provider-ZKX2USIN.js → oauth2-provider-TUVQXNLY.js} +1 -1
- package/bundle/oauth2-provider-ZPJOR5SG.js +237 -0
- package/bundle/{start-WILIWWLN.js → start-ELTWFVNO.js} +6 -6
- package/bundle/{start-B4GKBYKT.js → start-HHZI73VV.js} +7 -7
- package/bundle/start-NCMR7HOQ.js +19 -0
- package/bundle/{start-SW3EMEQ2.js → start-S3TEO5BN.js} +6 -6
- package/package.json +1 -1
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-PBD26LJQ.js";
|
|
45
45
|
import {
|
|
46
46
|
appEvents
|
|
47
47
|
} from "./chunk-5PS3AYFU.js";
|
|
48
48
|
import {
|
|
49
49
|
startCommand,
|
|
50
50
|
startServer
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-KSNNZBTV.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-LK7LIPO6.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_PORT,
|
|
58
58
|
GEMMA_MODEL_NAME,
|
|
@@ -86,11 +86,11 @@ import {
|
|
|
86
86
|
readServerProcessInfo,
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-BUJZOWQ7.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-66C7JVNE.js";
|
|
93
|
+
import "./chunk-BZZHETT5.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,33 +99,43 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-UVBJHP26.js";
|
|
103
103
|
import {
|
|
104
104
|
AuthType,
|
|
105
105
|
ChatRecordingService,
|
|
106
106
|
Client,
|
|
107
107
|
Config,
|
|
108
|
+
CoreToolCallStatus,
|
|
108
109
|
ExitCodes,
|
|
109
110
|
FileDiscoveryService,
|
|
110
111
|
FolderTrustDiscoveryService,
|
|
112
|
+
GeminiEventType,
|
|
111
113
|
IdeClient,
|
|
114
|
+
IntegrityStatus,
|
|
112
115
|
InvalidStreamError,
|
|
113
116
|
JsonFormatter,
|
|
117
|
+
JsonStreamEventType,
|
|
114
118
|
LegacyAgentSession,
|
|
115
119
|
Logger,
|
|
116
120
|
MCPServerConfig,
|
|
121
|
+
MCPServerStatus,
|
|
122
|
+
OutputFormat,
|
|
117
123
|
PolicyIntegrityManager,
|
|
118
124
|
ROOT_SCHEDULER_ID,
|
|
119
125
|
ReadManyFilesTool,
|
|
120
126
|
Scheduler,
|
|
127
|
+
SessionEndReason,
|
|
128
|
+
SessionStartSource,
|
|
121
129
|
ShellExecutionService,
|
|
122
130
|
SimpleExtensionLoader,
|
|
123
131
|
StreamJsonFormatter,
|
|
124
132
|
ToolCallEvent,
|
|
133
|
+
TrustLevel,
|
|
125
134
|
UserAccountManager,
|
|
126
135
|
UserPromptEvent,
|
|
127
136
|
ValidationCancelledError,
|
|
128
137
|
ValidationRequiredError,
|
|
138
|
+
WarningPriority,
|
|
129
139
|
addMemory,
|
|
130
140
|
applyAdminAllowlist,
|
|
131
141
|
applyRequiredServers,
|
|
@@ -189,9 +199,11 @@ import {
|
|
|
189
199
|
updatePolicy,
|
|
190
200
|
writeToStderr,
|
|
191
201
|
writeToStdout
|
|
192
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-ARLWCFGI.js";
|
|
193
203
|
import {
|
|
194
204
|
ASK_USER_TOOL_NAME,
|
|
205
|
+
ApprovalMode,
|
|
206
|
+
CoreEvent,
|
|
195
207
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
196
208
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
197
209
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -211,6 +223,7 @@ import {
|
|
|
211
223
|
FatalUntrustedWorkspaceError,
|
|
212
224
|
GEMINI_DIR,
|
|
213
225
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
226
|
+
Kind,
|
|
214
227
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
215
228
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
216
229
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -220,6 +233,7 @@ import {
|
|
|
220
233
|
REFERENCE_CONTENT_START,
|
|
221
234
|
Storage,
|
|
222
235
|
ToolConfirmationOutcome,
|
|
236
|
+
ToolErrorType,
|
|
223
237
|
coreEvents,
|
|
224
238
|
debugLogger,
|
|
225
239
|
external_exports,
|
|
@@ -233,7 +247,7 @@ import {
|
|
|
233
247
|
loadServerHierarchicalMemory,
|
|
234
248
|
resolveToRealPath,
|
|
235
249
|
setGeminiMdFilename
|
|
236
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-JEW7ZIWE.js";
|
|
237
251
|
import "./chunk-664ZODQF.js";
|
|
238
252
|
import "./chunk-RJTRUG2J.js";
|
|
239
253
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5363,7 +5377,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5363
5377
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5364
5378
|
const isStdio = !!config.command;
|
|
5365
5379
|
if (isStdio && !isTrusted) {
|
|
5366
|
-
return
|
|
5380
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5367
5381
|
}
|
|
5368
5382
|
const client = new Client({
|
|
5369
5383
|
name: "mcp-test-client",
|
|
@@ -5399,7 +5413,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5399
5413
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5400
5414
|
} catch {
|
|
5401
5415
|
await client.close();
|
|
5402
|
-
return
|
|
5416
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5403
5417
|
}
|
|
5404
5418
|
try {
|
|
5405
5419
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5413,10 +5427,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5413
5427
|
);
|
|
5414
5428
|
}
|
|
5415
5429
|
await client.close();
|
|
5416
|
-
return
|
|
5430
|
+
return MCPServerStatus.CONNECTED;
|
|
5417
5431
|
} catch {
|
|
5418
5432
|
await transport.close();
|
|
5419
|
-
return
|
|
5433
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5420
5434
|
}
|
|
5421
5435
|
}
|
|
5422
5436
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5429,9 +5443,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5429
5443
|
});
|
|
5430
5444
|
if (!loadResult.allowed) {
|
|
5431
5445
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5432
|
-
return
|
|
5446
|
+
return MCPServerStatus.BLOCKED;
|
|
5433
5447
|
}
|
|
5434
|
-
return
|
|
5448
|
+
return MCPServerStatus.DISABLED;
|
|
5435
5449
|
}
|
|
5436
5450
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5437
5451
|
}
|
|
@@ -5465,23 +5479,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5465
5479
|
let statusIndicator = "";
|
|
5466
5480
|
let statusText = "";
|
|
5467
5481
|
switch (status) {
|
|
5468
|
-
case
|
|
5482
|
+
case MCPServerStatus.CONNECTED:
|
|
5469
5483
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5470
5484
|
statusText = "Connected";
|
|
5471
5485
|
break;
|
|
5472
|
-
case
|
|
5486
|
+
case MCPServerStatus.CONNECTING:
|
|
5473
5487
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5474
5488
|
statusText = "Connecting";
|
|
5475
5489
|
break;
|
|
5476
|
-
case
|
|
5490
|
+
case MCPServerStatus.BLOCKED:
|
|
5477
5491
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5478
5492
|
statusText = "Blocked";
|
|
5479
5493
|
break;
|
|
5480
|
-
case
|
|
5494
|
+
case MCPServerStatus.DISABLED:
|
|
5481
5495
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5482
5496
|
statusText = "Disabled";
|
|
5483
5497
|
break;
|
|
5484
|
-
case
|
|
5498
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5485
5499
|
default:
|
|
5486
5500
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5487
5501
|
statusText = "Disconnected";
|
|
@@ -5767,7 +5781,7 @@ async function handleInstall(args) {
|
|
|
5767
5781
|
);
|
|
5768
5782
|
if (confirmed) {
|
|
5769
5783
|
const trustedFolders = loadTrustedFolders();
|
|
5770
|
-
await trustedFolders.setValue(realPath,
|
|
5784
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5771
5785
|
} else {
|
|
5772
5786
|
throw new Error(
|
|
5773
5787
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7812,7 +7826,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7812
7826
|
}
|
|
7813
7827
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7814
7828
|
const packageJson = await getPackageJson(__dirname3);
|
|
7815
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.42.0-
|
|
7829
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.42.0-preview.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7816
7830
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7817
7831
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7818
7832
|
}
|
|
@@ -7871,9 +7885,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7871
7885
|
cwd,
|
|
7872
7886
|
potentialWorkspacePoliciesDir
|
|
7873
7887
|
);
|
|
7874
|
-
if (integrityResult.status ===
|
|
7888
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7875
7889
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7876
|
-
} else if (integrityResult.status ===
|
|
7890
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7877
7891
|
workspacePoliciesDir = void 0;
|
|
7878
7892
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7879
7893
|
policyUpdateConfirmationRequest = {
|
|
@@ -8313,23 +8327,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8313
8327
|
if (rawApprovalMode) {
|
|
8314
8328
|
switch (rawApprovalMode) {
|
|
8315
8329
|
case "yolo":
|
|
8316
|
-
approvalMode =
|
|
8330
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8317
8331
|
break;
|
|
8318
8332
|
case "auto_edit":
|
|
8319
|
-
approvalMode =
|
|
8333
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8320
8334
|
break;
|
|
8321
8335
|
case "plan":
|
|
8322
8336
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8323
8337
|
debugLogger.warn(
|
|
8324
8338
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8325
8339
|
);
|
|
8326
|
-
approvalMode =
|
|
8340
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8327
8341
|
} else {
|
|
8328
|
-
approvalMode =
|
|
8342
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8329
8343
|
}
|
|
8330
8344
|
break;
|
|
8331
8345
|
case "default":
|
|
8332
|
-
approvalMode =
|
|
8346
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8333
8347
|
break;
|
|
8334
8348
|
default:
|
|
8335
8349
|
throw new Error(
|
|
@@ -8337,10 +8351,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8337
8351
|
);
|
|
8338
8352
|
}
|
|
8339
8353
|
} else {
|
|
8340
|
-
approvalMode =
|
|
8354
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8341
8355
|
}
|
|
8342
8356
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8343
|
-
if (approvalMode ===
|
|
8357
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8344
8358
|
if (settings.admin?.secureModeEnabled) {
|
|
8345
8359
|
debugLogger.error(
|
|
8346
8360
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8358,16 +8372,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8358
8372
|
)
|
|
8359
8373
|
);
|
|
8360
8374
|
}
|
|
8361
|
-
} else if (approvalMode ===
|
|
8375
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8362
8376
|
debugLogger.warn(
|
|
8363
8377
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8364
8378
|
);
|
|
8365
8379
|
}
|
|
8366
|
-
if (!trustedFolder && approvalMode !==
|
|
8380
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8367
8381
|
debugLogger.warn(
|
|
8368
8382
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8369
8383
|
);
|
|
8370
|
-
approvalMode =
|
|
8384
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8371
8385
|
}
|
|
8372
8386
|
let telemetrySettings;
|
|
8373
8387
|
try {
|
|
@@ -9788,7 +9802,7 @@ import path9 from "node:path";
|
|
|
9788
9802
|
import process4 from "node:process";
|
|
9789
9803
|
var homeDirectoryCheck = {
|
|
9790
9804
|
id: "home-directory",
|
|
9791
|
-
priority:
|
|
9805
|
+
priority: WarningPriority.Low,
|
|
9792
9806
|
check: async (workspaceRoot, settings) => {
|
|
9793
9807
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9794
9808
|
return null;
|
|
@@ -9812,7 +9826,7 @@ var homeDirectoryCheck = {
|
|
|
9812
9826
|
};
|
|
9813
9827
|
var rootDirectoryCheck = {
|
|
9814
9828
|
id: "root-directory",
|
|
9815
|
-
priority:
|
|
9829
|
+
priority: WarningPriority.High,
|
|
9816
9830
|
check: async (workspaceRoot, _settings) => {
|
|
9817
9831
|
try {
|
|
9818
9832
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9828,7 +9842,7 @@ var rootDirectoryCheck = {
|
|
|
9828
9842
|
};
|
|
9829
9843
|
var folderTrustCheck = {
|
|
9830
9844
|
id: "folder-trust",
|
|
9831
|
-
priority:
|
|
9845
|
+
priority: WarningPriority.High,
|
|
9832
9846
|
check: async (workspaceRoot, settings) => {
|
|
9833
9847
|
if (!isFolderTrustEnabled(settings)) {
|
|
9834
9848
|
return null;
|
|
@@ -10018,12 +10032,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10018
10032
|
error,
|
|
10019
10033
|
config.getContentGeneratorConfig()?.authType
|
|
10020
10034
|
);
|
|
10021
|
-
if (config.getOutputFormat() ===
|
|
10035
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10022
10036
|
const streamFormatter = new StreamJsonFormatter();
|
|
10023
10037
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10024
10038
|
const metrics = uiTelemetryService.getMetrics();
|
|
10025
10039
|
streamFormatter.emitEvent({
|
|
10026
|
-
type:
|
|
10040
|
+
type: JsonStreamEventType.RESULT,
|
|
10027
10041
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10028
10042
|
status: "error",
|
|
10029
10043
|
error: {
|
|
@@ -10034,7 +10048,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10034
10048
|
});
|
|
10035
10049
|
runSyncCleanup();
|
|
10036
10050
|
process.exit(getNumericExitCode(errorCode));
|
|
10037
|
-
} else if (config.getOutputFormat() ===
|
|
10051
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10038
10052
|
const formatter = new JsonFormatter();
|
|
10039
10053
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10040
10054
|
const formattedError = formatter.formatError(
|
|
@@ -10054,11 +10068,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10054
10068
|
const isFatal = isFatalToolError(errorType);
|
|
10055
10069
|
if (isFatal) {
|
|
10056
10070
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10057
|
-
if (config.getOutputFormat() ===
|
|
10071
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10058
10072
|
const streamFormatter = new StreamJsonFormatter();
|
|
10059
10073
|
const metrics = uiTelemetryService.getMetrics();
|
|
10060
10074
|
streamFormatter.emitEvent({
|
|
10061
|
-
type:
|
|
10075
|
+
type: JsonStreamEventType.RESULT,
|
|
10062
10076
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10063
10077
|
status: "error",
|
|
10064
10078
|
error: {
|
|
@@ -10067,7 +10081,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10067
10081
|
},
|
|
10068
10082
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10069
10083
|
});
|
|
10070
|
-
} else if (config.getOutputFormat() ===
|
|
10084
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10071
10085
|
const formatter = new JsonFormatter();
|
|
10072
10086
|
const formattedError = formatter.formatError(
|
|
10073
10087
|
toolExecutionError,
|
|
@@ -10085,11 +10099,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10085
10099
|
}
|
|
10086
10100
|
function handleCancellationError(config) {
|
|
10087
10101
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10088
|
-
if (config.getOutputFormat() ===
|
|
10102
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10089
10103
|
const streamFormatter = new StreamJsonFormatter();
|
|
10090
10104
|
const metrics = uiTelemetryService.getMetrics();
|
|
10091
10105
|
streamFormatter.emitEvent({
|
|
10092
|
-
type:
|
|
10106
|
+
type: JsonStreamEventType.RESULT,
|
|
10093
10107
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10094
10108
|
status: "error",
|
|
10095
10109
|
error: {
|
|
@@ -10100,7 +10114,7 @@ function handleCancellationError(config) {
|
|
|
10100
10114
|
});
|
|
10101
10115
|
runSyncCleanup();
|
|
10102
10116
|
process.exit(cancellationError.exitCode);
|
|
10103
|
-
} else if (config.getOutputFormat() ===
|
|
10117
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10104
10118
|
const formatter = new JsonFormatter();
|
|
10105
10119
|
const formattedError = formatter.formatError(
|
|
10106
10120
|
cancellationError,
|
|
@@ -10120,11 +10134,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10120
10134
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10121
10135
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10122
10136
|
);
|
|
10123
|
-
if (config.getOutputFormat() ===
|
|
10137
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10124
10138
|
const streamFormatter = new StreamJsonFormatter();
|
|
10125
10139
|
const metrics = uiTelemetryService.getMetrics();
|
|
10126
10140
|
streamFormatter.emitEvent({
|
|
10127
|
-
type:
|
|
10141
|
+
type: JsonStreamEventType.RESULT,
|
|
10128
10142
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10129
10143
|
status: "error",
|
|
10130
10144
|
error: {
|
|
@@ -10135,7 +10149,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10135
10149
|
});
|
|
10136
10150
|
runSyncCleanup();
|
|
10137
10151
|
process.exit(maxTurnsError.exitCode);
|
|
10138
|
-
} else if (config.getOutputFormat() ===
|
|
10152
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10139
10153
|
const formatter = new JsonFormatter();
|
|
10140
10154
|
const formattedError = formatter.formatError(
|
|
10141
10155
|
maxTurnsError,
|
|
@@ -10215,7 +10229,7 @@ async function runNonInteractive({
|
|
|
10215
10229
|
}
|
|
10216
10230
|
});
|
|
10217
10231
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10218
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10232
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-SPV43SGI.js");
|
|
10219
10233
|
setupInitialActivityLogger(config);
|
|
10220
10234
|
}
|
|
10221
10235
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10231,7 +10245,7 @@ async function runNonInteractive({
|
|
|
10231
10245
|
}
|
|
10232
10246
|
};
|
|
10233
10247
|
const startTime = Date.now();
|
|
10234
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10248
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10235
10249
|
const abortController = new AbortController();
|
|
10236
10250
|
let isAborting = false;
|
|
10237
10251
|
let cancelMessageTimer = null;
|
|
@@ -10284,13 +10298,13 @@ async function runNonInteractive({
|
|
|
10284
10298
|
};
|
|
10285
10299
|
try {
|
|
10286
10300
|
consolePatcher.patch();
|
|
10287
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10301
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10288
10302
|
process.stderr.write(
|
|
10289
10303
|
"[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"
|
|
10290
10304
|
);
|
|
10291
10305
|
}
|
|
10292
10306
|
setupStdinCancellation();
|
|
10293
|
-
coreEvents.on(
|
|
10307
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10294
10308
|
coreEvents.drainBacklogs();
|
|
10295
10309
|
process.stdout.on("error", (err) => {
|
|
10296
10310
|
if (err.code === "EPIPE") {
|
|
@@ -10316,7 +10330,7 @@ async function runNonInteractive({
|
|
|
10316
10330
|
}
|
|
10317
10331
|
if (streamFormatter) {
|
|
10318
10332
|
streamFormatter.emitEvent({
|
|
10319
|
-
type:
|
|
10333
|
+
type: JsonStreamEventType.INIT,
|
|
10320
10334
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10321
10335
|
session_id: config.getSessionId(),
|
|
10322
10336
|
model: config.getModel()
|
|
@@ -10354,7 +10368,7 @@ async function runNonInteractive({
|
|
|
10354
10368
|
}
|
|
10355
10369
|
if (streamFormatter) {
|
|
10356
10370
|
streamFormatter.emitEvent({
|
|
10357
|
-
type:
|
|
10371
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10358
10372
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10359
10373
|
role: "user",
|
|
10360
10374
|
content: input
|
|
@@ -10393,12 +10407,12 @@ async function runNonInteractive({
|
|
|
10393
10407
|
const metrics = uiTelemetryService.getMetrics();
|
|
10394
10408
|
const durationMs = Date.now() - startTime;
|
|
10395
10409
|
streamFormatter.emitEvent({
|
|
10396
|
-
type:
|
|
10410
|
+
type: JsonStreamEventType.RESULT,
|
|
10397
10411
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10398
10412
|
status: "success",
|
|
10399
10413
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10400
10414
|
});
|
|
10401
|
-
} else if (config.getOutputFormat() ===
|
|
10415
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10402
10416
|
const formatter = new JsonFormatter();
|
|
10403
10417
|
const stats = uiTelemetryService.getMetrics();
|
|
10404
10418
|
textOutput.write(
|
|
@@ -10491,13 +10505,13 @@ async function runNonInteractive({
|
|
|
10491
10505
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10492
10506
|
if (streamFormatter) {
|
|
10493
10507
|
streamFormatter.emitEvent({
|
|
10494
|
-
type:
|
|
10508
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10495
10509
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10496
10510
|
role: "assistant",
|
|
10497
10511
|
content: output,
|
|
10498
10512
|
delta: true
|
|
10499
10513
|
});
|
|
10500
|
-
} else if (config.getOutputFormat() ===
|
|
10514
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10501
10515
|
responseText += output;
|
|
10502
10516
|
} else {
|
|
10503
10517
|
if (part.text) {
|
|
@@ -10510,13 +10524,13 @@ async function runNonInteractive({
|
|
|
10510
10524
|
break;
|
|
10511
10525
|
}
|
|
10512
10526
|
case "tool_request": {
|
|
10513
|
-
if (config.getOutputFormat() ===
|
|
10527
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10514
10528
|
preToolResponseText = responseText || preToolResponseText;
|
|
10515
10529
|
responseText = "";
|
|
10516
10530
|
}
|
|
10517
10531
|
if (streamFormatter) {
|
|
10518
10532
|
streamFormatter.emitEvent({
|
|
10519
|
-
type:
|
|
10533
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10520
10534
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10521
10535
|
tool_name: event.name,
|
|
10522
10536
|
tool_id: event.requestId,
|
|
@@ -10532,7 +10546,7 @@ async function runNonInteractive({
|
|
|
10532
10546
|
const displayText = displayContentToString(display);
|
|
10533
10547
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10534
10548
|
streamFormatter.emitEvent({
|
|
10535
|
-
type:
|
|
10549
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10536
10550
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10537
10551
|
tool_id: event.requestId,
|
|
10538
10552
|
status: event.isError ? "error" : "success",
|
|
@@ -10547,17 +10561,17 @@ async function runNonInteractive({
|
|
|
10547
10561
|
const display = event.display?.result;
|
|
10548
10562
|
const displayText = displayContentToString(display);
|
|
10549
10563
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10550
|
-
if (event.data?.["errorType"] ===
|
|
10551
|
-
if (config.getOutputFormat() ===
|
|
10564
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
10565
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
10552
10566
|
responseText = preToolResponseText;
|
|
10553
10567
|
}
|
|
10554
10568
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10555
|
-
if (config.getOutputFormat() ===
|
|
10569
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10556
10570
|
process.stderr.write(`${stopMessage}
|
|
10557
10571
|
`);
|
|
10558
10572
|
}
|
|
10559
10573
|
}
|
|
10560
|
-
if (event.data?.["errorType"] ===
|
|
10574
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
10561
10575
|
throw new FatalToolExecutionError(
|
|
10562
10576
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10563
10577
|
);
|
|
@@ -10579,12 +10593,12 @@ async function runNonInteractive({
|
|
|
10579
10593
|
const errorCode = event._meta?.["code"];
|
|
10580
10594
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10581
10595
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10582
|
-
if (config.getOutputFormat() ===
|
|
10596
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10583
10597
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10584
10598
|
`);
|
|
10585
10599
|
} else if (streamFormatter) {
|
|
10586
10600
|
streamFormatter.emitEvent({
|
|
10587
|
-
type:
|
|
10601
|
+
type: JsonStreamEventType.ERROR,
|
|
10588
10602
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10589
10603
|
severity: "warning",
|
|
10590
10604
|
message: stripAnsi(blockMessage)
|
|
@@ -10594,13 +10608,13 @@ async function runNonInteractive({
|
|
|
10594
10608
|
break;
|
|
10595
10609
|
}
|
|
10596
10610
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10597
|
-
if (config.getOutputFormat() ===
|
|
10611
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10598
10612
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10599
10613
|
`);
|
|
10600
10614
|
}
|
|
10601
10615
|
if (streamFormatter) {
|
|
10602
10616
|
streamFormatter.emitEvent({
|
|
10603
|
-
type:
|
|
10617
|
+
type: JsonStreamEventType.ERROR,
|
|
10604
10618
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10605
10619
|
severity,
|
|
10606
10620
|
message: stripAnsi(event.message)
|
|
@@ -10620,7 +10634,7 @@ async function runNonInteractive({
|
|
|
10620
10634
|
);
|
|
10621
10635
|
} else if (streamFormatter) {
|
|
10622
10636
|
streamFormatter.emitEvent({
|
|
10623
|
-
type:
|
|
10637
|
+
type: JsonStreamEventType.ERROR,
|
|
10624
10638
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10625
10639
|
severity: "error",
|
|
10626
10640
|
message: "Maximum session turns exceeded"
|
|
@@ -10628,7 +10642,7 @@ async function runNonInteractive({
|
|
|
10628
10642
|
}
|
|
10629
10643
|
}
|
|
10630
10644
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10631
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10645
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10632
10646
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10633
10647
|
`);
|
|
10634
10648
|
}
|
|
@@ -10658,7 +10672,7 @@ async function runNonInteractive({
|
|
|
10658
10672
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10659
10673
|
scheduler?.dispose();
|
|
10660
10674
|
consolePatcher.cleanup();
|
|
10661
|
-
coreEvents.off(
|
|
10675
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10662
10676
|
}
|
|
10663
10677
|
if (errorToHandle) {
|
|
10664
10678
|
handleError(errorToHandle, config);
|
|
@@ -10683,7 +10697,7 @@ async function runNonInteractive2(params) {
|
|
|
10683
10697
|
}
|
|
10684
10698
|
});
|
|
10685
10699
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10686
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10700
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-SPV43SGI.js");
|
|
10687
10701
|
setupInitialActivityLogger(config);
|
|
10688
10702
|
}
|
|
10689
10703
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10699,7 +10713,7 @@ async function runNonInteractive2(params) {
|
|
|
10699
10713
|
}
|
|
10700
10714
|
};
|
|
10701
10715
|
const startTime = Date.now();
|
|
10702
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10716
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10703
10717
|
const abortController = new AbortController();
|
|
10704
10718
|
let isAborting = false;
|
|
10705
10719
|
let cancelMessageTimer = null;
|
|
@@ -10750,13 +10764,13 @@ async function runNonInteractive2(params) {
|
|
|
10750
10764
|
let scheduler;
|
|
10751
10765
|
try {
|
|
10752
10766
|
consolePatcher.patch();
|
|
10753
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10767
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10754
10768
|
process.stderr.write(
|
|
10755
10769
|
"[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"
|
|
10756
10770
|
);
|
|
10757
10771
|
}
|
|
10758
10772
|
setupStdinCancellation();
|
|
10759
|
-
coreEvents.on(
|
|
10773
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10760
10774
|
coreEvents.drainBacklogs();
|
|
10761
10775
|
process.stdout.on("error", (err) => {
|
|
10762
10776
|
if (err.code === "EPIPE") {
|
|
@@ -10780,7 +10794,7 @@ async function runNonInteractive2(params) {
|
|
|
10780
10794
|
}
|
|
10781
10795
|
if (streamFormatter) {
|
|
10782
10796
|
streamFormatter.emitEvent({
|
|
10783
|
-
type:
|
|
10797
|
+
type: JsonStreamEventType.INIT,
|
|
10784
10798
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10785
10799
|
session_id: config.getSessionId(),
|
|
10786
10800
|
model: config.getModel()
|
|
@@ -10818,7 +10832,7 @@ async function runNonInteractive2(params) {
|
|
|
10818
10832
|
}
|
|
10819
10833
|
if (streamFormatter) {
|
|
10820
10834
|
streamFormatter.emitEvent({
|
|
10821
|
-
type:
|
|
10835
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10822
10836
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10823
10837
|
role: "user",
|
|
10824
10838
|
content: input
|
|
@@ -10846,28 +10860,28 @@ async function runNonInteractive2(params) {
|
|
|
10846
10860
|
if (abortController.signal.aborted) {
|
|
10847
10861
|
handleCancellationError(config);
|
|
10848
10862
|
}
|
|
10849
|
-
if (event.type ===
|
|
10863
|
+
if (event.type === GeminiEventType.Content) {
|
|
10850
10864
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10851
10865
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10852
10866
|
if (streamFormatter) {
|
|
10853
10867
|
streamFormatter.emitEvent({
|
|
10854
|
-
type:
|
|
10868
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10855
10869
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10856
10870
|
role: "assistant",
|
|
10857
10871
|
content: output,
|
|
10858
10872
|
delta: true
|
|
10859
10873
|
});
|
|
10860
|
-
} else if (config.getOutputFormat() ===
|
|
10874
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10861
10875
|
responseText += output;
|
|
10862
10876
|
} else {
|
|
10863
10877
|
if (event.value) {
|
|
10864
10878
|
textOutput.write(output);
|
|
10865
10879
|
}
|
|
10866
10880
|
}
|
|
10867
|
-
} else if (event.type ===
|
|
10881
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
10868
10882
|
if (streamFormatter) {
|
|
10869
10883
|
streamFormatter.emitEvent({
|
|
10870
|
-
type:
|
|
10884
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10871
10885
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10872
10886
|
tool_name: event.value.name,
|
|
10873
10887
|
tool_id: event.value.callId,
|
|
@@ -10875,33 +10889,33 @@ async function runNonInteractive2(params) {
|
|
|
10875
10889
|
});
|
|
10876
10890
|
}
|
|
10877
10891
|
toolCallRequests.push(event.value);
|
|
10878
|
-
} else if (event.type ===
|
|
10892
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
10879
10893
|
const message = "Loop detected, stopping execution";
|
|
10880
10894
|
if (streamFormatter) {
|
|
10881
10895
|
streamFormatter.emitEvent({
|
|
10882
|
-
type:
|
|
10896
|
+
type: JsonStreamEventType.ERROR,
|
|
10883
10897
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10884
10898
|
severity: "warning",
|
|
10885
10899
|
message
|
|
10886
10900
|
});
|
|
10887
10901
|
}
|
|
10888
10902
|
warnings.push(message);
|
|
10889
|
-
} else if (event.type ===
|
|
10903
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
10890
10904
|
const message = "Maximum session turns exceeded";
|
|
10891
10905
|
if (streamFormatter) {
|
|
10892
10906
|
streamFormatter.emitEvent({
|
|
10893
|
-
type:
|
|
10907
|
+
type: JsonStreamEventType.ERROR,
|
|
10894
10908
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10895
10909
|
severity: "error",
|
|
10896
10910
|
message
|
|
10897
10911
|
});
|
|
10898
10912
|
}
|
|
10899
10913
|
warnings.push(message);
|
|
10900
|
-
} else if (event.type ===
|
|
10914
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
10901
10915
|
throw event.value.error;
|
|
10902
|
-
} else if (event.type ===
|
|
10916
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
10903
10917
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10904
|
-
if (config.getOutputFormat() ===
|
|
10918
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10905
10919
|
process.stderr.write(`${stopMessage}
|
|
10906
10920
|
`);
|
|
10907
10921
|
}
|
|
@@ -10909,7 +10923,7 @@ async function runNonInteractive2(params) {
|
|
|
10909
10923
|
const metrics = uiTelemetryService.getMetrics();
|
|
10910
10924
|
const durationMs = Date.now() - startTime;
|
|
10911
10925
|
streamFormatter.emitEvent({
|
|
10912
|
-
type:
|
|
10926
|
+
type: JsonStreamEventType.RESULT,
|
|
10913
10927
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10914
10928
|
status: "success",
|
|
10915
10929
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10919,30 +10933,30 @@ async function runNonInteractive2(params) {
|
|
|
10919
10933
|
});
|
|
10920
10934
|
}
|
|
10921
10935
|
return;
|
|
10922
|
-
} else if (event.type ===
|
|
10936
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
10923
10937
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10924
|
-
if (config.getOutputFormat() ===
|
|
10938
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10925
10939
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10926
10940
|
`);
|
|
10927
10941
|
} else if (streamFormatter) {
|
|
10928
10942
|
streamFormatter.emitEvent({
|
|
10929
|
-
type:
|
|
10943
|
+
type: JsonStreamEventType.ERROR,
|
|
10930
10944
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10931
10945
|
severity: "warning",
|
|
10932
10946
|
message: stripAnsi(blockMessage)
|
|
10933
10947
|
});
|
|
10934
10948
|
}
|
|
10935
10949
|
warnings.push(blockMessage);
|
|
10936
|
-
} else if (event.type ===
|
|
10950
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
10937
10951
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10938
10952
|
if (streamFormatter) {
|
|
10939
10953
|
streamFormatter.emitEvent({
|
|
10940
|
-
type:
|
|
10954
|
+
type: JsonStreamEventType.ERROR,
|
|
10941
10955
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10942
10956
|
severity: "error",
|
|
10943
10957
|
message: invalidStreamError
|
|
10944
10958
|
});
|
|
10945
|
-
} else if (config.getOutputFormat() ===
|
|
10959
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10946
10960
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10947
10961
|
`);
|
|
10948
10962
|
}
|
|
@@ -10962,7 +10976,7 @@ async function runNonInteractive2(params) {
|
|
|
10962
10976
|
const requestInfo = completedToolCall.request;
|
|
10963
10977
|
if (streamFormatter) {
|
|
10964
10978
|
streamFormatter.emitEvent({
|
|
10965
|
-
type:
|
|
10979
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10966
10980
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10967
10981
|
tool_id: requestInfo.callId,
|
|
10968
10982
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -10996,11 +11010,11 @@ async function runNonInteractive2(params) {
|
|
|
10996
11010
|
);
|
|
10997
11011
|
}
|
|
10998
11012
|
const stopExecutionTool = completedToolCalls.find(
|
|
10999
|
-
(tc) => tc.response.errorType ===
|
|
11013
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
11000
11014
|
);
|
|
11001
11015
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11002
11016
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11003
|
-
if (config.getOutputFormat() ===
|
|
11017
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11004
11018
|
process.stderr.write(`${stopMessage}
|
|
11005
11019
|
`);
|
|
11006
11020
|
}
|
|
@@ -11008,7 +11022,7 @@ async function runNonInteractive2(params) {
|
|
|
11008
11022
|
const metrics = uiTelemetryService.getMetrics();
|
|
11009
11023
|
const durationMs = Date.now() - startTime;
|
|
11010
11024
|
streamFormatter.emitEvent({
|
|
11011
|
-
type:
|
|
11025
|
+
type: JsonStreamEventType.RESULT,
|
|
11012
11026
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11013
11027
|
status: "success",
|
|
11014
11028
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11016,7 +11030,7 @@ async function runNonInteractive2(params) {
|
|
|
11016
11030
|
durationMs
|
|
11017
11031
|
)
|
|
11018
11032
|
});
|
|
11019
|
-
} else if (config.getOutputFormat() ===
|
|
11033
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11020
11034
|
const formatter = new JsonFormatter();
|
|
11021
11035
|
const stats = uiTelemetryService.getMetrics();
|
|
11022
11036
|
textOutput.write(
|
|
@@ -11039,12 +11053,12 @@ async function runNonInteractive2(params) {
|
|
|
11039
11053
|
const metrics = uiTelemetryService.getMetrics();
|
|
11040
11054
|
const durationMs = Date.now() - startTime;
|
|
11041
11055
|
streamFormatter.emitEvent({
|
|
11042
|
-
type:
|
|
11056
|
+
type: JsonStreamEventType.RESULT,
|
|
11043
11057
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11044
11058
|
status: invalidStreamError ? "error" : "success",
|
|
11045
11059
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11046
11060
|
});
|
|
11047
|
-
} else if (config.getOutputFormat() ===
|
|
11061
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11048
11062
|
const formatter = new JsonFormatter();
|
|
11049
11063
|
const stats = uiTelemetryService.getMetrics();
|
|
11050
11064
|
textOutput.write(
|
|
@@ -11068,7 +11082,7 @@ async function runNonInteractive2(params) {
|
|
|
11068
11082
|
cleanupStdinCancellation();
|
|
11069
11083
|
scheduler?.dispose();
|
|
11070
11084
|
consolePatcher.cleanup();
|
|
11071
|
-
coreEvents.off(
|
|
11085
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11072
11086
|
}
|
|
11073
11087
|
if (errorToHandle) {
|
|
11074
11088
|
handleError(errorToHandle, config);
|
|
@@ -13499,12 +13513,12 @@ function toToolCallContent(toolResult) {
|
|
|
13499
13513
|
}
|
|
13500
13514
|
var basicPermissionOptions = [
|
|
13501
13515
|
{
|
|
13502
|
-
optionId:
|
|
13516
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
13503
13517
|
name: "Allow",
|
|
13504
13518
|
kind: "allow_once"
|
|
13505
13519
|
},
|
|
13506
13520
|
{
|
|
13507
|
-
optionId:
|
|
13521
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
13508
13522
|
name: "Reject",
|
|
13509
13523
|
kind: "reject_once"
|
|
13510
13524
|
}
|
|
@@ -13516,13 +13530,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13516
13530
|
switch (confirmation.type) {
|
|
13517
13531
|
case "edit":
|
|
13518
13532
|
options.push({
|
|
13519
|
-
optionId:
|
|
13533
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13520
13534
|
name: "Allow for this session",
|
|
13521
13535
|
kind: "allow_always"
|
|
13522
13536
|
});
|
|
13523
13537
|
if (enablePermanentToolApproval) {
|
|
13524
13538
|
options.push({
|
|
13525
|
-
optionId:
|
|
13539
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13526
13540
|
name: "Allow for this file in all future sessions",
|
|
13527
13541
|
kind: "allow_always"
|
|
13528
13542
|
});
|
|
@@ -13530,13 +13544,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13530
13544
|
break;
|
|
13531
13545
|
case "exec":
|
|
13532
13546
|
options.push({
|
|
13533
|
-
optionId:
|
|
13547
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13534
13548
|
name: "Allow for this session",
|
|
13535
13549
|
kind: "allow_always"
|
|
13536
13550
|
});
|
|
13537
13551
|
if (enablePermanentToolApproval) {
|
|
13538
13552
|
options.push({
|
|
13539
|
-
optionId:
|
|
13553
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13540
13554
|
name: "Allow this command for all future sessions",
|
|
13541
13555
|
kind: "allow_always"
|
|
13542
13556
|
});
|
|
@@ -13545,19 +13559,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13545
13559
|
case "mcp":
|
|
13546
13560
|
options.push(
|
|
13547
13561
|
{
|
|
13548
|
-
optionId:
|
|
13562
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
13549
13563
|
name: "Allow all server tools for this session",
|
|
13550
13564
|
kind: "allow_always"
|
|
13551
13565
|
},
|
|
13552
13566
|
{
|
|
13553
|
-
optionId:
|
|
13567
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
13554
13568
|
name: "Allow tool for this session",
|
|
13555
13569
|
kind: "allow_always"
|
|
13556
13570
|
}
|
|
13557
13571
|
);
|
|
13558
13572
|
if (enablePermanentToolApproval) {
|
|
13559
13573
|
options.push({
|
|
13560
|
-
optionId:
|
|
13574
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13561
13575
|
name: "Allow tool for all future sessions",
|
|
13562
13576
|
kind: "allow_always"
|
|
13563
13577
|
});
|
|
@@ -13565,13 +13579,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13565
13579
|
break;
|
|
13566
13580
|
case "info":
|
|
13567
13581
|
options.push({
|
|
13568
|
-
optionId:
|
|
13582
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13569
13583
|
name: "Allow for this session",
|
|
13570
13584
|
kind: "allow_always"
|
|
13571
13585
|
});
|
|
13572
13586
|
if (enablePermanentToolApproval) {
|
|
13573
13587
|
options.push({
|
|
13574
|
-
optionId:
|
|
13588
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13575
13589
|
name: "Allow for all future sessions",
|
|
13576
13590
|
kind: "allow_always"
|
|
13577
13591
|
});
|
|
@@ -13603,21 +13617,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13603
13617
|
}
|
|
13604
13618
|
function toAcpToolKind(kind) {
|
|
13605
13619
|
switch (kind) {
|
|
13606
|
-
case
|
|
13607
|
-
case
|
|
13608
|
-
case
|
|
13609
|
-
case
|
|
13610
|
-
case
|
|
13611
|
-
case
|
|
13612
|
-
case
|
|
13613
|
-
case
|
|
13614
|
-
case
|
|
13615
|
-
case
|
|
13620
|
+
case Kind.Read:
|
|
13621
|
+
case Kind.Edit:
|
|
13622
|
+
case Kind.Execute:
|
|
13623
|
+
case Kind.Search:
|
|
13624
|
+
case Kind.Delete:
|
|
13625
|
+
case Kind.Move:
|
|
13626
|
+
case Kind.Think:
|
|
13627
|
+
case Kind.Fetch:
|
|
13628
|
+
case Kind.SwitchMode:
|
|
13629
|
+
case Kind.Other:
|
|
13616
13630
|
return kind;
|
|
13617
|
-
case
|
|
13631
|
+
case Kind.Agent:
|
|
13618
13632
|
return "think";
|
|
13619
|
-
case
|
|
13620
|
-
case
|
|
13633
|
+
case Kind.Plan:
|
|
13634
|
+
case Kind.Communicate:
|
|
13621
13635
|
default:
|
|
13622
13636
|
return "other";
|
|
13623
13637
|
}
|
|
@@ -13625,24 +13639,24 @@ function toAcpToolKind(kind) {
|
|
|
13625
13639
|
function buildAvailableModes(isPlanEnabled) {
|
|
13626
13640
|
const modes = [
|
|
13627
13641
|
{
|
|
13628
|
-
id:
|
|
13642
|
+
id: ApprovalMode.DEFAULT,
|
|
13629
13643
|
name: "Default",
|
|
13630
13644
|
description: "Prompts for approval"
|
|
13631
13645
|
},
|
|
13632
13646
|
{
|
|
13633
|
-
id:
|
|
13647
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
13634
13648
|
name: "Auto Edit",
|
|
13635
13649
|
description: "Auto-approves edit tools"
|
|
13636
13650
|
},
|
|
13637
13651
|
{
|
|
13638
|
-
id:
|
|
13652
|
+
id: ApprovalMode.YOLO,
|
|
13639
13653
|
name: "YOLO",
|
|
13640
13654
|
description: "Auto-approves all tools"
|
|
13641
13655
|
}
|
|
13642
13656
|
];
|
|
13643
13657
|
if (isPlanEnabled) {
|
|
13644
13658
|
modes.push({
|
|
13645
|
-
id:
|
|
13659
|
+
id: ApprovalMode.PLAN,
|
|
13646
13660
|
name: "Plan",
|
|
13647
13661
|
description: "Read-only mode"
|
|
13648
13662
|
});
|
|
@@ -13655,7 +13669,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13655
13669
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13656
13670
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
13657
13671
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13658
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13672
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
13659
13673
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13660
13674
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13661
13675
|
useGemini3_1: useGemini31,
|
|
@@ -13744,7 +13758,7 @@ var Session = class {
|
|
|
13744
13758
|
this.connection = connection;
|
|
13745
13759
|
this.settings = settings;
|
|
13746
13760
|
coreEvents.on(
|
|
13747
|
-
|
|
13761
|
+
CoreEvent.ApprovalModeChanged,
|
|
13748
13762
|
this.handleApprovalModeChanged
|
|
13749
13763
|
);
|
|
13750
13764
|
}
|
|
@@ -13767,7 +13781,7 @@ var Session = class {
|
|
|
13767
13781
|
};
|
|
13768
13782
|
dispose() {
|
|
13769
13783
|
coreEvents.off(
|
|
13770
|
-
|
|
13784
|
+
CoreEvent.ApprovalModeChanged,
|
|
13771
13785
|
this.handleApprovalModeChanged
|
|
13772
13786
|
);
|
|
13773
13787
|
}
|
|
@@ -13855,7 +13869,7 @@ ${thought.description}`;
|
|
|
13855
13869
|
await this.sendUpdate({
|
|
13856
13870
|
sessionUpdate: "tool_call",
|
|
13857
13871
|
toolCallId: toolCall.id,
|
|
13858
|
-
status: toolCall.status ===
|
|
13872
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
13859
13873
|
title: toolCall.displayName || toolCall.name,
|
|
13860
13874
|
content: toolCallContent,
|
|
13861
13875
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -13947,7 +13961,7 @@ ${thought.description}`;
|
|
|
13947
13961
|
return { stopReason: "cancelled" };
|
|
13948
13962
|
}
|
|
13949
13963
|
switch (event.type) {
|
|
13950
|
-
case
|
|
13964
|
+
case GeminiEventType.Content: {
|
|
13951
13965
|
const content = {
|
|
13952
13966
|
type: "text",
|
|
13953
13967
|
text: event.value
|
|
@@ -13958,7 +13972,7 @@ ${thought.description}`;
|
|
|
13958
13972
|
});
|
|
13959
13973
|
break;
|
|
13960
13974
|
}
|
|
13961
|
-
case
|
|
13975
|
+
case GeminiEventType.Thought: {
|
|
13962
13976
|
const thoughtText = `**${event.value.subject}**
|
|
13963
13977
|
${event.value.description}`;
|
|
13964
13978
|
await this.sendUpdate({
|
|
@@ -13967,10 +13981,10 @@ ${event.value.description}`;
|
|
|
13967
13981
|
});
|
|
13968
13982
|
break;
|
|
13969
13983
|
}
|
|
13970
|
-
case
|
|
13984
|
+
case GeminiEventType.ToolCallRequest:
|
|
13971
13985
|
toolCallRequests.push(event.value);
|
|
13972
13986
|
break;
|
|
13973
|
-
case
|
|
13987
|
+
case GeminiEventType.Finished: {
|
|
13974
13988
|
const usage2 = event.value.usageMetadata;
|
|
13975
13989
|
if (usage2) {
|
|
13976
13990
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -13978,19 +13992,19 @@ ${event.value.description}`;
|
|
|
13978
13992
|
}
|
|
13979
13993
|
break;
|
|
13980
13994
|
}
|
|
13981
|
-
case
|
|
13995
|
+
case GeminiEventType.ModelInfo:
|
|
13982
13996
|
turnModelId = event.value;
|
|
13983
13997
|
break;
|
|
13984
|
-
case
|
|
13998
|
+
case GeminiEventType.MaxSessionTurns:
|
|
13985
13999
|
stopReason = "max_turn_requests";
|
|
13986
14000
|
break;
|
|
13987
|
-
case
|
|
14001
|
+
case GeminiEventType.LoopDetected:
|
|
13988
14002
|
stopReason = "max_turn_requests";
|
|
13989
14003
|
break;
|
|
13990
|
-
case
|
|
14004
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
13991
14005
|
stopReason = "max_tokens";
|
|
13992
14006
|
break;
|
|
13993
|
-
case
|
|
14007
|
+
case GeminiEventType.Error: {
|
|
13994
14008
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
13995
14009
|
event.value.error
|
|
13996
14010
|
);
|
|
@@ -14218,7 +14232,7 @@ ${event.value.description}`;
|
|
|
14218
14232
|
const output = RequestPermissionResponseSchema.parse(
|
|
14219
14233
|
await this.connection.requestPermission(params)
|
|
14220
14234
|
);
|
|
14221
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14235
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14222
14236
|
await confirmationDetails.onConfirm(outcome);
|
|
14223
14237
|
await updatePolicy(
|
|
14224
14238
|
tool,
|
|
@@ -14229,16 +14243,16 @@ ${event.value.description}`;
|
|
|
14229
14243
|
invocation
|
|
14230
14244
|
);
|
|
14231
14245
|
switch (outcome) {
|
|
14232
|
-
case
|
|
14246
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14233
14247
|
return errorResponse(
|
|
14234
14248
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14235
14249
|
);
|
|
14236
|
-
case
|
|
14237
|
-
case
|
|
14238
|
-
case
|
|
14239
|
-
case
|
|
14240
|
-
case
|
|
14241
|
-
case
|
|
14250
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
14251
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
14252
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
14253
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
14254
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
14255
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14242
14256
|
break;
|
|
14243
14257
|
default: {
|
|
14244
14258
|
const resultOutcome = outcome;
|
|
@@ -14286,7 +14300,7 @@ ${event.value.description}`;
|
|
|
14286
14300
|
);
|
|
14287
14301
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14288
14302
|
{
|
|
14289
|
-
status:
|
|
14303
|
+
status: CoreToolCallStatus.Success,
|
|
14290
14304
|
request: {
|
|
14291
14305
|
callId,
|
|
14292
14306
|
name: fc.name,
|
|
@@ -14331,7 +14345,7 @@ ${event.value.description}`;
|
|
|
14331
14345
|
});
|
|
14332
14346
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14333
14347
|
{
|
|
14334
|
-
status:
|
|
14348
|
+
status: CoreToolCallStatus.Error,
|
|
14335
14349
|
request: {
|
|
14336
14350
|
callId,
|
|
14337
14351
|
name: fc.name,
|
|
@@ -14446,12 +14460,12 @@ ${event.value.description}`;
|
|
|
14446
14460
|
sessionId: this.id,
|
|
14447
14461
|
options: [
|
|
14448
14462
|
{
|
|
14449
|
-
optionId:
|
|
14463
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14450
14464
|
name: "Allow once",
|
|
14451
14465
|
kind: "allow_once"
|
|
14452
14466
|
},
|
|
14453
14467
|
{
|
|
14454
|
-
optionId:
|
|
14468
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14455
14469
|
name: "Deny",
|
|
14456
14470
|
kind: "reject_once"
|
|
14457
14471
|
}
|
|
@@ -14476,8 +14490,8 @@ ${event.value.description}`;
|
|
|
14476
14490
|
const output = RequestPermissionResponseSchema.parse(
|
|
14477
14491
|
await this.connection.requestPermission(params)
|
|
14478
14492
|
);
|
|
14479
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14480
|
-
if (outcome ===
|
|
14493
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14494
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14481
14495
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14482
14496
|
validationError = null;
|
|
14483
14497
|
} else {
|
|
@@ -14909,7 +14923,7 @@ var AcpSessionManager = class {
|
|
|
14909
14923
|
mcpServers,
|
|
14910
14924
|
loadedSettings
|
|
14911
14925
|
);
|
|
14912
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
14926
|
+
const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
|
|
14913
14927
|
let isAuthenticated = false;
|
|
14914
14928
|
let authErrorMessage = "";
|
|
14915
14929
|
try {
|
|
@@ -14921,7 +14935,7 @@ var AcpSessionManager = class {
|
|
|
14921
14935
|
);
|
|
14922
14936
|
isAuthenticated = true;
|
|
14923
14937
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
14924
|
-
if (authType ===
|
|
14938
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
14925
14939
|
isAuthenticated = false;
|
|
14926
14940
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
14927
14941
|
}
|
|
@@ -15131,12 +15145,12 @@ var GeminiAgent = class {
|
|
|
15131
15145
|
}
|
|
15132
15146
|
const authMethods = [
|
|
15133
15147
|
{
|
|
15134
|
-
id:
|
|
15148
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
15135
15149
|
name: "Log in with Google",
|
|
15136
15150
|
description: "Log in with your Google account"
|
|
15137
15151
|
},
|
|
15138
15152
|
{
|
|
15139
|
-
id:
|
|
15153
|
+
id: AuthType.USE_GEMINI,
|
|
15140
15154
|
name: "Gemini API key",
|
|
15141
15155
|
description: "Use an API key with Gemini Developer API",
|
|
15142
15156
|
_meta: {
|
|
@@ -15146,12 +15160,12 @@ var GeminiAgent = class {
|
|
|
15146
15160
|
}
|
|
15147
15161
|
},
|
|
15148
15162
|
{
|
|
15149
|
-
id:
|
|
15163
|
+
id: AuthType.USE_VERTEX_AI,
|
|
15150
15164
|
name: "Vertex AI",
|
|
15151
15165
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15152
15166
|
},
|
|
15153
15167
|
{
|
|
15154
|
-
id:
|
|
15168
|
+
id: AuthType.GATEWAY,
|
|
15155
15169
|
name: "AI API Gateway",
|
|
15156
15170
|
description: "Use a custom AI API Gateway",
|
|
15157
15171
|
_meta: {
|
|
@@ -15324,7 +15338,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15324
15338
|
}
|
|
15325
15339
|
return authType;
|
|
15326
15340
|
} catch (error) {
|
|
15327
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15341
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
15328
15342
|
handleError(
|
|
15329
15343
|
error instanceof Error ? error : new Error(String(error)),
|
|
15330
15344
|
nonInteractiveConfig,
|
|
@@ -15520,10 +15534,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15520
15534
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15521
15535
|
}
|
|
15522
15536
|
start() {
|
|
15523
|
-
coreEvents.on(
|
|
15537
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15524
15538
|
}
|
|
15525
15539
|
stop() {
|
|
15526
|
-
coreEvents.off(
|
|
15540
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15527
15541
|
if (this.flushTimeout) {
|
|
15528
15542
|
clearTimeout(this.flushTimeout);
|
|
15529
15543
|
this.flushTimeout = null;
|
|
@@ -15746,7 +15760,7 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
|
|
|
15746
15760
|
}
|
|
15747
15761
|
}
|
|
15748
15762
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15749
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15763
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-BNDKNCVJ.js");
|
|
15750
15764
|
await doStartUI(
|
|
15751
15765
|
config,
|
|
15752
15766
|
settings,
|
|
@@ -15848,12 +15862,12 @@ async function main() {
|
|
|
15848
15862
|
dns.setDefaultResultOrder(
|
|
15849
15863
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15850
15864
|
);
|
|
15851
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15865
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
15852
15866
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15853
15867
|
settings.setValue(
|
|
15854
15868
|
"User" /* User */,
|
|
15855
15869
|
"security.auth.selectedType",
|
|
15856
|
-
|
|
15870
|
+
AuthType.COMPUTE_ADC
|
|
15857
15871
|
);
|
|
15858
15872
|
}
|
|
15859
15873
|
}
|
|
@@ -15953,7 +15967,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15953
15967
|
await config.storage.initialize();
|
|
15954
15968
|
adminControlsListner.setConfig(config);
|
|
15955
15969
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15956
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
15970
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-SPV43SGI.js");
|
|
15957
15971
|
setupInitialActivityLogger(config);
|
|
15958
15972
|
}
|
|
15959
15973
|
registerTelemetryConfig(config);
|
|
@@ -15961,7 +15975,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15961
15975
|
const messageBus = config.getMessageBus();
|
|
15962
15976
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
15963
15977
|
registerCleanup(async () => {
|
|
15964
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
15978
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
15965
15979
|
});
|
|
15966
15980
|
if (!config.getAcpMode()) {
|
|
15967
15981
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16012,7 +16026,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16012
16026
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16013
16027
|
const initializationResult = await initializeApp(config, settings);
|
|
16014
16028
|
initAppHandle?.end();
|
|
16015
|
-
import("./liteRtServerManager-
|
|
16029
|
+
import("./liteRtServerManager-IQHHDTUM.js").then(({ LiteRtServerManager }) => {
|
|
16016
16030
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16017
16031
|
if (!mergedGemma) return;
|
|
16018
16032
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16022,7 +16036,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16022
16036
|
autoStartServer: userGemma?.autoStartServer
|
|
16023
16037
|
});
|
|
16024
16038
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16025
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16039
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
16026
16040
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16027
16041
|
}
|
|
16028
16042
|
if (config.getAcpMode()) {
|
|
@@ -16038,7 +16052,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16038
16052
|
...rawStartupWarnings.map((message) => ({
|
|
16039
16053
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16040
16054
|
message,
|
|
16041
|
-
priority:
|
|
16055
|
+
priority: WarningPriority.High
|
|
16042
16056
|
})),
|
|
16043
16057
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16044
16058
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16075,7 +16089,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16075
16089
|
${input}` : stdinData;
|
|
16076
16090
|
}
|
|
16077
16091
|
}
|
|
16078
|
-
const sessionStartSource = resumedSessionData ?
|
|
16092
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
16079
16093
|
const hookSystem = config?.getHookSystem();
|
|
16080
16094
|
if (hookSystem) {
|
|
16081
16095
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16132,8 +16146,8 @@ ${input}` : wrappedContext;
|
|
|
16132
16146
|
}
|
|
16133
16147
|
}
|
|
16134
16148
|
function initializeOutputListenersAndFlush(config) {
|
|
16135
|
-
if (coreEvents.listenerCount(
|
|
16136
|
-
coreEvents.on(
|
|
16149
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
16150
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
16137
16151
|
if (payload.isStderr) {
|
|
16138
16152
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16139
16153
|
} else {
|
|
@@ -16141,8 +16155,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16141
16155
|
}
|
|
16142
16156
|
});
|
|
16143
16157
|
}
|
|
16144
|
-
if (coreEvents.listenerCount(
|
|
16145
|
-
coreEvents.on(
|
|
16158
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
16159
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
16146
16160
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16147
16161
|
writeToStderr(payload.content + "\n");
|
|
16148
16162
|
} else {
|
|
@@ -16150,8 +16164,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16150
16164
|
}
|
|
16151
16165
|
});
|
|
16152
16166
|
}
|
|
16153
|
-
if (coreEvents.listenerCount(
|
|
16154
|
-
coreEvents.on(
|
|
16167
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
16168
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
16155
16169
|
writeToStderr(payload.message + "\n");
|
|
16156
16170
|
});
|
|
16157
16171
|
}
|
|
@@ -16159,7 +16173,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16159
16173
|
const forceToStderr = outputFormat === "json";
|
|
16160
16174
|
coreEvents.drainBacklogs(
|
|
16161
16175
|
(event, args) => {
|
|
16162
|
-
if (forceToStderr && event ===
|
|
16176
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
16163
16177
|
const payload = args[0];
|
|
16164
16178
|
if (!payload.isStderr) {
|
|
16165
16179
|
return {
|