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