@google/gemini-cli 0.40.0-preview.2 → 0.41.0-nightly.20260423.gd1c91f526
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-NO7STVVM.js → chunk-4PEADYI5.js} +4 -4
- package/bundle/{chunk-QK7UWGBN.js → chunk-5RWN2VOG.js} +4 -4
- package/bundle/{chunk-3GU3LF3I.js → chunk-BE3FMR6C.js} +6 -6
- package/bundle/{chunk-IMEC72NS.js → chunk-BGTQF57Z.js} +1 -1
- package/bundle/{chunk-EFCQXWIF.js → chunk-BM7TRCHV.js} +2 -2
- package/bundle/{chunk-WL5MCPV2.js → chunk-BXO2CSHU.js} +1 -1
- package/bundle/{chunk-PLUWJHZZ.js → chunk-CMDSUNBE.js} +64 -52
- package/bundle/{chunk-33ANPP4S.js → chunk-DOZGGGM3.js} +2 -2
- package/bundle/{chunk-TDW6FM3A.js → chunk-FLEXF7OP.js} +1 -1
- package/bundle/{chunk-HV36F4CL.js → chunk-HGAC7IIS.js} +1 -1
- package/bundle/{chunk-UBXB5AEJ.js → chunk-ILGARB2Y.js} +3 -3
- package/bundle/{chunk-4IJPDKI6.js → chunk-ILSUW45Y.js} +14 -12
- package/bundle/{chunk-MUGUV6RZ.js → chunk-JI66QA3S.js} +2 -2
- package/bundle/{chunk-RM43GNQQ.js → chunk-KCEU7UY3.js} +6356 -11853
- package/bundle/{chunk-WHIWQCI5.js → chunk-LO2U5DX7.js} +1 -1
- package/bundle/chunk-MJ35NORG.js +1571 -0
- package/bundle/chunk-MRRUSUAI.js +79847 -0
- package/bundle/chunk-MURNAVEF.js +350850 -0
- package/bundle/chunk-NF5KE423.js +17725 -0
- package/bundle/{chunk-IUVLJUOL.js → chunk-OKARZDAC.js} +1 -1
- package/bundle/chunk-RFYY2EXK.js +156 -0
- package/bundle/chunk-ULLQZW4G.js +118 -0
- package/bundle/{chunk-GXRQOXQF.js → chunk-ZRHJDW4J.js} +6 -6
- package/bundle/{chunk-NIVCRM5L.js → chunk-ZRZIZSCI.js} +1 -1
- package/bundle/{cleanup-A7WXWAMI.js → cleanup-CM5YE3PO.js} +2 -2
- package/bundle/{cleanup-IPLJJT5S.js → cleanup-GCC3QSXL.js} +3 -3
- package/bundle/{cleanup-EWPIME2M.js → cleanup-JSTWYHMS.js} +2 -2
- package/bundle/cleanup-WQ3P3JRW.js +33 -0
- package/bundle/{core-VCDK23ZC.js → core-WAVEV7SE.js} +1 -1
- package/bundle/{devtoolsService-B5VVZ752.js → devtoolsService-65PTC72C.js} +2 -2
- package/bundle/{devtoolsService-6Y6YER6T.js → devtoolsService-KHTP2AVU.js} +2 -2
- package/bundle/{devtoolsService-2JXSALRU.js → devtoolsService-QZON66HV.js} +5 -4
- package/bundle/devtoolsService-YL2DS7JV.js +852 -0
- package/bundle/{dist-UIXQETMC.js → dist-IJE6ZESE.js} +1 -1
- package/bundle/{core-BQT6T3CH.js → dist-JJVAY7EX.js} +2 -2
- package/bundle/dist-S3PCMM76.js +2020 -0
- package/bundle/{gemini-54LH6RUH.js → gemini-5Z5FJY4B.js} +12 -12
- package/bundle/{gemini-ID44Z5SV.js → gemini-LFI3ENEH.js} +12 -12
- package/bundle/{gemini-44W2QEZI.js → gemini-MAC54OQS.js} +188 -173
- package/bundle/gemini-UPKTLJJZ.js +16043 -0
- package/bundle/gemini.js +3 -3
- package/bundle/{interactiveCli-JFBPGMNM.js → interactiveCli-3UQTFU2M.js} +6 -6
- package/bundle/{interactiveCli-5B3X6RNB.js → interactiveCli-7ZE7G6ZY.js} +277 -260
- package/bundle/{interactiveCli-5MTJDFYC.js → interactiveCli-FZUKC563.js} +6 -6
- package/bundle/interactiveCli-JE4PLDY5.js +34597 -0
- package/bundle/{liteRtServerManager-6GJWEP5W.js → liteRtServerManager-L6OWAEH4.js} +3 -3
- package/bundle/{liteRtServerManager-76V63PRJ.js → liteRtServerManager-OARJ4EUZ.js} +4 -4
- package/bundle/{liteRtServerManager-WQMDPACQ.js → liteRtServerManager-WJT6SPLU.js} +3 -3
- package/bundle/liteRtServerManager-ZDS6QYLO.js +65 -0
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-EX6SQEZP.js → oauth2-provider-JPWXPXQ6.js} +1 -1
- package/bundle/{oauth2-provider-ZF52AWQY.js → oauth2-provider-Q4A4U7PX.js} +39 -73
- package/bundle/oauth2-provider-WW42PZXK.js +237 -0
- package/bundle/{oauth2-provider-JCKLNKRV.js → oauth2-provider-ZW2I3O4T.js} +1 -1
- package/bundle/{start-SHOUHW3Y.js → start-BXEBAKTI.js} +5 -5
- package/bundle/{start-B6EMQCH5.js → start-JFRQSQYB.js} +6 -6
- package/bundle/start-PMSOWXLI.js +18 -0
- package/bundle/{start-CYDJTOAP.js → start-XEUSMK4W.js} +5 -5
- package/package.json +1 -1
|
@@ -42,18 +42,18 @@ import {
|
|
|
42
42
|
updateAllUpdatableExtensions,
|
|
43
43
|
updateExtension,
|
|
44
44
|
validateAuthMethod
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-BE3FMR6C.js";
|
|
46
46
|
import {
|
|
47
47
|
appEvents
|
|
48
48
|
} from "./chunk-5PS3AYFU.js";
|
|
49
49
|
import {
|
|
50
50
|
startCommand,
|
|
51
51
|
startServer
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-ILGARB2Y.js";
|
|
53
53
|
import {
|
|
54
54
|
exitCli,
|
|
55
55
|
require_source
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-LO2U5DX7.js";
|
|
57
57
|
import {
|
|
58
58
|
DEFAULT_PORT,
|
|
59
59
|
GEMMA_MODEL_NAME,
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
readServerProcessInfo,
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-HGAC7IIS.js";
|
|
91
91
|
import {
|
|
92
92
|
cleanupCheckpoints,
|
|
93
93
|
registerCleanup,
|
|
@@ -96,32 +96,43 @@ import {
|
|
|
96
96
|
runExitCleanup,
|
|
97
97
|
runSyncCleanup,
|
|
98
98
|
setupSignalHandlers
|
|
99
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-BXO2CSHU.js";
|
|
100
100
|
import {
|
|
101
101
|
AuthType,
|
|
102
102
|
ChatRecordingService,
|
|
103
103
|
Client,
|
|
104
104
|
Config,
|
|
105
|
+
CoreToolCallStatus,
|
|
105
106
|
ExitCodes,
|
|
106
107
|
FileDiscoveryService,
|
|
107
108
|
FolderTrustDiscoveryService,
|
|
109
|
+
GeminiEventType,
|
|
108
110
|
IdeClient,
|
|
111
|
+
IntegrityStatus,
|
|
109
112
|
InvalidStreamError,
|
|
110
113
|
JsonFormatter,
|
|
114
|
+
JsonStreamEventType,
|
|
111
115
|
LegacyAgentSession,
|
|
116
|
+
LlmRole,
|
|
112
117
|
Logger,
|
|
113
118
|
MCPServerConfig,
|
|
119
|
+
MCPServerStatus,
|
|
120
|
+
OutputFormat,
|
|
114
121
|
PolicyIntegrityManager,
|
|
115
122
|
ROOT_SCHEDULER_ID,
|
|
116
123
|
ReadManyFilesTool,
|
|
117
124
|
Scheduler,
|
|
125
|
+
SessionEndReason,
|
|
126
|
+
SessionStartSource,
|
|
118
127
|
ShellExecutionService,
|
|
128
|
+
StreamEventType,
|
|
119
129
|
StreamJsonFormatter,
|
|
120
130
|
ToolCallEvent,
|
|
121
131
|
UserAccountManager,
|
|
122
132
|
UserPromptEvent,
|
|
123
133
|
ValidationCancelledError,
|
|
124
134
|
ValidationRequiredError,
|
|
135
|
+
WarningPriority,
|
|
125
136
|
addMemory,
|
|
126
137
|
applyAdminAllowlist,
|
|
127
138
|
applyRequiredServers,
|
|
@@ -183,9 +194,11 @@ import {
|
|
|
183
194
|
updatePolicy,
|
|
184
195
|
writeToStderr,
|
|
185
196
|
writeToStdout
|
|
186
|
-
} from "./chunk-
|
|
197
|
+
} from "./chunk-5RWN2VOG.js";
|
|
187
198
|
import {
|
|
188
199
|
ASK_USER_TOOL_NAME,
|
|
200
|
+
ApprovalMode,
|
|
201
|
+
CoreEvent,
|
|
189
202
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
190
203
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
191
204
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -204,6 +217,7 @@ import {
|
|
|
204
217
|
FatalTurnLimitedError,
|
|
205
218
|
GEMINI_DIR,
|
|
206
219
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
220
|
+
Kind,
|
|
207
221
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
208
222
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
209
223
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -213,6 +227,7 @@ import {
|
|
|
213
227
|
REFERENCE_CONTENT_START,
|
|
214
228
|
Storage,
|
|
215
229
|
ToolConfirmationOutcome,
|
|
230
|
+
ToolErrorType,
|
|
216
231
|
coreEvents,
|
|
217
232
|
debugLogger,
|
|
218
233
|
external_exports,
|
|
@@ -226,7 +241,7 @@ import {
|
|
|
226
241
|
loadServerHierarchicalMemory,
|
|
227
242
|
resolveToRealPath,
|
|
228
243
|
setGeminiMdFilename
|
|
229
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-VCGILCZV.js";
|
|
230
245
|
import "./chunk-664ZODQF.js";
|
|
231
246
|
import "./chunk-RJTRUG2J.js";
|
|
232
247
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5511,7 +5526,7 @@ async function getMcpServersFromConfig(settings) {
|
|
|
5511
5526
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5512
5527
|
const isStdio = !!config.command;
|
|
5513
5528
|
if (isStdio && !isTrusted) {
|
|
5514
|
-
return
|
|
5529
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5515
5530
|
}
|
|
5516
5531
|
const client = new Client({
|
|
5517
5532
|
name: "mcp-test-client",
|
|
@@ -5547,16 +5562,16 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5547
5562
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5548
5563
|
} catch {
|
|
5549
5564
|
await client.close();
|
|
5550
|
-
return
|
|
5565
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5551
5566
|
}
|
|
5552
5567
|
try {
|
|
5553
5568
|
await client.connect(transport, { timeout: 5e3 });
|
|
5554
5569
|
await client.ping();
|
|
5555
5570
|
await client.close();
|
|
5556
|
-
return
|
|
5571
|
+
return MCPServerStatus.CONNECTED;
|
|
5557
5572
|
} catch {
|
|
5558
5573
|
await transport.close();
|
|
5559
|
-
return
|
|
5574
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5560
5575
|
}
|
|
5561
5576
|
}
|
|
5562
5577
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5569,9 +5584,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5569
5584
|
});
|
|
5570
5585
|
if (!loadResult.allowed) {
|
|
5571
5586
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5572
|
-
return
|
|
5587
|
+
return MCPServerStatus.BLOCKED;
|
|
5573
5588
|
}
|
|
5574
|
-
return
|
|
5589
|
+
return MCPServerStatus.DISABLED;
|
|
5575
5590
|
}
|
|
5576
5591
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5577
5592
|
}
|
|
@@ -5605,23 +5620,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5605
5620
|
let statusIndicator = "";
|
|
5606
5621
|
let statusText = "";
|
|
5607
5622
|
switch (status) {
|
|
5608
|
-
case
|
|
5623
|
+
case MCPServerStatus.CONNECTED:
|
|
5609
5624
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5610
5625
|
statusText = "Connected";
|
|
5611
5626
|
break;
|
|
5612
|
-
case
|
|
5627
|
+
case MCPServerStatus.CONNECTING:
|
|
5613
5628
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5614
5629
|
statusText = "Connecting";
|
|
5615
5630
|
break;
|
|
5616
|
-
case
|
|
5631
|
+
case MCPServerStatus.BLOCKED:
|
|
5617
5632
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5618
5633
|
statusText = "Blocked";
|
|
5619
5634
|
break;
|
|
5620
|
-
case
|
|
5635
|
+
case MCPServerStatus.DISABLED:
|
|
5621
5636
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5622
5637
|
statusText = "Disabled";
|
|
5623
5638
|
break;
|
|
5624
|
-
case
|
|
5639
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5625
5640
|
default:
|
|
5626
5641
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5627
5642
|
statusText = "Disconnected";
|
|
@@ -7952,7 +7967,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7952
7967
|
}
|
|
7953
7968
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7954
7969
|
const packageJson = await getPackageJson(__dirname3);
|
|
7955
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
7970
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.41.0-nightly.20260423.gd1c91f526" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7956
7971
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7957
7972
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7958
7973
|
}
|
|
@@ -8011,9 +8026,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
8011
8026
|
cwd,
|
|
8012
8027
|
potentialWorkspacePoliciesDir
|
|
8013
8028
|
);
|
|
8014
|
-
if (integrityResult.status ===
|
|
8029
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
8015
8030
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
8016
|
-
} else if (integrityResult.status ===
|
|
8031
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
8017
8032
|
workspacePoliciesDir = void 0;
|
|
8018
8033
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
8019
8034
|
policyUpdateConfirmationRequest = {
|
|
@@ -8409,23 +8424,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8409
8424
|
if (rawApprovalMode) {
|
|
8410
8425
|
switch (rawApprovalMode) {
|
|
8411
8426
|
case "yolo":
|
|
8412
|
-
approvalMode =
|
|
8427
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8413
8428
|
break;
|
|
8414
8429
|
case "auto_edit":
|
|
8415
|
-
approvalMode =
|
|
8430
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8416
8431
|
break;
|
|
8417
8432
|
case "plan":
|
|
8418
8433
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8419
8434
|
debugLogger.warn(
|
|
8420
8435
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8421
8436
|
);
|
|
8422
|
-
approvalMode =
|
|
8437
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8423
8438
|
} else {
|
|
8424
|
-
approvalMode =
|
|
8439
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8425
8440
|
}
|
|
8426
8441
|
break;
|
|
8427
8442
|
case "default":
|
|
8428
|
-
approvalMode =
|
|
8443
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8429
8444
|
break;
|
|
8430
8445
|
default:
|
|
8431
8446
|
throw new Error(
|
|
@@ -8433,10 +8448,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8433
8448
|
);
|
|
8434
8449
|
}
|
|
8435
8450
|
} else {
|
|
8436
|
-
approvalMode =
|
|
8451
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8437
8452
|
}
|
|
8438
8453
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8439
|
-
if (approvalMode ===
|
|
8454
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8440
8455
|
if (settings.admin?.secureModeEnabled) {
|
|
8441
8456
|
debugLogger.error(
|
|
8442
8457
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8454,16 +8469,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8454
8469
|
)
|
|
8455
8470
|
);
|
|
8456
8471
|
}
|
|
8457
|
-
} else if (approvalMode ===
|
|
8472
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8458
8473
|
debugLogger.warn(
|
|
8459
8474
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8460
8475
|
);
|
|
8461
8476
|
}
|
|
8462
|
-
if (!trustedFolder && approvalMode !==
|
|
8477
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8463
8478
|
debugLogger.warn(
|
|
8464
8479
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8465
8480
|
);
|
|
8466
|
-
approvalMode =
|
|
8481
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8467
8482
|
}
|
|
8468
8483
|
let telemetrySettings;
|
|
8469
8484
|
try {
|
|
@@ -9852,7 +9867,7 @@ import path9 from "node:path";
|
|
|
9852
9867
|
import process4 from "node:process";
|
|
9853
9868
|
var homeDirectoryCheck = {
|
|
9854
9869
|
id: "home-directory",
|
|
9855
|
-
priority:
|
|
9870
|
+
priority: WarningPriority.Low,
|
|
9856
9871
|
check: async (workspaceRoot, settings) => {
|
|
9857
9872
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9858
9873
|
return null;
|
|
@@ -9876,7 +9891,7 @@ var homeDirectoryCheck = {
|
|
|
9876
9891
|
};
|
|
9877
9892
|
var rootDirectoryCheck = {
|
|
9878
9893
|
id: "root-directory",
|
|
9879
|
-
priority:
|
|
9894
|
+
priority: WarningPriority.High,
|
|
9880
9895
|
check: async (workspaceRoot, _settings) => {
|
|
9881
9896
|
try {
|
|
9882
9897
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -10060,12 +10075,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10060
10075
|
error,
|
|
10061
10076
|
config.getContentGeneratorConfig()?.authType
|
|
10062
10077
|
);
|
|
10063
|
-
if (config.getOutputFormat() ===
|
|
10078
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10064
10079
|
const streamFormatter = new StreamJsonFormatter();
|
|
10065
10080
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10066
10081
|
const metrics = uiTelemetryService.getMetrics();
|
|
10067
10082
|
streamFormatter.emitEvent({
|
|
10068
|
-
type:
|
|
10083
|
+
type: JsonStreamEventType.RESULT,
|
|
10069
10084
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10070
10085
|
status: "error",
|
|
10071
10086
|
error: {
|
|
@@ -10076,7 +10091,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10076
10091
|
});
|
|
10077
10092
|
runSyncCleanup();
|
|
10078
10093
|
process.exit(getNumericExitCode(errorCode));
|
|
10079
|
-
} else if (config.getOutputFormat() ===
|
|
10094
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10080
10095
|
const formatter = new JsonFormatter();
|
|
10081
10096
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10082
10097
|
const formattedError = formatter.formatError(
|
|
@@ -10096,11 +10111,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10096
10111
|
const isFatal = isFatalToolError(errorType);
|
|
10097
10112
|
if (isFatal) {
|
|
10098
10113
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10099
|
-
if (config.getOutputFormat() ===
|
|
10114
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10100
10115
|
const streamFormatter = new StreamJsonFormatter();
|
|
10101
10116
|
const metrics = uiTelemetryService.getMetrics();
|
|
10102
10117
|
streamFormatter.emitEvent({
|
|
10103
|
-
type:
|
|
10118
|
+
type: JsonStreamEventType.RESULT,
|
|
10104
10119
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10105
10120
|
status: "error",
|
|
10106
10121
|
error: {
|
|
@@ -10109,7 +10124,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10109
10124
|
},
|
|
10110
10125
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10111
10126
|
});
|
|
10112
|
-
} else if (config.getOutputFormat() ===
|
|
10127
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10113
10128
|
const formatter = new JsonFormatter();
|
|
10114
10129
|
const formattedError = formatter.formatError(
|
|
10115
10130
|
toolExecutionError,
|
|
@@ -10127,11 +10142,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10127
10142
|
}
|
|
10128
10143
|
function handleCancellationError(config) {
|
|
10129
10144
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10130
|
-
if (config.getOutputFormat() ===
|
|
10145
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10131
10146
|
const streamFormatter = new StreamJsonFormatter();
|
|
10132
10147
|
const metrics = uiTelemetryService.getMetrics();
|
|
10133
10148
|
streamFormatter.emitEvent({
|
|
10134
|
-
type:
|
|
10149
|
+
type: JsonStreamEventType.RESULT,
|
|
10135
10150
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10136
10151
|
status: "error",
|
|
10137
10152
|
error: {
|
|
@@ -10142,7 +10157,7 @@ function handleCancellationError(config) {
|
|
|
10142
10157
|
});
|
|
10143
10158
|
runSyncCleanup();
|
|
10144
10159
|
process.exit(cancellationError.exitCode);
|
|
10145
|
-
} else if (config.getOutputFormat() ===
|
|
10160
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10146
10161
|
const formatter = new JsonFormatter();
|
|
10147
10162
|
const formattedError = formatter.formatError(
|
|
10148
10163
|
cancellationError,
|
|
@@ -10162,11 +10177,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10162
10177
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10163
10178
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10164
10179
|
);
|
|
10165
|
-
if (config.getOutputFormat() ===
|
|
10180
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10166
10181
|
const streamFormatter = new StreamJsonFormatter();
|
|
10167
10182
|
const metrics = uiTelemetryService.getMetrics();
|
|
10168
10183
|
streamFormatter.emitEvent({
|
|
10169
|
-
type:
|
|
10184
|
+
type: JsonStreamEventType.RESULT,
|
|
10170
10185
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10171
10186
|
status: "error",
|
|
10172
10187
|
error: {
|
|
@@ -10177,7 +10192,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10177
10192
|
});
|
|
10178
10193
|
runSyncCleanup();
|
|
10179
10194
|
process.exit(maxTurnsError.exitCode);
|
|
10180
|
-
} else if (config.getOutputFormat() ===
|
|
10195
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10181
10196
|
const formatter = new JsonFormatter();
|
|
10182
10197
|
const formattedError = formatter.formatError(
|
|
10183
10198
|
maxTurnsError,
|
|
@@ -10257,7 +10272,7 @@ async function runNonInteractive({
|
|
|
10257
10272
|
}
|
|
10258
10273
|
});
|
|
10259
10274
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10260
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10275
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-65PTC72C.js");
|
|
10261
10276
|
setupInitialActivityLogger(config);
|
|
10262
10277
|
}
|
|
10263
10278
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10273,7 +10288,7 @@ async function runNonInteractive({
|
|
|
10273
10288
|
}
|
|
10274
10289
|
};
|
|
10275
10290
|
const startTime = Date.now();
|
|
10276
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10291
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10277
10292
|
const abortController = new AbortController();
|
|
10278
10293
|
let isAborting = false;
|
|
10279
10294
|
let cancelMessageTimer = null;
|
|
@@ -10326,13 +10341,13 @@ async function runNonInteractive({
|
|
|
10326
10341
|
};
|
|
10327
10342
|
try {
|
|
10328
10343
|
consolePatcher.patch();
|
|
10329
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10344
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10330
10345
|
process.stderr.write(
|
|
10331
10346
|
"[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"
|
|
10332
10347
|
);
|
|
10333
10348
|
}
|
|
10334
10349
|
setupStdinCancellation();
|
|
10335
|
-
coreEvents.on(
|
|
10350
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10336
10351
|
coreEvents.drainBacklogs();
|
|
10337
10352
|
process.stdout.on("error", (err) => {
|
|
10338
10353
|
if (err.code === "EPIPE") {
|
|
@@ -10358,7 +10373,7 @@ async function runNonInteractive({
|
|
|
10358
10373
|
}
|
|
10359
10374
|
if (streamFormatter) {
|
|
10360
10375
|
streamFormatter.emitEvent({
|
|
10361
|
-
type:
|
|
10376
|
+
type: JsonStreamEventType.INIT,
|
|
10362
10377
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10363
10378
|
session_id: config.getSessionId(),
|
|
10364
10379
|
model: config.getModel()
|
|
@@ -10396,7 +10411,7 @@ async function runNonInteractive({
|
|
|
10396
10411
|
}
|
|
10397
10412
|
if (streamFormatter) {
|
|
10398
10413
|
streamFormatter.emitEvent({
|
|
10399
|
-
type:
|
|
10414
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10400
10415
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10401
10416
|
role: "user",
|
|
10402
10417
|
content: input
|
|
@@ -10435,12 +10450,12 @@ async function runNonInteractive({
|
|
|
10435
10450
|
const metrics = uiTelemetryService.getMetrics();
|
|
10436
10451
|
const durationMs = Date.now() - startTime;
|
|
10437
10452
|
streamFormatter.emitEvent({
|
|
10438
|
-
type:
|
|
10453
|
+
type: JsonStreamEventType.RESULT,
|
|
10439
10454
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10440
10455
|
status: "success",
|
|
10441
10456
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10442
10457
|
});
|
|
10443
|
-
} else if (config.getOutputFormat() ===
|
|
10458
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10444
10459
|
const formatter = new JsonFormatter();
|
|
10445
10460
|
const stats = uiTelemetryService.getMetrics();
|
|
10446
10461
|
textOutput.write(
|
|
@@ -10526,13 +10541,13 @@ async function runNonInteractive({
|
|
|
10526
10541
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10527
10542
|
if (streamFormatter) {
|
|
10528
10543
|
streamFormatter.emitEvent({
|
|
10529
|
-
type:
|
|
10544
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10530
10545
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10531
10546
|
role: "assistant",
|
|
10532
10547
|
content: output,
|
|
10533
10548
|
delta: true
|
|
10534
10549
|
});
|
|
10535
|
-
} else if (config.getOutputFormat() ===
|
|
10550
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10536
10551
|
responseText += output;
|
|
10537
10552
|
} else {
|
|
10538
10553
|
if (part.text) {
|
|
@@ -10545,13 +10560,13 @@ async function runNonInteractive({
|
|
|
10545
10560
|
break;
|
|
10546
10561
|
}
|
|
10547
10562
|
case "tool_request": {
|
|
10548
|
-
if (config.getOutputFormat() ===
|
|
10563
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10549
10564
|
preToolResponseText = responseText || preToolResponseText;
|
|
10550
10565
|
responseText = "";
|
|
10551
10566
|
}
|
|
10552
10567
|
if (streamFormatter) {
|
|
10553
10568
|
streamFormatter.emitEvent({
|
|
10554
|
-
type:
|
|
10569
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10555
10570
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10556
10571
|
tool_name: event.name,
|
|
10557
10572
|
tool_id: event.requestId,
|
|
@@ -10567,7 +10582,7 @@ async function runNonInteractive({
|
|
|
10567
10582
|
const displayText = displayContentToString(display);
|
|
10568
10583
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10569
10584
|
streamFormatter.emitEvent({
|
|
10570
|
-
type:
|
|
10585
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10571
10586
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10572
10587
|
tool_id: event.requestId,
|
|
10573
10588
|
status: event.isError ? "error" : "success",
|
|
@@ -10582,17 +10597,17 @@ async function runNonInteractive({
|
|
|
10582
10597
|
const display = event.display?.result;
|
|
10583
10598
|
const displayText = displayContentToString(display);
|
|
10584
10599
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10585
|
-
if (event.data?.["errorType"] ===
|
|
10586
|
-
if (config.getOutputFormat() ===
|
|
10600
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
10601
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
10587
10602
|
responseText = preToolResponseText;
|
|
10588
10603
|
}
|
|
10589
10604
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10590
|
-
if (config.getOutputFormat() ===
|
|
10605
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10591
10606
|
process.stderr.write(`${stopMessage}
|
|
10592
10607
|
`);
|
|
10593
10608
|
}
|
|
10594
10609
|
}
|
|
10595
|
-
if (event.data?.["errorType"] ===
|
|
10610
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
10596
10611
|
throw new FatalToolExecutionError(
|
|
10597
10612
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10598
10613
|
);
|
|
@@ -10613,20 +10628,20 @@ async function runNonInteractive({
|
|
|
10613
10628
|
}
|
|
10614
10629
|
const errorCode = event._meta?.["code"];
|
|
10615
10630
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10616
|
-
if (config.getOutputFormat() ===
|
|
10631
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10617
10632
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10618
10633
|
`);
|
|
10619
10634
|
}
|
|
10620
10635
|
break;
|
|
10621
10636
|
}
|
|
10622
10637
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10623
|
-
if (config.getOutputFormat() ===
|
|
10638
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10624
10639
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10625
10640
|
`);
|
|
10626
10641
|
}
|
|
10627
10642
|
if (streamFormatter) {
|
|
10628
10643
|
streamFormatter.emitEvent({
|
|
10629
|
-
type:
|
|
10644
|
+
type: JsonStreamEventType.ERROR,
|
|
10630
10645
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10631
10646
|
severity,
|
|
10632
10647
|
message: event.message
|
|
@@ -10645,7 +10660,7 @@ async function runNonInteractive({
|
|
|
10645
10660
|
);
|
|
10646
10661
|
} else if (streamFormatter) {
|
|
10647
10662
|
streamFormatter.emitEvent({
|
|
10648
|
-
type:
|
|
10663
|
+
type: JsonStreamEventType.ERROR,
|
|
10649
10664
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10650
10665
|
severity: "error",
|
|
10651
10666
|
message: "Maximum session turns exceeded"
|
|
@@ -10653,7 +10668,7 @@ async function runNonInteractive({
|
|
|
10653
10668
|
}
|
|
10654
10669
|
}
|
|
10655
10670
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10656
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10671
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10657
10672
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10658
10673
|
`);
|
|
10659
10674
|
}
|
|
@@ -10683,7 +10698,7 @@ async function runNonInteractive({
|
|
|
10683
10698
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10684
10699
|
scheduler?.dispose();
|
|
10685
10700
|
consolePatcher.cleanup();
|
|
10686
|
-
coreEvents.off(
|
|
10701
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10687
10702
|
}
|
|
10688
10703
|
if (errorToHandle) {
|
|
10689
10704
|
handleError(errorToHandle, config);
|
|
@@ -10708,7 +10723,7 @@ async function runNonInteractive2(params) {
|
|
|
10708
10723
|
}
|
|
10709
10724
|
});
|
|
10710
10725
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10711
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10726
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-65PTC72C.js");
|
|
10712
10727
|
setupInitialActivityLogger(config);
|
|
10713
10728
|
}
|
|
10714
10729
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10724,7 +10739,7 @@ async function runNonInteractive2(params) {
|
|
|
10724
10739
|
}
|
|
10725
10740
|
};
|
|
10726
10741
|
const startTime = Date.now();
|
|
10727
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10742
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10728
10743
|
const abortController = new AbortController();
|
|
10729
10744
|
let isAborting = false;
|
|
10730
10745
|
let cancelMessageTimer = null;
|
|
@@ -10775,13 +10790,13 @@ async function runNonInteractive2(params) {
|
|
|
10775
10790
|
let scheduler;
|
|
10776
10791
|
try {
|
|
10777
10792
|
consolePatcher.patch();
|
|
10778
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10793
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10779
10794
|
process.stderr.write(
|
|
10780
10795
|
"[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"
|
|
10781
10796
|
);
|
|
10782
10797
|
}
|
|
10783
10798
|
setupStdinCancellation();
|
|
10784
|
-
coreEvents.on(
|
|
10799
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10785
10800
|
coreEvents.drainBacklogs();
|
|
10786
10801
|
process.stdout.on("error", (err) => {
|
|
10787
10802
|
if (err.code === "EPIPE") {
|
|
@@ -10805,7 +10820,7 @@ async function runNonInteractive2(params) {
|
|
|
10805
10820
|
}
|
|
10806
10821
|
if (streamFormatter) {
|
|
10807
10822
|
streamFormatter.emitEvent({
|
|
10808
|
-
type:
|
|
10823
|
+
type: JsonStreamEventType.INIT,
|
|
10809
10824
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10810
10825
|
session_id: config.getSessionId(),
|
|
10811
10826
|
model: config.getModel()
|
|
@@ -10843,7 +10858,7 @@ async function runNonInteractive2(params) {
|
|
|
10843
10858
|
}
|
|
10844
10859
|
if (streamFormatter) {
|
|
10845
10860
|
streamFormatter.emitEvent({
|
|
10846
|
-
type:
|
|
10861
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10847
10862
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10848
10863
|
role: "user",
|
|
10849
10864
|
content: input
|
|
@@ -10870,28 +10885,28 @@ async function runNonInteractive2(params) {
|
|
|
10870
10885
|
if (abortController.signal.aborted) {
|
|
10871
10886
|
handleCancellationError(config);
|
|
10872
10887
|
}
|
|
10873
|
-
if (event.type ===
|
|
10888
|
+
if (event.type === GeminiEventType.Content) {
|
|
10874
10889
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10875
10890
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10876
10891
|
if (streamFormatter) {
|
|
10877
10892
|
streamFormatter.emitEvent({
|
|
10878
|
-
type:
|
|
10893
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10879
10894
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10880
10895
|
role: "assistant",
|
|
10881
10896
|
content: output,
|
|
10882
10897
|
delta: true
|
|
10883
10898
|
});
|
|
10884
|
-
} else if (config.getOutputFormat() ===
|
|
10899
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10885
10900
|
responseText += output;
|
|
10886
10901
|
} else {
|
|
10887
10902
|
if (event.value) {
|
|
10888
10903
|
textOutput.write(output);
|
|
10889
10904
|
}
|
|
10890
10905
|
}
|
|
10891
|
-
} else if (event.type ===
|
|
10906
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
10892
10907
|
if (streamFormatter) {
|
|
10893
10908
|
streamFormatter.emitEvent({
|
|
10894
|
-
type:
|
|
10909
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10895
10910
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10896
10911
|
tool_name: event.value.name,
|
|
10897
10912
|
tool_id: event.value.callId,
|
|
@@ -10899,29 +10914,29 @@ async function runNonInteractive2(params) {
|
|
|
10899
10914
|
});
|
|
10900
10915
|
}
|
|
10901
10916
|
toolCallRequests.push(event.value);
|
|
10902
|
-
} else if (event.type ===
|
|
10917
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
10903
10918
|
if (streamFormatter) {
|
|
10904
10919
|
streamFormatter.emitEvent({
|
|
10905
|
-
type:
|
|
10920
|
+
type: JsonStreamEventType.ERROR,
|
|
10906
10921
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10907
10922
|
severity: "warning",
|
|
10908
10923
|
message: "Loop detected, stopping execution"
|
|
10909
10924
|
});
|
|
10910
10925
|
}
|
|
10911
|
-
} else if (event.type ===
|
|
10926
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
10912
10927
|
if (streamFormatter) {
|
|
10913
10928
|
streamFormatter.emitEvent({
|
|
10914
|
-
type:
|
|
10929
|
+
type: JsonStreamEventType.ERROR,
|
|
10915
10930
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10916
10931
|
severity: "error",
|
|
10917
10932
|
message: "Maximum session turns exceeded"
|
|
10918
10933
|
});
|
|
10919
10934
|
}
|
|
10920
|
-
} else if (event.type ===
|
|
10935
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
10921
10936
|
throw event.value.error;
|
|
10922
|
-
} else if (event.type ===
|
|
10937
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
10923
10938
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10924
|
-
if (config.getOutputFormat() ===
|
|
10939
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10925
10940
|
process.stderr.write(`${stopMessage}
|
|
10926
10941
|
`);
|
|
10927
10942
|
}
|
|
@@ -10929,7 +10944,7 @@ async function runNonInteractive2(params) {
|
|
|
10929
10944
|
const metrics = uiTelemetryService.getMetrics();
|
|
10930
10945
|
const durationMs = Date.now() - startTime;
|
|
10931
10946
|
streamFormatter.emitEvent({
|
|
10932
|
-
type:
|
|
10947
|
+
type: JsonStreamEventType.RESULT,
|
|
10933
10948
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10934
10949
|
status: "success",
|
|
10935
10950
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10939,9 +10954,9 @@ async function runNonInteractive2(params) {
|
|
|
10939
10954
|
});
|
|
10940
10955
|
}
|
|
10941
10956
|
return;
|
|
10942
|
-
} else if (event.type ===
|
|
10957
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
10943
10958
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10944
|
-
if (config.getOutputFormat() ===
|
|
10959
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10945
10960
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10946
10961
|
`);
|
|
10947
10962
|
}
|
|
@@ -10959,7 +10974,7 @@ async function runNonInteractive2(params) {
|
|
|
10959
10974
|
const requestInfo = completedToolCall.request;
|
|
10960
10975
|
if (streamFormatter) {
|
|
10961
10976
|
streamFormatter.emitEvent({
|
|
10962
|
-
type:
|
|
10977
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10963
10978
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10964
10979
|
tool_id: requestInfo.callId,
|
|
10965
10980
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -10993,11 +11008,11 @@ async function runNonInteractive2(params) {
|
|
|
10993
11008
|
);
|
|
10994
11009
|
}
|
|
10995
11010
|
const stopExecutionTool = completedToolCalls.find(
|
|
10996
|
-
(tc) => tc.response.errorType ===
|
|
11011
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
10997
11012
|
);
|
|
10998
11013
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
10999
11014
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11000
|
-
if (config.getOutputFormat() ===
|
|
11015
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11001
11016
|
process.stderr.write(`${stopMessage}
|
|
11002
11017
|
`);
|
|
11003
11018
|
}
|
|
@@ -11005,7 +11020,7 @@ async function runNonInteractive2(params) {
|
|
|
11005
11020
|
const metrics = uiTelemetryService.getMetrics();
|
|
11006
11021
|
const durationMs = Date.now() - startTime;
|
|
11007
11022
|
streamFormatter.emitEvent({
|
|
11008
|
-
type:
|
|
11023
|
+
type: JsonStreamEventType.RESULT,
|
|
11009
11024
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11010
11025
|
status: "success",
|
|
11011
11026
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11013,7 +11028,7 @@ async function runNonInteractive2(params) {
|
|
|
11013
11028
|
durationMs
|
|
11014
11029
|
)
|
|
11015
11030
|
});
|
|
11016
|
-
} else if (config.getOutputFormat() ===
|
|
11031
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11017
11032
|
const formatter = new JsonFormatter();
|
|
11018
11033
|
const stats = uiTelemetryService.getMetrics();
|
|
11019
11034
|
textOutput.write(
|
|
@@ -11030,12 +11045,12 @@ async function runNonInteractive2(params) {
|
|
|
11030
11045
|
const metrics = uiTelemetryService.getMetrics();
|
|
11031
11046
|
const durationMs = Date.now() - startTime;
|
|
11032
11047
|
streamFormatter.emitEvent({
|
|
11033
|
-
type:
|
|
11048
|
+
type: JsonStreamEventType.RESULT,
|
|
11034
11049
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11035
11050
|
status: "success",
|
|
11036
11051
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11037
11052
|
});
|
|
11038
|
-
} else if (config.getOutputFormat() ===
|
|
11053
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11039
11054
|
const formatter = new JsonFormatter();
|
|
11040
11055
|
const stats = uiTelemetryService.getMetrics();
|
|
11041
11056
|
textOutput.write(
|
|
@@ -11053,7 +11068,7 @@ async function runNonInteractive2(params) {
|
|
|
11053
11068
|
cleanupStdinCancellation();
|
|
11054
11069
|
scheduler?.dispose();
|
|
11055
11070
|
consolePatcher.cleanup();
|
|
11056
|
-
coreEvents.off(
|
|
11071
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11057
11072
|
}
|
|
11058
11073
|
if (errorToHandle) {
|
|
11059
11074
|
handleError(errorToHandle, config);
|
|
@@ -13524,12 +13539,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13524
13539
|
this.clientCapabilities = args.clientCapabilities;
|
|
13525
13540
|
const authMethods = [
|
|
13526
13541
|
{
|
|
13527
|
-
id:
|
|
13542
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
13528
13543
|
name: "Log in with Google",
|
|
13529
13544
|
description: "Log in with your Google account"
|
|
13530
13545
|
},
|
|
13531
13546
|
{
|
|
13532
|
-
id:
|
|
13547
|
+
id: AuthType.USE_GEMINI,
|
|
13533
13548
|
name: "Gemini API key",
|
|
13534
13549
|
description: "Use an API key with Gemini Developer API",
|
|
13535
13550
|
_meta: {
|
|
@@ -13539,12 +13554,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13539
13554
|
}
|
|
13540
13555
|
},
|
|
13541
13556
|
{
|
|
13542
|
-
id:
|
|
13557
|
+
id: AuthType.USE_VERTEX_AI,
|
|
13543
13558
|
name: "Vertex AI",
|
|
13544
13559
|
description: "Use an API key with Vertex AI GenAI API"
|
|
13545
13560
|
},
|
|
13546
13561
|
{
|
|
13547
|
-
id:
|
|
13562
|
+
id: AuthType.GATEWAY,
|
|
13548
13563
|
name: "AI API Gateway",
|
|
13549
13564
|
description: "Use a custom AI API Gateway",
|
|
13550
13565
|
_meta: {
|
|
@@ -13639,7 +13654,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13639
13654
|
mcpServers,
|
|
13640
13655
|
loadedSettings
|
|
13641
13656
|
);
|
|
13642
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
13657
|
+
const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
|
|
13643
13658
|
let isAuthenticated = false;
|
|
13644
13659
|
let authErrorMessage = "";
|
|
13645
13660
|
try {
|
|
@@ -13651,7 +13666,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
13651
13666
|
);
|
|
13652
13667
|
isAuthenticated = true;
|
|
13653
13668
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
13654
|
-
if (authType ===
|
|
13669
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
13655
13670
|
isAuthenticated = false;
|
|
13656
13671
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
13657
13672
|
}
|
|
@@ -13961,7 +13976,7 @@ ${thought.description}`;
|
|
|
13961
13976
|
await this.sendUpdate({
|
|
13962
13977
|
sessionUpdate: "tool_call",
|
|
13963
13978
|
toolCallId: toolCall.id,
|
|
13964
|
-
status: toolCall.status ===
|
|
13979
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
13965
13980
|
title: toolCall.displayName || toolCall.name,
|
|
13966
13981
|
content: toolCallContent,
|
|
13967
13982
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14014,7 +14029,7 @@ ${thought.description}`;
|
|
|
14014
14029
|
while (nextMessage !== null) {
|
|
14015
14030
|
if (pendingSend.signal.aborted) {
|
|
14016
14031
|
chat.addHistory(nextMessage);
|
|
14017
|
-
return { stopReason:
|
|
14032
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14018
14033
|
}
|
|
14019
14034
|
const functionCalls = [];
|
|
14020
14035
|
try {
|
|
@@ -14034,7 +14049,7 @@ ${thought.description}`;
|
|
|
14034
14049
|
nextMessage?.parts ?? [],
|
|
14035
14050
|
promptId,
|
|
14036
14051
|
pendingSend.signal,
|
|
14037
|
-
|
|
14052
|
+
LlmRole.MAIN
|
|
14038
14053
|
);
|
|
14039
14054
|
nextMessage = null;
|
|
14040
14055
|
let turnInputTokens = 0;
|
|
@@ -14042,16 +14057,16 @@ ${thought.description}`;
|
|
|
14042
14057
|
let turnModelId = model;
|
|
14043
14058
|
for await (const resp of responseStream) {
|
|
14044
14059
|
if (pendingSend.signal.aborted) {
|
|
14045
|
-
return { stopReason:
|
|
14060
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14046
14061
|
}
|
|
14047
|
-
if (resp.type ===
|
|
14062
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
|
|
14048
14063
|
turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
|
|
14049
14064
|
turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
|
|
14050
14065
|
if (resp.value.modelVersion) {
|
|
14051
14066
|
turnModelId = resp.value.modelVersion;
|
|
14052
14067
|
}
|
|
14053
14068
|
}
|
|
14054
|
-
if (resp.type ===
|
|
14069
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
14055
14070
|
const candidate = resp.value.candidates[0];
|
|
14056
14071
|
for (const part of candidate.content?.parts ?? []) {
|
|
14057
14072
|
if (!part.text) {
|
|
@@ -14067,7 +14082,7 @@ ${thought.description}`;
|
|
|
14067
14082
|
});
|
|
14068
14083
|
}
|
|
14069
14084
|
}
|
|
14070
|
-
if (resp.type ===
|
|
14085
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
|
|
14071
14086
|
functionCalls.push(...resp.value.functionCalls);
|
|
14072
14087
|
}
|
|
14073
14088
|
}
|
|
@@ -14083,7 +14098,7 @@ ${thought.description}`;
|
|
|
14083
14098
|
modelUsageMap.set(turnModelId, existing);
|
|
14084
14099
|
}
|
|
14085
14100
|
if (pendingSend.signal.aborted) {
|
|
14086
|
-
return { stopReason:
|
|
14101
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14087
14102
|
}
|
|
14088
14103
|
} catch (error) {
|
|
14089
14104
|
if (getErrorStatus(error) === 429) {
|
|
@@ -14093,7 +14108,7 @@ ${thought.description}`;
|
|
|
14093
14108
|
);
|
|
14094
14109
|
}
|
|
14095
14110
|
if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
|
|
14096
|
-
return { stopReason:
|
|
14111
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
14097
14112
|
}
|
|
14098
14113
|
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")) {
|
|
14099
14114
|
return {
|
|
@@ -14257,7 +14272,7 @@ ${thought.description}`;
|
|
|
14257
14272
|
const output = RequestPermissionResponseSchema.parse(
|
|
14258
14273
|
await this.connection.requestPermission(params)
|
|
14259
14274
|
);
|
|
14260
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14275
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14261
14276
|
await confirmationDetails.onConfirm(outcome);
|
|
14262
14277
|
await updatePolicy(
|
|
14263
14278
|
tool,
|
|
@@ -14268,16 +14283,16 @@ ${thought.description}`;
|
|
|
14268
14283
|
invocation
|
|
14269
14284
|
);
|
|
14270
14285
|
switch (outcome) {
|
|
14271
|
-
case
|
|
14286
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14272
14287
|
return errorResponse(
|
|
14273
14288
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14274
14289
|
);
|
|
14275
|
-
case
|
|
14276
|
-
case
|
|
14277
|
-
case
|
|
14278
|
-
case
|
|
14279
|
-
case
|
|
14280
|
-
case
|
|
14290
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
14291
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
14292
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
14293
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
14294
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
14295
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14281
14296
|
break;
|
|
14282
14297
|
default: {
|
|
14283
14298
|
const resultOutcome = outcome;
|
|
@@ -14325,7 +14340,7 @@ ${thought.description}`;
|
|
|
14325
14340
|
);
|
|
14326
14341
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14327
14342
|
{
|
|
14328
|
-
status:
|
|
14343
|
+
status: CoreToolCallStatus.Success,
|
|
14329
14344
|
request: {
|
|
14330
14345
|
callId,
|
|
14331
14346
|
name: fc.name,
|
|
@@ -14370,7 +14385,7 @@ ${thought.description}`;
|
|
|
14370
14385
|
});
|
|
14371
14386
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14372
14387
|
{
|
|
14373
|
-
status:
|
|
14388
|
+
status: CoreToolCallStatus.Error,
|
|
14374
14389
|
request: {
|
|
14375
14390
|
callId,
|
|
14376
14391
|
name: fc.name,
|
|
@@ -14485,12 +14500,12 @@ ${thought.description}`;
|
|
|
14485
14500
|
sessionId: this.id,
|
|
14486
14501
|
options: [
|
|
14487
14502
|
{
|
|
14488
|
-
optionId:
|
|
14503
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14489
14504
|
name: "Allow once",
|
|
14490
14505
|
kind: "allow_once"
|
|
14491
14506
|
},
|
|
14492
14507
|
{
|
|
14493
|
-
optionId:
|
|
14508
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14494
14509
|
name: "Deny",
|
|
14495
14510
|
kind: "reject_once"
|
|
14496
14511
|
}
|
|
@@ -14515,8 +14530,8 @@ ${thought.description}`;
|
|
|
14515
14530
|
const output = RequestPermissionResponseSchema.parse(
|
|
14516
14531
|
await this.connection.requestPermission(params)
|
|
14517
14532
|
);
|
|
14518
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14519
|
-
if (outcome ===
|
|
14533
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14534
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14520
14535
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14521
14536
|
validationError = null;
|
|
14522
14537
|
} else {
|
|
@@ -14893,12 +14908,12 @@ function toToolCallContent(toolResult) {
|
|
|
14893
14908
|
}
|
|
14894
14909
|
var basicPermissionOptions = [
|
|
14895
14910
|
{
|
|
14896
|
-
optionId:
|
|
14911
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14897
14912
|
name: "Allow",
|
|
14898
14913
|
kind: "allow_once"
|
|
14899
14914
|
},
|
|
14900
14915
|
{
|
|
14901
|
-
optionId:
|
|
14916
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14902
14917
|
name: "Reject",
|
|
14903
14918
|
kind: "reject_once"
|
|
14904
14919
|
}
|
|
@@ -14910,13 +14925,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14910
14925
|
switch (confirmation.type) {
|
|
14911
14926
|
case "edit":
|
|
14912
14927
|
options.push({
|
|
14913
|
-
optionId:
|
|
14928
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14914
14929
|
name: "Allow for this session",
|
|
14915
14930
|
kind: "allow_always"
|
|
14916
14931
|
});
|
|
14917
14932
|
if (enablePermanentToolApproval) {
|
|
14918
14933
|
options.push({
|
|
14919
|
-
optionId:
|
|
14934
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14920
14935
|
name: "Allow for this file in all future sessions",
|
|
14921
14936
|
kind: "allow_always"
|
|
14922
14937
|
});
|
|
@@ -14924,13 +14939,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14924
14939
|
break;
|
|
14925
14940
|
case "exec":
|
|
14926
14941
|
options.push({
|
|
14927
|
-
optionId:
|
|
14942
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14928
14943
|
name: "Allow for this session",
|
|
14929
14944
|
kind: "allow_always"
|
|
14930
14945
|
});
|
|
14931
14946
|
if (enablePermanentToolApproval) {
|
|
14932
14947
|
options.push({
|
|
14933
|
-
optionId:
|
|
14948
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14934
14949
|
name: "Allow this command for all future sessions",
|
|
14935
14950
|
kind: "allow_always"
|
|
14936
14951
|
});
|
|
@@ -14939,19 +14954,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14939
14954
|
case "mcp":
|
|
14940
14955
|
options.push(
|
|
14941
14956
|
{
|
|
14942
|
-
optionId:
|
|
14957
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
14943
14958
|
name: "Allow all server tools for this session",
|
|
14944
14959
|
kind: "allow_always"
|
|
14945
14960
|
},
|
|
14946
14961
|
{
|
|
14947
|
-
optionId:
|
|
14962
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
14948
14963
|
name: "Allow tool for this session",
|
|
14949
14964
|
kind: "allow_always"
|
|
14950
14965
|
}
|
|
14951
14966
|
);
|
|
14952
14967
|
if (enablePermanentToolApproval) {
|
|
14953
14968
|
options.push({
|
|
14954
|
-
optionId:
|
|
14969
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14955
14970
|
name: "Allow tool for all future sessions",
|
|
14956
14971
|
kind: "allow_always"
|
|
14957
14972
|
});
|
|
@@ -14959,13 +14974,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14959
14974
|
break;
|
|
14960
14975
|
case "info":
|
|
14961
14976
|
options.push({
|
|
14962
|
-
optionId:
|
|
14977
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14963
14978
|
name: "Allow for this session",
|
|
14964
14979
|
kind: "allow_always"
|
|
14965
14980
|
});
|
|
14966
14981
|
if (enablePermanentToolApproval) {
|
|
14967
14982
|
options.push({
|
|
14968
|
-
optionId:
|
|
14983
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14969
14984
|
name: "Allow for all future sessions",
|
|
14970
14985
|
kind: "allow_always"
|
|
14971
14986
|
});
|
|
@@ -14997,21 +15012,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14997
15012
|
}
|
|
14998
15013
|
function toAcpToolKind(kind) {
|
|
14999
15014
|
switch (kind) {
|
|
15000
|
-
case
|
|
15001
|
-
case
|
|
15002
|
-
case
|
|
15003
|
-
case
|
|
15004
|
-
case
|
|
15005
|
-
case
|
|
15006
|
-
case
|
|
15007
|
-
case
|
|
15008
|
-
case
|
|
15009
|
-
case
|
|
15015
|
+
case Kind.Read:
|
|
15016
|
+
case Kind.Edit:
|
|
15017
|
+
case Kind.Execute:
|
|
15018
|
+
case Kind.Search:
|
|
15019
|
+
case Kind.Delete:
|
|
15020
|
+
case Kind.Move:
|
|
15021
|
+
case Kind.Think:
|
|
15022
|
+
case Kind.Fetch:
|
|
15023
|
+
case Kind.SwitchMode:
|
|
15024
|
+
case Kind.Other:
|
|
15010
15025
|
return kind;
|
|
15011
|
-
case
|
|
15026
|
+
case Kind.Agent:
|
|
15012
15027
|
return "think";
|
|
15013
|
-
case
|
|
15014
|
-
case
|
|
15028
|
+
case Kind.Plan:
|
|
15029
|
+
case Kind.Communicate:
|
|
15015
15030
|
default:
|
|
15016
15031
|
return "other";
|
|
15017
15032
|
}
|
|
@@ -15019,24 +15034,24 @@ function toAcpToolKind(kind) {
|
|
|
15019
15034
|
function buildAvailableModes(isPlanEnabled) {
|
|
15020
15035
|
const modes = [
|
|
15021
15036
|
{
|
|
15022
|
-
id:
|
|
15037
|
+
id: ApprovalMode.DEFAULT,
|
|
15023
15038
|
name: "Default",
|
|
15024
15039
|
description: "Prompts for approval"
|
|
15025
15040
|
},
|
|
15026
15041
|
{
|
|
15027
|
-
id:
|
|
15042
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
15028
15043
|
name: "Auto Edit",
|
|
15029
15044
|
description: "Auto-approves edit tools"
|
|
15030
15045
|
},
|
|
15031
15046
|
{
|
|
15032
|
-
id:
|
|
15047
|
+
id: ApprovalMode.YOLO,
|
|
15033
15048
|
name: "YOLO",
|
|
15034
15049
|
description: "Auto-approves all tools"
|
|
15035
15050
|
}
|
|
15036
15051
|
];
|
|
15037
15052
|
if (isPlanEnabled) {
|
|
15038
15053
|
modes.push({
|
|
15039
|
-
id:
|
|
15054
|
+
id: ApprovalMode.PLAN,
|
|
15040
15055
|
name: "Plan",
|
|
15041
15056
|
description: "Read-only mode"
|
|
15042
15057
|
});
|
|
@@ -15049,7 +15064,7 @@ function buildAvailableModels(config, settings) {
|
|
|
15049
15064
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
15050
15065
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
15051
15066
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
15052
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
15067
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
15053
15068
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
15054
15069
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
15055
15070
|
useGemini3_1: useGemini31,
|
|
@@ -15147,7 +15162,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15147
15162
|
}
|
|
15148
15163
|
return authType;
|
|
15149
15164
|
} catch (error) {
|
|
15150
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15165
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
15151
15166
|
handleError(
|
|
15152
15167
|
error instanceof Error ? error : new Error(String(error)),
|
|
15153
15168
|
nonInteractiveConfig,
|
|
@@ -15343,10 +15358,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15343
15358
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15344
15359
|
}
|
|
15345
15360
|
start() {
|
|
15346
|
-
coreEvents.on(
|
|
15361
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15347
15362
|
}
|
|
15348
15363
|
stop() {
|
|
15349
|
-
coreEvents.off(
|
|
15364
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15350
15365
|
if (this.flushTimeout) {
|
|
15351
15366
|
clearTimeout(this.flushTimeout);
|
|
15352
15367
|
this.flushTimeout = null;
|
|
@@ -15557,7 +15572,7 @@ async function resolveSessionId(resumeArg) {
|
|
|
15557
15572
|
}
|
|
15558
15573
|
}
|
|
15559
15574
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15560
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15575
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-3UQTFU2M.js");
|
|
15561
15576
|
await doStartUI(
|
|
15562
15577
|
config,
|
|
15563
15578
|
settings,
|
|
@@ -15656,12 +15671,12 @@ async function main() {
|
|
|
15656
15671
|
dns.setDefaultResultOrder(
|
|
15657
15672
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15658
15673
|
);
|
|
15659
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15674
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
15660
15675
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15661
15676
|
settings.setValue(
|
|
15662
15677
|
"User" /* User */,
|
|
15663
15678
|
"security.auth.selectedType",
|
|
15664
|
-
|
|
15679
|
+
AuthType.COMPUTE_ADC
|
|
15665
15680
|
);
|
|
15666
15681
|
}
|
|
15667
15682
|
}
|
|
@@ -15759,7 +15774,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15759
15774
|
await config.storage.initialize();
|
|
15760
15775
|
adminControlsListner.setConfig(config);
|
|
15761
15776
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15762
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
15777
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-65PTC72C.js");
|
|
15763
15778
|
setupInitialActivityLogger(config);
|
|
15764
15779
|
}
|
|
15765
15780
|
registerTelemetryConfig(config);
|
|
@@ -15767,7 +15782,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15767
15782
|
const messageBus = config.getMessageBus();
|
|
15768
15783
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
15769
15784
|
registerCleanup(async () => {
|
|
15770
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
15785
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
15771
15786
|
});
|
|
15772
15787
|
cleanupExpiredSessions(config, settings.merged).catch((e) => {
|
|
15773
15788
|
debugLogger.error("Failed to cleanup expired sessions:", e);
|
|
@@ -15815,7 +15830,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15815
15830
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
15816
15831
|
const initializationResult = await initializeApp(config, settings);
|
|
15817
15832
|
initAppHandle?.end();
|
|
15818
|
-
import("./liteRtServerManager-
|
|
15833
|
+
import("./liteRtServerManager-OARJ4EUZ.js").then(({ LiteRtServerManager }) => {
|
|
15819
15834
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
15820
15835
|
if (!mergedGemma) return;
|
|
15821
15836
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -15825,7 +15840,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15825
15840
|
autoStartServer: userGemma?.autoStartServer
|
|
15826
15841
|
});
|
|
15827
15842
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
15828
|
-
if (settings.merged.security.auth.selectedType ===
|
|
15843
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
15829
15844
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
15830
15845
|
}
|
|
15831
15846
|
if (config.getAcpMode()) {
|
|
@@ -15841,7 +15856,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15841
15856
|
...rawStartupWarnings.map((message) => ({
|
|
15842
15857
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
15843
15858
|
message,
|
|
15844
|
-
priority:
|
|
15859
|
+
priority: WarningPriority.High
|
|
15845
15860
|
})),
|
|
15846
15861
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
15847
15862
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -15873,7 +15888,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15873
15888
|
${input}` : stdinData;
|
|
15874
15889
|
}
|
|
15875
15890
|
}
|
|
15876
|
-
const sessionStartSource = resumedSessionData ?
|
|
15891
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
15877
15892
|
const hookSystem = config?.getHookSystem();
|
|
15878
15893
|
if (hookSystem) {
|
|
15879
15894
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -15930,16 +15945,16 @@ ${input}` : wrappedContext;
|
|
|
15930
15945
|
}
|
|
15931
15946
|
}
|
|
15932
15947
|
function initializeOutputListenersAndFlush() {
|
|
15933
|
-
if (coreEvents.listenerCount(
|
|
15934
|
-
coreEvents.on(
|
|
15948
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
15949
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
15935
15950
|
if (payload.isStderr) {
|
|
15936
15951
|
writeToStderr(payload.chunk, payload.encoding);
|
|
15937
15952
|
} else {
|
|
15938
15953
|
writeToStdout(payload.chunk, payload.encoding);
|
|
15939
15954
|
}
|
|
15940
15955
|
});
|
|
15941
|
-
if (coreEvents.listenerCount(
|
|
15942
|
-
coreEvents.on(
|
|
15956
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
15957
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
15943
15958
|
if (payload.type === "error" || payload.type === "warn") {
|
|
15944
15959
|
writeToStderr(payload.content);
|
|
15945
15960
|
} else {
|
|
@@ -15947,8 +15962,8 @@ function initializeOutputListenersAndFlush() {
|
|
|
15947
15962
|
}
|
|
15948
15963
|
});
|
|
15949
15964
|
}
|
|
15950
|
-
if (coreEvents.listenerCount(
|
|
15951
|
-
coreEvents.on(
|
|
15965
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
15966
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
15952
15967
|
if (payload.severity === "error" || payload.severity === "warning") {
|
|
15953
15968
|
writeToStderr(payload.message);
|
|
15954
15969
|
} else {
|