@google/gemini-cli 0.67.0-nightly.20261104.g89e9d25d6 → 0.67.0
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/README.md +24 -18
- package/bundle/{chunk-TAYMSEDM.js → chunk-2E3ETS5J.js} +2 -2
- package/bundle/{chunk-2VRD7O3N.js → chunk-4JH2G4F4.js} +3 -3
- package/bundle/{chunk-AT7K3IZG.js → chunk-56IGTM4O.js} +1 -1
- package/bundle/{chunk-B2FKXXUH.js → chunk-5RNHNFYV.js} +106 -327
- package/bundle/{chunk-R7UEKGMB.js → chunk-7LX6MRZ6.js} +1 -1
- package/bundle/{chunk-HU3K5KGK.js → chunk-BW65QRZA.js} +11 -9
- package/bundle/{chunk-5WHCLVFH.js → chunk-CJFBYU4J.js} +157 -391
- package/bundle/{chunk-NMKJ47HQ.js → chunk-GBUWHRK6.js} +3 -3
- package/bundle/{chunk-VBHMFLBY.js → chunk-IDJ4QXBF.js} +1 -1
- package/bundle/{chunk-JMHCFAD6.js → chunk-IGE3G3WZ.js} +1 -1
- package/bundle/{chunk-RCF66HCI.js → chunk-LAR4JEC7.js} +1008 -1627
- package/bundle/{chunk-CXMHAFLN.js → chunk-M73CYIV5.js} +2 -2
- package/bundle/{chunk-TB5I5645.js → chunk-MQNW2IRI.js} +2 -2
- package/bundle/{chunk-DKKEYKSG.js → chunk-NGQU3QTQ.js} +996 -1558
- package/bundle/{chunk-VLYI5NP4.js → chunk-O7MGOE2I.js} +16023 -9466
- package/bundle/{chunk-RD2EMHV2.js → chunk-OJ62HCXG.js} +1 -1
- package/bundle/{chunk-HRM7UWGB.js → chunk-P62CI7AR.js} +11 -9
- package/bundle/{chunk-H3WGFU7D.js → chunk-PUNFASKY.js} +1 -1
- package/bundle/{chunk-L77QEOSK.js → chunk-QA5FT4VY.js} +3 -3
- package/bundle/{chunk-WY3X2UP2.js → chunk-QTXJG3I3.js} +8 -9
- package/bundle/{chunk-XBEZPOEF.js → chunk-VK766A3F.js} +1 -1
- package/bundle/{chunk-3DAQUNXR.js → chunk-VO6PFWLY.js} +15 -15
- package/bundle/{chunk-ILNZCTNC.js → chunk-XETHQLRU.js} +106 -327
- package/bundle/{chunk-7SSKD5HN.js → chunk-YUO7RUF4.js} +1 -1
- package/bundle/{cleanup-3ALSKRBJ.js → cleanup-B6AOSVD4.js} +2 -2
- package/bundle/{cleanup-6DVNSRQY.js → cleanup-BRFB47DL.js} +2 -2
- package/bundle/{cleanup-HRNPECKR.js → cleanup-S5QFYCEP.js} +2 -2
- package/bundle/{core-NQRKBS47.js → core-GTUUQBGE.js} +1 -3
- package/bundle/{dist-QYTQZ6QW.js → core-N27LU4DK.js} +1 -3
- package/bundle/{devtoolsService-EWNQDTC7.js → devtoolsService-6V46WMXX.js} +2 -2
- package/bundle/{devtoolsService-64TPRUWQ.js → devtoolsService-E74ZMDMM.js} +2 -2
- package/bundle/{devtoolsService-E6I4WSAL.js → devtoolsService-EFJXZRFD.js} +3 -4
- package/bundle/{dist-L5NYU7FF.js → dist-E6RCLXQU.js} +1 -3
- package/bundle/docs/changelogs/index.md +0 -24
- package/bundle/docs/changelogs/latest.md +90 -83
- package/bundle/docs/changelogs/preview.md +87 -89
- package/bundle/docs/cli/sandbox.md +2 -8
- package/bundle/docs/cli/themes.md +3 -6
- package/bundle/docs/extensions/releasing.md +0 -32
- package/bundle/docs/reference/configuration.md +10 -2
- package/bundle/{gemini-YFCTZ76S.js → gemini-4JPKPLQN.js} +24 -122
- package/bundle/{gemini-QAVNR7N4.js → gemini-QWDTSJTS.js} +209 -323
- package/bundle/{gemini-7USJ6MGR.js → gemini-VF5FS3OM.js} +24 -122
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-X54KN2EM.js → interactiveCli-F2YYMYTP.js} +1145 -1350
- package/bundle/{interactiveCli-XN43CGES.js → interactiveCli-FQ3YKGOG.js} +1428 -1652
- package/bundle/{interactiveCli-3VTQP4GH.js → interactiveCli-QJZZISQQ.js} +1145 -1350
- package/bundle/{liteRtServerManager-E4PDEWY3.js → liteRtServerManager-27R2M6XE.js} +4 -4
- package/bundle/{liteRtServerManager-ENSSU4TN.js → liteRtServerManager-JAV3GR4V.js} +4 -4
- package/bundle/{liteRtServerManager-FLPMMDNM.js → liteRtServerManager-X5CCMKM6.js} +4 -4
- package/bundle/{oauth2-provider-3MJNDLJF.js → oauth2-provider-6UCP23AQ.js} +1 -1
- package/bundle/{oauth2-provider-VMBYZOC7.js → oauth2-provider-C65IJMNQ.js} +1 -1
- package/bundle/{oauth2-provider-ZIZQIT7D.js → oauth2-provider-H2KV36NU.js} +79 -41
- package/bundle/{start-B63MUWDV.js → start-E4ZL44QM.js} +6 -6
- package/bundle/{start-DFHM4HI4.js → start-GNOA75NQ.js} +6 -6
- package/bundle/{start-OHBUJSIL.js → start-K2AYYNST.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-674DJGDU.js +0 -512
- package/bundle/chunk-M4REEHDQ.js +0 -185
- package/bundle/chunk-NOMIJA6W.js +0 -1956
- package/bundle/chunk-ORXIIXSA.js +0 -80453
- package/bundle/chunk-Q3OUSMTD.js +0 -39405
- package/bundle/chunk-Q76ZDILI.js +0 -118
- package/bundle/chunk-T6YNV33L.js +0 -1571
- package/bundle/chunk-YTSRA7S6.js +0 -403181
- package/bundle/cleanup-OQV2G5Y3.js +0 -34
- package/bundle/devtoolsService-PG47POWV.js +0 -4422
- package/bundle/dist-LJVRZOCO.js +0 -2298
- package/bundle/gemini-QVVNPYKF.js +0 -19271
- package/bundle/interactiveCli-ELN2VGHK.js +0 -35871
- package/bundle/liteRtServerManager-TYCQMNCE.js +0 -65
- package/bundle/oauth2-provider-NLSE3P5W.js +0 -273
- package/bundle/start-V3EP7MBL.js +0 -18
|
@@ -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-QA5FT4VY.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
updateExtension,
|
|
46
46
|
validateAuthMethod,
|
|
47
47
|
validateContextFilePath
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-CJFBYU4J.js";
|
|
49
49
|
import {
|
|
50
50
|
exitCli,
|
|
51
51
|
require_source
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-IGE3G3WZ.js";
|
|
53
53
|
import {
|
|
54
54
|
appEvents
|
|
55
55
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -89,12 +89,12 @@ import {
|
|
|
89
89
|
saveModelChange,
|
|
90
90
|
setAmbiguousCharactersWide,
|
|
91
91
|
stripAnsi
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-P62CI7AR.js";
|
|
93
93
|
import {
|
|
94
94
|
RELAUNCH_EXIT_CODE,
|
|
95
95
|
require_semver
|
|
96
|
-
} from "./chunk-
|
|
97
|
-
import "./chunk-
|
|
96
|
+
} from "./chunk-M73CYIV5.js";
|
|
97
|
+
import "./chunk-QTXJG3I3.js";
|
|
98
98
|
import {
|
|
99
99
|
cleanupCheckpoints,
|
|
100
100
|
registerCleanup,
|
|
@@ -103,18 +103,15 @@ import {
|
|
|
103
103
|
runExitCleanup,
|
|
104
104
|
runSyncCleanup,
|
|
105
105
|
setupSignalHandlers
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-OJ62HCXG.js";
|
|
107
107
|
import {
|
|
108
108
|
ASK_USER_TOOL_NAME,
|
|
109
109
|
AjvJsonSchemaValidator,
|
|
110
|
-
ApprovalMode,
|
|
111
110
|
AuthType,
|
|
112
111
|
CallToolRequestSchema,
|
|
113
112
|
CallToolResultSchema,
|
|
114
113
|
Client,
|
|
115
114
|
Config,
|
|
116
|
-
CoreEvent,
|
|
117
|
-
CoreToolCallStatus,
|
|
118
115
|
CreateMessageResultSchema,
|
|
119
116
|
DEFAULT_CONTEXT_FILENAME,
|
|
120
117
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
@@ -141,7 +138,6 @@ import {
|
|
|
141
138
|
FolderTrustDiscoveryService,
|
|
142
139
|
GEMINI_DIR,
|
|
143
140
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
144
|
-
GeminiEventType,
|
|
145
141
|
IdeClient,
|
|
146
142
|
IdeContextNotificationSchema,
|
|
147
143
|
IdeDiffAcceptedNotificationSchema,
|
|
@@ -149,11 +145,8 @@ import {
|
|
|
149
145
|
IdeDiffRejectedNotificationSchema,
|
|
150
146
|
InitializeRequestSchema,
|
|
151
147
|
InitializedNotificationSchema,
|
|
152
|
-
IntegrityStatus,
|
|
153
148
|
InvalidStreamError,
|
|
154
149
|
JsonFormatter,
|
|
155
|
-
JsonStreamEventType,
|
|
156
|
-
Kind,
|
|
157
150
|
LATEST_PROTOCOL_VERSION,
|
|
158
151
|
LegacyAgentSession,
|
|
159
152
|
ListRootsResultSchema,
|
|
@@ -162,17 +155,13 @@ import {
|
|
|
162
155
|
LoggingLevelSchema,
|
|
163
156
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
164
157
|
MCPServerConfig,
|
|
165
|
-
MCPServerStatus,
|
|
166
158
|
McpError,
|
|
167
|
-
MessageBusType,
|
|
168
159
|
OTHER_BLOCKED_MESSAGE,
|
|
169
|
-
OutputFormat,
|
|
170
160
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
171
161
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
172
162
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
173
163
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
174
164
|
PREVIEW_GEMINI_MODEL,
|
|
175
|
-
PolicyDecision,
|
|
176
165
|
PolicyIntegrityManager,
|
|
177
166
|
Protocol,
|
|
178
167
|
RECITATION_BLOCKED_MESSAGE,
|
|
@@ -183,8 +172,6 @@ import {
|
|
|
183
172
|
SAFETY_BLOCKED_MESSAGE,
|
|
184
173
|
SUPPORTED_PROTOCOL_VERSIONS,
|
|
185
174
|
Scheduler,
|
|
186
|
-
SessionEndReason,
|
|
187
|
-
SessionStartSource,
|
|
188
175
|
SetLevelRequestSchema,
|
|
189
176
|
ShellExecutionService,
|
|
190
177
|
SimpleExtensionLoader,
|
|
@@ -195,13 +182,10 @@ import {
|
|
|
195
182
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
196
183
|
ToolCallEvent,
|
|
197
184
|
ToolConfirmationOutcome,
|
|
198
|
-
ToolErrorType,
|
|
199
|
-
TrustLevel,
|
|
200
185
|
UserAccountManager,
|
|
201
186
|
UserPromptEvent,
|
|
202
187
|
ValidationCancelledError,
|
|
203
188
|
ValidationRequiredError,
|
|
204
|
-
WarningPriority,
|
|
205
189
|
applyAdminAllowlist,
|
|
206
190
|
applyRequiredServers,
|
|
207
191
|
clearCachedCredentialFile,
|
|
@@ -289,7 +273,7 @@ import {
|
|
|
289
273
|
updatePolicy,
|
|
290
274
|
writeToStderr,
|
|
291
275
|
writeToStdout
|
|
292
|
-
} from "./chunk-
|
|
276
|
+
} from "./chunk-LAR4JEC7.js";
|
|
293
277
|
import "./chunk-664ZODQF.js";
|
|
294
278
|
import "./chunk-IUUIT4SU.js";
|
|
295
279
|
import "./chunk-L6PII3GR.js";
|
|
@@ -5438,7 +5422,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5438
5422
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5439
5423
|
const isStdio = !!config.command;
|
|
5440
5424
|
if (isStdio && !isTrusted) {
|
|
5441
|
-
return
|
|
5425
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5442
5426
|
}
|
|
5443
5427
|
const client = new Client({
|
|
5444
5428
|
name: "mcp-test-client",
|
|
@@ -5474,7 +5458,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5474
5458
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5475
5459
|
} catch {
|
|
5476
5460
|
await client.close();
|
|
5477
|
-
return
|
|
5461
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5478
5462
|
}
|
|
5479
5463
|
try {
|
|
5480
5464
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5488,10 +5472,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5488
5472
|
);
|
|
5489
5473
|
}
|
|
5490
5474
|
await client.close();
|
|
5491
|
-
return
|
|
5475
|
+
return "connected" /* CONNECTED */;
|
|
5492
5476
|
} catch {
|
|
5493
5477
|
await transport.close();
|
|
5494
|
-
return
|
|
5478
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5495
5479
|
}
|
|
5496
5480
|
}
|
|
5497
5481
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5504,12 +5488,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5504
5488
|
});
|
|
5505
5489
|
if (!loadResult.allowed) {
|
|
5506
5490
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5507
|
-
return
|
|
5491
|
+
return "blocked" /* BLOCKED */;
|
|
5508
5492
|
}
|
|
5509
|
-
return
|
|
5493
|
+
return "disabled" /* DISABLED */;
|
|
5510
5494
|
}
|
|
5511
5495
|
if (!isTrusted) {
|
|
5512
|
-
return
|
|
5496
|
+
return "disabled" /* DISABLED */;
|
|
5513
5497
|
}
|
|
5514
5498
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5515
5499
|
}
|
|
@@ -5555,23 +5539,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5555
5539
|
let statusIndicator = "";
|
|
5556
5540
|
let statusText = "";
|
|
5557
5541
|
switch (status) {
|
|
5558
|
-
case
|
|
5542
|
+
case "connected" /* CONNECTED */:
|
|
5559
5543
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5560
5544
|
statusText = "Connected";
|
|
5561
5545
|
break;
|
|
5562
|
-
case
|
|
5546
|
+
case "connecting" /* CONNECTING */:
|
|
5563
5547
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5564
5548
|
statusText = "Connecting";
|
|
5565
5549
|
break;
|
|
5566
|
-
case
|
|
5550
|
+
case "blocked" /* BLOCKED */:
|
|
5567
5551
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5568
5552
|
statusText = "Blocked";
|
|
5569
5553
|
break;
|
|
5570
|
-
case
|
|
5554
|
+
case "disabled" /* DISABLED */:
|
|
5571
5555
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5572
5556
|
statusText = "Disabled";
|
|
5573
5557
|
break;
|
|
5574
|
-
case
|
|
5558
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5575
5559
|
default:
|
|
5576
5560
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5577
5561
|
statusText = "Disconnected";
|
|
@@ -5857,7 +5841,7 @@ async function handleInstall(args) {
|
|
|
5857
5841
|
);
|
|
5858
5842
|
if (confirmed) {
|
|
5859
5843
|
const trustedFolders = loadTrustedFolders();
|
|
5860
|
-
await trustedFolders.setValue(realPath,
|
|
5844
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5861
5845
|
} else {
|
|
5862
5846
|
throw new Error(
|
|
5863
5847
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -6512,57 +6496,6 @@ async function validateExtension(args) {
|
|
|
6512
6496
|
`Warning: Version '${extensionConfig.version}' does not appear to be standard semver (e.g., 1.0.0).`
|
|
6513
6497
|
);
|
|
6514
6498
|
}
|
|
6515
|
-
if (extensionConfig.mcpServers) {
|
|
6516
|
-
if (typeof extensionConfig.mcpServers !== "object" || extensionConfig.mcpServers === null || Array.isArray(extensionConfig.mcpServers)) {
|
|
6517
|
-
errors.push('The "mcpServers" field must be an object.');
|
|
6518
|
-
} else {
|
|
6519
|
-
for (const [serverName, serverConfig] of Object.entries(
|
|
6520
|
-
extensionConfig.mcpServers
|
|
6521
|
-
)) {
|
|
6522
|
-
if (typeof serverConfig !== "object" || serverConfig === null || Array.isArray(serverConfig)) {
|
|
6523
|
-
errors.push(
|
|
6524
|
-
`MCP server configuration for "${serverName}" must be an object.`
|
|
6525
|
-
);
|
|
6526
|
-
continue;
|
|
6527
|
-
}
|
|
6528
|
-
const hasCommand = typeof serverConfig.command === "string" && serverConfig.command.trim().length > 0;
|
|
6529
|
-
const hasUrl = typeof serverConfig.url === "string" && serverConfig.url.trim().length > 0;
|
|
6530
|
-
const hasHttpUrl = typeof serverConfig.httpUrl === "string" && serverConfig.httpUrl.trim().length > 0;
|
|
6531
|
-
const hasTcp = typeof serverConfig.tcp === "string" && serverConfig.tcp.trim().length > 0 || typeof serverConfig.tcp === "number";
|
|
6532
|
-
if (!hasCommand && !hasUrl && !hasHttpUrl && !hasTcp) {
|
|
6533
|
-
errors.push(
|
|
6534
|
-
`MCP server "${serverName}" must specify a transport (e.g., "command", "url", or "httpUrl").`
|
|
6535
|
-
);
|
|
6536
|
-
}
|
|
6537
|
-
if (hasHttpUrl) {
|
|
6538
|
-
warnings.push(
|
|
6539
|
-
`MCP server "${serverName}" uses deprecated "httpUrl". Consider using "url" with "type": "http" instead.`
|
|
6540
|
-
);
|
|
6541
|
-
}
|
|
6542
|
-
const errorPrefix = `MCP server "${serverName}" specifies an invalid `;
|
|
6543
|
-
if (hasUrl && serverConfig.url) {
|
|
6544
|
-
const hasPlaceholder = serverConfig.url.includes("$");
|
|
6545
|
-
if (!hasPlaceholder) {
|
|
6546
|
-
try {
|
|
6547
|
-
new URL(serverConfig.url);
|
|
6548
|
-
} catch {
|
|
6549
|
-
errors.push(`${errorPrefix}URL: "${serverConfig.url}".`);
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6552
|
-
}
|
|
6553
|
-
if (hasHttpUrl && serverConfig.httpUrl) {
|
|
6554
|
-
const hasPlaceholder = serverConfig.httpUrl.includes("$");
|
|
6555
|
-
if (!hasPlaceholder) {
|
|
6556
|
-
try {
|
|
6557
|
-
new URL(serverConfig.httpUrl);
|
|
6558
|
-
} catch {
|
|
6559
|
-
errors.push(`${errorPrefix}httpUrl: "${serverConfig.httpUrl}".`);
|
|
6560
|
-
}
|
|
6561
|
-
}
|
|
6562
|
-
}
|
|
6563
|
-
}
|
|
6564
|
-
}
|
|
6565
|
-
}
|
|
6566
6499
|
if (warnings.length > 0) {
|
|
6567
6500
|
debugLogger.warn("Validation warnings:");
|
|
6568
6501
|
for (const warning of warnings) {
|
|
@@ -7007,10 +6940,8 @@ var EVENT_MAPPING = {
|
|
|
7007
6940
|
PostToolUse: "AfterTool",
|
|
7008
6941
|
UserPromptSubmit: "BeforeAgent",
|
|
7009
6942
|
Stop: "AfterAgent",
|
|
7010
|
-
SubagentStop: "AfterAgent",
|
|
7011
|
-
// Gemini doesn't have sub-agents, map to AfterAgent
|
|
7012
6943
|
SubAgentStop: "AfterAgent",
|
|
7013
|
-
//
|
|
6944
|
+
// Gemini doesn't have sub-agents, map to AfterAgent
|
|
7014
6945
|
SessionStart: "SessionStart",
|
|
7015
6946
|
SessionEnd: "SessionEnd",
|
|
7016
6947
|
PreCompact: "PreCompress",
|
|
@@ -7098,10 +7029,7 @@ function migrateClaudeHooks(claudeConfig) {
|
|
|
7098
7029
|
}
|
|
7099
7030
|
return migratedDef;
|
|
7100
7031
|
});
|
|
7101
|
-
geminiHooks[geminiEventName] =
|
|
7102
|
-
...geminiHooks[geminiEventName] || [],
|
|
7103
|
-
...migratedDefinitions
|
|
7104
|
-
];
|
|
7032
|
+
geminiHooks[geminiEventName] = migratedDefinitions;
|
|
7105
7033
|
}
|
|
7106
7034
|
return geminiHooks;
|
|
7107
7035
|
}
|
|
@@ -7924,12 +7852,12 @@ function toToolCallContent(toolResult) {
|
|
|
7924
7852
|
}
|
|
7925
7853
|
var basicPermissionOptions = [
|
|
7926
7854
|
{
|
|
7927
|
-
optionId:
|
|
7855
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
7928
7856
|
name: "Allow",
|
|
7929
7857
|
kind: "allow_once"
|
|
7930
7858
|
},
|
|
7931
7859
|
{
|
|
7932
|
-
optionId:
|
|
7860
|
+
optionId: "cancel" /* Cancel */,
|
|
7933
7861
|
name: "Reject",
|
|
7934
7862
|
kind: "reject_once"
|
|
7935
7863
|
}
|
|
@@ -7941,13 +7869,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
7941
7869
|
switch (confirmation.type) {
|
|
7942
7870
|
case "edit":
|
|
7943
7871
|
options.push({
|
|
7944
|
-
optionId:
|
|
7872
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
7945
7873
|
name: "Allow for this session",
|
|
7946
7874
|
kind: "allow_always"
|
|
7947
7875
|
});
|
|
7948
7876
|
if (enablePermanentToolApproval) {
|
|
7949
7877
|
options.push({
|
|
7950
|
-
optionId:
|
|
7878
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
7951
7879
|
name: "Allow for this file in all future sessions",
|
|
7952
7880
|
kind: "allow_always"
|
|
7953
7881
|
});
|
|
@@ -7955,13 +7883,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
7955
7883
|
break;
|
|
7956
7884
|
case "exec":
|
|
7957
7885
|
options.push({
|
|
7958
|
-
optionId:
|
|
7886
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
7959
7887
|
name: "Allow for this session",
|
|
7960
7888
|
kind: "allow_always"
|
|
7961
7889
|
});
|
|
7962
7890
|
if (enablePermanentToolApproval) {
|
|
7963
7891
|
options.push({
|
|
7964
|
-
optionId:
|
|
7892
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
7965
7893
|
name: "Allow this command for all future sessions",
|
|
7966
7894
|
kind: "allow_always"
|
|
7967
7895
|
});
|
|
@@ -7972,19 +7900,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
7972
7900
|
const toolName = confirmation.toolName?.trim() || "generic_tool";
|
|
7973
7901
|
options.push(
|
|
7974
7902
|
{
|
|
7975
|
-
optionId:
|
|
7903
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
7976
7904
|
name: `Allow all "${serverName}" server tools for this session`,
|
|
7977
7905
|
kind: "allow_always"
|
|
7978
7906
|
},
|
|
7979
7907
|
{
|
|
7980
|
-
optionId:
|
|
7908
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
7981
7909
|
name: `Allow tool "${toolName}" for this session`,
|
|
7982
7910
|
kind: "allow_always"
|
|
7983
7911
|
}
|
|
7984
7912
|
);
|
|
7985
7913
|
if (enablePermanentToolApproval) {
|
|
7986
7914
|
options.push({
|
|
7987
|
-
optionId:
|
|
7915
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
7988
7916
|
name: `Allow tool "${toolName}" for all future sessions`,
|
|
7989
7917
|
kind: "allow_always"
|
|
7990
7918
|
});
|
|
@@ -7993,13 +7921,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
7993
7921
|
}
|
|
7994
7922
|
case "info":
|
|
7995
7923
|
options.push({
|
|
7996
|
-
optionId:
|
|
7924
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
7997
7925
|
name: "Allow for this session",
|
|
7998
7926
|
kind: "allow_always"
|
|
7999
7927
|
});
|
|
8000
7928
|
if (enablePermanentToolApproval) {
|
|
8001
7929
|
options.push({
|
|
8002
|
-
optionId:
|
|
7930
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
8003
7931
|
name: "Allow for all future sessions",
|
|
8004
7932
|
kind: "allow_always"
|
|
8005
7933
|
});
|
|
@@ -8031,21 +7959,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
8031
7959
|
}
|
|
8032
7960
|
function toAcpToolKind(kind) {
|
|
8033
7961
|
switch (kind) {
|
|
8034
|
-
case
|
|
8035
|
-
case
|
|
8036
|
-
case
|
|
8037
|
-
case
|
|
8038
|
-
case
|
|
8039
|
-
case
|
|
8040
|
-
case
|
|
8041
|
-
case
|
|
8042
|
-
case
|
|
8043
|
-
case
|
|
7962
|
+
case "read" /* Read */:
|
|
7963
|
+
case "edit" /* Edit */:
|
|
7964
|
+
case "execute" /* Execute */:
|
|
7965
|
+
case "search" /* Search */:
|
|
7966
|
+
case "delete" /* Delete */:
|
|
7967
|
+
case "move" /* Move */:
|
|
7968
|
+
case "think" /* Think */:
|
|
7969
|
+
case "fetch" /* Fetch */:
|
|
7970
|
+
case "switch_mode" /* SwitchMode */:
|
|
7971
|
+
case "other" /* Other */:
|
|
8044
7972
|
return kind;
|
|
8045
|
-
case
|
|
7973
|
+
case "agent" /* Agent */:
|
|
8046
7974
|
return "think";
|
|
8047
|
-
case
|
|
8048
|
-
case
|
|
7975
|
+
case "plan" /* Plan */:
|
|
7976
|
+
case "communicate" /* Communicate */:
|
|
8049
7977
|
default:
|
|
8050
7978
|
return "other";
|
|
8051
7979
|
}
|
|
@@ -8053,24 +7981,24 @@ function toAcpToolKind(kind) {
|
|
|
8053
7981
|
function buildAvailableModes(isPlanEnabled) {
|
|
8054
7982
|
const modes = [
|
|
8055
7983
|
{
|
|
8056
|
-
id:
|
|
7984
|
+
id: "default" /* DEFAULT */,
|
|
8057
7985
|
name: "Default",
|
|
8058
7986
|
description: "Prompts for approval"
|
|
8059
7987
|
},
|
|
8060
7988
|
{
|
|
8061
|
-
id:
|
|
7989
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
8062
7990
|
name: "Auto Edit",
|
|
8063
7991
|
description: "Auto-approves edit tools"
|
|
8064
7992
|
},
|
|
8065
7993
|
{
|
|
8066
|
-
id:
|
|
7994
|
+
id: "yolo" /* YOLO */,
|
|
8067
7995
|
name: "YOLO",
|
|
8068
7996
|
description: "Auto-approves all tools"
|
|
8069
7997
|
}
|
|
8070
7998
|
];
|
|
8071
7999
|
if (isPlanEnabled) {
|
|
8072
8000
|
modes.push({
|
|
8073
|
-
id:
|
|
8001
|
+
id: "plan" /* PLAN */,
|
|
8074
8002
|
name: "Plan",
|
|
8075
8003
|
description: "Read-only mode"
|
|
8076
8004
|
});
|
|
@@ -8084,7 +8012,7 @@ function buildAvailableModels(config, settings) {
|
|
|
8084
8012
|
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
8085
8013
|
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
8086
8014
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
8087
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
8015
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
8088
8016
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
8089
8017
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
8090
8018
|
useGemini3_1: useGemini31,
|
|
@@ -8380,7 +8308,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
8380
8308
|
}
|
|
8381
8309
|
const command2 = getSandboxCommand(sandboxValue);
|
|
8382
8310
|
const packageJson = await getPackageJson(__dirname3);
|
|
8383
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.67.0
|
|
8311
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.67.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
8384
8312
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
8385
8313
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
8386
8314
|
}
|
|
@@ -8439,9 +8367,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
8439
8367
|
cwd,
|
|
8440
8368
|
potentialWorkspacePoliciesDir
|
|
8441
8369
|
);
|
|
8442
|
-
if (integrityResult.status ===
|
|
8370
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
8443
8371
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
8444
|
-
} else if (integrityResult.status ===
|
|
8372
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
8445
8373
|
workspacePoliciesDir = void 0;
|
|
8446
8374
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
8447
8375
|
policyUpdateConfirmationRequest = {
|
|
@@ -8877,23 +8805,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8877
8805
|
if (rawApprovalMode) {
|
|
8878
8806
|
switch (rawApprovalMode) {
|
|
8879
8807
|
case "yolo":
|
|
8880
|
-
approvalMode =
|
|
8808
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8881
8809
|
break;
|
|
8882
8810
|
case "auto_edit":
|
|
8883
|
-
approvalMode =
|
|
8811
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8884
8812
|
break;
|
|
8885
8813
|
case "plan":
|
|
8886
8814
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8887
8815
|
debugLogger.warn(
|
|
8888
8816
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8889
8817
|
);
|
|
8890
|
-
approvalMode =
|
|
8818
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8891
8819
|
} else {
|
|
8892
|
-
approvalMode =
|
|
8820
|
+
approvalMode = "plan" /* PLAN */;
|
|
8893
8821
|
}
|
|
8894
8822
|
break;
|
|
8895
8823
|
case "default":
|
|
8896
|
-
approvalMode =
|
|
8824
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8897
8825
|
break;
|
|
8898
8826
|
default:
|
|
8899
8827
|
throw new Error(
|
|
@@ -8901,10 +8829,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8901
8829
|
);
|
|
8902
8830
|
}
|
|
8903
8831
|
} else {
|
|
8904
|
-
approvalMode =
|
|
8832
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8905
8833
|
}
|
|
8906
8834
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8907
|
-
if (approvalMode ===
|
|
8835
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8908
8836
|
if (settings.admin?.secureModeEnabled) {
|
|
8909
8837
|
debugLogger.error(
|
|
8910
8838
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8922,16 +8850,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8922
8850
|
)
|
|
8923
8851
|
);
|
|
8924
8852
|
}
|
|
8925
|
-
} else if (approvalMode ===
|
|
8853
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8926
8854
|
debugLogger.warn(
|
|
8927
8855
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8928
8856
|
);
|
|
8929
8857
|
}
|
|
8930
|
-
if (!trustedFolder && approvalMode !==
|
|
8858
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8931
8859
|
debugLogger.warn(
|
|
8932
8860
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8933
8861
|
);
|
|
8934
|
-
approvalMode =
|
|
8862
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8935
8863
|
}
|
|
8936
8864
|
let telemetrySettings;
|
|
8937
8865
|
try {
|
|
@@ -11448,45 +11376,6 @@ function isRecord3(value) {
|
|
|
11448
11376
|
}
|
|
11449
11377
|
var execAsync = promisify(exec);
|
|
11450
11378
|
var execFileAsync = promisify(execFile);
|
|
11451
|
-
var PODMAN_INFO_TIMEOUT_MS = 5e3;
|
|
11452
|
-
async function isPodmanRootless() {
|
|
11453
|
-
const formats = [
|
|
11454
|
-
"{{.Host.Security.Rootless}}",
|
|
11455
|
-
"{{.Host.ServiceIsRootless}}"
|
|
11456
|
-
];
|
|
11457
|
-
for (const format3 of formats) {
|
|
11458
|
-
try {
|
|
11459
|
-
const { stdout } = await execFileAsync(
|
|
11460
|
-
"podman",
|
|
11461
|
-
["info", "--format", format3],
|
|
11462
|
-
{
|
|
11463
|
-
encoding: "utf-8",
|
|
11464
|
-
timeout: PODMAN_INFO_TIMEOUT_MS,
|
|
11465
|
-
killSignal: "SIGKILL"
|
|
11466
|
-
}
|
|
11467
|
-
);
|
|
11468
|
-
const trimmed = String(stdout ?? "").trim().toLowerCase();
|
|
11469
|
-
if (trimmed === "true") {
|
|
11470
|
-
return true;
|
|
11471
|
-
}
|
|
11472
|
-
if (trimmed === "false") {
|
|
11473
|
-
return false;
|
|
11474
|
-
}
|
|
11475
|
-
} catch (err) {
|
|
11476
|
-
const isMissingBinary = isNodeError(err) && err.code === "ENOENT";
|
|
11477
|
-
const timedOut = isRecord3(err) && err["killed"] === true;
|
|
11478
|
-
if (isMissingBinary || timedOut) {
|
|
11479
|
-
break;
|
|
11480
|
-
}
|
|
11481
|
-
}
|
|
11482
|
-
}
|
|
11483
|
-
return false;
|
|
11484
|
-
}
|
|
11485
|
-
function hasUsernsFlag(flags) {
|
|
11486
|
-
return flags.some(
|
|
11487
|
-
(flag) => flag === "--userns" || flag.startsWith("--userns=")
|
|
11488
|
-
);
|
|
11489
|
-
}
|
|
11490
11379
|
async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
11491
11380
|
const patcher = new ConsolePatcher({
|
|
11492
11381
|
debugMode: cliConfig?.getDebugMode() || !!process.env["DEBUG"],
|
|
@@ -11825,10 +11714,12 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
11825
11714
|
if (config.command === "runsc") {
|
|
11826
11715
|
args.push("--runtime=runsc");
|
|
11827
11716
|
}
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11717
|
+
if (process.env["SANDBOX_FLAGS"]) {
|
|
11718
|
+
const flags = (0, import_shell_quote2.parse)(process.env["SANDBOX_FLAGS"], process.env).filter(
|
|
11719
|
+
(f) => typeof f === "string"
|
|
11720
|
+
);
|
|
11721
|
+
args.push(...flags);
|
|
11722
|
+
}
|
|
11832
11723
|
if (process.stdin.isTTY) {
|
|
11833
11724
|
args.push("-t");
|
|
11834
11725
|
}
|
|
@@ -12141,9 +12032,6 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
12141
12032
|
userFlag = "--user root";
|
|
12142
12033
|
} else if (await shouldUseCurrentUserInSandbox()) {
|
|
12143
12034
|
args.push("--user", "root");
|
|
12144
|
-
if (command2 === "podman" && !hasUsernsFlag(customFlags) && await isPodmanRootless()) {
|
|
12145
|
-
args.push("--userns=keep-id");
|
|
12146
|
-
}
|
|
12147
12035
|
const uid = (await execAsync("id -u")).stdout.trim();
|
|
12148
12036
|
const gid = (await execAsync("id -g")).stdout.trim();
|
|
12149
12037
|
const username = "gemini";
|
|
@@ -12618,7 +12506,7 @@ import path11 from "node:path";
|
|
|
12618
12506
|
import process5 from "node:process";
|
|
12619
12507
|
var homeDirectoryCheck = {
|
|
12620
12508
|
id: "home-directory",
|
|
12621
|
-
priority:
|
|
12509
|
+
priority: "low" /* Low */,
|
|
12622
12510
|
check: async (workspaceRoot, settings) => {
|
|
12623
12511
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
12624
12512
|
return null;
|
|
@@ -12642,7 +12530,7 @@ var homeDirectoryCheck = {
|
|
|
12642
12530
|
};
|
|
12643
12531
|
var rootDirectoryCheck = {
|
|
12644
12532
|
id: "root-directory",
|
|
12645
|
-
priority:
|
|
12533
|
+
priority: "high" /* High */,
|
|
12646
12534
|
check: async (workspaceRoot, _settings) => {
|
|
12647
12535
|
try {
|
|
12648
12536
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -12658,7 +12546,7 @@ var rootDirectoryCheck = {
|
|
|
12658
12546
|
};
|
|
12659
12547
|
var folderTrustCheck = {
|
|
12660
12548
|
id: "folder-trust",
|
|
12661
|
-
priority:
|
|
12549
|
+
priority: "high" /* High */,
|
|
12662
12550
|
check: async (workspaceRoot, settings) => {
|
|
12663
12551
|
if (!isFolderTrustEnabled(settings)) {
|
|
12664
12552
|
return null;
|
|
@@ -12848,12 +12736,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
12848
12736
|
error,
|
|
12849
12737
|
config.getContentGeneratorConfig()?.authType
|
|
12850
12738
|
);
|
|
12851
|
-
if (config.getOutputFormat() ===
|
|
12739
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
12852
12740
|
const streamFormatter = new StreamJsonFormatter();
|
|
12853
12741
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
12854
12742
|
const metrics = uiTelemetryService.getMetrics();
|
|
12855
12743
|
streamFormatter.emitEvent({
|
|
12856
|
-
type:
|
|
12744
|
+
type: "result" /* RESULT */,
|
|
12857
12745
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12858
12746
|
status: "error",
|
|
12859
12747
|
error: {
|
|
@@ -12864,7 +12752,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
12864
12752
|
});
|
|
12865
12753
|
runSyncCleanup();
|
|
12866
12754
|
process.exit(getNumericExitCode(errorCode));
|
|
12867
|
-
} else if (config.getOutputFormat() ===
|
|
12755
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12868
12756
|
const formatter = new JsonFormatter();
|
|
12869
12757
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
12870
12758
|
const formattedError = formatter.formatError(
|
|
@@ -12884,11 +12772,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
12884
12772
|
const isFatal = isFatalToolError(errorType);
|
|
12885
12773
|
if (isFatal) {
|
|
12886
12774
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
12887
|
-
if (config.getOutputFormat() ===
|
|
12775
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
12888
12776
|
const streamFormatter = new StreamJsonFormatter();
|
|
12889
12777
|
const metrics = uiTelemetryService.getMetrics();
|
|
12890
12778
|
streamFormatter.emitEvent({
|
|
12891
|
-
type:
|
|
12779
|
+
type: "result" /* RESULT */,
|
|
12892
12780
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12893
12781
|
status: "error",
|
|
12894
12782
|
error: {
|
|
@@ -12897,7 +12785,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
12897
12785
|
},
|
|
12898
12786
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
12899
12787
|
});
|
|
12900
|
-
} else if (config.getOutputFormat() ===
|
|
12788
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12901
12789
|
const formatter = new JsonFormatter();
|
|
12902
12790
|
const formattedError = formatter.formatError(
|
|
12903
12791
|
toolExecutionError,
|
|
@@ -12915,11 +12803,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
12915
12803
|
}
|
|
12916
12804
|
function handleCancellationError(config) {
|
|
12917
12805
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
12918
|
-
if (config.getOutputFormat() ===
|
|
12806
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
12919
12807
|
const streamFormatter = new StreamJsonFormatter();
|
|
12920
12808
|
const metrics = uiTelemetryService.getMetrics();
|
|
12921
12809
|
streamFormatter.emitEvent({
|
|
12922
|
-
type:
|
|
12810
|
+
type: "result" /* RESULT */,
|
|
12923
12811
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12924
12812
|
status: "error",
|
|
12925
12813
|
error: {
|
|
@@ -12930,7 +12818,7 @@ function handleCancellationError(config) {
|
|
|
12930
12818
|
});
|
|
12931
12819
|
runSyncCleanup();
|
|
12932
12820
|
process.exit(cancellationError.exitCode);
|
|
12933
|
-
} else if (config.getOutputFormat() ===
|
|
12821
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12934
12822
|
const formatter = new JsonFormatter();
|
|
12935
12823
|
const formattedError = formatter.formatError(
|
|
12936
12824
|
cancellationError,
|
|
@@ -12950,11 +12838,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
12950
12838
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
12951
12839
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
12952
12840
|
);
|
|
12953
|
-
if (config.getOutputFormat() ===
|
|
12841
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
12954
12842
|
const streamFormatter = new StreamJsonFormatter();
|
|
12955
12843
|
const metrics = uiTelemetryService.getMetrics();
|
|
12956
12844
|
streamFormatter.emitEvent({
|
|
12957
|
-
type:
|
|
12845
|
+
type: "result" /* RESULT */,
|
|
12958
12846
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12959
12847
|
status: "error",
|
|
12960
12848
|
error: {
|
|
@@ -12965,7 +12853,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
12965
12853
|
});
|
|
12966
12854
|
runSyncCleanup();
|
|
12967
12855
|
process.exit(maxTurnsError.exitCode);
|
|
12968
|
-
} else if (config.getOutputFormat() ===
|
|
12856
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12969
12857
|
const formatter = new JsonFormatter();
|
|
12970
12858
|
const formattedError = formatter.formatError(
|
|
12971
12859
|
maxTurnsError,
|
|
@@ -13048,7 +12936,7 @@ async function runNonInteractive({
|
|
|
13048
12936
|
}
|
|
13049
12937
|
});
|
|
13050
12938
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
13051
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
12939
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-EFJXZRFD.js");
|
|
13052
12940
|
setupInitialActivityLogger(config);
|
|
13053
12941
|
}
|
|
13054
12942
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -13064,7 +12952,7 @@ async function runNonInteractive({
|
|
|
13064
12952
|
}
|
|
13065
12953
|
};
|
|
13066
12954
|
const startTime = Date.now();
|
|
13067
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
12955
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
13068
12956
|
const abortController = new AbortController();
|
|
13069
12957
|
let isAborting = false;
|
|
13070
12958
|
let cancelMessageTimer = null;
|
|
@@ -13137,13 +13025,13 @@ async function runNonInteractive({
|
|
|
13137
13025
|
};
|
|
13138
13026
|
try {
|
|
13139
13027
|
consolePatcher.patch();
|
|
13140
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
13028
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
13141
13029
|
process.stderr.write(
|
|
13142
13030
|
"[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"
|
|
13143
13031
|
);
|
|
13144
13032
|
}
|
|
13145
13033
|
setupCancellation();
|
|
13146
|
-
coreEvents.on(
|
|
13034
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
13147
13035
|
coreEvents.drainBacklogs();
|
|
13148
13036
|
process.stdout.on("error", handleStdoutError);
|
|
13149
13037
|
const geminiClient = config.getGeminiClient();
|
|
@@ -13163,7 +13051,7 @@ async function runNonInteractive({
|
|
|
13163
13051
|
}
|
|
13164
13052
|
if (streamFormatter) {
|
|
13165
13053
|
streamFormatter.emitEvent({
|
|
13166
|
-
type:
|
|
13054
|
+
type: "init" /* INIT */,
|
|
13167
13055
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13168
13056
|
session_id: config.getSessionId(),
|
|
13169
13057
|
model: config.getModel()
|
|
@@ -13201,7 +13089,7 @@ async function runNonInteractive({
|
|
|
13201
13089
|
}
|
|
13202
13090
|
if (streamFormatter) {
|
|
13203
13091
|
streamFormatter.emitEvent({
|
|
13204
|
-
type:
|
|
13092
|
+
type: "message" /* MESSAGE */,
|
|
13205
13093
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13206
13094
|
role: "user",
|
|
13207
13095
|
content: input
|
|
@@ -13240,12 +13128,12 @@ async function runNonInteractive({
|
|
|
13240
13128
|
const metrics = uiTelemetryService.getMetrics();
|
|
13241
13129
|
const durationMs = Date.now() - startTime;
|
|
13242
13130
|
streamFormatter.emitEvent({
|
|
13243
|
-
type:
|
|
13131
|
+
type: "result" /* RESULT */,
|
|
13244
13132
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13245
13133
|
status: errorPayload ? "error" : "success",
|
|
13246
13134
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
13247
13135
|
});
|
|
13248
|
-
} else if (config.getOutputFormat() ===
|
|
13136
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13249
13137
|
const formatter = new JsonFormatter();
|
|
13250
13138
|
const stats = uiTelemetryService.getMetrics();
|
|
13251
13139
|
textOutput.write(
|
|
@@ -13338,13 +13226,13 @@ async function runNonInteractive({
|
|
|
13338
13226
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
13339
13227
|
if (streamFormatter) {
|
|
13340
13228
|
streamFormatter.emitEvent({
|
|
13341
|
-
type:
|
|
13229
|
+
type: "message" /* MESSAGE */,
|
|
13342
13230
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13343
13231
|
role: "assistant",
|
|
13344
13232
|
content: output,
|
|
13345
13233
|
delta: true
|
|
13346
13234
|
});
|
|
13347
|
-
} else if (config.getOutputFormat() ===
|
|
13235
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13348
13236
|
responseText += output;
|
|
13349
13237
|
} else {
|
|
13350
13238
|
if (part.text) {
|
|
@@ -13357,13 +13245,13 @@ async function runNonInteractive({
|
|
|
13357
13245
|
break;
|
|
13358
13246
|
}
|
|
13359
13247
|
case "tool_request": {
|
|
13360
|
-
if (config.getOutputFormat() ===
|
|
13248
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13361
13249
|
preToolResponseText = responseText || preToolResponseText;
|
|
13362
13250
|
responseText = "";
|
|
13363
13251
|
}
|
|
13364
13252
|
if (streamFormatter) {
|
|
13365
13253
|
streamFormatter.emitEvent({
|
|
13366
|
-
type:
|
|
13254
|
+
type: "tool_use" /* TOOL_USE */,
|
|
13367
13255
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13368
13256
|
tool_name: event.name,
|
|
13369
13257
|
tool_id: event.requestId,
|
|
@@ -13379,7 +13267,7 @@ async function runNonInteractive({
|
|
|
13379
13267
|
const displayText = displayContentToString(display);
|
|
13380
13268
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
13381
13269
|
streamFormatter.emitEvent({
|
|
13382
|
-
type:
|
|
13270
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
13383
13271
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13384
13272
|
tool_id: event.requestId,
|
|
13385
13273
|
status: event.isError ? "error" : "success",
|
|
@@ -13394,17 +13282,17 @@ async function runNonInteractive({
|
|
|
13394
13282
|
const display = event.display?.result;
|
|
13395
13283
|
const displayText = displayContentToString(display);
|
|
13396
13284
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
13397
|
-
if (event.data?.["errorType"] ===
|
|
13398
|
-
if (config.getOutputFormat() ===
|
|
13285
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
13286
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
13399
13287
|
responseText = preToolResponseText;
|
|
13400
13288
|
}
|
|
13401
13289
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
13402
|
-
if (config.getOutputFormat() ===
|
|
13290
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13403
13291
|
process.stderr.write(`${stopMessage}
|
|
13404
13292
|
`);
|
|
13405
13293
|
}
|
|
13406
13294
|
}
|
|
13407
|
-
if (event.data?.["errorType"] ===
|
|
13295
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
13408
13296
|
throw new FatalToolExecutionError(
|
|
13409
13297
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
13410
13298
|
);
|
|
@@ -13439,12 +13327,12 @@ async function runNonInteractive({
|
|
|
13439
13327
|
}
|
|
13440
13328
|
if (streamFormatter) {
|
|
13441
13329
|
streamFormatter.emitEvent({
|
|
13442
|
-
type:
|
|
13330
|
+
type: "error" /* ERROR */,
|
|
13443
13331
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13444
13332
|
severity: "error",
|
|
13445
13333
|
message: errorMessage
|
|
13446
13334
|
});
|
|
13447
|
-
} else if (config.getOutputFormat() ===
|
|
13335
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13448
13336
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
13449
13337
|
`);
|
|
13450
13338
|
}
|
|
@@ -13465,12 +13353,12 @@ async function runNonInteractive({
|
|
|
13465
13353
|
const errorCode = event._meta?.["code"];
|
|
13466
13354
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
13467
13355
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
13468
|
-
if (config.getOutputFormat() ===
|
|
13356
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13469
13357
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
13470
13358
|
`);
|
|
13471
13359
|
} else if (streamFormatter) {
|
|
13472
13360
|
streamFormatter.emitEvent({
|
|
13473
|
-
type:
|
|
13361
|
+
type: "error" /* ERROR */,
|
|
13474
13362
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13475
13363
|
severity: "warning",
|
|
13476
13364
|
message: stripAnsi(blockMessage)
|
|
@@ -13480,13 +13368,13 @@ async function runNonInteractive({
|
|
|
13480
13368
|
break;
|
|
13481
13369
|
}
|
|
13482
13370
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
13483
|
-
if (config.getOutputFormat() ===
|
|
13371
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13484
13372
|
process.stderr.write(`[WARNING] ${event.message}
|
|
13485
13373
|
`);
|
|
13486
13374
|
}
|
|
13487
13375
|
if (streamFormatter) {
|
|
13488
13376
|
streamFormatter.emitEvent({
|
|
13489
|
-
type:
|
|
13377
|
+
type: "error" /* ERROR */,
|
|
13490
13378
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13491
13379
|
severity,
|
|
13492
13380
|
message: stripAnsi(event.message)
|
|
@@ -13506,7 +13394,7 @@ async function runNonInteractive({
|
|
|
13506
13394
|
);
|
|
13507
13395
|
} else if (streamFormatter) {
|
|
13508
13396
|
streamFormatter.emitEvent({
|
|
13509
|
-
type:
|
|
13397
|
+
type: "error" /* ERROR */,
|
|
13510
13398
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13511
13399
|
severity: "error",
|
|
13512
13400
|
message: "Maximum session turns exceeded"
|
|
@@ -13514,7 +13402,7 @@ async function runNonInteractive({
|
|
|
13514
13402
|
}
|
|
13515
13403
|
}
|
|
13516
13404
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
13517
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
13405
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
13518
13406
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
13519
13407
|
`);
|
|
13520
13408
|
}
|
|
@@ -13544,7 +13432,7 @@ async function runNonInteractive({
|
|
|
13544
13432
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
13545
13433
|
scheduler?.dispose();
|
|
13546
13434
|
consolePatcher.cleanup();
|
|
13547
|
-
coreEvents.off(
|
|
13435
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
13548
13436
|
await runExitCleanup();
|
|
13549
13437
|
}
|
|
13550
13438
|
if (abortController.signal.aborted || isFatalCancellationError(errorToHandle)) {
|
|
@@ -13576,7 +13464,7 @@ async function runNonInteractive2(params) {
|
|
|
13576
13464
|
}
|
|
13577
13465
|
});
|
|
13578
13466
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
13579
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
13467
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-EFJXZRFD.js");
|
|
13580
13468
|
setupInitialActivityLogger(config);
|
|
13581
13469
|
}
|
|
13582
13470
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -13592,7 +13480,7 @@ async function runNonInteractive2(params) {
|
|
|
13592
13480
|
}
|
|
13593
13481
|
};
|
|
13594
13482
|
const startTime = Date.now();
|
|
13595
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
13483
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
13596
13484
|
const abortController = new AbortController();
|
|
13597
13485
|
let isAborting = false;
|
|
13598
13486
|
let cancelMessageTimer = null;
|
|
@@ -13663,13 +13551,13 @@ async function runNonInteractive2(params) {
|
|
|
13663
13551
|
let scheduler;
|
|
13664
13552
|
try {
|
|
13665
13553
|
consolePatcher.patch();
|
|
13666
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
13554
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
13667
13555
|
process.stderr.write(
|
|
13668
13556
|
"[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"
|
|
13669
13557
|
);
|
|
13670
13558
|
}
|
|
13671
13559
|
setupCancellation();
|
|
13672
|
-
coreEvents.on(
|
|
13560
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
13673
13561
|
coreEvents.drainBacklogs();
|
|
13674
13562
|
process.stdout.on("error", handleStdoutError);
|
|
13675
13563
|
const geminiClient = config.getGeminiClient();
|
|
@@ -13689,7 +13577,7 @@ async function runNonInteractive2(params) {
|
|
|
13689
13577
|
}
|
|
13690
13578
|
if (streamFormatter) {
|
|
13691
13579
|
streamFormatter.emitEvent({
|
|
13692
|
-
type:
|
|
13580
|
+
type: "init" /* INIT */,
|
|
13693
13581
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13694
13582
|
session_id: config.getSessionId(),
|
|
13695
13583
|
model: config.getModel()
|
|
@@ -13727,7 +13615,7 @@ async function runNonInteractive2(params) {
|
|
|
13727
13615
|
}
|
|
13728
13616
|
if (streamFormatter) {
|
|
13729
13617
|
streamFormatter.emitEvent({
|
|
13730
|
-
type:
|
|
13618
|
+
type: "message" /* MESSAGE */,
|
|
13731
13619
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13732
13620
|
role: "user",
|
|
13733
13621
|
content: input
|
|
@@ -13755,28 +13643,28 @@ async function runNonInteractive2(params) {
|
|
|
13755
13643
|
if (abortController.signal.aborted) {
|
|
13756
13644
|
handleCancellationError(config);
|
|
13757
13645
|
}
|
|
13758
|
-
if (event.type ===
|
|
13646
|
+
if (event.type === "content" /* Content */) {
|
|
13759
13647
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
13760
13648
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
13761
13649
|
if (streamFormatter) {
|
|
13762
13650
|
streamFormatter.emitEvent({
|
|
13763
|
-
type:
|
|
13651
|
+
type: "message" /* MESSAGE */,
|
|
13764
13652
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13765
13653
|
role: "assistant",
|
|
13766
13654
|
content: output,
|
|
13767
13655
|
delta: true
|
|
13768
13656
|
});
|
|
13769
|
-
} else if (config.getOutputFormat() ===
|
|
13657
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13770
13658
|
responseText += output;
|
|
13771
13659
|
} else {
|
|
13772
13660
|
if (event.value) {
|
|
13773
13661
|
textOutput.write(output);
|
|
13774
13662
|
}
|
|
13775
13663
|
}
|
|
13776
|
-
} else if (event.type ===
|
|
13664
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
13777
13665
|
if (streamFormatter) {
|
|
13778
13666
|
streamFormatter.emitEvent({
|
|
13779
|
-
type:
|
|
13667
|
+
type: "tool_use" /* TOOL_USE */,
|
|
13780
13668
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13781
13669
|
tool_name: event.value.name,
|
|
13782
13670
|
tool_id: event.value.callId,
|
|
@@ -13784,33 +13672,33 @@ async function runNonInteractive2(params) {
|
|
|
13784
13672
|
});
|
|
13785
13673
|
}
|
|
13786
13674
|
toolCallRequests.push(event.value);
|
|
13787
|
-
} else if (event.type ===
|
|
13675
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
13788
13676
|
const message = "Loop detected, stopping execution";
|
|
13789
13677
|
if (streamFormatter) {
|
|
13790
13678
|
streamFormatter.emitEvent({
|
|
13791
|
-
type:
|
|
13679
|
+
type: "error" /* ERROR */,
|
|
13792
13680
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13793
13681
|
severity: "warning",
|
|
13794
13682
|
message
|
|
13795
13683
|
});
|
|
13796
13684
|
}
|
|
13797
13685
|
warnings.push(message);
|
|
13798
|
-
} else if (event.type ===
|
|
13686
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
13799
13687
|
const message = "Maximum session turns exceeded";
|
|
13800
13688
|
if (streamFormatter) {
|
|
13801
13689
|
streamFormatter.emitEvent({
|
|
13802
|
-
type:
|
|
13690
|
+
type: "error" /* ERROR */,
|
|
13803
13691
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13804
13692
|
severity: "error",
|
|
13805
13693
|
message
|
|
13806
13694
|
});
|
|
13807
13695
|
}
|
|
13808
13696
|
warnings.push(message);
|
|
13809
|
-
} else if (event.type ===
|
|
13697
|
+
} else if (event.type === "error" /* Error */) {
|
|
13810
13698
|
throw event.value.error;
|
|
13811
|
-
} else if (event.type ===
|
|
13699
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
13812
13700
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
13813
|
-
if (config.getOutputFormat() ===
|
|
13701
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13814
13702
|
process.stderr.write(`${stopMessage}
|
|
13815
13703
|
`);
|
|
13816
13704
|
}
|
|
@@ -13818,7 +13706,7 @@ async function runNonInteractive2(params) {
|
|
|
13818
13706
|
const metrics = uiTelemetryService.getMetrics();
|
|
13819
13707
|
const durationMs = Date.now() - startTime;
|
|
13820
13708
|
streamFormatter.emitEvent({
|
|
13821
|
-
type:
|
|
13709
|
+
type: "result" /* RESULT */,
|
|
13822
13710
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13823
13711
|
status: "success",
|
|
13824
13712
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -13826,7 +13714,7 @@ async function runNonInteractive2(params) {
|
|
|
13826
13714
|
durationMs
|
|
13827
13715
|
)
|
|
13828
13716
|
});
|
|
13829
|
-
} else if (config.getOutputFormat() ===
|
|
13717
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13830
13718
|
const formatter = new JsonFormatter();
|
|
13831
13719
|
const stats = uiTelemetryService.getMetrics();
|
|
13832
13720
|
textOutput.write(
|
|
@@ -13842,23 +13730,23 @@ async function runNonInteractive2(params) {
|
|
|
13842
13730
|
textOutput.ensureTrailingNewline();
|
|
13843
13731
|
}
|
|
13844
13732
|
return;
|
|
13845
|
-
} else if (event.type ===
|
|
13733
|
+
} else if (event.type === "user_cancelled" /* UserCancelled */) {
|
|
13846
13734
|
throw new FatalCancellationError("Operation cancelled.");
|
|
13847
|
-
} else if (event.type ===
|
|
13735
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
13848
13736
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
13849
|
-
if (config.getOutputFormat() ===
|
|
13737
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13850
13738
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
13851
13739
|
`);
|
|
13852
13740
|
} else if (streamFormatter) {
|
|
13853
13741
|
streamFormatter.emitEvent({
|
|
13854
|
-
type:
|
|
13742
|
+
type: "error" /* ERROR */,
|
|
13855
13743
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13856
13744
|
severity: "warning",
|
|
13857
13745
|
message: stripAnsi(blockMessage)
|
|
13858
13746
|
});
|
|
13859
13747
|
}
|
|
13860
13748
|
warnings.push(blockMessage);
|
|
13861
|
-
} else if (event.type ===
|
|
13749
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
13862
13750
|
const eventValue = event.value;
|
|
13863
13751
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
13864
13752
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -13881,12 +13769,12 @@ async function runNonInteractive2(params) {
|
|
|
13881
13769
|
);
|
|
13882
13770
|
if (streamFormatter) {
|
|
13883
13771
|
streamFormatter.emitEvent({
|
|
13884
|
-
type:
|
|
13772
|
+
type: "error" /* ERROR */,
|
|
13885
13773
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13886
13774
|
severity: "error",
|
|
13887
13775
|
message: invalidStreamError
|
|
13888
13776
|
});
|
|
13889
|
-
} else if (config.getOutputFormat() ===
|
|
13777
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13890
13778
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
13891
13779
|
`);
|
|
13892
13780
|
}
|
|
@@ -13909,7 +13797,7 @@ async function runNonInteractive2(params) {
|
|
|
13909
13797
|
const requestInfo = completedToolCall.request;
|
|
13910
13798
|
if (streamFormatter) {
|
|
13911
13799
|
streamFormatter.emitEvent({
|
|
13912
|
-
type:
|
|
13800
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
13913
13801
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13914
13802
|
tool_id: requestInfo.callId,
|
|
13915
13803
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -13943,11 +13831,11 @@ async function runNonInteractive2(params) {
|
|
|
13943
13831
|
);
|
|
13944
13832
|
}
|
|
13945
13833
|
const stopExecutionTool = completedToolCalls.find(
|
|
13946
|
-
(tc) => tc.response.errorType ===
|
|
13834
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
13947
13835
|
);
|
|
13948
13836
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
13949
13837
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
13950
|
-
if (config.getOutputFormat() ===
|
|
13838
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
13951
13839
|
process.stderr.write(`${stopMessage}
|
|
13952
13840
|
`);
|
|
13953
13841
|
}
|
|
@@ -13955,7 +13843,7 @@ async function runNonInteractive2(params) {
|
|
|
13955
13843
|
const metrics = uiTelemetryService.getMetrics();
|
|
13956
13844
|
const durationMs = Date.now() - startTime;
|
|
13957
13845
|
streamFormatter.emitEvent({
|
|
13958
|
-
type:
|
|
13846
|
+
type: "result" /* RESULT */,
|
|
13959
13847
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13960
13848
|
status: "success",
|
|
13961
13849
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -13963,7 +13851,7 @@ async function runNonInteractive2(params) {
|
|
|
13963
13851
|
durationMs
|
|
13964
13852
|
)
|
|
13965
13853
|
});
|
|
13966
|
-
} else if (config.getOutputFormat() ===
|
|
13854
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13967
13855
|
const formatter = new JsonFormatter();
|
|
13968
13856
|
const stats = uiTelemetryService.getMetrics();
|
|
13969
13857
|
textOutput.write(
|
|
@@ -13986,12 +13874,12 @@ async function runNonInteractive2(params) {
|
|
|
13986
13874
|
const metrics = uiTelemetryService.getMetrics();
|
|
13987
13875
|
const durationMs = Date.now() - startTime;
|
|
13988
13876
|
streamFormatter.emitEvent({
|
|
13989
|
-
type:
|
|
13877
|
+
type: "result" /* RESULT */,
|
|
13990
13878
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13991
13879
|
status: invalidStreamError ? "error" : "success",
|
|
13992
13880
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
13993
13881
|
});
|
|
13994
|
-
} else if (config.getOutputFormat() ===
|
|
13882
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
13995
13883
|
const formatter = new JsonFormatter();
|
|
13996
13884
|
const stats = uiTelemetryService.getMetrics();
|
|
13997
13885
|
textOutput.write(
|
|
@@ -14015,7 +13903,7 @@ async function runNonInteractive2(params) {
|
|
|
14015
13903
|
cleanupCancellation();
|
|
14016
13904
|
scheduler?.dispose();
|
|
14017
13905
|
consolePatcher.cleanup();
|
|
14018
|
-
coreEvents.off(
|
|
13906
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
14019
13907
|
await runExitCleanup();
|
|
14020
13908
|
}
|
|
14021
13909
|
if (abortController.signal.aborted || isFatalCancellationError(errorToHandle)) {
|
|
@@ -16380,11 +16268,11 @@ var Session = class {
|
|
|
16380
16268
|
this.connection = connection;
|
|
16381
16269
|
this.settings = settings;
|
|
16382
16270
|
coreEvents.on(
|
|
16383
|
-
|
|
16271
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
16384
16272
|
this.handleApprovalModeChanged
|
|
16385
16273
|
);
|
|
16386
16274
|
this.context.config.getMessageBus()?.subscribe(
|
|
16387
|
-
|
|
16275
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
16388
16276
|
this.handleToolConfirmationRequest,
|
|
16389
16277
|
{ signal: this.disposeController.signal }
|
|
16390
16278
|
);
|
|
@@ -16408,7 +16296,7 @@ var Session = class {
|
|
|
16408
16296
|
"Policy engine missing. Denying tool confirmation request."
|
|
16409
16297
|
);
|
|
16410
16298
|
await messageBus.publish({
|
|
16411
|
-
type:
|
|
16299
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
16412
16300
|
correlationId: request.correlationId,
|
|
16413
16301
|
confirmed: false,
|
|
16414
16302
|
requiresUserConfirmation: false
|
|
@@ -16421,7 +16309,7 @@ var Session = class {
|
|
|
16421
16309
|
"Tool confirmation request missing tool name. Denying."
|
|
16422
16310
|
);
|
|
16423
16311
|
await messageBus.publish({
|
|
16424
|
-
type:
|
|
16312
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
16425
16313
|
correlationId: request.correlationId,
|
|
16426
16314
|
confirmed: false,
|
|
16427
16315
|
requiresUserConfirmation: false
|
|
@@ -16434,7 +16322,7 @@ var Session = class {
|
|
|
16434
16322
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
16435
16323
|
);
|
|
16436
16324
|
await messageBus.publish({
|
|
16437
|
-
type:
|
|
16325
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
16438
16326
|
correlationId: request.correlationId,
|
|
16439
16327
|
confirmed: false,
|
|
16440
16328
|
requiresUserConfirmation: false
|
|
@@ -16450,15 +16338,15 @@ var Session = class {
|
|
|
16450
16338
|
request.subagent
|
|
16451
16339
|
);
|
|
16452
16340
|
await messageBus.publish({
|
|
16453
|
-
type:
|
|
16341
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
16454
16342
|
correlationId: request.correlationId,
|
|
16455
|
-
confirmed: result.decision ===
|
|
16456
|
-
requiresUserConfirmation: result.decision ===
|
|
16343
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
16344
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
16457
16345
|
});
|
|
16458
16346
|
} catch (error) {
|
|
16459
16347
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
16460
16348
|
await this.context.config.getMessageBus()?.publish({
|
|
16461
|
-
type:
|
|
16349
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
16462
16350
|
correlationId: request.correlationId,
|
|
16463
16351
|
confirmed: false,
|
|
16464
16352
|
requiresUserConfirmation: false
|
|
@@ -16478,7 +16366,7 @@ var Session = class {
|
|
|
16478
16366
|
};
|
|
16479
16367
|
async dispose() {
|
|
16480
16368
|
coreEvents.off(
|
|
16481
|
-
|
|
16369
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
16482
16370
|
this.handleApprovalModeChanged
|
|
16483
16371
|
);
|
|
16484
16372
|
this.disposeController.abort();
|
|
@@ -16574,7 +16462,7 @@ ${thought.description}`;
|
|
|
16574
16462
|
await this.sendUpdate({
|
|
16575
16463
|
sessionUpdate: "tool_call",
|
|
16576
16464
|
toolCallId: toolCall.id,
|
|
16577
|
-
status: toolCall.status ===
|
|
16465
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
16578
16466
|
title: toolCall.displayName || toolCall.name,
|
|
16579
16467
|
content: toolCallContent,
|
|
16580
16468
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -16683,7 +16571,7 @@ ${thought.description}`;
|
|
|
16683
16571
|
return { stopReason: "cancelled" };
|
|
16684
16572
|
}
|
|
16685
16573
|
switch (event.type) {
|
|
16686
|
-
case
|
|
16574
|
+
case "content" /* Content */: {
|
|
16687
16575
|
const content = {
|
|
16688
16576
|
type: "text",
|
|
16689
16577
|
text: event.value
|
|
@@ -16694,7 +16582,7 @@ ${thought.description}`;
|
|
|
16694
16582
|
});
|
|
16695
16583
|
break;
|
|
16696
16584
|
}
|
|
16697
|
-
case
|
|
16585
|
+
case "thought" /* Thought */: {
|
|
16698
16586
|
const thoughtText = `**${event.value.subject}**
|
|
16699
16587
|
${event.value.description}`;
|
|
16700
16588
|
await this.sendUpdate({
|
|
@@ -16703,10 +16591,10 @@ ${event.value.description}`;
|
|
|
16703
16591
|
});
|
|
16704
16592
|
break;
|
|
16705
16593
|
}
|
|
16706
|
-
case
|
|
16594
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
16707
16595
|
toolCallRequests.push(event.value);
|
|
16708
16596
|
break;
|
|
16709
|
-
case
|
|
16597
|
+
case "finished" /* Finished */: {
|
|
16710
16598
|
const usage2 = event.value.usageMetadata;
|
|
16711
16599
|
if (usage2) {
|
|
16712
16600
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -16723,19 +16611,19 @@ ${event.value.description}`;
|
|
|
16723
16611
|
}
|
|
16724
16612
|
break;
|
|
16725
16613
|
}
|
|
16726
|
-
case
|
|
16614
|
+
case "model_info" /* ModelInfo */:
|
|
16727
16615
|
turnModelId = event.value;
|
|
16728
16616
|
break;
|
|
16729
|
-
case
|
|
16617
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
16730
16618
|
stopReason = "max_turn_requests";
|
|
16731
16619
|
break;
|
|
16732
|
-
case
|
|
16620
|
+
case "loop_detected" /* LoopDetected */:
|
|
16733
16621
|
stopReason = "max_turn_requests";
|
|
16734
16622
|
break;
|
|
16735
|
-
case
|
|
16623
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
16736
16624
|
stopReason = "max_tokens";
|
|
16737
16625
|
break;
|
|
16738
|
-
case
|
|
16626
|
+
case "error" /* Error */: {
|
|
16739
16627
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
16740
16628
|
event.value.error
|
|
16741
16629
|
);
|
|
@@ -16926,7 +16814,7 @@ ${event.value.description}`;
|
|
|
16926
16814
|
const output = RequestPermissionResponseSchema.parse(
|
|
16927
16815
|
await this.connection.requestPermission(params)
|
|
16928
16816
|
);
|
|
16929
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
16817
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
16930
16818
|
await confirmationDetails.onConfirm(outcome);
|
|
16931
16819
|
await updatePolicy(
|
|
16932
16820
|
tool,
|
|
@@ -16937,7 +16825,7 @@ ${event.value.description}`;
|
|
|
16937
16825
|
invocation
|
|
16938
16826
|
);
|
|
16939
16827
|
switch (outcome) {
|
|
16940
|
-
case
|
|
16828
|
+
case "cancel" /* Cancel */: {
|
|
16941
16829
|
const cancelError = new Error(
|
|
16942
16830
|
`Tool "${fc.name}" was canceled by the user.`
|
|
16943
16831
|
);
|
|
@@ -16955,12 +16843,12 @@ ${event.value.description}`;
|
|
|
16955
16843
|
});
|
|
16956
16844
|
return errorResponse(cancelError);
|
|
16957
16845
|
}
|
|
16958
|
-
case
|
|
16959
|
-
case
|
|
16960
|
-
case
|
|
16961
|
-
case
|
|
16962
|
-
case
|
|
16963
|
-
case
|
|
16846
|
+
case "proceed_once" /* ProceedOnce */:
|
|
16847
|
+
case "proceed_always" /* ProceedAlways */:
|
|
16848
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
16849
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
16850
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
16851
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
16964
16852
|
break;
|
|
16965
16853
|
default: {
|
|
16966
16854
|
const resultOutcome = outcome;
|
|
@@ -17014,7 +16902,7 @@ ${event.value.description}`;
|
|
|
17014
16902
|
);
|
|
17015
16903
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
17016
16904
|
{
|
|
17017
|
-
status:
|
|
16905
|
+
status: "success" /* Success */,
|
|
17018
16906
|
request: {
|
|
17019
16907
|
callId,
|
|
17020
16908
|
name: fc.name,
|
|
@@ -17059,7 +16947,7 @@ ${event.value.description}`;
|
|
|
17059
16947
|
});
|
|
17060
16948
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
17061
16949
|
{
|
|
17062
|
-
status:
|
|
16950
|
+
status: "error" /* Error */,
|
|
17063
16951
|
request: {
|
|
17064
16952
|
callId,
|
|
17065
16953
|
name: fc.name,
|
|
@@ -17188,12 +17076,12 @@ ${event.value.description}`;
|
|
|
17188
17076
|
sessionId: this.id,
|
|
17189
17077
|
options: [
|
|
17190
17078
|
{
|
|
17191
|
-
optionId:
|
|
17079
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
17192
17080
|
name: "Allow once",
|
|
17193
17081
|
kind: "allow_once"
|
|
17194
17082
|
},
|
|
17195
17083
|
{
|
|
17196
|
-
optionId:
|
|
17084
|
+
optionId: "cancel" /* Cancel */,
|
|
17197
17085
|
name: "Deny",
|
|
17198
17086
|
kind: "reject_once"
|
|
17199
17087
|
}
|
|
@@ -17218,8 +17106,8 @@ ${event.value.description}`;
|
|
|
17218
17106
|
const output = RequestPermissionResponseSchema.parse(
|
|
17219
17107
|
await this.connection.requestPermission(params)
|
|
17220
17108
|
);
|
|
17221
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
17222
|
-
if (outcome ===
|
|
17109
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
17110
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
17223
17111
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
17224
17112
|
validationError = null;
|
|
17225
17113
|
} else {
|
|
@@ -17660,7 +17548,7 @@ var AcpSessionManager = class {
|
|
|
17660
17548
|
mcpServers,
|
|
17661
17549
|
loadedSettings
|
|
17662
17550
|
);
|
|
17663
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
17551
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
17664
17552
|
let isAuthenticated = false;
|
|
17665
17553
|
let authErrorMessage = "";
|
|
17666
17554
|
try {
|
|
@@ -17672,7 +17560,7 @@ var AcpSessionManager = class {
|
|
|
17672
17560
|
);
|
|
17673
17561
|
isAuthenticated = true;
|
|
17674
17562
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
17675
|
-
if (authType ===
|
|
17563
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
17676
17564
|
isAuthenticated = false;
|
|
17677
17565
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
17678
17566
|
}
|
|
@@ -17826,11 +17714,9 @@ var AcpSessionManager = class {
|
|
|
17826
17714
|
currentModelId
|
|
17827
17715
|
}
|
|
17828
17716
|
};
|
|
17829
|
-
|
|
17830
|
-
await session.streamHistory(messages);
|
|
17831
|
-
} catch (err) {
|
|
17717
|
+
session.streamHistory(messages).catch((err) => {
|
|
17832
17718
|
debugLogger.error(`Error streaming history: ${err}`);
|
|
17833
|
-
}
|
|
17719
|
+
});
|
|
17834
17720
|
setTimeout(() => {
|
|
17835
17721
|
session?.sendAvailableCommands().catch((err) => {
|
|
17836
17722
|
debugLogger.error(`Error sending available commands: ${err}`);
|
|
@@ -17858,7 +17744,7 @@ var AcpSessionManager = class {
|
|
|
17858
17744
|
}
|
|
17859
17745
|
}
|
|
17860
17746
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
17861
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
17747
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
17862
17748
|
if (!selectedAuthType) {
|
|
17863
17749
|
throw RequestError.authRequired();
|
|
17864
17750
|
}
|
|
@@ -17970,12 +17856,12 @@ var GeminiAgent = class {
|
|
|
17970
17856
|
}
|
|
17971
17857
|
const authMethods = [
|
|
17972
17858
|
{
|
|
17973
|
-
id:
|
|
17859
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
17974
17860
|
name: "Log in with Google",
|
|
17975
17861
|
description: "Log in with your Google account"
|
|
17976
17862
|
},
|
|
17977
17863
|
{
|
|
17978
|
-
id:
|
|
17864
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
17979
17865
|
name: "Gemini API key",
|
|
17980
17866
|
description: "Use an API key with Gemini Developer API",
|
|
17981
17867
|
_meta: {
|
|
@@ -17985,12 +17871,12 @@ var GeminiAgent = class {
|
|
|
17985
17871
|
}
|
|
17986
17872
|
},
|
|
17987
17873
|
{
|
|
17988
|
-
id:
|
|
17874
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
17989
17875
|
name: "Vertex AI",
|
|
17990
17876
|
description: "Use an API key with Vertex AI GenAI API"
|
|
17991
17877
|
},
|
|
17992
17878
|
{
|
|
17993
|
-
id:
|
|
17879
|
+
id: "gateway" /* GATEWAY */,
|
|
17994
17880
|
name: "AI API Gateway",
|
|
17995
17881
|
description: "Use a custom AI API Gateway",
|
|
17996
17882
|
_meta: {
|
|
@@ -18163,7 +18049,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
18163
18049
|
}
|
|
18164
18050
|
return authType;
|
|
18165
18051
|
} catch (error) {
|
|
18166
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
18052
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
18167
18053
|
handleError(
|
|
18168
18054
|
error instanceof Error ? error : new Error(String(error)),
|
|
18169
18055
|
nonInteractiveConfig,
|
|
@@ -18361,10 +18247,10 @@ var SlashCommandConflictHandler = class {
|
|
|
18361
18247
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
18362
18248
|
}
|
|
18363
18249
|
start() {
|
|
18364
|
-
coreEvents.on(
|
|
18250
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
18365
18251
|
}
|
|
18366
18252
|
stop() {
|
|
18367
|
-
coreEvents.off(
|
|
18253
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
18368
18254
|
if (this.flushTimeout) {
|
|
18369
18255
|
clearTimeout(this.flushTimeout);
|
|
18370
18256
|
this.flushTimeout = null;
|
|
@@ -18739,7 +18625,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
18739
18625
|
}
|
|
18740
18626
|
}
|
|
18741
18627
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
18742
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
18628
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-F2YYMYTP.js");
|
|
18743
18629
|
await doStartUI(
|
|
18744
18630
|
config,
|
|
18745
18631
|
settings,
|
|
@@ -18842,12 +18728,12 @@ async function main() {
|
|
|
18842
18728
|
dns.setDefaultResultOrder(
|
|
18843
18729
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
18844
18730
|
);
|
|
18845
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
18731
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
18846
18732
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
18847
18733
|
settings.setValue(
|
|
18848
18734
|
"User" /* User */,
|
|
18849
18735
|
"security.auth.selectedType",
|
|
18850
|
-
|
|
18736
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
18851
18737
|
);
|
|
18852
18738
|
}
|
|
18853
18739
|
}
|
|
@@ -18964,7 +18850,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
18964
18850
|
await config.storage.initialize();
|
|
18965
18851
|
adminControlsListner.setConfig(config);
|
|
18966
18852
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
18967
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
18853
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-EFJXZRFD.js");
|
|
18968
18854
|
setupInitialActivityLogger(config);
|
|
18969
18855
|
}
|
|
18970
18856
|
registerTelemetryConfig(config);
|
|
@@ -18972,7 +18858,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
18972
18858
|
const messageBus = config.getMessageBus();
|
|
18973
18859
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
18974
18860
|
registerCleanup(async () => {
|
|
18975
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
18861
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
18976
18862
|
});
|
|
18977
18863
|
if (!config.getAcpMode()) {
|
|
18978
18864
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -19023,7 +18909,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19023
18909
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
19024
18910
|
const initializationResult = await initializeApp(config, settings);
|
|
19025
18911
|
initAppHandle?.end();
|
|
19026
|
-
import("./liteRtServerManager-
|
|
18912
|
+
import("./liteRtServerManager-27R2M6XE.js").then(({ LiteRtServerManager }) => {
|
|
19027
18913
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
19028
18914
|
if (!mergedGemma) return;
|
|
19029
18915
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -19033,7 +18919,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19033
18919
|
autoStartServer: userGemma?.autoStartServer
|
|
19034
18920
|
});
|
|
19035
18921
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
19036
|
-
if (settings.merged.security.auth.selectedType ===
|
|
18922
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
19037
18923
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
19038
18924
|
}
|
|
19039
18925
|
if (config.getAcpMode()) {
|
|
@@ -19049,7 +18935,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19049
18935
|
...rawStartupWarnings.map((message) => ({
|
|
19050
18936
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
19051
18937
|
message,
|
|
19052
|
-
priority:
|
|
18938
|
+
priority: "high" /* High */
|
|
19053
18939
|
})),
|
|
19054
18940
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
19055
18941
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -19086,7 +18972,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
19086
18972
|
${input}` : stdinData;
|
|
19087
18973
|
}
|
|
19088
18974
|
}
|
|
19089
|
-
const sessionStartSource = resumedSessionData ?
|
|
18975
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
19090
18976
|
const hookSystem = config?.getHookSystem();
|
|
19091
18977
|
if (hookSystem) {
|
|
19092
18978
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -19143,8 +19029,8 @@ ${input}` : wrappedContext;
|
|
|
19143
19029
|
}
|
|
19144
19030
|
}
|
|
19145
19031
|
function initializeOutputListenersAndFlush(config) {
|
|
19146
|
-
if (coreEvents.listenerCount(
|
|
19147
|
-
coreEvents.on(
|
|
19032
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
19033
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
19148
19034
|
if (payload.isStderr) {
|
|
19149
19035
|
writeToStderr(payload.chunk, payload.encoding);
|
|
19150
19036
|
} else {
|
|
@@ -19152,8 +19038,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19152
19038
|
}
|
|
19153
19039
|
});
|
|
19154
19040
|
}
|
|
19155
|
-
if (coreEvents.listenerCount(
|
|
19156
|
-
coreEvents.on(
|
|
19041
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
19042
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
19157
19043
|
if (payload.type === "error" || payload.type === "warn") {
|
|
19158
19044
|
writeToStderr(payload.content + "\n");
|
|
19159
19045
|
} else {
|
|
@@ -19161,8 +19047,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19161
19047
|
}
|
|
19162
19048
|
});
|
|
19163
19049
|
}
|
|
19164
|
-
if (coreEvents.listenerCount(
|
|
19165
|
-
coreEvents.on(
|
|
19050
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
19051
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
19166
19052
|
writeToStderr(payload.message + "\n");
|
|
19167
19053
|
});
|
|
19168
19054
|
}
|
|
@@ -19170,7 +19056,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
19170
19056
|
const forceToStderr = outputFormat === "json";
|
|
19171
19057
|
coreEvents.drainBacklogs(
|
|
19172
19058
|
(event, args) => {
|
|
19173
|
-
if (forceToStderr && event ===
|
|
19059
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
19174
19060
|
const payload = args[0];
|
|
19175
19061
|
if (!payload.isStderr) {
|
|
19176
19062
|
return {
|