@google/gemini-cli 0.70.0 → 0.71.0-nightly.20261120.gd4cb1713f
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-VHXUWMGE.js → chunk-22NLCXU3.js} +2 -2
- package/bundle/{chunk-SPAMAY26.js → chunk-3DBVNRC7.js} +1 -1
- package/bundle/{chunk-FXAACYC3.js → chunk-3VKSDKQA.js} +1 -1
- package/bundle/{chunk-YOEWNBDC.js → chunk-43QQPZRQ.js} +2 -2
- package/bundle/{chunk-5VFAWK3F.js → chunk-4FKCNBUM.js} +1 -1
- package/bundle/{chunk-BOIBJEIO.js → chunk-4SEHQOPY.js} +3 -3
- package/bundle/{chunk-6IKD2NB3.js → chunk-4V6FXIV7.js} +1 -1
- package/bundle/{chunk-FHK4RNCX.js → chunk-4YWPS6WG.js} +7 -7
- package/bundle/{chunk-4BWP3TDK.js → chunk-6VJSIYX5.js} +9 -8
- package/bundle/{chunk-LMNAB62M.js → chunk-7CGFKAQQ.js} +2 -2
- package/bundle/{chunk-3VGGGCOZ.js → chunk-7WRW57EW.js} +2 -2
- package/bundle/{chunk-37D3S3FZ.js → chunk-AQR7HAVC.js} +878 -371
- package/bundle/{chunk-V4HIE5G5.js → chunk-AWAS7A4U.js} +1 -1
- package/bundle/{chunk-GFBMTAPD.js → chunk-BFYOZTEC.js} +8 -6
- package/bundle/{chunk-WRWAVEME.js → chunk-CVDUPOPD.js} +1 -1
- package/bundle/{chunk-JLKRLYZG.js → chunk-EV4MLSRK.js} +2 -2
- package/bundle/{chunk-KV6XIC2Z.js → chunk-H35O2XC7.js} +1 -1
- package/bundle/{chunk-7JS2T75Z.js → chunk-HBX5SUG6.js} +1 -1
- package/bundle/chunk-ID6HT5PN.js +512 -0
- package/bundle/chunk-JUDLPWWJ.js +1962 -0
- package/bundle/{chunk-CB37EK5Y.js → chunk-JVBEESQE.js} +3 -3
- package/bundle/{chunk-EG2BSKPF.js → chunk-L7GW5P2N.js} +1 -1
- package/bundle/{chunk-UF44X63P.js → chunk-MFOWRKY4.js} +782 -323
- package/bundle/chunk-MPPDWK6R.js +40024 -0
- package/bundle/{chunk-G6SC5BOV.js → chunk-NF46UAZ5.js} +1 -1
- package/bundle/chunk-P3QKD7NI.js +190 -0
- package/bundle/chunk-P5SMSWOI.js +65 -0
- package/bundle/{chunk-QYKA4YD7.js → chunk-Q3MSDTUZ.js} +3 -3
- package/bundle/{chunk-AMHNNZY2.js → chunk-QYILFI2Q.js} +7 -7
- package/bundle/{chunk-RFQXG324.js → chunk-R5O4JOJ7.js} +1 -1
- package/bundle/chunk-T5ERFODG.js +118 -0
- package/bundle/{chunk-LMBUPWFC.js → chunk-TKCJYF6S.js} +8765 -15613
- package/bundle/{chunk-CMKRWIX6.js → chunk-WEQEDCCJ.js} +71 -58
- package/bundle/chunk-YGBB6EOP.js +1571 -0
- package/bundle/chunk-ZL2NEMMB.js +420386 -0
- package/bundle/chunk-ZM7BCSH5.js +60338 -0
- package/bundle/{cleanup-BMYAIPAL.js → cleanup-2V4YG4JU.js} +2 -2
- package/bundle/{cleanup-CWOSCK57.js → cleanup-577T3DEI.js} +2 -2
- package/bundle/{cleanup-JTPRPYIQ.js → cleanup-A7BQ5O2C.js} +2 -2
- package/bundle/cleanup-BER5KF3M.js +34 -0
- package/bundle/{core-XZECNCR2.js → core-J5GAQUTA.js} +31 -1
- package/bundle/{devtoolsService-ER22TM2Y.js → devtoolsService-5ICQIIYF.js} +2 -2
- package/bundle/{devtoolsService-WNJOZ7ZT.js → devtoolsService-7E2XLRN6.js} +2 -2
- package/bundle/{devtoolsService-O5VD5YWD.js → devtoolsService-B2G4MIWC.js} +4 -3
- package/bundle/devtoolsService-HFMB7OZU.js +919 -0
- package/bundle/{core-HYVGBZPP.js → dist-63TFONDS.js} +31 -1
- package/bundle/{dist-75NDR3EX.js → dist-J4SRUOE6.js} +31 -1
- package/bundle/dist-J54GSUG2.js +2372 -0
- package/bundle/docs/changelogs/index.md +46 -0
- package/bundle/docs/changelogs/latest.md +82 -100
- package/bundle/docs/changelogs/preview.md +82 -115
- package/bundle/{formatError-M4GLDFGE.js → formatError-ISWUYAZB.js} +2 -2
- package/bundle/{formatError-QOZLAZ32.js → formatError-IX7HHO6M.js} +2 -2
- package/bundle/{formatError-FYLLVZDF.js → formatError-MZRXOV55.js} +2 -2
- package/bundle/formatError-U2ZQLJHB.js +14 -0
- package/bundle/{gemini-AYDYW6NZ.js → gemini-FRGLIXP7.js} +15 -15
- package/bundle/{gemini-PG2FEK5D.js → gemini-GSQARDB2.js} +224 -208
- package/bundle/gemini-KZFVMGY3.js +20020 -0
- package/bundle/{gemini-FRSP6LA3.js → gemini-ZZBTL6TA.js} +15 -15
- package/bundle/gemini.js +8 -8
- package/bundle/{interactiveCli-76LAQB3B.js → interactiveCli-AHDFCTRR.js} +157 -32
- package/bundle/{interactiveCli-BYWR7IEK.js → interactiveCli-MVGIIVAP.js} +157 -32
- package/bundle/{interactiveCli-6TVFB4R5.js → interactiveCli-UN4BNLK2.js} +468 -324
- package/bundle/interactiveCli-XW2S7MKZ.js +36447 -0
- package/bundle/{liteRtServerManager-GIRVSE6M.js → liteRtServerManager-3MOGK3XY.js} +4 -4
- package/bundle/{liteRtServerManager-KZ62KJW3.js → liteRtServerManager-O727KCKA.js} +4 -4
- package/bundle/{liteRtServerManager-BYJWS5BO.js → liteRtServerManager-TSG2V5XN.js} +4 -4
- package/bundle/liteRtServerManager-YLE7JTV7.js +65 -0
- package/bundle/{oauth2-provider-ZBFFAIQE.js → oauth2-provider-3EEFSHG4.js} +1 -1
- package/bundle/{oauth2-provider-SFFQQ6OE.js → oauth2-provider-DWO2KVCY.js} +1 -1
- package/bundle/{oauth2-provider-SRH6I6G7.js → oauth2-provider-G25ZRGDY.js} +41 -79
- package/bundle/oauth2-provider-RHT5OSMO.js +273 -0
- package/bundle/{start-PLK5XHJC.js → start-4XOSRN5A.js} +6 -6
- package/bundle/{start-Q66LTS3Y.js → start-7JXWL6XR.js} +6 -6
- package/bundle/{start-OLEVDFQS.js → start-CAA6RQBK.js} +6 -6
- package/bundle/start-I3RUABAZ.js +18 -0
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JVBEESQE.js";
|
|
6
6
|
import {
|
|
7
7
|
formatCliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3DBVNRC7.js";
|
|
9
9
|
import {
|
|
10
10
|
BuiltinCommandLoader,
|
|
11
11
|
CommandService,
|
|
@@ -49,11 +49,11 @@ import {
|
|
|
49
49
|
updateExtension,
|
|
50
50
|
validateAuthMethod,
|
|
51
51
|
validateContextFilePath
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-4YWPS6WG.js";
|
|
53
53
|
import {
|
|
54
54
|
exitCli,
|
|
55
55
|
require_source
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-HBX5SUG6.js";
|
|
57
57
|
import {
|
|
58
58
|
appEvents
|
|
59
59
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -93,13 +93,13 @@ import {
|
|
|
93
93
|
saveModelChange,
|
|
94
94
|
setAmbiguousCharactersWide,
|
|
95
95
|
stripAnsi
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-MPPDWK6R.js";
|
|
97
97
|
import {
|
|
98
98
|
RELAUNCH_EXIT_CODE,
|
|
99
99
|
isIPCAvailable,
|
|
100
100
|
require_semver
|
|
101
|
-
} from "./chunk-
|
|
102
|
-
import "./chunk-
|
|
101
|
+
} from "./chunk-EV4MLSRK.js";
|
|
102
|
+
import "./chunk-6VJSIYX5.js";
|
|
103
103
|
import {
|
|
104
104
|
cleanupCheckpoints,
|
|
105
105
|
registerCleanup,
|
|
@@ -108,15 +108,18 @@ import {
|
|
|
108
108
|
runExitCleanup,
|
|
109
109
|
runSyncCleanup,
|
|
110
110
|
setupSignalHandlers
|
|
111
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-P3QKD7NI.js";
|
|
112
112
|
import {
|
|
113
113
|
ASK_USER_TOOL_NAME,
|
|
114
114
|
AjvJsonSchemaValidator,
|
|
115
|
+
ApprovalMode,
|
|
115
116
|
AuthType,
|
|
116
117
|
CallToolRequestSchema,
|
|
117
118
|
CallToolResultSchema,
|
|
118
119
|
Client,
|
|
119
120
|
Config,
|
|
121
|
+
CoreEvent,
|
|
122
|
+
CoreToolCallStatus,
|
|
120
123
|
CreateMessageResultSchema,
|
|
121
124
|
CreateMessageResultWithToolsSchema,
|
|
122
125
|
CreateTaskResultSchema,
|
|
@@ -147,6 +150,7 @@ import {
|
|
|
147
150
|
GEMINI_CLI_NESTED_SESSION_ENV_VAR,
|
|
148
151
|
GEMINI_DIR,
|
|
149
152
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
153
|
+
GeminiEventType,
|
|
150
154
|
IdeClient,
|
|
151
155
|
IdeContextNotificationSchema,
|
|
152
156
|
IdeDiffAcceptedNotificationSchema,
|
|
@@ -154,8 +158,11 @@ import {
|
|
|
154
158
|
IdeDiffRejectedNotificationSchema,
|
|
155
159
|
InitializeRequestSchema,
|
|
156
160
|
InitializedNotificationSchema,
|
|
161
|
+
IntegrityStatus,
|
|
157
162
|
InvalidStreamError,
|
|
158
163
|
JsonFormatter,
|
|
164
|
+
JsonStreamEventType,
|
|
165
|
+
Kind,
|
|
159
166
|
LATEST_PROTOCOL_VERSION,
|
|
160
167
|
LegacyAgentSession,
|
|
161
168
|
ListRootsResultSchema,
|
|
@@ -164,14 +171,18 @@ import {
|
|
|
164
171
|
LoggingLevelSchema,
|
|
165
172
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
166
173
|
MCPServerConfig,
|
|
174
|
+
MCPServerStatus,
|
|
167
175
|
McpError,
|
|
176
|
+
MessageBusType,
|
|
168
177
|
NESTED_INTERACTIVE_SESSION_ERROR,
|
|
169
178
|
OTHER_BLOCKED_MESSAGE,
|
|
179
|
+
OutputFormat,
|
|
170
180
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
171
181
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
172
182
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
173
183
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
174
184
|
PREVIEW_GEMINI_MODEL,
|
|
185
|
+
PolicyDecision,
|
|
175
186
|
PolicyIntegrityManager,
|
|
176
187
|
Protocol,
|
|
177
188
|
RECITATION_BLOCKED_MESSAGE,
|
|
@@ -182,6 +193,8 @@ import {
|
|
|
182
193
|
SAFETY_BLOCKED_MESSAGE,
|
|
183
194
|
SUPPORTED_PROTOCOL_VERSIONS,
|
|
184
195
|
Scheduler,
|
|
196
|
+
SessionEndReason,
|
|
197
|
+
SessionStartSource,
|
|
185
198
|
SetLevelRequestSchema,
|
|
186
199
|
ShellExecutionService,
|
|
187
200
|
SimpleExtensionLoader,
|
|
@@ -192,10 +205,13 @@ import {
|
|
|
192
205
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
193
206
|
ToolCallEvent,
|
|
194
207
|
ToolConfirmationOutcome,
|
|
208
|
+
ToolErrorType,
|
|
209
|
+
TrustLevel,
|
|
195
210
|
UserAccountManager,
|
|
196
211
|
UserPromptEvent,
|
|
197
212
|
ValidationCancelledError,
|
|
198
213
|
ValidationRequiredError,
|
|
214
|
+
WarningPriority,
|
|
199
215
|
applyAdminAllowlist,
|
|
200
216
|
applyRequiredServers,
|
|
201
217
|
assertClientRequestTaskCapability,
|
|
@@ -290,7 +306,7 @@ import {
|
|
|
290
306
|
updatePolicy,
|
|
291
307
|
writeToStderr,
|
|
292
308
|
writeToStdout
|
|
293
|
-
} from "./chunk-
|
|
309
|
+
} from "./chunk-ZL2NEMMB.js";
|
|
294
310
|
import "./chunk-W2AJR23G.js";
|
|
295
311
|
import "./chunk-N7J54YNL.js";
|
|
296
312
|
import "./chunk-L6PII3GR.js";
|
|
@@ -5439,7 +5455,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5439
5455
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5440
5456
|
const isStdio = !!config.command;
|
|
5441
5457
|
if (isStdio && !isTrusted) {
|
|
5442
|
-
return
|
|
5458
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5443
5459
|
}
|
|
5444
5460
|
const client = new Client({
|
|
5445
5461
|
name: "mcp-test-client",
|
|
@@ -5475,7 +5491,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5475
5491
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5476
5492
|
} catch {
|
|
5477
5493
|
await client.close();
|
|
5478
|
-
return
|
|
5494
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5479
5495
|
}
|
|
5480
5496
|
try {
|
|
5481
5497
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5489,10 +5505,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5489
5505
|
);
|
|
5490
5506
|
}
|
|
5491
5507
|
await client.close();
|
|
5492
|
-
return
|
|
5508
|
+
return MCPServerStatus.CONNECTED;
|
|
5493
5509
|
} catch {
|
|
5494
5510
|
await transport.close();
|
|
5495
|
-
return
|
|
5511
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5496
5512
|
}
|
|
5497
5513
|
}
|
|
5498
5514
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5505,12 +5521,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5505
5521
|
});
|
|
5506
5522
|
if (!loadResult.allowed) {
|
|
5507
5523
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5508
|
-
return
|
|
5524
|
+
return MCPServerStatus.BLOCKED;
|
|
5509
5525
|
}
|
|
5510
|
-
return
|
|
5526
|
+
return MCPServerStatus.DISABLED;
|
|
5511
5527
|
}
|
|
5512
5528
|
if (!isTrusted) {
|
|
5513
|
-
return
|
|
5529
|
+
return MCPServerStatus.DISABLED;
|
|
5514
5530
|
}
|
|
5515
5531
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5516
5532
|
}
|
|
@@ -5556,23 +5572,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5556
5572
|
let statusIndicator = "";
|
|
5557
5573
|
let statusText = "";
|
|
5558
5574
|
switch (status) {
|
|
5559
|
-
case
|
|
5575
|
+
case MCPServerStatus.CONNECTED:
|
|
5560
5576
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5561
5577
|
statusText = "Connected";
|
|
5562
5578
|
break;
|
|
5563
|
-
case
|
|
5579
|
+
case MCPServerStatus.CONNECTING:
|
|
5564
5580
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5565
5581
|
statusText = "Connecting";
|
|
5566
5582
|
break;
|
|
5567
|
-
case
|
|
5583
|
+
case MCPServerStatus.BLOCKED:
|
|
5568
5584
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5569
5585
|
statusText = "Blocked";
|
|
5570
5586
|
break;
|
|
5571
|
-
case
|
|
5587
|
+
case MCPServerStatus.DISABLED:
|
|
5572
5588
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5573
5589
|
statusText = "Disabled";
|
|
5574
5590
|
break;
|
|
5575
|
-
case
|
|
5591
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5576
5592
|
default:
|
|
5577
5593
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5578
5594
|
statusText = "Disconnected";
|
|
@@ -5858,7 +5874,7 @@ async function handleInstall(args) {
|
|
|
5858
5874
|
);
|
|
5859
5875
|
if (confirmed) {
|
|
5860
5876
|
const trustedFolders = loadTrustedFolders();
|
|
5861
|
-
await trustedFolders.setValue(realPath,
|
|
5877
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5862
5878
|
} else {
|
|
5863
5879
|
throw new Error(
|
|
5864
5880
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7957,12 +7973,12 @@ function toToolCallContent(toolResult) {
|
|
|
7957
7973
|
}
|
|
7958
7974
|
var basicPermissionOptions = [
|
|
7959
7975
|
{
|
|
7960
|
-
optionId:
|
|
7976
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
7961
7977
|
name: "Allow",
|
|
7962
7978
|
kind: "allow_once"
|
|
7963
7979
|
},
|
|
7964
7980
|
{
|
|
7965
|
-
optionId:
|
|
7981
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
7966
7982
|
name: "Reject",
|
|
7967
7983
|
kind: "reject_once"
|
|
7968
7984
|
}
|
|
@@ -7974,13 +7990,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
7974
7990
|
switch (confirmation.type) {
|
|
7975
7991
|
case "edit":
|
|
7976
7992
|
options.push({
|
|
7977
|
-
optionId:
|
|
7993
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
7978
7994
|
name: "Allow for this session",
|
|
7979
7995
|
kind: "allow_always"
|
|
7980
7996
|
});
|
|
7981
7997
|
if (enablePermanentToolApproval) {
|
|
7982
7998
|
options.push({
|
|
7983
|
-
optionId:
|
|
7999
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
7984
8000
|
name: "Allow for this file in all future sessions",
|
|
7985
8001
|
kind: "allow_always"
|
|
7986
8002
|
});
|
|
@@ -7988,13 +8004,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
7988
8004
|
break;
|
|
7989
8005
|
case "exec":
|
|
7990
8006
|
options.push({
|
|
7991
|
-
optionId:
|
|
8007
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
7992
8008
|
name: "Allow for this session",
|
|
7993
8009
|
kind: "allow_always"
|
|
7994
8010
|
});
|
|
7995
8011
|
if (enablePermanentToolApproval) {
|
|
7996
8012
|
options.push({
|
|
7997
|
-
optionId:
|
|
8013
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
7998
8014
|
name: "Allow this command for all future sessions",
|
|
7999
8015
|
kind: "allow_always"
|
|
8000
8016
|
});
|
|
@@ -8005,19 +8021,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
8005
8021
|
const toolName = confirmation.toolName?.trim() || "generic_tool";
|
|
8006
8022
|
options.push(
|
|
8007
8023
|
{
|
|
8008
|
-
optionId:
|
|
8024
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
8009
8025
|
name: `Allow all "${serverName}" server tools for this session`,
|
|
8010
8026
|
kind: "allow_always"
|
|
8011
8027
|
},
|
|
8012
8028
|
{
|
|
8013
|
-
optionId:
|
|
8029
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
8014
8030
|
name: `Allow tool "${toolName}" for this session`,
|
|
8015
8031
|
kind: "allow_always"
|
|
8016
8032
|
}
|
|
8017
8033
|
);
|
|
8018
8034
|
if (enablePermanentToolApproval) {
|
|
8019
8035
|
options.push({
|
|
8020
|
-
optionId:
|
|
8036
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
8021
8037
|
name: `Allow tool "${toolName}" for all future sessions`,
|
|
8022
8038
|
kind: "allow_always"
|
|
8023
8039
|
});
|
|
@@ -8026,13 +8042,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
8026
8042
|
}
|
|
8027
8043
|
case "info":
|
|
8028
8044
|
options.push({
|
|
8029
|
-
optionId:
|
|
8045
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
8030
8046
|
name: "Allow for this session",
|
|
8031
8047
|
kind: "allow_always"
|
|
8032
8048
|
});
|
|
8033
8049
|
if (enablePermanentToolApproval) {
|
|
8034
8050
|
options.push({
|
|
8035
|
-
optionId:
|
|
8051
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
8036
8052
|
name: "Allow for all future sessions",
|
|
8037
8053
|
kind: "allow_always"
|
|
8038
8054
|
});
|
|
@@ -8064,21 +8080,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
8064
8080
|
}
|
|
8065
8081
|
function toAcpToolKind(kind) {
|
|
8066
8082
|
switch (kind) {
|
|
8067
|
-
case
|
|
8068
|
-
case
|
|
8069
|
-
case
|
|
8070
|
-
case
|
|
8071
|
-
case
|
|
8072
|
-
case
|
|
8073
|
-
case
|
|
8074
|
-
case
|
|
8075
|
-
case
|
|
8076
|
-
case
|
|
8083
|
+
case Kind.Read:
|
|
8084
|
+
case Kind.Edit:
|
|
8085
|
+
case Kind.Execute:
|
|
8086
|
+
case Kind.Search:
|
|
8087
|
+
case Kind.Delete:
|
|
8088
|
+
case Kind.Move:
|
|
8089
|
+
case Kind.Think:
|
|
8090
|
+
case Kind.Fetch:
|
|
8091
|
+
case Kind.SwitchMode:
|
|
8092
|
+
case Kind.Other:
|
|
8077
8093
|
return kind;
|
|
8078
|
-
case
|
|
8094
|
+
case Kind.Agent:
|
|
8079
8095
|
return "think";
|
|
8080
|
-
case
|
|
8081
|
-
case
|
|
8096
|
+
case Kind.Plan:
|
|
8097
|
+
case Kind.Communicate:
|
|
8082
8098
|
default:
|
|
8083
8099
|
return "other";
|
|
8084
8100
|
}
|
|
@@ -8086,24 +8102,24 @@ function toAcpToolKind(kind) {
|
|
|
8086
8102
|
function buildAvailableModes(isPlanEnabled) {
|
|
8087
8103
|
const modes = [
|
|
8088
8104
|
{
|
|
8089
|
-
id:
|
|
8105
|
+
id: ApprovalMode.DEFAULT,
|
|
8090
8106
|
name: "Default",
|
|
8091
8107
|
description: "Prompts for approval"
|
|
8092
8108
|
},
|
|
8093
8109
|
{
|
|
8094
|
-
id:
|
|
8110
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
8095
8111
|
name: "Auto Edit",
|
|
8096
8112
|
description: "Auto-approves edit tools"
|
|
8097
8113
|
},
|
|
8098
8114
|
{
|
|
8099
|
-
id:
|
|
8115
|
+
id: ApprovalMode.YOLO,
|
|
8100
8116
|
name: "YOLO",
|
|
8101
8117
|
description: "Auto-approves all tools"
|
|
8102
8118
|
}
|
|
8103
8119
|
];
|
|
8104
8120
|
if (isPlanEnabled) {
|
|
8105
8121
|
modes.push({
|
|
8106
|
-
id:
|
|
8122
|
+
id: ApprovalMode.PLAN,
|
|
8107
8123
|
name: "Plan",
|
|
8108
8124
|
description: "Read-only mode"
|
|
8109
8125
|
});
|
|
@@ -8117,7 +8133,7 @@ function buildAvailableModels(config, settings) {
|
|
|
8117
8133
|
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
8118
8134
|
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
8119
8135
|
const selectedAuthType = settings.merged.security?.auth?.selectedType ?? config.getContentGeneratorConfig?.()?.authType;
|
|
8120
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
8136
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
8121
8137
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
8122
8138
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
8123
8139
|
useGemini3_1: useGemini31,
|
|
@@ -8278,7 +8294,7 @@ async function handleList3(options) {
|
|
|
8278
8294
|
}
|
|
8279
8295
|
if (authType && !authConfig?.useExternal) {
|
|
8280
8296
|
try {
|
|
8281
|
-
if (authType !==
|
|
8297
|
+
if (authType !== AuthType.GATEWAY) {
|
|
8282
8298
|
const authError = await validateAuthMethod(authType);
|
|
8283
8299
|
if (authError) {
|
|
8284
8300
|
throw new Error(authError);
|
|
@@ -8456,7 +8472,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
8456
8472
|
}
|
|
8457
8473
|
const command2 = getSandboxCommand(sandboxValue);
|
|
8458
8474
|
const packageJson = await getPackageJson(__dirname3);
|
|
8459
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
8475
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.71.0-nightly.20261118.g615d6bc8c" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
8460
8476
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
8461
8477
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
8462
8478
|
}
|
|
@@ -8515,9 +8531,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
8515
8531
|
cwd,
|
|
8516
8532
|
potentialWorkspacePoliciesDir
|
|
8517
8533
|
);
|
|
8518
|
-
if (integrityResult.status ===
|
|
8534
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
8519
8535
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
8520
|
-
} else if (integrityResult.status ===
|
|
8536
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
8521
8537
|
workspacePoliciesDir = void 0;
|
|
8522
8538
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
8523
8539
|
policyUpdateConfirmationRequest = {
|
|
@@ -8987,23 +9003,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8987
9003
|
if (rawApprovalMode) {
|
|
8988
9004
|
switch (rawApprovalMode) {
|
|
8989
9005
|
case "yolo":
|
|
8990
|
-
approvalMode =
|
|
9006
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8991
9007
|
break;
|
|
8992
9008
|
case "auto_edit":
|
|
8993
|
-
approvalMode =
|
|
9009
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8994
9010
|
break;
|
|
8995
9011
|
case "plan":
|
|
8996
9012
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8997
9013
|
debugLogger.warn(
|
|
8998
9014
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8999
9015
|
);
|
|
9000
|
-
approvalMode =
|
|
9016
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9001
9017
|
} else {
|
|
9002
|
-
approvalMode =
|
|
9018
|
+
approvalMode = ApprovalMode.PLAN;
|
|
9003
9019
|
}
|
|
9004
9020
|
break;
|
|
9005
9021
|
case "default":
|
|
9006
|
-
approvalMode =
|
|
9022
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9007
9023
|
break;
|
|
9008
9024
|
default:
|
|
9009
9025
|
throw new Error(
|
|
@@ -9011,10 +9027,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
9011
9027
|
);
|
|
9012
9028
|
}
|
|
9013
9029
|
} else {
|
|
9014
|
-
approvalMode =
|
|
9030
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9015
9031
|
}
|
|
9016
9032
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
9017
|
-
if (approvalMode ===
|
|
9033
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
9018
9034
|
if (settings.admin?.secureModeEnabled) {
|
|
9019
9035
|
debugLogger.error(
|
|
9020
9036
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -9032,16 +9048,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
9032
9048
|
)
|
|
9033
9049
|
);
|
|
9034
9050
|
}
|
|
9035
|
-
} else if (approvalMode ===
|
|
9051
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
9036
9052
|
debugLogger.warn(
|
|
9037
9053
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
9038
9054
|
);
|
|
9039
9055
|
}
|
|
9040
|
-
if (!trustedFolder && approvalMode !==
|
|
9056
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
9041
9057
|
debugLogger.warn(
|
|
9042
9058
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
9043
9059
|
);
|
|
9044
|
-
approvalMode =
|
|
9060
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9045
9061
|
}
|
|
9046
9062
|
let telemetrySettings;
|
|
9047
9063
|
try {
|
|
@@ -13031,11 +13047,11 @@ var TRUST_WORKSPACE_ENV = "GEMINI_CLI_TRUST_WORKSPACE";
|
|
|
13031
13047
|
function parseTrustChoice(answer) {
|
|
13032
13048
|
switch (answer.trim()) {
|
|
13033
13049
|
case "1":
|
|
13034
|
-
return
|
|
13050
|
+
return TrustLevel.TRUST_FOLDER;
|
|
13035
13051
|
case "2":
|
|
13036
|
-
return
|
|
13052
|
+
return TrustLevel.TRUST_PARENT;
|
|
13037
13053
|
case "3":
|
|
13038
|
-
return
|
|
13054
|
+
return TrustLevel.DO_NOT_TRUST;
|
|
13039
13055
|
default:
|
|
13040
13056
|
return void 0;
|
|
13041
13057
|
}
|
|
@@ -13073,7 +13089,7 @@ async function resolveFolderTrustForSandbox({
|
|
|
13073
13089
|
} catch {
|
|
13074
13090
|
throw new FatalConfigError("Failed to save trust settings.");
|
|
13075
13091
|
}
|
|
13076
|
-
isTrusted = trustLevel !==
|
|
13092
|
+
isTrusted = trustLevel !== TrustLevel.DO_NOT_TRUST;
|
|
13077
13093
|
}
|
|
13078
13094
|
process.env[TRUST_WORKSPACE_ENV] = isTrusted ? "true" : "false";
|
|
13079
13095
|
}
|
|
@@ -13207,7 +13223,7 @@ import path13 from "node:path";
|
|
|
13207
13223
|
import process5 from "node:process";
|
|
13208
13224
|
var homeDirectoryCheck = {
|
|
13209
13225
|
id: "home-directory",
|
|
13210
|
-
priority:
|
|
13226
|
+
priority: WarningPriority.Low,
|
|
13211
13227
|
check: async (workspaceRoot, settings) => {
|
|
13212
13228
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
13213
13229
|
return null;
|
|
@@ -13231,7 +13247,7 @@ var homeDirectoryCheck = {
|
|
|
13231
13247
|
};
|
|
13232
13248
|
var rootDirectoryCheck = {
|
|
13233
13249
|
id: "root-directory",
|
|
13234
|
-
priority:
|
|
13250
|
+
priority: WarningPriority.High,
|
|
13235
13251
|
check: async (workspaceRoot, _settings) => {
|
|
13236
13252
|
try {
|
|
13237
13253
|
const workspaceRealPath = await fs10.realpath(workspaceRoot);
|
|
@@ -13247,7 +13263,7 @@ var rootDirectoryCheck = {
|
|
|
13247
13263
|
};
|
|
13248
13264
|
var folderTrustCheck = {
|
|
13249
13265
|
id: "folder-trust",
|
|
13250
|
-
priority:
|
|
13266
|
+
priority: WarningPriority.High,
|
|
13251
13267
|
check: async (workspaceRoot, settings) => {
|
|
13252
13268
|
if (!isFolderTrustEnabled(settings)) {
|
|
13253
13269
|
return null;
|
|
@@ -13437,12 +13453,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
13437
13453
|
error,
|
|
13438
13454
|
config.getContentGeneratorConfig()?.authType
|
|
13439
13455
|
);
|
|
13440
|
-
if (config.getOutputFormat() ===
|
|
13456
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13441
13457
|
const streamFormatter = new StreamJsonFormatter();
|
|
13442
13458
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
13443
13459
|
const metrics = uiTelemetryService.getMetrics();
|
|
13444
13460
|
streamFormatter.emitEvent({
|
|
13445
|
-
type:
|
|
13461
|
+
type: JsonStreamEventType.RESULT,
|
|
13446
13462
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13447
13463
|
status: "error",
|
|
13448
13464
|
error: {
|
|
@@ -13453,7 +13469,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
13453
13469
|
});
|
|
13454
13470
|
runSyncCleanup();
|
|
13455
13471
|
process.exit(getNumericExitCode(errorCode));
|
|
13456
|
-
} else if (config.getOutputFormat() ===
|
|
13472
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13457
13473
|
const formatter = new JsonFormatter();
|
|
13458
13474
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
13459
13475
|
const formattedError = formatter.formatError(
|
|
@@ -13473,11 +13489,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
13473
13489
|
const isFatal = isFatalToolError(errorType);
|
|
13474
13490
|
if (isFatal) {
|
|
13475
13491
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
13476
|
-
if (config.getOutputFormat() ===
|
|
13492
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13477
13493
|
const streamFormatter = new StreamJsonFormatter();
|
|
13478
13494
|
const metrics = uiTelemetryService.getMetrics();
|
|
13479
13495
|
streamFormatter.emitEvent({
|
|
13480
|
-
type:
|
|
13496
|
+
type: JsonStreamEventType.RESULT,
|
|
13481
13497
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13482
13498
|
status: "error",
|
|
13483
13499
|
error: {
|
|
@@ -13486,7 +13502,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
13486
13502
|
},
|
|
13487
13503
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
13488
13504
|
});
|
|
13489
|
-
} else if (config.getOutputFormat() ===
|
|
13505
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13490
13506
|
const formatter = new JsonFormatter();
|
|
13491
13507
|
const formattedError = formatter.formatError(
|
|
13492
13508
|
toolExecutionError,
|
|
@@ -13507,11 +13523,11 @@ function handleCancellationError(config, exitCode = 130) {
|
|
|
13507
13523
|
"Operation cancelled.",
|
|
13508
13524
|
exitCode
|
|
13509
13525
|
);
|
|
13510
|
-
if (config.getOutputFormat() ===
|
|
13526
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13511
13527
|
const streamFormatter = new StreamJsonFormatter();
|
|
13512
13528
|
const metrics = uiTelemetryService.getMetrics();
|
|
13513
13529
|
streamFormatter.emitEvent({
|
|
13514
|
-
type:
|
|
13530
|
+
type: JsonStreamEventType.RESULT,
|
|
13515
13531
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13516
13532
|
status: "error",
|
|
13517
13533
|
error: {
|
|
@@ -13522,7 +13538,7 @@ function handleCancellationError(config, exitCode = 130) {
|
|
|
13522
13538
|
});
|
|
13523
13539
|
runSyncCleanup();
|
|
13524
13540
|
process.exit(cancellationError.exitCode);
|
|
13525
|
-
} else if (config.getOutputFormat() ===
|
|
13541
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13526
13542
|
const formatter = new JsonFormatter();
|
|
13527
13543
|
const formattedError = formatter.formatError(
|
|
13528
13544
|
cancellationError,
|
|
@@ -13542,11 +13558,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
13542
13558
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
13543
13559
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
13544
13560
|
);
|
|
13545
|
-
if (config.getOutputFormat() ===
|
|
13561
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13546
13562
|
const streamFormatter = new StreamJsonFormatter();
|
|
13547
13563
|
const metrics = uiTelemetryService.getMetrics();
|
|
13548
13564
|
streamFormatter.emitEvent({
|
|
13549
|
-
type:
|
|
13565
|
+
type: JsonStreamEventType.RESULT,
|
|
13550
13566
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13551
13567
|
status: "error",
|
|
13552
13568
|
error: {
|
|
@@ -13557,7 +13573,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
13557
13573
|
});
|
|
13558
13574
|
runSyncCleanup();
|
|
13559
13575
|
process.exit(maxTurnsError.exitCode);
|
|
13560
|
-
} else if (config.getOutputFormat() ===
|
|
13576
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13561
13577
|
const formatter = new JsonFormatter();
|
|
13562
13578
|
const formattedError = formatter.formatError(
|
|
13563
13579
|
maxTurnsError,
|
|
@@ -13640,7 +13656,7 @@ async function runNonInteractive({
|
|
|
13640
13656
|
}
|
|
13641
13657
|
});
|
|
13642
13658
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
13643
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
13659
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-B2G4MIWC.js");
|
|
13644
13660
|
setupInitialActivityLogger(config);
|
|
13645
13661
|
}
|
|
13646
13662
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -13656,7 +13672,7 @@ async function runNonInteractive({
|
|
|
13656
13672
|
}
|
|
13657
13673
|
};
|
|
13658
13674
|
const startTime = Date.now();
|
|
13659
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
13675
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
13660
13676
|
const abortController = new AbortController();
|
|
13661
13677
|
let isAborting = false;
|
|
13662
13678
|
let cancelMessageTimer = null;
|
|
@@ -13742,13 +13758,13 @@ async function runNonInteractive({
|
|
|
13742
13758
|
};
|
|
13743
13759
|
try {
|
|
13744
13760
|
consolePatcher.patch();
|
|
13745
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
13761
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
13746
13762
|
process.stderr.write(
|
|
13747
13763
|
"[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"
|
|
13748
13764
|
);
|
|
13749
13765
|
}
|
|
13750
13766
|
setupCancellation();
|
|
13751
|
-
coreEvents.on(
|
|
13767
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
13752
13768
|
coreEvents.drainBacklogs();
|
|
13753
13769
|
process.stdout.on("error", handleStdoutError);
|
|
13754
13770
|
const geminiClient = config.getGeminiClient();
|
|
@@ -13768,7 +13784,7 @@ async function runNonInteractive({
|
|
|
13768
13784
|
}
|
|
13769
13785
|
if (streamFormatter) {
|
|
13770
13786
|
streamFormatter.emitEvent({
|
|
13771
|
-
type:
|
|
13787
|
+
type: JsonStreamEventType.INIT,
|
|
13772
13788
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13773
13789
|
session_id: config.getSessionId(),
|
|
13774
13790
|
model: config.getModel()
|
|
@@ -13806,7 +13822,7 @@ async function runNonInteractive({
|
|
|
13806
13822
|
}
|
|
13807
13823
|
if (streamFormatter) {
|
|
13808
13824
|
streamFormatter.emitEvent({
|
|
13809
|
-
type:
|
|
13825
|
+
type: JsonStreamEventType.MESSAGE,
|
|
13810
13826
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13811
13827
|
role: "user",
|
|
13812
13828
|
content: input
|
|
@@ -13845,12 +13861,12 @@ async function runNonInteractive({
|
|
|
13845
13861
|
const metrics = uiTelemetryService.getMetrics();
|
|
13846
13862
|
const durationMs = Date.now() - startTime;
|
|
13847
13863
|
streamFormatter.emitEvent({
|
|
13848
|
-
type:
|
|
13864
|
+
type: JsonStreamEventType.RESULT,
|
|
13849
13865
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13850
13866
|
status: errorPayload ? "error" : "success",
|
|
13851
13867
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
13852
13868
|
});
|
|
13853
|
-
} else if (config.getOutputFormat() ===
|
|
13869
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13854
13870
|
const formatter = new JsonFormatter();
|
|
13855
13871
|
const stats = uiTelemetryService.getMetrics();
|
|
13856
13872
|
textOutput.write(
|
|
@@ -13942,13 +13958,13 @@ async function runNonInteractive({
|
|
|
13942
13958
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
13943
13959
|
if (streamFormatter) {
|
|
13944
13960
|
streamFormatter.emitEvent({
|
|
13945
|
-
type:
|
|
13961
|
+
type: JsonStreamEventType.MESSAGE,
|
|
13946
13962
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13947
13963
|
role: "assistant",
|
|
13948
13964
|
content: output,
|
|
13949
13965
|
delta: true
|
|
13950
13966
|
});
|
|
13951
|
-
} else if (config.getOutputFormat() ===
|
|
13967
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13952
13968
|
responseText += output;
|
|
13953
13969
|
} else {
|
|
13954
13970
|
if (part.text) {
|
|
@@ -13961,13 +13977,13 @@ async function runNonInteractive({
|
|
|
13961
13977
|
break;
|
|
13962
13978
|
}
|
|
13963
13979
|
case "tool_request": {
|
|
13964
|
-
if (config.getOutputFormat() ===
|
|
13980
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13965
13981
|
preToolResponseText = responseText || preToolResponseText;
|
|
13966
13982
|
responseText = "";
|
|
13967
13983
|
}
|
|
13968
13984
|
if (streamFormatter) {
|
|
13969
13985
|
streamFormatter.emitEvent({
|
|
13970
|
-
type:
|
|
13986
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
13971
13987
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13972
13988
|
tool_name: event.name,
|
|
13973
13989
|
tool_id: event.requestId,
|
|
@@ -13983,7 +13999,7 @@ async function runNonInteractive({
|
|
|
13983
13999
|
const displayText = displayContentToString(display);
|
|
13984
14000
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
13985
14001
|
streamFormatter.emitEvent({
|
|
13986
|
-
type:
|
|
14002
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
13987
14003
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13988
14004
|
tool_id: event.requestId,
|
|
13989
14005
|
status: event.isError ? "error" : "success",
|
|
@@ -13998,17 +14014,17 @@ async function runNonInteractive({
|
|
|
13998
14014
|
const display = event.display?.result;
|
|
13999
14015
|
const displayText = displayContentToString(display);
|
|
14000
14016
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
14001
|
-
if (event.data?.["errorType"] ===
|
|
14002
|
-
if (config.getOutputFormat() ===
|
|
14017
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
14018
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
14003
14019
|
responseText = preToolResponseText;
|
|
14004
14020
|
}
|
|
14005
14021
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
14006
|
-
if (config.getOutputFormat() ===
|
|
14022
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14007
14023
|
process.stderr.write(`${stopMessage}
|
|
14008
14024
|
`);
|
|
14009
14025
|
}
|
|
14010
14026
|
}
|
|
14011
|
-
if (event.data?.["errorType"] ===
|
|
14027
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
14012
14028
|
throw new FatalToolExecutionError(
|
|
14013
14029
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
14014
14030
|
);
|
|
@@ -14043,12 +14059,12 @@ async function runNonInteractive({
|
|
|
14043
14059
|
}
|
|
14044
14060
|
if (streamFormatter) {
|
|
14045
14061
|
streamFormatter.emitEvent({
|
|
14046
|
-
type:
|
|
14062
|
+
type: JsonStreamEventType.ERROR,
|
|
14047
14063
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14048
14064
|
severity: "error",
|
|
14049
14065
|
message: errorMessage
|
|
14050
14066
|
});
|
|
14051
|
-
} else if (config.getOutputFormat() ===
|
|
14067
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14052
14068
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
14053
14069
|
`);
|
|
14054
14070
|
}
|
|
@@ -14069,12 +14085,12 @@ async function runNonInteractive({
|
|
|
14069
14085
|
const errorCode = event._meta?.["code"];
|
|
14070
14086
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
14071
14087
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
14072
|
-
if (config.getOutputFormat() ===
|
|
14088
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14073
14089
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
14074
14090
|
`);
|
|
14075
14091
|
} else if (streamFormatter) {
|
|
14076
14092
|
streamFormatter.emitEvent({
|
|
14077
|
-
type:
|
|
14093
|
+
type: JsonStreamEventType.ERROR,
|
|
14078
14094
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14079
14095
|
severity: "warning",
|
|
14080
14096
|
message: stripAnsi(blockMessage)
|
|
@@ -14084,13 +14100,13 @@ async function runNonInteractive({
|
|
|
14084
14100
|
break;
|
|
14085
14101
|
}
|
|
14086
14102
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
14087
|
-
if (config.getOutputFormat() ===
|
|
14103
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14088
14104
|
process.stderr.write(`[WARNING] ${event.message}
|
|
14089
14105
|
`);
|
|
14090
14106
|
}
|
|
14091
14107
|
if (streamFormatter) {
|
|
14092
14108
|
streamFormatter.emitEvent({
|
|
14093
|
-
type:
|
|
14109
|
+
type: JsonStreamEventType.ERROR,
|
|
14094
14110
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14095
14111
|
severity,
|
|
14096
14112
|
message: stripAnsi(event.message)
|
|
@@ -14110,7 +14126,7 @@ async function runNonInteractive({
|
|
|
14110
14126
|
);
|
|
14111
14127
|
} else if (streamFormatter) {
|
|
14112
14128
|
streamFormatter.emitEvent({
|
|
14113
|
-
type:
|
|
14129
|
+
type: JsonStreamEventType.ERROR,
|
|
14114
14130
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14115
14131
|
severity: "error",
|
|
14116
14132
|
message: "Maximum session turns exceeded"
|
|
@@ -14118,7 +14134,7 @@ async function runNonInteractive({
|
|
|
14118
14134
|
}
|
|
14119
14135
|
}
|
|
14120
14136
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
14121
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
14137
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14122
14138
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
14123
14139
|
`);
|
|
14124
14140
|
}
|
|
@@ -14148,7 +14164,7 @@ async function runNonInteractive({
|
|
|
14148
14164
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
14149
14165
|
scheduler?.dispose();
|
|
14150
14166
|
consolePatcher.cleanup();
|
|
14151
|
-
coreEvents.off(
|
|
14167
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
14152
14168
|
await runExitCleanup();
|
|
14153
14169
|
}
|
|
14154
14170
|
if (abortController.signal.aborted || isFatalCancellationError(errorToHandle)) {
|
|
@@ -14181,7 +14197,7 @@ async function runNonInteractive2(params) {
|
|
|
14181
14197
|
}
|
|
14182
14198
|
});
|
|
14183
14199
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
14184
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
14200
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-B2G4MIWC.js");
|
|
14185
14201
|
setupInitialActivityLogger(config);
|
|
14186
14202
|
}
|
|
14187
14203
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -14197,7 +14213,7 @@ async function runNonInteractive2(params) {
|
|
|
14197
14213
|
}
|
|
14198
14214
|
};
|
|
14199
14215
|
const startTime = Date.now();
|
|
14200
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
14216
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
14201
14217
|
const abortController = new AbortController();
|
|
14202
14218
|
let isAborting = false;
|
|
14203
14219
|
let cancelMessageTimer = null;
|
|
@@ -14281,13 +14297,13 @@ async function runNonInteractive2(params) {
|
|
|
14281
14297
|
let scheduler;
|
|
14282
14298
|
try {
|
|
14283
14299
|
consolePatcher.patch();
|
|
14284
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
14300
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14285
14301
|
process.stderr.write(
|
|
14286
14302
|
"[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"
|
|
14287
14303
|
);
|
|
14288
14304
|
}
|
|
14289
14305
|
setupCancellation();
|
|
14290
|
-
coreEvents.on(
|
|
14306
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
14291
14307
|
coreEvents.drainBacklogs();
|
|
14292
14308
|
process.stdout.on("error", handleStdoutError);
|
|
14293
14309
|
const geminiClient = config.getGeminiClient();
|
|
@@ -14307,7 +14323,7 @@ async function runNonInteractive2(params) {
|
|
|
14307
14323
|
}
|
|
14308
14324
|
if (streamFormatter) {
|
|
14309
14325
|
streamFormatter.emitEvent({
|
|
14310
|
-
type:
|
|
14326
|
+
type: JsonStreamEventType.INIT,
|
|
14311
14327
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14312
14328
|
session_id: config.getSessionId(),
|
|
14313
14329
|
model: config.getModel()
|
|
@@ -14345,7 +14361,7 @@ async function runNonInteractive2(params) {
|
|
|
14345
14361
|
}
|
|
14346
14362
|
if (streamFormatter) {
|
|
14347
14363
|
streamFormatter.emitEvent({
|
|
14348
|
-
type:
|
|
14364
|
+
type: JsonStreamEventType.MESSAGE,
|
|
14349
14365
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14350
14366
|
role: "user",
|
|
14351
14367
|
content: input
|
|
@@ -14373,28 +14389,28 @@ async function runNonInteractive2(params) {
|
|
|
14373
14389
|
if (abortController.signal.aborted) {
|
|
14374
14390
|
handleCancellationError(config, abortExitCode);
|
|
14375
14391
|
}
|
|
14376
|
-
if (event.type ===
|
|
14392
|
+
if (event.type === GeminiEventType.Content) {
|
|
14377
14393
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
14378
14394
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
14379
14395
|
if (streamFormatter) {
|
|
14380
14396
|
streamFormatter.emitEvent({
|
|
14381
|
-
type:
|
|
14397
|
+
type: JsonStreamEventType.MESSAGE,
|
|
14382
14398
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14383
14399
|
role: "assistant",
|
|
14384
14400
|
content: output,
|
|
14385
14401
|
delta: true
|
|
14386
14402
|
});
|
|
14387
|
-
} else if (config.getOutputFormat() ===
|
|
14403
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14388
14404
|
responseText += output;
|
|
14389
14405
|
} else {
|
|
14390
14406
|
if (event.value) {
|
|
14391
14407
|
textOutput.write(output);
|
|
14392
14408
|
}
|
|
14393
14409
|
}
|
|
14394
|
-
} else if (event.type ===
|
|
14410
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
14395
14411
|
if (streamFormatter) {
|
|
14396
14412
|
streamFormatter.emitEvent({
|
|
14397
|
-
type:
|
|
14413
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
14398
14414
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14399
14415
|
tool_name: event.value.name,
|
|
14400
14416
|
tool_id: event.value.callId,
|
|
@@ -14402,29 +14418,29 @@ async function runNonInteractive2(params) {
|
|
|
14402
14418
|
});
|
|
14403
14419
|
}
|
|
14404
14420
|
toolCallRequests.push(event.value);
|
|
14405
|
-
} else if (event.type ===
|
|
14421
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
14406
14422
|
const message = "Loop detected, stopping execution";
|
|
14407
14423
|
if (streamFormatter) {
|
|
14408
14424
|
streamFormatter.emitEvent({
|
|
14409
|
-
type:
|
|
14425
|
+
type: JsonStreamEventType.ERROR,
|
|
14410
14426
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14411
14427
|
severity: "warning",
|
|
14412
14428
|
message
|
|
14413
14429
|
});
|
|
14414
14430
|
}
|
|
14415
14431
|
warnings.push(message);
|
|
14416
|
-
} else if (event.type ===
|
|
14432
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
14417
14433
|
const message = "Maximum session turns exceeded";
|
|
14418
14434
|
if (streamFormatter) {
|
|
14419
14435
|
streamFormatter.emitEvent({
|
|
14420
|
-
type:
|
|
14436
|
+
type: JsonStreamEventType.ERROR,
|
|
14421
14437
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14422
14438
|
severity: "error",
|
|
14423
14439
|
message
|
|
14424
14440
|
});
|
|
14425
14441
|
}
|
|
14426
14442
|
warnings.push(message);
|
|
14427
|
-
} else if (event.type ===
|
|
14443
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
14428
14444
|
const normalized = normalizeError(event.value?.error);
|
|
14429
14445
|
const code = normalized.code ?? (typeof normalized.status === "string" ? normalized.status : void 0);
|
|
14430
14446
|
const err = Object.assign(
|
|
@@ -14439,9 +14455,9 @@ async function runNonInteractive2(params) {
|
|
|
14439
14455
|
}
|
|
14440
14456
|
);
|
|
14441
14457
|
throw err;
|
|
14442
|
-
} else if (event.type ===
|
|
14458
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
14443
14459
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
14444
|
-
if (config.getOutputFormat() ===
|
|
14460
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14445
14461
|
process.stderr.write(`${stopMessage}
|
|
14446
14462
|
`);
|
|
14447
14463
|
}
|
|
@@ -14449,7 +14465,7 @@ async function runNonInteractive2(params) {
|
|
|
14449
14465
|
const metrics = uiTelemetryService.getMetrics();
|
|
14450
14466
|
const durationMs = Date.now() - startTime;
|
|
14451
14467
|
streamFormatter.emitEvent({
|
|
14452
|
-
type:
|
|
14468
|
+
type: JsonStreamEventType.RESULT,
|
|
14453
14469
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14454
14470
|
status: "success",
|
|
14455
14471
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -14457,7 +14473,7 @@ async function runNonInteractive2(params) {
|
|
|
14457
14473
|
durationMs
|
|
14458
14474
|
)
|
|
14459
14475
|
});
|
|
14460
|
-
} else if (config.getOutputFormat() ===
|
|
14476
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14461
14477
|
const formatter = new JsonFormatter();
|
|
14462
14478
|
const stats = uiTelemetryService.getMetrics();
|
|
14463
14479
|
textOutput.write(
|
|
@@ -14473,23 +14489,23 @@ async function runNonInteractive2(params) {
|
|
|
14473
14489
|
textOutput.ensureTrailingNewline();
|
|
14474
14490
|
}
|
|
14475
14491
|
return;
|
|
14476
|
-
} else if (event.type ===
|
|
14492
|
+
} else if (event.type === GeminiEventType.UserCancelled) {
|
|
14477
14493
|
throw new FatalCancellationError("Operation cancelled.");
|
|
14478
|
-
} else if (event.type ===
|
|
14494
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
14479
14495
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
14480
|
-
if (config.getOutputFormat() ===
|
|
14496
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14481
14497
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
14482
14498
|
`);
|
|
14483
14499
|
} else if (streamFormatter) {
|
|
14484
14500
|
streamFormatter.emitEvent({
|
|
14485
|
-
type:
|
|
14501
|
+
type: JsonStreamEventType.ERROR,
|
|
14486
14502
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14487
14503
|
severity: "warning",
|
|
14488
14504
|
message: stripAnsi(blockMessage)
|
|
14489
14505
|
});
|
|
14490
14506
|
}
|
|
14491
14507
|
warnings.push(blockMessage);
|
|
14492
|
-
} else if (event.type ===
|
|
14508
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
14493
14509
|
const eventValue = event.value;
|
|
14494
14510
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
14495
14511
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -14512,12 +14528,12 @@ async function runNonInteractive2(params) {
|
|
|
14512
14528
|
);
|
|
14513
14529
|
if (streamFormatter) {
|
|
14514
14530
|
streamFormatter.emitEvent({
|
|
14515
|
-
type:
|
|
14531
|
+
type: JsonStreamEventType.ERROR,
|
|
14516
14532
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14517
14533
|
severity: "error",
|
|
14518
14534
|
message: invalidStreamError
|
|
14519
14535
|
});
|
|
14520
|
-
} else if (config.getOutputFormat() ===
|
|
14536
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14521
14537
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
14522
14538
|
`);
|
|
14523
14539
|
}
|
|
@@ -14554,7 +14570,7 @@ async function runNonInteractive2(params) {
|
|
|
14554
14570
|
const requestInfo = completedToolCall.request;
|
|
14555
14571
|
if (streamFormatter) {
|
|
14556
14572
|
streamFormatter.emitEvent({
|
|
14557
|
-
type:
|
|
14573
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
14558
14574
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14559
14575
|
tool_id: requestInfo.callId,
|
|
14560
14576
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -14588,11 +14604,11 @@ async function runNonInteractive2(params) {
|
|
|
14588
14604
|
);
|
|
14589
14605
|
}
|
|
14590
14606
|
const stopExecutionTool = completedToolCalls.find(
|
|
14591
|
-
(tc) => tc.response.errorType ===
|
|
14607
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
14592
14608
|
);
|
|
14593
14609
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
14594
14610
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
14595
|
-
if (config.getOutputFormat() ===
|
|
14611
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14596
14612
|
process.stderr.write(`${stopMessage}
|
|
14597
14613
|
`);
|
|
14598
14614
|
}
|
|
@@ -14600,7 +14616,7 @@ async function runNonInteractive2(params) {
|
|
|
14600
14616
|
const metrics = uiTelemetryService.getMetrics();
|
|
14601
14617
|
const durationMs = Date.now() - startTime;
|
|
14602
14618
|
streamFormatter.emitEvent({
|
|
14603
|
-
type:
|
|
14619
|
+
type: JsonStreamEventType.RESULT,
|
|
14604
14620
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14605
14621
|
status: "success",
|
|
14606
14622
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -14608,7 +14624,7 @@ async function runNonInteractive2(params) {
|
|
|
14608
14624
|
durationMs
|
|
14609
14625
|
)
|
|
14610
14626
|
});
|
|
14611
|
-
} else if (config.getOutputFormat() ===
|
|
14627
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14612
14628
|
const formatter = new JsonFormatter();
|
|
14613
14629
|
const stats = uiTelemetryService.getMetrics();
|
|
14614
14630
|
textOutput.write(
|
|
@@ -14637,12 +14653,12 @@ async function runNonInteractive2(params) {
|
|
|
14637
14653
|
const metrics = uiTelemetryService.getMetrics();
|
|
14638
14654
|
const durationMs = Date.now() - startTime;
|
|
14639
14655
|
streamFormatter.emitEvent({
|
|
14640
|
-
type:
|
|
14656
|
+
type: JsonStreamEventType.RESULT,
|
|
14641
14657
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14642
14658
|
status: invalidStreamError ? "error" : "success",
|
|
14643
14659
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
14644
14660
|
});
|
|
14645
|
-
} else if (config.getOutputFormat() ===
|
|
14661
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14646
14662
|
const formatter = new JsonFormatter();
|
|
14647
14663
|
const stats = uiTelemetryService.getMetrics();
|
|
14648
14664
|
textOutput.write(
|
|
@@ -14666,7 +14682,7 @@ async function runNonInteractive2(params) {
|
|
|
14666
14682
|
cleanupCancellation();
|
|
14667
14683
|
scheduler?.dispose();
|
|
14668
14684
|
consolePatcher.cleanup();
|
|
14669
|
-
coreEvents.off(
|
|
14685
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
14670
14686
|
await runExitCleanup();
|
|
14671
14687
|
}
|
|
14672
14688
|
if (abortController.signal.aborted || isFatalCancellationError(errorToHandle)) {
|
|
@@ -17064,12 +17080,12 @@ var Session = class {
|
|
|
17064
17080
|
this.connection = connection;
|
|
17065
17081
|
this.settings = settings;
|
|
17066
17082
|
coreEvents.on(
|
|
17067
|
-
|
|
17083
|
+
CoreEvent.ApprovalModeChanged,
|
|
17068
17084
|
this.handleApprovalModeChanged
|
|
17069
17085
|
);
|
|
17070
|
-
coreEvents.on(
|
|
17086
|
+
coreEvents.on(CoreEvent.RetryAttempt, this.handleRetryAttempt);
|
|
17071
17087
|
this.context.config.getMessageBus()?.subscribe(
|
|
17072
|
-
|
|
17088
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
17073
17089
|
this.handleToolConfirmationRequest,
|
|
17074
17090
|
{ signal: this.disposeController.signal }
|
|
17075
17091
|
);
|
|
@@ -17093,7 +17109,7 @@ var Session = class {
|
|
|
17093
17109
|
"Policy engine missing. Denying tool confirmation request."
|
|
17094
17110
|
);
|
|
17095
17111
|
await messageBus.publish({
|
|
17096
|
-
type:
|
|
17112
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17097
17113
|
correlationId: request.correlationId,
|
|
17098
17114
|
confirmed: false,
|
|
17099
17115
|
requiresUserConfirmation: false
|
|
@@ -17106,7 +17122,7 @@ var Session = class {
|
|
|
17106
17122
|
"Tool confirmation request missing tool name. Denying."
|
|
17107
17123
|
);
|
|
17108
17124
|
await messageBus.publish({
|
|
17109
|
-
type:
|
|
17125
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17110
17126
|
correlationId: request.correlationId,
|
|
17111
17127
|
confirmed: false,
|
|
17112
17128
|
requiresUserConfirmation: false
|
|
@@ -17119,7 +17135,7 @@ var Session = class {
|
|
|
17119
17135
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
17120
17136
|
);
|
|
17121
17137
|
await messageBus.publish({
|
|
17122
|
-
type:
|
|
17138
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17123
17139
|
correlationId: request.correlationId,
|
|
17124
17140
|
confirmed: false,
|
|
17125
17141
|
requiresUserConfirmation: false
|
|
@@ -17135,15 +17151,15 @@ var Session = class {
|
|
|
17135
17151
|
request.subagent
|
|
17136
17152
|
);
|
|
17137
17153
|
await messageBus.publish({
|
|
17138
|
-
type:
|
|
17154
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17139
17155
|
correlationId: request.correlationId,
|
|
17140
|
-
confirmed: result.decision ===
|
|
17141
|
-
requiresUserConfirmation: result.decision ===
|
|
17156
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
17157
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
17142
17158
|
});
|
|
17143
17159
|
} catch (error) {
|
|
17144
17160
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
17145
17161
|
await this.context.config.getMessageBus()?.publish({
|
|
17146
|
-
type:
|
|
17162
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17147
17163
|
correlationId: request.correlationId,
|
|
17148
17164
|
confirmed: false,
|
|
17149
17165
|
requiresUserConfirmation: false
|
|
@@ -17177,10 +17193,10 @@ var Session = class {
|
|
|
17177
17193
|
};
|
|
17178
17194
|
async dispose() {
|
|
17179
17195
|
coreEvents.off(
|
|
17180
|
-
|
|
17196
|
+
CoreEvent.ApprovalModeChanged,
|
|
17181
17197
|
this.handleApprovalModeChanged
|
|
17182
17198
|
);
|
|
17183
|
-
coreEvents.off(
|
|
17199
|
+
coreEvents.off(CoreEvent.RetryAttempt, this.handleRetryAttempt);
|
|
17184
17200
|
this.disposeController.abort();
|
|
17185
17201
|
if (this.context.config?.dispose) {
|
|
17186
17202
|
try {
|
|
@@ -17274,7 +17290,7 @@ ${thought.description}`;
|
|
|
17274
17290
|
await this.sendUpdate({
|
|
17275
17291
|
sessionUpdate: "tool_call",
|
|
17276
17292
|
toolCallId: toolCall.id,
|
|
17277
|
-
status: toolCall.status ===
|
|
17293
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
17278
17294
|
title: toolCall.displayName || toolCall.name,
|
|
17279
17295
|
content: toolCallContent,
|
|
17280
17296
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -17384,7 +17400,7 @@ ${thought.description}`;
|
|
|
17384
17400
|
return { stopReason: "cancelled" };
|
|
17385
17401
|
}
|
|
17386
17402
|
switch (event.type) {
|
|
17387
|
-
case
|
|
17403
|
+
case GeminiEventType.Content: {
|
|
17388
17404
|
const content = {
|
|
17389
17405
|
type: "text",
|
|
17390
17406
|
text: event.value
|
|
@@ -17398,7 +17414,7 @@ ${thought.description}`;
|
|
|
17398
17414
|
await this.sendUpdate(update);
|
|
17399
17415
|
break;
|
|
17400
17416
|
}
|
|
17401
|
-
case
|
|
17417
|
+
case GeminiEventType.Thought: {
|
|
17402
17418
|
const thoughtText = `**${event.value.subject}**
|
|
17403
17419
|
${event.value.description}`;
|
|
17404
17420
|
await this.sendUpdate({
|
|
@@ -17407,7 +17423,7 @@ ${event.value.description}`;
|
|
|
17407
17423
|
});
|
|
17408
17424
|
break;
|
|
17409
17425
|
}
|
|
17410
|
-
case
|
|
17426
|
+
case GeminiEventType.Retry: {
|
|
17411
17427
|
toolCallRequests.length = 0;
|
|
17412
17428
|
debugLogger.warn(
|
|
17413
17429
|
"Model stream interrupted mid-response; retrying prompt..."
|
|
@@ -17423,10 +17439,10 @@ ${event.value.description}`;
|
|
|
17423
17439
|
isFirstChunkAfterRetry = true;
|
|
17424
17440
|
break;
|
|
17425
17441
|
}
|
|
17426
|
-
case
|
|
17442
|
+
case GeminiEventType.ToolCallRequest:
|
|
17427
17443
|
toolCallRequests.push(event.value);
|
|
17428
17444
|
break;
|
|
17429
|
-
case
|
|
17445
|
+
case GeminiEventType.Finished: {
|
|
17430
17446
|
const usage2 = event.value.usageMetadata;
|
|
17431
17447
|
if (usage2) {
|
|
17432
17448
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -17443,19 +17459,19 @@ ${event.value.description}`;
|
|
|
17443
17459
|
}
|
|
17444
17460
|
break;
|
|
17445
17461
|
}
|
|
17446
|
-
case
|
|
17462
|
+
case GeminiEventType.ModelInfo:
|
|
17447
17463
|
turnModelId = event.value;
|
|
17448
17464
|
break;
|
|
17449
|
-
case
|
|
17465
|
+
case GeminiEventType.MaxSessionTurns:
|
|
17450
17466
|
stopReason = "max_turn_requests";
|
|
17451
17467
|
break;
|
|
17452
|
-
case
|
|
17468
|
+
case GeminiEventType.LoopDetected:
|
|
17453
17469
|
stopReason = "max_turn_requests";
|
|
17454
17470
|
break;
|
|
17455
|
-
case
|
|
17471
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
17456
17472
|
stopReason = "max_tokens";
|
|
17457
17473
|
break;
|
|
17458
|
-
case
|
|
17474
|
+
case GeminiEventType.Error: {
|
|
17459
17475
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
17460
17476
|
event.value.error
|
|
17461
17477
|
);
|
|
@@ -17646,7 +17662,7 @@ ${event.value.description}`;
|
|
|
17646
17662
|
const output = RequestPermissionResponseSchema.parse(
|
|
17647
17663
|
await this.connection.requestPermission(params)
|
|
17648
17664
|
);
|
|
17649
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
17665
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
17650
17666
|
await confirmationDetails.onConfirm(outcome);
|
|
17651
17667
|
await updatePolicy(
|
|
17652
17668
|
tool,
|
|
@@ -17657,7 +17673,7 @@ ${event.value.description}`;
|
|
|
17657
17673
|
invocation
|
|
17658
17674
|
);
|
|
17659
17675
|
switch (outcome) {
|
|
17660
|
-
case
|
|
17676
|
+
case ToolConfirmationOutcome.Cancel: {
|
|
17661
17677
|
const cancelError = new Error(
|
|
17662
17678
|
`Tool "${fc.name}" was canceled by the user.`
|
|
17663
17679
|
);
|
|
@@ -17675,12 +17691,12 @@ ${event.value.description}`;
|
|
|
17675
17691
|
});
|
|
17676
17692
|
return errorResponse(cancelError);
|
|
17677
17693
|
}
|
|
17678
|
-
case
|
|
17679
|
-
case
|
|
17680
|
-
case
|
|
17681
|
-
case
|
|
17682
|
-
case
|
|
17683
|
-
case
|
|
17694
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
17695
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
17696
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
17697
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
17698
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
17699
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
17684
17700
|
break;
|
|
17685
17701
|
default: {
|
|
17686
17702
|
const resultOutcome = outcome;
|
|
@@ -17734,7 +17750,7 @@ ${event.value.description}`;
|
|
|
17734
17750
|
);
|
|
17735
17751
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
17736
17752
|
{
|
|
17737
|
-
status:
|
|
17753
|
+
status: CoreToolCallStatus.Success,
|
|
17738
17754
|
request: {
|
|
17739
17755
|
callId,
|
|
17740
17756
|
name: fc.name,
|
|
@@ -17779,7 +17795,7 @@ ${event.value.description}`;
|
|
|
17779
17795
|
});
|
|
17780
17796
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
17781
17797
|
{
|
|
17782
|
-
status:
|
|
17798
|
+
status: CoreToolCallStatus.Error,
|
|
17783
17799
|
request: {
|
|
17784
17800
|
callId,
|
|
17785
17801
|
name: fc.name,
|
|
@@ -17908,12 +17924,12 @@ ${event.value.description}`;
|
|
|
17908
17924
|
sessionId: this.id,
|
|
17909
17925
|
options: [
|
|
17910
17926
|
{
|
|
17911
|
-
optionId:
|
|
17927
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
17912
17928
|
name: "Allow once",
|
|
17913
17929
|
kind: "allow_once"
|
|
17914
17930
|
},
|
|
17915
17931
|
{
|
|
17916
|
-
optionId:
|
|
17932
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
17917
17933
|
name: "Deny",
|
|
17918
17934
|
kind: "reject_once"
|
|
17919
17935
|
}
|
|
@@ -17938,8 +17954,8 @@ ${event.value.description}`;
|
|
|
17938
17954
|
const output = RequestPermissionResponseSchema.parse(
|
|
17939
17955
|
await this.connection.requestPermission(params)
|
|
17940
17956
|
);
|
|
17941
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
17942
|
-
if (outcome ===
|
|
17957
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
17958
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
17943
17959
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
17944
17960
|
validationError = null;
|
|
17945
17961
|
} else {
|
|
@@ -18382,7 +18398,7 @@ var AcpSessionManager = class {
|
|
|
18382
18398
|
mcpServers,
|
|
18383
18399
|
loadedSettings
|
|
18384
18400
|
);
|
|
18385
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
18401
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
18386
18402
|
let isAuthenticated = false;
|
|
18387
18403
|
let authErrorMessage = "";
|
|
18388
18404
|
try {
|
|
@@ -18394,7 +18410,7 @@ var AcpSessionManager = class {
|
|
|
18394
18410
|
);
|
|
18395
18411
|
isAuthenticated = true;
|
|
18396
18412
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
18397
|
-
if (authType ===
|
|
18413
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
18398
18414
|
isAuthenticated = false;
|
|
18399
18415
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
18400
18416
|
}
|
|
@@ -18580,7 +18596,7 @@ var AcpSessionManager = class {
|
|
|
18580
18596
|
}
|
|
18581
18597
|
}
|
|
18582
18598
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
18583
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
18599
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
18584
18600
|
if (!selectedAuthType) {
|
|
18585
18601
|
throw RequestError.authRequired();
|
|
18586
18602
|
}
|
|
@@ -18692,12 +18708,12 @@ var GeminiAgent = class {
|
|
|
18692
18708
|
}
|
|
18693
18709
|
const authMethods = [
|
|
18694
18710
|
{
|
|
18695
|
-
id:
|
|
18711
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
18696
18712
|
name: "Log in with Google",
|
|
18697
18713
|
description: "Log in with your Google account"
|
|
18698
18714
|
},
|
|
18699
18715
|
{
|
|
18700
|
-
id:
|
|
18716
|
+
id: AuthType.USE_GEMINI,
|
|
18701
18717
|
name: "Gemini API key",
|
|
18702
18718
|
description: "Use an API key with Gemini Developer API",
|
|
18703
18719
|
_meta: {
|
|
@@ -18707,12 +18723,12 @@ var GeminiAgent = class {
|
|
|
18707
18723
|
}
|
|
18708
18724
|
},
|
|
18709
18725
|
{
|
|
18710
|
-
id:
|
|
18726
|
+
id: AuthType.USE_VERTEX_AI,
|
|
18711
18727
|
name: "Vertex AI",
|
|
18712
18728
|
description: "Use an API key with Vertex AI GenAI API"
|
|
18713
18729
|
},
|
|
18714
18730
|
{
|
|
18715
|
-
id:
|
|
18731
|
+
id: AuthType.GATEWAY,
|
|
18716
18732
|
name: "AI API Gateway",
|
|
18717
18733
|
description: "Use a custom AI API Gateway",
|
|
18718
18734
|
_meta: {
|
|
@@ -18885,7 +18901,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
18885
18901
|
}
|
|
18886
18902
|
return authType;
|
|
18887
18903
|
} catch (error) {
|
|
18888
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
18904
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
18889
18905
|
handleError(
|
|
18890
18906
|
error instanceof Error ? error : new Error(String(error)),
|
|
18891
18907
|
nonInteractiveConfig,
|
|
@@ -19084,10 +19100,10 @@ var SlashCommandConflictHandler = class {
|
|
|
19084
19100
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
19085
19101
|
}
|
|
19086
19102
|
start() {
|
|
19087
|
-
coreEvents.on(
|
|
19103
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
19088
19104
|
}
|
|
19089
19105
|
stop() {
|
|
19090
|
-
coreEvents.off(
|
|
19106
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
19091
19107
|
if (this.flushTimeout) {
|
|
19092
19108
|
clearTimeout(this.flushTimeout);
|
|
19093
19109
|
this.flushTimeout = null;
|
|
@@ -19462,7 +19478,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
19462
19478
|
}
|
|
19463
19479
|
}
|
|
19464
19480
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
19465
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
19481
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-XW2S7MKZ.js");
|
|
19466
19482
|
await doStartUI(
|
|
19467
19483
|
config,
|
|
19468
19484
|
settings,
|
|
@@ -19565,12 +19581,12 @@ async function main() {
|
|
|
19565
19581
|
dns.setDefaultResultOrder(
|
|
19566
19582
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
19567
19583
|
);
|
|
19568
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
19584
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
19569
19585
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
19570
19586
|
settings.setValue(
|
|
19571
19587
|
"User" /* User */,
|
|
19572
19588
|
"security.auth.selectedType",
|
|
19573
|
-
|
|
19589
|
+
AuthType.COMPUTE_ADC
|
|
19574
19590
|
);
|
|
19575
19591
|
}
|
|
19576
19592
|
}
|
|
@@ -19697,7 +19713,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19697
19713
|
await config.storage.initialize();
|
|
19698
19714
|
adminControlsListner.setConfig(config);
|
|
19699
19715
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
19700
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
19716
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-B2G4MIWC.js");
|
|
19701
19717
|
setupInitialActivityLogger(config);
|
|
19702
19718
|
}
|
|
19703
19719
|
registerTelemetryConfig(config);
|
|
@@ -19705,7 +19721,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19705
19721
|
const messageBus = config.getMessageBus();
|
|
19706
19722
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
19707
19723
|
registerCleanup(async () => {
|
|
19708
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
19724
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
19709
19725
|
});
|
|
19710
19726
|
if (!config.getAcpMode()) {
|
|
19711
19727
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -19756,7 +19772,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19756
19772
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
19757
19773
|
const initializationResult = await initializeApp(config, settings);
|
|
19758
19774
|
initAppHandle?.end();
|
|
19759
|
-
import("./liteRtServerManager-
|
|
19775
|
+
import("./liteRtServerManager-YLE7JTV7.js").then(({ LiteRtServerManager }) => {
|
|
19760
19776
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
19761
19777
|
if (!mergedGemma) return;
|
|
19762
19778
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -19766,7 +19782,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19766
19782
|
autoStartServer: userGemma?.autoStartServer
|
|
19767
19783
|
});
|
|
19768
19784
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
19769
|
-
if (settings.merged.security.auth.selectedType ===
|
|
19785
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
19770
19786
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
19771
19787
|
}
|
|
19772
19788
|
if (config.getAcpMode()) {
|
|
@@ -19782,7 +19798,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19782
19798
|
...rawStartupWarnings.map((message) => ({
|
|
19783
19799
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
19784
19800
|
message,
|
|
19785
|
-
priority:
|
|
19801
|
+
priority: WarningPriority.High
|
|
19786
19802
|
})),
|
|
19787
19803
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
19788
19804
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -19819,7 +19835,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19819
19835
|
${input}` : stdinData;
|
|
19820
19836
|
}
|
|
19821
19837
|
}
|
|
19822
|
-
const sessionStartSource = resumedSessionData ?
|
|
19838
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
19823
19839
|
const hookSystem = config?.getHookSystem();
|
|
19824
19840
|
if (hookSystem) {
|
|
19825
19841
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -19876,8 +19892,8 @@ ${input}` : wrappedContext;
|
|
|
19876
19892
|
}
|
|
19877
19893
|
}
|
|
19878
19894
|
function initializeOutputListenersAndFlush(config) {
|
|
19879
|
-
if (coreEvents.listenerCount(
|
|
19880
|
-
coreEvents.on(
|
|
19895
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
19896
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
19881
19897
|
if (payload.isStderr) {
|
|
19882
19898
|
writeToStderr(payload.chunk, payload.encoding);
|
|
19883
19899
|
} else {
|
|
@@ -19885,8 +19901,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19885
19901
|
}
|
|
19886
19902
|
});
|
|
19887
19903
|
}
|
|
19888
|
-
if (coreEvents.listenerCount(
|
|
19889
|
-
coreEvents.on(
|
|
19904
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
19905
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
19890
19906
|
if (payload.type === "error" || payload.type === "warn") {
|
|
19891
19907
|
writeToStderr(payload.content + "\n");
|
|
19892
19908
|
} else {
|
|
@@ -19894,8 +19910,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19894
19910
|
}
|
|
19895
19911
|
});
|
|
19896
19912
|
}
|
|
19897
|
-
if (coreEvents.listenerCount(
|
|
19898
|
-
coreEvents.on(
|
|
19913
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
19914
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
19899
19915
|
writeToStderr(payload.message + "\n");
|
|
19900
19916
|
});
|
|
19901
19917
|
}
|
|
@@ -19903,7 +19919,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19903
19919
|
const forceToStderr = outputFormat === "json";
|
|
19904
19920
|
coreEvents.drainBacklogs(
|
|
19905
19921
|
(event, args) => {
|
|
19906
|
-
if (forceToStderr && event ===
|
|
19922
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
19907
19923
|
const payload = args[0];
|
|
19908
19924
|
if (!payload.isStderr) {
|
|
19909
19925
|
return {
|