@google/gemini-cli 0.63.0-preview.0 → 0.64.0-nightly.20261001.gc6bccb7ec
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-EIMVJG2V.js → chunk-2AWGKUBT.js} +1 -1
- package/bundle/{chunk-GRSO6OI3.js → chunk-33M6KTJD.js} +11 -9
- package/bundle/{chunk-2J6RC447.js → chunk-3V7PFNJW.js} +3 -3
- package/bundle/{chunk-NWSCUKK3.js → chunk-5Q2IR4AT.js} +1512 -1317
- package/bundle/{chunk-RXHIISMM.js → chunk-5S3XVXG6.js} +1 -1
- package/bundle/{chunk-R6Q6D3UA.js → chunk-A7EL6FWX.js} +1 -1
- package/bundle/{chunk-UEOEM4H5.js → chunk-AMALQQ3Z.js} +3 -3
- package/bundle/{chunk-EWEUWTBB.js → chunk-CBYMGCHX.js} +75 -60
- package/bundle/{chunk-2NCBQURB.js → chunk-CFKLEVXK.js} +1 -1
- package/bundle/{chunk-RC6VJ6FT.js → chunk-DGM2IXGQ.js} +1 -1
- package/bundle/{chunk-NTWFJ2RF.js → chunk-EUQCH4QF.js} +2 -2
- package/bundle/{chunk-KCB54UJ5.js → chunk-FLYR6TVJ.js} +9279 -16064
- package/bundle/{chunk-H4WLRV6U.js → chunk-FQCPUDNE.js} +2 -2
- package/bundle/{chunk-BVDTRESW.js → chunk-FSELSFI5.js} +1 -1
- package/bundle/{chunk-5VYF5TVF.js → chunk-G4FAHQEH.js} +2 -2
- package/bundle/{chunk-Z5RCAIV5.js → chunk-I5GYMICM.js} +7 -5
- package/bundle/{chunk-JEUVKR2X.js → chunk-IGVQSZBB.js} +3 -3
- package/bundle/{chunk-HBZBBLAV.js → chunk-JMQIN5UZ.js} +1521 -1323
- package/bundle/{chunk-KPPDDNGJ.js → chunk-JW5YA5WN.js} +9 -8
- package/bundle/chunk-KTIX6VY2.js +17446 -0
- package/bundle/{chunk-SNGNFODQ.js → chunk-KUSXLIPR.js} +1 -1
- package/bundle/{chunk-ZDQYLJYN.js → chunk-KVZWFEJY.js} +1 -1
- package/bundle/{chunk-2P4ETAEG.js → chunk-LTM347XQ.js} +1 -1
- package/bundle/chunk-LXT3NLFW.js +118 -0
- package/bundle/chunk-PAWJR2VY.js +1571 -0
- package/bundle/chunk-RVS5CHWO.js +425 -0
- package/bundle/{chunk-B2C7BQ4Z.js → chunk-RW6IRAFG.js} +11 -9
- package/bundle/{chunk-CTL6DZSY.js → chunk-U4667HKR.js} +1 -1
- package/bundle/chunk-WTO5SKFR.js +400730 -0
- package/bundle/chunk-WXSWGEUJ.js +512 -0
- package/bundle/chunk-XKSEOGBW.js +154 -0
- package/bundle/chunk-ZG5IQP2R.js +102953 -0
- package/bundle/{cleanup-EX2L3L3E.js → cleanup-I7CTORMX.js} +2 -2
- package/bundle/{cleanup-IT7XR7KS.js → cleanup-MOFJ6BES.js} +2 -2
- package/bundle/{cleanup-WWLYKZIX.js → cleanup-OAR3IBTA.js} +2 -2
- package/bundle/cleanup-WFLHSVPH.js +32 -0
- package/bundle/{core-GAJB2LOX.js → core-VXMTLS6K.js} +1 -1
- package/bundle/{devtoolsService-TJPENQSW.js → devtoolsService-4QAJJ6WJ.js} +2 -2
- package/bundle/{devtoolsService-S4ZTRGJL.js → devtoolsService-54XKSYYW.js} +4 -3
- package/bundle/{devtoolsService-4YTFHHPN.js → devtoolsService-L6BPP3IA.js} +2 -2
- package/bundle/devtoolsService-LSDQLZ62.js +4359 -0
- package/bundle/{dist-MTMOCTIW.js → dist-BNMP57Q5.js} +1 -1
- package/bundle/{core-D5D4MF5H.js → dist-FJ7DKGAM.js} +1 -1
- package/bundle/dist-U5DFAJ4Y.js +2250 -0
- package/bundle/docs/changelogs/preview.md +54 -65
- package/bundle/{gemini-5T5BS7L7.js → gemini-L553JD26.js} +66 -95
- package/bundle/{gemini-FHORRYHM.js → gemini-LN35PXGR.js} +66 -95
- package/bundle/gemini-VZOPAMKQ.js +17834 -0
- package/bundle/{gemini-UQRS6TBE.js → gemini-W63I3AHM.js} +266 -279
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-WOM6QZHM.js → interactiveCli-2JCDVYVC.js} +26 -23
- package/bundle/{interactiveCli-I5K7O5Z6.js → interactiveCli-KN6ETEWY.js} +26 -23
- package/bundle/{interactiveCli-5YNYZTMK.js → interactiveCli-N7HBJ434.js} +329 -307
- package/bundle/interactiveCli-TX7INBPE.js +34918 -0
- package/bundle/{liteRtServerManager-EH2L2UVH.js → liteRtServerManager-GIDPQRR4.js} +4 -4
- package/bundle/{liteRtServerManager-ZLIHBLZP.js → liteRtServerManager-NK3OA5CI.js} +4 -4
- package/bundle/{liteRtServerManager-3N5KI6YS.js → liteRtServerManager-NSDSBW7B.js} +4 -4
- package/bundle/liteRtServerManager-PKOODTU4.js +65 -0
- package/bundle/{oauth2-provider-TA2KRXWQ.js → oauth2-provider-DE3RVHTQ.js} +1 -1
- package/bundle/{oauth2-provider-5GFYTXFU.js → oauth2-provider-FDRYB63N.js} +38 -72
- package/bundle/{oauth2-provider-NGSH2JQK.js → oauth2-provider-KMACQ2PX.js} +1 -1
- package/bundle/oauth2-provider-UAZAD3AF.js +235 -0
- package/bundle/{start-M3IUNCYH.js → start-5X2H6QGN.js} +6 -6
- package/bundle/{start-MWDNIQUY.js → start-AMYT67DW.js} +6 -6
- package/bundle/{start-CWI6OP6N.js → start-QYGGE4KC.js} +6 -6
- package/bundle/start-WWUBZPNX.js +18 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ 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-AMALQQ3Z.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod,
|
|
48
48
|
validateContextFilePath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-33M6KTJD.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-LTM347XQ.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange,
|
|
90
90
|
stripAnsi
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-I5GYMICM.js";
|
|
92
92
|
import {
|
|
93
93
|
RELAUNCH_EXIT_CODE
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-RVS5CHWO.js";
|
|
95
|
+
import "./chunk-2AWGKUBT.js";
|
|
96
96
|
import {
|
|
97
97
|
cleanupCheckpoints,
|
|
98
98
|
registerCleanup,
|
|
@@ -101,12 +101,15 @@ import {
|
|
|
101
101
|
runExitCleanup,
|
|
102
102
|
runSyncCleanup,
|
|
103
103
|
setupSignalHandlers
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-XKSEOGBW.js";
|
|
105
105
|
import {
|
|
106
106
|
ASK_USER_TOOL_NAME,
|
|
107
|
+
ApprovalMode,
|
|
107
108
|
AuthType,
|
|
108
109
|
Client,
|
|
109
110
|
Config,
|
|
111
|
+
CoreEvent,
|
|
112
|
+
CoreToolCallStatus,
|
|
110
113
|
DEFAULT_CONTEXT_FILENAME,
|
|
111
114
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
112
115
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -128,19 +131,27 @@ import {
|
|
|
128
131
|
FolderTrustDiscoveryService,
|
|
129
132
|
GEMINI_DIR,
|
|
130
133
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
134
|
+
GeminiEventType,
|
|
131
135
|
IdeClient,
|
|
136
|
+
IntegrityStatus,
|
|
132
137
|
InvalidStreamError,
|
|
133
138
|
JsonFormatter,
|
|
139
|
+
JsonStreamEventType,
|
|
140
|
+
Kind,
|
|
134
141
|
LegacyAgentSession,
|
|
135
142
|
Logger,
|
|
136
143
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
137
144
|
MCPServerConfig,
|
|
145
|
+
MCPServerStatus,
|
|
146
|
+
MessageBusType,
|
|
138
147
|
OTHER_BLOCKED_MESSAGE,
|
|
148
|
+
OutputFormat,
|
|
139
149
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
140
150
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
141
151
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
142
152
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
143
153
|
PREVIEW_GEMINI_MODEL,
|
|
154
|
+
PolicyDecision,
|
|
144
155
|
PolicyIntegrityManager,
|
|
145
156
|
RECITATION_BLOCKED_MESSAGE,
|
|
146
157
|
REFERENCE_CONTENT_START,
|
|
@@ -148,6 +159,8 @@ import {
|
|
|
148
159
|
ReadManyFilesTool,
|
|
149
160
|
SAFETY_BLOCKED_MESSAGE,
|
|
150
161
|
Scheduler,
|
|
162
|
+
SessionEndReason,
|
|
163
|
+
SessionStartSource,
|
|
151
164
|
ShellExecutionService,
|
|
152
165
|
SimpleExtensionLoader,
|
|
153
166
|
Storage,
|
|
@@ -156,10 +169,13 @@ import {
|
|
|
156
169
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
157
170
|
ToolCallEvent,
|
|
158
171
|
ToolConfirmationOutcome,
|
|
172
|
+
ToolErrorType,
|
|
173
|
+
TrustLevel,
|
|
159
174
|
UserAccountManager,
|
|
160
175
|
UserPromptEvent,
|
|
161
176
|
ValidationCancelledError,
|
|
162
177
|
ValidationRequiredError,
|
|
178
|
+
WarningPriority,
|
|
163
179
|
applyAdminAllowlist,
|
|
164
180
|
applyRequiredServers,
|
|
165
181
|
clearCachedCredentialFile,
|
|
@@ -235,11 +251,12 @@ import {
|
|
|
235
251
|
shouldEnterAlternateScreen,
|
|
236
252
|
showMemory,
|
|
237
253
|
startupProfiler,
|
|
254
|
+
tokenLimit,
|
|
238
255
|
uiTelemetryService,
|
|
239
256
|
updatePolicy,
|
|
240
257
|
writeToStderr,
|
|
241
258
|
writeToStdout
|
|
242
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-WTO5SKFR.js";
|
|
243
260
|
import "./chunk-664ZODQF.js";
|
|
244
261
|
import "./chunk-IUUIT4SU.js";
|
|
245
262
|
import "./chunk-L6PII3GR.js";
|
|
@@ -5369,7 +5386,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5369
5386
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5370
5387
|
const isStdio = !!config.command;
|
|
5371
5388
|
if (isStdio && !isTrusted) {
|
|
5372
|
-
return
|
|
5389
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5373
5390
|
}
|
|
5374
5391
|
const client = new Client({
|
|
5375
5392
|
name: "mcp-test-client",
|
|
@@ -5405,7 +5422,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5405
5422
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5406
5423
|
} catch {
|
|
5407
5424
|
await client.close();
|
|
5408
|
-
return
|
|
5425
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5409
5426
|
}
|
|
5410
5427
|
try {
|
|
5411
5428
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5419,10 +5436,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5419
5436
|
);
|
|
5420
5437
|
}
|
|
5421
5438
|
await client.close();
|
|
5422
|
-
return
|
|
5439
|
+
return MCPServerStatus.CONNECTED;
|
|
5423
5440
|
} catch {
|
|
5424
5441
|
await transport.close();
|
|
5425
|
-
return
|
|
5442
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5426
5443
|
}
|
|
5427
5444
|
}
|
|
5428
5445
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5435,12 +5452,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5435
5452
|
});
|
|
5436
5453
|
if (!loadResult.allowed) {
|
|
5437
5454
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5438
|
-
return
|
|
5455
|
+
return MCPServerStatus.BLOCKED;
|
|
5439
5456
|
}
|
|
5440
|
-
return
|
|
5457
|
+
return MCPServerStatus.DISABLED;
|
|
5441
5458
|
}
|
|
5442
5459
|
if (!isTrusted) {
|
|
5443
|
-
return
|
|
5460
|
+
return MCPServerStatus.DISABLED;
|
|
5444
5461
|
}
|
|
5445
5462
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5446
5463
|
}
|
|
@@ -5486,23 +5503,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5486
5503
|
let statusIndicator = "";
|
|
5487
5504
|
let statusText = "";
|
|
5488
5505
|
switch (status) {
|
|
5489
|
-
case
|
|
5506
|
+
case MCPServerStatus.CONNECTED:
|
|
5490
5507
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5491
5508
|
statusText = "Connected";
|
|
5492
5509
|
break;
|
|
5493
|
-
case
|
|
5510
|
+
case MCPServerStatus.CONNECTING:
|
|
5494
5511
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5495
5512
|
statusText = "Connecting";
|
|
5496
5513
|
break;
|
|
5497
|
-
case
|
|
5514
|
+
case MCPServerStatus.BLOCKED:
|
|
5498
5515
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5499
5516
|
statusText = "Blocked";
|
|
5500
5517
|
break;
|
|
5501
|
-
case
|
|
5518
|
+
case MCPServerStatus.DISABLED:
|
|
5502
5519
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5503
5520
|
statusText = "Disabled";
|
|
5504
5521
|
break;
|
|
5505
|
-
case
|
|
5522
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5506
5523
|
default:
|
|
5507
5524
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5508
5525
|
statusText = "Disconnected";
|
|
@@ -5788,7 +5805,7 @@ async function handleInstall(args) {
|
|
|
5788
5805
|
);
|
|
5789
5806
|
if (confirmed) {
|
|
5790
5807
|
const trustedFolders = loadTrustedFolders();
|
|
5791
|
-
await trustedFolders.setValue(realPath,
|
|
5808
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5792
5809
|
} else {
|
|
5793
5810
|
throw new Error(
|
|
5794
5811
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7839,7 +7856,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7839
7856
|
}
|
|
7840
7857
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7841
7858
|
const packageJson = await getPackageJson(__dirname3);
|
|
7842
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
7859
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.64.0-nightly.20260929.gd75234cae" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7843
7860
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7844
7861
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7845
7862
|
}
|
|
@@ -7898,9 +7915,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7898
7915
|
cwd,
|
|
7899
7916
|
potentialWorkspacePoliciesDir
|
|
7900
7917
|
);
|
|
7901
|
-
if (integrityResult.status ===
|
|
7918
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7902
7919
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7903
|
-
} else if (integrityResult.status ===
|
|
7920
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7904
7921
|
workspacePoliciesDir = void 0;
|
|
7905
7922
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7906
7923
|
policyUpdateConfirmationRequest = {
|
|
@@ -8328,23 +8345,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8328
8345
|
if (rawApprovalMode) {
|
|
8329
8346
|
switch (rawApprovalMode) {
|
|
8330
8347
|
case "yolo":
|
|
8331
|
-
approvalMode =
|
|
8348
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8332
8349
|
break;
|
|
8333
8350
|
case "auto_edit":
|
|
8334
|
-
approvalMode =
|
|
8351
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8335
8352
|
break;
|
|
8336
8353
|
case "plan":
|
|
8337
8354
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8338
8355
|
debugLogger.warn(
|
|
8339
8356
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8340
8357
|
);
|
|
8341
|
-
approvalMode =
|
|
8358
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8342
8359
|
} else {
|
|
8343
|
-
approvalMode =
|
|
8360
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8344
8361
|
}
|
|
8345
8362
|
break;
|
|
8346
8363
|
case "default":
|
|
8347
|
-
approvalMode =
|
|
8364
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8348
8365
|
break;
|
|
8349
8366
|
default:
|
|
8350
8367
|
throw new Error(
|
|
@@ -8352,10 +8369,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8352
8369
|
);
|
|
8353
8370
|
}
|
|
8354
8371
|
} else {
|
|
8355
|
-
approvalMode =
|
|
8372
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8356
8373
|
}
|
|
8357
8374
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8358
|
-
if (approvalMode ===
|
|
8375
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8359
8376
|
if (settings.admin?.secureModeEnabled) {
|
|
8360
8377
|
debugLogger.error(
|
|
8361
8378
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8373,16 +8390,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8373
8390
|
)
|
|
8374
8391
|
);
|
|
8375
8392
|
}
|
|
8376
|
-
} else if (approvalMode ===
|
|
8393
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8377
8394
|
debugLogger.warn(
|
|
8378
8395
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8379
8396
|
);
|
|
8380
8397
|
}
|
|
8381
|
-
if (!trustedFolder && approvalMode !==
|
|
8398
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8382
8399
|
debugLogger.warn(
|
|
8383
8400
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8384
8401
|
);
|
|
8385
|
-
approvalMode =
|
|
8402
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8386
8403
|
}
|
|
8387
8404
|
let telemetrySettings;
|
|
8388
8405
|
try {
|
|
@@ -11083,7 +11100,7 @@ import path10 from "node:path";
|
|
|
11083
11100
|
import process4 from "node:process";
|
|
11084
11101
|
var homeDirectoryCheck = {
|
|
11085
11102
|
id: "home-directory",
|
|
11086
|
-
priority:
|
|
11103
|
+
priority: WarningPriority.Low,
|
|
11087
11104
|
check: async (workspaceRoot, settings) => {
|
|
11088
11105
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
11089
11106
|
return null;
|
|
@@ -11107,7 +11124,7 @@ var homeDirectoryCheck = {
|
|
|
11107
11124
|
};
|
|
11108
11125
|
var rootDirectoryCheck = {
|
|
11109
11126
|
id: "root-directory",
|
|
11110
|
-
priority:
|
|
11127
|
+
priority: WarningPriority.High,
|
|
11111
11128
|
check: async (workspaceRoot, _settings) => {
|
|
11112
11129
|
try {
|
|
11113
11130
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -11123,7 +11140,7 @@ var rootDirectoryCheck = {
|
|
|
11123
11140
|
};
|
|
11124
11141
|
var folderTrustCheck = {
|
|
11125
11142
|
id: "folder-trust",
|
|
11126
|
-
priority:
|
|
11143
|
+
priority: WarningPriority.High,
|
|
11127
11144
|
check: async (workspaceRoot, settings) => {
|
|
11128
11145
|
if (!isFolderTrustEnabled(settings)) {
|
|
11129
11146
|
return null;
|
|
@@ -11313,12 +11330,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
11313
11330
|
error,
|
|
11314
11331
|
config.getContentGeneratorConfig()?.authType
|
|
11315
11332
|
);
|
|
11316
|
-
if (config.getOutputFormat() ===
|
|
11333
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11317
11334
|
const streamFormatter = new StreamJsonFormatter();
|
|
11318
11335
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11319
11336
|
const metrics = uiTelemetryService.getMetrics();
|
|
11320
11337
|
streamFormatter.emitEvent({
|
|
11321
|
-
type:
|
|
11338
|
+
type: JsonStreamEventType.RESULT,
|
|
11322
11339
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11323
11340
|
status: "error",
|
|
11324
11341
|
error: {
|
|
@@ -11329,7 +11346,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
11329
11346
|
});
|
|
11330
11347
|
runSyncCleanup();
|
|
11331
11348
|
process.exit(getNumericExitCode(errorCode));
|
|
11332
|
-
} else if (config.getOutputFormat() ===
|
|
11349
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11333
11350
|
const formatter = new JsonFormatter();
|
|
11334
11351
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11335
11352
|
const formattedError = formatter.formatError(
|
|
@@ -11349,11 +11366,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11349
11366
|
const isFatal = isFatalToolError(errorType);
|
|
11350
11367
|
if (isFatal) {
|
|
11351
11368
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
11352
|
-
if (config.getOutputFormat() ===
|
|
11369
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11353
11370
|
const streamFormatter = new StreamJsonFormatter();
|
|
11354
11371
|
const metrics = uiTelemetryService.getMetrics();
|
|
11355
11372
|
streamFormatter.emitEvent({
|
|
11356
|
-
type:
|
|
11373
|
+
type: JsonStreamEventType.RESULT,
|
|
11357
11374
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11358
11375
|
status: "error",
|
|
11359
11376
|
error: {
|
|
@@ -11362,7 +11379,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11362
11379
|
},
|
|
11363
11380
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
11364
11381
|
});
|
|
11365
|
-
} else if (config.getOutputFormat() ===
|
|
11382
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11366
11383
|
const formatter = new JsonFormatter();
|
|
11367
11384
|
const formattedError = formatter.formatError(
|
|
11368
11385
|
toolExecutionError,
|
|
@@ -11380,11 +11397,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11380
11397
|
}
|
|
11381
11398
|
function handleCancellationError(config) {
|
|
11382
11399
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
11383
|
-
if (config.getOutputFormat() ===
|
|
11400
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11384
11401
|
const streamFormatter = new StreamJsonFormatter();
|
|
11385
11402
|
const metrics = uiTelemetryService.getMetrics();
|
|
11386
11403
|
streamFormatter.emitEvent({
|
|
11387
|
-
type:
|
|
11404
|
+
type: JsonStreamEventType.RESULT,
|
|
11388
11405
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11389
11406
|
status: "error",
|
|
11390
11407
|
error: {
|
|
@@ -11395,7 +11412,7 @@ function handleCancellationError(config) {
|
|
|
11395
11412
|
});
|
|
11396
11413
|
runSyncCleanup();
|
|
11397
11414
|
process.exit(cancellationError.exitCode);
|
|
11398
|
-
} else if (config.getOutputFormat() ===
|
|
11415
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11399
11416
|
const formatter = new JsonFormatter();
|
|
11400
11417
|
const formattedError = formatter.formatError(
|
|
11401
11418
|
cancellationError,
|
|
@@ -11415,11 +11432,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11415
11432
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11416
11433
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11417
11434
|
);
|
|
11418
|
-
if (config.getOutputFormat() ===
|
|
11435
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11419
11436
|
const streamFormatter = new StreamJsonFormatter();
|
|
11420
11437
|
const metrics = uiTelemetryService.getMetrics();
|
|
11421
11438
|
streamFormatter.emitEvent({
|
|
11422
|
-
type:
|
|
11439
|
+
type: JsonStreamEventType.RESULT,
|
|
11423
11440
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11424
11441
|
status: "error",
|
|
11425
11442
|
error: {
|
|
@@ -11430,7 +11447,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11430
11447
|
});
|
|
11431
11448
|
runSyncCleanup();
|
|
11432
11449
|
process.exit(maxTurnsError.exitCode);
|
|
11433
|
-
} else if (config.getOutputFormat() ===
|
|
11450
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11434
11451
|
const formatter = new JsonFormatter();
|
|
11435
11452
|
const formattedError = formatter.formatError(
|
|
11436
11453
|
maxTurnsError,
|
|
@@ -11510,7 +11527,7 @@ async function runNonInteractive({
|
|
|
11510
11527
|
}
|
|
11511
11528
|
});
|
|
11512
11529
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11513
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11530
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-4QAJJ6WJ.js");
|
|
11514
11531
|
setupInitialActivityLogger(config);
|
|
11515
11532
|
}
|
|
11516
11533
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11526,7 +11543,7 @@ async function runNonInteractive({
|
|
|
11526
11543
|
}
|
|
11527
11544
|
};
|
|
11528
11545
|
const startTime = Date.now();
|
|
11529
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11546
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
11530
11547
|
const abortController = new AbortController();
|
|
11531
11548
|
let isAborting = false;
|
|
11532
11549
|
let cancelMessageTimer = null;
|
|
@@ -11579,13 +11596,13 @@ async function runNonInteractive({
|
|
|
11579
11596
|
};
|
|
11580
11597
|
try {
|
|
11581
11598
|
consolePatcher.patch();
|
|
11582
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11599
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11583
11600
|
process.stderr.write(
|
|
11584
11601
|
"[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"
|
|
11585
11602
|
);
|
|
11586
11603
|
}
|
|
11587
11604
|
setupStdinCancellation();
|
|
11588
|
-
coreEvents.on(
|
|
11605
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11589
11606
|
coreEvents.drainBacklogs();
|
|
11590
11607
|
process.stdout.on("error", (err) => {
|
|
11591
11608
|
if (err.code === "EPIPE") {
|
|
@@ -11611,7 +11628,7 @@ async function runNonInteractive({
|
|
|
11611
11628
|
}
|
|
11612
11629
|
if (streamFormatter) {
|
|
11613
11630
|
streamFormatter.emitEvent({
|
|
11614
|
-
type:
|
|
11631
|
+
type: JsonStreamEventType.INIT,
|
|
11615
11632
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11616
11633
|
session_id: config.getSessionId(),
|
|
11617
11634
|
model: config.getModel()
|
|
@@ -11649,7 +11666,7 @@ async function runNonInteractive({
|
|
|
11649
11666
|
}
|
|
11650
11667
|
if (streamFormatter) {
|
|
11651
11668
|
streamFormatter.emitEvent({
|
|
11652
|
-
type:
|
|
11669
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11653
11670
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11654
11671
|
role: "user",
|
|
11655
11672
|
content: input
|
|
@@ -11688,12 +11705,12 @@ async function runNonInteractive({
|
|
|
11688
11705
|
const metrics = uiTelemetryService.getMetrics();
|
|
11689
11706
|
const durationMs = Date.now() - startTime;
|
|
11690
11707
|
streamFormatter.emitEvent({
|
|
11691
|
-
type:
|
|
11708
|
+
type: JsonStreamEventType.RESULT,
|
|
11692
11709
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11693
11710
|
status: errorPayload ? "error" : "success",
|
|
11694
11711
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11695
11712
|
});
|
|
11696
|
-
} else if (config.getOutputFormat() ===
|
|
11713
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11697
11714
|
const formatter = new JsonFormatter();
|
|
11698
11715
|
const stats = uiTelemetryService.getMetrics();
|
|
11699
11716
|
textOutput.write(
|
|
@@ -11786,13 +11803,13 @@ async function runNonInteractive({
|
|
|
11786
11803
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11787
11804
|
if (streamFormatter) {
|
|
11788
11805
|
streamFormatter.emitEvent({
|
|
11789
|
-
type:
|
|
11806
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11790
11807
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11791
11808
|
role: "assistant",
|
|
11792
11809
|
content: output,
|
|
11793
11810
|
delta: true
|
|
11794
11811
|
});
|
|
11795
|
-
} else if (config.getOutputFormat() ===
|
|
11812
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11796
11813
|
responseText += output;
|
|
11797
11814
|
} else {
|
|
11798
11815
|
if (part.text) {
|
|
@@ -11805,13 +11822,13 @@ async function runNonInteractive({
|
|
|
11805
11822
|
break;
|
|
11806
11823
|
}
|
|
11807
11824
|
case "tool_request": {
|
|
11808
|
-
if (config.getOutputFormat() ===
|
|
11825
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11809
11826
|
preToolResponseText = responseText || preToolResponseText;
|
|
11810
11827
|
responseText = "";
|
|
11811
11828
|
}
|
|
11812
11829
|
if (streamFormatter) {
|
|
11813
11830
|
streamFormatter.emitEvent({
|
|
11814
|
-
type:
|
|
11831
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
11815
11832
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11816
11833
|
tool_name: event.name,
|
|
11817
11834
|
tool_id: event.requestId,
|
|
@@ -11827,7 +11844,7 @@ async function runNonInteractive({
|
|
|
11827
11844
|
const displayText = displayContentToString(display);
|
|
11828
11845
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11829
11846
|
streamFormatter.emitEvent({
|
|
11830
|
-
type:
|
|
11847
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11831
11848
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11832
11849
|
tool_id: event.requestId,
|
|
11833
11850
|
status: event.isError ? "error" : "success",
|
|
@@ -11842,17 +11859,17 @@ async function runNonInteractive({
|
|
|
11842
11859
|
const display = event.display?.result;
|
|
11843
11860
|
const displayText = displayContentToString(display);
|
|
11844
11861
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11845
|
-
if (event.data?.["errorType"] ===
|
|
11846
|
-
if (config.getOutputFormat() ===
|
|
11862
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
11863
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
11847
11864
|
responseText = preToolResponseText;
|
|
11848
11865
|
}
|
|
11849
11866
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11850
|
-
if (config.getOutputFormat() ===
|
|
11867
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11851
11868
|
process.stderr.write(`${stopMessage}
|
|
11852
11869
|
`);
|
|
11853
11870
|
}
|
|
11854
11871
|
}
|
|
11855
|
-
if (event.data?.["errorType"] ===
|
|
11872
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
11856
11873
|
throw new FatalToolExecutionError(
|
|
11857
11874
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11858
11875
|
);
|
|
@@ -11887,12 +11904,12 @@ async function runNonInteractive({
|
|
|
11887
11904
|
}
|
|
11888
11905
|
if (streamFormatter) {
|
|
11889
11906
|
streamFormatter.emitEvent({
|
|
11890
|
-
type:
|
|
11907
|
+
type: JsonStreamEventType.ERROR,
|
|
11891
11908
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11892
11909
|
severity: "error",
|
|
11893
11910
|
message: errorMessage
|
|
11894
11911
|
});
|
|
11895
|
-
} else if (config.getOutputFormat() ===
|
|
11912
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11896
11913
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11897
11914
|
`);
|
|
11898
11915
|
}
|
|
@@ -11913,12 +11930,12 @@ async function runNonInteractive({
|
|
|
11913
11930
|
const errorCode = event._meta?.["code"];
|
|
11914
11931
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11915
11932
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11916
|
-
if (config.getOutputFormat() ===
|
|
11933
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11917
11934
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11918
11935
|
`);
|
|
11919
11936
|
} else if (streamFormatter) {
|
|
11920
11937
|
streamFormatter.emitEvent({
|
|
11921
|
-
type:
|
|
11938
|
+
type: JsonStreamEventType.ERROR,
|
|
11922
11939
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11923
11940
|
severity: "warning",
|
|
11924
11941
|
message: stripAnsi(blockMessage)
|
|
@@ -11928,13 +11945,13 @@ async function runNonInteractive({
|
|
|
11928
11945
|
break;
|
|
11929
11946
|
}
|
|
11930
11947
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11931
|
-
if (config.getOutputFormat() ===
|
|
11948
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11932
11949
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11933
11950
|
`);
|
|
11934
11951
|
}
|
|
11935
11952
|
if (streamFormatter) {
|
|
11936
11953
|
streamFormatter.emitEvent({
|
|
11937
|
-
type:
|
|
11954
|
+
type: JsonStreamEventType.ERROR,
|
|
11938
11955
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11939
11956
|
severity,
|
|
11940
11957
|
message: stripAnsi(event.message)
|
|
@@ -11954,7 +11971,7 @@ async function runNonInteractive({
|
|
|
11954
11971
|
);
|
|
11955
11972
|
} else if (streamFormatter) {
|
|
11956
11973
|
streamFormatter.emitEvent({
|
|
11957
|
-
type:
|
|
11974
|
+
type: JsonStreamEventType.ERROR,
|
|
11958
11975
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11959
11976
|
severity: "error",
|
|
11960
11977
|
message: "Maximum session turns exceeded"
|
|
@@ -11962,7 +11979,7 @@ async function runNonInteractive({
|
|
|
11962
11979
|
}
|
|
11963
11980
|
}
|
|
11964
11981
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11965
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11982
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11966
11983
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11967
11984
|
`);
|
|
11968
11985
|
}
|
|
@@ -11992,7 +12009,7 @@ async function runNonInteractive({
|
|
|
11992
12009
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11993
12010
|
scheduler?.dispose();
|
|
11994
12011
|
consolePatcher.cleanup();
|
|
11995
|
-
coreEvents.off(
|
|
12012
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11996
12013
|
}
|
|
11997
12014
|
if (errorToHandle) {
|
|
11998
12015
|
handleError(errorToHandle, config);
|
|
@@ -12020,7 +12037,7 @@ async function runNonInteractive2(params) {
|
|
|
12020
12037
|
}
|
|
12021
12038
|
});
|
|
12022
12039
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
12023
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
12040
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-4QAJJ6WJ.js");
|
|
12024
12041
|
setupInitialActivityLogger(config);
|
|
12025
12042
|
}
|
|
12026
12043
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -12036,7 +12053,7 @@ async function runNonInteractive2(params) {
|
|
|
12036
12053
|
}
|
|
12037
12054
|
};
|
|
12038
12055
|
const startTime = Date.now();
|
|
12039
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
12056
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
12040
12057
|
const abortController = new AbortController();
|
|
12041
12058
|
let isAborting = false;
|
|
12042
12059
|
let cancelMessageTimer = null;
|
|
@@ -12087,13 +12104,13 @@ async function runNonInteractive2(params) {
|
|
|
12087
12104
|
let scheduler;
|
|
12088
12105
|
try {
|
|
12089
12106
|
consolePatcher.patch();
|
|
12090
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
12107
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12091
12108
|
process.stderr.write(
|
|
12092
12109
|
"[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"
|
|
12093
12110
|
);
|
|
12094
12111
|
}
|
|
12095
12112
|
setupStdinCancellation();
|
|
12096
|
-
coreEvents.on(
|
|
12113
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
12097
12114
|
coreEvents.drainBacklogs();
|
|
12098
12115
|
process.stdout.on("error", (err) => {
|
|
12099
12116
|
if (err.code === "EPIPE") {
|
|
@@ -12117,7 +12134,7 @@ async function runNonInteractive2(params) {
|
|
|
12117
12134
|
}
|
|
12118
12135
|
if (streamFormatter) {
|
|
12119
12136
|
streamFormatter.emitEvent({
|
|
12120
|
-
type:
|
|
12137
|
+
type: JsonStreamEventType.INIT,
|
|
12121
12138
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12122
12139
|
session_id: config.getSessionId(),
|
|
12123
12140
|
model: config.getModel()
|
|
@@ -12155,7 +12172,7 @@ async function runNonInteractive2(params) {
|
|
|
12155
12172
|
}
|
|
12156
12173
|
if (streamFormatter) {
|
|
12157
12174
|
streamFormatter.emitEvent({
|
|
12158
|
-
type:
|
|
12175
|
+
type: JsonStreamEventType.MESSAGE,
|
|
12159
12176
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12160
12177
|
role: "user",
|
|
12161
12178
|
content: input
|
|
@@ -12183,28 +12200,28 @@ async function runNonInteractive2(params) {
|
|
|
12183
12200
|
if (abortController.signal.aborted) {
|
|
12184
12201
|
handleCancellationError(config);
|
|
12185
12202
|
}
|
|
12186
|
-
if (event.type ===
|
|
12203
|
+
if (event.type === GeminiEventType.Content) {
|
|
12187
12204
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
12188
12205
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
12189
12206
|
if (streamFormatter) {
|
|
12190
12207
|
streamFormatter.emitEvent({
|
|
12191
|
-
type:
|
|
12208
|
+
type: JsonStreamEventType.MESSAGE,
|
|
12192
12209
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12193
12210
|
role: "assistant",
|
|
12194
12211
|
content: output,
|
|
12195
12212
|
delta: true
|
|
12196
12213
|
});
|
|
12197
|
-
} else if (config.getOutputFormat() ===
|
|
12214
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12198
12215
|
responseText += output;
|
|
12199
12216
|
} else {
|
|
12200
12217
|
if (event.value) {
|
|
12201
12218
|
textOutput.write(output);
|
|
12202
12219
|
}
|
|
12203
12220
|
}
|
|
12204
|
-
} else if (event.type ===
|
|
12221
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
12205
12222
|
if (streamFormatter) {
|
|
12206
12223
|
streamFormatter.emitEvent({
|
|
12207
|
-
type:
|
|
12224
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
12208
12225
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12209
12226
|
tool_name: event.value.name,
|
|
12210
12227
|
tool_id: event.value.callId,
|
|
@@ -12212,33 +12229,33 @@ async function runNonInteractive2(params) {
|
|
|
12212
12229
|
});
|
|
12213
12230
|
}
|
|
12214
12231
|
toolCallRequests.push(event.value);
|
|
12215
|
-
} else if (event.type ===
|
|
12232
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
12216
12233
|
const message = "Loop detected, stopping execution";
|
|
12217
12234
|
if (streamFormatter) {
|
|
12218
12235
|
streamFormatter.emitEvent({
|
|
12219
|
-
type:
|
|
12236
|
+
type: JsonStreamEventType.ERROR,
|
|
12220
12237
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12221
12238
|
severity: "warning",
|
|
12222
12239
|
message
|
|
12223
12240
|
});
|
|
12224
12241
|
}
|
|
12225
12242
|
warnings.push(message);
|
|
12226
|
-
} else if (event.type ===
|
|
12243
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
12227
12244
|
const message = "Maximum session turns exceeded";
|
|
12228
12245
|
if (streamFormatter) {
|
|
12229
12246
|
streamFormatter.emitEvent({
|
|
12230
|
-
type:
|
|
12247
|
+
type: JsonStreamEventType.ERROR,
|
|
12231
12248
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12232
12249
|
severity: "error",
|
|
12233
12250
|
message
|
|
12234
12251
|
});
|
|
12235
12252
|
}
|
|
12236
12253
|
warnings.push(message);
|
|
12237
|
-
} else if (event.type ===
|
|
12254
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
12238
12255
|
throw event.value.error;
|
|
12239
|
-
} else if (event.type ===
|
|
12256
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
12240
12257
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12241
|
-
if (config.getOutputFormat() ===
|
|
12258
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12242
12259
|
process.stderr.write(`${stopMessage}
|
|
12243
12260
|
`);
|
|
12244
12261
|
}
|
|
@@ -12246,7 +12263,7 @@ async function runNonInteractive2(params) {
|
|
|
12246
12263
|
const metrics = uiTelemetryService.getMetrics();
|
|
12247
12264
|
const durationMs = Date.now() - startTime;
|
|
12248
12265
|
streamFormatter.emitEvent({
|
|
12249
|
-
type:
|
|
12266
|
+
type: JsonStreamEventType.RESULT,
|
|
12250
12267
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12251
12268
|
status: "success",
|
|
12252
12269
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12254,7 +12271,7 @@ async function runNonInteractive2(params) {
|
|
|
12254
12271
|
durationMs
|
|
12255
12272
|
)
|
|
12256
12273
|
});
|
|
12257
|
-
} else if (config.getOutputFormat() ===
|
|
12274
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12258
12275
|
const formatter = new JsonFormatter();
|
|
12259
12276
|
const stats = uiTelemetryService.getMetrics();
|
|
12260
12277
|
textOutput.write(
|
|
@@ -12270,21 +12287,21 @@ async function runNonInteractive2(params) {
|
|
|
12270
12287
|
textOutput.ensureTrailingNewline();
|
|
12271
12288
|
}
|
|
12272
12289
|
return;
|
|
12273
|
-
} else if (event.type ===
|
|
12290
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
12274
12291
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12275
|
-
if (config.getOutputFormat() ===
|
|
12292
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12276
12293
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
12277
12294
|
`);
|
|
12278
12295
|
} else if (streamFormatter) {
|
|
12279
12296
|
streamFormatter.emitEvent({
|
|
12280
|
-
type:
|
|
12297
|
+
type: JsonStreamEventType.ERROR,
|
|
12281
12298
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12282
12299
|
severity: "warning",
|
|
12283
12300
|
message: stripAnsi(blockMessage)
|
|
12284
12301
|
});
|
|
12285
12302
|
}
|
|
12286
12303
|
warnings.push(blockMessage);
|
|
12287
|
-
} else if (event.type ===
|
|
12304
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
12288
12305
|
const eventValue = event.value;
|
|
12289
12306
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
12290
12307
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -12307,12 +12324,12 @@ async function runNonInteractive2(params) {
|
|
|
12307
12324
|
);
|
|
12308
12325
|
if (streamFormatter) {
|
|
12309
12326
|
streamFormatter.emitEvent({
|
|
12310
|
-
type:
|
|
12327
|
+
type: JsonStreamEventType.ERROR,
|
|
12311
12328
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12312
12329
|
severity: "error",
|
|
12313
12330
|
message: invalidStreamError
|
|
12314
12331
|
});
|
|
12315
|
-
} else if (config.getOutputFormat() ===
|
|
12332
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12316
12333
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
12317
12334
|
`);
|
|
12318
12335
|
}
|
|
@@ -12332,7 +12349,7 @@ async function runNonInteractive2(params) {
|
|
|
12332
12349
|
const requestInfo = completedToolCall.request;
|
|
12333
12350
|
if (streamFormatter) {
|
|
12334
12351
|
streamFormatter.emitEvent({
|
|
12335
|
-
type:
|
|
12352
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
12336
12353
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12337
12354
|
tool_id: requestInfo.callId,
|
|
12338
12355
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -12366,11 +12383,11 @@ async function runNonInteractive2(params) {
|
|
|
12366
12383
|
);
|
|
12367
12384
|
}
|
|
12368
12385
|
const stopExecutionTool = completedToolCalls.find(
|
|
12369
|
-
(tc) => tc.response.errorType ===
|
|
12386
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
12370
12387
|
);
|
|
12371
12388
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
12372
12389
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
12373
|
-
if (config.getOutputFormat() ===
|
|
12390
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12374
12391
|
process.stderr.write(`${stopMessage}
|
|
12375
12392
|
`);
|
|
12376
12393
|
}
|
|
@@ -12378,7 +12395,7 @@ async function runNonInteractive2(params) {
|
|
|
12378
12395
|
const metrics = uiTelemetryService.getMetrics();
|
|
12379
12396
|
const durationMs = Date.now() - startTime;
|
|
12380
12397
|
streamFormatter.emitEvent({
|
|
12381
|
-
type:
|
|
12398
|
+
type: JsonStreamEventType.RESULT,
|
|
12382
12399
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12383
12400
|
status: "success",
|
|
12384
12401
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12386,7 +12403,7 @@ async function runNonInteractive2(params) {
|
|
|
12386
12403
|
durationMs
|
|
12387
12404
|
)
|
|
12388
12405
|
});
|
|
12389
|
-
} else if (config.getOutputFormat() ===
|
|
12406
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12390
12407
|
const formatter = new JsonFormatter();
|
|
12391
12408
|
const stats = uiTelemetryService.getMetrics();
|
|
12392
12409
|
textOutput.write(
|
|
@@ -12409,12 +12426,12 @@ async function runNonInteractive2(params) {
|
|
|
12409
12426
|
const metrics = uiTelemetryService.getMetrics();
|
|
12410
12427
|
const durationMs = Date.now() - startTime;
|
|
12411
12428
|
streamFormatter.emitEvent({
|
|
12412
|
-
type:
|
|
12429
|
+
type: JsonStreamEventType.RESULT,
|
|
12413
12430
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12414
12431
|
status: invalidStreamError ? "error" : "success",
|
|
12415
12432
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12416
12433
|
});
|
|
12417
|
-
} else if (config.getOutputFormat() ===
|
|
12434
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12418
12435
|
const formatter = new JsonFormatter();
|
|
12419
12436
|
const stats = uiTelemetryService.getMetrics();
|
|
12420
12437
|
textOutput.write(
|
|
@@ -12438,7 +12455,7 @@ async function runNonInteractive2(params) {
|
|
|
12438
12455
|
cleanupStdinCancellation();
|
|
12439
12456
|
scheduler?.dispose();
|
|
12440
12457
|
consolePatcher.cleanup();
|
|
12441
|
-
coreEvents.off(
|
|
12458
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
12442
12459
|
}
|
|
12443
12460
|
if (errorToHandle) {
|
|
12444
12461
|
handleError(errorToHandle, config);
|
|
@@ -14829,12 +14846,12 @@ function toToolCallContent(toolResult) {
|
|
|
14829
14846
|
}
|
|
14830
14847
|
var basicPermissionOptions = [
|
|
14831
14848
|
{
|
|
14832
|
-
optionId:
|
|
14849
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14833
14850
|
name: "Allow",
|
|
14834
14851
|
kind: "allow_once"
|
|
14835
14852
|
},
|
|
14836
14853
|
{
|
|
14837
|
-
optionId:
|
|
14854
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14838
14855
|
name: "Reject",
|
|
14839
14856
|
kind: "reject_once"
|
|
14840
14857
|
}
|
|
@@ -14846,13 +14863,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14846
14863
|
switch (confirmation.type) {
|
|
14847
14864
|
case "edit":
|
|
14848
14865
|
options.push({
|
|
14849
|
-
optionId:
|
|
14866
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14850
14867
|
name: "Allow for this session",
|
|
14851
14868
|
kind: "allow_always"
|
|
14852
14869
|
});
|
|
14853
14870
|
if (enablePermanentToolApproval) {
|
|
14854
14871
|
options.push({
|
|
14855
|
-
optionId:
|
|
14872
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14856
14873
|
name: "Allow for this file in all future sessions",
|
|
14857
14874
|
kind: "allow_always"
|
|
14858
14875
|
});
|
|
@@ -14860,13 +14877,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14860
14877
|
break;
|
|
14861
14878
|
case "exec":
|
|
14862
14879
|
options.push({
|
|
14863
|
-
optionId:
|
|
14880
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14864
14881
|
name: "Allow for this session",
|
|
14865
14882
|
kind: "allow_always"
|
|
14866
14883
|
});
|
|
14867
14884
|
if (enablePermanentToolApproval) {
|
|
14868
14885
|
options.push({
|
|
14869
|
-
optionId:
|
|
14886
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14870
14887
|
name: "Allow this command for all future sessions",
|
|
14871
14888
|
kind: "allow_always"
|
|
14872
14889
|
});
|
|
@@ -14875,19 +14892,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14875
14892
|
case "mcp":
|
|
14876
14893
|
options.push(
|
|
14877
14894
|
{
|
|
14878
|
-
optionId:
|
|
14895
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
14879
14896
|
name: "Allow all server tools for this session",
|
|
14880
14897
|
kind: "allow_always"
|
|
14881
14898
|
},
|
|
14882
14899
|
{
|
|
14883
|
-
optionId:
|
|
14900
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
14884
14901
|
name: "Allow tool for this session",
|
|
14885
14902
|
kind: "allow_always"
|
|
14886
14903
|
}
|
|
14887
14904
|
);
|
|
14888
14905
|
if (enablePermanentToolApproval) {
|
|
14889
14906
|
options.push({
|
|
14890
|
-
optionId:
|
|
14907
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14891
14908
|
name: "Allow tool for all future sessions",
|
|
14892
14909
|
kind: "allow_always"
|
|
14893
14910
|
});
|
|
@@ -14895,13 +14912,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14895
14912
|
break;
|
|
14896
14913
|
case "info":
|
|
14897
14914
|
options.push({
|
|
14898
|
-
optionId:
|
|
14915
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14899
14916
|
name: "Allow for this session",
|
|
14900
14917
|
kind: "allow_always"
|
|
14901
14918
|
});
|
|
14902
14919
|
if (enablePermanentToolApproval) {
|
|
14903
14920
|
options.push({
|
|
14904
|
-
optionId:
|
|
14921
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14905
14922
|
name: "Allow for all future sessions",
|
|
14906
14923
|
kind: "allow_always"
|
|
14907
14924
|
});
|
|
@@ -14933,21 +14950,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14933
14950
|
}
|
|
14934
14951
|
function toAcpToolKind(kind) {
|
|
14935
14952
|
switch (kind) {
|
|
14936
|
-
case
|
|
14937
|
-
case
|
|
14938
|
-
case
|
|
14939
|
-
case
|
|
14940
|
-
case
|
|
14941
|
-
case
|
|
14942
|
-
case
|
|
14943
|
-
case
|
|
14944
|
-
case
|
|
14945
|
-
case
|
|
14953
|
+
case Kind.Read:
|
|
14954
|
+
case Kind.Edit:
|
|
14955
|
+
case Kind.Execute:
|
|
14956
|
+
case Kind.Search:
|
|
14957
|
+
case Kind.Delete:
|
|
14958
|
+
case Kind.Move:
|
|
14959
|
+
case Kind.Think:
|
|
14960
|
+
case Kind.Fetch:
|
|
14961
|
+
case Kind.SwitchMode:
|
|
14962
|
+
case Kind.Other:
|
|
14946
14963
|
return kind;
|
|
14947
|
-
case
|
|
14964
|
+
case Kind.Agent:
|
|
14948
14965
|
return "think";
|
|
14949
|
-
case
|
|
14950
|
-
case
|
|
14966
|
+
case Kind.Plan:
|
|
14967
|
+
case Kind.Communicate:
|
|
14951
14968
|
default:
|
|
14952
14969
|
return "other";
|
|
14953
14970
|
}
|
|
@@ -14955,24 +14972,24 @@ function toAcpToolKind(kind) {
|
|
|
14955
14972
|
function buildAvailableModes(isPlanEnabled) {
|
|
14956
14973
|
const modes = [
|
|
14957
14974
|
{
|
|
14958
|
-
id:
|
|
14975
|
+
id: ApprovalMode.DEFAULT,
|
|
14959
14976
|
name: "Default",
|
|
14960
14977
|
description: "Prompts for approval"
|
|
14961
14978
|
},
|
|
14962
14979
|
{
|
|
14963
|
-
id:
|
|
14980
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
14964
14981
|
name: "Auto Edit",
|
|
14965
14982
|
description: "Auto-approves edit tools"
|
|
14966
14983
|
},
|
|
14967
14984
|
{
|
|
14968
|
-
id:
|
|
14985
|
+
id: ApprovalMode.YOLO,
|
|
14969
14986
|
name: "YOLO",
|
|
14970
14987
|
description: "Auto-approves all tools"
|
|
14971
14988
|
}
|
|
14972
14989
|
];
|
|
14973
14990
|
if (isPlanEnabled) {
|
|
14974
14991
|
modes.push({
|
|
14975
|
-
id:
|
|
14992
|
+
id: ApprovalMode.PLAN,
|
|
14976
14993
|
name: "Plan",
|
|
14977
14994
|
description: "Read-only mode"
|
|
14978
14995
|
});
|
|
@@ -14986,7 +15003,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14986
15003
|
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
14987
15004
|
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
14988
15005
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14989
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
15006
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
14990
15007
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14991
15008
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14992
15009
|
useGemini3_1: useGemini31,
|
|
@@ -15073,11 +15090,11 @@ var Session = class {
|
|
|
15073
15090
|
this.connection = connection;
|
|
15074
15091
|
this.settings = settings;
|
|
15075
15092
|
coreEvents.on(
|
|
15076
|
-
|
|
15093
|
+
CoreEvent.ApprovalModeChanged,
|
|
15077
15094
|
this.handleApprovalModeChanged
|
|
15078
15095
|
);
|
|
15079
15096
|
this.context.config.getMessageBus()?.subscribe(
|
|
15080
|
-
|
|
15097
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
15081
15098
|
this.handleToolConfirmationRequest,
|
|
15082
15099
|
{ signal: this.disposeController.signal }
|
|
15083
15100
|
);
|
|
@@ -15101,7 +15118,7 @@ var Session = class {
|
|
|
15101
15118
|
"Policy engine missing. Denying tool confirmation request."
|
|
15102
15119
|
);
|
|
15103
15120
|
await messageBus.publish({
|
|
15104
|
-
type:
|
|
15121
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15105
15122
|
correlationId: request.correlationId,
|
|
15106
15123
|
confirmed: false,
|
|
15107
15124
|
requiresUserConfirmation: false
|
|
@@ -15114,7 +15131,7 @@ var Session = class {
|
|
|
15114
15131
|
"Tool confirmation request missing tool name. Denying."
|
|
15115
15132
|
);
|
|
15116
15133
|
await messageBus.publish({
|
|
15117
|
-
type:
|
|
15134
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15118
15135
|
correlationId: request.correlationId,
|
|
15119
15136
|
confirmed: false,
|
|
15120
15137
|
requiresUserConfirmation: false
|
|
@@ -15127,7 +15144,7 @@ var Session = class {
|
|
|
15127
15144
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
15128
15145
|
);
|
|
15129
15146
|
await messageBus.publish({
|
|
15130
|
-
type:
|
|
15147
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15131
15148
|
correlationId: request.correlationId,
|
|
15132
15149
|
confirmed: false,
|
|
15133
15150
|
requiresUserConfirmation: false
|
|
@@ -15143,15 +15160,15 @@ var Session = class {
|
|
|
15143
15160
|
request.subagent
|
|
15144
15161
|
);
|
|
15145
15162
|
await messageBus.publish({
|
|
15146
|
-
type:
|
|
15163
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15147
15164
|
correlationId: request.correlationId,
|
|
15148
|
-
confirmed: result.decision ===
|
|
15149
|
-
requiresUserConfirmation: result.decision ===
|
|
15165
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
15166
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
15150
15167
|
});
|
|
15151
15168
|
} catch (error) {
|
|
15152
15169
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
15153
15170
|
await this.context.config.getMessageBus()?.publish({
|
|
15154
|
-
type:
|
|
15171
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15155
15172
|
correlationId: request.correlationId,
|
|
15156
15173
|
confirmed: false,
|
|
15157
15174
|
requiresUserConfirmation: false
|
|
@@ -15171,7 +15188,7 @@ var Session = class {
|
|
|
15171
15188
|
};
|
|
15172
15189
|
dispose() {
|
|
15173
15190
|
coreEvents.off(
|
|
15174
|
-
|
|
15191
|
+
CoreEvent.ApprovalModeChanged,
|
|
15175
15192
|
this.handleApprovalModeChanged
|
|
15176
15193
|
);
|
|
15177
15194
|
this.disposeController.abort();
|
|
@@ -15260,7 +15277,7 @@ ${thought.description}`;
|
|
|
15260
15277
|
await this.sendUpdate({
|
|
15261
15278
|
sessionUpdate: "tool_call",
|
|
15262
15279
|
toolCallId: toolCall.id,
|
|
15263
|
-
status: toolCall.status ===
|
|
15280
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
15264
15281
|
title: toolCall.displayName || toolCall.name,
|
|
15265
15282
|
content: toolCallContent,
|
|
15266
15283
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -15294,6 +15311,11 @@ ${thought.description}`;
|
|
|
15294
15311
|
if (handled) {
|
|
15295
15312
|
return {
|
|
15296
15313
|
stopReason: "end_turn",
|
|
15314
|
+
usage: {
|
|
15315
|
+
inputTokens: 0,
|
|
15316
|
+
outputTokens: 0,
|
|
15317
|
+
totalTokens: 0
|
|
15318
|
+
},
|
|
15297
15319
|
_meta: {
|
|
15298
15320
|
quota: {
|
|
15299
15321
|
token_count: { input_tokens: 0, output_tokens: 0 },
|
|
@@ -15305,33 +15327,43 @@ ${thought.description}`;
|
|
|
15305
15327
|
}
|
|
15306
15328
|
let totalInputTokens = 0;
|
|
15307
15329
|
let totalOutputTokens = 0;
|
|
15330
|
+
let totalCachedTokens = 0;
|
|
15331
|
+
let totalThoughtTokens = 0;
|
|
15308
15332
|
const modelUsageMap = /* @__PURE__ */ new Map();
|
|
15333
|
+
const buildPromptResponse = (stopReason) => ({
|
|
15334
|
+
stopReason,
|
|
15335
|
+
usage: {
|
|
15336
|
+
inputTokens: totalInputTokens,
|
|
15337
|
+
outputTokens: totalOutputTokens,
|
|
15338
|
+
cachedReadTokens: totalCachedTokens || void 0,
|
|
15339
|
+
thoughtTokens: totalThoughtTokens || void 0,
|
|
15340
|
+
totalTokens: totalInputTokens + totalOutputTokens
|
|
15341
|
+
},
|
|
15342
|
+
_meta: {
|
|
15343
|
+
quota: {
|
|
15344
|
+
token_count: {
|
|
15345
|
+
input_tokens: totalInputTokens,
|
|
15346
|
+
output_tokens: totalOutputTokens
|
|
15347
|
+
},
|
|
15348
|
+
model_usage: Array.from(modelUsageMap.entries()).map(
|
|
15349
|
+
([modelName, counts]) => ({
|
|
15350
|
+
model: modelName,
|
|
15351
|
+
token_count: {
|
|
15352
|
+
input_tokens: counts.input,
|
|
15353
|
+
output_tokens: counts.output
|
|
15354
|
+
}
|
|
15355
|
+
})
|
|
15356
|
+
)
|
|
15357
|
+
}
|
|
15358
|
+
}
|
|
15359
|
+
});
|
|
15309
15360
|
let currentParts = parts;
|
|
15310
15361
|
let turnCount = 0;
|
|
15311
15362
|
const maxTurns = this.context.config.getMaxSessionTurns();
|
|
15312
15363
|
while (true) {
|
|
15313
15364
|
turnCount++;
|
|
15314
15365
|
if (maxTurns >= 0 && turnCount > maxTurns) {
|
|
15315
|
-
return
|
|
15316
|
-
stopReason: "max_turn_requests",
|
|
15317
|
-
_meta: {
|
|
15318
|
-
quota: {
|
|
15319
|
-
token_count: {
|
|
15320
|
-
input_tokens: totalInputTokens,
|
|
15321
|
-
output_tokens: totalOutputTokens
|
|
15322
|
-
},
|
|
15323
|
-
model_usage: Array.from(modelUsageMap.entries()).map(
|
|
15324
|
-
([modelName, counts]) => ({
|
|
15325
|
-
model: modelName,
|
|
15326
|
-
token_count: {
|
|
15327
|
-
input_tokens: counts.input,
|
|
15328
|
-
output_tokens: counts.output
|
|
15329
|
-
}
|
|
15330
|
-
})
|
|
15331
|
-
)
|
|
15332
|
-
}
|
|
15333
|
-
}
|
|
15334
|
-
};
|
|
15366
|
+
return buildPromptResponse("max_turn_requests");
|
|
15335
15367
|
}
|
|
15336
15368
|
if (pendingSend.signal.aborted) {
|
|
15337
15369
|
return { stopReason: "cancelled" };
|
|
@@ -15341,6 +15373,8 @@ ${thought.description}`;
|
|
|
15341
15373
|
let turnModelId = this.context.config.getModel();
|
|
15342
15374
|
let turnInputTokens = 0;
|
|
15343
15375
|
let turnOutputTokens = 0;
|
|
15376
|
+
let turnCachedTokens = 0;
|
|
15377
|
+
let turnThoughtTokens = 0;
|
|
15344
15378
|
try {
|
|
15345
15379
|
const responseStream = this.context.geminiClient.sendMessageStream(
|
|
15346
15380
|
currentParts,
|
|
@@ -15352,7 +15386,7 @@ ${thought.description}`;
|
|
|
15352
15386
|
return { stopReason: "cancelled" };
|
|
15353
15387
|
}
|
|
15354
15388
|
switch (event.type) {
|
|
15355
|
-
case
|
|
15389
|
+
case GeminiEventType.Content: {
|
|
15356
15390
|
const content = {
|
|
15357
15391
|
type: "text",
|
|
15358
15392
|
text: event.value
|
|
@@ -15363,7 +15397,7 @@ ${thought.description}`;
|
|
|
15363
15397
|
});
|
|
15364
15398
|
break;
|
|
15365
15399
|
}
|
|
15366
|
-
case
|
|
15400
|
+
case GeminiEventType.Thought: {
|
|
15367
15401
|
const thoughtText = `**${event.value.subject}**
|
|
15368
15402
|
${event.value.description}`;
|
|
15369
15403
|
await this.sendUpdate({
|
|
@@ -15372,30 +15406,39 @@ ${event.value.description}`;
|
|
|
15372
15406
|
});
|
|
15373
15407
|
break;
|
|
15374
15408
|
}
|
|
15375
|
-
case
|
|
15409
|
+
case GeminiEventType.ToolCallRequest:
|
|
15376
15410
|
toolCallRequests.push(event.value);
|
|
15377
15411
|
break;
|
|
15378
|
-
case
|
|
15412
|
+
case GeminiEventType.Finished: {
|
|
15379
15413
|
const usage2 = event.value.usageMetadata;
|
|
15380
15414
|
if (usage2) {
|
|
15381
15415
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
15382
15416
|
turnOutputTokens = usage2.candidatesTokenCount ?? turnOutputTokens;
|
|
15417
|
+
turnCachedTokens = usage2.cachedContentTokenCount ?? turnCachedTokens;
|
|
15418
|
+
turnThoughtTokens = usage2.thoughtsTokenCount ?? turnThoughtTokens;
|
|
15419
|
+
await this.sendUpdate({
|
|
15420
|
+
sessionUpdate: "usage_update",
|
|
15421
|
+
used: turnInputTokens + turnOutputTokens,
|
|
15422
|
+
size: tokenLimit(
|
|
15423
|
+
turnModelId || this.context.config.getModel()
|
|
15424
|
+
)
|
|
15425
|
+
});
|
|
15383
15426
|
}
|
|
15384
15427
|
break;
|
|
15385
15428
|
}
|
|
15386
|
-
case
|
|
15429
|
+
case GeminiEventType.ModelInfo:
|
|
15387
15430
|
turnModelId = event.value;
|
|
15388
15431
|
break;
|
|
15389
|
-
case
|
|
15432
|
+
case GeminiEventType.MaxSessionTurns:
|
|
15390
15433
|
stopReason = "max_turn_requests";
|
|
15391
15434
|
break;
|
|
15392
|
-
case
|
|
15435
|
+
case GeminiEventType.LoopDetected:
|
|
15393
15436
|
stopReason = "max_turn_requests";
|
|
15394
15437
|
break;
|
|
15395
|
-
case
|
|
15438
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
15396
15439
|
stopReason = "max_tokens";
|
|
15397
15440
|
break;
|
|
15398
|
-
case
|
|
15441
|
+
case GeminiEventType.Error: {
|
|
15399
15442
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
15400
15443
|
event.value.error
|
|
15401
15444
|
);
|
|
@@ -15423,26 +15466,7 @@ ${event.value.description}`;
|
|
|
15423
15466
|
throw error;
|
|
15424
15467
|
}
|
|
15425
15468
|
if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL" || error.type === "MAX_TOKENS_EXCEEDED" || error.type === "SAFETY_BLOCKED" || error.type === "RECITATION_BLOCKED" || error.type === "OTHER_BLOCKED" || error.type === "THINKING_ONLY_RESPONSE")) {
|
|
15426
|
-
return
|
|
15427
|
-
stopReason: "end_turn",
|
|
15428
|
-
_meta: {
|
|
15429
|
-
quota: {
|
|
15430
|
-
token_count: {
|
|
15431
|
-
input_tokens: totalInputTokens,
|
|
15432
|
-
output_tokens: totalOutputTokens
|
|
15433
|
-
},
|
|
15434
|
-
model_usage: Array.from(modelUsageMap.entries()).map(
|
|
15435
|
-
([modelName, counts]) => ({
|
|
15436
|
-
model: modelName,
|
|
15437
|
-
token_count: {
|
|
15438
|
-
input_tokens: counts.input,
|
|
15439
|
-
output_tokens: counts.output
|
|
15440
|
-
}
|
|
15441
|
-
})
|
|
15442
|
-
)
|
|
15443
|
-
}
|
|
15444
|
-
}
|
|
15445
|
-
};
|
|
15469
|
+
return buildPromptResponse("end_turn");
|
|
15446
15470
|
}
|
|
15447
15471
|
throw new RequestError(
|
|
15448
15472
|
getErrorStatus(error) || 500,
|
|
@@ -15451,6 +15475,8 @@ ${event.value.description}`;
|
|
|
15451
15475
|
}
|
|
15452
15476
|
totalInputTokens += turnInputTokens;
|
|
15453
15477
|
totalOutputTokens += turnOutputTokens;
|
|
15478
|
+
totalCachedTokens += turnCachedTokens;
|
|
15479
|
+
totalThoughtTokens += turnThoughtTokens;
|
|
15454
15480
|
if (turnInputTokens > 0 || turnOutputTokens > 0) {
|
|
15455
15481
|
const existing = modelUsageMap.get(turnModelId) ?? {
|
|
15456
15482
|
input: 0,
|
|
@@ -15461,26 +15487,7 @@ ${event.value.description}`;
|
|
|
15461
15487
|
modelUsageMap.set(turnModelId, existing);
|
|
15462
15488
|
}
|
|
15463
15489
|
if (stopReason !== "end_turn") {
|
|
15464
|
-
return
|
|
15465
|
-
stopReason,
|
|
15466
|
-
_meta: {
|
|
15467
|
-
quota: {
|
|
15468
|
-
token_count: {
|
|
15469
|
-
input_tokens: totalInputTokens,
|
|
15470
|
-
output_tokens: totalOutputTokens
|
|
15471
|
-
},
|
|
15472
|
-
model_usage: Array.from(modelUsageMap.entries()).map(
|
|
15473
|
-
([modelName, counts]) => ({
|
|
15474
|
-
model: modelName,
|
|
15475
|
-
token_count: {
|
|
15476
|
-
input_tokens: counts.input,
|
|
15477
|
-
output_tokens: counts.output
|
|
15478
|
-
}
|
|
15479
|
-
})
|
|
15480
|
-
)
|
|
15481
|
-
}
|
|
15482
|
-
}
|
|
15483
|
-
};
|
|
15490
|
+
return buildPromptResponse(stopReason);
|
|
15484
15491
|
}
|
|
15485
15492
|
if (toolCallRequests.length === 0) {
|
|
15486
15493
|
break;
|
|
@@ -15497,27 +15504,7 @@ ${event.value.description}`;
|
|
|
15497
15504
|
}
|
|
15498
15505
|
currentParts = toolResponseParts;
|
|
15499
15506
|
}
|
|
15500
|
-
|
|
15501
|
-
([modelName, counts]) => ({
|
|
15502
|
-
model: modelName,
|
|
15503
|
-
token_count: {
|
|
15504
|
-
input_tokens: counts.input,
|
|
15505
|
-
output_tokens: counts.output
|
|
15506
|
-
}
|
|
15507
|
-
})
|
|
15508
|
-
);
|
|
15509
|
-
return {
|
|
15510
|
-
stopReason: "end_turn",
|
|
15511
|
-
_meta: {
|
|
15512
|
-
quota: {
|
|
15513
|
-
token_count: {
|
|
15514
|
-
input_tokens: totalInputTokens,
|
|
15515
|
-
output_tokens: totalOutputTokens
|
|
15516
|
-
},
|
|
15517
|
-
model_usage: modelUsageArray
|
|
15518
|
-
}
|
|
15519
|
-
}
|
|
15520
|
-
};
|
|
15507
|
+
return buildPromptResponse("end_turn");
|
|
15521
15508
|
}
|
|
15522
15509
|
async handleCommand(commandText, parts) {
|
|
15523
15510
|
const gitService = await this.context.config.getGitService();
|
|
@@ -15632,7 +15619,7 @@ ${event.value.description}`;
|
|
|
15632
15619
|
const output = RequestPermissionResponseSchema.parse(
|
|
15633
15620
|
await this.connection.requestPermission(params)
|
|
15634
15621
|
);
|
|
15635
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15622
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15636
15623
|
await confirmationDetails.onConfirm(outcome);
|
|
15637
15624
|
await updatePolicy(
|
|
15638
15625
|
tool,
|
|
@@ -15643,7 +15630,7 @@ ${event.value.description}`;
|
|
|
15643
15630
|
invocation
|
|
15644
15631
|
);
|
|
15645
15632
|
switch (outcome) {
|
|
15646
|
-
case
|
|
15633
|
+
case ToolConfirmationOutcome.Cancel: {
|
|
15647
15634
|
const cancelError = new Error(
|
|
15648
15635
|
`Tool "${fc.name}" was canceled by the user.`
|
|
15649
15636
|
);
|
|
@@ -15661,12 +15648,12 @@ ${event.value.description}`;
|
|
|
15661
15648
|
});
|
|
15662
15649
|
return errorResponse(cancelError);
|
|
15663
15650
|
}
|
|
15664
|
-
case
|
|
15665
|
-
case
|
|
15666
|
-
case
|
|
15667
|
-
case
|
|
15668
|
-
case
|
|
15669
|
-
case
|
|
15651
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
15652
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
15653
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
15654
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
15655
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
15656
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
15670
15657
|
break;
|
|
15671
15658
|
default: {
|
|
15672
15659
|
const resultOutcome = outcome;
|
|
@@ -15720,7 +15707,7 @@ ${event.value.description}`;
|
|
|
15720
15707
|
);
|
|
15721
15708
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15722
15709
|
{
|
|
15723
|
-
status:
|
|
15710
|
+
status: CoreToolCallStatus.Success,
|
|
15724
15711
|
request: {
|
|
15725
15712
|
callId,
|
|
15726
15713
|
name: fc.name,
|
|
@@ -15765,7 +15752,7 @@ ${event.value.description}`;
|
|
|
15765
15752
|
});
|
|
15766
15753
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15767
15754
|
{
|
|
15768
|
-
status:
|
|
15755
|
+
status: CoreToolCallStatus.Error,
|
|
15769
15756
|
request: {
|
|
15770
15757
|
callId,
|
|
15771
15758
|
name: fc.name,
|
|
@@ -15893,12 +15880,12 @@ ${event.value.description}`;
|
|
|
15893
15880
|
sessionId: this.id,
|
|
15894
15881
|
options: [
|
|
15895
15882
|
{
|
|
15896
|
-
optionId:
|
|
15883
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
15897
15884
|
name: "Allow once",
|
|
15898
15885
|
kind: "allow_once"
|
|
15899
15886
|
},
|
|
15900
15887
|
{
|
|
15901
|
-
optionId:
|
|
15888
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
15902
15889
|
name: "Deny",
|
|
15903
15890
|
kind: "reject_once"
|
|
15904
15891
|
}
|
|
@@ -15923,8 +15910,8 @@ ${event.value.description}`;
|
|
|
15923
15910
|
const output = RequestPermissionResponseSchema.parse(
|
|
15924
15911
|
await this.connection.requestPermission(params)
|
|
15925
15912
|
);
|
|
15926
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15927
|
-
if (outcome ===
|
|
15913
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15914
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
15928
15915
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15929
15916
|
validationError = null;
|
|
15930
15917
|
} else {
|
|
@@ -16362,7 +16349,7 @@ var AcpSessionManager = class {
|
|
|
16362
16349
|
mcpServers,
|
|
16363
16350
|
loadedSettings
|
|
16364
16351
|
);
|
|
16365
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16352
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
16366
16353
|
let isAuthenticated = false;
|
|
16367
16354
|
let authErrorMessage = "";
|
|
16368
16355
|
try {
|
|
@@ -16374,7 +16361,7 @@ var AcpSessionManager = class {
|
|
|
16374
16361
|
);
|
|
16375
16362
|
isAuthenticated = true;
|
|
16376
16363
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
16377
|
-
if (authType ===
|
|
16364
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
16378
16365
|
isAuthenticated = false;
|
|
16379
16366
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
16380
16367
|
}
|
|
@@ -16486,7 +16473,7 @@ var AcpSessionManager = class {
|
|
|
16486
16473
|
return response;
|
|
16487
16474
|
}
|
|
16488
16475
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16489
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16476
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
16490
16477
|
if (!selectedAuthType) {
|
|
16491
16478
|
throw RequestError.authRequired();
|
|
16492
16479
|
}
|
|
@@ -16584,12 +16571,12 @@ var GeminiAgent = class {
|
|
|
16584
16571
|
}
|
|
16585
16572
|
const authMethods = [
|
|
16586
16573
|
{
|
|
16587
|
-
id:
|
|
16574
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
16588
16575
|
name: "Log in with Google",
|
|
16589
16576
|
description: "Log in with your Google account"
|
|
16590
16577
|
},
|
|
16591
16578
|
{
|
|
16592
|
-
id:
|
|
16579
|
+
id: AuthType.USE_GEMINI,
|
|
16593
16580
|
name: "Gemini API key",
|
|
16594
16581
|
description: "Use an API key with Gemini Developer API",
|
|
16595
16582
|
_meta: {
|
|
@@ -16599,12 +16586,12 @@ var GeminiAgent = class {
|
|
|
16599
16586
|
}
|
|
16600
16587
|
},
|
|
16601
16588
|
{
|
|
16602
|
-
id:
|
|
16589
|
+
id: AuthType.USE_VERTEX_AI,
|
|
16603
16590
|
name: "Vertex AI",
|
|
16604
16591
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16605
16592
|
},
|
|
16606
16593
|
{
|
|
16607
|
-
id:
|
|
16594
|
+
id: AuthType.GATEWAY,
|
|
16608
16595
|
name: "AI API Gateway",
|
|
16609
16596
|
description: "Use a custom AI API Gateway",
|
|
16610
16597
|
_meta: {
|
|
@@ -16777,7 +16764,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16777
16764
|
}
|
|
16778
16765
|
return authType;
|
|
16779
16766
|
} catch (error) {
|
|
16780
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16767
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
16781
16768
|
handleError(
|
|
16782
16769
|
error instanceof Error ? error : new Error(String(error)),
|
|
16783
16770
|
nonInteractiveConfig,
|
|
@@ -16972,10 +16959,10 @@ var SlashCommandConflictHandler = class {
|
|
|
16972
16959
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
16973
16960
|
}
|
|
16974
16961
|
start() {
|
|
16975
|
-
coreEvents.on(
|
|
16962
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
16976
16963
|
}
|
|
16977
16964
|
stop() {
|
|
16978
|
-
coreEvents.off(
|
|
16965
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
16979
16966
|
if (this.flushTimeout) {
|
|
16980
16967
|
clearTimeout(this.flushTimeout);
|
|
16981
16968
|
this.flushTimeout = null;
|
|
@@ -17331,7 +17318,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
17331
17318
|
}
|
|
17332
17319
|
}
|
|
17333
17320
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
17334
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
17321
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-KN6ETEWY.js");
|
|
17335
17322
|
await doStartUI(
|
|
17336
17323
|
config,
|
|
17337
17324
|
settings,
|
|
@@ -17434,12 +17421,12 @@ async function main() {
|
|
|
17434
17421
|
dns.setDefaultResultOrder(
|
|
17435
17422
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
17436
17423
|
);
|
|
17437
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
17424
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
17438
17425
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
17439
17426
|
settings.setValue(
|
|
17440
17427
|
"User" /* User */,
|
|
17441
17428
|
"security.auth.selectedType",
|
|
17442
|
-
|
|
17429
|
+
AuthType.COMPUTE_ADC
|
|
17443
17430
|
);
|
|
17444
17431
|
}
|
|
17445
17432
|
}
|
|
@@ -17540,7 +17527,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17540
17527
|
await config.storage.initialize();
|
|
17541
17528
|
adminControlsListner.setConfig(config);
|
|
17542
17529
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17543
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17530
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-4QAJJ6WJ.js");
|
|
17544
17531
|
setupInitialActivityLogger(config);
|
|
17545
17532
|
}
|
|
17546
17533
|
registerTelemetryConfig(config);
|
|
@@ -17548,7 +17535,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17548
17535
|
const messageBus = config.getMessageBus();
|
|
17549
17536
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17550
17537
|
registerCleanup(async () => {
|
|
17551
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17538
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
17552
17539
|
});
|
|
17553
17540
|
if (!config.getAcpMode()) {
|
|
17554
17541
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17599,7 +17586,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17599
17586
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17600
17587
|
const initializationResult = await initializeApp(config, settings);
|
|
17601
17588
|
initAppHandle?.end();
|
|
17602
|
-
import("./liteRtServerManager-
|
|
17589
|
+
import("./liteRtServerManager-GIDPQRR4.js").then(({ LiteRtServerManager }) => {
|
|
17603
17590
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17604
17591
|
if (!mergedGemma) return;
|
|
17605
17592
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17609,7 +17596,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17609
17596
|
autoStartServer: userGemma?.autoStartServer
|
|
17610
17597
|
});
|
|
17611
17598
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17612
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17599
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
17613
17600
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17614
17601
|
}
|
|
17615
17602
|
if (config.getAcpMode()) {
|
|
@@ -17625,7 +17612,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17625
17612
|
...rawStartupWarnings.map((message) => ({
|
|
17626
17613
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17627
17614
|
message,
|
|
17628
|
-
priority:
|
|
17615
|
+
priority: WarningPriority.High
|
|
17629
17616
|
})),
|
|
17630
17617
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17631
17618
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17662,7 +17649,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17662
17649
|
${input}` : stdinData;
|
|
17663
17650
|
}
|
|
17664
17651
|
}
|
|
17665
|
-
const sessionStartSource = resumedSessionData ?
|
|
17652
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
17666
17653
|
const hookSystem = config?.getHookSystem();
|
|
17667
17654
|
if (hookSystem) {
|
|
17668
17655
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17719,8 +17706,8 @@ ${input}` : wrappedContext;
|
|
|
17719
17706
|
}
|
|
17720
17707
|
}
|
|
17721
17708
|
function initializeOutputListenersAndFlush(config) {
|
|
17722
|
-
if (coreEvents.listenerCount(
|
|
17723
|
-
coreEvents.on(
|
|
17709
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
17710
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
17724
17711
|
if (payload.isStderr) {
|
|
17725
17712
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17726
17713
|
} else {
|
|
@@ -17728,8 +17715,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17728
17715
|
}
|
|
17729
17716
|
});
|
|
17730
17717
|
}
|
|
17731
|
-
if (coreEvents.listenerCount(
|
|
17732
|
-
coreEvents.on(
|
|
17718
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
17719
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
17733
17720
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17734
17721
|
writeToStderr(payload.content + "\n");
|
|
17735
17722
|
} else {
|
|
@@ -17737,8 +17724,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17737
17724
|
}
|
|
17738
17725
|
});
|
|
17739
17726
|
}
|
|
17740
|
-
if (coreEvents.listenerCount(
|
|
17741
|
-
coreEvents.on(
|
|
17727
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
17728
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
17742
17729
|
writeToStderr(payload.message + "\n");
|
|
17743
17730
|
});
|
|
17744
17731
|
}
|
|
@@ -17746,7 +17733,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17746
17733
|
const forceToStderr = outputFormat === "json";
|
|
17747
17734
|
coreEvents.drainBacklogs(
|
|
17748
17735
|
(event, args) => {
|
|
17749
|
-
if (forceToStderr && event ===
|
|
17736
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
17750
17737
|
const payload = args[0];
|
|
17751
17738
|
if (!payload.isStderr) {
|
|
17752
17739
|
return {
|