@google/gemini-cli 0.43.0-preview.0 → 0.43.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-MXKXLNQD.js → chunk-3BNJIKEP.js} +2 -2
- package/bundle/{chunk-UIG2IVPJ.js → chunk-4G3X2H3F.js} +1 -1
- package/bundle/{chunk-LFGJVOVZ.js → chunk-4SLX6GS6.js} +7 -7
- package/bundle/{chunk-MRHFLHPJ.js → chunk-4ZT3EIBI.js} +1 -1
- package/bundle/{chunk-HQXINMBL.js → chunk-6YMGRLOQ.js} +1 -1
- package/bundle/{chunk-43AGRA7S.js → chunk-CKPZGEE3.js} +2 -2
- package/bundle/{chunk-WQOLTO3C.js → chunk-CZPVSLJF.js} +1 -1
- package/bundle/{chunk-PSWUV2OO.js → chunk-DJCG6GWZ.js} +2 -2
- package/bundle/{chunk-6XOSIMPZ.js → chunk-ERQUIEOO.js} +9 -8
- package/bundle/{chunk-SYD5SJFT.js → chunk-EWAAFVBK.js} +9 -6
- package/bundle/{chunk-T3SUXLQQ.js → chunk-F7PEGIBA.js} +2 -2
- package/bundle/{chunk-P4UQCQUB.js → chunk-ICOPZSVB.js} +3 -3
- package/bundle/{chunk-PGJUNQPO.js → chunk-IF5BAOVJ.js} +1 -1
- package/bundle/chunk-KILFUY3Y.js +512 -0
- package/bundle/{chunk-JENIU3E3.js → chunk-L4LBKMR6.js} +1 -1
- package/bundle/{chunk-LBQFRHYD.js → chunk-LTFEPQ67.js} +1 -1
- package/bundle/{chunk-X26T73X6.js → chunk-LTSFEC7U.js} +2 -2
- package/bundle/{chunk-SAISHGWW.js → chunk-MRVZNBXY.js} +4 -4
- package/bundle/{chunk-QYUN3J2L.js → chunk-N3MLU4IQ.js} +68 -55
- package/bundle/{chunk-UNAVBUTP.js → chunk-NDSJWRFE.js} +6974 -13060
- package/bundle/{chunk-NBRZ4A3S.js → chunk-NG2WIKH5.js} +2 -2
- package/bundle/chunk-PLEERNRJ.js +156 -0
- package/bundle/{chunk-PYLHDAUK.js → chunk-QAQT56LH.js} +3 -3
- package/bundle/{chunk-4TLQKGTR.js → chunk-S36EONMM.js} +1 -1
- package/bundle/chunk-UB4AWMZC.js +391 -0
- package/bundle/{chunk-Q23X5R4A.js → chunk-UBCHSKF2.js} +7 -7
- package/bundle/chunk-ULCEBJMK.js +17248 -0
- package/bundle/chunk-UUHMEKLA.js +357199 -0
- package/bundle/chunk-UW3H4T6A.js +1571 -0
- package/bundle/{chunk-46T44JOY.js → chunk-VSTO23O2.js} +1 -1
- package/bundle/chunk-XKIM3BNI.js +118 -0
- package/bundle/chunk-YIHNW7CC.js +81649 -0
- package/bundle/{cleanup-MI76P55B.js → cleanup-BMLCC7SO.js} +2 -2
- package/bundle/{cleanup-NZBQYB7U.js → cleanup-LMJA4J5S.js} +3 -3
- package/bundle/cleanup-M7RSLDBR.js +33 -0
- package/bundle/{cleanup-EIZJH2E3.js → cleanup-NMUMRIEF.js} +2 -2
- package/bundle/{core-T2TBFAYG.js → core-WXTAU5UX.js} +1 -1
- package/bundle/{devtoolsService-LV5NJ2BT.js → devtoolsService-2L5U47ZQ.js} +2 -2
- package/bundle/{devtoolsService-FYTOIC37.js → devtoolsService-6THA6GNX.js} +2 -2
- package/bundle/{devtoolsService-7KZDSYEF.js → devtoolsService-J2AC6YXM.js} +5 -4
- package/bundle/devtoolsService-SRWIME2Q.js +857 -0
- package/bundle/{dist-ETX67B7P.js → dist-DIIMIT2U.js} +1 -1
- package/bundle/{core-ERSGIOMQ.js → dist-MXL7ZG46.js} +2 -2
- package/bundle/dist-POIHCQVM.js +2124 -0
- package/bundle/{gemini-IVKBXHDT.js → gemini-D32FDZXN.js} +13 -13
- package/bundle/{gemini-Z77GAAR6.js → gemini-DLZ2R4X7.js} +202 -188
- package/bundle/{gemini-JKWQQTKP.js → gemini-HYQU2RK2.js} +13 -13
- package/bundle/gemini-JJG7ZGWB.js +16356 -0
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-36WZS6KT.js → interactiveCli-DHMPW4RS.js} +8 -8
- package/bundle/{interactiveCli-SME5QTEN.js → interactiveCli-K7ETWJMN.js} +315 -296
- package/bundle/{interactiveCli-BQ36B66Z.js → interactiveCli-NR7OUF3G.js} +8 -8
- package/bundle/interactiveCli-X4AUP7T7.js +34752 -0
- package/bundle/{liteRtServerManager-2QD4R3A3.js → liteRtServerManager-L7C3D5RL.js} +4 -4
- package/bundle/{liteRtServerManager-N6OMT6W5.js → liteRtServerManager-PKRLUK2P.js} +4 -4
- package/bundle/{liteRtServerManager-ISYDOBNC.js → liteRtServerManager-TEBDIGEN.js} +5 -5
- package/bundle/liteRtServerManager-UPCAT7Z2.js +66 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-DOSIH6VE.js → oauth2-provider-52IJKUJI.js} +1 -1
- package/bundle/{oauth2-provider-VFOABWBW.js → oauth2-provider-OPOTTZ5C.js} +1 -1
- package/bundle/{oauth2-provider-TZF6EZRX.js → oauth2-provider-TOAKXOL7.js} +39 -73
- package/bundle/oauth2-provider-WN4YIDA4.js +237 -0
- package/bundle/{start-3GPIRK3E.js → start-6KIIUSAH.js} +6 -6
- package/bundle/{start-6NONW677.js → start-7ZNSGJD6.js} +7 -7
- package/bundle/start-EPIILWLN.js +19 -0
- package/bundle/{start-M6MUPEJS.js → start-TMFPUYEL.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-4SLX6GS6.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-XKIM3BNI.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-S36EONMM.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-4G3X2H3F.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-3BNJIKEP.js";
|
|
93
|
+
import "./chunk-KILFUY3Y.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-F7PEGIBA.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,
|
|
@@ -190,9 +200,11 @@ import {
|
|
|
190
200
|
updatePolicy,
|
|
191
201
|
writeToStderr,
|
|
192
202
|
writeToStdout
|
|
193
|
-
} from "./chunk-
|
|
203
|
+
} from "./chunk-MRVZNBXY.js";
|
|
194
204
|
import {
|
|
195
205
|
ASK_USER_TOOL_NAME,
|
|
206
|
+
ApprovalMode,
|
|
207
|
+
CoreEvent,
|
|
196
208
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
197
209
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
198
210
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -212,6 +224,7 @@ import {
|
|
|
212
224
|
FatalUntrustedWorkspaceError,
|
|
213
225
|
GEMINI_DIR,
|
|
214
226
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
227
|
+
Kind,
|
|
215
228
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
216
229
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
217
230
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -221,6 +234,7 @@ import {
|
|
|
221
234
|
REFERENCE_CONTENT_START,
|
|
222
235
|
Storage,
|
|
223
236
|
ToolConfirmationOutcome,
|
|
237
|
+
ToolErrorType,
|
|
224
238
|
coreEvents,
|
|
225
239
|
debugLogger,
|
|
226
240
|
external_exports,
|
|
@@ -235,7 +249,7 @@ import {
|
|
|
235
249
|
loadServerHierarchicalMemory,
|
|
236
250
|
resolveToRealPath,
|
|
237
251
|
setGeminiMdFilename
|
|
238
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-UJ26GAE5.js";
|
|
239
253
|
import "./chunk-664ZODQF.js";
|
|
240
254
|
import "./chunk-RJTRUG2J.js";
|
|
241
255
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5365,7 +5379,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5365
5379
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5366
5380
|
const isStdio = !!config.command;
|
|
5367
5381
|
if (isStdio && !isTrusted) {
|
|
5368
|
-
return
|
|
5382
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5369
5383
|
}
|
|
5370
5384
|
const client = new Client({
|
|
5371
5385
|
name: "mcp-test-client",
|
|
@@ -5401,7 +5415,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5401
5415
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5402
5416
|
} catch {
|
|
5403
5417
|
await client.close();
|
|
5404
|
-
return
|
|
5418
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5405
5419
|
}
|
|
5406
5420
|
try {
|
|
5407
5421
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5415,10 +5429,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5415
5429
|
);
|
|
5416
5430
|
}
|
|
5417
5431
|
await client.close();
|
|
5418
|
-
return
|
|
5432
|
+
return MCPServerStatus.CONNECTED;
|
|
5419
5433
|
} catch {
|
|
5420
5434
|
await transport.close();
|
|
5421
|
-
return
|
|
5435
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5422
5436
|
}
|
|
5423
5437
|
}
|
|
5424
5438
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5431,12 +5445,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5431
5445
|
});
|
|
5432
5446
|
if (!loadResult.allowed) {
|
|
5433
5447
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5434
|
-
return
|
|
5448
|
+
return MCPServerStatus.BLOCKED;
|
|
5435
5449
|
}
|
|
5436
|
-
return
|
|
5450
|
+
return MCPServerStatus.DISABLED;
|
|
5437
5451
|
}
|
|
5438
5452
|
if (!isTrusted) {
|
|
5439
|
-
return
|
|
5453
|
+
return MCPServerStatus.DISABLED;
|
|
5440
5454
|
}
|
|
5441
5455
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5442
5456
|
}
|
|
@@ -5478,23 +5492,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5478
5492
|
let statusIndicator = "";
|
|
5479
5493
|
let statusText = "";
|
|
5480
5494
|
switch (status) {
|
|
5481
|
-
case
|
|
5495
|
+
case MCPServerStatus.CONNECTED:
|
|
5482
5496
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5483
5497
|
statusText = "Connected";
|
|
5484
5498
|
break;
|
|
5485
|
-
case
|
|
5499
|
+
case MCPServerStatus.CONNECTING:
|
|
5486
5500
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5487
5501
|
statusText = "Connecting";
|
|
5488
5502
|
break;
|
|
5489
|
-
case
|
|
5503
|
+
case MCPServerStatus.BLOCKED:
|
|
5490
5504
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5491
5505
|
statusText = "Blocked";
|
|
5492
5506
|
break;
|
|
5493
|
-
case
|
|
5507
|
+
case MCPServerStatus.DISABLED:
|
|
5494
5508
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5495
5509
|
statusText = "Disabled";
|
|
5496
5510
|
break;
|
|
5497
|
-
case
|
|
5511
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5498
5512
|
default:
|
|
5499
5513
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5500
5514
|
statusText = "Disconnected";
|
|
@@ -5780,7 +5794,7 @@ async function handleInstall(args) {
|
|
|
5780
5794
|
);
|
|
5781
5795
|
if (confirmed) {
|
|
5782
5796
|
const trustedFolders = loadTrustedFolders();
|
|
5783
|
-
await trustedFolders.setValue(realPath,
|
|
5797
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5784
5798
|
} else {
|
|
5785
5799
|
throw new Error(
|
|
5786
5800
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7825,7 +7839,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7825
7839
|
}
|
|
7826
7840
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7827
7841
|
const packageJson = await getPackageJson(__dirname3);
|
|
7828
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
7842
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.43.0-preview.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7829
7843
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7830
7844
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7831
7845
|
}
|
|
@@ -7884,9 +7898,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7884
7898
|
cwd,
|
|
7885
7899
|
potentialWorkspacePoliciesDir
|
|
7886
7900
|
);
|
|
7887
|
-
if (integrityResult.status ===
|
|
7901
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7888
7902
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7889
|
-
} else if (integrityResult.status ===
|
|
7903
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7890
7904
|
workspacePoliciesDir = void 0;
|
|
7891
7905
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7892
7906
|
policyUpdateConfirmationRequest = {
|
|
@@ -8335,23 +8349,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8335
8349
|
if (rawApprovalMode) {
|
|
8336
8350
|
switch (rawApprovalMode) {
|
|
8337
8351
|
case "yolo":
|
|
8338
|
-
approvalMode =
|
|
8352
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8339
8353
|
break;
|
|
8340
8354
|
case "auto_edit":
|
|
8341
|
-
approvalMode =
|
|
8355
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8342
8356
|
break;
|
|
8343
8357
|
case "plan":
|
|
8344
8358
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8345
8359
|
debugLogger.warn(
|
|
8346
8360
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8347
8361
|
);
|
|
8348
|
-
approvalMode =
|
|
8362
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8349
8363
|
} else {
|
|
8350
|
-
approvalMode =
|
|
8364
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8351
8365
|
}
|
|
8352
8366
|
break;
|
|
8353
8367
|
case "default":
|
|
8354
|
-
approvalMode =
|
|
8368
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8355
8369
|
break;
|
|
8356
8370
|
default:
|
|
8357
8371
|
throw new Error(
|
|
@@ -8359,10 +8373,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8359
8373
|
);
|
|
8360
8374
|
}
|
|
8361
8375
|
} else {
|
|
8362
|
-
approvalMode =
|
|
8376
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8363
8377
|
}
|
|
8364
8378
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8365
|
-
if (approvalMode ===
|
|
8379
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8366
8380
|
if (settings.admin?.secureModeEnabled) {
|
|
8367
8381
|
debugLogger.error(
|
|
8368
8382
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8380,16 +8394,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8380
8394
|
)
|
|
8381
8395
|
);
|
|
8382
8396
|
}
|
|
8383
|
-
} else if (approvalMode ===
|
|
8397
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8384
8398
|
debugLogger.warn(
|
|
8385
8399
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8386
8400
|
);
|
|
8387
8401
|
}
|
|
8388
|
-
if (!trustedFolder && approvalMode !==
|
|
8402
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8389
8403
|
debugLogger.warn(
|
|
8390
8404
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8391
8405
|
);
|
|
8392
|
-
approvalMode =
|
|
8406
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8393
8407
|
}
|
|
8394
8408
|
let telemetrySettings;
|
|
8395
8409
|
try {
|
|
@@ -9806,7 +9820,7 @@ import path9 from "node:path";
|
|
|
9806
9820
|
import process4 from "node:process";
|
|
9807
9821
|
var homeDirectoryCheck = {
|
|
9808
9822
|
id: "home-directory",
|
|
9809
|
-
priority:
|
|
9823
|
+
priority: WarningPriority.Low,
|
|
9810
9824
|
check: async (workspaceRoot, settings) => {
|
|
9811
9825
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9812
9826
|
return null;
|
|
@@ -9830,7 +9844,7 @@ var homeDirectoryCheck = {
|
|
|
9830
9844
|
};
|
|
9831
9845
|
var rootDirectoryCheck = {
|
|
9832
9846
|
id: "root-directory",
|
|
9833
|
-
priority:
|
|
9847
|
+
priority: WarningPriority.High,
|
|
9834
9848
|
check: async (workspaceRoot, _settings) => {
|
|
9835
9849
|
try {
|
|
9836
9850
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9846,7 +9860,7 @@ var rootDirectoryCheck = {
|
|
|
9846
9860
|
};
|
|
9847
9861
|
var folderTrustCheck = {
|
|
9848
9862
|
id: "folder-trust",
|
|
9849
|
-
priority:
|
|
9863
|
+
priority: WarningPriority.High,
|
|
9850
9864
|
check: async (workspaceRoot, settings) => {
|
|
9851
9865
|
if (!isFolderTrustEnabled(settings)) {
|
|
9852
9866
|
return null;
|
|
@@ -10036,12 +10050,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10036
10050
|
error,
|
|
10037
10051
|
config.getContentGeneratorConfig()?.authType
|
|
10038
10052
|
);
|
|
10039
|
-
if (config.getOutputFormat() ===
|
|
10053
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10040
10054
|
const streamFormatter = new StreamJsonFormatter();
|
|
10041
10055
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10042
10056
|
const metrics = uiTelemetryService.getMetrics();
|
|
10043
10057
|
streamFormatter.emitEvent({
|
|
10044
|
-
type:
|
|
10058
|
+
type: JsonStreamEventType.RESULT,
|
|
10045
10059
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10046
10060
|
status: "error",
|
|
10047
10061
|
error: {
|
|
@@ -10052,7 +10066,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10052
10066
|
});
|
|
10053
10067
|
runSyncCleanup();
|
|
10054
10068
|
process.exit(getNumericExitCode(errorCode));
|
|
10055
|
-
} else if (config.getOutputFormat() ===
|
|
10069
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10056
10070
|
const formatter = new JsonFormatter();
|
|
10057
10071
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10058
10072
|
const formattedError = formatter.formatError(
|
|
@@ -10072,11 +10086,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10072
10086
|
const isFatal = isFatalToolError(errorType);
|
|
10073
10087
|
if (isFatal) {
|
|
10074
10088
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10075
|
-
if (config.getOutputFormat() ===
|
|
10089
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10076
10090
|
const streamFormatter = new StreamJsonFormatter();
|
|
10077
10091
|
const metrics = uiTelemetryService.getMetrics();
|
|
10078
10092
|
streamFormatter.emitEvent({
|
|
10079
|
-
type:
|
|
10093
|
+
type: JsonStreamEventType.RESULT,
|
|
10080
10094
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10081
10095
|
status: "error",
|
|
10082
10096
|
error: {
|
|
@@ -10085,7 +10099,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10085
10099
|
},
|
|
10086
10100
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10087
10101
|
});
|
|
10088
|
-
} else if (config.getOutputFormat() ===
|
|
10102
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10089
10103
|
const formatter = new JsonFormatter();
|
|
10090
10104
|
const formattedError = formatter.formatError(
|
|
10091
10105
|
toolExecutionError,
|
|
@@ -10103,11 +10117,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10103
10117
|
}
|
|
10104
10118
|
function handleCancellationError(config) {
|
|
10105
10119
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10106
|
-
if (config.getOutputFormat() ===
|
|
10120
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10107
10121
|
const streamFormatter = new StreamJsonFormatter();
|
|
10108
10122
|
const metrics = uiTelemetryService.getMetrics();
|
|
10109
10123
|
streamFormatter.emitEvent({
|
|
10110
|
-
type:
|
|
10124
|
+
type: JsonStreamEventType.RESULT,
|
|
10111
10125
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10112
10126
|
status: "error",
|
|
10113
10127
|
error: {
|
|
@@ -10118,7 +10132,7 @@ function handleCancellationError(config) {
|
|
|
10118
10132
|
});
|
|
10119
10133
|
runSyncCleanup();
|
|
10120
10134
|
process.exit(cancellationError.exitCode);
|
|
10121
|
-
} else if (config.getOutputFormat() ===
|
|
10135
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10122
10136
|
const formatter = new JsonFormatter();
|
|
10123
10137
|
const formattedError = formatter.formatError(
|
|
10124
10138
|
cancellationError,
|
|
@@ -10138,11 +10152,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10138
10152
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10139
10153
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10140
10154
|
);
|
|
10141
|
-
if (config.getOutputFormat() ===
|
|
10155
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10142
10156
|
const streamFormatter = new StreamJsonFormatter();
|
|
10143
10157
|
const metrics = uiTelemetryService.getMetrics();
|
|
10144
10158
|
streamFormatter.emitEvent({
|
|
10145
|
-
type:
|
|
10159
|
+
type: JsonStreamEventType.RESULT,
|
|
10146
10160
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10147
10161
|
status: "error",
|
|
10148
10162
|
error: {
|
|
@@ -10153,7 +10167,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10153
10167
|
});
|
|
10154
10168
|
runSyncCleanup();
|
|
10155
10169
|
process.exit(maxTurnsError.exitCode);
|
|
10156
|
-
} else if (config.getOutputFormat() ===
|
|
10170
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10157
10171
|
const formatter = new JsonFormatter();
|
|
10158
10172
|
const formattedError = formatter.formatError(
|
|
10159
10173
|
maxTurnsError,
|
|
@@ -10233,7 +10247,7 @@ async function runNonInteractive({
|
|
|
10233
10247
|
}
|
|
10234
10248
|
});
|
|
10235
10249
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10236
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10250
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-6THA6GNX.js");
|
|
10237
10251
|
setupInitialActivityLogger(config);
|
|
10238
10252
|
}
|
|
10239
10253
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10249,7 +10263,7 @@ async function runNonInteractive({
|
|
|
10249
10263
|
}
|
|
10250
10264
|
};
|
|
10251
10265
|
const startTime = Date.now();
|
|
10252
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10266
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10253
10267
|
const abortController = new AbortController();
|
|
10254
10268
|
let isAborting = false;
|
|
10255
10269
|
let cancelMessageTimer = null;
|
|
@@ -10302,13 +10316,13 @@ async function runNonInteractive({
|
|
|
10302
10316
|
};
|
|
10303
10317
|
try {
|
|
10304
10318
|
consolePatcher.patch();
|
|
10305
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10319
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10306
10320
|
process.stderr.write(
|
|
10307
10321
|
"[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"
|
|
10308
10322
|
);
|
|
10309
10323
|
}
|
|
10310
10324
|
setupStdinCancellation();
|
|
10311
|
-
coreEvents.on(
|
|
10325
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10312
10326
|
coreEvents.drainBacklogs();
|
|
10313
10327
|
process.stdout.on("error", (err) => {
|
|
10314
10328
|
if (err.code === "EPIPE") {
|
|
@@ -10334,7 +10348,7 @@ async function runNonInteractive({
|
|
|
10334
10348
|
}
|
|
10335
10349
|
if (streamFormatter) {
|
|
10336
10350
|
streamFormatter.emitEvent({
|
|
10337
|
-
type:
|
|
10351
|
+
type: JsonStreamEventType.INIT,
|
|
10338
10352
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10339
10353
|
session_id: config.getSessionId(),
|
|
10340
10354
|
model: config.getModel()
|
|
@@ -10372,7 +10386,7 @@ async function runNonInteractive({
|
|
|
10372
10386
|
}
|
|
10373
10387
|
if (streamFormatter) {
|
|
10374
10388
|
streamFormatter.emitEvent({
|
|
10375
|
-
type:
|
|
10389
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10376
10390
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10377
10391
|
role: "user",
|
|
10378
10392
|
content: input
|
|
@@ -10411,12 +10425,12 @@ async function runNonInteractive({
|
|
|
10411
10425
|
const metrics = uiTelemetryService.getMetrics();
|
|
10412
10426
|
const durationMs = Date.now() - startTime;
|
|
10413
10427
|
streamFormatter.emitEvent({
|
|
10414
|
-
type:
|
|
10428
|
+
type: JsonStreamEventType.RESULT,
|
|
10415
10429
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10416
10430
|
status: "success",
|
|
10417
10431
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10418
10432
|
});
|
|
10419
|
-
} else if (config.getOutputFormat() ===
|
|
10433
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10420
10434
|
const formatter = new JsonFormatter();
|
|
10421
10435
|
const stats = uiTelemetryService.getMetrics();
|
|
10422
10436
|
textOutput.write(
|
|
@@ -10509,13 +10523,13 @@ async function runNonInteractive({
|
|
|
10509
10523
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10510
10524
|
if (streamFormatter) {
|
|
10511
10525
|
streamFormatter.emitEvent({
|
|
10512
|
-
type:
|
|
10526
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10513
10527
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10514
10528
|
role: "assistant",
|
|
10515
10529
|
content: output,
|
|
10516
10530
|
delta: true
|
|
10517
10531
|
});
|
|
10518
|
-
} else if (config.getOutputFormat() ===
|
|
10532
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10519
10533
|
responseText += output;
|
|
10520
10534
|
} else {
|
|
10521
10535
|
if (part.text) {
|
|
@@ -10528,13 +10542,13 @@ async function runNonInteractive({
|
|
|
10528
10542
|
break;
|
|
10529
10543
|
}
|
|
10530
10544
|
case "tool_request": {
|
|
10531
|
-
if (config.getOutputFormat() ===
|
|
10545
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10532
10546
|
preToolResponseText = responseText || preToolResponseText;
|
|
10533
10547
|
responseText = "";
|
|
10534
10548
|
}
|
|
10535
10549
|
if (streamFormatter) {
|
|
10536
10550
|
streamFormatter.emitEvent({
|
|
10537
|
-
type:
|
|
10551
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10538
10552
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10539
10553
|
tool_name: event.name,
|
|
10540
10554
|
tool_id: event.requestId,
|
|
@@ -10550,7 +10564,7 @@ async function runNonInteractive({
|
|
|
10550
10564
|
const displayText = displayContentToString(display);
|
|
10551
10565
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10552
10566
|
streamFormatter.emitEvent({
|
|
10553
|
-
type:
|
|
10567
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10554
10568
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10555
10569
|
tool_id: event.requestId,
|
|
10556
10570
|
status: event.isError ? "error" : "success",
|
|
@@ -10565,17 +10579,17 @@ async function runNonInteractive({
|
|
|
10565
10579
|
const display = event.display?.result;
|
|
10566
10580
|
const displayText = displayContentToString(display);
|
|
10567
10581
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10568
|
-
if (event.data?.["errorType"] ===
|
|
10569
|
-
if (config.getOutputFormat() ===
|
|
10582
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
10583
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
10570
10584
|
responseText = preToolResponseText;
|
|
10571
10585
|
}
|
|
10572
10586
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10573
|
-
if (config.getOutputFormat() ===
|
|
10587
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10574
10588
|
process.stderr.write(`${stopMessage}
|
|
10575
10589
|
`);
|
|
10576
10590
|
}
|
|
10577
10591
|
}
|
|
10578
|
-
if (event.data?.["errorType"] ===
|
|
10592
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
10579
10593
|
throw new FatalToolExecutionError(
|
|
10580
10594
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10581
10595
|
);
|
|
@@ -10597,12 +10611,12 @@ async function runNonInteractive({
|
|
|
10597
10611
|
const errorCode = event._meta?.["code"];
|
|
10598
10612
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10599
10613
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10600
|
-
if (config.getOutputFormat() ===
|
|
10614
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10601
10615
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10602
10616
|
`);
|
|
10603
10617
|
} else if (streamFormatter) {
|
|
10604
10618
|
streamFormatter.emitEvent({
|
|
10605
|
-
type:
|
|
10619
|
+
type: JsonStreamEventType.ERROR,
|
|
10606
10620
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10607
10621
|
severity: "warning",
|
|
10608
10622
|
message: stripAnsi(blockMessage)
|
|
@@ -10612,13 +10626,13 @@ async function runNonInteractive({
|
|
|
10612
10626
|
break;
|
|
10613
10627
|
}
|
|
10614
10628
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10615
|
-
if (config.getOutputFormat() ===
|
|
10629
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10616
10630
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10617
10631
|
`);
|
|
10618
10632
|
}
|
|
10619
10633
|
if (streamFormatter) {
|
|
10620
10634
|
streamFormatter.emitEvent({
|
|
10621
|
-
type:
|
|
10635
|
+
type: JsonStreamEventType.ERROR,
|
|
10622
10636
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10623
10637
|
severity,
|
|
10624
10638
|
message: stripAnsi(event.message)
|
|
@@ -10638,7 +10652,7 @@ async function runNonInteractive({
|
|
|
10638
10652
|
);
|
|
10639
10653
|
} else if (streamFormatter) {
|
|
10640
10654
|
streamFormatter.emitEvent({
|
|
10641
|
-
type:
|
|
10655
|
+
type: JsonStreamEventType.ERROR,
|
|
10642
10656
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10643
10657
|
severity: "error",
|
|
10644
10658
|
message: "Maximum session turns exceeded"
|
|
@@ -10646,7 +10660,7 @@ async function runNonInteractive({
|
|
|
10646
10660
|
}
|
|
10647
10661
|
}
|
|
10648
10662
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10649
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10663
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10650
10664
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10651
10665
|
`);
|
|
10652
10666
|
}
|
|
@@ -10676,7 +10690,7 @@ async function runNonInteractive({
|
|
|
10676
10690
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10677
10691
|
scheduler?.dispose();
|
|
10678
10692
|
consolePatcher.cleanup();
|
|
10679
|
-
coreEvents.off(
|
|
10693
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10680
10694
|
}
|
|
10681
10695
|
if (errorToHandle) {
|
|
10682
10696
|
handleError(errorToHandle, config);
|
|
@@ -10704,7 +10718,7 @@ async function runNonInteractive2(params) {
|
|
|
10704
10718
|
}
|
|
10705
10719
|
});
|
|
10706
10720
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10707
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10721
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-6THA6GNX.js");
|
|
10708
10722
|
setupInitialActivityLogger(config);
|
|
10709
10723
|
}
|
|
10710
10724
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10720,7 +10734,7 @@ async function runNonInteractive2(params) {
|
|
|
10720
10734
|
}
|
|
10721
10735
|
};
|
|
10722
10736
|
const startTime = Date.now();
|
|
10723
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10737
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10724
10738
|
const abortController = new AbortController();
|
|
10725
10739
|
let isAborting = false;
|
|
10726
10740
|
let cancelMessageTimer = null;
|
|
@@ -10771,13 +10785,13 @@ async function runNonInteractive2(params) {
|
|
|
10771
10785
|
let scheduler;
|
|
10772
10786
|
try {
|
|
10773
10787
|
consolePatcher.patch();
|
|
10774
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10788
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10775
10789
|
process.stderr.write(
|
|
10776
10790
|
"[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"
|
|
10777
10791
|
);
|
|
10778
10792
|
}
|
|
10779
10793
|
setupStdinCancellation();
|
|
10780
|
-
coreEvents.on(
|
|
10794
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10781
10795
|
coreEvents.drainBacklogs();
|
|
10782
10796
|
process.stdout.on("error", (err) => {
|
|
10783
10797
|
if (err.code === "EPIPE") {
|
|
@@ -10801,7 +10815,7 @@ async function runNonInteractive2(params) {
|
|
|
10801
10815
|
}
|
|
10802
10816
|
if (streamFormatter) {
|
|
10803
10817
|
streamFormatter.emitEvent({
|
|
10804
|
-
type:
|
|
10818
|
+
type: JsonStreamEventType.INIT,
|
|
10805
10819
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10806
10820
|
session_id: config.getSessionId(),
|
|
10807
10821
|
model: config.getModel()
|
|
@@ -10839,7 +10853,7 @@ async function runNonInteractive2(params) {
|
|
|
10839
10853
|
}
|
|
10840
10854
|
if (streamFormatter) {
|
|
10841
10855
|
streamFormatter.emitEvent({
|
|
10842
|
-
type:
|
|
10856
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10843
10857
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10844
10858
|
role: "user",
|
|
10845
10859
|
content: input
|
|
@@ -10867,28 +10881,28 @@ async function runNonInteractive2(params) {
|
|
|
10867
10881
|
if (abortController.signal.aborted) {
|
|
10868
10882
|
handleCancellationError(config);
|
|
10869
10883
|
}
|
|
10870
|
-
if (event.type ===
|
|
10884
|
+
if (event.type === GeminiEventType.Content) {
|
|
10871
10885
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10872
10886
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10873
10887
|
if (streamFormatter) {
|
|
10874
10888
|
streamFormatter.emitEvent({
|
|
10875
|
-
type:
|
|
10889
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10876
10890
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10877
10891
|
role: "assistant",
|
|
10878
10892
|
content: output,
|
|
10879
10893
|
delta: true
|
|
10880
10894
|
});
|
|
10881
|
-
} else if (config.getOutputFormat() ===
|
|
10895
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10882
10896
|
responseText += output;
|
|
10883
10897
|
} else {
|
|
10884
10898
|
if (event.value) {
|
|
10885
10899
|
textOutput.write(output);
|
|
10886
10900
|
}
|
|
10887
10901
|
}
|
|
10888
|
-
} else if (event.type ===
|
|
10902
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
10889
10903
|
if (streamFormatter) {
|
|
10890
10904
|
streamFormatter.emitEvent({
|
|
10891
|
-
type:
|
|
10905
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10892
10906
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10893
10907
|
tool_name: event.value.name,
|
|
10894
10908
|
tool_id: event.value.callId,
|
|
@@ -10896,33 +10910,33 @@ async function runNonInteractive2(params) {
|
|
|
10896
10910
|
});
|
|
10897
10911
|
}
|
|
10898
10912
|
toolCallRequests.push(event.value);
|
|
10899
|
-
} else if (event.type ===
|
|
10913
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
10900
10914
|
const message = "Loop detected, stopping execution";
|
|
10901
10915
|
if (streamFormatter) {
|
|
10902
10916
|
streamFormatter.emitEvent({
|
|
10903
|
-
type:
|
|
10917
|
+
type: JsonStreamEventType.ERROR,
|
|
10904
10918
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10905
10919
|
severity: "warning",
|
|
10906
10920
|
message
|
|
10907
10921
|
});
|
|
10908
10922
|
}
|
|
10909
10923
|
warnings.push(message);
|
|
10910
|
-
} else if (event.type ===
|
|
10924
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
10911
10925
|
const message = "Maximum session turns exceeded";
|
|
10912
10926
|
if (streamFormatter) {
|
|
10913
10927
|
streamFormatter.emitEvent({
|
|
10914
|
-
type:
|
|
10928
|
+
type: JsonStreamEventType.ERROR,
|
|
10915
10929
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10916
10930
|
severity: "error",
|
|
10917
10931
|
message
|
|
10918
10932
|
});
|
|
10919
10933
|
}
|
|
10920
10934
|
warnings.push(message);
|
|
10921
|
-
} else if (event.type ===
|
|
10935
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
10922
10936
|
throw event.value.error;
|
|
10923
|
-
} else if (event.type ===
|
|
10937
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
10924
10938
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10925
|
-
if (config.getOutputFormat() ===
|
|
10939
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10926
10940
|
process.stderr.write(`${stopMessage}
|
|
10927
10941
|
`);
|
|
10928
10942
|
}
|
|
@@ -10930,7 +10944,7 @@ async function runNonInteractive2(params) {
|
|
|
10930
10944
|
const metrics = uiTelemetryService.getMetrics();
|
|
10931
10945
|
const durationMs = Date.now() - startTime;
|
|
10932
10946
|
streamFormatter.emitEvent({
|
|
10933
|
-
type:
|
|
10947
|
+
type: JsonStreamEventType.RESULT,
|
|
10934
10948
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10935
10949
|
status: "success",
|
|
10936
10950
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10938,7 +10952,7 @@ async function runNonInteractive2(params) {
|
|
|
10938
10952
|
durationMs
|
|
10939
10953
|
)
|
|
10940
10954
|
});
|
|
10941
|
-
} else if (config.getOutputFormat() ===
|
|
10955
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10942
10956
|
const formatter = new JsonFormatter();
|
|
10943
10957
|
const stats = uiTelemetryService.getMetrics();
|
|
10944
10958
|
textOutput.write(
|
|
@@ -10954,30 +10968,30 @@ async function runNonInteractive2(params) {
|
|
|
10954
10968
|
textOutput.ensureTrailingNewline();
|
|
10955
10969
|
}
|
|
10956
10970
|
return;
|
|
10957
|
-
} else if (event.type ===
|
|
10971
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
10958
10972
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10959
|
-
if (config.getOutputFormat() ===
|
|
10973
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10960
10974
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10961
10975
|
`);
|
|
10962
10976
|
} else if (streamFormatter) {
|
|
10963
10977
|
streamFormatter.emitEvent({
|
|
10964
|
-
type:
|
|
10978
|
+
type: JsonStreamEventType.ERROR,
|
|
10965
10979
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10966
10980
|
severity: "warning",
|
|
10967
10981
|
message: stripAnsi(blockMessage)
|
|
10968
10982
|
});
|
|
10969
10983
|
}
|
|
10970
10984
|
warnings.push(blockMessage);
|
|
10971
|
-
} else if (event.type ===
|
|
10985
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
10972
10986
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10973
10987
|
if (streamFormatter) {
|
|
10974
10988
|
streamFormatter.emitEvent({
|
|
10975
|
-
type:
|
|
10989
|
+
type: JsonStreamEventType.ERROR,
|
|
10976
10990
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10977
10991
|
severity: "error",
|
|
10978
10992
|
message: invalidStreamError
|
|
10979
10993
|
});
|
|
10980
|
-
} else if (config.getOutputFormat() ===
|
|
10994
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10981
10995
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10982
10996
|
`);
|
|
10983
10997
|
}
|
|
@@ -10997,7 +11011,7 @@ async function runNonInteractive2(params) {
|
|
|
10997
11011
|
const requestInfo = completedToolCall.request;
|
|
10998
11012
|
if (streamFormatter) {
|
|
10999
11013
|
streamFormatter.emitEvent({
|
|
11000
|
-
type:
|
|
11014
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11001
11015
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11002
11016
|
tool_id: requestInfo.callId,
|
|
11003
11017
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11031,11 +11045,11 @@ async function runNonInteractive2(params) {
|
|
|
11031
11045
|
);
|
|
11032
11046
|
}
|
|
11033
11047
|
const stopExecutionTool = completedToolCalls.find(
|
|
11034
|
-
(tc) => tc.response.errorType ===
|
|
11048
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
11035
11049
|
);
|
|
11036
11050
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11037
11051
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11038
|
-
if (config.getOutputFormat() ===
|
|
11052
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11039
11053
|
process.stderr.write(`${stopMessage}
|
|
11040
11054
|
`);
|
|
11041
11055
|
}
|
|
@@ -11043,7 +11057,7 @@ async function runNonInteractive2(params) {
|
|
|
11043
11057
|
const metrics = uiTelemetryService.getMetrics();
|
|
11044
11058
|
const durationMs = Date.now() - startTime;
|
|
11045
11059
|
streamFormatter.emitEvent({
|
|
11046
|
-
type:
|
|
11060
|
+
type: JsonStreamEventType.RESULT,
|
|
11047
11061
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11048
11062
|
status: "success",
|
|
11049
11063
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11051,7 +11065,7 @@ async function runNonInteractive2(params) {
|
|
|
11051
11065
|
durationMs
|
|
11052
11066
|
)
|
|
11053
11067
|
});
|
|
11054
|
-
} else if (config.getOutputFormat() ===
|
|
11068
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11055
11069
|
const formatter = new JsonFormatter();
|
|
11056
11070
|
const stats = uiTelemetryService.getMetrics();
|
|
11057
11071
|
textOutput.write(
|
|
@@ -11074,12 +11088,12 @@ async function runNonInteractive2(params) {
|
|
|
11074
11088
|
const metrics = uiTelemetryService.getMetrics();
|
|
11075
11089
|
const durationMs = Date.now() - startTime;
|
|
11076
11090
|
streamFormatter.emitEvent({
|
|
11077
|
-
type:
|
|
11091
|
+
type: JsonStreamEventType.RESULT,
|
|
11078
11092
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11079
11093
|
status: invalidStreamError ? "error" : "success",
|
|
11080
11094
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11081
11095
|
});
|
|
11082
|
-
} else if (config.getOutputFormat() ===
|
|
11096
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11083
11097
|
const formatter = new JsonFormatter();
|
|
11084
11098
|
const stats = uiTelemetryService.getMetrics();
|
|
11085
11099
|
textOutput.write(
|
|
@@ -11103,7 +11117,7 @@ async function runNonInteractive2(params) {
|
|
|
11103
11117
|
cleanupStdinCancellation();
|
|
11104
11118
|
scheduler?.dispose();
|
|
11105
11119
|
consolePatcher.cleanup();
|
|
11106
|
-
coreEvents.off(
|
|
11120
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11107
11121
|
}
|
|
11108
11122
|
if (errorToHandle) {
|
|
11109
11123
|
handleError(errorToHandle, config);
|
|
@@ -13534,12 +13548,12 @@ function toToolCallContent(toolResult) {
|
|
|
13534
13548
|
}
|
|
13535
13549
|
var basicPermissionOptions = [
|
|
13536
13550
|
{
|
|
13537
|
-
optionId:
|
|
13551
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
13538
13552
|
name: "Allow",
|
|
13539
13553
|
kind: "allow_once"
|
|
13540
13554
|
},
|
|
13541
13555
|
{
|
|
13542
|
-
optionId:
|
|
13556
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
13543
13557
|
name: "Reject",
|
|
13544
13558
|
kind: "reject_once"
|
|
13545
13559
|
}
|
|
@@ -13551,13 +13565,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13551
13565
|
switch (confirmation.type) {
|
|
13552
13566
|
case "edit":
|
|
13553
13567
|
options.push({
|
|
13554
|
-
optionId:
|
|
13568
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13555
13569
|
name: "Allow for this session",
|
|
13556
13570
|
kind: "allow_always"
|
|
13557
13571
|
});
|
|
13558
13572
|
if (enablePermanentToolApproval) {
|
|
13559
13573
|
options.push({
|
|
13560
|
-
optionId:
|
|
13574
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13561
13575
|
name: "Allow for this file in 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 "exec":
|
|
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 this command for all future sessions",
|
|
13576
13590
|
kind: "allow_always"
|
|
13577
13591
|
});
|
|
@@ -13580,19 +13594,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13580
13594
|
case "mcp":
|
|
13581
13595
|
options.push(
|
|
13582
13596
|
{
|
|
13583
|
-
optionId:
|
|
13597
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
13584
13598
|
name: "Allow all server tools for this session",
|
|
13585
13599
|
kind: "allow_always"
|
|
13586
13600
|
},
|
|
13587
13601
|
{
|
|
13588
|
-
optionId:
|
|
13602
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
13589
13603
|
name: "Allow tool for this session",
|
|
13590
13604
|
kind: "allow_always"
|
|
13591
13605
|
}
|
|
13592
13606
|
);
|
|
13593
13607
|
if (enablePermanentToolApproval) {
|
|
13594
13608
|
options.push({
|
|
13595
|
-
optionId:
|
|
13609
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13596
13610
|
name: "Allow tool for all future sessions",
|
|
13597
13611
|
kind: "allow_always"
|
|
13598
13612
|
});
|
|
@@ -13600,13 +13614,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13600
13614
|
break;
|
|
13601
13615
|
case "info":
|
|
13602
13616
|
options.push({
|
|
13603
|
-
optionId:
|
|
13617
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13604
13618
|
name: "Allow for this session",
|
|
13605
13619
|
kind: "allow_always"
|
|
13606
13620
|
});
|
|
13607
13621
|
if (enablePermanentToolApproval) {
|
|
13608
13622
|
options.push({
|
|
13609
|
-
optionId:
|
|
13623
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13610
13624
|
name: "Allow for all future sessions",
|
|
13611
13625
|
kind: "allow_always"
|
|
13612
13626
|
});
|
|
@@ -13638,21 +13652,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13638
13652
|
}
|
|
13639
13653
|
function toAcpToolKind(kind) {
|
|
13640
13654
|
switch (kind) {
|
|
13641
|
-
case
|
|
13642
|
-
case
|
|
13643
|
-
case
|
|
13644
|
-
case
|
|
13645
|
-
case
|
|
13646
|
-
case
|
|
13647
|
-
case
|
|
13648
|
-
case
|
|
13649
|
-
case
|
|
13650
|
-
case
|
|
13655
|
+
case Kind.Read:
|
|
13656
|
+
case Kind.Edit:
|
|
13657
|
+
case Kind.Execute:
|
|
13658
|
+
case Kind.Search:
|
|
13659
|
+
case Kind.Delete:
|
|
13660
|
+
case Kind.Move:
|
|
13661
|
+
case Kind.Think:
|
|
13662
|
+
case Kind.Fetch:
|
|
13663
|
+
case Kind.SwitchMode:
|
|
13664
|
+
case Kind.Other:
|
|
13651
13665
|
return kind;
|
|
13652
|
-
case
|
|
13666
|
+
case Kind.Agent:
|
|
13653
13667
|
return "think";
|
|
13654
|
-
case
|
|
13655
|
-
case
|
|
13668
|
+
case Kind.Plan:
|
|
13669
|
+
case Kind.Communicate:
|
|
13656
13670
|
default:
|
|
13657
13671
|
return "other";
|
|
13658
13672
|
}
|
|
@@ -13660,24 +13674,24 @@ function toAcpToolKind(kind) {
|
|
|
13660
13674
|
function buildAvailableModes(isPlanEnabled) {
|
|
13661
13675
|
const modes = [
|
|
13662
13676
|
{
|
|
13663
|
-
id:
|
|
13677
|
+
id: ApprovalMode.DEFAULT,
|
|
13664
13678
|
name: "Default",
|
|
13665
13679
|
description: "Prompts for approval"
|
|
13666
13680
|
},
|
|
13667
13681
|
{
|
|
13668
|
-
id:
|
|
13682
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
13669
13683
|
name: "Auto Edit",
|
|
13670
13684
|
description: "Auto-approves edit tools"
|
|
13671
13685
|
},
|
|
13672
13686
|
{
|
|
13673
|
-
id:
|
|
13687
|
+
id: ApprovalMode.YOLO,
|
|
13674
13688
|
name: "YOLO",
|
|
13675
13689
|
description: "Auto-approves all tools"
|
|
13676
13690
|
}
|
|
13677
13691
|
];
|
|
13678
13692
|
if (isPlanEnabled) {
|
|
13679
13693
|
modes.push({
|
|
13680
|
-
id:
|
|
13694
|
+
id: ApprovalMode.PLAN,
|
|
13681
13695
|
name: "Plan",
|
|
13682
13696
|
description: "Read-only mode"
|
|
13683
13697
|
});
|
|
@@ -13690,7 +13704,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13690
13704
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13691
13705
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
13692
13706
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13693
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13707
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
13694
13708
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13695
13709
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13696
13710
|
useGemini3_1: useGemini31,
|
|
@@ -13779,7 +13793,7 @@ var Session = class {
|
|
|
13779
13793
|
this.connection = connection;
|
|
13780
13794
|
this.settings = settings;
|
|
13781
13795
|
coreEvents.on(
|
|
13782
|
-
|
|
13796
|
+
CoreEvent.ApprovalModeChanged,
|
|
13783
13797
|
this.handleApprovalModeChanged
|
|
13784
13798
|
);
|
|
13785
13799
|
}
|
|
@@ -13802,7 +13816,7 @@ var Session = class {
|
|
|
13802
13816
|
};
|
|
13803
13817
|
dispose() {
|
|
13804
13818
|
coreEvents.off(
|
|
13805
|
-
|
|
13819
|
+
CoreEvent.ApprovalModeChanged,
|
|
13806
13820
|
this.handleApprovalModeChanged
|
|
13807
13821
|
);
|
|
13808
13822
|
}
|
|
@@ -13890,7 +13904,7 @@ ${thought.description}`;
|
|
|
13890
13904
|
await this.sendUpdate({
|
|
13891
13905
|
sessionUpdate: "tool_call",
|
|
13892
13906
|
toolCallId: toolCall.id,
|
|
13893
|
-
status: toolCall.status ===
|
|
13907
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
13894
13908
|
title: toolCall.displayName || toolCall.name,
|
|
13895
13909
|
content: toolCallContent,
|
|
13896
13910
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -13982,7 +13996,7 @@ ${thought.description}`;
|
|
|
13982
13996
|
return { stopReason: "cancelled" };
|
|
13983
13997
|
}
|
|
13984
13998
|
switch (event.type) {
|
|
13985
|
-
case
|
|
13999
|
+
case GeminiEventType.Content: {
|
|
13986
14000
|
const content = {
|
|
13987
14001
|
type: "text",
|
|
13988
14002
|
text: event.value
|
|
@@ -13993,7 +14007,7 @@ ${thought.description}`;
|
|
|
13993
14007
|
});
|
|
13994
14008
|
break;
|
|
13995
14009
|
}
|
|
13996
|
-
case
|
|
14010
|
+
case GeminiEventType.Thought: {
|
|
13997
14011
|
const thoughtText = `**${event.value.subject}**
|
|
13998
14012
|
${event.value.description}`;
|
|
13999
14013
|
await this.sendUpdate({
|
|
@@ -14002,10 +14016,10 @@ ${event.value.description}`;
|
|
|
14002
14016
|
});
|
|
14003
14017
|
break;
|
|
14004
14018
|
}
|
|
14005
|
-
case
|
|
14019
|
+
case GeminiEventType.ToolCallRequest:
|
|
14006
14020
|
toolCallRequests.push(event.value);
|
|
14007
14021
|
break;
|
|
14008
|
-
case
|
|
14022
|
+
case GeminiEventType.Finished: {
|
|
14009
14023
|
const usage2 = event.value.usageMetadata;
|
|
14010
14024
|
if (usage2) {
|
|
14011
14025
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14013,19 +14027,19 @@ ${event.value.description}`;
|
|
|
14013
14027
|
}
|
|
14014
14028
|
break;
|
|
14015
14029
|
}
|
|
14016
|
-
case
|
|
14030
|
+
case GeminiEventType.ModelInfo:
|
|
14017
14031
|
turnModelId = event.value;
|
|
14018
14032
|
break;
|
|
14019
|
-
case
|
|
14033
|
+
case GeminiEventType.MaxSessionTurns:
|
|
14020
14034
|
stopReason = "max_turn_requests";
|
|
14021
14035
|
break;
|
|
14022
|
-
case
|
|
14036
|
+
case GeminiEventType.LoopDetected:
|
|
14023
14037
|
stopReason = "max_turn_requests";
|
|
14024
14038
|
break;
|
|
14025
|
-
case
|
|
14039
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
14026
14040
|
stopReason = "max_tokens";
|
|
14027
14041
|
break;
|
|
14028
|
-
case
|
|
14042
|
+
case GeminiEventType.Error: {
|
|
14029
14043
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14030
14044
|
event.value.error
|
|
14031
14045
|
);
|
|
@@ -14253,7 +14267,7 @@ ${event.value.description}`;
|
|
|
14253
14267
|
const output = RequestPermissionResponseSchema.parse(
|
|
14254
14268
|
await this.connection.requestPermission(params)
|
|
14255
14269
|
);
|
|
14256
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14270
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14257
14271
|
await confirmationDetails.onConfirm(outcome);
|
|
14258
14272
|
await updatePolicy(
|
|
14259
14273
|
tool,
|
|
@@ -14264,16 +14278,16 @@ ${event.value.description}`;
|
|
|
14264
14278
|
invocation
|
|
14265
14279
|
);
|
|
14266
14280
|
switch (outcome) {
|
|
14267
|
-
case
|
|
14281
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14268
14282
|
return errorResponse(
|
|
14269
14283
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14270
14284
|
);
|
|
14271
|
-
case
|
|
14272
|
-
case
|
|
14273
|
-
case
|
|
14274
|
-
case
|
|
14275
|
-
case
|
|
14276
|
-
case
|
|
14285
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
14286
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
14287
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
14288
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
14289
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
14290
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14277
14291
|
break;
|
|
14278
14292
|
default: {
|
|
14279
14293
|
const resultOutcome = outcome;
|
|
@@ -14327,7 +14341,7 @@ ${event.value.description}`;
|
|
|
14327
14341
|
);
|
|
14328
14342
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14329
14343
|
{
|
|
14330
|
-
status:
|
|
14344
|
+
status: CoreToolCallStatus.Success,
|
|
14331
14345
|
request: {
|
|
14332
14346
|
callId,
|
|
14333
14347
|
name: fc.name,
|
|
@@ -14372,7 +14386,7 @@ ${event.value.description}`;
|
|
|
14372
14386
|
});
|
|
14373
14387
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14374
14388
|
{
|
|
14375
|
-
status:
|
|
14389
|
+
status: CoreToolCallStatus.Error,
|
|
14376
14390
|
request: {
|
|
14377
14391
|
callId,
|
|
14378
14392
|
name: fc.name,
|
|
@@ -14487,12 +14501,12 @@ ${event.value.description}`;
|
|
|
14487
14501
|
sessionId: this.id,
|
|
14488
14502
|
options: [
|
|
14489
14503
|
{
|
|
14490
|
-
optionId:
|
|
14504
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14491
14505
|
name: "Allow once",
|
|
14492
14506
|
kind: "allow_once"
|
|
14493
14507
|
},
|
|
14494
14508
|
{
|
|
14495
|
-
optionId:
|
|
14509
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14496
14510
|
name: "Deny",
|
|
14497
14511
|
kind: "reject_once"
|
|
14498
14512
|
}
|
|
@@ -14517,8 +14531,8 @@ ${event.value.description}`;
|
|
|
14517
14531
|
const output = RequestPermissionResponseSchema.parse(
|
|
14518
14532
|
await this.connection.requestPermission(params)
|
|
14519
14533
|
);
|
|
14520
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14521
|
-
if (outcome ===
|
|
14534
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14535
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14522
14536
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14523
14537
|
validationError = null;
|
|
14524
14538
|
} else {
|
|
@@ -14950,7 +14964,7 @@ var AcpSessionManager = class {
|
|
|
14950
14964
|
mcpServers,
|
|
14951
14965
|
loadedSettings
|
|
14952
14966
|
);
|
|
14953
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
14967
|
+
const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
|
|
14954
14968
|
let isAuthenticated = false;
|
|
14955
14969
|
let authErrorMessage = "";
|
|
14956
14970
|
try {
|
|
@@ -14962,7 +14976,7 @@ var AcpSessionManager = class {
|
|
|
14962
14976
|
);
|
|
14963
14977
|
isAuthenticated = true;
|
|
14964
14978
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
14965
|
-
if (authType ===
|
|
14979
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
14966
14980
|
isAuthenticated = false;
|
|
14967
14981
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
14968
14982
|
}
|
|
@@ -15172,12 +15186,12 @@ var GeminiAgent = class {
|
|
|
15172
15186
|
}
|
|
15173
15187
|
const authMethods = [
|
|
15174
15188
|
{
|
|
15175
|
-
id:
|
|
15189
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
15176
15190
|
name: "Log in with Google",
|
|
15177
15191
|
description: "Log in with your Google account"
|
|
15178
15192
|
},
|
|
15179
15193
|
{
|
|
15180
|
-
id:
|
|
15194
|
+
id: AuthType.USE_GEMINI,
|
|
15181
15195
|
name: "Gemini API key",
|
|
15182
15196
|
description: "Use an API key with Gemini Developer API",
|
|
15183
15197
|
_meta: {
|
|
@@ -15187,12 +15201,12 @@ var GeminiAgent = class {
|
|
|
15187
15201
|
}
|
|
15188
15202
|
},
|
|
15189
15203
|
{
|
|
15190
|
-
id:
|
|
15204
|
+
id: AuthType.USE_VERTEX_AI,
|
|
15191
15205
|
name: "Vertex AI",
|
|
15192
15206
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15193
15207
|
},
|
|
15194
15208
|
{
|
|
15195
|
-
id:
|
|
15209
|
+
id: AuthType.GATEWAY,
|
|
15196
15210
|
name: "AI API Gateway",
|
|
15197
15211
|
description: "Use a custom AI API Gateway",
|
|
15198
15212
|
_meta: {
|
|
@@ -15365,7 +15379,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15365
15379
|
}
|
|
15366
15380
|
return authType;
|
|
15367
15381
|
} catch (error) {
|
|
15368
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15382
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
15369
15383
|
handleError(
|
|
15370
15384
|
error instanceof Error ? error : new Error(String(error)),
|
|
15371
15385
|
nonInteractiveConfig,
|
|
@@ -15561,10 +15575,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15561
15575
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15562
15576
|
}
|
|
15563
15577
|
start() {
|
|
15564
|
-
coreEvents.on(
|
|
15578
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15565
15579
|
}
|
|
15566
15580
|
stop() {
|
|
15567
|
-
coreEvents.off(
|
|
15581
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15568
15582
|
if (this.flushTimeout) {
|
|
15569
15583
|
clearTimeout(this.flushTimeout);
|
|
15570
15584
|
this.flushTimeout = null;
|
|
@@ -15845,7 +15859,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15845
15859
|
}
|
|
15846
15860
|
}
|
|
15847
15861
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15848
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15862
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-DHMPW4RS.js");
|
|
15849
15863
|
await doStartUI(
|
|
15850
15864
|
config,
|
|
15851
15865
|
settings,
|
|
@@ -15948,12 +15962,12 @@ async function main() {
|
|
|
15948
15962
|
dns.setDefaultResultOrder(
|
|
15949
15963
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15950
15964
|
);
|
|
15951
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15965
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
15952
15966
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15953
15967
|
settings.setValue(
|
|
15954
15968
|
"User" /* User */,
|
|
15955
15969
|
"security.auth.selectedType",
|
|
15956
|
-
|
|
15970
|
+
AuthType.COMPUTE_ADC
|
|
15957
15971
|
);
|
|
15958
15972
|
}
|
|
15959
15973
|
}
|
|
@@ -16053,7 +16067,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16053
16067
|
await config.storage.initialize();
|
|
16054
16068
|
adminControlsListner.setConfig(config);
|
|
16055
16069
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16056
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16070
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-6THA6GNX.js");
|
|
16057
16071
|
setupInitialActivityLogger(config);
|
|
16058
16072
|
}
|
|
16059
16073
|
registerTelemetryConfig(config);
|
|
@@ -16061,7 +16075,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16061
16075
|
const messageBus = config.getMessageBus();
|
|
16062
16076
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16063
16077
|
registerCleanup(async () => {
|
|
16064
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
16078
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
16065
16079
|
});
|
|
16066
16080
|
if (!config.getAcpMode()) {
|
|
16067
16081
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16112,7 +16126,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16112
16126
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16113
16127
|
const initializationResult = await initializeApp(config, settings);
|
|
16114
16128
|
initAppHandle?.end();
|
|
16115
|
-
import("./liteRtServerManager-
|
|
16129
|
+
import("./liteRtServerManager-TEBDIGEN.js").then(({ LiteRtServerManager }) => {
|
|
16116
16130
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16117
16131
|
if (!mergedGemma) return;
|
|
16118
16132
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16122,7 +16136,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16122
16136
|
autoStartServer: userGemma?.autoStartServer
|
|
16123
16137
|
});
|
|
16124
16138
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16125
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16139
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
16126
16140
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16127
16141
|
}
|
|
16128
16142
|
if (config.getAcpMode()) {
|
|
@@ -16138,7 +16152,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16138
16152
|
...rawStartupWarnings.map((message) => ({
|
|
16139
16153
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16140
16154
|
message,
|
|
16141
|
-
priority:
|
|
16155
|
+
priority: WarningPriority.High
|
|
16142
16156
|
})),
|
|
16143
16157
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16144
16158
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16175,7 +16189,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16175
16189
|
${input}` : stdinData;
|
|
16176
16190
|
}
|
|
16177
16191
|
}
|
|
16178
|
-
const sessionStartSource = resumedSessionData ?
|
|
16192
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
16179
16193
|
const hookSystem = config?.getHookSystem();
|
|
16180
16194
|
if (hookSystem) {
|
|
16181
16195
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16232,8 +16246,8 @@ ${input}` : wrappedContext;
|
|
|
16232
16246
|
}
|
|
16233
16247
|
}
|
|
16234
16248
|
function initializeOutputListenersAndFlush(config) {
|
|
16235
|
-
if (coreEvents.listenerCount(
|
|
16236
|
-
coreEvents.on(
|
|
16249
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
16250
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
16237
16251
|
if (payload.isStderr) {
|
|
16238
16252
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16239
16253
|
} else {
|
|
@@ -16241,8 +16255,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16241
16255
|
}
|
|
16242
16256
|
});
|
|
16243
16257
|
}
|
|
16244
|
-
if (coreEvents.listenerCount(
|
|
16245
|
-
coreEvents.on(
|
|
16258
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
16259
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
16246
16260
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16247
16261
|
writeToStderr(payload.content + "\n");
|
|
16248
16262
|
} else {
|
|
@@ -16250,8 +16264,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16250
16264
|
}
|
|
16251
16265
|
});
|
|
16252
16266
|
}
|
|
16253
|
-
if (coreEvents.listenerCount(
|
|
16254
|
-
coreEvents.on(
|
|
16267
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
16268
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
16255
16269
|
writeToStderr(payload.message + "\n");
|
|
16256
16270
|
});
|
|
16257
16271
|
}
|
|
@@ -16259,7 +16273,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16259
16273
|
const forceToStderr = outputFormat === "json";
|
|
16260
16274
|
coreEvents.drainBacklogs(
|
|
16261
16275
|
(event, args) => {
|
|
16262
|
-
if (forceToStderr && event ===
|
|
16276
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
16263
16277
|
const payload = args[0];
|
|
16264
16278
|
if (!payload.isStderr) {
|
|
16265
16279
|
return {
|