@google/gemini-cli 0.40.0 → 0.40.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-ML7VG4QG.js → chunk-2ABM66ZR.js} +1 -1
- package/bundle/{chunk-URTDU3HF.js → chunk-3XIE7V2G.js} +1 -1
- package/bundle/{chunk-O7SPQTAS.js → chunk-4NKEZSZL.js} +2 -2
- package/bundle/{chunk-MBLCGSJW.js → chunk-A3XZVE6S.js} +1 -1
- package/bundle/{chunk-SZYCJREE.js → chunk-B2OARGJJ.js} +72 -37
- package/bundle/{chunk-FRSESBS3.js → chunk-B6PIKVSF.js} +95 -47
- package/bundle/{chunk-EITHKKXC.js → chunk-BJ6YFFH2.js} +2 -2
- package/bundle/{chunk-BSQN7W2F.js → chunk-C45QOW2J.js} +2 -2
- package/bundle/{chunk-DYY5TRG5.js → chunk-DMTQDMOD.js} +14 -12
- package/bundle/{chunk-J76QO4KN.js → chunk-DQXPDCC3.js} +6 -6
- package/bundle/chunk-F5YK2O2Q.js +156 -0
- package/bundle/{chunk-3OSQ5US4.js → chunk-GT76ECCD.js} +6451 -11938
- package/bundle/{chunk-RUHTTGS7.js → chunk-H4FKMO4N.js} +3 -3
- package/bundle/{chunk-G6ODSHKI.js → chunk-HKIALAT6.js} +1 -1
- package/bundle/chunk-MKP6YHAI.js +118 -0
- package/bundle/{chunk-3F3SMPJP.js → chunk-RDM3AHIW.js} +6 -6
- package/bundle/{chunk-HMR2JSPA.js → chunk-RP4KDMW3.js} +1 -1
- package/bundle/{chunk-OE2ZUR66.js → chunk-SDLMN2WK.js} +1 -1
- package/bundle/{chunk-P7LA6IIC.js → chunk-SVRZDVKN.js} +1 -1
- package/bundle/{chunk-OEIRJHU4.js → chunk-TV3H5VBI.js} +67 -54
- package/bundle/chunk-UN6XCVMJ.js +351184 -0
- package/bundle/chunk-VKQT3B2X.js +17505 -0
- package/bundle/chunk-VWLKCG5Q.js +80012 -0
- package/bundle/chunk-WCG76BEG.js +1571 -0
- package/bundle/{cleanup-AJ7G3WEE.js → cleanup-7VP4F7GR.js} +2 -2
- package/bundle/{cleanup-6MKBWA6V.js → cleanup-MNQ2UZZG.js} +2 -2
- package/bundle/{cleanup-SOJQVOTG.js → cleanup-P53J5X4G.js} +3 -3
- package/bundle/cleanup-PLWTY4UK.js +33 -0
- package/bundle/{core-O5TD6NYP.js → core-UFCQUVAZ.js} +1 -1
- package/bundle/{devtoolsService-CCXHJEUM.js → devtoolsService-F4BITN2L.js} +2 -2
- package/bundle/{devtoolsService-AR5HWQA7.js → devtoolsService-K4I6YCD4.js} +5 -4
- package/bundle/devtoolsService-TPQOS3XD.js +852 -0
- package/bundle/{devtoolsService-GQF7V6FB.js → devtoolsService-UBZYOZNR.js} +2 -2
- package/bundle/{dist-LZ5ASNAL.js → dist-CRAFZ4EV.js} +1 -1
- package/bundle/{core-KELRGMHQ.js → dist-KBXYTOD4.js} +2 -2
- package/bundle/dist-RP6V5FR5.js +2046 -0
- package/bundle/{gemini-YJTI2WQP.js → gemini-3OZCG3O2.js} +191 -175
- package/bundle/{gemini-TKPXJBGX.js → gemini-OEXUXD4F.js} +11 -11
- package/bundle/gemini-RYFDQAFM.js +16087 -0
- package/bundle/{gemini-LSLMD4HG.js → gemini-ZYQZGZWC.js} +11 -11
- package/bundle/gemini.js +3 -3
- package/bundle/{interactiveCli-O3UYJUNT.js → interactiveCli-M2JHWWJW.js} +6 -6
- package/bundle/{interactiveCli-I56L63GE.js → interactiveCli-ND2AVROW.js} +6 -6
- package/bundle/{interactiveCli-5YSP2IQI.js → interactiveCli-VO2T47FA.js} +290 -272
- package/bundle/interactiveCli-ZSLDJYKZ.js +34448 -0
- package/bundle/{liteRtServerManager-XI56E5P3.js → liteRtServerManager-ESWH5RRJ.js} +3 -3
- package/bundle/{liteRtServerManager-6INPACOA.js → liteRtServerManager-HMMIC3TU.js} +3 -3
- package/bundle/{liteRtServerManager-CIC7DD4U.js → liteRtServerManager-JHBFWDI6.js} +4 -4
- package/bundle/liteRtServerManager-KR4G6HVQ.js +65 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-HUMYTY6K.js → oauth2-provider-25JJN4A4.js} +1 -1
- package/bundle/{oauth2-provider-VGGNG5XI.js → oauth2-provider-HPAQM7LS.js} +39 -73
- package/bundle/oauth2-provider-IJ4VRZ7W.js +237 -0
- package/bundle/{oauth2-provider-HDKVDC2Q.js → oauth2-provider-RQPXCAE5.js} +1 -1
- package/bundle/{start-VHURPYN7.js → start-2XU4BDSD.js} +5 -5
- package/bundle/{start-25VD33TV.js → start-H6E5SBV7.js} +6 -6
- package/bundle/{start-U4YQCY2A.js → start-KGL2CIOG.js} +5 -5
- package/bundle/start-PATVFSB6.js +18 -0
- package/package.json +1 -1
|
@@ -43,18 +43,18 @@ import {
|
|
|
43
43
|
updateAllUpdatableExtensions,
|
|
44
44
|
updateExtension,
|
|
45
45
|
validateAuthMethod
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-VWLKCG5Q.js";
|
|
47
47
|
import {
|
|
48
48
|
appEvents
|
|
49
49
|
} from "./chunk-5PS3AYFU.js";
|
|
50
50
|
import {
|
|
51
51
|
startCommand,
|
|
52
52
|
startServer
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-MKP6YHAI.js";
|
|
54
54
|
import {
|
|
55
55
|
exitCli,
|
|
56
56
|
require_source
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-HKIALAT6.js";
|
|
58
58
|
import {
|
|
59
59
|
DEFAULT_PORT,
|
|
60
60
|
GEMMA_MODEL_NAME,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
readServerProcessInfo,
|
|
89
89
|
resolveGemmaConfig,
|
|
90
90
|
saveModelChange
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-VKQT3B2X.js";
|
|
92
92
|
import {
|
|
93
93
|
cleanupCheckpoints,
|
|
94
94
|
registerCleanup,
|
|
@@ -97,32 +97,44 @@ import {
|
|
|
97
97
|
runExitCleanup,
|
|
98
98
|
runSyncCleanup,
|
|
99
99
|
setupSignalHandlers
|
|
100
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-3XIE7V2G.js";
|
|
101
101
|
import {
|
|
102
102
|
AuthType,
|
|
103
103
|
ChatRecordingService,
|
|
104
104
|
Client,
|
|
105
105
|
Config,
|
|
106
|
+
CoreToolCallStatus,
|
|
106
107
|
ExitCodes,
|
|
107
108
|
FileDiscoveryService,
|
|
108
109
|
FolderTrustDiscoveryService,
|
|
110
|
+
GeminiEventType,
|
|
109
111
|
IdeClient,
|
|
112
|
+
IntegrityStatus,
|
|
110
113
|
InvalidStreamError,
|
|
111
114
|
JsonFormatter,
|
|
115
|
+
JsonStreamEventType,
|
|
112
116
|
LegacyAgentSession,
|
|
117
|
+
LlmRole,
|
|
113
118
|
Logger,
|
|
114
119
|
MCPServerConfig,
|
|
120
|
+
MCPServerStatus,
|
|
121
|
+
OutputFormat,
|
|
115
122
|
PolicyIntegrityManager,
|
|
116
123
|
ROOT_SCHEDULER_ID,
|
|
117
124
|
ReadManyFilesTool,
|
|
118
125
|
Scheduler,
|
|
126
|
+
SessionEndReason,
|
|
127
|
+
SessionStartSource,
|
|
119
128
|
ShellExecutionService,
|
|
129
|
+
StreamEventType,
|
|
120
130
|
StreamJsonFormatter,
|
|
121
131
|
ToolCallEvent,
|
|
132
|
+
TrustLevel,
|
|
122
133
|
UserAccountManager,
|
|
123
134
|
UserPromptEvent,
|
|
124
135
|
ValidationCancelledError,
|
|
125
136
|
ValidationRequiredError,
|
|
137
|
+
WarningPriority,
|
|
126
138
|
addMemory,
|
|
127
139
|
applyAdminAllowlist,
|
|
128
140
|
applyRequiredServers,
|
|
@@ -184,9 +196,11 @@ import {
|
|
|
184
196
|
updatePolicy,
|
|
185
197
|
writeToStderr,
|
|
186
198
|
writeToStdout
|
|
187
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-UN6XCVMJ.js";
|
|
188
200
|
import {
|
|
189
201
|
ASK_USER_TOOL_NAME,
|
|
202
|
+
ApprovalMode,
|
|
203
|
+
CoreEvent,
|
|
190
204
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
191
205
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
192
206
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -206,6 +220,7 @@ import {
|
|
|
206
220
|
FatalUntrustedWorkspaceError,
|
|
207
221
|
GEMINI_DIR,
|
|
208
222
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
223
|
+
Kind,
|
|
209
224
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
210
225
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
211
226
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -215,6 +230,7 @@ import {
|
|
|
215
230
|
REFERENCE_CONTENT_START,
|
|
216
231
|
Storage,
|
|
217
232
|
ToolConfirmationOutcome,
|
|
233
|
+
ToolErrorType,
|
|
218
234
|
coreEvents,
|
|
219
235
|
debugLogger,
|
|
220
236
|
external_exports,
|
|
@@ -228,7 +244,7 @@ import {
|
|
|
228
244
|
loadServerHierarchicalMemory,
|
|
229
245
|
resolveToRealPath,
|
|
230
246
|
setGeminiMdFilename
|
|
231
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-F73F75XM.js";
|
|
232
248
|
import "./chunk-664ZODQF.js";
|
|
233
249
|
import "./chunk-RJTRUG2J.js";
|
|
234
250
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5513,7 +5529,7 @@ async function getMcpServersFromConfig(settings) {
|
|
|
5513
5529
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5514
5530
|
const isStdio = !!config.command;
|
|
5515
5531
|
if (isStdio && !isTrusted) {
|
|
5516
|
-
return
|
|
5532
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5517
5533
|
}
|
|
5518
5534
|
const client = new Client({
|
|
5519
5535
|
name: "mcp-test-client",
|
|
@@ -5549,16 +5565,16 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5549
5565
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5550
5566
|
} catch {
|
|
5551
5567
|
await client.close();
|
|
5552
|
-
return
|
|
5568
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5553
5569
|
}
|
|
5554
5570
|
try {
|
|
5555
5571
|
await client.connect(transport, { timeout: 5e3 });
|
|
5556
5572
|
await client.ping();
|
|
5557
5573
|
await client.close();
|
|
5558
|
-
return
|
|
5574
|
+
return MCPServerStatus.CONNECTED;
|
|
5559
5575
|
} catch {
|
|
5560
5576
|
await transport.close();
|
|
5561
|
-
return
|
|
5577
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5562
5578
|
}
|
|
5563
5579
|
}
|
|
5564
5580
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5571,9 +5587,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5571
5587
|
});
|
|
5572
5588
|
if (!loadResult.allowed) {
|
|
5573
5589
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5574
|
-
return
|
|
5590
|
+
return MCPServerStatus.BLOCKED;
|
|
5575
5591
|
}
|
|
5576
|
-
return
|
|
5592
|
+
return MCPServerStatus.DISABLED;
|
|
5577
5593
|
}
|
|
5578
5594
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5579
5595
|
}
|
|
@@ -5607,23 +5623,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5607
5623
|
let statusIndicator = "";
|
|
5608
5624
|
let statusText = "";
|
|
5609
5625
|
switch (status) {
|
|
5610
|
-
case
|
|
5626
|
+
case MCPServerStatus.CONNECTED:
|
|
5611
5627
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5612
5628
|
statusText = "Connected";
|
|
5613
5629
|
break;
|
|
5614
|
-
case
|
|
5630
|
+
case MCPServerStatus.CONNECTING:
|
|
5615
5631
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5616
5632
|
statusText = "Connecting";
|
|
5617
5633
|
break;
|
|
5618
|
-
case
|
|
5634
|
+
case MCPServerStatus.BLOCKED:
|
|
5619
5635
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5620
5636
|
statusText = "Blocked";
|
|
5621
5637
|
break;
|
|
5622
|
-
case
|
|
5638
|
+
case MCPServerStatus.DISABLED:
|
|
5623
5639
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5624
5640
|
statusText = "Disabled";
|
|
5625
5641
|
break;
|
|
5626
|
-
case
|
|
5642
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5627
5643
|
default:
|
|
5628
5644
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5629
5645
|
statusText = "Disconnected";
|
|
@@ -5909,7 +5925,7 @@ async function handleInstall(args) {
|
|
|
5909
5925
|
);
|
|
5910
5926
|
if (confirmed) {
|
|
5911
5927
|
const trustedFolders = loadTrustedFolders();
|
|
5912
|
-
await trustedFolders.setValue(realPath,
|
|
5928
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5913
5929
|
} else {
|
|
5914
5930
|
throw new Error(
|
|
5915
5931
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7954,7 +7970,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7954
7970
|
}
|
|
7955
7971
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7956
7972
|
const packageJson = await getPackageJson(__dirname3);
|
|
7957
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.40.
|
|
7973
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.40.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7958
7974
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7959
7975
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7960
7976
|
}
|
|
@@ -8013,9 +8029,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
8013
8029
|
cwd,
|
|
8014
8030
|
potentialWorkspacePoliciesDir
|
|
8015
8031
|
);
|
|
8016
|
-
if (integrityResult.status ===
|
|
8032
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
8017
8033
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
8018
|
-
} else if (integrityResult.status ===
|
|
8034
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
8019
8035
|
workspacePoliciesDir = void 0;
|
|
8020
8036
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
8021
8037
|
policyUpdateConfirmationRequest = {
|
|
@@ -8427,23 +8443,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8427
8443
|
if (rawApprovalMode) {
|
|
8428
8444
|
switch (rawApprovalMode) {
|
|
8429
8445
|
case "yolo":
|
|
8430
|
-
approvalMode =
|
|
8446
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8431
8447
|
break;
|
|
8432
8448
|
case "auto_edit":
|
|
8433
|
-
approvalMode =
|
|
8449
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8434
8450
|
break;
|
|
8435
8451
|
case "plan":
|
|
8436
8452
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8437
8453
|
debugLogger.warn(
|
|
8438
8454
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8439
8455
|
);
|
|
8440
|
-
approvalMode =
|
|
8456
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8441
8457
|
} else {
|
|
8442
|
-
approvalMode =
|
|
8458
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8443
8459
|
}
|
|
8444
8460
|
break;
|
|
8445
8461
|
case "default":
|
|
8446
|
-
approvalMode =
|
|
8462
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8447
8463
|
break;
|
|
8448
8464
|
default:
|
|
8449
8465
|
throw new Error(
|
|
@@ -8451,10 +8467,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8451
8467
|
);
|
|
8452
8468
|
}
|
|
8453
8469
|
} else {
|
|
8454
|
-
approvalMode =
|
|
8470
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8455
8471
|
}
|
|
8456
8472
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8457
|
-
if (approvalMode ===
|
|
8473
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8458
8474
|
if (settings.admin?.secureModeEnabled) {
|
|
8459
8475
|
debugLogger.error(
|
|
8460
8476
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8472,16 +8488,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8472
8488
|
)
|
|
8473
8489
|
);
|
|
8474
8490
|
}
|
|
8475
|
-
} else if (approvalMode ===
|
|
8491
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8476
8492
|
debugLogger.warn(
|
|
8477
8493
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8478
8494
|
);
|
|
8479
8495
|
}
|
|
8480
|
-
if (!trustedFolder && approvalMode !==
|
|
8496
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8481
8497
|
debugLogger.warn(
|
|
8482
8498
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8483
8499
|
);
|
|
8484
|
-
approvalMode =
|
|
8500
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8485
8501
|
}
|
|
8486
8502
|
let telemetrySettings;
|
|
8487
8503
|
try {
|
|
@@ -9870,7 +9886,7 @@ import path9 from "node:path";
|
|
|
9870
9886
|
import process4 from "node:process";
|
|
9871
9887
|
var homeDirectoryCheck = {
|
|
9872
9888
|
id: "home-directory",
|
|
9873
|
-
priority:
|
|
9889
|
+
priority: WarningPriority.Low,
|
|
9874
9890
|
check: async (workspaceRoot, settings) => {
|
|
9875
9891
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9876
9892
|
return null;
|
|
@@ -9894,7 +9910,7 @@ var homeDirectoryCheck = {
|
|
|
9894
9910
|
};
|
|
9895
9911
|
var rootDirectoryCheck = {
|
|
9896
9912
|
id: "root-directory",
|
|
9897
|
-
priority:
|
|
9913
|
+
priority: WarningPriority.High,
|
|
9898
9914
|
check: async (workspaceRoot, _settings) => {
|
|
9899
9915
|
try {
|
|
9900
9916
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9910,7 +9926,7 @@ var rootDirectoryCheck = {
|
|
|
9910
9926
|
};
|
|
9911
9927
|
var folderTrustCheck = {
|
|
9912
9928
|
id: "folder-trust",
|
|
9913
|
-
priority:
|
|
9929
|
+
priority: WarningPriority.High,
|
|
9914
9930
|
check: async (workspaceRoot, settings) => {
|
|
9915
9931
|
if (!isFolderTrustEnabled(settings)) {
|
|
9916
9932
|
return null;
|
|
@@ -10098,12 +10114,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10098
10114
|
error,
|
|
10099
10115
|
config.getContentGeneratorConfig()?.authType
|
|
10100
10116
|
);
|
|
10101
|
-
if (config.getOutputFormat() ===
|
|
10117
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10102
10118
|
const streamFormatter = new StreamJsonFormatter();
|
|
10103
10119
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10104
10120
|
const metrics = uiTelemetryService.getMetrics();
|
|
10105
10121
|
streamFormatter.emitEvent({
|
|
10106
|
-
type:
|
|
10122
|
+
type: JsonStreamEventType.RESULT,
|
|
10107
10123
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10108
10124
|
status: "error",
|
|
10109
10125
|
error: {
|
|
@@ -10114,7 +10130,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10114
10130
|
});
|
|
10115
10131
|
runSyncCleanup();
|
|
10116
10132
|
process.exit(getNumericExitCode(errorCode));
|
|
10117
|
-
} else if (config.getOutputFormat() ===
|
|
10133
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10118
10134
|
const formatter = new JsonFormatter();
|
|
10119
10135
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10120
10136
|
const formattedError = formatter.formatError(
|
|
@@ -10134,11 +10150,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10134
10150
|
const isFatal = isFatalToolError(errorType);
|
|
10135
10151
|
if (isFatal) {
|
|
10136
10152
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10137
|
-
if (config.getOutputFormat() ===
|
|
10153
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10138
10154
|
const streamFormatter = new StreamJsonFormatter();
|
|
10139
10155
|
const metrics = uiTelemetryService.getMetrics();
|
|
10140
10156
|
streamFormatter.emitEvent({
|
|
10141
|
-
type:
|
|
10157
|
+
type: JsonStreamEventType.RESULT,
|
|
10142
10158
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10143
10159
|
status: "error",
|
|
10144
10160
|
error: {
|
|
@@ -10147,7 +10163,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10147
10163
|
},
|
|
10148
10164
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10149
10165
|
});
|
|
10150
|
-
} else if (config.getOutputFormat() ===
|
|
10166
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10151
10167
|
const formatter = new JsonFormatter();
|
|
10152
10168
|
const formattedError = formatter.formatError(
|
|
10153
10169
|
toolExecutionError,
|
|
@@ -10165,11 +10181,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10165
10181
|
}
|
|
10166
10182
|
function handleCancellationError(config) {
|
|
10167
10183
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10168
|
-
if (config.getOutputFormat() ===
|
|
10184
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10169
10185
|
const streamFormatter = new StreamJsonFormatter();
|
|
10170
10186
|
const metrics = uiTelemetryService.getMetrics();
|
|
10171
10187
|
streamFormatter.emitEvent({
|
|
10172
|
-
type:
|
|
10188
|
+
type: JsonStreamEventType.RESULT,
|
|
10173
10189
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10174
10190
|
status: "error",
|
|
10175
10191
|
error: {
|
|
@@ -10180,7 +10196,7 @@ function handleCancellationError(config) {
|
|
|
10180
10196
|
});
|
|
10181
10197
|
runSyncCleanup();
|
|
10182
10198
|
process.exit(cancellationError.exitCode);
|
|
10183
|
-
} else if (config.getOutputFormat() ===
|
|
10199
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10184
10200
|
const formatter = new JsonFormatter();
|
|
10185
10201
|
const formattedError = formatter.formatError(
|
|
10186
10202
|
cancellationError,
|
|
@@ -10200,11 +10216,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10200
10216
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10201
10217
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10202
10218
|
);
|
|
10203
|
-
if (config.getOutputFormat() ===
|
|
10219
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10204
10220
|
const streamFormatter = new StreamJsonFormatter();
|
|
10205
10221
|
const metrics = uiTelemetryService.getMetrics();
|
|
10206
10222
|
streamFormatter.emitEvent({
|
|
10207
|
-
type:
|
|
10223
|
+
type: JsonStreamEventType.RESULT,
|
|
10208
10224
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10209
10225
|
status: "error",
|
|
10210
10226
|
error: {
|
|
@@ -10215,7 +10231,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10215
10231
|
});
|
|
10216
10232
|
runSyncCleanup();
|
|
10217
10233
|
process.exit(maxTurnsError.exitCode);
|
|
10218
|
-
} else if (config.getOutputFormat() ===
|
|
10234
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10219
10235
|
const formatter = new JsonFormatter();
|
|
10220
10236
|
const formattedError = formatter.formatError(
|
|
10221
10237
|
maxTurnsError,
|
|
@@ -10295,7 +10311,7 @@ async function runNonInteractive({
|
|
|
10295
10311
|
}
|
|
10296
10312
|
});
|
|
10297
10313
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10298
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10314
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-K4I6YCD4.js");
|
|
10299
10315
|
setupInitialActivityLogger(config);
|
|
10300
10316
|
}
|
|
10301
10317
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10311,7 +10327,7 @@ async function runNonInteractive({
|
|
|
10311
10327
|
}
|
|
10312
10328
|
};
|
|
10313
10329
|
const startTime = Date.now();
|
|
10314
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10330
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10315
10331
|
const abortController = new AbortController();
|
|
10316
10332
|
let isAborting = false;
|
|
10317
10333
|
let cancelMessageTimer = null;
|
|
@@ -10364,13 +10380,13 @@ async function runNonInteractive({
|
|
|
10364
10380
|
};
|
|
10365
10381
|
try {
|
|
10366
10382
|
consolePatcher.patch();
|
|
10367
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10383
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10368
10384
|
process.stderr.write(
|
|
10369
10385
|
"[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"
|
|
10370
10386
|
);
|
|
10371
10387
|
}
|
|
10372
10388
|
setupStdinCancellation();
|
|
10373
|
-
coreEvents.on(
|
|
10389
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10374
10390
|
coreEvents.drainBacklogs();
|
|
10375
10391
|
process.stdout.on("error", (err) => {
|
|
10376
10392
|
if (err.code === "EPIPE") {
|
|
@@ -10396,7 +10412,7 @@ async function runNonInteractive({
|
|
|
10396
10412
|
}
|
|
10397
10413
|
if (streamFormatter) {
|
|
10398
10414
|
streamFormatter.emitEvent({
|
|
10399
|
-
type:
|
|
10415
|
+
type: JsonStreamEventType.INIT,
|
|
10400
10416
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10401
10417
|
session_id: config.getSessionId(),
|
|
10402
10418
|
model: config.getModel()
|
|
@@ -10434,7 +10450,7 @@ async function runNonInteractive({
|
|
|
10434
10450
|
}
|
|
10435
10451
|
if (streamFormatter) {
|
|
10436
10452
|
streamFormatter.emitEvent({
|
|
10437
|
-
type:
|
|
10453
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10438
10454
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10439
10455
|
role: "user",
|
|
10440
10456
|
content: input
|
|
@@ -10473,12 +10489,12 @@ async function runNonInteractive({
|
|
|
10473
10489
|
const metrics = uiTelemetryService.getMetrics();
|
|
10474
10490
|
const durationMs = Date.now() - startTime;
|
|
10475
10491
|
streamFormatter.emitEvent({
|
|
10476
|
-
type:
|
|
10492
|
+
type: JsonStreamEventType.RESULT,
|
|
10477
10493
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10478
10494
|
status: "success",
|
|
10479
10495
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10480
10496
|
});
|
|
10481
|
-
} else if (config.getOutputFormat() ===
|
|
10497
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10482
10498
|
const formatter = new JsonFormatter();
|
|
10483
10499
|
const stats = uiTelemetryService.getMetrics();
|
|
10484
10500
|
textOutput.write(
|
|
@@ -10564,13 +10580,13 @@ async function runNonInteractive({
|
|
|
10564
10580
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10565
10581
|
if (streamFormatter) {
|
|
10566
10582
|
streamFormatter.emitEvent({
|
|
10567
|
-
type:
|
|
10583
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10568
10584
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10569
10585
|
role: "assistant",
|
|
10570
10586
|
content: output,
|
|
10571
10587
|
delta: true
|
|
10572
10588
|
});
|
|
10573
|
-
} else if (config.getOutputFormat() ===
|
|
10589
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10574
10590
|
responseText += output;
|
|
10575
10591
|
} else {
|
|
10576
10592
|
if (part.text) {
|
|
@@ -10583,13 +10599,13 @@ async function runNonInteractive({
|
|
|
10583
10599
|
break;
|
|
10584
10600
|
}
|
|
10585
10601
|
case "tool_request": {
|
|
10586
|
-
if (config.getOutputFormat() ===
|
|
10602
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10587
10603
|
preToolResponseText = responseText || preToolResponseText;
|
|
10588
10604
|
responseText = "";
|
|
10589
10605
|
}
|
|
10590
10606
|
if (streamFormatter) {
|
|
10591
10607
|
streamFormatter.emitEvent({
|
|
10592
|
-
type:
|
|
10608
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10593
10609
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10594
10610
|
tool_name: event.name,
|
|
10595
10611
|
tool_id: event.requestId,
|
|
@@ -10605,7 +10621,7 @@ async function runNonInteractive({
|
|
|
10605
10621
|
const displayText = displayContentToString(display);
|
|
10606
10622
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10607
10623
|
streamFormatter.emitEvent({
|
|
10608
|
-
type:
|
|
10624
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10609
10625
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10610
10626
|
tool_id: event.requestId,
|
|
10611
10627
|
status: event.isError ? "error" : "success",
|
|
@@ -10620,17 +10636,17 @@ async function runNonInteractive({
|
|
|
10620
10636
|
const display = event.display?.result;
|
|
10621
10637
|
const displayText = displayContentToString(display);
|
|
10622
10638
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10623
|
-
if (event.data?.["errorType"] ===
|
|
10624
|
-
if (config.getOutputFormat() ===
|
|
10639
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
10640
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
10625
10641
|
responseText = preToolResponseText;
|
|
10626
10642
|
}
|
|
10627
10643
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10628
|
-
if (config.getOutputFormat() ===
|
|
10644
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10629
10645
|
process.stderr.write(`${stopMessage}
|
|
10630
10646
|
`);
|
|
10631
10647
|
}
|
|
10632
10648
|
}
|
|
10633
|
-
if (event.data?.["errorType"] ===
|
|
10649
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
10634
10650
|
throw new FatalToolExecutionError(
|
|
10635
10651
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10636
10652
|
);
|
|
@@ -10651,20 +10667,20 @@ async function runNonInteractive({
|
|
|
10651
10667
|
}
|
|
10652
10668
|
const errorCode = event._meta?.["code"];
|
|
10653
10669
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10654
|
-
if (config.getOutputFormat() ===
|
|
10670
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10655
10671
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10656
10672
|
`);
|
|
10657
10673
|
}
|
|
10658
10674
|
break;
|
|
10659
10675
|
}
|
|
10660
10676
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10661
|
-
if (config.getOutputFormat() ===
|
|
10677
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10662
10678
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10663
10679
|
`);
|
|
10664
10680
|
}
|
|
10665
10681
|
if (streamFormatter) {
|
|
10666
10682
|
streamFormatter.emitEvent({
|
|
10667
|
-
type:
|
|
10683
|
+
type: JsonStreamEventType.ERROR,
|
|
10668
10684
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10669
10685
|
severity,
|
|
10670
10686
|
message: event.message
|
|
@@ -10683,7 +10699,7 @@ async function runNonInteractive({
|
|
|
10683
10699
|
);
|
|
10684
10700
|
} else if (streamFormatter) {
|
|
10685
10701
|
streamFormatter.emitEvent({
|
|
10686
|
-
type:
|
|
10702
|
+
type: JsonStreamEventType.ERROR,
|
|
10687
10703
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10688
10704
|
severity: "error",
|
|
10689
10705
|
message: "Maximum session turns exceeded"
|
|
@@ -10691,7 +10707,7 @@ async function runNonInteractive({
|
|
|
10691
10707
|
}
|
|
10692
10708
|
}
|
|
10693
10709
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10694
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10710
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10695
10711
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10696
10712
|
`);
|
|
10697
10713
|
}
|
|
@@ -10721,7 +10737,7 @@ async function runNonInteractive({
|
|
|
10721
10737
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10722
10738
|
scheduler?.dispose();
|
|
10723
10739
|
consolePatcher.cleanup();
|
|
10724
|
-
coreEvents.off(
|
|
10740
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10725
10741
|
}
|
|
10726
10742
|
if (errorToHandle) {
|
|
10727
10743
|
handleError(errorToHandle, config);
|
|
@@ -10746,7 +10762,7 @@ async function runNonInteractive2(params) {
|
|
|
10746
10762
|
}
|
|
10747
10763
|
});
|
|
10748
10764
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10749
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10765
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-K4I6YCD4.js");
|
|
10750
10766
|
setupInitialActivityLogger(config);
|
|
10751
10767
|
}
|
|
10752
10768
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10762,7 +10778,7 @@ async function runNonInteractive2(params) {
|
|
|
10762
10778
|
}
|
|
10763
10779
|
};
|
|
10764
10780
|
const startTime = Date.now();
|
|
10765
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10781
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10766
10782
|
const abortController = new AbortController();
|
|
10767
10783
|
let isAborting = false;
|
|
10768
10784
|
let cancelMessageTimer = null;
|
|
@@ -10813,13 +10829,13 @@ async function runNonInteractive2(params) {
|
|
|
10813
10829
|
let scheduler;
|
|
10814
10830
|
try {
|
|
10815
10831
|
consolePatcher.patch();
|
|
10816
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10832
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10817
10833
|
process.stderr.write(
|
|
10818
10834
|
"[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"
|
|
10819
10835
|
);
|
|
10820
10836
|
}
|
|
10821
10837
|
setupStdinCancellation();
|
|
10822
|
-
coreEvents.on(
|
|
10838
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10823
10839
|
coreEvents.drainBacklogs();
|
|
10824
10840
|
process.stdout.on("error", (err) => {
|
|
10825
10841
|
if (err.code === "EPIPE") {
|
|
@@ -10843,7 +10859,7 @@ async function runNonInteractive2(params) {
|
|
|
10843
10859
|
}
|
|
10844
10860
|
if (streamFormatter) {
|
|
10845
10861
|
streamFormatter.emitEvent({
|
|
10846
|
-
type:
|
|
10862
|
+
type: JsonStreamEventType.INIT,
|
|
10847
10863
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10848
10864
|
session_id: config.getSessionId(),
|
|
10849
10865
|
model: config.getModel()
|
|
@@ -10881,7 +10897,7 @@ async function runNonInteractive2(params) {
|
|
|
10881
10897
|
}
|
|
10882
10898
|
if (streamFormatter) {
|
|
10883
10899
|
streamFormatter.emitEvent({
|
|
10884
|
-
type:
|
|
10900
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10885
10901
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10886
10902
|
role: "user",
|
|
10887
10903
|
content: input
|
|
@@ -10908,28 +10924,28 @@ async function runNonInteractive2(params) {
|
|
|
10908
10924
|
if (abortController.signal.aborted) {
|
|
10909
10925
|
handleCancellationError(config);
|
|
10910
10926
|
}
|
|
10911
|
-
if (event.type ===
|
|
10927
|
+
if (event.type === GeminiEventType.Content) {
|
|
10912
10928
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10913
10929
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10914
10930
|
if (streamFormatter) {
|
|
10915
10931
|
streamFormatter.emitEvent({
|
|
10916
|
-
type:
|
|
10932
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10917
10933
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10918
10934
|
role: "assistant",
|
|
10919
10935
|
content: output,
|
|
10920
10936
|
delta: true
|
|
10921
10937
|
});
|
|
10922
|
-
} else if (config.getOutputFormat() ===
|
|
10938
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10923
10939
|
responseText += output;
|
|
10924
10940
|
} else {
|
|
10925
10941
|
if (event.value) {
|
|
10926
10942
|
textOutput.write(output);
|
|
10927
10943
|
}
|
|
10928
10944
|
}
|
|
10929
|
-
} else if (event.type ===
|
|
10945
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
10930
10946
|
if (streamFormatter) {
|
|
10931
10947
|
streamFormatter.emitEvent({
|
|
10932
|
-
type:
|
|
10948
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10933
10949
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10934
10950
|
tool_name: event.value.name,
|
|
10935
10951
|
tool_id: event.value.callId,
|
|
@@ -10937,29 +10953,29 @@ async function runNonInteractive2(params) {
|
|
|
10937
10953
|
});
|
|
10938
10954
|
}
|
|
10939
10955
|
toolCallRequests.push(event.value);
|
|
10940
|
-
} else if (event.type ===
|
|
10956
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
10941
10957
|
if (streamFormatter) {
|
|
10942
10958
|
streamFormatter.emitEvent({
|
|
10943
|
-
type:
|
|
10959
|
+
type: JsonStreamEventType.ERROR,
|
|
10944
10960
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10945
10961
|
severity: "warning",
|
|
10946
10962
|
message: "Loop detected, stopping execution"
|
|
10947
10963
|
});
|
|
10948
10964
|
}
|
|
10949
|
-
} else if (event.type ===
|
|
10965
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
10950
10966
|
if (streamFormatter) {
|
|
10951
10967
|
streamFormatter.emitEvent({
|
|
10952
|
-
type:
|
|
10968
|
+
type: JsonStreamEventType.ERROR,
|
|
10953
10969
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10954
10970
|
severity: "error",
|
|
10955
10971
|
message: "Maximum session turns exceeded"
|
|
10956
10972
|
});
|
|
10957
10973
|
}
|
|
10958
|
-
} else if (event.type ===
|
|
10974
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
10959
10975
|
throw event.value.error;
|
|
10960
|
-
} else if (event.type ===
|
|
10976
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
10961
10977
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10962
|
-
if (config.getOutputFormat() ===
|
|
10978
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10963
10979
|
process.stderr.write(`${stopMessage}
|
|
10964
10980
|
`);
|
|
10965
10981
|
}
|
|
@@ -10967,7 +10983,7 @@ async function runNonInteractive2(params) {
|
|
|
10967
10983
|
const metrics = uiTelemetryService.getMetrics();
|
|
10968
10984
|
const durationMs = Date.now() - startTime;
|
|
10969
10985
|
streamFormatter.emitEvent({
|
|
10970
|
-
type:
|
|
10986
|
+
type: JsonStreamEventType.RESULT,
|
|
10971
10987
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10972
10988
|
status: "success",
|
|
10973
10989
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10977,9 +10993,9 @@ async function runNonInteractive2(params) {
|
|
|
10977
10993
|
});
|
|
10978
10994
|
}
|
|
10979
10995
|
return;
|
|
10980
|
-
} else if (event.type ===
|
|
10996
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
10981
10997
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10982
|
-
if (config.getOutputFormat() ===
|
|
10998
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10983
10999
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10984
11000
|
`);
|
|
10985
11001
|
}
|
|
@@ -10997,7 +11013,7 @@ async function runNonInteractive2(params) {
|
|
|
10997
11013
|
const requestInfo = completedToolCall.request;
|
|
10998
11014
|
if (streamFormatter) {
|
|
10999
11015
|
streamFormatter.emitEvent({
|
|
11000
|
-
type:
|
|
11016
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11001
11017
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11002
11018
|
tool_id: requestInfo.callId,
|
|
11003
11019
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11031,11 +11047,11 @@ async function runNonInteractive2(params) {
|
|
|
11031
11047
|
);
|
|
11032
11048
|
}
|
|
11033
11049
|
const stopExecutionTool = completedToolCalls.find(
|
|
11034
|
-
(tc) => tc.response.errorType ===
|
|
11050
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
11035
11051
|
);
|
|
11036
11052
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11037
11053
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11038
|
-
if (config.getOutputFormat() ===
|
|
11054
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11039
11055
|
process.stderr.write(`${stopMessage}
|
|
11040
11056
|
`);
|
|
11041
11057
|
}
|
|
@@ -11043,7 +11059,7 @@ async function runNonInteractive2(params) {
|
|
|
11043
11059
|
const metrics = uiTelemetryService.getMetrics();
|
|
11044
11060
|
const durationMs = Date.now() - startTime;
|
|
11045
11061
|
streamFormatter.emitEvent({
|
|
11046
|
-
type:
|
|
11062
|
+
type: JsonStreamEventType.RESULT,
|
|
11047
11063
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11048
11064
|
status: "success",
|
|
11049
11065
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11051,7 +11067,7 @@ async function runNonInteractive2(params) {
|
|
|
11051
11067
|
durationMs
|
|
11052
11068
|
)
|
|
11053
11069
|
});
|
|
11054
|
-
} else if (config.getOutputFormat() ===
|
|
11070
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11055
11071
|
const formatter = new JsonFormatter();
|
|
11056
11072
|
const stats = uiTelemetryService.getMetrics();
|
|
11057
11073
|
textOutput.write(
|
|
@@ -11068,12 +11084,12 @@ async function runNonInteractive2(params) {
|
|
|
11068
11084
|
const metrics = uiTelemetryService.getMetrics();
|
|
11069
11085
|
const durationMs = Date.now() - startTime;
|
|
11070
11086
|
streamFormatter.emitEvent({
|
|
11071
|
-
type:
|
|
11087
|
+
type: JsonStreamEventType.RESULT,
|
|
11072
11088
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11073
11089
|
status: "success",
|
|
11074
11090
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11075
11091
|
});
|
|
11076
|
-
} else if (config.getOutputFormat() ===
|
|
11092
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11077
11093
|
const formatter = new JsonFormatter();
|
|
11078
11094
|
const stats = uiTelemetryService.getMetrics();
|
|
11079
11095
|
textOutput.write(
|
|
@@ -11091,7 +11107,7 @@ async function runNonInteractive2(params) {
|
|
|
11091
11107
|
cleanupStdinCancellation();
|
|
11092
11108
|
scheduler?.dispose();
|
|
11093
11109
|
consolePatcher.cleanup();
|
|
11094
|
-
coreEvents.off(
|
|
11110
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11095
11111
|
}
|
|
11096
11112
|
if (errorToHandle) {
|
|
11097
11113
|
handleError(errorToHandle, config);
|
|
@@ -13562,12 +13578,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13562
13578
|
this.clientCapabilities = args.clientCapabilities;
|
|
13563
13579
|
const authMethods = [
|
|
13564
13580
|
{
|
|
13565
|
-
id:
|
|
13581
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
13566
13582
|
name: "Log in with Google",
|
|
13567
13583
|
description: "Log in with your Google account"
|
|
13568
13584
|
},
|
|
13569
13585
|
{
|
|
13570
|
-
id:
|
|
13586
|
+
id: AuthType.USE_GEMINI,
|
|
13571
13587
|
name: "Gemini API key",
|
|
13572
13588
|
description: "Use an API key with Gemini Developer API",
|
|
13573
13589
|
_meta: {
|
|
@@ -13577,12 +13593,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13577
13593
|
}
|
|
13578
13594
|
},
|
|
13579
13595
|
{
|
|
13580
|
-
id:
|
|
13596
|
+
id: AuthType.USE_VERTEX_AI,
|
|
13581
13597
|
name: "Vertex AI",
|
|
13582
13598
|
description: "Use an API key with Vertex AI GenAI API"
|
|
13583
13599
|
},
|
|
13584
13600
|
{
|
|
13585
|
-
id:
|
|
13601
|
+
id: AuthType.GATEWAY,
|
|
13586
13602
|
name: "AI API Gateway",
|
|
13587
13603
|
description: "Use a custom AI API Gateway",
|
|
13588
13604
|
_meta: {
|
|
@@ -13677,7 +13693,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13677
13693
|
mcpServers,
|
|
13678
13694
|
loadedSettings
|
|
13679
13695
|
);
|
|
13680
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
13696
|
+
const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
|
|
13681
13697
|
let isAuthenticated = false;
|
|
13682
13698
|
let authErrorMessage = "";
|
|
13683
13699
|
try {
|
|
@@ -13689,7 +13705,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13689
13705
|
);
|
|
13690
13706
|
isAuthenticated = true;
|
|
13691
13707
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
13692
|
-
if (authType ===
|
|
13708
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
13693
13709
|
isAuthenticated = false;
|
|
13694
13710
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
13695
13711
|
}
|
|
@@ -13999,7 +14015,7 @@ ${thought.description}`;
|
|
|
13999
14015
|
await this.sendUpdate({
|
|
14000
14016
|
sessionUpdate: "tool_call",
|
|
14001
14017
|
toolCallId: toolCall.id,
|
|
14002
|
-
status: toolCall.status ===
|
|
14018
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
14003
14019
|
title: toolCall.displayName || toolCall.name,
|
|
14004
14020
|
content: toolCallContent,
|
|
14005
14021
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14052,7 +14068,7 @@ ${thought.description}`;
|
|
|
14052
14068
|
while (nextMessage !== null) {
|
|
14053
14069
|
if (pendingSend.signal.aborted) {
|
|
14054
14070
|
chat.addHistory(nextMessage);
|
|
14055
|
-
return { stopReason:
|
|
14071
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14056
14072
|
}
|
|
14057
14073
|
const functionCalls = [];
|
|
14058
14074
|
try {
|
|
@@ -14072,7 +14088,7 @@ ${thought.description}`;
|
|
|
14072
14088
|
nextMessage?.parts ?? [],
|
|
14073
14089
|
promptId,
|
|
14074
14090
|
pendingSend.signal,
|
|
14075
|
-
|
|
14091
|
+
LlmRole.MAIN
|
|
14076
14092
|
);
|
|
14077
14093
|
nextMessage = null;
|
|
14078
14094
|
let turnInputTokens = 0;
|
|
@@ -14080,16 +14096,16 @@ ${thought.description}`;
|
|
|
14080
14096
|
let turnModelId = model;
|
|
14081
14097
|
for await (const resp of responseStream) {
|
|
14082
14098
|
if (pendingSend.signal.aborted) {
|
|
14083
|
-
return { stopReason:
|
|
14099
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14084
14100
|
}
|
|
14085
|
-
if (resp.type ===
|
|
14101
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
|
|
14086
14102
|
turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
|
|
14087
14103
|
turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
|
|
14088
14104
|
if (resp.value.modelVersion) {
|
|
14089
14105
|
turnModelId = resp.value.modelVersion;
|
|
14090
14106
|
}
|
|
14091
14107
|
}
|
|
14092
|
-
if (resp.type ===
|
|
14108
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
14093
14109
|
const candidate = resp.value.candidates[0];
|
|
14094
14110
|
for (const part of candidate.content?.parts ?? []) {
|
|
14095
14111
|
if (!part.text) {
|
|
@@ -14105,7 +14121,7 @@ ${thought.description}`;
|
|
|
14105
14121
|
});
|
|
14106
14122
|
}
|
|
14107
14123
|
}
|
|
14108
|
-
if (resp.type ===
|
|
14124
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
|
|
14109
14125
|
functionCalls.push(...resp.value.functionCalls);
|
|
14110
14126
|
}
|
|
14111
14127
|
}
|
|
@@ -14121,7 +14137,7 @@ ${thought.description}`;
|
|
|
14121
14137
|
modelUsageMap.set(turnModelId, existing);
|
|
14122
14138
|
}
|
|
14123
14139
|
if (pendingSend.signal.aborted) {
|
|
14124
|
-
return { stopReason:
|
|
14140
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14125
14141
|
}
|
|
14126
14142
|
} catch (error) {
|
|
14127
14143
|
if (getErrorStatus(error) === 429) {
|
|
@@ -14131,7 +14147,7 @@ ${thought.description}`;
|
|
|
14131
14147
|
);
|
|
14132
14148
|
}
|
|
14133
14149
|
if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
|
|
14134
|
-
return { stopReason:
|
|
14150
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14135
14151
|
}
|
|
14136
14152
|
if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL")) {
|
|
14137
14153
|
return {
|
|
@@ -14295,7 +14311,7 @@ ${thought.description}`;
|
|
|
14295
14311
|
const output = RequestPermissionResponseSchema.parse(
|
|
14296
14312
|
await this.connection.requestPermission(params)
|
|
14297
14313
|
);
|
|
14298
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14314
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14299
14315
|
await confirmationDetails.onConfirm(outcome);
|
|
14300
14316
|
await updatePolicy(
|
|
14301
14317
|
tool,
|
|
@@ -14306,16 +14322,16 @@ ${thought.description}`;
|
|
|
14306
14322
|
invocation
|
|
14307
14323
|
);
|
|
14308
14324
|
switch (outcome) {
|
|
14309
|
-
case
|
|
14325
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14310
14326
|
return errorResponse(
|
|
14311
14327
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14312
14328
|
);
|
|
14313
|
-
case
|
|
14314
|
-
case
|
|
14315
|
-
case
|
|
14316
|
-
case
|
|
14317
|
-
case
|
|
14318
|
-
case
|
|
14329
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
14330
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
14331
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
14332
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
14333
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
14334
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14319
14335
|
break;
|
|
14320
14336
|
default: {
|
|
14321
14337
|
const resultOutcome = outcome;
|
|
@@ -14363,7 +14379,7 @@ ${thought.description}`;
|
|
|
14363
14379
|
);
|
|
14364
14380
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14365
14381
|
{
|
|
14366
|
-
status:
|
|
14382
|
+
status: CoreToolCallStatus.Success,
|
|
14367
14383
|
request: {
|
|
14368
14384
|
callId,
|
|
14369
14385
|
name: fc.name,
|
|
@@ -14408,7 +14424,7 @@ ${thought.description}`;
|
|
|
14408
14424
|
});
|
|
14409
14425
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14410
14426
|
{
|
|
14411
|
-
status:
|
|
14427
|
+
status: CoreToolCallStatus.Error,
|
|
14412
14428
|
request: {
|
|
14413
14429
|
callId,
|
|
14414
14430
|
name: fc.name,
|
|
@@ -14523,12 +14539,12 @@ ${thought.description}`;
|
|
|
14523
14539
|
sessionId: this.id,
|
|
14524
14540
|
options: [
|
|
14525
14541
|
{
|
|
14526
|
-
optionId:
|
|
14542
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14527
14543
|
name: "Allow once",
|
|
14528
14544
|
kind: "allow_once"
|
|
14529
14545
|
},
|
|
14530
14546
|
{
|
|
14531
|
-
optionId:
|
|
14547
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14532
14548
|
name: "Deny",
|
|
14533
14549
|
kind: "reject_once"
|
|
14534
14550
|
}
|
|
@@ -14553,8 +14569,8 @@ ${thought.description}`;
|
|
|
14553
14569
|
const output = RequestPermissionResponseSchema.parse(
|
|
14554
14570
|
await this.connection.requestPermission(params)
|
|
14555
14571
|
);
|
|
14556
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14557
|
-
if (outcome ===
|
|
14572
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14573
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14558
14574
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14559
14575
|
validationError = null;
|
|
14560
14576
|
} else {
|
|
@@ -14931,12 +14947,12 @@ function toToolCallContent(toolResult) {
|
|
|
14931
14947
|
}
|
|
14932
14948
|
var basicPermissionOptions = [
|
|
14933
14949
|
{
|
|
14934
|
-
optionId:
|
|
14950
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14935
14951
|
name: "Allow",
|
|
14936
14952
|
kind: "allow_once"
|
|
14937
14953
|
},
|
|
14938
14954
|
{
|
|
14939
|
-
optionId:
|
|
14955
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14940
14956
|
name: "Reject",
|
|
14941
14957
|
kind: "reject_once"
|
|
14942
14958
|
}
|
|
@@ -14948,13 +14964,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14948
14964
|
switch (confirmation.type) {
|
|
14949
14965
|
case "edit":
|
|
14950
14966
|
options.push({
|
|
14951
|
-
optionId:
|
|
14967
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14952
14968
|
name: "Allow for this session",
|
|
14953
14969
|
kind: "allow_always"
|
|
14954
14970
|
});
|
|
14955
14971
|
if (enablePermanentToolApproval) {
|
|
14956
14972
|
options.push({
|
|
14957
|
-
optionId:
|
|
14973
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14958
14974
|
name: "Allow for this file in all future sessions",
|
|
14959
14975
|
kind: "allow_always"
|
|
14960
14976
|
});
|
|
@@ -14962,13 +14978,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14962
14978
|
break;
|
|
14963
14979
|
case "exec":
|
|
14964
14980
|
options.push({
|
|
14965
|
-
optionId:
|
|
14981
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14966
14982
|
name: "Allow for this session",
|
|
14967
14983
|
kind: "allow_always"
|
|
14968
14984
|
});
|
|
14969
14985
|
if (enablePermanentToolApproval) {
|
|
14970
14986
|
options.push({
|
|
14971
|
-
optionId:
|
|
14987
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14972
14988
|
name: "Allow this command for all future sessions",
|
|
14973
14989
|
kind: "allow_always"
|
|
14974
14990
|
});
|
|
@@ -14977,19 +14993,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14977
14993
|
case "mcp":
|
|
14978
14994
|
options.push(
|
|
14979
14995
|
{
|
|
14980
|
-
optionId:
|
|
14996
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
14981
14997
|
name: "Allow all server tools for this session",
|
|
14982
14998
|
kind: "allow_always"
|
|
14983
14999
|
},
|
|
14984
15000
|
{
|
|
14985
|
-
optionId:
|
|
15001
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
14986
15002
|
name: "Allow tool for this session",
|
|
14987
15003
|
kind: "allow_always"
|
|
14988
15004
|
}
|
|
14989
15005
|
);
|
|
14990
15006
|
if (enablePermanentToolApproval) {
|
|
14991
15007
|
options.push({
|
|
14992
|
-
optionId:
|
|
15008
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14993
15009
|
name: "Allow tool for all future sessions",
|
|
14994
15010
|
kind: "allow_always"
|
|
14995
15011
|
});
|
|
@@ -14997,13 +15013,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14997
15013
|
break;
|
|
14998
15014
|
case "info":
|
|
14999
15015
|
options.push({
|
|
15000
|
-
optionId:
|
|
15016
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
15001
15017
|
name: "Allow for this session",
|
|
15002
15018
|
kind: "allow_always"
|
|
15003
15019
|
});
|
|
15004
15020
|
if (enablePermanentToolApproval) {
|
|
15005
15021
|
options.push({
|
|
15006
|
-
optionId:
|
|
15022
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
15007
15023
|
name: "Allow for all future sessions",
|
|
15008
15024
|
kind: "allow_always"
|
|
15009
15025
|
});
|
|
@@ -15035,21 +15051,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
15035
15051
|
}
|
|
15036
15052
|
function toAcpToolKind(kind) {
|
|
15037
15053
|
switch (kind) {
|
|
15038
|
-
case
|
|
15039
|
-
case
|
|
15040
|
-
case
|
|
15041
|
-
case
|
|
15042
|
-
case
|
|
15043
|
-
case
|
|
15044
|
-
case
|
|
15045
|
-
case
|
|
15046
|
-
case
|
|
15047
|
-
case
|
|
15054
|
+
case Kind.Read:
|
|
15055
|
+
case Kind.Edit:
|
|
15056
|
+
case Kind.Execute:
|
|
15057
|
+
case Kind.Search:
|
|
15058
|
+
case Kind.Delete:
|
|
15059
|
+
case Kind.Move:
|
|
15060
|
+
case Kind.Think:
|
|
15061
|
+
case Kind.Fetch:
|
|
15062
|
+
case Kind.SwitchMode:
|
|
15063
|
+
case Kind.Other:
|
|
15048
15064
|
return kind;
|
|
15049
|
-
case
|
|
15065
|
+
case Kind.Agent:
|
|
15050
15066
|
return "think";
|
|
15051
|
-
case
|
|
15052
|
-
case
|
|
15067
|
+
case Kind.Plan:
|
|
15068
|
+
case Kind.Communicate:
|
|
15053
15069
|
default:
|
|
15054
15070
|
return "other";
|
|
15055
15071
|
}
|
|
@@ -15057,24 +15073,24 @@ function toAcpToolKind(kind) {
|
|
|
15057
15073
|
function buildAvailableModes(isPlanEnabled) {
|
|
15058
15074
|
const modes = [
|
|
15059
15075
|
{
|
|
15060
|
-
id:
|
|
15076
|
+
id: ApprovalMode.DEFAULT,
|
|
15061
15077
|
name: "Default",
|
|
15062
15078
|
description: "Prompts for approval"
|
|
15063
15079
|
},
|
|
15064
15080
|
{
|
|
15065
|
-
id:
|
|
15081
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
15066
15082
|
name: "Auto Edit",
|
|
15067
15083
|
description: "Auto-approves edit tools"
|
|
15068
15084
|
},
|
|
15069
15085
|
{
|
|
15070
|
-
id:
|
|
15086
|
+
id: ApprovalMode.YOLO,
|
|
15071
15087
|
name: "YOLO",
|
|
15072
15088
|
description: "Auto-approves all tools"
|
|
15073
15089
|
}
|
|
15074
15090
|
];
|
|
15075
15091
|
if (isPlanEnabled) {
|
|
15076
15092
|
modes.push({
|
|
15077
|
-
id:
|
|
15093
|
+
id: ApprovalMode.PLAN,
|
|
15078
15094
|
name: "Plan",
|
|
15079
15095
|
description: "Read-only mode"
|
|
15080
15096
|
});
|
|
@@ -15087,7 +15103,7 @@ function buildAvailableModels(config, settings) {
|
|
|
15087
15103
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
15088
15104
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
15089
15105
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
15090
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
15106
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
15091
15107
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
15092
15108
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
15093
15109
|
useGemini3_1: useGemini31,
|
|
@@ -15185,7 +15201,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15185
15201
|
}
|
|
15186
15202
|
return authType;
|
|
15187
15203
|
} catch (error) {
|
|
15188
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15204
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
15189
15205
|
handleError(
|
|
15190
15206
|
error instanceof Error ? error : new Error(String(error)),
|
|
15191
15207
|
nonInteractiveConfig,
|
|
@@ -15381,10 +15397,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15381
15397
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15382
15398
|
}
|
|
15383
15399
|
start() {
|
|
15384
|
-
coreEvents.on(
|
|
15400
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15385
15401
|
}
|
|
15386
15402
|
stop() {
|
|
15387
|
-
coreEvents.off(
|
|
15403
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15388
15404
|
if (this.flushTimeout) {
|
|
15389
15405
|
clearTimeout(this.flushTimeout);
|
|
15390
15406
|
this.flushTimeout = null;
|
|
@@ -15595,7 +15611,7 @@ async function resolveSessionId(resumeArg) {
|
|
|
15595
15611
|
}
|
|
15596
15612
|
}
|
|
15597
15613
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15598
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15614
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-VO2T47FA.js");
|
|
15599
15615
|
await doStartUI(
|
|
15600
15616
|
config,
|
|
15601
15617
|
settings,
|
|
@@ -15694,12 +15710,12 @@ async function main() {
|
|
|
15694
15710
|
dns.setDefaultResultOrder(
|
|
15695
15711
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15696
15712
|
);
|
|
15697
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15713
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
15698
15714
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15699
15715
|
settings.setValue(
|
|
15700
15716
|
"User" /* User */,
|
|
15701
15717
|
"security.auth.selectedType",
|
|
15702
|
-
|
|
15718
|
+
AuthType.COMPUTE_ADC
|
|
15703
15719
|
);
|
|
15704
15720
|
}
|
|
15705
15721
|
}
|
|
@@ -15797,7 +15813,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15797
15813
|
await config.storage.initialize();
|
|
15798
15814
|
adminControlsListner.setConfig(config);
|
|
15799
15815
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15800
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
15816
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-K4I6YCD4.js");
|
|
15801
15817
|
setupInitialActivityLogger(config);
|
|
15802
15818
|
}
|
|
15803
15819
|
registerTelemetryConfig(config);
|
|
@@ -15805,7 +15821,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15805
15821
|
const messageBus = config.getMessageBus();
|
|
15806
15822
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
15807
15823
|
registerCleanup(async () => {
|
|
15808
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
15824
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
15809
15825
|
});
|
|
15810
15826
|
cleanupExpiredSessions(config, settings.merged).catch((e) => {
|
|
15811
15827
|
debugLogger.error("Failed to cleanup expired sessions:", e);
|
|
@@ -15853,7 +15869,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15853
15869
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
15854
15870
|
const initializationResult = await initializeApp(config, settings);
|
|
15855
15871
|
initAppHandle?.end();
|
|
15856
|
-
import("./liteRtServerManager-
|
|
15872
|
+
import("./liteRtServerManager-HMMIC3TU.js").then(({ LiteRtServerManager }) => {
|
|
15857
15873
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
15858
15874
|
if (!mergedGemma) return;
|
|
15859
15875
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -15863,7 +15879,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15863
15879
|
autoStartServer: userGemma?.autoStartServer
|
|
15864
15880
|
});
|
|
15865
15881
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
15866
|
-
if (settings.merged.security.auth.selectedType ===
|
|
15882
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
15867
15883
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
15868
15884
|
}
|
|
15869
15885
|
if (config.getAcpMode()) {
|
|
@@ -15879,7 +15895,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15879
15895
|
...rawStartupWarnings.map((message) => ({
|
|
15880
15896
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
15881
15897
|
message,
|
|
15882
|
-
priority:
|
|
15898
|
+
priority: WarningPriority.High
|
|
15883
15899
|
})),
|
|
15884
15900
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
15885
15901
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -15916,7 +15932,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15916
15932
|
${input}` : stdinData;
|
|
15917
15933
|
}
|
|
15918
15934
|
}
|
|
15919
|
-
const sessionStartSource = resumedSessionData ?
|
|
15935
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
15920
15936
|
const hookSystem = config?.getHookSystem();
|
|
15921
15937
|
if (hookSystem) {
|
|
15922
15938
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -15973,16 +15989,16 @@ ${input}` : wrappedContext;
|
|
|
15973
15989
|
}
|
|
15974
15990
|
}
|
|
15975
15991
|
function initializeOutputListenersAndFlush() {
|
|
15976
|
-
if (coreEvents.listenerCount(
|
|
15977
|
-
coreEvents.on(
|
|
15992
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
15993
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
15978
15994
|
if (payload.isStderr) {
|
|
15979
15995
|
writeToStderr(payload.chunk, payload.encoding);
|
|
15980
15996
|
} else {
|
|
15981
15997
|
writeToStdout(payload.chunk, payload.encoding);
|
|
15982
15998
|
}
|
|
15983
15999
|
});
|
|
15984
|
-
if (coreEvents.listenerCount(
|
|
15985
|
-
coreEvents.on(
|
|
16000
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
16001
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
15986
16002
|
if (payload.type === "error" || payload.type === "warn") {
|
|
15987
16003
|
writeToStderr(payload.content);
|
|
15988
16004
|
} else {
|
|
@@ -15990,8 +16006,8 @@ function initializeOutputListenersAndFlush() {
|
|
|
15990
16006
|
}
|
|
15991
16007
|
});
|
|
15992
16008
|
}
|
|
15993
|
-
if (coreEvents.listenerCount(
|
|
15994
|
-
coreEvents.on(
|
|
16009
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
16010
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
15995
16011
|
if (payload.severity === "error" || payload.severity === "warning") {
|
|
15996
16012
|
writeToStderr(payload.message);
|
|
15997
16013
|
} else {
|