@google/gemini-cli 0.44.0 → 0.45.0-nightly.20260527.g41c9260ca
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-FOOWNGAB.js → chunk-2RAPXSOV.js} +1 -1
- package/bundle/{chunk-TN4WXWFM.js → chunk-5SQYZFP6.js} +3 -3
- package/bundle/{chunk-BOYNQXWU.js → chunk-6SMPX7UU.js} +2 -2
- package/bundle/{chunk-QUZ62PY7.js → chunk-6VVFXG4V.js} +2 -2
- package/bundle/{chunk-DALZZYPQ.js → chunk-7EPRHON5.js} +1 -1
- package/bundle/{chunk-XTG4JBIR.js → chunk-AAGSPORB.js} +1 -1
- package/bundle/{chunk-BE42OOYM.js → chunk-EVYFBIGQ.js} +377 -297
- package/bundle/{chunk-5CABHQOE.js → chunk-FHQHQ6DS.js} +1 -1
- package/bundle/{chunk-ONQVFEHS.js → chunk-GIZR3U4X.js} +1 -1
- package/bundle/{chunk-CBT4PN4R.js → chunk-H4PA4O33.js} +8 -8
- package/bundle/{chunk-M3EDSAPV.js → chunk-I6UPFWEQ.js} +1 -1
- package/bundle/{chunk-TW47A6FW.js → chunk-IGGUR3YU.js} +7827 -14242
- package/bundle/{chunk-VUERI7WB.js → chunk-K4FVPC4T.js} +8 -8
- package/bundle/{chunk-EKUU3KNX.js → chunk-KSJ6OVGZ.js} +1 -1
- package/bundle/{chunk-OLBOCZ5F.js → chunk-P4IX67II.js} +68 -55
- package/bundle/{chunk-6W2Z7FTE.js → chunk-P4YCK66H.js} +3 -3
- package/bundle/{chunk-SIXPHUVZ.js → chunk-PN5LGMOT.js} +423 -330
- package/bundle/{chunk-N4SGO3W6.js → chunk-RJZUBUMQ.js} +2 -2
- package/bundle/{chunk-3K52543M.js → chunk-SJJUCWYW.js} +56 -2
- package/bundle/{chunk-G2L4VCSN.js → chunk-SS6WZNE5.js} +9 -8
- package/bundle/{chunk-LM6XTSWQ.js → chunk-T5BJFXUT.js} +56 -2
- package/bundle/chunk-TKOMYARC.js +81685 -0
- package/bundle/{chunk-OTLI6LZ3.js → chunk-TREYQA4O.js} +1 -1
- package/bundle/chunk-U3JK5HRW.js +394429 -0
- package/bundle/chunk-UHMKT6SK.js +154 -0
- package/bundle/chunk-UJJ75A5I.js +398 -0
- package/bundle/{chunk-7KIX5G5D.js → chunk-UMBPNYQU.js} +3 -3
- package/bundle/{chunk-7ZH745HC.js → chunk-VC3YLUFW.js} +63 -6
- package/bundle/chunk-VCSWELYF.js +512 -0
- package/bundle/chunk-VG6I25WK.js +1571 -0
- package/bundle/chunk-WU3YM7M5.js +118 -0
- package/bundle/chunk-YHUFSS4V.js +17320 -0
- package/bundle/{cleanup-PDT5ATZB.js → cleanup-DAEFNP5D.js} +2 -2
- package/bundle/{cleanup-SF7XW2P3.js → cleanup-QLHTBBSJ.js} +2 -2
- package/bundle/{cleanup-UW3DZLXP.js → cleanup-SWVNBESF.js} +2 -2
- package/bundle/cleanup-V5HN45VV.js +32 -0
- package/bundle/{core-LN2S4IOX.js → core-RLNQPUYW.js} +3 -7
- package/bundle/{devtoolsService-64QE2V7E.js → devtoolsService-F5XNH3LW.js} +2 -2
- package/bundle/{devtoolsService-ZC7E4R2A.js → devtoolsService-KSXJ7ZBM.js} +4 -3
- package/bundle/devtoolsService-N5XYKGOS.js +856 -0
- package/bundle/{devtoolsService-DUEWJW52.js → devtoolsService-Y4US3JKZ.js} +2 -2
- package/bundle/{dist-J4RONYVV.js → dist-CMC3RCEI.js} +3 -7
- package/bundle/{core-GW6VAL53.js → dist-XPJBSOYP.js} +3 -7
- package/bundle/dist-YCN22NGW.js +2134 -0
- package/bundle/docs/changelogs/index.md +15 -0
- package/bundle/docs/changelogs/latest.md +198 -262
- package/bundle/docs/changelogs/preview.md +202 -181
- package/bundle/docs/reference/configuration.md +24 -29
- package/bundle/{gemini-SSQIKHR2.js → gemini-3FB3K6RR.js} +41 -30
- package/bundle/{gemini-CMBH5YG6.js → gemini-AAR7OIGT.js} +239 -212
- package/bundle/{gemini-CSPRLMWN.js → gemini-BKWLRTMK.js} +41 -30
- package/bundle/gemini-JVLQYJ2G.js +16406 -0
- package/bundle/gemini.js +15 -10
- package/bundle/{interactiveCli-RDMZS6KL.js → interactiveCli-7AF74ES4.js} +33 -57
- package/bundle/{interactiveCli-TOEU7LIO.js → interactiveCli-LEZF6KPA.js} +33 -57
- package/bundle/{interactiveCli-Q2A2JFLA.js → interactiveCli-PCGUDXG4.js} +339 -344
- package/bundle/interactiveCli-QC3CJANH.js +34726 -0
- package/bundle/{liteRtServerManager-ASKAVAO7.js → liteRtServerManager-2ZSZW3IA.js} +4 -4
- package/bundle/{liteRtServerManager-6BWTXMUI.js → liteRtServerManager-A3Z4AS3V.js} +4 -4
- package/bundle/{liteRtServerManager-ZS3BCW53.js → liteRtServerManager-EDFTLOS6.js} +4 -4
- package/bundle/liteRtServerManager-YPEZDSGQ.js +65 -0
- package/bundle/{oauth2-provider-SYRZDGL5.js → oauth2-provider-5ZA5OIVB.js} +1 -1
- package/bundle/{oauth2-provider-FGI6QDEM.js → oauth2-provider-O4BUOOYR.js} +1 -1
- package/bundle/{oauth2-provider-7JOVY727.js → oauth2-provider-O635QVSF.js} +38 -72
- package/bundle/oauth2-provider-WIBCYDQG.js +235 -0
- package/bundle/{start-KJCIH3GX.js → start-7TRTTGGV.js} +6 -6
- package/bundle/{start-TU5WNP77.js → start-A4YSRLHR.js} +6 -6
- package/bundle/{start-47OYCVVA.js → start-HFZVWJGC.js} +6 -6
- package/bundle/start-KH23TWSE.js +18 -0
- package/package.json +1 -1
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-TKOMYARC.js";
|
|
45
45
|
import {
|
|
46
46
|
appEvents
|
|
47
47
|
} from "./chunk-5PS3AYFU.js";
|
|
48
48
|
import {
|
|
49
49
|
startCommand,
|
|
50
50
|
startServer
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-UMBPNYQU.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-TREYQA4O.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_PORT,
|
|
58
58
|
GEMMA_MODEL_NAME,
|
|
@@ -86,11 +86,11 @@ import {
|
|
|
86
86
|
readServerProcessInfo,
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-VC3YLUFW.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-6SMPX7UU.js";
|
|
93
|
+
import "./chunk-KSJ6OVGZ.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,12 +99,15 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-GIZR3U4X.js";
|
|
103
103
|
import {
|
|
104
104
|
ASK_USER_TOOL_NAME,
|
|
105
|
+
ApprovalMode,
|
|
105
106
|
AuthType,
|
|
106
107
|
Client,
|
|
107
108
|
Config,
|
|
109
|
+
CoreEvent,
|
|
110
|
+
CoreToolCallStatus,
|
|
108
111
|
DEFAULT_CONTEXT_FILENAME,
|
|
109
112
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
110
113
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -126,32 +129,45 @@ import {
|
|
|
126
129
|
FolderTrustDiscoveryService,
|
|
127
130
|
GEMINI_DIR,
|
|
128
131
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
132
|
+
GeminiEventType,
|
|
129
133
|
IdeClient,
|
|
134
|
+
IntegrityStatus,
|
|
130
135
|
InvalidStreamError,
|
|
131
136
|
JsonFormatter,
|
|
137
|
+
JsonStreamEventType,
|
|
138
|
+
Kind,
|
|
132
139
|
LegacyAgentSession,
|
|
133
140
|
Logger,
|
|
134
141
|
MCPServerConfig,
|
|
142
|
+
MCPServerStatus,
|
|
143
|
+
MessageBusType,
|
|
144
|
+
OutputFormat,
|
|
135
145
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
136
|
-
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
137
146
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
147
|
+
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
138
148
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
139
149
|
PREVIEW_GEMINI_MODEL,
|
|
150
|
+
PolicyDecision,
|
|
140
151
|
PolicyIntegrityManager,
|
|
141
152
|
REFERENCE_CONTENT_START,
|
|
142
153
|
ROOT_SCHEDULER_ID,
|
|
143
154
|
ReadManyFilesTool,
|
|
144
155
|
Scheduler,
|
|
156
|
+
SessionEndReason,
|
|
157
|
+
SessionStartSource,
|
|
145
158
|
ShellExecutionService,
|
|
146
159
|
SimpleExtensionLoader,
|
|
147
160
|
Storage,
|
|
148
161
|
StreamJsonFormatter,
|
|
149
162
|
ToolCallEvent,
|
|
150
163
|
ToolConfirmationOutcome,
|
|
164
|
+
ToolErrorType,
|
|
165
|
+
TrustLevel,
|
|
151
166
|
UserAccountManager,
|
|
152
167
|
UserPromptEvent,
|
|
153
168
|
ValidationCancelledError,
|
|
154
169
|
ValidationRequiredError,
|
|
170
|
+
WarningPriority,
|
|
155
171
|
applyAdminAllowlist,
|
|
156
172
|
applyRequiredServers,
|
|
157
173
|
clearCachedCredentialFile,
|
|
@@ -231,7 +247,7 @@ import {
|
|
|
231
247
|
updatePolicy,
|
|
232
248
|
writeToStderr,
|
|
233
249
|
writeToStdout
|
|
234
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-EVYFBIGQ.js";
|
|
235
251
|
import "./chunk-6HI7VNOG.js";
|
|
236
252
|
import "./chunk-TUDYL3X4.js";
|
|
237
253
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5361,7 +5377,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5361
5377
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5362
5378
|
const isStdio = !!config.command;
|
|
5363
5379
|
if (isStdio && !isTrusted) {
|
|
5364
|
-
return
|
|
5380
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5365
5381
|
}
|
|
5366
5382
|
const client = new Client({
|
|
5367
5383
|
name: "mcp-test-client",
|
|
@@ -5397,7 +5413,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5397
5413
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5398
5414
|
} catch {
|
|
5399
5415
|
await client.close();
|
|
5400
|
-
return
|
|
5416
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5401
5417
|
}
|
|
5402
5418
|
try {
|
|
5403
5419
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5411,28 +5427,28 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5411
5427
|
);
|
|
5412
5428
|
}
|
|
5413
5429
|
await client.close();
|
|
5414
|
-
return
|
|
5430
|
+
return MCPServerStatus.CONNECTED;
|
|
5415
5431
|
} catch {
|
|
5416
5432
|
await transport.close();
|
|
5417
|
-
return
|
|
5433
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5418
5434
|
}
|
|
5419
5435
|
}
|
|
5420
|
-
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
5436
|
+
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
5421
5437
|
const mcpEnablementManager = McpServerEnablementManager.getInstance();
|
|
5422
5438
|
const loadResult = await canLoadServer(serverName, {
|
|
5423
5439
|
adminMcpEnabled: activeSettings.admin?.mcp?.enabled ?? true,
|
|
5424
|
-
allowedList:
|
|
5425
|
-
excludedList:
|
|
5440
|
+
allowedList: consolidatedAllowed,
|
|
5441
|
+
excludedList: consolidatedExcluded.length > 0 ? consolidatedExcluded : void 0,
|
|
5426
5442
|
enablement: mcpEnablementManager.getEnablementCallbacks()
|
|
5427
5443
|
});
|
|
5428
5444
|
if (!loadResult.allowed) {
|
|
5429
5445
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5430
|
-
return
|
|
5446
|
+
return MCPServerStatus.BLOCKED;
|
|
5431
5447
|
}
|
|
5432
|
-
return
|
|
5448
|
+
return MCPServerStatus.DISABLED;
|
|
5433
5449
|
}
|
|
5434
5450
|
if (!isTrusted) {
|
|
5435
|
-
return
|
|
5451
|
+
return MCPServerStatus.DISABLED;
|
|
5436
5452
|
}
|
|
5437
5453
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5438
5454
|
}
|
|
@@ -5462,6 +5478,8 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5462
5478
|
)
|
|
5463
5479
|
);
|
|
5464
5480
|
}
|
|
5481
|
+
const consolidatedExcluded = loadedSettings.getConsolidatedExcludedMcpServers();
|
|
5482
|
+
const consolidatedAllowed = loadedSettings.getConsolidatedAllowedMcpServers();
|
|
5465
5483
|
debugLogger.log("Configured MCP servers:\n");
|
|
5466
5484
|
for (const serverName of serverNames) {
|
|
5467
5485
|
const server = mcpServers[serverName];
|
|
@@ -5469,28 +5487,30 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5469
5487
|
serverName,
|
|
5470
5488
|
server,
|
|
5471
5489
|
loadedSettings.isTrusted,
|
|
5472
|
-
activeSettings
|
|
5490
|
+
activeSettings,
|
|
5491
|
+
consolidatedExcluded,
|
|
5492
|
+
consolidatedAllowed
|
|
5473
5493
|
);
|
|
5474
5494
|
let statusIndicator = "";
|
|
5475
5495
|
let statusText = "";
|
|
5476
5496
|
switch (status) {
|
|
5477
|
-
case
|
|
5497
|
+
case MCPServerStatus.CONNECTED:
|
|
5478
5498
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5479
5499
|
statusText = "Connected";
|
|
5480
5500
|
break;
|
|
5481
|
-
case
|
|
5501
|
+
case MCPServerStatus.CONNECTING:
|
|
5482
5502
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5483
5503
|
statusText = "Connecting";
|
|
5484
5504
|
break;
|
|
5485
|
-
case
|
|
5505
|
+
case MCPServerStatus.BLOCKED:
|
|
5486
5506
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5487
5507
|
statusText = "Blocked";
|
|
5488
5508
|
break;
|
|
5489
|
-
case
|
|
5509
|
+
case MCPServerStatus.DISABLED:
|
|
5490
5510
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5491
5511
|
statusText = "Disabled";
|
|
5492
5512
|
break;
|
|
5493
|
-
case
|
|
5513
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5494
5514
|
default:
|
|
5495
5515
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5496
5516
|
statusText = "Disconnected";
|
|
@@ -5776,7 +5796,7 @@ async function handleInstall(args) {
|
|
|
5776
5796
|
);
|
|
5777
5797
|
if (confirmed) {
|
|
5778
5798
|
const trustedFolders = loadTrustedFolders();
|
|
5779
|
-
await trustedFolders.setValue(realPath,
|
|
5799
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5780
5800
|
} else {
|
|
5781
5801
|
throw new Error(
|
|
5782
5802
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7821,7 +7841,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7821
7841
|
}
|
|
7822
7842
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7823
7843
|
const packageJson = await getPackageJson(__dirname3);
|
|
7824
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
7844
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.45.0-nightly.20260527.g41c9260ca" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7825
7845
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7826
7846
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7827
7847
|
}
|
|
@@ -7880,9 +7900,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7880
7900
|
cwd,
|
|
7881
7901
|
potentialWorkspacePoliciesDir
|
|
7882
7902
|
);
|
|
7883
|
-
if (integrityResult.status ===
|
|
7903
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7884
7904
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7885
|
-
} else if (integrityResult.status ===
|
|
7905
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7886
7906
|
workspacePoliciesDir = void 0;
|
|
7887
7907
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7888
7908
|
policyUpdateConfirmationRequest = {
|
|
@@ -8236,7 +8256,12 @@ function isDebugMode(argv) {
|
|
|
8236
8256
|
);
|
|
8237
8257
|
}
|
|
8238
8258
|
async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
8239
|
-
const {
|
|
8259
|
+
const {
|
|
8260
|
+
cwd = process3.cwd(),
|
|
8261
|
+
projectHooks,
|
|
8262
|
+
skipExtensions = false,
|
|
8263
|
+
loadedSettings
|
|
8264
|
+
} = options;
|
|
8240
8265
|
const debugMode = isDebugMode(argv);
|
|
8241
8266
|
const worktreeSettings = options.worktreeSettings ?? await resolveWorktreeSettings(cwd);
|
|
8242
8267
|
if (argv.sandbox) {
|
|
@@ -8305,23 +8330,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8305
8330
|
if (rawApprovalMode) {
|
|
8306
8331
|
switch (rawApprovalMode) {
|
|
8307
8332
|
case "yolo":
|
|
8308
|
-
approvalMode =
|
|
8333
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8309
8334
|
break;
|
|
8310
8335
|
case "auto_edit":
|
|
8311
|
-
approvalMode =
|
|
8336
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8312
8337
|
break;
|
|
8313
8338
|
case "plan":
|
|
8314
8339
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8315
8340
|
debugLogger.warn(
|
|
8316
8341
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8317
8342
|
);
|
|
8318
|
-
approvalMode =
|
|
8343
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8319
8344
|
} else {
|
|
8320
|
-
approvalMode =
|
|
8345
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8321
8346
|
}
|
|
8322
8347
|
break;
|
|
8323
8348
|
case "default":
|
|
8324
|
-
approvalMode =
|
|
8349
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8325
8350
|
break;
|
|
8326
8351
|
default:
|
|
8327
8352
|
throw new Error(
|
|
@@ -8329,10 +8354,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8329
8354
|
);
|
|
8330
8355
|
}
|
|
8331
8356
|
} else {
|
|
8332
|
-
approvalMode =
|
|
8357
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8333
8358
|
}
|
|
8334
8359
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8335
|
-
if (approvalMode ===
|
|
8360
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8336
8361
|
if (settings.admin?.secureModeEnabled) {
|
|
8337
8362
|
debugLogger.error(
|
|
8338
8363
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8350,16 +8375,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8350
8375
|
)
|
|
8351
8376
|
);
|
|
8352
8377
|
}
|
|
8353
|
-
} else if (approvalMode ===
|
|
8378
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8354
8379
|
debugLogger.warn(
|
|
8355
8380
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8356
8381
|
);
|
|
8357
8382
|
}
|
|
8358
|
-
if (!trustedFolder && approvalMode !==
|
|
8383
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8359
8384
|
debugLogger.warn(
|
|
8360
8385
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8361
8386
|
);
|
|
8362
|
-
approvalMode =
|
|
8387
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8363
8388
|
}
|
|
8364
8389
|
let telemetrySettings;
|
|
8365
8390
|
try {
|
|
@@ -8483,6 +8508,8 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8483
8508
|
let profileSelector = void 0;
|
|
8484
8509
|
if (settings.experimental?.stressTestProfile) {
|
|
8485
8510
|
profileSelector = "stressTestProfile";
|
|
8511
|
+
} else if (settings.experimental?.powerUserProfile) {
|
|
8512
|
+
profileSelector = "powerUserProfile";
|
|
8486
8513
|
} else if (settings.experimental?.generalistProfile || settings.experimental?.contextManagement) {
|
|
8487
8514
|
profileSelector = "generalistProfile";
|
|
8488
8515
|
}
|
|
@@ -8522,8 +8549,8 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8522
8549
|
extensionsEnabled,
|
|
8523
8550
|
agents: settings.agents,
|
|
8524
8551
|
adminSkillsEnabled,
|
|
8525
|
-
allowedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ?? settings.mcp?.allowed : void 0,
|
|
8526
|
-
blockedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ? void 0 : settings.mcp?.excluded : void 0,
|
|
8552
|
+
allowedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ?? (loadedSettings ? loadedSettings.getConsolidatedAllowedMcpServers() : settings.mcp?.allowed) : void 0,
|
|
8553
|
+
blockedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ? void 0 : loadedSettings ? loadedSettings.getConsolidatedExcludedMcpServers() : settings.mcp?.excluded : void 0,
|
|
8527
8554
|
blockedEnvironmentVariables: settings.security?.environmentVariableRedaction?.blocked,
|
|
8528
8555
|
allowedEnvironmentVariables: settings.security?.environmentVariableRedaction?.allowed,
|
|
8529
8556
|
enableEnvironmentVariableRedaction: settings.security?.environmentVariableRedaction?.enabled,
|
|
@@ -9795,7 +9822,7 @@ import path9 from "node:path";
|
|
|
9795
9822
|
import process4 from "node:process";
|
|
9796
9823
|
var homeDirectoryCheck = {
|
|
9797
9824
|
id: "home-directory",
|
|
9798
|
-
priority:
|
|
9825
|
+
priority: WarningPriority.Low,
|
|
9799
9826
|
check: async (workspaceRoot, settings) => {
|
|
9800
9827
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9801
9828
|
return null;
|
|
@@ -9819,7 +9846,7 @@ var homeDirectoryCheck = {
|
|
|
9819
9846
|
};
|
|
9820
9847
|
var rootDirectoryCheck = {
|
|
9821
9848
|
id: "root-directory",
|
|
9822
|
-
priority:
|
|
9849
|
+
priority: WarningPriority.High,
|
|
9823
9850
|
check: async (workspaceRoot, _settings) => {
|
|
9824
9851
|
try {
|
|
9825
9852
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9835,7 +9862,7 @@ var rootDirectoryCheck = {
|
|
|
9835
9862
|
};
|
|
9836
9863
|
var folderTrustCheck = {
|
|
9837
9864
|
id: "folder-trust",
|
|
9838
|
-
priority:
|
|
9865
|
+
priority: WarningPriority.High,
|
|
9839
9866
|
check: async (workspaceRoot, settings) => {
|
|
9840
9867
|
if (!isFolderTrustEnabled(settings)) {
|
|
9841
9868
|
return null;
|
|
@@ -10025,12 +10052,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10025
10052
|
error,
|
|
10026
10053
|
config.getContentGeneratorConfig()?.authType
|
|
10027
10054
|
);
|
|
10028
|
-
if (config.getOutputFormat() ===
|
|
10055
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10029
10056
|
const streamFormatter = new StreamJsonFormatter();
|
|
10030
10057
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10031
10058
|
const metrics = uiTelemetryService.getMetrics();
|
|
10032
10059
|
streamFormatter.emitEvent({
|
|
10033
|
-
type:
|
|
10060
|
+
type: JsonStreamEventType.RESULT,
|
|
10034
10061
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10035
10062
|
status: "error",
|
|
10036
10063
|
error: {
|
|
@@ -10041,7 +10068,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10041
10068
|
});
|
|
10042
10069
|
runSyncCleanup();
|
|
10043
10070
|
process.exit(getNumericExitCode(errorCode));
|
|
10044
|
-
} else if (config.getOutputFormat() ===
|
|
10071
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10045
10072
|
const formatter = new JsonFormatter();
|
|
10046
10073
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10047
10074
|
const formattedError = formatter.formatError(
|
|
@@ -10061,11 +10088,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10061
10088
|
const isFatal = isFatalToolError(errorType);
|
|
10062
10089
|
if (isFatal) {
|
|
10063
10090
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10064
|
-
if (config.getOutputFormat() ===
|
|
10091
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10065
10092
|
const streamFormatter = new StreamJsonFormatter();
|
|
10066
10093
|
const metrics = uiTelemetryService.getMetrics();
|
|
10067
10094
|
streamFormatter.emitEvent({
|
|
10068
|
-
type:
|
|
10095
|
+
type: JsonStreamEventType.RESULT,
|
|
10069
10096
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10070
10097
|
status: "error",
|
|
10071
10098
|
error: {
|
|
@@ -10074,7 +10101,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10074
10101
|
},
|
|
10075
10102
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10076
10103
|
});
|
|
10077
|
-
} else if (config.getOutputFormat() ===
|
|
10104
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10078
10105
|
const formatter = new JsonFormatter();
|
|
10079
10106
|
const formattedError = formatter.formatError(
|
|
10080
10107
|
toolExecutionError,
|
|
@@ -10092,11 +10119,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10092
10119
|
}
|
|
10093
10120
|
function handleCancellationError(config) {
|
|
10094
10121
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10095
|
-
if (config.getOutputFormat() ===
|
|
10122
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10096
10123
|
const streamFormatter = new StreamJsonFormatter();
|
|
10097
10124
|
const metrics = uiTelemetryService.getMetrics();
|
|
10098
10125
|
streamFormatter.emitEvent({
|
|
10099
|
-
type:
|
|
10126
|
+
type: JsonStreamEventType.RESULT,
|
|
10100
10127
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10101
10128
|
status: "error",
|
|
10102
10129
|
error: {
|
|
@@ -10107,7 +10134,7 @@ function handleCancellationError(config) {
|
|
|
10107
10134
|
});
|
|
10108
10135
|
runSyncCleanup();
|
|
10109
10136
|
process.exit(cancellationError.exitCode);
|
|
10110
|
-
} else if (config.getOutputFormat() ===
|
|
10137
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10111
10138
|
const formatter = new JsonFormatter();
|
|
10112
10139
|
const formattedError = formatter.formatError(
|
|
10113
10140
|
cancellationError,
|
|
@@ -10127,11 +10154,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10127
10154
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10128
10155
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10129
10156
|
);
|
|
10130
|
-
if (config.getOutputFormat() ===
|
|
10157
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10131
10158
|
const streamFormatter = new StreamJsonFormatter();
|
|
10132
10159
|
const metrics = uiTelemetryService.getMetrics();
|
|
10133
10160
|
streamFormatter.emitEvent({
|
|
10134
|
-
type:
|
|
10161
|
+
type: JsonStreamEventType.RESULT,
|
|
10135
10162
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10136
10163
|
status: "error",
|
|
10137
10164
|
error: {
|
|
@@ -10142,7 +10169,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10142
10169
|
});
|
|
10143
10170
|
runSyncCleanup();
|
|
10144
10171
|
process.exit(maxTurnsError.exitCode);
|
|
10145
|
-
} else if (config.getOutputFormat() ===
|
|
10172
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10146
10173
|
const formatter = new JsonFormatter();
|
|
10147
10174
|
const formattedError = formatter.formatError(
|
|
10148
10175
|
maxTurnsError,
|
|
@@ -10222,7 +10249,7 @@ async function runNonInteractive({
|
|
|
10222
10249
|
}
|
|
10223
10250
|
});
|
|
10224
10251
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10225
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10252
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-N5XYKGOS.js");
|
|
10226
10253
|
setupInitialActivityLogger(config);
|
|
10227
10254
|
}
|
|
10228
10255
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10238,7 +10265,7 @@ async function runNonInteractive({
|
|
|
10238
10265
|
}
|
|
10239
10266
|
};
|
|
10240
10267
|
const startTime = Date.now();
|
|
10241
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10268
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10242
10269
|
const abortController = new AbortController();
|
|
10243
10270
|
let isAborting = false;
|
|
10244
10271
|
let cancelMessageTimer = null;
|
|
@@ -10291,13 +10318,13 @@ async function runNonInteractive({
|
|
|
10291
10318
|
};
|
|
10292
10319
|
try {
|
|
10293
10320
|
consolePatcher.patch();
|
|
10294
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10321
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10295
10322
|
process.stderr.write(
|
|
10296
10323
|
"[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"
|
|
10297
10324
|
);
|
|
10298
10325
|
}
|
|
10299
10326
|
setupStdinCancellation();
|
|
10300
|
-
coreEvents.on(
|
|
10327
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10301
10328
|
coreEvents.drainBacklogs();
|
|
10302
10329
|
process.stdout.on("error", (err) => {
|
|
10303
10330
|
if (err.code === "EPIPE") {
|
|
@@ -10323,7 +10350,7 @@ async function runNonInteractive({
|
|
|
10323
10350
|
}
|
|
10324
10351
|
if (streamFormatter) {
|
|
10325
10352
|
streamFormatter.emitEvent({
|
|
10326
|
-
type:
|
|
10353
|
+
type: JsonStreamEventType.INIT,
|
|
10327
10354
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10328
10355
|
session_id: config.getSessionId(),
|
|
10329
10356
|
model: config.getModel()
|
|
@@ -10361,7 +10388,7 @@ async function runNonInteractive({
|
|
|
10361
10388
|
}
|
|
10362
10389
|
if (streamFormatter) {
|
|
10363
10390
|
streamFormatter.emitEvent({
|
|
10364
|
-
type:
|
|
10391
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10365
10392
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10366
10393
|
role: "user",
|
|
10367
10394
|
content: input
|
|
@@ -10400,12 +10427,12 @@ async function runNonInteractive({
|
|
|
10400
10427
|
const metrics = uiTelemetryService.getMetrics();
|
|
10401
10428
|
const durationMs = Date.now() - startTime;
|
|
10402
10429
|
streamFormatter.emitEvent({
|
|
10403
|
-
type:
|
|
10430
|
+
type: JsonStreamEventType.RESULT,
|
|
10404
10431
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10405
10432
|
status: "success",
|
|
10406
10433
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10407
10434
|
});
|
|
10408
|
-
} else if (config.getOutputFormat() ===
|
|
10435
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10409
10436
|
const formatter = new JsonFormatter();
|
|
10410
10437
|
const stats = uiTelemetryService.getMetrics();
|
|
10411
10438
|
textOutput.write(
|
|
@@ -10498,13 +10525,13 @@ async function runNonInteractive({
|
|
|
10498
10525
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10499
10526
|
if (streamFormatter) {
|
|
10500
10527
|
streamFormatter.emitEvent({
|
|
10501
|
-
type:
|
|
10528
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10502
10529
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10503
10530
|
role: "assistant",
|
|
10504
10531
|
content: output,
|
|
10505
10532
|
delta: true
|
|
10506
10533
|
});
|
|
10507
|
-
} else if (config.getOutputFormat() ===
|
|
10534
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10508
10535
|
responseText += output;
|
|
10509
10536
|
} else {
|
|
10510
10537
|
if (part.text) {
|
|
@@ -10517,13 +10544,13 @@ async function runNonInteractive({
|
|
|
10517
10544
|
break;
|
|
10518
10545
|
}
|
|
10519
10546
|
case "tool_request": {
|
|
10520
|
-
if (config.getOutputFormat() ===
|
|
10547
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10521
10548
|
preToolResponseText = responseText || preToolResponseText;
|
|
10522
10549
|
responseText = "";
|
|
10523
10550
|
}
|
|
10524
10551
|
if (streamFormatter) {
|
|
10525
10552
|
streamFormatter.emitEvent({
|
|
10526
|
-
type:
|
|
10553
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10527
10554
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10528
10555
|
tool_name: event.name,
|
|
10529
10556
|
tool_id: event.requestId,
|
|
@@ -10539,7 +10566,7 @@ async function runNonInteractive({
|
|
|
10539
10566
|
const displayText = displayContentToString(display);
|
|
10540
10567
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10541
10568
|
streamFormatter.emitEvent({
|
|
10542
|
-
type:
|
|
10569
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10543
10570
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10544
10571
|
tool_id: event.requestId,
|
|
10545
10572
|
status: event.isError ? "error" : "success",
|
|
@@ -10554,17 +10581,17 @@ async function runNonInteractive({
|
|
|
10554
10581
|
const display = event.display?.result;
|
|
10555
10582
|
const displayText = displayContentToString(display);
|
|
10556
10583
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10557
|
-
if (event.data?.["errorType"] ===
|
|
10558
|
-
if (config.getOutputFormat() ===
|
|
10584
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
10585
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
10559
10586
|
responseText = preToolResponseText;
|
|
10560
10587
|
}
|
|
10561
10588
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10562
|
-
if (config.getOutputFormat() ===
|
|
10589
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10563
10590
|
process.stderr.write(`${stopMessage}
|
|
10564
10591
|
`);
|
|
10565
10592
|
}
|
|
10566
10593
|
}
|
|
10567
|
-
if (event.data?.["errorType"] ===
|
|
10594
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
10568
10595
|
throw new FatalToolExecutionError(
|
|
10569
10596
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10570
10597
|
);
|
|
@@ -10586,12 +10613,12 @@ async function runNonInteractive({
|
|
|
10586
10613
|
const errorCode = event._meta?.["code"];
|
|
10587
10614
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10588
10615
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10589
|
-
if (config.getOutputFormat() ===
|
|
10616
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10590
10617
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10591
10618
|
`);
|
|
10592
10619
|
} else if (streamFormatter) {
|
|
10593
10620
|
streamFormatter.emitEvent({
|
|
10594
|
-
type:
|
|
10621
|
+
type: JsonStreamEventType.ERROR,
|
|
10595
10622
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10596
10623
|
severity: "warning",
|
|
10597
10624
|
message: stripAnsi(blockMessage)
|
|
@@ -10601,13 +10628,13 @@ async function runNonInteractive({
|
|
|
10601
10628
|
break;
|
|
10602
10629
|
}
|
|
10603
10630
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10604
|
-
if (config.getOutputFormat() ===
|
|
10631
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10605
10632
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10606
10633
|
`);
|
|
10607
10634
|
}
|
|
10608
10635
|
if (streamFormatter) {
|
|
10609
10636
|
streamFormatter.emitEvent({
|
|
10610
|
-
type:
|
|
10637
|
+
type: JsonStreamEventType.ERROR,
|
|
10611
10638
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10612
10639
|
severity,
|
|
10613
10640
|
message: stripAnsi(event.message)
|
|
@@ -10627,7 +10654,7 @@ async function runNonInteractive({
|
|
|
10627
10654
|
);
|
|
10628
10655
|
} else if (streamFormatter) {
|
|
10629
10656
|
streamFormatter.emitEvent({
|
|
10630
|
-
type:
|
|
10657
|
+
type: JsonStreamEventType.ERROR,
|
|
10631
10658
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10632
10659
|
severity: "error",
|
|
10633
10660
|
message: "Maximum session turns exceeded"
|
|
@@ -10635,7 +10662,7 @@ async function runNonInteractive({
|
|
|
10635
10662
|
}
|
|
10636
10663
|
}
|
|
10637
10664
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10638
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10665
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10639
10666
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10640
10667
|
`);
|
|
10641
10668
|
}
|
|
@@ -10665,7 +10692,7 @@ async function runNonInteractive({
|
|
|
10665
10692
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10666
10693
|
scheduler?.dispose();
|
|
10667
10694
|
consolePatcher.cleanup();
|
|
10668
|
-
coreEvents.off(
|
|
10695
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10669
10696
|
}
|
|
10670
10697
|
if (errorToHandle) {
|
|
10671
10698
|
handleError(errorToHandle, config);
|
|
@@ -10693,7 +10720,7 @@ async function runNonInteractive2(params) {
|
|
|
10693
10720
|
}
|
|
10694
10721
|
});
|
|
10695
10722
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10696
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10723
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-N5XYKGOS.js");
|
|
10697
10724
|
setupInitialActivityLogger(config);
|
|
10698
10725
|
}
|
|
10699
10726
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10709,7 +10736,7 @@ async function runNonInteractive2(params) {
|
|
|
10709
10736
|
}
|
|
10710
10737
|
};
|
|
10711
10738
|
const startTime = Date.now();
|
|
10712
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10739
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10713
10740
|
const abortController = new AbortController();
|
|
10714
10741
|
let isAborting = false;
|
|
10715
10742
|
let cancelMessageTimer = null;
|
|
@@ -10760,13 +10787,13 @@ async function runNonInteractive2(params) {
|
|
|
10760
10787
|
let scheduler;
|
|
10761
10788
|
try {
|
|
10762
10789
|
consolePatcher.patch();
|
|
10763
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10790
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10764
10791
|
process.stderr.write(
|
|
10765
10792
|
"[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"
|
|
10766
10793
|
);
|
|
10767
10794
|
}
|
|
10768
10795
|
setupStdinCancellation();
|
|
10769
|
-
coreEvents.on(
|
|
10796
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10770
10797
|
coreEvents.drainBacklogs();
|
|
10771
10798
|
process.stdout.on("error", (err) => {
|
|
10772
10799
|
if (err.code === "EPIPE") {
|
|
@@ -10790,7 +10817,7 @@ async function runNonInteractive2(params) {
|
|
|
10790
10817
|
}
|
|
10791
10818
|
if (streamFormatter) {
|
|
10792
10819
|
streamFormatter.emitEvent({
|
|
10793
|
-
type:
|
|
10820
|
+
type: JsonStreamEventType.INIT,
|
|
10794
10821
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10795
10822
|
session_id: config.getSessionId(),
|
|
10796
10823
|
model: config.getModel()
|
|
@@ -10828,7 +10855,7 @@ async function runNonInteractive2(params) {
|
|
|
10828
10855
|
}
|
|
10829
10856
|
if (streamFormatter) {
|
|
10830
10857
|
streamFormatter.emitEvent({
|
|
10831
|
-
type:
|
|
10858
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10832
10859
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10833
10860
|
role: "user",
|
|
10834
10861
|
content: input
|
|
@@ -10856,28 +10883,28 @@ async function runNonInteractive2(params) {
|
|
|
10856
10883
|
if (abortController.signal.aborted) {
|
|
10857
10884
|
handleCancellationError(config);
|
|
10858
10885
|
}
|
|
10859
|
-
if (event.type ===
|
|
10886
|
+
if (event.type === GeminiEventType.Content) {
|
|
10860
10887
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10861
10888
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10862
10889
|
if (streamFormatter) {
|
|
10863
10890
|
streamFormatter.emitEvent({
|
|
10864
|
-
type:
|
|
10891
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10865
10892
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10866
10893
|
role: "assistant",
|
|
10867
10894
|
content: output,
|
|
10868
10895
|
delta: true
|
|
10869
10896
|
});
|
|
10870
|
-
} else if (config.getOutputFormat() ===
|
|
10897
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10871
10898
|
responseText += output;
|
|
10872
10899
|
} else {
|
|
10873
10900
|
if (event.value) {
|
|
10874
10901
|
textOutput.write(output);
|
|
10875
10902
|
}
|
|
10876
10903
|
}
|
|
10877
|
-
} else if (event.type ===
|
|
10904
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
10878
10905
|
if (streamFormatter) {
|
|
10879
10906
|
streamFormatter.emitEvent({
|
|
10880
|
-
type:
|
|
10907
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10881
10908
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10882
10909
|
tool_name: event.value.name,
|
|
10883
10910
|
tool_id: event.value.callId,
|
|
@@ -10885,33 +10912,33 @@ async function runNonInteractive2(params) {
|
|
|
10885
10912
|
});
|
|
10886
10913
|
}
|
|
10887
10914
|
toolCallRequests.push(event.value);
|
|
10888
|
-
} else if (event.type ===
|
|
10915
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
10889
10916
|
const message = "Loop detected, stopping execution";
|
|
10890
10917
|
if (streamFormatter) {
|
|
10891
10918
|
streamFormatter.emitEvent({
|
|
10892
|
-
type:
|
|
10919
|
+
type: JsonStreamEventType.ERROR,
|
|
10893
10920
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10894
10921
|
severity: "warning",
|
|
10895
10922
|
message
|
|
10896
10923
|
});
|
|
10897
10924
|
}
|
|
10898
10925
|
warnings.push(message);
|
|
10899
|
-
} else if (event.type ===
|
|
10926
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
10900
10927
|
const message = "Maximum session turns exceeded";
|
|
10901
10928
|
if (streamFormatter) {
|
|
10902
10929
|
streamFormatter.emitEvent({
|
|
10903
|
-
type:
|
|
10930
|
+
type: JsonStreamEventType.ERROR,
|
|
10904
10931
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10905
10932
|
severity: "error",
|
|
10906
10933
|
message
|
|
10907
10934
|
});
|
|
10908
10935
|
}
|
|
10909
10936
|
warnings.push(message);
|
|
10910
|
-
} else if (event.type ===
|
|
10937
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
10911
10938
|
throw event.value.error;
|
|
10912
|
-
} else if (event.type ===
|
|
10939
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
10913
10940
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10914
|
-
if (config.getOutputFormat() ===
|
|
10941
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10915
10942
|
process.stderr.write(`${stopMessage}
|
|
10916
10943
|
`);
|
|
10917
10944
|
}
|
|
@@ -10919,7 +10946,7 @@ async function runNonInteractive2(params) {
|
|
|
10919
10946
|
const metrics = uiTelemetryService.getMetrics();
|
|
10920
10947
|
const durationMs = Date.now() - startTime;
|
|
10921
10948
|
streamFormatter.emitEvent({
|
|
10922
|
-
type:
|
|
10949
|
+
type: JsonStreamEventType.RESULT,
|
|
10923
10950
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10924
10951
|
status: "success",
|
|
10925
10952
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10927,7 +10954,7 @@ async function runNonInteractive2(params) {
|
|
|
10927
10954
|
durationMs
|
|
10928
10955
|
)
|
|
10929
10956
|
});
|
|
10930
|
-
} else if (config.getOutputFormat() ===
|
|
10957
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10931
10958
|
const formatter = new JsonFormatter();
|
|
10932
10959
|
const stats = uiTelemetryService.getMetrics();
|
|
10933
10960
|
textOutput.write(
|
|
@@ -10943,30 +10970,30 @@ async function runNonInteractive2(params) {
|
|
|
10943
10970
|
textOutput.ensureTrailingNewline();
|
|
10944
10971
|
}
|
|
10945
10972
|
return;
|
|
10946
|
-
} else if (event.type ===
|
|
10973
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
10947
10974
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10948
|
-
if (config.getOutputFormat() ===
|
|
10975
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10949
10976
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10950
10977
|
`);
|
|
10951
10978
|
} else if (streamFormatter) {
|
|
10952
10979
|
streamFormatter.emitEvent({
|
|
10953
|
-
type:
|
|
10980
|
+
type: JsonStreamEventType.ERROR,
|
|
10954
10981
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10955
10982
|
severity: "warning",
|
|
10956
10983
|
message: stripAnsi(blockMessage)
|
|
10957
10984
|
});
|
|
10958
10985
|
}
|
|
10959
10986
|
warnings.push(blockMessage);
|
|
10960
|
-
} else if (event.type ===
|
|
10987
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
10961
10988
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10962
10989
|
if (streamFormatter) {
|
|
10963
10990
|
streamFormatter.emitEvent({
|
|
10964
|
-
type:
|
|
10991
|
+
type: JsonStreamEventType.ERROR,
|
|
10965
10992
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10966
10993
|
severity: "error",
|
|
10967
10994
|
message: invalidStreamError
|
|
10968
10995
|
});
|
|
10969
|
-
} else if (config.getOutputFormat() ===
|
|
10996
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10970
10997
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10971
10998
|
`);
|
|
10972
10999
|
}
|
|
@@ -10986,7 +11013,7 @@ async function runNonInteractive2(params) {
|
|
|
10986
11013
|
const requestInfo = completedToolCall.request;
|
|
10987
11014
|
if (streamFormatter) {
|
|
10988
11015
|
streamFormatter.emitEvent({
|
|
10989
|
-
type:
|
|
11016
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10990
11017
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10991
11018
|
tool_id: requestInfo.callId,
|
|
10992
11019
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11020,11 +11047,11 @@ async function runNonInteractive2(params) {
|
|
|
11020
11047
|
);
|
|
11021
11048
|
}
|
|
11022
11049
|
const stopExecutionTool = completedToolCalls.find(
|
|
11023
|
-
(tc) => tc.response.errorType ===
|
|
11050
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
11024
11051
|
);
|
|
11025
11052
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11026
11053
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11027
|
-
if (config.getOutputFormat() ===
|
|
11054
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11028
11055
|
process.stderr.write(`${stopMessage}
|
|
11029
11056
|
`);
|
|
11030
11057
|
}
|
|
@@ -11032,7 +11059,7 @@ async function runNonInteractive2(params) {
|
|
|
11032
11059
|
const metrics = uiTelemetryService.getMetrics();
|
|
11033
11060
|
const durationMs = Date.now() - startTime;
|
|
11034
11061
|
streamFormatter.emitEvent({
|
|
11035
|
-
type:
|
|
11062
|
+
type: JsonStreamEventType.RESULT,
|
|
11036
11063
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11037
11064
|
status: "success",
|
|
11038
11065
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11040,7 +11067,7 @@ async function runNonInteractive2(params) {
|
|
|
11040
11067
|
durationMs
|
|
11041
11068
|
)
|
|
11042
11069
|
});
|
|
11043
|
-
} else if (config.getOutputFormat() ===
|
|
11070
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11044
11071
|
const formatter = new JsonFormatter();
|
|
11045
11072
|
const stats = uiTelemetryService.getMetrics();
|
|
11046
11073
|
textOutput.write(
|
|
@@ -11063,12 +11090,12 @@ async function runNonInteractive2(params) {
|
|
|
11063
11090
|
const metrics = uiTelemetryService.getMetrics();
|
|
11064
11091
|
const durationMs = Date.now() - startTime;
|
|
11065
11092
|
streamFormatter.emitEvent({
|
|
11066
|
-
type:
|
|
11093
|
+
type: JsonStreamEventType.RESULT,
|
|
11067
11094
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11068
11095
|
status: invalidStreamError ? "error" : "success",
|
|
11069
11096
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11070
11097
|
});
|
|
11071
|
-
} else if (config.getOutputFormat() ===
|
|
11098
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11072
11099
|
const formatter = new JsonFormatter();
|
|
11073
11100
|
const stats = uiTelemetryService.getMetrics();
|
|
11074
11101
|
textOutput.write(
|
|
@@ -11092,7 +11119,7 @@ async function runNonInteractive2(params) {
|
|
|
11092
11119
|
cleanupStdinCancellation();
|
|
11093
11120
|
scheduler?.dispose();
|
|
11094
11121
|
consolePatcher.cleanup();
|
|
11095
|
-
coreEvents.off(
|
|
11122
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11096
11123
|
}
|
|
11097
11124
|
if (errorToHandle) {
|
|
11098
11125
|
handleError(errorToHandle, config);
|
|
@@ -13483,12 +13510,12 @@ function toToolCallContent(toolResult) {
|
|
|
13483
13510
|
}
|
|
13484
13511
|
var basicPermissionOptions = [
|
|
13485
13512
|
{
|
|
13486
|
-
optionId:
|
|
13513
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
13487
13514
|
name: "Allow",
|
|
13488
13515
|
kind: "allow_once"
|
|
13489
13516
|
},
|
|
13490
13517
|
{
|
|
13491
|
-
optionId:
|
|
13518
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
13492
13519
|
name: "Reject",
|
|
13493
13520
|
kind: "reject_once"
|
|
13494
13521
|
}
|
|
@@ -13500,13 +13527,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13500
13527
|
switch (confirmation.type) {
|
|
13501
13528
|
case "edit":
|
|
13502
13529
|
options.push({
|
|
13503
|
-
optionId:
|
|
13530
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13504
13531
|
name: "Allow for this session",
|
|
13505
13532
|
kind: "allow_always"
|
|
13506
13533
|
});
|
|
13507
13534
|
if (enablePermanentToolApproval) {
|
|
13508
13535
|
options.push({
|
|
13509
|
-
optionId:
|
|
13536
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13510
13537
|
name: "Allow for this file in all future sessions",
|
|
13511
13538
|
kind: "allow_always"
|
|
13512
13539
|
});
|
|
@@ -13514,13 +13541,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13514
13541
|
break;
|
|
13515
13542
|
case "exec":
|
|
13516
13543
|
options.push({
|
|
13517
|
-
optionId:
|
|
13544
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13518
13545
|
name: "Allow for this session",
|
|
13519
13546
|
kind: "allow_always"
|
|
13520
13547
|
});
|
|
13521
13548
|
if (enablePermanentToolApproval) {
|
|
13522
13549
|
options.push({
|
|
13523
|
-
optionId:
|
|
13550
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13524
13551
|
name: "Allow this command for all future sessions",
|
|
13525
13552
|
kind: "allow_always"
|
|
13526
13553
|
});
|
|
@@ -13529,19 +13556,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13529
13556
|
case "mcp":
|
|
13530
13557
|
options.push(
|
|
13531
13558
|
{
|
|
13532
|
-
optionId:
|
|
13559
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
13533
13560
|
name: "Allow all server tools for this session",
|
|
13534
13561
|
kind: "allow_always"
|
|
13535
13562
|
},
|
|
13536
13563
|
{
|
|
13537
|
-
optionId:
|
|
13564
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
13538
13565
|
name: "Allow tool for this session",
|
|
13539
13566
|
kind: "allow_always"
|
|
13540
13567
|
}
|
|
13541
13568
|
);
|
|
13542
13569
|
if (enablePermanentToolApproval) {
|
|
13543
13570
|
options.push({
|
|
13544
|
-
optionId:
|
|
13571
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13545
13572
|
name: "Allow tool for all future sessions",
|
|
13546
13573
|
kind: "allow_always"
|
|
13547
13574
|
});
|
|
@@ -13549,13 +13576,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13549
13576
|
break;
|
|
13550
13577
|
case "info":
|
|
13551
13578
|
options.push({
|
|
13552
|
-
optionId:
|
|
13579
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13553
13580
|
name: "Allow for this session",
|
|
13554
13581
|
kind: "allow_always"
|
|
13555
13582
|
});
|
|
13556
13583
|
if (enablePermanentToolApproval) {
|
|
13557
13584
|
options.push({
|
|
13558
|
-
optionId:
|
|
13585
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13559
13586
|
name: "Allow for all future sessions",
|
|
13560
13587
|
kind: "allow_always"
|
|
13561
13588
|
});
|
|
@@ -13587,21 +13614,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13587
13614
|
}
|
|
13588
13615
|
function toAcpToolKind(kind) {
|
|
13589
13616
|
switch (kind) {
|
|
13590
|
-
case
|
|
13591
|
-
case
|
|
13592
|
-
case
|
|
13593
|
-
case
|
|
13594
|
-
case
|
|
13595
|
-
case
|
|
13596
|
-
case
|
|
13597
|
-
case
|
|
13598
|
-
case
|
|
13599
|
-
case
|
|
13617
|
+
case Kind.Read:
|
|
13618
|
+
case Kind.Edit:
|
|
13619
|
+
case Kind.Execute:
|
|
13620
|
+
case Kind.Search:
|
|
13621
|
+
case Kind.Delete:
|
|
13622
|
+
case Kind.Move:
|
|
13623
|
+
case Kind.Think:
|
|
13624
|
+
case Kind.Fetch:
|
|
13625
|
+
case Kind.SwitchMode:
|
|
13626
|
+
case Kind.Other:
|
|
13600
13627
|
return kind;
|
|
13601
|
-
case
|
|
13628
|
+
case Kind.Agent:
|
|
13602
13629
|
return "think";
|
|
13603
|
-
case
|
|
13604
|
-
case
|
|
13630
|
+
case Kind.Plan:
|
|
13631
|
+
case Kind.Communicate:
|
|
13605
13632
|
default:
|
|
13606
13633
|
return "other";
|
|
13607
13634
|
}
|
|
@@ -13609,24 +13636,24 @@ function toAcpToolKind(kind) {
|
|
|
13609
13636
|
function buildAvailableModes(isPlanEnabled) {
|
|
13610
13637
|
const modes = [
|
|
13611
13638
|
{
|
|
13612
|
-
id:
|
|
13639
|
+
id: ApprovalMode.DEFAULT,
|
|
13613
13640
|
name: "Default",
|
|
13614
13641
|
description: "Prompts for approval"
|
|
13615
13642
|
},
|
|
13616
13643
|
{
|
|
13617
|
-
id:
|
|
13644
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
13618
13645
|
name: "Auto Edit",
|
|
13619
13646
|
description: "Auto-approves edit tools"
|
|
13620
13647
|
},
|
|
13621
13648
|
{
|
|
13622
|
-
id:
|
|
13649
|
+
id: ApprovalMode.YOLO,
|
|
13623
13650
|
name: "YOLO",
|
|
13624
13651
|
description: "Auto-approves all tools"
|
|
13625
13652
|
}
|
|
13626
13653
|
];
|
|
13627
13654
|
if (isPlanEnabled) {
|
|
13628
13655
|
modes.push({
|
|
13629
|
-
id:
|
|
13656
|
+
id: ApprovalMode.PLAN,
|
|
13630
13657
|
name: "Plan",
|
|
13631
13658
|
description: "Read-only mode"
|
|
13632
13659
|
});
|
|
@@ -13637,13 +13664,11 @@ function buildAvailableModels(config, settings) {
|
|
|
13637
13664
|
const preferredModel = config.getModel() || GEMINI_MODEL_ALIAS_AUTO;
|
|
13638
13665
|
const shouldShowPreviewModels = config.getHasAccessToPreviewModel();
|
|
13639
13666
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13640
|
-
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
13641
13667
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13642
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13668
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
13643
13669
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13644
13670
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13645
13671
|
useGemini3_1: useGemini31,
|
|
13646
|
-
useGemini3_1FlashLite: useGemini31FlashLite,
|
|
13647
13672
|
useCustomTools: useCustomToolModel,
|
|
13648
13673
|
hasAccessToPreview: shouldShowPreviewModels
|
|
13649
13674
|
});
|
|
@@ -13689,10 +13714,10 @@ function buildAvailableModels(config, settings) {
|
|
|
13689
13714
|
title: getDisplayString(PREVIEW_GEMINI_FLASH_MODEL)
|
|
13690
13715
|
}
|
|
13691
13716
|
];
|
|
13692
|
-
if (
|
|
13717
|
+
if (PREVIEW_GEMINI_FLASH_LITE_MODEL !== "none") {
|
|
13693
13718
|
previewOptions.push({
|
|
13694
|
-
value:
|
|
13695
|
-
title: getDisplayString(
|
|
13719
|
+
value: PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
13720
|
+
title: getDisplayString(PREVIEW_GEMINI_FLASH_LITE_MODEL)
|
|
13696
13721
|
});
|
|
13697
13722
|
}
|
|
13698
13723
|
manualOptions.unshift(...previewOptions);
|
|
@@ -13724,11 +13749,11 @@ var Session = class {
|
|
|
13724
13749
|
this.connection = connection;
|
|
13725
13750
|
this.settings = settings;
|
|
13726
13751
|
coreEvents.on(
|
|
13727
|
-
|
|
13752
|
+
CoreEvent.ApprovalModeChanged,
|
|
13728
13753
|
this.handleApprovalModeChanged
|
|
13729
13754
|
);
|
|
13730
13755
|
this.context.config.getMessageBus()?.subscribe(
|
|
13731
|
-
|
|
13756
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
13732
13757
|
this.handleToolConfirmationRequest,
|
|
13733
13758
|
{ signal: this.disposeController.signal }
|
|
13734
13759
|
);
|
|
@@ -13752,7 +13777,7 @@ var Session = class {
|
|
|
13752
13777
|
"Policy engine missing. Denying tool confirmation request."
|
|
13753
13778
|
);
|
|
13754
13779
|
await messageBus.publish({
|
|
13755
|
-
type:
|
|
13780
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13756
13781
|
correlationId: request.correlationId,
|
|
13757
13782
|
confirmed: false,
|
|
13758
13783
|
requiresUserConfirmation: false
|
|
@@ -13765,7 +13790,7 @@ var Session = class {
|
|
|
13765
13790
|
"Tool confirmation request missing tool name. Denying."
|
|
13766
13791
|
);
|
|
13767
13792
|
await messageBus.publish({
|
|
13768
|
-
type:
|
|
13793
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13769
13794
|
correlationId: request.correlationId,
|
|
13770
13795
|
confirmed: false,
|
|
13771
13796
|
requiresUserConfirmation: false
|
|
@@ -13778,7 +13803,7 @@ var Session = class {
|
|
|
13778
13803
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
13779
13804
|
);
|
|
13780
13805
|
await messageBus.publish({
|
|
13781
|
-
type:
|
|
13806
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13782
13807
|
correlationId: request.correlationId,
|
|
13783
13808
|
confirmed: false,
|
|
13784
13809
|
requiresUserConfirmation: false
|
|
@@ -13794,15 +13819,15 @@ var Session = class {
|
|
|
13794
13819
|
request.subagent
|
|
13795
13820
|
);
|
|
13796
13821
|
await messageBus.publish({
|
|
13797
|
-
type:
|
|
13822
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13798
13823
|
correlationId: request.correlationId,
|
|
13799
|
-
confirmed: result.decision ===
|
|
13800
|
-
requiresUserConfirmation: result.decision ===
|
|
13824
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
13825
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
13801
13826
|
});
|
|
13802
13827
|
} catch (error) {
|
|
13803
13828
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
13804
13829
|
await this.context.config.getMessageBus()?.publish({
|
|
13805
|
-
type:
|
|
13830
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13806
13831
|
correlationId: request.correlationId,
|
|
13807
13832
|
confirmed: false,
|
|
13808
13833
|
requiresUserConfirmation: false
|
|
@@ -13822,7 +13847,7 @@ var Session = class {
|
|
|
13822
13847
|
};
|
|
13823
13848
|
dispose() {
|
|
13824
13849
|
coreEvents.off(
|
|
13825
|
-
|
|
13850
|
+
CoreEvent.ApprovalModeChanged,
|
|
13826
13851
|
this.handleApprovalModeChanged
|
|
13827
13852
|
);
|
|
13828
13853
|
this.disposeController.abort();
|
|
@@ -13911,7 +13936,7 @@ ${thought.description}`;
|
|
|
13911
13936
|
await this.sendUpdate({
|
|
13912
13937
|
sessionUpdate: "tool_call",
|
|
13913
13938
|
toolCallId: toolCall.id,
|
|
13914
|
-
status: toolCall.status ===
|
|
13939
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
13915
13940
|
title: toolCall.displayName || toolCall.name,
|
|
13916
13941
|
content: toolCallContent,
|
|
13917
13942
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14003,7 +14028,7 @@ ${thought.description}`;
|
|
|
14003
14028
|
return { stopReason: "cancelled" };
|
|
14004
14029
|
}
|
|
14005
14030
|
switch (event.type) {
|
|
14006
|
-
case
|
|
14031
|
+
case GeminiEventType.Content: {
|
|
14007
14032
|
const content = {
|
|
14008
14033
|
type: "text",
|
|
14009
14034
|
text: event.value
|
|
@@ -14014,7 +14039,7 @@ ${thought.description}`;
|
|
|
14014
14039
|
});
|
|
14015
14040
|
break;
|
|
14016
14041
|
}
|
|
14017
|
-
case
|
|
14042
|
+
case GeminiEventType.Thought: {
|
|
14018
14043
|
const thoughtText = `**${event.value.subject}**
|
|
14019
14044
|
${event.value.description}`;
|
|
14020
14045
|
await this.sendUpdate({
|
|
@@ -14023,10 +14048,10 @@ ${event.value.description}`;
|
|
|
14023
14048
|
});
|
|
14024
14049
|
break;
|
|
14025
14050
|
}
|
|
14026
|
-
case
|
|
14051
|
+
case GeminiEventType.ToolCallRequest:
|
|
14027
14052
|
toolCallRequests.push(event.value);
|
|
14028
14053
|
break;
|
|
14029
|
-
case
|
|
14054
|
+
case GeminiEventType.Finished: {
|
|
14030
14055
|
const usage2 = event.value.usageMetadata;
|
|
14031
14056
|
if (usage2) {
|
|
14032
14057
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14034,19 +14059,19 @@ ${event.value.description}`;
|
|
|
14034
14059
|
}
|
|
14035
14060
|
break;
|
|
14036
14061
|
}
|
|
14037
|
-
case
|
|
14062
|
+
case GeminiEventType.ModelInfo:
|
|
14038
14063
|
turnModelId = event.value;
|
|
14039
14064
|
break;
|
|
14040
|
-
case
|
|
14065
|
+
case GeminiEventType.MaxSessionTurns:
|
|
14041
14066
|
stopReason = "max_turn_requests";
|
|
14042
14067
|
break;
|
|
14043
|
-
case
|
|
14068
|
+
case GeminiEventType.LoopDetected:
|
|
14044
14069
|
stopReason = "max_turn_requests";
|
|
14045
14070
|
break;
|
|
14046
|
-
case
|
|
14071
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
14047
14072
|
stopReason = "max_tokens";
|
|
14048
14073
|
break;
|
|
14049
|
-
case
|
|
14074
|
+
case GeminiEventType.Error: {
|
|
14050
14075
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14051
14076
|
event.value.error
|
|
14052
14077
|
);
|
|
@@ -14274,7 +14299,7 @@ ${event.value.description}`;
|
|
|
14274
14299
|
const output = RequestPermissionResponseSchema.parse(
|
|
14275
14300
|
await this.connection.requestPermission(params)
|
|
14276
14301
|
);
|
|
14277
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14302
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14278
14303
|
await confirmationDetails.onConfirm(outcome);
|
|
14279
14304
|
await updatePolicy(
|
|
14280
14305
|
tool,
|
|
@@ -14285,16 +14310,16 @@ ${event.value.description}`;
|
|
|
14285
14310
|
invocation
|
|
14286
14311
|
);
|
|
14287
14312
|
switch (outcome) {
|
|
14288
|
-
case
|
|
14313
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14289
14314
|
return errorResponse(
|
|
14290
14315
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14291
14316
|
);
|
|
14292
|
-
case
|
|
14293
|
-
case
|
|
14294
|
-
case
|
|
14295
|
-
case
|
|
14296
|
-
case
|
|
14297
|
-
case
|
|
14317
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
14318
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
14319
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
14320
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
14321
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
14322
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14298
14323
|
break;
|
|
14299
14324
|
default: {
|
|
14300
14325
|
const resultOutcome = outcome;
|
|
@@ -14348,7 +14373,7 @@ ${event.value.description}`;
|
|
|
14348
14373
|
);
|
|
14349
14374
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14350
14375
|
{
|
|
14351
|
-
status:
|
|
14376
|
+
status: CoreToolCallStatus.Success,
|
|
14352
14377
|
request: {
|
|
14353
14378
|
callId,
|
|
14354
14379
|
name: fc.name,
|
|
@@ -14393,7 +14418,7 @@ ${event.value.description}`;
|
|
|
14393
14418
|
});
|
|
14394
14419
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14395
14420
|
{
|
|
14396
|
-
status:
|
|
14421
|
+
status: CoreToolCallStatus.Error,
|
|
14397
14422
|
request: {
|
|
14398
14423
|
callId,
|
|
14399
14424
|
name: fc.name,
|
|
@@ -14521,12 +14546,12 @@ ${event.value.description}`;
|
|
|
14521
14546
|
sessionId: this.id,
|
|
14522
14547
|
options: [
|
|
14523
14548
|
{
|
|
14524
|
-
optionId:
|
|
14549
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14525
14550
|
name: "Allow once",
|
|
14526
14551
|
kind: "allow_once"
|
|
14527
14552
|
},
|
|
14528
14553
|
{
|
|
14529
|
-
optionId:
|
|
14554
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14530
14555
|
name: "Deny",
|
|
14531
14556
|
kind: "reject_once"
|
|
14532
14557
|
}
|
|
@@ -14551,8 +14576,8 @@ ${event.value.description}`;
|
|
|
14551
14576
|
const output = RequestPermissionResponseSchema.parse(
|
|
14552
14577
|
await this.connection.requestPermission(params)
|
|
14553
14578
|
);
|
|
14554
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14555
|
-
if (outcome ===
|
|
14579
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14580
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14556
14581
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14557
14582
|
validationError = null;
|
|
14558
14583
|
} else {
|
|
@@ -14989,7 +15014,7 @@ var AcpSessionManager = class {
|
|
|
14989
15014
|
mcpServers,
|
|
14990
15015
|
loadedSettings
|
|
14991
15016
|
);
|
|
14992
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15017
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
14993
15018
|
let isAuthenticated = false;
|
|
14994
15019
|
let authErrorMessage = "";
|
|
14995
15020
|
try {
|
|
@@ -15001,7 +15026,7 @@ var AcpSessionManager = class {
|
|
|
15001
15026
|
);
|
|
15002
15027
|
isAuthenticated = true;
|
|
15003
15028
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15004
|
-
if (authType ===
|
|
15029
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15005
15030
|
isAuthenticated = false;
|
|
15006
15031
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15007
15032
|
}
|
|
@@ -15110,7 +15135,7 @@ var AcpSessionManager = class {
|
|
|
15110
15135
|
return response;
|
|
15111
15136
|
}
|
|
15112
15137
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15113
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15138
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
15114
15139
|
if (!selectedAuthType) {
|
|
15115
15140
|
throw RequestError.authRequired();
|
|
15116
15141
|
}
|
|
@@ -15211,12 +15236,12 @@ var GeminiAgent = class {
|
|
|
15211
15236
|
}
|
|
15212
15237
|
const authMethods = [
|
|
15213
15238
|
{
|
|
15214
|
-
id:
|
|
15239
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
15215
15240
|
name: "Log in with Google",
|
|
15216
15241
|
description: "Log in with your Google account"
|
|
15217
15242
|
},
|
|
15218
15243
|
{
|
|
15219
|
-
id:
|
|
15244
|
+
id: AuthType.USE_GEMINI,
|
|
15220
15245
|
name: "Gemini API key",
|
|
15221
15246
|
description: "Use an API key with Gemini Developer API",
|
|
15222
15247
|
_meta: {
|
|
@@ -15226,12 +15251,12 @@ var GeminiAgent = class {
|
|
|
15226
15251
|
}
|
|
15227
15252
|
},
|
|
15228
15253
|
{
|
|
15229
|
-
id:
|
|
15254
|
+
id: AuthType.USE_VERTEX_AI,
|
|
15230
15255
|
name: "Vertex AI",
|
|
15231
15256
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15232
15257
|
},
|
|
15233
15258
|
{
|
|
15234
|
-
id:
|
|
15259
|
+
id: AuthType.GATEWAY,
|
|
15235
15260
|
name: "AI API Gateway",
|
|
15236
15261
|
description: "Use a custom AI API Gateway",
|
|
15237
15262
|
_meta: {
|
|
@@ -15404,7 +15429,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15404
15429
|
}
|
|
15405
15430
|
return authType;
|
|
15406
15431
|
} catch (error) {
|
|
15407
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15432
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
15408
15433
|
handleError(
|
|
15409
15434
|
error instanceof Error ? error : new Error(String(error)),
|
|
15410
15435
|
nonInteractiveConfig,
|
|
@@ -15423,7 +15448,7 @@ async function relaunchOnExitCode(runner) {
|
|
|
15423
15448
|
while (true) {
|
|
15424
15449
|
try {
|
|
15425
15450
|
const exitCode = await runner();
|
|
15426
|
-
if (exitCode !== RELAUNCH_EXIT_CODE) {
|
|
15451
|
+
if (process.platform === "android" || exitCode !== RELAUNCH_EXIT_CODE) {
|
|
15427
15452
|
process.exit(exitCode);
|
|
15428
15453
|
}
|
|
15429
15454
|
} catch (error) {
|
|
@@ -15599,10 +15624,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15599
15624
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15600
15625
|
}
|
|
15601
15626
|
start() {
|
|
15602
|
-
coreEvents.on(
|
|
15627
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15603
15628
|
}
|
|
15604
15629
|
stop() {
|
|
15605
|
-
coreEvents.off(
|
|
15630
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15606
15631
|
if (this.flushTimeout) {
|
|
15607
15632
|
clearTimeout(this.flushTimeout);
|
|
15608
15633
|
this.flushTimeout = null;
|
|
@@ -15883,7 +15908,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15883
15908
|
}
|
|
15884
15909
|
}
|
|
15885
15910
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15886
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15911
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-PCGUDXG4.js");
|
|
15887
15912
|
await doStartUI(
|
|
15888
15913
|
config,
|
|
15889
15914
|
settings,
|
|
@@ -15986,18 +16011,19 @@ async function main() {
|
|
|
15986
16011
|
dns.setDefaultResultOrder(
|
|
15987
16012
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15988
16013
|
);
|
|
15989
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16014
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
15990
16015
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15991
16016
|
settings.setValue(
|
|
15992
16017
|
"User" /* User */,
|
|
15993
16018
|
"security.auth.selectedType",
|
|
15994
|
-
|
|
16019
|
+
AuthType.COMPUTE_ADC
|
|
15995
16020
|
);
|
|
15996
16021
|
}
|
|
15997
16022
|
}
|
|
15998
16023
|
const partialConfig = await loadCliConfig(settings.merged, sessionId, argv, {
|
|
15999
16024
|
projectHooks: settings.workspace.settings.hooks,
|
|
16000
|
-
skipExtensions: true
|
|
16025
|
+
skipExtensions: true,
|
|
16026
|
+
loadedSettings: settings
|
|
16001
16027
|
});
|
|
16002
16028
|
adminControlsListner.setConfig(partialConfig);
|
|
16003
16029
|
let initialAuthFailed = false;
|
|
@@ -16084,13 +16110,14 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16084
16110
|
const loadConfigHandle = startupProfiler.start("load_cli_config");
|
|
16085
16111
|
config = await loadCliConfig(settings.merged, sessionId, argv, {
|
|
16086
16112
|
projectHooks: settings.workspace.settings.hooks,
|
|
16087
|
-
worktreeSettings: worktreeInfo
|
|
16113
|
+
worktreeSettings: worktreeInfo,
|
|
16114
|
+
loadedSettings: settings
|
|
16088
16115
|
});
|
|
16089
16116
|
loadConfigHandle?.end();
|
|
16090
16117
|
await config.storage.initialize();
|
|
16091
16118
|
adminControlsListner.setConfig(config);
|
|
16092
16119
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16093
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16120
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-N5XYKGOS.js");
|
|
16094
16121
|
setupInitialActivityLogger(config);
|
|
16095
16122
|
}
|
|
16096
16123
|
registerTelemetryConfig(config);
|
|
@@ -16098,7 +16125,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16098
16125
|
const messageBus = config.getMessageBus();
|
|
16099
16126
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16100
16127
|
registerCleanup(async () => {
|
|
16101
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
16128
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
16102
16129
|
});
|
|
16103
16130
|
if (!config.getAcpMode()) {
|
|
16104
16131
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16149,7 +16176,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16149
16176
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16150
16177
|
const initializationResult = await initializeApp(config, settings);
|
|
16151
16178
|
initAppHandle?.end();
|
|
16152
|
-
import("./liteRtServerManager-
|
|
16179
|
+
import("./liteRtServerManager-YPEZDSGQ.js").then(({ LiteRtServerManager }) => {
|
|
16153
16180
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16154
16181
|
if (!mergedGemma) return;
|
|
16155
16182
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16159,7 +16186,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16159
16186
|
autoStartServer: userGemma?.autoStartServer
|
|
16160
16187
|
});
|
|
16161
16188
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16162
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16189
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
16163
16190
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16164
16191
|
}
|
|
16165
16192
|
if (config.getAcpMode()) {
|
|
@@ -16175,7 +16202,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16175
16202
|
...rawStartupWarnings.map((message) => ({
|
|
16176
16203
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16177
16204
|
message,
|
|
16178
|
-
priority:
|
|
16205
|
+
priority: WarningPriority.High
|
|
16179
16206
|
})),
|
|
16180
16207
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16181
16208
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16212,7 +16239,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16212
16239
|
${input}` : stdinData;
|
|
16213
16240
|
}
|
|
16214
16241
|
}
|
|
16215
|
-
const sessionStartSource = resumedSessionData ?
|
|
16242
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
16216
16243
|
const hookSystem = config?.getHookSystem();
|
|
16217
16244
|
if (hookSystem) {
|
|
16218
16245
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16269,8 +16296,8 @@ ${input}` : wrappedContext;
|
|
|
16269
16296
|
}
|
|
16270
16297
|
}
|
|
16271
16298
|
function initializeOutputListenersAndFlush(config) {
|
|
16272
|
-
if (coreEvents.listenerCount(
|
|
16273
|
-
coreEvents.on(
|
|
16299
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
16300
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
16274
16301
|
if (payload.isStderr) {
|
|
16275
16302
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16276
16303
|
} else {
|
|
@@ -16278,8 +16305,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16278
16305
|
}
|
|
16279
16306
|
});
|
|
16280
16307
|
}
|
|
16281
|
-
if (coreEvents.listenerCount(
|
|
16282
|
-
coreEvents.on(
|
|
16308
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
16309
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
16283
16310
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16284
16311
|
writeToStderr(payload.content + "\n");
|
|
16285
16312
|
} else {
|
|
@@ -16287,8 +16314,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16287
16314
|
}
|
|
16288
16315
|
});
|
|
16289
16316
|
}
|
|
16290
|
-
if (coreEvents.listenerCount(
|
|
16291
|
-
coreEvents.on(
|
|
16317
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
16318
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
16292
16319
|
writeToStderr(payload.message + "\n");
|
|
16293
16320
|
});
|
|
16294
16321
|
}
|
|
@@ -16296,7 +16323,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16296
16323
|
const forceToStderr = outputFormat === "json";
|
|
16297
16324
|
coreEvents.drainBacklogs(
|
|
16298
16325
|
(event, args) => {
|
|
16299
|
-
if (forceToStderr && event ===
|
|
16326
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
16300
16327
|
const payload = args[0];
|
|
16301
16328
|
if (!payload.isStderr) {
|
|
16302
16329
|
return {
|