@google/gemini-cli 0.65.0-nightly.20261013.g51617c1bc → 0.65.0-preview.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/bundle/{chunk-BXWN65YH.js → chunk-2WVLIJA5.js} +1 -1
- package/bundle/{chunk-5322VSKQ.js → chunk-43EXRO7A.js} +1 -1
- package/bundle/{chunk-3EFBILEW.js → chunk-4DCA4L53.js} +2 -2
- package/bundle/{chunk-NAGGT65S.js → chunk-4JGVVJGK.js} +1 -1
- package/bundle/{chunk-VJXI22NX.js → chunk-BFIV7GTA.js} +2 -2
- package/bundle/{chunk-NJIZWOAO.js → chunk-F6AJM4WN.js} +3 -3
- package/bundle/{chunk-EPXYFN6C.js → chunk-GSQEBEGC.js} +3 -3
- package/bundle/{chunk-SSAL6PAH.js → chunk-H2CZXS7F.js} +1 -1
- package/bundle/{chunk-76GSGGHI.js → chunk-HLOOE7YN.js} +1 -1
- package/bundle/{chunk-ZZJRXUDM.js → chunk-K4G5D5ZZ.js} +1 -1
- package/bundle/{chunk-B22AOTUS.js → chunk-K7AA35SP.js} +26 -22
- package/bundle/{chunk-HVVLEMLR.js → chunk-K7NOVQ6G.js} +24 -20
- package/bundle/{chunk-C3XVWXTB.js → chunk-LLE5Z636.js} +7 -7
- package/bundle/{chunk-KR7RUPIE.js → chunk-NL7ZHGCH.js} +1 -1
- package/bundle/{chunk-6M4QEFFF.js → chunk-QJK54DSE.js} +8 -9
- package/bundle/{chunk-EA2F2LNY.js → chunk-RPHDSDL6.js} +1 -1
- package/bundle/{chunk-LBJNFX6K.js → chunk-S7BCRBI4.js} +1 -1
- package/bundle/{chunk-LB7T3Q3K.js → chunk-SN7QZKXC.js} +58 -71
- package/bundle/{chunk-GI5HEZHG.js → chunk-TP236FKO.js} +14976 -7914
- package/bundle/{chunk-LJV6OKHI.js → chunk-V2R74WAG.js} +5 -7
- package/bundle/{chunk-VLEIPZMF.js → chunk-V72FRESD.js} +2 -2
- package/bundle/{chunk-N2N4FSJX.js → chunk-VF5WQSOE.js} +1 -1
- package/bundle/{chunk-5OZJ7SSG.js → chunk-WGL5FJOS.js} +3 -3
- package/bundle/{chunk-JCR3XD5H.js → chunk-WTRK3NVX.js} +7 -7
- package/bundle/{cleanup-C3GRMYTQ.js → cleanup-HPADDONA.js} +2 -2
- package/bundle/{cleanup-HHEU7BTA.js → cleanup-JOMSXKMP.js} +2 -2
- package/bundle/{cleanup-VCQCBVRV.js → cleanup-LYRJHMMO.js} +2 -2
- package/bundle/{core-EX2SPRDZ.js → core-IVQAI4S6.js} +1 -1
- package/bundle/{dist-GG436DD3.js → core-NCJTYARO.js} +1 -1
- package/bundle/{devtoolsService-OI7AEJQC.js → devtoolsService-HIZA3JGR.js} +2 -2
- package/bundle/{devtoolsService-E3YLHACW.js → devtoolsService-JFJBTZ4B.js} +3 -4
- package/bundle/{devtoolsService-CSRUFNFL.js → devtoolsService-WP2OPVPB.js} +2 -2
- package/bundle/{dist-MRDCUCIF.js → dist-GQKLLBDW.js} +1 -1
- package/bundle/{gemini-TWP2M62H.js → gemini-546WMAHG.js} +198 -214
- package/bundle/{gemini-W7O4SF3Y.js → gemini-5TUKZVGS.js} +14 -14
- package/bundle/{gemini-GG2HNQFT.js → gemini-7CHJYSHM.js} +13 -13
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-3Y2RHZKF.js → interactiveCli-5XIAIY74.js} +1069 -554
- package/bundle/{interactiveCli-GBXKC6IY.js → interactiveCli-E3PUPYMZ.js} +1069 -554
- package/bundle/{interactiveCli-E5RBGMKR.js → interactiveCli-L4PK7YY3.js} +1348 -852
- package/bundle/{liteRtServerManager-BV7LQRJK.js → liteRtServerManager-22ISMNN2.js} +4 -4
- package/bundle/{liteRtServerManager-EW5TUX2V.js → liteRtServerManager-JCTYJBV5.js} +4 -4
- package/bundle/{liteRtServerManager-G3ETQGQD.js → liteRtServerManager-JERG6KYC.js} +4 -4
- package/bundle/{oauth2-provider-NVW65VJA.js → oauth2-provider-477UJQX6.js} +1 -1
- package/bundle/{oauth2-provider-6Z2ZXOX6.js → oauth2-provider-MKWWBW4K.js} +79 -41
- package/bundle/{oauth2-provider-4CXU66CN.js → oauth2-provider-XRUER2XR.js} +1 -1
- package/bundle/{start-AZFYLAF2.js → start-AGMBPY3O.js} +6 -6
- package/bundle/{start-BHB4KDHO.js → start-MVIPJNQ5.js} +6 -6
- package/bundle/{start-CHWZQ4ZN.js → start-RZWSVT55.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-5YND2HLC.js +0 -1571
- package/bundle/chunk-IJ7X4I2Z.js +0 -425
- package/bundle/chunk-K6N5Z54J.js +0 -154
- package/bundle/chunk-LZISQJNJ.js +0 -512
- package/bundle/chunk-OB6IRF7N.js +0 -118
- package/bundle/chunk-TLYQMFOC.js +0 -17535
- package/bundle/chunk-UVUPZGTC.js +0 -402042
- package/bundle/chunk-XHQIF7OW.js +0 -103253
- package/bundle/cleanup-XUHY5LXE.js +0 -32
- package/bundle/devtoolsService-NB2AMKES.js +0 -4359
- package/bundle/dist-O7VOOHX4.js +0 -2268
- package/bundle/gemini-UZP4MEXP.js +0 -17951
- package/bundle/interactiveCli-R3ZT6N5Z.js +0 -35014
- package/bundle/liteRtServerManager-YM2L7SJG.js +0 -65
- package/bundle/oauth2-provider-VEKJJAQ2.js +0 -273
- package/bundle/start-NJW6EU4P.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-WGL5FJOS.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-LLE5Z636.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-4JGVVJGK.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -89,11 +89,11 @@ import {
|
|
|
89
89
|
resolveGemmaConfig,
|
|
90
90
|
saveModelChange,
|
|
91
91
|
stripAnsi
|
|
92
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-43EXRO7A.js";
|
|
93
93
|
import {
|
|
94
94
|
RELAUNCH_EXIT_CODE
|
|
95
|
-
} from "./chunk-
|
|
96
|
-
import "./chunk-
|
|
95
|
+
} from "./chunk-V72FRESD.js";
|
|
96
|
+
import "./chunk-HLOOE7YN.js";
|
|
97
97
|
import {
|
|
98
98
|
cleanupCheckpoints,
|
|
99
99
|
registerCleanup,
|
|
@@ -102,15 +102,12 @@ import {
|
|
|
102
102
|
runExitCleanup,
|
|
103
103
|
runSyncCleanup,
|
|
104
104
|
setupSignalHandlers
|
|
105
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-VF5WQSOE.js";
|
|
106
106
|
import {
|
|
107
107
|
ASK_USER_TOOL_NAME,
|
|
108
|
-
ApprovalMode,
|
|
109
108
|
AuthType,
|
|
110
109
|
Client,
|
|
111
110
|
Config,
|
|
112
|
-
CoreEvent,
|
|
113
|
-
CoreToolCallStatus,
|
|
114
111
|
DEFAULT_CONTEXT_FILENAME,
|
|
115
112
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
116
113
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -132,27 +129,19 @@ import {
|
|
|
132
129
|
FolderTrustDiscoveryService,
|
|
133
130
|
GEMINI_DIR,
|
|
134
131
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
135
|
-
GeminiEventType,
|
|
136
132
|
IdeClient,
|
|
137
|
-
IntegrityStatus,
|
|
138
133
|
InvalidStreamError,
|
|
139
134
|
JsonFormatter,
|
|
140
|
-
JsonStreamEventType,
|
|
141
|
-
Kind,
|
|
142
135
|
LegacyAgentSession,
|
|
143
136
|
Logger,
|
|
144
137
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
145
138
|
MCPServerConfig,
|
|
146
|
-
MCPServerStatus,
|
|
147
|
-
MessageBusType,
|
|
148
139
|
OTHER_BLOCKED_MESSAGE,
|
|
149
|
-
OutputFormat,
|
|
150
140
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
151
141
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
152
142
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
153
143
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
154
144
|
PREVIEW_GEMINI_MODEL,
|
|
155
|
-
PolicyDecision,
|
|
156
145
|
PolicyIntegrityManager,
|
|
157
146
|
RECITATION_BLOCKED_MESSAGE,
|
|
158
147
|
REFERENCE_CONTENT_START,
|
|
@@ -160,8 +149,6 @@ import {
|
|
|
160
149
|
ReadManyFilesTool,
|
|
161
150
|
SAFETY_BLOCKED_MESSAGE,
|
|
162
151
|
Scheduler,
|
|
163
|
-
SessionEndReason,
|
|
164
|
-
SessionStartSource,
|
|
165
152
|
ShellExecutionService,
|
|
166
153
|
SimpleExtensionLoader,
|
|
167
154
|
Storage,
|
|
@@ -170,13 +157,10 @@ import {
|
|
|
170
157
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
171
158
|
ToolCallEvent,
|
|
172
159
|
ToolConfirmationOutcome,
|
|
173
|
-
ToolErrorType,
|
|
174
|
-
TrustLevel,
|
|
175
160
|
UserAccountManager,
|
|
176
161
|
UserPromptEvent,
|
|
177
162
|
ValidationCancelledError,
|
|
178
163
|
ValidationRequiredError,
|
|
179
|
-
WarningPriority,
|
|
180
164
|
applyAdminAllowlist,
|
|
181
165
|
applyRequiredServers,
|
|
182
166
|
clearCachedCredentialFile,
|
|
@@ -257,7 +241,7 @@ import {
|
|
|
257
241
|
updatePolicy,
|
|
258
242
|
writeToStderr,
|
|
259
243
|
writeToStdout
|
|
260
|
-
} from "./chunk-
|
|
244
|
+
} from "./chunk-TP236FKO.js";
|
|
261
245
|
import "./chunk-664ZODQF.js";
|
|
262
246
|
import "./chunk-IUUIT4SU.js";
|
|
263
247
|
import "./chunk-L6PII3GR.js";
|
|
@@ -5406,7 +5390,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5406
5390
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5407
5391
|
const isStdio = !!config.command;
|
|
5408
5392
|
if (isStdio && !isTrusted) {
|
|
5409
|
-
return
|
|
5393
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5410
5394
|
}
|
|
5411
5395
|
const client = new Client({
|
|
5412
5396
|
name: "mcp-test-client",
|
|
@@ -5442,7 +5426,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5442
5426
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5443
5427
|
} catch {
|
|
5444
5428
|
await client.close();
|
|
5445
|
-
return
|
|
5429
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5446
5430
|
}
|
|
5447
5431
|
try {
|
|
5448
5432
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5456,10 +5440,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5456
5440
|
);
|
|
5457
5441
|
}
|
|
5458
5442
|
await client.close();
|
|
5459
|
-
return
|
|
5443
|
+
return "connected" /* CONNECTED */;
|
|
5460
5444
|
} catch {
|
|
5461
5445
|
await transport.close();
|
|
5462
|
-
return
|
|
5446
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5463
5447
|
}
|
|
5464
5448
|
}
|
|
5465
5449
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5472,12 +5456,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5472
5456
|
});
|
|
5473
5457
|
if (!loadResult.allowed) {
|
|
5474
5458
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5475
|
-
return
|
|
5459
|
+
return "blocked" /* BLOCKED */;
|
|
5476
5460
|
}
|
|
5477
|
-
return
|
|
5461
|
+
return "disabled" /* DISABLED */;
|
|
5478
5462
|
}
|
|
5479
5463
|
if (!isTrusted) {
|
|
5480
|
-
return
|
|
5464
|
+
return "disabled" /* DISABLED */;
|
|
5481
5465
|
}
|
|
5482
5466
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5483
5467
|
}
|
|
@@ -5523,23 +5507,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5523
5507
|
let statusIndicator = "";
|
|
5524
5508
|
let statusText = "";
|
|
5525
5509
|
switch (status) {
|
|
5526
|
-
case
|
|
5510
|
+
case "connected" /* CONNECTED */:
|
|
5527
5511
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5528
5512
|
statusText = "Connected";
|
|
5529
5513
|
break;
|
|
5530
|
-
case
|
|
5514
|
+
case "connecting" /* CONNECTING */:
|
|
5531
5515
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5532
5516
|
statusText = "Connecting";
|
|
5533
5517
|
break;
|
|
5534
|
-
case
|
|
5518
|
+
case "blocked" /* BLOCKED */:
|
|
5535
5519
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5536
5520
|
statusText = "Blocked";
|
|
5537
5521
|
break;
|
|
5538
|
-
case
|
|
5522
|
+
case "disabled" /* DISABLED */:
|
|
5539
5523
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5540
5524
|
statusText = "Disabled";
|
|
5541
5525
|
break;
|
|
5542
|
-
case
|
|
5526
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5543
5527
|
default:
|
|
5544
5528
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5545
5529
|
statusText = "Disconnected";
|
|
@@ -5825,7 +5809,7 @@ async function handleInstall(args) {
|
|
|
5825
5809
|
);
|
|
5826
5810
|
if (confirmed) {
|
|
5827
5811
|
const trustedFolders = loadTrustedFolders();
|
|
5828
|
-
await trustedFolders.setValue(realPath,
|
|
5812
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5829
5813
|
} else {
|
|
5830
5814
|
throw new Error(
|
|
5831
5815
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7876,7 +7860,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7876
7860
|
}
|
|
7877
7861
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7878
7862
|
const packageJson = await getPackageJson(__dirname3);
|
|
7879
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.65.0-
|
|
7863
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.65.0-preview.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7880
7864
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7881
7865
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7882
7866
|
}
|
|
@@ -7935,9 +7919,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7935
7919
|
cwd,
|
|
7936
7920
|
potentialWorkspacePoliciesDir
|
|
7937
7921
|
);
|
|
7938
|
-
if (integrityResult.status ===
|
|
7922
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7939
7923
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7940
|
-
} else if (integrityResult.status ===
|
|
7924
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7941
7925
|
workspacePoliciesDir = void 0;
|
|
7942
7926
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7943
7927
|
policyUpdateConfirmationRequest = {
|
|
@@ -8365,23 +8349,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8365
8349
|
if (rawApprovalMode) {
|
|
8366
8350
|
switch (rawApprovalMode) {
|
|
8367
8351
|
case "yolo":
|
|
8368
|
-
approvalMode =
|
|
8352
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8369
8353
|
break;
|
|
8370
8354
|
case "auto_edit":
|
|
8371
|
-
approvalMode =
|
|
8355
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8372
8356
|
break;
|
|
8373
8357
|
case "plan":
|
|
8374
8358
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8375
8359
|
debugLogger.warn(
|
|
8376
8360
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8377
8361
|
);
|
|
8378
|
-
approvalMode =
|
|
8362
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8379
8363
|
} else {
|
|
8380
|
-
approvalMode =
|
|
8364
|
+
approvalMode = "plan" /* PLAN */;
|
|
8381
8365
|
}
|
|
8382
8366
|
break;
|
|
8383
8367
|
case "default":
|
|
8384
|
-
approvalMode =
|
|
8368
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8385
8369
|
break;
|
|
8386
8370
|
default:
|
|
8387
8371
|
throw new Error(
|
|
@@ -8389,10 +8373,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8389
8373
|
);
|
|
8390
8374
|
}
|
|
8391
8375
|
} else {
|
|
8392
|
-
approvalMode =
|
|
8376
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8393
8377
|
}
|
|
8394
8378
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8395
|
-
if (approvalMode ===
|
|
8379
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8396
8380
|
if (settings.admin?.secureModeEnabled) {
|
|
8397
8381
|
debugLogger.error(
|
|
8398
8382
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8410,16 +8394,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8410
8394
|
)
|
|
8411
8395
|
);
|
|
8412
8396
|
}
|
|
8413
|
-
} else if (approvalMode ===
|
|
8397
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8414
8398
|
debugLogger.warn(
|
|
8415
8399
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8416
8400
|
);
|
|
8417
8401
|
}
|
|
8418
|
-
if (!trustedFolder && approvalMode !==
|
|
8402
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8419
8403
|
debugLogger.warn(
|
|
8420
8404
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8421
8405
|
);
|
|
8422
|
-
approvalMode =
|
|
8406
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8423
8407
|
}
|
|
8424
8408
|
let telemetrySettings;
|
|
8425
8409
|
try {
|
|
@@ -11120,7 +11104,7 @@ import path10 from "node:path";
|
|
|
11120
11104
|
import process4 from "node:process";
|
|
11121
11105
|
var homeDirectoryCheck = {
|
|
11122
11106
|
id: "home-directory",
|
|
11123
|
-
priority:
|
|
11107
|
+
priority: "low" /* Low */,
|
|
11124
11108
|
check: async (workspaceRoot, settings) => {
|
|
11125
11109
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
11126
11110
|
return null;
|
|
@@ -11144,7 +11128,7 @@ var homeDirectoryCheck = {
|
|
|
11144
11128
|
};
|
|
11145
11129
|
var rootDirectoryCheck = {
|
|
11146
11130
|
id: "root-directory",
|
|
11147
|
-
priority:
|
|
11131
|
+
priority: "high" /* High */,
|
|
11148
11132
|
check: async (workspaceRoot, _settings) => {
|
|
11149
11133
|
try {
|
|
11150
11134
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -11160,7 +11144,7 @@ var rootDirectoryCheck = {
|
|
|
11160
11144
|
};
|
|
11161
11145
|
var folderTrustCheck = {
|
|
11162
11146
|
id: "folder-trust",
|
|
11163
|
-
priority:
|
|
11147
|
+
priority: "high" /* High */,
|
|
11164
11148
|
check: async (workspaceRoot, settings) => {
|
|
11165
11149
|
if (!isFolderTrustEnabled(settings)) {
|
|
11166
11150
|
return null;
|
|
@@ -11350,12 +11334,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
11350
11334
|
error,
|
|
11351
11335
|
config.getContentGeneratorConfig()?.authType
|
|
11352
11336
|
);
|
|
11353
|
-
if (config.getOutputFormat() ===
|
|
11337
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11354
11338
|
const streamFormatter = new StreamJsonFormatter();
|
|
11355
11339
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11356
11340
|
const metrics = uiTelemetryService.getMetrics();
|
|
11357
11341
|
streamFormatter.emitEvent({
|
|
11358
|
-
type:
|
|
11342
|
+
type: "result" /* RESULT */,
|
|
11359
11343
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11360
11344
|
status: "error",
|
|
11361
11345
|
error: {
|
|
@@ -11366,7 +11350,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
11366
11350
|
});
|
|
11367
11351
|
runSyncCleanup();
|
|
11368
11352
|
process.exit(getNumericExitCode(errorCode));
|
|
11369
|
-
} else if (config.getOutputFormat() ===
|
|
11353
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11370
11354
|
const formatter = new JsonFormatter();
|
|
11371
11355
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11372
11356
|
const formattedError = formatter.formatError(
|
|
@@ -11386,11 +11370,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11386
11370
|
const isFatal = isFatalToolError(errorType);
|
|
11387
11371
|
if (isFatal) {
|
|
11388
11372
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
11389
|
-
if (config.getOutputFormat() ===
|
|
11373
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11390
11374
|
const streamFormatter = new StreamJsonFormatter();
|
|
11391
11375
|
const metrics = uiTelemetryService.getMetrics();
|
|
11392
11376
|
streamFormatter.emitEvent({
|
|
11393
|
-
type:
|
|
11377
|
+
type: "result" /* RESULT */,
|
|
11394
11378
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11395
11379
|
status: "error",
|
|
11396
11380
|
error: {
|
|
@@ -11399,7 +11383,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11399
11383
|
},
|
|
11400
11384
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
11401
11385
|
});
|
|
11402
|
-
} else if (config.getOutputFormat() ===
|
|
11386
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11403
11387
|
const formatter = new JsonFormatter();
|
|
11404
11388
|
const formattedError = formatter.formatError(
|
|
11405
11389
|
toolExecutionError,
|
|
@@ -11417,11 +11401,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11417
11401
|
}
|
|
11418
11402
|
function handleCancellationError(config) {
|
|
11419
11403
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
11420
|
-
if (config.getOutputFormat() ===
|
|
11404
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11421
11405
|
const streamFormatter = new StreamJsonFormatter();
|
|
11422
11406
|
const metrics = uiTelemetryService.getMetrics();
|
|
11423
11407
|
streamFormatter.emitEvent({
|
|
11424
|
-
type:
|
|
11408
|
+
type: "result" /* RESULT */,
|
|
11425
11409
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11426
11410
|
status: "error",
|
|
11427
11411
|
error: {
|
|
@@ -11432,7 +11416,7 @@ function handleCancellationError(config) {
|
|
|
11432
11416
|
});
|
|
11433
11417
|
runSyncCleanup();
|
|
11434
11418
|
process.exit(cancellationError.exitCode);
|
|
11435
|
-
} else if (config.getOutputFormat() ===
|
|
11419
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11436
11420
|
const formatter = new JsonFormatter();
|
|
11437
11421
|
const formattedError = formatter.formatError(
|
|
11438
11422
|
cancellationError,
|
|
@@ -11452,11 +11436,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11452
11436
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11453
11437
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11454
11438
|
);
|
|
11455
|
-
if (config.getOutputFormat() ===
|
|
11439
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11456
11440
|
const streamFormatter = new StreamJsonFormatter();
|
|
11457
11441
|
const metrics = uiTelemetryService.getMetrics();
|
|
11458
11442
|
streamFormatter.emitEvent({
|
|
11459
|
-
type:
|
|
11443
|
+
type: "result" /* RESULT */,
|
|
11460
11444
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11461
11445
|
status: "error",
|
|
11462
11446
|
error: {
|
|
@@ -11467,7 +11451,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11467
11451
|
});
|
|
11468
11452
|
runSyncCleanup();
|
|
11469
11453
|
process.exit(maxTurnsError.exitCode);
|
|
11470
|
-
} else if (config.getOutputFormat() ===
|
|
11454
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11471
11455
|
const formatter = new JsonFormatter();
|
|
11472
11456
|
const formattedError = formatter.formatError(
|
|
11473
11457
|
maxTurnsError,
|
|
@@ -11547,7 +11531,7 @@ async function runNonInteractive({
|
|
|
11547
11531
|
}
|
|
11548
11532
|
});
|
|
11549
11533
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11550
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11534
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-JFJBTZ4B.js");
|
|
11551
11535
|
setupInitialActivityLogger(config);
|
|
11552
11536
|
}
|
|
11553
11537
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11563,7 +11547,7 @@ async function runNonInteractive({
|
|
|
11563
11547
|
}
|
|
11564
11548
|
};
|
|
11565
11549
|
const startTime = Date.now();
|
|
11566
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11550
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11567
11551
|
const abortController = new AbortController();
|
|
11568
11552
|
let isAborting = false;
|
|
11569
11553
|
let cancelMessageTimer = null;
|
|
@@ -11616,13 +11600,13 @@ async function runNonInteractive({
|
|
|
11616
11600
|
};
|
|
11617
11601
|
try {
|
|
11618
11602
|
consolePatcher.patch();
|
|
11619
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11603
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11620
11604
|
process.stderr.write(
|
|
11621
11605
|
"[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"
|
|
11622
11606
|
);
|
|
11623
11607
|
}
|
|
11624
11608
|
setupStdinCancellation();
|
|
11625
|
-
coreEvents.on(
|
|
11609
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11626
11610
|
coreEvents.drainBacklogs();
|
|
11627
11611
|
process.stdout.on("error", (err) => {
|
|
11628
11612
|
if (err.code === "EPIPE") {
|
|
@@ -11648,7 +11632,7 @@ async function runNonInteractive({
|
|
|
11648
11632
|
}
|
|
11649
11633
|
if (streamFormatter) {
|
|
11650
11634
|
streamFormatter.emitEvent({
|
|
11651
|
-
type:
|
|
11635
|
+
type: "init" /* INIT */,
|
|
11652
11636
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11653
11637
|
session_id: config.getSessionId(),
|
|
11654
11638
|
model: config.getModel()
|
|
@@ -11686,7 +11670,7 @@ async function runNonInteractive({
|
|
|
11686
11670
|
}
|
|
11687
11671
|
if (streamFormatter) {
|
|
11688
11672
|
streamFormatter.emitEvent({
|
|
11689
|
-
type:
|
|
11673
|
+
type: "message" /* MESSAGE */,
|
|
11690
11674
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11691
11675
|
role: "user",
|
|
11692
11676
|
content: input
|
|
@@ -11725,12 +11709,12 @@ async function runNonInteractive({
|
|
|
11725
11709
|
const metrics = uiTelemetryService.getMetrics();
|
|
11726
11710
|
const durationMs = Date.now() - startTime;
|
|
11727
11711
|
streamFormatter.emitEvent({
|
|
11728
|
-
type:
|
|
11712
|
+
type: "result" /* RESULT */,
|
|
11729
11713
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11730
11714
|
status: errorPayload ? "error" : "success",
|
|
11731
11715
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11732
11716
|
});
|
|
11733
|
-
} else if (config.getOutputFormat() ===
|
|
11717
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11734
11718
|
const formatter = new JsonFormatter();
|
|
11735
11719
|
const stats = uiTelemetryService.getMetrics();
|
|
11736
11720
|
textOutput.write(
|
|
@@ -11823,13 +11807,13 @@ async function runNonInteractive({
|
|
|
11823
11807
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11824
11808
|
if (streamFormatter) {
|
|
11825
11809
|
streamFormatter.emitEvent({
|
|
11826
|
-
type:
|
|
11810
|
+
type: "message" /* MESSAGE */,
|
|
11827
11811
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11828
11812
|
role: "assistant",
|
|
11829
11813
|
content: output,
|
|
11830
11814
|
delta: true
|
|
11831
11815
|
});
|
|
11832
|
-
} else if (config.getOutputFormat() ===
|
|
11816
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11833
11817
|
responseText += output;
|
|
11834
11818
|
} else {
|
|
11835
11819
|
if (part.text) {
|
|
@@ -11842,13 +11826,13 @@ async function runNonInteractive({
|
|
|
11842
11826
|
break;
|
|
11843
11827
|
}
|
|
11844
11828
|
case "tool_request": {
|
|
11845
|
-
if (config.getOutputFormat() ===
|
|
11829
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11846
11830
|
preToolResponseText = responseText || preToolResponseText;
|
|
11847
11831
|
responseText = "";
|
|
11848
11832
|
}
|
|
11849
11833
|
if (streamFormatter) {
|
|
11850
11834
|
streamFormatter.emitEvent({
|
|
11851
|
-
type:
|
|
11835
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11852
11836
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11853
11837
|
tool_name: event.name,
|
|
11854
11838
|
tool_id: event.requestId,
|
|
@@ -11864,7 +11848,7 @@ async function runNonInteractive({
|
|
|
11864
11848
|
const displayText = displayContentToString(display);
|
|
11865
11849
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11866
11850
|
streamFormatter.emitEvent({
|
|
11867
|
-
type:
|
|
11851
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11868
11852
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11869
11853
|
tool_id: event.requestId,
|
|
11870
11854
|
status: event.isError ? "error" : "success",
|
|
@@ -11879,17 +11863,17 @@ async function runNonInteractive({
|
|
|
11879
11863
|
const display = event.display?.result;
|
|
11880
11864
|
const displayText = displayContentToString(display);
|
|
11881
11865
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11882
|
-
if (event.data?.["errorType"] ===
|
|
11883
|
-
if (config.getOutputFormat() ===
|
|
11866
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
11867
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
11884
11868
|
responseText = preToolResponseText;
|
|
11885
11869
|
}
|
|
11886
11870
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11887
|
-
if (config.getOutputFormat() ===
|
|
11871
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11888
11872
|
process.stderr.write(`${stopMessage}
|
|
11889
11873
|
`);
|
|
11890
11874
|
}
|
|
11891
11875
|
}
|
|
11892
|
-
if (event.data?.["errorType"] ===
|
|
11876
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
11893
11877
|
throw new FatalToolExecutionError(
|
|
11894
11878
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11895
11879
|
);
|
|
@@ -11924,12 +11908,12 @@ async function runNonInteractive({
|
|
|
11924
11908
|
}
|
|
11925
11909
|
if (streamFormatter) {
|
|
11926
11910
|
streamFormatter.emitEvent({
|
|
11927
|
-
type:
|
|
11911
|
+
type: "error" /* ERROR */,
|
|
11928
11912
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11929
11913
|
severity: "error",
|
|
11930
11914
|
message: errorMessage
|
|
11931
11915
|
});
|
|
11932
|
-
} else if (config.getOutputFormat() ===
|
|
11916
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11933
11917
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11934
11918
|
`);
|
|
11935
11919
|
}
|
|
@@ -11950,12 +11934,12 @@ async function runNonInteractive({
|
|
|
11950
11934
|
const errorCode = event._meta?.["code"];
|
|
11951
11935
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11952
11936
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11953
|
-
if (config.getOutputFormat() ===
|
|
11937
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11954
11938
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11955
11939
|
`);
|
|
11956
11940
|
} else if (streamFormatter) {
|
|
11957
11941
|
streamFormatter.emitEvent({
|
|
11958
|
-
type:
|
|
11942
|
+
type: "error" /* ERROR */,
|
|
11959
11943
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11960
11944
|
severity: "warning",
|
|
11961
11945
|
message: stripAnsi(blockMessage)
|
|
@@ -11965,13 +11949,13 @@ async function runNonInteractive({
|
|
|
11965
11949
|
break;
|
|
11966
11950
|
}
|
|
11967
11951
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11968
|
-
if (config.getOutputFormat() ===
|
|
11952
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11969
11953
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11970
11954
|
`);
|
|
11971
11955
|
}
|
|
11972
11956
|
if (streamFormatter) {
|
|
11973
11957
|
streamFormatter.emitEvent({
|
|
11974
|
-
type:
|
|
11958
|
+
type: "error" /* ERROR */,
|
|
11975
11959
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11976
11960
|
severity,
|
|
11977
11961
|
message: stripAnsi(event.message)
|
|
@@ -11991,7 +11975,7 @@ async function runNonInteractive({
|
|
|
11991
11975
|
);
|
|
11992
11976
|
} else if (streamFormatter) {
|
|
11993
11977
|
streamFormatter.emitEvent({
|
|
11994
|
-
type:
|
|
11978
|
+
type: "error" /* ERROR */,
|
|
11995
11979
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11996
11980
|
severity: "error",
|
|
11997
11981
|
message: "Maximum session turns exceeded"
|
|
@@ -11999,7 +11983,7 @@ async function runNonInteractive({
|
|
|
11999
11983
|
}
|
|
12000
11984
|
}
|
|
12001
11985
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
12002
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11986
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
12003
11987
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
12004
11988
|
`);
|
|
12005
11989
|
}
|
|
@@ -12029,7 +12013,7 @@ async function runNonInteractive({
|
|
|
12029
12013
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
12030
12014
|
scheduler?.dispose();
|
|
12031
12015
|
consolePatcher.cleanup();
|
|
12032
|
-
coreEvents.off(
|
|
12016
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12033
12017
|
}
|
|
12034
12018
|
if (errorToHandle) {
|
|
12035
12019
|
handleError(errorToHandle, config);
|
|
@@ -12057,7 +12041,7 @@ async function runNonInteractive2(params) {
|
|
|
12057
12041
|
}
|
|
12058
12042
|
});
|
|
12059
12043
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
12060
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
12044
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-JFJBTZ4B.js");
|
|
12061
12045
|
setupInitialActivityLogger(config);
|
|
12062
12046
|
}
|
|
12063
12047
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -12073,7 +12057,7 @@ async function runNonInteractive2(params) {
|
|
|
12073
12057
|
}
|
|
12074
12058
|
};
|
|
12075
12059
|
const startTime = Date.now();
|
|
12076
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
12060
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
12077
12061
|
const abortController = new AbortController();
|
|
12078
12062
|
let isAborting = false;
|
|
12079
12063
|
let cancelMessageTimer = null;
|
|
@@ -12124,13 +12108,13 @@ async function runNonInteractive2(params) {
|
|
|
12124
12108
|
let scheduler;
|
|
12125
12109
|
try {
|
|
12126
12110
|
consolePatcher.patch();
|
|
12127
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
12111
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
12128
12112
|
process.stderr.write(
|
|
12129
12113
|
"[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"
|
|
12130
12114
|
);
|
|
12131
12115
|
}
|
|
12132
12116
|
setupStdinCancellation();
|
|
12133
|
-
coreEvents.on(
|
|
12117
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12134
12118
|
coreEvents.drainBacklogs();
|
|
12135
12119
|
process.stdout.on("error", (err) => {
|
|
12136
12120
|
if (err.code === "EPIPE") {
|
|
@@ -12154,7 +12138,7 @@ async function runNonInteractive2(params) {
|
|
|
12154
12138
|
}
|
|
12155
12139
|
if (streamFormatter) {
|
|
12156
12140
|
streamFormatter.emitEvent({
|
|
12157
|
-
type:
|
|
12141
|
+
type: "init" /* INIT */,
|
|
12158
12142
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12159
12143
|
session_id: config.getSessionId(),
|
|
12160
12144
|
model: config.getModel()
|
|
@@ -12192,7 +12176,7 @@ async function runNonInteractive2(params) {
|
|
|
12192
12176
|
}
|
|
12193
12177
|
if (streamFormatter) {
|
|
12194
12178
|
streamFormatter.emitEvent({
|
|
12195
|
-
type:
|
|
12179
|
+
type: "message" /* MESSAGE */,
|
|
12196
12180
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12197
12181
|
role: "user",
|
|
12198
12182
|
content: input
|
|
@@ -12220,28 +12204,28 @@ async function runNonInteractive2(params) {
|
|
|
12220
12204
|
if (abortController.signal.aborted) {
|
|
12221
12205
|
handleCancellationError(config);
|
|
12222
12206
|
}
|
|
12223
|
-
if (event.type ===
|
|
12207
|
+
if (event.type === "content" /* Content */) {
|
|
12224
12208
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
12225
12209
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
12226
12210
|
if (streamFormatter) {
|
|
12227
12211
|
streamFormatter.emitEvent({
|
|
12228
|
-
type:
|
|
12212
|
+
type: "message" /* MESSAGE */,
|
|
12229
12213
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12230
12214
|
role: "assistant",
|
|
12231
12215
|
content: output,
|
|
12232
12216
|
delta: true
|
|
12233
12217
|
});
|
|
12234
|
-
} else if (config.getOutputFormat() ===
|
|
12218
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12235
12219
|
responseText += output;
|
|
12236
12220
|
} else {
|
|
12237
12221
|
if (event.value) {
|
|
12238
12222
|
textOutput.write(output);
|
|
12239
12223
|
}
|
|
12240
12224
|
}
|
|
12241
|
-
} else if (event.type ===
|
|
12225
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
12242
12226
|
if (streamFormatter) {
|
|
12243
12227
|
streamFormatter.emitEvent({
|
|
12244
|
-
type:
|
|
12228
|
+
type: "tool_use" /* TOOL_USE */,
|
|
12245
12229
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12246
12230
|
tool_name: event.value.name,
|
|
12247
12231
|
tool_id: event.value.callId,
|
|
@@ -12249,33 +12233,33 @@ async function runNonInteractive2(params) {
|
|
|
12249
12233
|
});
|
|
12250
12234
|
}
|
|
12251
12235
|
toolCallRequests.push(event.value);
|
|
12252
|
-
} else if (event.type ===
|
|
12236
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
12253
12237
|
const message = "Loop detected, stopping execution";
|
|
12254
12238
|
if (streamFormatter) {
|
|
12255
12239
|
streamFormatter.emitEvent({
|
|
12256
|
-
type:
|
|
12240
|
+
type: "error" /* ERROR */,
|
|
12257
12241
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12258
12242
|
severity: "warning",
|
|
12259
12243
|
message
|
|
12260
12244
|
});
|
|
12261
12245
|
}
|
|
12262
12246
|
warnings.push(message);
|
|
12263
|
-
} else if (event.type ===
|
|
12247
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
12264
12248
|
const message = "Maximum session turns exceeded";
|
|
12265
12249
|
if (streamFormatter) {
|
|
12266
12250
|
streamFormatter.emitEvent({
|
|
12267
|
-
type:
|
|
12251
|
+
type: "error" /* ERROR */,
|
|
12268
12252
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12269
12253
|
severity: "error",
|
|
12270
12254
|
message
|
|
12271
12255
|
});
|
|
12272
12256
|
}
|
|
12273
12257
|
warnings.push(message);
|
|
12274
|
-
} else if (event.type ===
|
|
12258
|
+
} else if (event.type === "error" /* Error */) {
|
|
12275
12259
|
throw event.value.error;
|
|
12276
|
-
} else if (event.type ===
|
|
12260
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
12277
12261
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12278
|
-
if (config.getOutputFormat() ===
|
|
12262
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12279
12263
|
process.stderr.write(`${stopMessage}
|
|
12280
12264
|
`);
|
|
12281
12265
|
}
|
|
@@ -12283,7 +12267,7 @@ async function runNonInteractive2(params) {
|
|
|
12283
12267
|
const metrics = uiTelemetryService.getMetrics();
|
|
12284
12268
|
const durationMs = Date.now() - startTime;
|
|
12285
12269
|
streamFormatter.emitEvent({
|
|
12286
|
-
type:
|
|
12270
|
+
type: "result" /* RESULT */,
|
|
12287
12271
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12288
12272
|
status: "success",
|
|
12289
12273
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12291,7 +12275,7 @@ async function runNonInteractive2(params) {
|
|
|
12291
12275
|
durationMs
|
|
12292
12276
|
)
|
|
12293
12277
|
});
|
|
12294
|
-
} else if (config.getOutputFormat() ===
|
|
12278
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12295
12279
|
const formatter = new JsonFormatter();
|
|
12296
12280
|
const stats = uiTelemetryService.getMetrics();
|
|
12297
12281
|
textOutput.write(
|
|
@@ -12307,21 +12291,21 @@ async function runNonInteractive2(params) {
|
|
|
12307
12291
|
textOutput.ensureTrailingNewline();
|
|
12308
12292
|
}
|
|
12309
12293
|
return;
|
|
12310
|
-
} else if (event.type ===
|
|
12294
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
12311
12295
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12312
|
-
if (config.getOutputFormat() ===
|
|
12296
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12313
12297
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
12314
12298
|
`);
|
|
12315
12299
|
} else if (streamFormatter) {
|
|
12316
12300
|
streamFormatter.emitEvent({
|
|
12317
|
-
type:
|
|
12301
|
+
type: "error" /* ERROR */,
|
|
12318
12302
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12319
12303
|
severity: "warning",
|
|
12320
12304
|
message: stripAnsi(blockMessage)
|
|
12321
12305
|
});
|
|
12322
12306
|
}
|
|
12323
12307
|
warnings.push(blockMessage);
|
|
12324
|
-
} else if (event.type ===
|
|
12308
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
12325
12309
|
const eventValue = event.value;
|
|
12326
12310
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
12327
12311
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -12344,12 +12328,12 @@ async function runNonInteractive2(params) {
|
|
|
12344
12328
|
);
|
|
12345
12329
|
if (streamFormatter) {
|
|
12346
12330
|
streamFormatter.emitEvent({
|
|
12347
|
-
type:
|
|
12331
|
+
type: "error" /* ERROR */,
|
|
12348
12332
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12349
12333
|
severity: "error",
|
|
12350
12334
|
message: invalidStreamError
|
|
12351
12335
|
});
|
|
12352
|
-
} else if (config.getOutputFormat() ===
|
|
12336
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12353
12337
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
12354
12338
|
`);
|
|
12355
12339
|
}
|
|
@@ -12369,7 +12353,7 @@ async function runNonInteractive2(params) {
|
|
|
12369
12353
|
const requestInfo = completedToolCall.request;
|
|
12370
12354
|
if (streamFormatter) {
|
|
12371
12355
|
streamFormatter.emitEvent({
|
|
12372
|
-
type:
|
|
12356
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
12373
12357
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12374
12358
|
tool_id: requestInfo.callId,
|
|
12375
12359
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -12403,11 +12387,11 @@ async function runNonInteractive2(params) {
|
|
|
12403
12387
|
);
|
|
12404
12388
|
}
|
|
12405
12389
|
const stopExecutionTool = completedToolCalls.find(
|
|
12406
|
-
(tc) => tc.response.errorType ===
|
|
12390
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
12407
12391
|
);
|
|
12408
12392
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
12409
12393
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
12410
|
-
if (config.getOutputFormat() ===
|
|
12394
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
12411
12395
|
process.stderr.write(`${stopMessage}
|
|
12412
12396
|
`);
|
|
12413
12397
|
}
|
|
@@ -12415,7 +12399,7 @@ async function runNonInteractive2(params) {
|
|
|
12415
12399
|
const metrics = uiTelemetryService.getMetrics();
|
|
12416
12400
|
const durationMs = Date.now() - startTime;
|
|
12417
12401
|
streamFormatter.emitEvent({
|
|
12418
|
-
type:
|
|
12402
|
+
type: "result" /* RESULT */,
|
|
12419
12403
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12420
12404
|
status: "success",
|
|
12421
12405
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12423,7 +12407,7 @@ async function runNonInteractive2(params) {
|
|
|
12423
12407
|
durationMs
|
|
12424
12408
|
)
|
|
12425
12409
|
});
|
|
12426
|
-
} else if (config.getOutputFormat() ===
|
|
12410
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12427
12411
|
const formatter = new JsonFormatter();
|
|
12428
12412
|
const stats = uiTelemetryService.getMetrics();
|
|
12429
12413
|
textOutput.write(
|
|
@@ -12446,12 +12430,12 @@ async function runNonInteractive2(params) {
|
|
|
12446
12430
|
const metrics = uiTelemetryService.getMetrics();
|
|
12447
12431
|
const durationMs = Date.now() - startTime;
|
|
12448
12432
|
streamFormatter.emitEvent({
|
|
12449
|
-
type:
|
|
12433
|
+
type: "result" /* RESULT */,
|
|
12450
12434
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12451
12435
|
status: invalidStreamError ? "error" : "success",
|
|
12452
12436
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12453
12437
|
});
|
|
12454
|
-
} else if (config.getOutputFormat() ===
|
|
12438
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12455
12439
|
const formatter = new JsonFormatter();
|
|
12456
12440
|
const stats = uiTelemetryService.getMetrics();
|
|
12457
12441
|
textOutput.write(
|
|
@@ -12475,7 +12459,7 @@ async function runNonInteractive2(params) {
|
|
|
12475
12459
|
cleanupStdinCancellation();
|
|
12476
12460
|
scheduler?.dispose();
|
|
12477
12461
|
consolePatcher.cleanup();
|
|
12478
|
-
coreEvents.off(
|
|
12462
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12479
12463
|
}
|
|
12480
12464
|
if (errorToHandle) {
|
|
12481
12465
|
handleError(errorToHandle, config);
|
|
@@ -14866,12 +14850,12 @@ function toToolCallContent(toolResult) {
|
|
|
14866
14850
|
}
|
|
14867
14851
|
var basicPermissionOptions = [
|
|
14868
14852
|
{
|
|
14869
|
-
optionId:
|
|
14853
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14870
14854
|
name: "Allow",
|
|
14871
14855
|
kind: "allow_once"
|
|
14872
14856
|
},
|
|
14873
14857
|
{
|
|
14874
|
-
optionId:
|
|
14858
|
+
optionId: "cancel" /* Cancel */,
|
|
14875
14859
|
name: "Reject",
|
|
14876
14860
|
kind: "reject_once"
|
|
14877
14861
|
}
|
|
@@ -14883,13 +14867,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14883
14867
|
switch (confirmation.type) {
|
|
14884
14868
|
case "edit":
|
|
14885
14869
|
options.push({
|
|
14886
|
-
optionId:
|
|
14870
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14887
14871
|
name: "Allow for this session",
|
|
14888
14872
|
kind: "allow_always"
|
|
14889
14873
|
});
|
|
14890
14874
|
if (enablePermanentToolApproval) {
|
|
14891
14875
|
options.push({
|
|
14892
|
-
optionId:
|
|
14876
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14893
14877
|
name: "Allow for this file in all future sessions",
|
|
14894
14878
|
kind: "allow_always"
|
|
14895
14879
|
});
|
|
@@ -14897,13 +14881,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14897
14881
|
break;
|
|
14898
14882
|
case "exec":
|
|
14899
14883
|
options.push({
|
|
14900
|
-
optionId:
|
|
14884
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14901
14885
|
name: "Allow for this session",
|
|
14902
14886
|
kind: "allow_always"
|
|
14903
14887
|
});
|
|
14904
14888
|
if (enablePermanentToolApproval) {
|
|
14905
14889
|
options.push({
|
|
14906
|
-
optionId:
|
|
14890
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14907
14891
|
name: "Allow this command for all future sessions",
|
|
14908
14892
|
kind: "allow_always"
|
|
14909
14893
|
});
|
|
@@ -14912,19 +14896,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14912
14896
|
case "mcp":
|
|
14913
14897
|
options.push(
|
|
14914
14898
|
{
|
|
14915
|
-
optionId:
|
|
14899
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14916
14900
|
name: "Allow all server tools for this session",
|
|
14917
14901
|
kind: "allow_always"
|
|
14918
14902
|
},
|
|
14919
14903
|
{
|
|
14920
|
-
optionId:
|
|
14904
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14921
14905
|
name: "Allow tool for this session",
|
|
14922
14906
|
kind: "allow_always"
|
|
14923
14907
|
}
|
|
14924
14908
|
);
|
|
14925
14909
|
if (enablePermanentToolApproval) {
|
|
14926
14910
|
options.push({
|
|
14927
|
-
optionId:
|
|
14911
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14928
14912
|
name: "Allow tool for all future sessions",
|
|
14929
14913
|
kind: "allow_always"
|
|
14930
14914
|
});
|
|
@@ -14932,13 +14916,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14932
14916
|
break;
|
|
14933
14917
|
case "info":
|
|
14934
14918
|
options.push({
|
|
14935
|
-
optionId:
|
|
14919
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14936
14920
|
name: "Allow for this session",
|
|
14937
14921
|
kind: "allow_always"
|
|
14938
14922
|
});
|
|
14939
14923
|
if (enablePermanentToolApproval) {
|
|
14940
14924
|
options.push({
|
|
14941
|
-
optionId:
|
|
14925
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14942
14926
|
name: "Allow for all future sessions",
|
|
14943
14927
|
kind: "allow_always"
|
|
14944
14928
|
});
|
|
@@ -14970,21 +14954,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14970
14954
|
}
|
|
14971
14955
|
function toAcpToolKind(kind) {
|
|
14972
14956
|
switch (kind) {
|
|
14973
|
-
case
|
|
14974
|
-
case
|
|
14975
|
-
case
|
|
14976
|
-
case
|
|
14977
|
-
case
|
|
14978
|
-
case
|
|
14979
|
-
case
|
|
14980
|
-
case
|
|
14981
|
-
case
|
|
14982
|
-
case
|
|
14957
|
+
case "read" /* Read */:
|
|
14958
|
+
case "edit" /* Edit */:
|
|
14959
|
+
case "execute" /* Execute */:
|
|
14960
|
+
case "search" /* Search */:
|
|
14961
|
+
case "delete" /* Delete */:
|
|
14962
|
+
case "move" /* Move */:
|
|
14963
|
+
case "think" /* Think */:
|
|
14964
|
+
case "fetch" /* Fetch */:
|
|
14965
|
+
case "switch_mode" /* SwitchMode */:
|
|
14966
|
+
case "other" /* Other */:
|
|
14983
14967
|
return kind;
|
|
14984
|
-
case
|
|
14968
|
+
case "agent" /* Agent */:
|
|
14985
14969
|
return "think";
|
|
14986
|
-
case
|
|
14987
|
-
case
|
|
14970
|
+
case "plan" /* Plan */:
|
|
14971
|
+
case "communicate" /* Communicate */:
|
|
14988
14972
|
default:
|
|
14989
14973
|
return "other";
|
|
14990
14974
|
}
|
|
@@ -14992,24 +14976,24 @@ function toAcpToolKind(kind) {
|
|
|
14992
14976
|
function buildAvailableModes(isPlanEnabled) {
|
|
14993
14977
|
const modes = [
|
|
14994
14978
|
{
|
|
14995
|
-
id:
|
|
14979
|
+
id: "default" /* DEFAULT */,
|
|
14996
14980
|
name: "Default",
|
|
14997
14981
|
description: "Prompts for approval"
|
|
14998
14982
|
},
|
|
14999
14983
|
{
|
|
15000
|
-
id:
|
|
14984
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
15001
14985
|
name: "Auto Edit",
|
|
15002
14986
|
description: "Auto-approves edit tools"
|
|
15003
14987
|
},
|
|
15004
14988
|
{
|
|
15005
|
-
id:
|
|
14989
|
+
id: "yolo" /* YOLO */,
|
|
15006
14990
|
name: "YOLO",
|
|
15007
14991
|
description: "Auto-approves all tools"
|
|
15008
14992
|
}
|
|
15009
14993
|
];
|
|
15010
14994
|
if (isPlanEnabled) {
|
|
15011
14995
|
modes.push({
|
|
15012
|
-
id:
|
|
14996
|
+
id: "plan" /* PLAN */,
|
|
15013
14997
|
name: "Plan",
|
|
15014
14998
|
description: "Read-only mode"
|
|
15015
14999
|
});
|
|
@@ -15023,7 +15007,7 @@ function buildAvailableModels(config, settings) {
|
|
|
15023
15007
|
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
15024
15008
|
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
15025
15009
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
15026
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
15010
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
15027
15011
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
15028
15012
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
15029
15013
|
useGemini3_1: useGemini31,
|
|
@@ -15110,11 +15094,11 @@ var Session = class {
|
|
|
15110
15094
|
this.connection = connection;
|
|
15111
15095
|
this.settings = settings;
|
|
15112
15096
|
coreEvents.on(
|
|
15113
|
-
|
|
15097
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
15114
15098
|
this.handleApprovalModeChanged
|
|
15115
15099
|
);
|
|
15116
15100
|
this.context.config.getMessageBus()?.subscribe(
|
|
15117
|
-
|
|
15101
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
15118
15102
|
this.handleToolConfirmationRequest,
|
|
15119
15103
|
{ signal: this.disposeController.signal }
|
|
15120
15104
|
);
|
|
@@ -15138,7 +15122,7 @@ var Session = class {
|
|
|
15138
15122
|
"Policy engine missing. Denying tool confirmation request."
|
|
15139
15123
|
);
|
|
15140
15124
|
await messageBus.publish({
|
|
15141
|
-
type:
|
|
15125
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15142
15126
|
correlationId: request.correlationId,
|
|
15143
15127
|
confirmed: false,
|
|
15144
15128
|
requiresUserConfirmation: false
|
|
@@ -15151,7 +15135,7 @@ var Session = class {
|
|
|
15151
15135
|
"Tool confirmation request missing tool name. Denying."
|
|
15152
15136
|
);
|
|
15153
15137
|
await messageBus.publish({
|
|
15154
|
-
type:
|
|
15138
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15155
15139
|
correlationId: request.correlationId,
|
|
15156
15140
|
confirmed: false,
|
|
15157
15141
|
requiresUserConfirmation: false
|
|
@@ -15164,7 +15148,7 @@ var Session = class {
|
|
|
15164
15148
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
15165
15149
|
);
|
|
15166
15150
|
await messageBus.publish({
|
|
15167
|
-
type:
|
|
15151
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15168
15152
|
correlationId: request.correlationId,
|
|
15169
15153
|
confirmed: false,
|
|
15170
15154
|
requiresUserConfirmation: false
|
|
@@ -15180,15 +15164,15 @@ var Session = class {
|
|
|
15180
15164
|
request.subagent
|
|
15181
15165
|
);
|
|
15182
15166
|
await messageBus.publish({
|
|
15183
|
-
type:
|
|
15167
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15184
15168
|
correlationId: request.correlationId,
|
|
15185
|
-
confirmed: result.decision ===
|
|
15186
|
-
requiresUserConfirmation: result.decision ===
|
|
15169
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
15170
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
15187
15171
|
});
|
|
15188
15172
|
} catch (error) {
|
|
15189
15173
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
15190
15174
|
await this.context.config.getMessageBus()?.publish({
|
|
15191
|
-
type:
|
|
15175
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
15192
15176
|
correlationId: request.correlationId,
|
|
15193
15177
|
confirmed: false,
|
|
15194
15178
|
requiresUserConfirmation: false
|
|
@@ -15208,7 +15192,7 @@ var Session = class {
|
|
|
15208
15192
|
};
|
|
15209
15193
|
async dispose() {
|
|
15210
15194
|
coreEvents.off(
|
|
15211
|
-
|
|
15195
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
15212
15196
|
this.handleApprovalModeChanged
|
|
15213
15197
|
);
|
|
15214
15198
|
this.disposeController.abort();
|
|
@@ -15304,7 +15288,7 @@ ${thought.description}`;
|
|
|
15304
15288
|
await this.sendUpdate({
|
|
15305
15289
|
sessionUpdate: "tool_call",
|
|
15306
15290
|
toolCallId: toolCall.id,
|
|
15307
|
-
status: toolCall.status ===
|
|
15291
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
15308
15292
|
title: toolCall.displayName || toolCall.name,
|
|
15309
15293
|
content: toolCallContent,
|
|
15310
15294
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -15413,7 +15397,7 @@ ${thought.description}`;
|
|
|
15413
15397
|
return { stopReason: "cancelled" };
|
|
15414
15398
|
}
|
|
15415
15399
|
switch (event.type) {
|
|
15416
|
-
case
|
|
15400
|
+
case "content" /* Content */: {
|
|
15417
15401
|
const content = {
|
|
15418
15402
|
type: "text",
|
|
15419
15403
|
text: event.value
|
|
@@ -15424,7 +15408,7 @@ ${thought.description}`;
|
|
|
15424
15408
|
});
|
|
15425
15409
|
break;
|
|
15426
15410
|
}
|
|
15427
|
-
case
|
|
15411
|
+
case "thought" /* Thought */: {
|
|
15428
15412
|
const thoughtText = `**${event.value.subject}**
|
|
15429
15413
|
${event.value.description}`;
|
|
15430
15414
|
await this.sendUpdate({
|
|
@@ -15433,10 +15417,10 @@ ${event.value.description}`;
|
|
|
15433
15417
|
});
|
|
15434
15418
|
break;
|
|
15435
15419
|
}
|
|
15436
|
-
case
|
|
15420
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
15437
15421
|
toolCallRequests.push(event.value);
|
|
15438
15422
|
break;
|
|
15439
|
-
case
|
|
15423
|
+
case "finished" /* Finished */: {
|
|
15440
15424
|
const usage2 = event.value.usageMetadata;
|
|
15441
15425
|
if (usage2) {
|
|
15442
15426
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -15453,19 +15437,19 @@ ${event.value.description}`;
|
|
|
15453
15437
|
}
|
|
15454
15438
|
break;
|
|
15455
15439
|
}
|
|
15456
|
-
case
|
|
15440
|
+
case "model_info" /* ModelInfo */:
|
|
15457
15441
|
turnModelId = event.value;
|
|
15458
15442
|
break;
|
|
15459
|
-
case
|
|
15443
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
15460
15444
|
stopReason = "max_turn_requests";
|
|
15461
15445
|
break;
|
|
15462
|
-
case
|
|
15446
|
+
case "loop_detected" /* LoopDetected */:
|
|
15463
15447
|
stopReason = "max_turn_requests";
|
|
15464
15448
|
break;
|
|
15465
|
-
case
|
|
15449
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
15466
15450
|
stopReason = "max_tokens";
|
|
15467
15451
|
break;
|
|
15468
|
-
case
|
|
15452
|
+
case "error" /* Error */: {
|
|
15469
15453
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
15470
15454
|
event.value.error
|
|
15471
15455
|
);
|
|
@@ -15646,7 +15630,7 @@ ${event.value.description}`;
|
|
|
15646
15630
|
const output = RequestPermissionResponseSchema.parse(
|
|
15647
15631
|
await this.connection.requestPermission(params)
|
|
15648
15632
|
);
|
|
15649
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15633
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15650
15634
|
await confirmationDetails.onConfirm(outcome);
|
|
15651
15635
|
await updatePolicy(
|
|
15652
15636
|
tool,
|
|
@@ -15657,7 +15641,7 @@ ${event.value.description}`;
|
|
|
15657
15641
|
invocation
|
|
15658
15642
|
);
|
|
15659
15643
|
switch (outcome) {
|
|
15660
|
-
case
|
|
15644
|
+
case "cancel" /* Cancel */: {
|
|
15661
15645
|
const cancelError = new Error(
|
|
15662
15646
|
`Tool "${fc.name}" was canceled by the user.`
|
|
15663
15647
|
);
|
|
@@ -15675,12 +15659,12 @@ ${event.value.description}`;
|
|
|
15675
15659
|
});
|
|
15676
15660
|
return errorResponse(cancelError);
|
|
15677
15661
|
}
|
|
15678
|
-
case
|
|
15679
|
-
case
|
|
15680
|
-
case
|
|
15681
|
-
case
|
|
15682
|
-
case
|
|
15683
|
-
case
|
|
15662
|
+
case "proceed_once" /* ProceedOnce */:
|
|
15663
|
+
case "proceed_always" /* ProceedAlways */:
|
|
15664
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
15665
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
15666
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
15667
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
15684
15668
|
break;
|
|
15685
15669
|
default: {
|
|
15686
15670
|
const resultOutcome = outcome;
|
|
@@ -15734,7 +15718,7 @@ ${event.value.description}`;
|
|
|
15734
15718
|
);
|
|
15735
15719
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15736
15720
|
{
|
|
15737
|
-
status:
|
|
15721
|
+
status: "success" /* Success */,
|
|
15738
15722
|
request: {
|
|
15739
15723
|
callId,
|
|
15740
15724
|
name: fc.name,
|
|
@@ -15779,7 +15763,7 @@ ${event.value.description}`;
|
|
|
15779
15763
|
});
|
|
15780
15764
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15781
15765
|
{
|
|
15782
|
-
status:
|
|
15766
|
+
status: "error" /* Error */,
|
|
15783
15767
|
request: {
|
|
15784
15768
|
callId,
|
|
15785
15769
|
name: fc.name,
|
|
@@ -15908,12 +15892,12 @@ ${event.value.description}`;
|
|
|
15908
15892
|
sessionId: this.id,
|
|
15909
15893
|
options: [
|
|
15910
15894
|
{
|
|
15911
|
-
optionId:
|
|
15895
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
15912
15896
|
name: "Allow once",
|
|
15913
15897
|
kind: "allow_once"
|
|
15914
15898
|
},
|
|
15915
15899
|
{
|
|
15916
|
-
optionId:
|
|
15900
|
+
optionId: "cancel" /* Cancel */,
|
|
15917
15901
|
name: "Deny",
|
|
15918
15902
|
kind: "reject_once"
|
|
15919
15903
|
}
|
|
@@ -15938,8 +15922,8 @@ ${event.value.description}`;
|
|
|
15938
15922
|
const output = RequestPermissionResponseSchema.parse(
|
|
15939
15923
|
await this.connection.requestPermission(params)
|
|
15940
15924
|
);
|
|
15941
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15942
|
-
if (outcome ===
|
|
15925
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15926
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
15943
15927
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15944
15928
|
validationError = null;
|
|
15945
15929
|
} else {
|
|
@@ -16380,7 +16364,7 @@ var AcpSessionManager = class {
|
|
|
16380
16364
|
mcpServers,
|
|
16381
16365
|
loadedSettings
|
|
16382
16366
|
);
|
|
16383
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16367
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
16384
16368
|
let isAuthenticated = false;
|
|
16385
16369
|
let authErrorMessage = "";
|
|
16386
16370
|
try {
|
|
@@ -16392,7 +16376,7 @@ var AcpSessionManager = class {
|
|
|
16392
16376
|
);
|
|
16393
16377
|
isAuthenticated = true;
|
|
16394
16378
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
16395
|
-
if (authType ===
|
|
16379
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
16396
16380
|
isAuthenticated = false;
|
|
16397
16381
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
16398
16382
|
}
|
|
@@ -16576,7 +16560,7 @@ var AcpSessionManager = class {
|
|
|
16576
16560
|
}
|
|
16577
16561
|
}
|
|
16578
16562
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16579
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16563
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
16580
16564
|
if (!selectedAuthType) {
|
|
16581
16565
|
throw RequestError.authRequired();
|
|
16582
16566
|
}
|
|
@@ -16688,12 +16672,12 @@ var GeminiAgent = class {
|
|
|
16688
16672
|
}
|
|
16689
16673
|
const authMethods = [
|
|
16690
16674
|
{
|
|
16691
|
-
id:
|
|
16675
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
16692
16676
|
name: "Log in with Google",
|
|
16693
16677
|
description: "Log in with your Google account"
|
|
16694
16678
|
},
|
|
16695
16679
|
{
|
|
16696
|
-
id:
|
|
16680
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
16697
16681
|
name: "Gemini API key",
|
|
16698
16682
|
description: "Use an API key with Gemini Developer API",
|
|
16699
16683
|
_meta: {
|
|
@@ -16703,12 +16687,12 @@ var GeminiAgent = class {
|
|
|
16703
16687
|
}
|
|
16704
16688
|
},
|
|
16705
16689
|
{
|
|
16706
|
-
id:
|
|
16690
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
16707
16691
|
name: "Vertex AI",
|
|
16708
16692
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16709
16693
|
},
|
|
16710
16694
|
{
|
|
16711
|
-
id:
|
|
16695
|
+
id: "gateway" /* GATEWAY */,
|
|
16712
16696
|
name: "AI API Gateway",
|
|
16713
16697
|
description: "Use a custom AI API Gateway",
|
|
16714
16698
|
_meta: {
|
|
@@ -16881,7 +16865,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16881
16865
|
}
|
|
16882
16866
|
return authType;
|
|
16883
16867
|
} catch (error) {
|
|
16884
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16868
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
16885
16869
|
handleError(
|
|
16886
16870
|
error instanceof Error ? error : new Error(String(error)),
|
|
16887
16871
|
nonInteractiveConfig,
|
|
@@ -17076,10 +17060,10 @@ var SlashCommandConflictHandler = class {
|
|
|
17076
17060
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
17077
17061
|
}
|
|
17078
17062
|
start() {
|
|
17079
|
-
coreEvents.on(
|
|
17063
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
17080
17064
|
}
|
|
17081
17065
|
stop() {
|
|
17082
|
-
coreEvents.off(
|
|
17066
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
17083
17067
|
if (this.flushTimeout) {
|
|
17084
17068
|
clearTimeout(this.flushTimeout);
|
|
17085
17069
|
this.flushTimeout = null;
|
|
@@ -17435,7 +17419,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
17435
17419
|
}
|
|
17436
17420
|
}
|
|
17437
17421
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
17438
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
17422
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-5XIAIY74.js");
|
|
17439
17423
|
await doStartUI(
|
|
17440
17424
|
config,
|
|
17441
17425
|
settings,
|
|
@@ -17538,12 +17522,12 @@ async function main() {
|
|
|
17538
17522
|
dns.setDefaultResultOrder(
|
|
17539
17523
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
17540
17524
|
);
|
|
17541
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
17525
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
17542
17526
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
17543
17527
|
settings.setValue(
|
|
17544
17528
|
"User" /* User */,
|
|
17545
17529
|
"security.auth.selectedType",
|
|
17546
|
-
|
|
17530
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
17547
17531
|
);
|
|
17548
17532
|
}
|
|
17549
17533
|
}
|
|
@@ -17644,7 +17628,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17644
17628
|
await config.storage.initialize();
|
|
17645
17629
|
adminControlsListner.setConfig(config);
|
|
17646
17630
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17647
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17631
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-JFJBTZ4B.js");
|
|
17648
17632
|
setupInitialActivityLogger(config);
|
|
17649
17633
|
}
|
|
17650
17634
|
registerTelemetryConfig(config);
|
|
@@ -17652,7 +17636,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17652
17636
|
const messageBus = config.getMessageBus();
|
|
17653
17637
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17654
17638
|
registerCleanup(async () => {
|
|
17655
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17639
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
17656
17640
|
});
|
|
17657
17641
|
if (!config.getAcpMode()) {
|
|
17658
17642
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17703,7 +17687,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17703
17687
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17704
17688
|
const initializationResult = await initializeApp(config, settings);
|
|
17705
17689
|
initAppHandle?.end();
|
|
17706
|
-
import("./liteRtServerManager-
|
|
17690
|
+
import("./liteRtServerManager-22ISMNN2.js").then(({ LiteRtServerManager }) => {
|
|
17707
17691
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17708
17692
|
if (!mergedGemma) return;
|
|
17709
17693
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17713,7 +17697,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17713
17697
|
autoStartServer: userGemma?.autoStartServer
|
|
17714
17698
|
});
|
|
17715
17699
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17716
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17700
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
17717
17701
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17718
17702
|
}
|
|
17719
17703
|
if (config.getAcpMode()) {
|
|
@@ -17729,7 +17713,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17729
17713
|
...rawStartupWarnings.map((message) => ({
|
|
17730
17714
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17731
17715
|
message,
|
|
17732
|
-
priority:
|
|
17716
|
+
priority: "high" /* High */
|
|
17733
17717
|
})),
|
|
17734
17718
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17735
17719
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17766,7 +17750,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17766
17750
|
${input}` : stdinData;
|
|
17767
17751
|
}
|
|
17768
17752
|
}
|
|
17769
|
-
const sessionStartSource = resumedSessionData ?
|
|
17753
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
17770
17754
|
const hookSystem = config?.getHookSystem();
|
|
17771
17755
|
if (hookSystem) {
|
|
17772
17756
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17823,8 +17807,8 @@ ${input}` : wrappedContext;
|
|
|
17823
17807
|
}
|
|
17824
17808
|
}
|
|
17825
17809
|
function initializeOutputListenersAndFlush(config) {
|
|
17826
|
-
if (coreEvents.listenerCount(
|
|
17827
|
-
coreEvents.on(
|
|
17810
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
17811
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
17828
17812
|
if (payload.isStderr) {
|
|
17829
17813
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17830
17814
|
} else {
|
|
@@ -17832,8 +17816,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17832
17816
|
}
|
|
17833
17817
|
});
|
|
17834
17818
|
}
|
|
17835
|
-
if (coreEvents.listenerCount(
|
|
17836
|
-
coreEvents.on(
|
|
17819
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
17820
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
17837
17821
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17838
17822
|
writeToStderr(payload.content + "\n");
|
|
17839
17823
|
} else {
|
|
@@ -17841,8 +17825,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17841
17825
|
}
|
|
17842
17826
|
});
|
|
17843
17827
|
}
|
|
17844
|
-
if (coreEvents.listenerCount(
|
|
17845
|
-
coreEvents.on(
|
|
17828
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
17829
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
17846
17830
|
writeToStderr(payload.message + "\n");
|
|
17847
17831
|
});
|
|
17848
17832
|
}
|
|
@@ -17850,7 +17834,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17850
17834
|
const forceToStderr = outputFormat === "json";
|
|
17851
17835
|
coreEvents.drainBacklogs(
|
|
17852
17836
|
(event, args) => {
|
|
17853
|
-
if (forceToStderr && event ===
|
|
17837
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
17854
17838
|
const payload = args[0];
|
|
17855
17839
|
if (!payload.isStderr) {
|
|
17856
17840
|
return {
|