@google/gemini-cli 0.70.0 → 0.71.0-nightly.20261121.geecccfcd5
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-V4HIE5G5.js → chunk-3IQPEEFT.js} +1 -1
- package/bundle/{chunk-FHK4RNCX.js → chunk-3OVOJOQV.js} +7 -7
- package/bundle/{chunk-SPAMAY26.js → chunk-5J2X3GYT.js} +1 -1
- package/bundle/{chunk-UF44X63P.js → chunk-66M6QVYR.js} +782 -323
- package/bundle/{chunk-37D3S3FZ.js → chunk-6FOUJKOM.js} +878 -371
- package/bundle/{chunk-YOEWNBDC.js → chunk-74F5ZRXI.js} +12 -5
- package/bundle/{chunk-LMBUPWFC.js → chunk-7WYEB7FO.js} +8765 -15613
- package/bundle/{chunk-6IKD2NB3.js → chunk-A3SNIZ4K.js} +1 -1
- package/bundle/{chunk-AMHNNZY2.js → chunk-BVNLNGFD.js} +7 -7
- package/bundle/{chunk-5VFAWK3F.js → chunk-DC6NT336.js} +1 -1
- package/bundle/{chunk-CMKRWIX6.js → chunk-DKKO776D.js} +71 -58
- package/bundle/{chunk-WRWAVEME.js → chunk-EUUDSNXQ.js} +1 -1
- package/bundle/{chunk-KV6XIC2Z.js → chunk-GMYJWERY.js} +1 -1
- package/bundle/{chunk-EG2BSKPF.js → chunk-HQSLNBBU.js} +1 -1
- package/bundle/{chunk-LMNAB62M.js → chunk-JWRXMN7H.js} +12 -5
- package/bundle/{chunk-GFBMTAPD.js → chunk-L2ISE4LK.js} +18 -9
- package/bundle/chunk-LS3EWJTC.js +60338 -0
- package/bundle/{chunk-4BWP3TDK.js → chunk-NLZKOWER.js} +9 -8
- package/bundle/{chunk-BOIBJEIO.js → chunk-OM5Z3ZRO.js} +3 -3
- package/bundle/{chunk-7JS2T75Z.js → chunk-OQHA6SOK.js} +1 -1
- package/bundle/{chunk-FXAACYC3.js → chunk-QADAHCRT.js} +1 -1
- package/bundle/{chunk-VHXUWMGE.js → chunk-QVVBLU5B.js} +2 -2
- package/bundle/{chunk-CB37EK5Y.js → chunk-QWS2TBZG.js} +3 -3
- package/bundle/{chunk-3VGGGCOZ.js → chunk-RJEQTG6S.js} +2 -2
- package/bundle/chunk-S53XQOHZ.js +512 -0
- package/bundle/{chunk-QYKA4YD7.js → chunk-SLTPPXVT.js} +3 -3
- package/bundle/{chunk-G6SC5BOV.js → chunk-TE62WOO3.js} +1 -1
- package/bundle/chunk-V2F2BV3A.js +118 -0
- package/bundle/chunk-VTIY77BF.js +1571 -0
- package/bundle/chunk-XAXLQ5BJ.js +65 -0
- package/bundle/{chunk-JLKRLYZG.js → chunk-XPXAWJCB.js} +2 -2
- package/bundle/chunk-Y5DW673N.js +420386 -0
- package/bundle/chunk-YEEWGYBU.js +1962 -0
- package/bundle/chunk-YVHZS4VP.js +190 -0
- package/bundle/chunk-YVZ2JHAE.js +40031 -0
- package/bundle/{chunk-RFQXG324.js → chunk-YYWNIP3F.js} +1 -1
- package/bundle/{cleanup-BMYAIPAL.js → cleanup-3C2E3PSM.js} +2 -2
- package/bundle/{cleanup-CWOSCK57.js → cleanup-4IYCYTUB.js} +2 -2
- package/bundle/{cleanup-JTPRPYIQ.js → cleanup-NXI65SJI.js} +2 -2
- package/bundle/cleanup-UNQWTWUR.js +34 -0
- package/bundle/{core-XZECNCR2.js → core-DQSJHYG4.js} +31 -1
- package/bundle/{devtoolsService-ER22TM2Y.js → devtoolsService-4TYJS6M3.js} +2 -2
- package/bundle/{devtoolsService-O5VD5YWD.js → devtoolsService-5PXTVI7M.js} +4 -3
- package/bundle/{devtoolsService-WNJOZ7ZT.js → devtoolsService-NOXMAH56.js} +2 -2
- package/bundle/devtoolsService-UZFFGBEG.js +919 -0
- package/bundle/{core-HYVGBZPP.js → dist-VWT5M5DY.js} +31 -1
- package/bundle/{dist-75NDR3EX.js → dist-YHW4CPAY.js} +31 -1
- package/bundle/dist-YWJAC3IM.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-PB6SEHWE.js} +2 -2
- package/bundle/{formatError-QOZLAZ32.js → formatError-QRSNJJ27.js} +2 -2
- package/bundle/{formatError-FYLLVZDF.js → formatError-UQIP4FYJ.js} +2 -2
- package/bundle/formatError-VMFHOWIU.js +14 -0
- package/bundle/{gemini-AYDYW6NZ.js → gemini-2SZFXE54.js} +18 -17
- package/bundle/{gemini-PG2FEK5D.js → gemini-OAKFBKMR.js} +227 -210
- package/bundle/{gemini-FRSP6LA3.js → gemini-TQYJRVJP.js} +18 -17
- package/bundle/gemini-XDU3J5JT.js +20021 -0
- package/bundle/gemini.js +8 -8
- package/bundle/{interactiveCli-76LAQB3B.js → interactiveCli-JWB6WIB2.js} +157 -32
- package/bundle/{interactiveCli-BYWR7IEK.js → interactiveCli-L5IOZTYF.js} +157 -32
- package/bundle/{interactiveCli-6TVFB4R5.js → interactiveCli-NBZDIAPD.js} +468 -324
- package/bundle/interactiveCli-W4IK4C6F.js +36447 -0
- package/bundle/{liteRtServerManager-GIRVSE6M.js → liteRtServerManager-GSYRGOB6.js} +4 -4
- package/bundle/{liteRtServerManager-KZ62KJW3.js → liteRtServerManager-I7YVNS3P.js} +4 -4
- package/bundle/{liteRtServerManager-BYJWS5BO.js → liteRtServerManager-OZPOFTLT.js} +4 -4
- package/bundle/liteRtServerManager-YUBDDMLI.js +65 -0
- package/bundle/{oauth2-provider-SFFQQ6OE.js → oauth2-provider-A6N22HUD.js} +1 -1
- package/bundle/{oauth2-provider-SRH6I6G7.js → oauth2-provider-JAYH53PG.js} +41 -79
- package/bundle/oauth2-provider-OUKCCXVS.js +273 -0
- package/bundle/{oauth2-provider-ZBFFAIQE.js → oauth2-provider-XADKJYM3.js} +1 -1
- package/bundle/{start-PLK5XHJC.js → start-7ZXOELXX.js} +6 -6
- package/bundle/{start-Q66LTS3Y.js → start-JF7ODMH2.js} +6 -6
- package/bundle/{start-OLEVDFQS.js → start-O7HDURUW.js} +6 -6
- package/bundle/start-X3ZAZW66.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-SLTPPXVT.js";
|
|
6
6
|
import {
|
|
7
7
|
formatCliError
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TE62WOO3.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-3OVOJOQV.js";
|
|
53
53
|
import {
|
|
54
54
|
exitCli,
|
|
55
55
|
require_source
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-VTIY77BF.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-L2ISE4LK.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-RJEQTG6S.js";
|
|
102
|
+
import "./chunk-NLZKOWER.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-3IQPEEFT.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-66M6QVYR.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
|
}
|
|
@@ -8470,10 +8486,11 @@ function resolvePath(p) {
|
|
|
8470
8486
|
let expandedPath = p;
|
|
8471
8487
|
if (p.toLowerCase().startsWith("%userprofile%")) {
|
|
8472
8488
|
expandedPath = homedir() + p.substring("%userprofile%".length);
|
|
8473
|
-
} else if (p === "~" || p.startsWith("~/")) {
|
|
8489
|
+
} else if (p === "~" || p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
8474
8490
|
expandedPath = homedir() + p.substring(1);
|
|
8475
8491
|
}
|
|
8476
|
-
|
|
8492
|
+
const pathModule = process.platform === "win32" ? path7.win32 : path7.posix;
|
|
8493
|
+
return pathModule.normalize(expandedPath);
|
|
8477
8494
|
}
|
|
8478
8495
|
|
|
8479
8496
|
// packages/cli/src/config/policy.ts
|
|
@@ -8515,9 +8532,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
8515
8532
|
cwd,
|
|
8516
8533
|
potentialWorkspacePoliciesDir
|
|
8517
8534
|
);
|
|
8518
|
-
if (integrityResult.status ===
|
|
8535
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
8519
8536
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
8520
|
-
} else if (integrityResult.status ===
|
|
8537
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
8521
8538
|
workspacePoliciesDir = void 0;
|
|
8522
8539
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
8523
8540
|
policyUpdateConfirmationRequest = {
|
|
@@ -8987,23 +9004,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8987
9004
|
if (rawApprovalMode) {
|
|
8988
9005
|
switch (rawApprovalMode) {
|
|
8989
9006
|
case "yolo":
|
|
8990
|
-
approvalMode =
|
|
9007
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8991
9008
|
break;
|
|
8992
9009
|
case "auto_edit":
|
|
8993
|
-
approvalMode =
|
|
9010
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8994
9011
|
break;
|
|
8995
9012
|
case "plan":
|
|
8996
9013
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8997
9014
|
debugLogger.warn(
|
|
8998
9015
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8999
9016
|
);
|
|
9000
|
-
approvalMode =
|
|
9017
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9001
9018
|
} else {
|
|
9002
|
-
approvalMode =
|
|
9019
|
+
approvalMode = ApprovalMode.PLAN;
|
|
9003
9020
|
}
|
|
9004
9021
|
break;
|
|
9005
9022
|
case "default":
|
|
9006
|
-
approvalMode =
|
|
9023
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9007
9024
|
break;
|
|
9008
9025
|
default:
|
|
9009
9026
|
throw new Error(
|
|
@@ -9011,10 +9028,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
9011
9028
|
);
|
|
9012
9029
|
}
|
|
9013
9030
|
} else {
|
|
9014
|
-
approvalMode =
|
|
9031
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9015
9032
|
}
|
|
9016
9033
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
9017
|
-
if (approvalMode ===
|
|
9034
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
9018
9035
|
if (settings.admin?.secureModeEnabled) {
|
|
9019
9036
|
debugLogger.error(
|
|
9020
9037
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -9032,16 +9049,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
9032
9049
|
)
|
|
9033
9050
|
);
|
|
9034
9051
|
}
|
|
9035
|
-
} else if (approvalMode ===
|
|
9052
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
9036
9053
|
debugLogger.warn(
|
|
9037
9054
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
9038
9055
|
);
|
|
9039
9056
|
}
|
|
9040
|
-
if (!trustedFolder && approvalMode !==
|
|
9057
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
9041
9058
|
debugLogger.warn(
|
|
9042
9059
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
9043
9060
|
);
|
|
9044
|
-
approvalMode =
|
|
9061
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
9045
9062
|
}
|
|
9046
9063
|
let telemetrySettings;
|
|
9047
9064
|
try {
|
|
@@ -13031,11 +13048,11 @@ var TRUST_WORKSPACE_ENV = "GEMINI_CLI_TRUST_WORKSPACE";
|
|
|
13031
13048
|
function parseTrustChoice(answer) {
|
|
13032
13049
|
switch (answer.trim()) {
|
|
13033
13050
|
case "1":
|
|
13034
|
-
return
|
|
13051
|
+
return TrustLevel.TRUST_FOLDER;
|
|
13035
13052
|
case "2":
|
|
13036
|
-
return
|
|
13053
|
+
return TrustLevel.TRUST_PARENT;
|
|
13037
13054
|
case "3":
|
|
13038
|
-
return
|
|
13055
|
+
return TrustLevel.DO_NOT_TRUST;
|
|
13039
13056
|
default:
|
|
13040
13057
|
return void 0;
|
|
13041
13058
|
}
|
|
@@ -13073,7 +13090,7 @@ async function resolveFolderTrustForSandbox({
|
|
|
13073
13090
|
} catch {
|
|
13074
13091
|
throw new FatalConfigError("Failed to save trust settings.");
|
|
13075
13092
|
}
|
|
13076
|
-
isTrusted = trustLevel !==
|
|
13093
|
+
isTrusted = trustLevel !== TrustLevel.DO_NOT_TRUST;
|
|
13077
13094
|
}
|
|
13078
13095
|
process.env[TRUST_WORKSPACE_ENV] = isTrusted ? "true" : "false";
|
|
13079
13096
|
}
|
|
@@ -13207,7 +13224,7 @@ import path13 from "node:path";
|
|
|
13207
13224
|
import process5 from "node:process";
|
|
13208
13225
|
var homeDirectoryCheck = {
|
|
13209
13226
|
id: "home-directory",
|
|
13210
|
-
priority:
|
|
13227
|
+
priority: WarningPriority.Low,
|
|
13211
13228
|
check: async (workspaceRoot, settings) => {
|
|
13212
13229
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
13213
13230
|
return null;
|
|
@@ -13231,7 +13248,7 @@ var homeDirectoryCheck = {
|
|
|
13231
13248
|
};
|
|
13232
13249
|
var rootDirectoryCheck = {
|
|
13233
13250
|
id: "root-directory",
|
|
13234
|
-
priority:
|
|
13251
|
+
priority: WarningPriority.High,
|
|
13235
13252
|
check: async (workspaceRoot, _settings) => {
|
|
13236
13253
|
try {
|
|
13237
13254
|
const workspaceRealPath = await fs10.realpath(workspaceRoot);
|
|
@@ -13247,7 +13264,7 @@ var rootDirectoryCheck = {
|
|
|
13247
13264
|
};
|
|
13248
13265
|
var folderTrustCheck = {
|
|
13249
13266
|
id: "folder-trust",
|
|
13250
|
-
priority:
|
|
13267
|
+
priority: WarningPriority.High,
|
|
13251
13268
|
check: async (workspaceRoot, settings) => {
|
|
13252
13269
|
if (!isFolderTrustEnabled(settings)) {
|
|
13253
13270
|
return null;
|
|
@@ -13437,12 +13454,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
13437
13454
|
error,
|
|
13438
13455
|
config.getContentGeneratorConfig()?.authType
|
|
13439
13456
|
);
|
|
13440
|
-
if (config.getOutputFormat() ===
|
|
13457
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13441
13458
|
const streamFormatter = new StreamJsonFormatter();
|
|
13442
13459
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
13443
13460
|
const metrics = uiTelemetryService.getMetrics();
|
|
13444
13461
|
streamFormatter.emitEvent({
|
|
13445
|
-
type:
|
|
13462
|
+
type: JsonStreamEventType.RESULT,
|
|
13446
13463
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13447
13464
|
status: "error",
|
|
13448
13465
|
error: {
|
|
@@ -13453,7 +13470,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
13453
13470
|
});
|
|
13454
13471
|
runSyncCleanup();
|
|
13455
13472
|
process.exit(getNumericExitCode(errorCode));
|
|
13456
|
-
} else if (config.getOutputFormat() ===
|
|
13473
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13457
13474
|
const formatter = new JsonFormatter();
|
|
13458
13475
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
13459
13476
|
const formattedError = formatter.formatError(
|
|
@@ -13473,11 +13490,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
13473
13490
|
const isFatal = isFatalToolError(errorType);
|
|
13474
13491
|
if (isFatal) {
|
|
13475
13492
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
13476
|
-
if (config.getOutputFormat() ===
|
|
13493
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13477
13494
|
const streamFormatter = new StreamJsonFormatter();
|
|
13478
13495
|
const metrics = uiTelemetryService.getMetrics();
|
|
13479
13496
|
streamFormatter.emitEvent({
|
|
13480
|
-
type:
|
|
13497
|
+
type: JsonStreamEventType.RESULT,
|
|
13481
13498
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13482
13499
|
status: "error",
|
|
13483
13500
|
error: {
|
|
@@ -13486,7 +13503,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
13486
13503
|
},
|
|
13487
13504
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
13488
13505
|
});
|
|
13489
|
-
} else if (config.getOutputFormat() ===
|
|
13506
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13490
13507
|
const formatter = new JsonFormatter();
|
|
13491
13508
|
const formattedError = formatter.formatError(
|
|
13492
13509
|
toolExecutionError,
|
|
@@ -13507,11 +13524,11 @@ function handleCancellationError(config, exitCode = 130) {
|
|
|
13507
13524
|
"Operation cancelled.",
|
|
13508
13525
|
exitCode
|
|
13509
13526
|
);
|
|
13510
|
-
if (config.getOutputFormat() ===
|
|
13527
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13511
13528
|
const streamFormatter = new StreamJsonFormatter();
|
|
13512
13529
|
const metrics = uiTelemetryService.getMetrics();
|
|
13513
13530
|
streamFormatter.emitEvent({
|
|
13514
|
-
type:
|
|
13531
|
+
type: JsonStreamEventType.RESULT,
|
|
13515
13532
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13516
13533
|
status: "error",
|
|
13517
13534
|
error: {
|
|
@@ -13522,7 +13539,7 @@ function handleCancellationError(config, exitCode = 130) {
|
|
|
13522
13539
|
});
|
|
13523
13540
|
runSyncCleanup();
|
|
13524
13541
|
process.exit(cancellationError.exitCode);
|
|
13525
|
-
} else if (config.getOutputFormat() ===
|
|
13542
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13526
13543
|
const formatter = new JsonFormatter();
|
|
13527
13544
|
const formattedError = formatter.formatError(
|
|
13528
13545
|
cancellationError,
|
|
@@ -13542,11 +13559,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
13542
13559
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
13543
13560
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
13544
13561
|
);
|
|
13545
|
-
if (config.getOutputFormat() ===
|
|
13562
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
13546
13563
|
const streamFormatter = new StreamJsonFormatter();
|
|
13547
13564
|
const metrics = uiTelemetryService.getMetrics();
|
|
13548
13565
|
streamFormatter.emitEvent({
|
|
13549
|
-
type:
|
|
13566
|
+
type: JsonStreamEventType.RESULT,
|
|
13550
13567
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13551
13568
|
status: "error",
|
|
13552
13569
|
error: {
|
|
@@ -13557,7 +13574,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
13557
13574
|
});
|
|
13558
13575
|
runSyncCleanup();
|
|
13559
13576
|
process.exit(maxTurnsError.exitCode);
|
|
13560
|
-
} else if (config.getOutputFormat() ===
|
|
13577
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13561
13578
|
const formatter = new JsonFormatter();
|
|
13562
13579
|
const formattedError = formatter.formatError(
|
|
13563
13580
|
maxTurnsError,
|
|
@@ -13640,7 +13657,7 @@ async function runNonInteractive({
|
|
|
13640
13657
|
}
|
|
13641
13658
|
});
|
|
13642
13659
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
13643
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
13660
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-UZFFGBEG.js");
|
|
13644
13661
|
setupInitialActivityLogger(config);
|
|
13645
13662
|
}
|
|
13646
13663
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -13656,7 +13673,7 @@ async function runNonInteractive({
|
|
|
13656
13673
|
}
|
|
13657
13674
|
};
|
|
13658
13675
|
const startTime = Date.now();
|
|
13659
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
13676
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
13660
13677
|
const abortController = new AbortController();
|
|
13661
13678
|
let isAborting = false;
|
|
13662
13679
|
let cancelMessageTimer = null;
|
|
@@ -13742,13 +13759,13 @@ async function runNonInteractive({
|
|
|
13742
13759
|
};
|
|
13743
13760
|
try {
|
|
13744
13761
|
consolePatcher.patch();
|
|
13745
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
13762
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
13746
13763
|
process.stderr.write(
|
|
13747
13764
|
"[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
13765
|
);
|
|
13749
13766
|
}
|
|
13750
13767
|
setupCancellation();
|
|
13751
|
-
coreEvents.on(
|
|
13768
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
13752
13769
|
coreEvents.drainBacklogs();
|
|
13753
13770
|
process.stdout.on("error", handleStdoutError);
|
|
13754
13771
|
const geminiClient = config.getGeminiClient();
|
|
@@ -13768,7 +13785,7 @@ async function runNonInteractive({
|
|
|
13768
13785
|
}
|
|
13769
13786
|
if (streamFormatter) {
|
|
13770
13787
|
streamFormatter.emitEvent({
|
|
13771
|
-
type:
|
|
13788
|
+
type: JsonStreamEventType.INIT,
|
|
13772
13789
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13773
13790
|
session_id: config.getSessionId(),
|
|
13774
13791
|
model: config.getModel()
|
|
@@ -13806,7 +13823,7 @@ async function runNonInteractive({
|
|
|
13806
13823
|
}
|
|
13807
13824
|
if (streamFormatter) {
|
|
13808
13825
|
streamFormatter.emitEvent({
|
|
13809
|
-
type:
|
|
13826
|
+
type: JsonStreamEventType.MESSAGE,
|
|
13810
13827
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13811
13828
|
role: "user",
|
|
13812
13829
|
content: input
|
|
@@ -13845,12 +13862,12 @@ async function runNonInteractive({
|
|
|
13845
13862
|
const metrics = uiTelemetryService.getMetrics();
|
|
13846
13863
|
const durationMs = Date.now() - startTime;
|
|
13847
13864
|
streamFormatter.emitEvent({
|
|
13848
|
-
type:
|
|
13865
|
+
type: JsonStreamEventType.RESULT,
|
|
13849
13866
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13850
13867
|
status: errorPayload ? "error" : "success",
|
|
13851
13868
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
13852
13869
|
});
|
|
13853
|
-
} else if (config.getOutputFormat() ===
|
|
13870
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13854
13871
|
const formatter = new JsonFormatter();
|
|
13855
13872
|
const stats = uiTelemetryService.getMetrics();
|
|
13856
13873
|
textOutput.write(
|
|
@@ -13942,13 +13959,13 @@ async function runNonInteractive({
|
|
|
13942
13959
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
13943
13960
|
if (streamFormatter) {
|
|
13944
13961
|
streamFormatter.emitEvent({
|
|
13945
|
-
type:
|
|
13962
|
+
type: JsonStreamEventType.MESSAGE,
|
|
13946
13963
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13947
13964
|
role: "assistant",
|
|
13948
13965
|
content: output,
|
|
13949
13966
|
delta: true
|
|
13950
13967
|
});
|
|
13951
|
-
} else if (config.getOutputFormat() ===
|
|
13968
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13952
13969
|
responseText += output;
|
|
13953
13970
|
} else {
|
|
13954
13971
|
if (part.text) {
|
|
@@ -13961,13 +13978,13 @@ async function runNonInteractive({
|
|
|
13961
13978
|
break;
|
|
13962
13979
|
}
|
|
13963
13980
|
case "tool_request": {
|
|
13964
|
-
if (config.getOutputFormat() ===
|
|
13981
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
13965
13982
|
preToolResponseText = responseText || preToolResponseText;
|
|
13966
13983
|
responseText = "";
|
|
13967
13984
|
}
|
|
13968
13985
|
if (streamFormatter) {
|
|
13969
13986
|
streamFormatter.emitEvent({
|
|
13970
|
-
type:
|
|
13987
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
13971
13988
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13972
13989
|
tool_name: event.name,
|
|
13973
13990
|
tool_id: event.requestId,
|
|
@@ -13983,7 +14000,7 @@ async function runNonInteractive({
|
|
|
13983
14000
|
const displayText = displayContentToString(display);
|
|
13984
14001
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
13985
14002
|
streamFormatter.emitEvent({
|
|
13986
|
-
type:
|
|
14003
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
13987
14004
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13988
14005
|
tool_id: event.requestId,
|
|
13989
14006
|
status: event.isError ? "error" : "success",
|
|
@@ -13998,17 +14015,17 @@ async function runNonInteractive({
|
|
|
13998
14015
|
const display = event.display?.result;
|
|
13999
14016
|
const displayText = displayContentToString(display);
|
|
14000
14017
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
14001
|
-
if (event.data?.["errorType"] ===
|
|
14002
|
-
if (config.getOutputFormat() ===
|
|
14018
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
14019
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
14003
14020
|
responseText = preToolResponseText;
|
|
14004
14021
|
}
|
|
14005
14022
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
14006
|
-
if (config.getOutputFormat() ===
|
|
14023
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14007
14024
|
process.stderr.write(`${stopMessage}
|
|
14008
14025
|
`);
|
|
14009
14026
|
}
|
|
14010
14027
|
}
|
|
14011
|
-
if (event.data?.["errorType"] ===
|
|
14028
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
14012
14029
|
throw new FatalToolExecutionError(
|
|
14013
14030
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
14014
14031
|
);
|
|
@@ -14043,12 +14060,12 @@ async function runNonInteractive({
|
|
|
14043
14060
|
}
|
|
14044
14061
|
if (streamFormatter) {
|
|
14045
14062
|
streamFormatter.emitEvent({
|
|
14046
|
-
type:
|
|
14063
|
+
type: JsonStreamEventType.ERROR,
|
|
14047
14064
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14048
14065
|
severity: "error",
|
|
14049
14066
|
message: errorMessage
|
|
14050
14067
|
});
|
|
14051
|
-
} else if (config.getOutputFormat() ===
|
|
14068
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14052
14069
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
14053
14070
|
`);
|
|
14054
14071
|
}
|
|
@@ -14069,12 +14086,12 @@ async function runNonInteractive({
|
|
|
14069
14086
|
const errorCode = event._meta?.["code"];
|
|
14070
14087
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
14071
14088
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
14072
|
-
if (config.getOutputFormat() ===
|
|
14089
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14073
14090
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
14074
14091
|
`);
|
|
14075
14092
|
} else if (streamFormatter) {
|
|
14076
14093
|
streamFormatter.emitEvent({
|
|
14077
|
-
type:
|
|
14094
|
+
type: JsonStreamEventType.ERROR,
|
|
14078
14095
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14079
14096
|
severity: "warning",
|
|
14080
14097
|
message: stripAnsi(blockMessage)
|
|
@@ -14084,13 +14101,13 @@ async function runNonInteractive({
|
|
|
14084
14101
|
break;
|
|
14085
14102
|
}
|
|
14086
14103
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
14087
|
-
if (config.getOutputFormat() ===
|
|
14104
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14088
14105
|
process.stderr.write(`[WARNING] ${event.message}
|
|
14089
14106
|
`);
|
|
14090
14107
|
}
|
|
14091
14108
|
if (streamFormatter) {
|
|
14092
14109
|
streamFormatter.emitEvent({
|
|
14093
|
-
type:
|
|
14110
|
+
type: JsonStreamEventType.ERROR,
|
|
14094
14111
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14095
14112
|
severity,
|
|
14096
14113
|
message: stripAnsi(event.message)
|
|
@@ -14110,7 +14127,7 @@ async function runNonInteractive({
|
|
|
14110
14127
|
);
|
|
14111
14128
|
} else if (streamFormatter) {
|
|
14112
14129
|
streamFormatter.emitEvent({
|
|
14113
|
-
type:
|
|
14130
|
+
type: JsonStreamEventType.ERROR,
|
|
14114
14131
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14115
14132
|
severity: "error",
|
|
14116
14133
|
message: "Maximum session turns exceeded"
|
|
@@ -14118,7 +14135,7 @@ async function runNonInteractive({
|
|
|
14118
14135
|
}
|
|
14119
14136
|
}
|
|
14120
14137
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
14121
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
14138
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14122
14139
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
14123
14140
|
`);
|
|
14124
14141
|
}
|
|
@@ -14148,7 +14165,7 @@ async function runNonInteractive({
|
|
|
14148
14165
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
14149
14166
|
scheduler?.dispose();
|
|
14150
14167
|
consolePatcher.cleanup();
|
|
14151
|
-
coreEvents.off(
|
|
14168
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
14152
14169
|
await runExitCleanup();
|
|
14153
14170
|
}
|
|
14154
14171
|
if (abortController.signal.aborted || isFatalCancellationError(errorToHandle)) {
|
|
@@ -14181,7 +14198,7 @@ async function runNonInteractive2(params) {
|
|
|
14181
14198
|
}
|
|
14182
14199
|
});
|
|
14183
14200
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
14184
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
14201
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-UZFFGBEG.js");
|
|
14185
14202
|
setupInitialActivityLogger(config);
|
|
14186
14203
|
}
|
|
14187
14204
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -14197,7 +14214,7 @@ async function runNonInteractive2(params) {
|
|
|
14197
14214
|
}
|
|
14198
14215
|
};
|
|
14199
14216
|
const startTime = Date.now();
|
|
14200
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
14217
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
14201
14218
|
const abortController = new AbortController();
|
|
14202
14219
|
let isAborting = false;
|
|
14203
14220
|
let cancelMessageTimer = null;
|
|
@@ -14281,13 +14298,13 @@ async function runNonInteractive2(params) {
|
|
|
14281
14298
|
let scheduler;
|
|
14282
14299
|
try {
|
|
14283
14300
|
consolePatcher.patch();
|
|
14284
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
14301
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14285
14302
|
process.stderr.write(
|
|
14286
14303
|
"[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
14304
|
);
|
|
14288
14305
|
}
|
|
14289
14306
|
setupCancellation();
|
|
14290
|
-
coreEvents.on(
|
|
14307
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
14291
14308
|
coreEvents.drainBacklogs();
|
|
14292
14309
|
process.stdout.on("error", handleStdoutError);
|
|
14293
14310
|
const geminiClient = config.getGeminiClient();
|
|
@@ -14307,7 +14324,7 @@ async function runNonInteractive2(params) {
|
|
|
14307
14324
|
}
|
|
14308
14325
|
if (streamFormatter) {
|
|
14309
14326
|
streamFormatter.emitEvent({
|
|
14310
|
-
type:
|
|
14327
|
+
type: JsonStreamEventType.INIT,
|
|
14311
14328
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14312
14329
|
session_id: config.getSessionId(),
|
|
14313
14330
|
model: config.getModel()
|
|
@@ -14345,7 +14362,7 @@ async function runNonInteractive2(params) {
|
|
|
14345
14362
|
}
|
|
14346
14363
|
if (streamFormatter) {
|
|
14347
14364
|
streamFormatter.emitEvent({
|
|
14348
|
-
type:
|
|
14365
|
+
type: JsonStreamEventType.MESSAGE,
|
|
14349
14366
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14350
14367
|
role: "user",
|
|
14351
14368
|
content: input
|
|
@@ -14373,28 +14390,28 @@ async function runNonInteractive2(params) {
|
|
|
14373
14390
|
if (abortController.signal.aborted) {
|
|
14374
14391
|
handleCancellationError(config, abortExitCode);
|
|
14375
14392
|
}
|
|
14376
|
-
if (event.type ===
|
|
14393
|
+
if (event.type === GeminiEventType.Content) {
|
|
14377
14394
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
14378
14395
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
14379
14396
|
if (streamFormatter) {
|
|
14380
14397
|
streamFormatter.emitEvent({
|
|
14381
|
-
type:
|
|
14398
|
+
type: JsonStreamEventType.MESSAGE,
|
|
14382
14399
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14383
14400
|
role: "assistant",
|
|
14384
14401
|
content: output,
|
|
14385
14402
|
delta: true
|
|
14386
14403
|
});
|
|
14387
|
-
} else if (config.getOutputFormat() ===
|
|
14404
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14388
14405
|
responseText += output;
|
|
14389
14406
|
} else {
|
|
14390
14407
|
if (event.value) {
|
|
14391
14408
|
textOutput.write(output);
|
|
14392
14409
|
}
|
|
14393
14410
|
}
|
|
14394
|
-
} else if (event.type ===
|
|
14411
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
14395
14412
|
if (streamFormatter) {
|
|
14396
14413
|
streamFormatter.emitEvent({
|
|
14397
|
-
type:
|
|
14414
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
14398
14415
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14399
14416
|
tool_name: event.value.name,
|
|
14400
14417
|
tool_id: event.value.callId,
|
|
@@ -14402,29 +14419,29 @@ async function runNonInteractive2(params) {
|
|
|
14402
14419
|
});
|
|
14403
14420
|
}
|
|
14404
14421
|
toolCallRequests.push(event.value);
|
|
14405
|
-
} else if (event.type ===
|
|
14422
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
14406
14423
|
const message = "Loop detected, stopping execution";
|
|
14407
14424
|
if (streamFormatter) {
|
|
14408
14425
|
streamFormatter.emitEvent({
|
|
14409
|
-
type:
|
|
14426
|
+
type: JsonStreamEventType.ERROR,
|
|
14410
14427
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14411
14428
|
severity: "warning",
|
|
14412
14429
|
message
|
|
14413
14430
|
});
|
|
14414
14431
|
}
|
|
14415
14432
|
warnings.push(message);
|
|
14416
|
-
} else if (event.type ===
|
|
14433
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
14417
14434
|
const message = "Maximum session turns exceeded";
|
|
14418
14435
|
if (streamFormatter) {
|
|
14419
14436
|
streamFormatter.emitEvent({
|
|
14420
|
-
type:
|
|
14437
|
+
type: JsonStreamEventType.ERROR,
|
|
14421
14438
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14422
14439
|
severity: "error",
|
|
14423
14440
|
message
|
|
14424
14441
|
});
|
|
14425
14442
|
}
|
|
14426
14443
|
warnings.push(message);
|
|
14427
|
-
} else if (event.type ===
|
|
14444
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
14428
14445
|
const normalized = normalizeError(event.value?.error);
|
|
14429
14446
|
const code = normalized.code ?? (typeof normalized.status === "string" ? normalized.status : void 0);
|
|
14430
14447
|
const err = Object.assign(
|
|
@@ -14439,9 +14456,9 @@ async function runNonInteractive2(params) {
|
|
|
14439
14456
|
}
|
|
14440
14457
|
);
|
|
14441
14458
|
throw err;
|
|
14442
|
-
} else if (event.type ===
|
|
14459
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
14443
14460
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
14444
|
-
if (config.getOutputFormat() ===
|
|
14461
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14445
14462
|
process.stderr.write(`${stopMessage}
|
|
14446
14463
|
`);
|
|
14447
14464
|
}
|
|
@@ -14449,7 +14466,7 @@ async function runNonInteractive2(params) {
|
|
|
14449
14466
|
const metrics = uiTelemetryService.getMetrics();
|
|
14450
14467
|
const durationMs = Date.now() - startTime;
|
|
14451
14468
|
streamFormatter.emitEvent({
|
|
14452
|
-
type:
|
|
14469
|
+
type: JsonStreamEventType.RESULT,
|
|
14453
14470
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14454
14471
|
status: "success",
|
|
14455
14472
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -14457,7 +14474,7 @@ async function runNonInteractive2(params) {
|
|
|
14457
14474
|
durationMs
|
|
14458
14475
|
)
|
|
14459
14476
|
});
|
|
14460
|
-
} else if (config.getOutputFormat() ===
|
|
14477
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14461
14478
|
const formatter = new JsonFormatter();
|
|
14462
14479
|
const stats = uiTelemetryService.getMetrics();
|
|
14463
14480
|
textOutput.write(
|
|
@@ -14473,23 +14490,23 @@ async function runNonInteractive2(params) {
|
|
|
14473
14490
|
textOutput.ensureTrailingNewline();
|
|
14474
14491
|
}
|
|
14475
14492
|
return;
|
|
14476
|
-
} else if (event.type ===
|
|
14493
|
+
} else if (event.type === GeminiEventType.UserCancelled) {
|
|
14477
14494
|
throw new FatalCancellationError("Operation cancelled.");
|
|
14478
|
-
} else if (event.type ===
|
|
14495
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
14479
14496
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
14480
|
-
if (config.getOutputFormat() ===
|
|
14497
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14481
14498
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
14482
14499
|
`);
|
|
14483
14500
|
} else if (streamFormatter) {
|
|
14484
14501
|
streamFormatter.emitEvent({
|
|
14485
|
-
type:
|
|
14502
|
+
type: JsonStreamEventType.ERROR,
|
|
14486
14503
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14487
14504
|
severity: "warning",
|
|
14488
14505
|
message: stripAnsi(blockMessage)
|
|
14489
14506
|
});
|
|
14490
14507
|
}
|
|
14491
14508
|
warnings.push(blockMessage);
|
|
14492
|
-
} else if (event.type ===
|
|
14509
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
14493
14510
|
const eventValue = event.value;
|
|
14494
14511
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
14495
14512
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -14512,12 +14529,12 @@ async function runNonInteractive2(params) {
|
|
|
14512
14529
|
);
|
|
14513
14530
|
if (streamFormatter) {
|
|
14514
14531
|
streamFormatter.emitEvent({
|
|
14515
|
-
type:
|
|
14532
|
+
type: JsonStreamEventType.ERROR,
|
|
14516
14533
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14517
14534
|
severity: "error",
|
|
14518
14535
|
message: invalidStreamError
|
|
14519
14536
|
});
|
|
14520
|
-
} else if (config.getOutputFormat() ===
|
|
14537
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14521
14538
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
14522
14539
|
`);
|
|
14523
14540
|
}
|
|
@@ -14554,7 +14571,7 @@ async function runNonInteractive2(params) {
|
|
|
14554
14571
|
const requestInfo = completedToolCall.request;
|
|
14555
14572
|
if (streamFormatter) {
|
|
14556
14573
|
streamFormatter.emitEvent({
|
|
14557
|
-
type:
|
|
14574
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
14558
14575
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14559
14576
|
tool_id: requestInfo.callId,
|
|
14560
14577
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -14588,11 +14605,11 @@ async function runNonInteractive2(params) {
|
|
|
14588
14605
|
);
|
|
14589
14606
|
}
|
|
14590
14607
|
const stopExecutionTool = completedToolCalls.find(
|
|
14591
|
-
(tc) => tc.response.errorType ===
|
|
14608
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
14592
14609
|
);
|
|
14593
14610
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
14594
14611
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
14595
|
-
if (config.getOutputFormat() ===
|
|
14612
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
14596
14613
|
process.stderr.write(`${stopMessage}
|
|
14597
14614
|
`);
|
|
14598
14615
|
}
|
|
@@ -14600,7 +14617,7 @@ async function runNonInteractive2(params) {
|
|
|
14600
14617
|
const metrics = uiTelemetryService.getMetrics();
|
|
14601
14618
|
const durationMs = Date.now() - startTime;
|
|
14602
14619
|
streamFormatter.emitEvent({
|
|
14603
|
-
type:
|
|
14620
|
+
type: JsonStreamEventType.RESULT,
|
|
14604
14621
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14605
14622
|
status: "success",
|
|
14606
14623
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -14608,7 +14625,7 @@ async function runNonInteractive2(params) {
|
|
|
14608
14625
|
durationMs
|
|
14609
14626
|
)
|
|
14610
14627
|
});
|
|
14611
|
-
} else if (config.getOutputFormat() ===
|
|
14628
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14612
14629
|
const formatter = new JsonFormatter();
|
|
14613
14630
|
const stats = uiTelemetryService.getMetrics();
|
|
14614
14631
|
textOutput.write(
|
|
@@ -14637,12 +14654,12 @@ async function runNonInteractive2(params) {
|
|
|
14637
14654
|
const metrics = uiTelemetryService.getMetrics();
|
|
14638
14655
|
const durationMs = Date.now() - startTime;
|
|
14639
14656
|
streamFormatter.emitEvent({
|
|
14640
|
-
type:
|
|
14657
|
+
type: JsonStreamEventType.RESULT,
|
|
14641
14658
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
14642
14659
|
status: invalidStreamError ? "error" : "success",
|
|
14643
14660
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
14644
14661
|
});
|
|
14645
|
-
} else if (config.getOutputFormat() ===
|
|
14662
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
14646
14663
|
const formatter = new JsonFormatter();
|
|
14647
14664
|
const stats = uiTelemetryService.getMetrics();
|
|
14648
14665
|
textOutput.write(
|
|
@@ -14666,7 +14683,7 @@ async function runNonInteractive2(params) {
|
|
|
14666
14683
|
cleanupCancellation();
|
|
14667
14684
|
scheduler?.dispose();
|
|
14668
14685
|
consolePatcher.cleanup();
|
|
14669
|
-
coreEvents.off(
|
|
14686
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
14670
14687
|
await runExitCleanup();
|
|
14671
14688
|
}
|
|
14672
14689
|
if (abortController.signal.aborted || isFatalCancellationError(errorToHandle)) {
|
|
@@ -17064,12 +17081,12 @@ var Session = class {
|
|
|
17064
17081
|
this.connection = connection;
|
|
17065
17082
|
this.settings = settings;
|
|
17066
17083
|
coreEvents.on(
|
|
17067
|
-
|
|
17084
|
+
CoreEvent.ApprovalModeChanged,
|
|
17068
17085
|
this.handleApprovalModeChanged
|
|
17069
17086
|
);
|
|
17070
|
-
coreEvents.on(
|
|
17087
|
+
coreEvents.on(CoreEvent.RetryAttempt, this.handleRetryAttempt);
|
|
17071
17088
|
this.context.config.getMessageBus()?.subscribe(
|
|
17072
|
-
|
|
17089
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
17073
17090
|
this.handleToolConfirmationRequest,
|
|
17074
17091
|
{ signal: this.disposeController.signal }
|
|
17075
17092
|
);
|
|
@@ -17093,7 +17110,7 @@ var Session = class {
|
|
|
17093
17110
|
"Policy engine missing. Denying tool confirmation request."
|
|
17094
17111
|
);
|
|
17095
17112
|
await messageBus.publish({
|
|
17096
|
-
type:
|
|
17113
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17097
17114
|
correlationId: request.correlationId,
|
|
17098
17115
|
confirmed: false,
|
|
17099
17116
|
requiresUserConfirmation: false
|
|
@@ -17106,7 +17123,7 @@ var Session = class {
|
|
|
17106
17123
|
"Tool confirmation request missing tool name. Denying."
|
|
17107
17124
|
);
|
|
17108
17125
|
await messageBus.publish({
|
|
17109
|
-
type:
|
|
17126
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17110
17127
|
correlationId: request.correlationId,
|
|
17111
17128
|
confirmed: false,
|
|
17112
17129
|
requiresUserConfirmation: false
|
|
@@ -17119,7 +17136,7 @@ var Session = class {
|
|
|
17119
17136
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
17120
17137
|
);
|
|
17121
17138
|
await messageBus.publish({
|
|
17122
|
-
type:
|
|
17139
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17123
17140
|
correlationId: request.correlationId,
|
|
17124
17141
|
confirmed: false,
|
|
17125
17142
|
requiresUserConfirmation: false
|
|
@@ -17135,15 +17152,15 @@ var Session = class {
|
|
|
17135
17152
|
request.subagent
|
|
17136
17153
|
);
|
|
17137
17154
|
await messageBus.publish({
|
|
17138
|
-
type:
|
|
17155
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17139
17156
|
correlationId: request.correlationId,
|
|
17140
|
-
confirmed: result.decision ===
|
|
17141
|
-
requiresUserConfirmation: result.decision ===
|
|
17157
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
17158
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
17142
17159
|
});
|
|
17143
17160
|
} catch (error) {
|
|
17144
17161
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
17145
17162
|
await this.context.config.getMessageBus()?.publish({
|
|
17146
|
-
type:
|
|
17163
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
17147
17164
|
correlationId: request.correlationId,
|
|
17148
17165
|
confirmed: false,
|
|
17149
17166
|
requiresUserConfirmation: false
|
|
@@ -17177,10 +17194,10 @@ var Session = class {
|
|
|
17177
17194
|
};
|
|
17178
17195
|
async dispose() {
|
|
17179
17196
|
coreEvents.off(
|
|
17180
|
-
|
|
17197
|
+
CoreEvent.ApprovalModeChanged,
|
|
17181
17198
|
this.handleApprovalModeChanged
|
|
17182
17199
|
);
|
|
17183
|
-
coreEvents.off(
|
|
17200
|
+
coreEvents.off(CoreEvent.RetryAttempt, this.handleRetryAttempt);
|
|
17184
17201
|
this.disposeController.abort();
|
|
17185
17202
|
if (this.context.config?.dispose) {
|
|
17186
17203
|
try {
|
|
@@ -17274,7 +17291,7 @@ ${thought.description}`;
|
|
|
17274
17291
|
await this.sendUpdate({
|
|
17275
17292
|
sessionUpdate: "tool_call",
|
|
17276
17293
|
toolCallId: toolCall.id,
|
|
17277
|
-
status: toolCall.status ===
|
|
17294
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
17278
17295
|
title: toolCall.displayName || toolCall.name,
|
|
17279
17296
|
content: toolCallContent,
|
|
17280
17297
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -17384,7 +17401,7 @@ ${thought.description}`;
|
|
|
17384
17401
|
return { stopReason: "cancelled" };
|
|
17385
17402
|
}
|
|
17386
17403
|
switch (event.type) {
|
|
17387
|
-
case
|
|
17404
|
+
case GeminiEventType.Content: {
|
|
17388
17405
|
const content = {
|
|
17389
17406
|
type: "text",
|
|
17390
17407
|
text: event.value
|
|
@@ -17398,7 +17415,7 @@ ${thought.description}`;
|
|
|
17398
17415
|
await this.sendUpdate(update);
|
|
17399
17416
|
break;
|
|
17400
17417
|
}
|
|
17401
|
-
case
|
|
17418
|
+
case GeminiEventType.Thought: {
|
|
17402
17419
|
const thoughtText = `**${event.value.subject}**
|
|
17403
17420
|
${event.value.description}`;
|
|
17404
17421
|
await this.sendUpdate({
|
|
@@ -17407,7 +17424,7 @@ ${event.value.description}`;
|
|
|
17407
17424
|
});
|
|
17408
17425
|
break;
|
|
17409
17426
|
}
|
|
17410
|
-
case
|
|
17427
|
+
case GeminiEventType.Retry: {
|
|
17411
17428
|
toolCallRequests.length = 0;
|
|
17412
17429
|
debugLogger.warn(
|
|
17413
17430
|
"Model stream interrupted mid-response; retrying prompt..."
|
|
@@ -17423,10 +17440,10 @@ ${event.value.description}`;
|
|
|
17423
17440
|
isFirstChunkAfterRetry = true;
|
|
17424
17441
|
break;
|
|
17425
17442
|
}
|
|
17426
|
-
case
|
|
17443
|
+
case GeminiEventType.ToolCallRequest:
|
|
17427
17444
|
toolCallRequests.push(event.value);
|
|
17428
17445
|
break;
|
|
17429
|
-
case
|
|
17446
|
+
case GeminiEventType.Finished: {
|
|
17430
17447
|
const usage2 = event.value.usageMetadata;
|
|
17431
17448
|
if (usage2) {
|
|
17432
17449
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -17443,19 +17460,19 @@ ${event.value.description}`;
|
|
|
17443
17460
|
}
|
|
17444
17461
|
break;
|
|
17445
17462
|
}
|
|
17446
|
-
case
|
|
17463
|
+
case GeminiEventType.ModelInfo:
|
|
17447
17464
|
turnModelId = event.value;
|
|
17448
17465
|
break;
|
|
17449
|
-
case
|
|
17466
|
+
case GeminiEventType.MaxSessionTurns:
|
|
17450
17467
|
stopReason = "max_turn_requests";
|
|
17451
17468
|
break;
|
|
17452
|
-
case
|
|
17469
|
+
case GeminiEventType.LoopDetected:
|
|
17453
17470
|
stopReason = "max_turn_requests";
|
|
17454
17471
|
break;
|
|
17455
|
-
case
|
|
17472
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
17456
17473
|
stopReason = "max_tokens";
|
|
17457
17474
|
break;
|
|
17458
|
-
case
|
|
17475
|
+
case GeminiEventType.Error: {
|
|
17459
17476
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
17460
17477
|
event.value.error
|
|
17461
17478
|
);
|
|
@@ -17646,7 +17663,7 @@ ${event.value.description}`;
|
|
|
17646
17663
|
const output = RequestPermissionResponseSchema.parse(
|
|
17647
17664
|
await this.connection.requestPermission(params)
|
|
17648
17665
|
);
|
|
17649
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
17666
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
17650
17667
|
await confirmationDetails.onConfirm(outcome);
|
|
17651
17668
|
await updatePolicy(
|
|
17652
17669
|
tool,
|
|
@@ -17657,7 +17674,7 @@ ${event.value.description}`;
|
|
|
17657
17674
|
invocation
|
|
17658
17675
|
);
|
|
17659
17676
|
switch (outcome) {
|
|
17660
|
-
case
|
|
17677
|
+
case ToolConfirmationOutcome.Cancel: {
|
|
17661
17678
|
const cancelError = new Error(
|
|
17662
17679
|
`Tool "${fc.name}" was canceled by the user.`
|
|
17663
17680
|
);
|
|
@@ -17675,12 +17692,12 @@ ${event.value.description}`;
|
|
|
17675
17692
|
});
|
|
17676
17693
|
return errorResponse(cancelError);
|
|
17677
17694
|
}
|
|
17678
|
-
case
|
|
17679
|
-
case
|
|
17680
|
-
case
|
|
17681
|
-
case
|
|
17682
|
-
case
|
|
17683
|
-
case
|
|
17695
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
17696
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
17697
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
17698
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
17699
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
17700
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
17684
17701
|
break;
|
|
17685
17702
|
default: {
|
|
17686
17703
|
const resultOutcome = outcome;
|
|
@@ -17734,7 +17751,7 @@ ${event.value.description}`;
|
|
|
17734
17751
|
);
|
|
17735
17752
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
17736
17753
|
{
|
|
17737
|
-
status:
|
|
17754
|
+
status: CoreToolCallStatus.Success,
|
|
17738
17755
|
request: {
|
|
17739
17756
|
callId,
|
|
17740
17757
|
name: fc.name,
|
|
@@ -17779,7 +17796,7 @@ ${event.value.description}`;
|
|
|
17779
17796
|
});
|
|
17780
17797
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
17781
17798
|
{
|
|
17782
|
-
status:
|
|
17799
|
+
status: CoreToolCallStatus.Error,
|
|
17783
17800
|
request: {
|
|
17784
17801
|
callId,
|
|
17785
17802
|
name: fc.name,
|
|
@@ -17908,12 +17925,12 @@ ${event.value.description}`;
|
|
|
17908
17925
|
sessionId: this.id,
|
|
17909
17926
|
options: [
|
|
17910
17927
|
{
|
|
17911
|
-
optionId:
|
|
17928
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
17912
17929
|
name: "Allow once",
|
|
17913
17930
|
kind: "allow_once"
|
|
17914
17931
|
},
|
|
17915
17932
|
{
|
|
17916
|
-
optionId:
|
|
17933
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
17917
17934
|
name: "Deny",
|
|
17918
17935
|
kind: "reject_once"
|
|
17919
17936
|
}
|
|
@@ -17938,8 +17955,8 @@ ${event.value.description}`;
|
|
|
17938
17955
|
const output = RequestPermissionResponseSchema.parse(
|
|
17939
17956
|
await this.connection.requestPermission(params)
|
|
17940
17957
|
);
|
|
17941
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
17942
|
-
if (outcome ===
|
|
17958
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
17959
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
17943
17960
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
17944
17961
|
validationError = null;
|
|
17945
17962
|
} else {
|
|
@@ -18382,7 +18399,7 @@ var AcpSessionManager = class {
|
|
|
18382
18399
|
mcpServers,
|
|
18383
18400
|
loadedSettings
|
|
18384
18401
|
);
|
|
18385
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
18402
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
18386
18403
|
let isAuthenticated = false;
|
|
18387
18404
|
let authErrorMessage = "";
|
|
18388
18405
|
try {
|
|
@@ -18394,7 +18411,7 @@ var AcpSessionManager = class {
|
|
|
18394
18411
|
);
|
|
18395
18412
|
isAuthenticated = true;
|
|
18396
18413
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
18397
|
-
if (authType ===
|
|
18414
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
18398
18415
|
isAuthenticated = false;
|
|
18399
18416
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
18400
18417
|
}
|
|
@@ -18580,7 +18597,7 @@ var AcpSessionManager = class {
|
|
|
18580
18597
|
}
|
|
18581
18598
|
}
|
|
18582
18599
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
18583
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
18600
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
18584
18601
|
if (!selectedAuthType) {
|
|
18585
18602
|
throw RequestError.authRequired();
|
|
18586
18603
|
}
|
|
@@ -18692,12 +18709,12 @@ var GeminiAgent = class {
|
|
|
18692
18709
|
}
|
|
18693
18710
|
const authMethods = [
|
|
18694
18711
|
{
|
|
18695
|
-
id:
|
|
18712
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
18696
18713
|
name: "Log in with Google",
|
|
18697
18714
|
description: "Log in with your Google account"
|
|
18698
18715
|
},
|
|
18699
18716
|
{
|
|
18700
|
-
id:
|
|
18717
|
+
id: AuthType.USE_GEMINI,
|
|
18701
18718
|
name: "Gemini API key",
|
|
18702
18719
|
description: "Use an API key with Gemini Developer API",
|
|
18703
18720
|
_meta: {
|
|
@@ -18707,12 +18724,12 @@ var GeminiAgent = class {
|
|
|
18707
18724
|
}
|
|
18708
18725
|
},
|
|
18709
18726
|
{
|
|
18710
|
-
id:
|
|
18727
|
+
id: AuthType.USE_VERTEX_AI,
|
|
18711
18728
|
name: "Vertex AI",
|
|
18712
18729
|
description: "Use an API key with Vertex AI GenAI API"
|
|
18713
18730
|
},
|
|
18714
18731
|
{
|
|
18715
|
-
id:
|
|
18732
|
+
id: AuthType.GATEWAY,
|
|
18716
18733
|
name: "AI API Gateway",
|
|
18717
18734
|
description: "Use a custom AI API Gateway",
|
|
18718
18735
|
_meta: {
|
|
@@ -18885,7 +18902,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
18885
18902
|
}
|
|
18886
18903
|
return authType;
|
|
18887
18904
|
} catch (error) {
|
|
18888
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
18905
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
18889
18906
|
handleError(
|
|
18890
18907
|
error instanceof Error ? error : new Error(String(error)),
|
|
18891
18908
|
nonInteractiveConfig,
|
|
@@ -19084,10 +19101,10 @@ var SlashCommandConflictHandler = class {
|
|
|
19084
19101
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
19085
19102
|
}
|
|
19086
19103
|
start() {
|
|
19087
|
-
coreEvents.on(
|
|
19104
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
19088
19105
|
}
|
|
19089
19106
|
stop() {
|
|
19090
|
-
coreEvents.off(
|
|
19107
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
19091
19108
|
if (this.flushTimeout) {
|
|
19092
19109
|
clearTimeout(this.flushTimeout);
|
|
19093
19110
|
this.flushTimeout = null;
|
|
@@ -19462,7 +19479,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
19462
19479
|
}
|
|
19463
19480
|
}
|
|
19464
19481
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
19465
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
19482
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-W4IK4C6F.js");
|
|
19466
19483
|
await doStartUI(
|
|
19467
19484
|
config,
|
|
19468
19485
|
settings,
|
|
@@ -19565,12 +19582,12 @@ async function main() {
|
|
|
19565
19582
|
dns.setDefaultResultOrder(
|
|
19566
19583
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
19567
19584
|
);
|
|
19568
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
19585
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
19569
19586
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
19570
19587
|
settings.setValue(
|
|
19571
19588
|
"User" /* User */,
|
|
19572
19589
|
"security.auth.selectedType",
|
|
19573
|
-
|
|
19590
|
+
AuthType.COMPUTE_ADC
|
|
19574
19591
|
);
|
|
19575
19592
|
}
|
|
19576
19593
|
}
|
|
@@ -19697,7 +19714,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19697
19714
|
await config.storage.initialize();
|
|
19698
19715
|
adminControlsListner.setConfig(config);
|
|
19699
19716
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
19700
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
19717
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-UZFFGBEG.js");
|
|
19701
19718
|
setupInitialActivityLogger(config);
|
|
19702
19719
|
}
|
|
19703
19720
|
registerTelemetryConfig(config);
|
|
@@ -19705,7 +19722,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19705
19722
|
const messageBus = config.getMessageBus();
|
|
19706
19723
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
19707
19724
|
registerCleanup(async () => {
|
|
19708
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
19725
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
19709
19726
|
});
|
|
19710
19727
|
if (!config.getAcpMode()) {
|
|
19711
19728
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -19756,7 +19773,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19756
19773
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
19757
19774
|
const initializationResult = await initializeApp(config, settings);
|
|
19758
19775
|
initAppHandle?.end();
|
|
19759
|
-
import("./liteRtServerManager-
|
|
19776
|
+
import("./liteRtServerManager-GSYRGOB6.js").then(({ LiteRtServerManager }) => {
|
|
19760
19777
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
19761
19778
|
if (!mergedGemma) return;
|
|
19762
19779
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -19766,7 +19783,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19766
19783
|
autoStartServer: userGemma?.autoStartServer
|
|
19767
19784
|
});
|
|
19768
19785
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
19769
|
-
if (settings.merged.security.auth.selectedType ===
|
|
19786
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
19770
19787
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
19771
19788
|
}
|
|
19772
19789
|
if (config.getAcpMode()) {
|
|
@@ -19782,7 +19799,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19782
19799
|
...rawStartupWarnings.map((message) => ({
|
|
19783
19800
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
19784
19801
|
message,
|
|
19785
|
-
priority:
|
|
19802
|
+
priority: WarningPriority.High
|
|
19786
19803
|
})),
|
|
19787
19804
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
19788
19805
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -19819,7 +19836,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19819
19836
|
${input}` : stdinData;
|
|
19820
19837
|
}
|
|
19821
19838
|
}
|
|
19822
|
-
const sessionStartSource = resumedSessionData ?
|
|
19839
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
19823
19840
|
const hookSystem = config?.getHookSystem();
|
|
19824
19841
|
if (hookSystem) {
|
|
19825
19842
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -19876,8 +19893,8 @@ ${input}` : wrappedContext;
|
|
|
19876
19893
|
}
|
|
19877
19894
|
}
|
|
19878
19895
|
function initializeOutputListenersAndFlush(config) {
|
|
19879
|
-
if (coreEvents.listenerCount(
|
|
19880
|
-
coreEvents.on(
|
|
19896
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
19897
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
19881
19898
|
if (payload.isStderr) {
|
|
19882
19899
|
writeToStderr(payload.chunk, payload.encoding);
|
|
19883
19900
|
} else {
|
|
@@ -19885,8 +19902,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19885
19902
|
}
|
|
19886
19903
|
});
|
|
19887
19904
|
}
|
|
19888
|
-
if (coreEvents.listenerCount(
|
|
19889
|
-
coreEvents.on(
|
|
19905
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
19906
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
19890
19907
|
if (payload.type === "error" || payload.type === "warn") {
|
|
19891
19908
|
writeToStderr(payload.content + "\n");
|
|
19892
19909
|
} else {
|
|
@@ -19894,8 +19911,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19894
19911
|
}
|
|
19895
19912
|
});
|
|
19896
19913
|
}
|
|
19897
|
-
if (coreEvents.listenerCount(
|
|
19898
|
-
coreEvents.on(
|
|
19914
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
19915
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
19899
19916
|
writeToStderr(payload.message + "\n");
|
|
19900
19917
|
});
|
|
19901
19918
|
}
|
|
@@ -19903,7 +19920,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19903
19920
|
const forceToStderr = outputFormat === "json";
|
|
19904
19921
|
coreEvents.drainBacklogs(
|
|
19905
19922
|
(event, args) => {
|
|
19906
|
-
if (forceToStderr && event ===
|
|
19923
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
19907
19924
|
const payload = args[0];
|
|
19908
19925
|
if (!payload.isStderr) {
|
|
19909
19926
|
return {
|