@google/gemini-cli 0.42.0-preview.2 → 0.42.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-6QBZKEWW.js → chunk-3IS7GD6D.js} +2 -2
- package/bundle/{chunk-OFOKTVUH.js → chunk-4SLGT6YD.js} +1 -1
- package/bundle/{chunk-OP6THN3K.js → chunk-7C6GGDK6.js} +2 -2
- package/bundle/{chunk-77HSANAH.js → chunk-7VVHSNDQ.js} +4 -4
- package/bundle/{chunk-S3WIE72K.js → chunk-BCYBA52D.js} +1 -1
- package/bundle/{chunk-2KRAWFEQ.js → chunk-CHERUG6W.js} +7 -7
- package/bundle/{chunk-AAU5XCLJ.js → chunk-COKAF5GM.js} +1 -1
- package/bundle/{chunk-SJ6AOVZF.js → chunk-COQP2M4D.js} +54 -67
- package/bundle/{chunk-QM234EIA.js → chunk-CYEIWMZJ.js} +1 -1
- package/bundle/{chunk-WOGMVEEF.js → chunk-DMWX7UP6.js} +4 -4
- package/bundle/{chunk-E54WEGH3.js → chunk-DN4XSYRG.js} +12729 -6831
- package/bundle/{chunk-BLNG7CSO.js → chunk-EDKX67D6.js} +1 -1
- package/bundle/{chunk-LHVIO4J4.js → chunk-FCAODPNO.js} +7 -7
- package/bundle/{chunk-LYMYMKWM.js → chunk-G2VTSEZ6.js} +1 -1
- package/bundle/{chunk-M6ZQAQKH.js → chunk-GA527JB7.js} +1 -1
- package/bundle/{chunk-4NXNVHPO.js → chunk-I7AME6VC.js} +8 -9
- package/bundle/{chunk-Q24MYLMP.js → chunk-KVEAHIIV.js} +3 -3
- package/bundle/{chunk-DEKZKOVU.js → chunk-LATVEETM.js} +1 -1
- package/bundle/{chunk-JW36FWGZ.js → chunk-NTOPH4WG.js} +2 -2
- package/bundle/{chunk-THNM4JU6.js → chunk-PUDLNWHE.js} +2 -2
- package/bundle/{chunk-FIIOJPLW.js → chunk-QOZSZYL7.js} +2 -2
- package/bundle/{chunk-R7BHIYZD.js → chunk-WIXUKOZA.js} +1 -1
- package/bundle/{chunk-I6IY72IP.js → chunk-XUMRUXOT.js} +6 -9
- package/bundle/{chunk-ODIOD5TJ.js → chunk-ZNMQA242.js} +3 -3
- package/bundle/{cleanup-G7DNOS4V.js → cleanup-3RILFNVM.js} +2 -2
- package/bundle/{cleanup-GZM5KIZA.js → cleanup-SVRKYBR6.js} +3 -3
- package/bundle/{cleanup-5FPOUEHR.js → cleanup-XFVHHDVO.js} +2 -2
- package/bundle/{core-IYSSLWMM.js → core-B5S6HZJT.js} +1 -1
- package/bundle/{dist-GF2RNVWZ.js → core-FRVSDP2C.js} +2 -2
- package/bundle/{devtoolsService-UADEEKOH.js → devtoolsService-RUEO5PGP.js} +2 -2
- package/bundle/{devtoolsService-7ZN7CSSO.js → devtoolsService-TRDGMQLJ.js} +4 -5
- package/bundle/{devtoolsService-3XOQOECV.js → devtoolsService-VM2WTHBX.js} +2 -2
- package/bundle/{dist-D7FZVGG3.js → dist-6BN2CJPN.js} +1 -1
- package/bundle/{gemini-IRKIMLB4.js → gemini-GHUELHBF.js} +14 -14
- package/bundle/{gemini-IMX43TZ4.js → gemini-NQPVX5JC.js} +186 -200
- package/bundle/{gemini-MWN2MSYV.js → gemini-QSTQ2DBG.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-752P4PTI.js → interactiveCli-453M2IVE.js} +8 -8
- package/bundle/{interactiveCli-37SKHAKX.js → interactiveCli-AG2YWL2O.js} +8 -8
- package/bundle/{interactiveCli-VX6GBWOV.js → interactiveCli-MZFG35NB.js} +276 -294
- package/bundle/{liteRtServerManager-OWPZ35U6.js → liteRtServerManager-BXQ6VVWP.js} +4 -4
- package/bundle/{liteRtServerManager-FPYU5KEK.js → liteRtServerManager-G4Q7OVBX.js} +4 -4
- package/bundle/{liteRtServerManager-CDLVKT7N.js → liteRtServerManager-S7WL25VD.js} +5 -5
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-RQNNLGWV.js → oauth2-provider-5UF5WEE2.js} +1 -1
- package/bundle/{oauth2-provider-6W4IY3LC.js → oauth2-provider-H7G6RSFW.js} +1 -1
- package/bundle/{oauth2-provider-446FDCUW.js → oauth2-provider-VR4DL6AL.js} +73 -39
- package/bundle/{start-KUNHDGRA.js → start-2SKRN43X.js} +6 -6
- package/bundle/{start-TZXEJLTH.js → start-CQBSKFYB.js} +7 -7
- package/bundle/{start-6U3XBAVH.js → start-NIMXQJYB.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-76KOJPMV.js +0 -391
- package/bundle/chunk-RO2XVFEU.js +0 -512
- package/bundle/chunk-WFKT4UTI.js +0 -118
- package/bundle/chunk-WLPWIJ3Y.js +0 -81544
- package/bundle/chunk-WRDVEMWE.js +0 -1571
- package/bundle/chunk-YDC4M26X.js +0 -156
- package/bundle/chunk-ZDP2ZWKG.js +0 -17230
- package/bundle/chunk-ZFOGBX2H.js +0 -356008
- package/bundle/cleanup-J6AUEKWI.js +0 -33
- package/bundle/devtoolsService-KTUMQHXG.js +0 -857
- package/bundle/dist-HBMVDPXB.js +0 -2096
- package/bundle/gemini-SYFUC6XO.js +0 -16256
- package/bundle/interactiveCli-SAMKYHUU.js +0 -34505
- package/bundle/liteRtServerManager-OWTQEYE6.js +0 -66
- package/bundle/oauth2-provider-TITPL3DN.js +0 -237
- package/bundle/start-TTLMBKNX.js +0 -19
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-CHERUG6W.js";
|
|
45
45
|
import {
|
|
46
46
|
appEvents
|
|
47
47
|
} from "./chunk-5PS3AYFU.js";
|
|
48
48
|
import {
|
|
49
49
|
startCommand,
|
|
50
50
|
startServer
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-KVEAHIIV.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-CYEIWMZJ.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_PORT,
|
|
58
58
|
GEMMA_MODEL_NAME,
|
|
@@ -86,11 +86,11 @@ import {
|
|
|
86
86
|
readServerProcessInfo,
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-BCYBA52D.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-ZNMQA242.js";
|
|
93
|
+
import "./chunk-I7AME6VC.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,43 +99,33 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-NTOPH4WG.js";
|
|
103
103
|
import {
|
|
104
104
|
AuthType,
|
|
105
105
|
ChatRecordingService,
|
|
106
106
|
Client,
|
|
107
107
|
Config,
|
|
108
|
-
CoreToolCallStatus,
|
|
109
108
|
ExitCodes,
|
|
110
109
|
FileDiscoveryService,
|
|
111
110
|
FolderTrustDiscoveryService,
|
|
112
|
-
GeminiEventType,
|
|
113
111
|
IdeClient,
|
|
114
|
-
IntegrityStatus,
|
|
115
112
|
InvalidStreamError,
|
|
116
113
|
JsonFormatter,
|
|
117
|
-
JsonStreamEventType,
|
|
118
114
|
LegacyAgentSession,
|
|
119
115
|
Logger,
|
|
120
116
|
MCPServerConfig,
|
|
121
|
-
MCPServerStatus,
|
|
122
|
-
OutputFormat,
|
|
123
117
|
PolicyIntegrityManager,
|
|
124
118
|
ROOT_SCHEDULER_ID,
|
|
125
119
|
ReadManyFilesTool,
|
|
126
120
|
Scheduler,
|
|
127
|
-
SessionEndReason,
|
|
128
|
-
SessionStartSource,
|
|
129
121
|
ShellExecutionService,
|
|
130
122
|
SimpleExtensionLoader,
|
|
131
123
|
StreamJsonFormatter,
|
|
132
124
|
ToolCallEvent,
|
|
133
|
-
TrustLevel,
|
|
134
125
|
UserAccountManager,
|
|
135
126
|
UserPromptEvent,
|
|
136
127
|
ValidationCancelledError,
|
|
137
128
|
ValidationRequiredError,
|
|
138
|
-
WarningPriority,
|
|
139
129
|
addMemory,
|
|
140
130
|
applyAdminAllowlist,
|
|
141
131
|
applyRequiredServers,
|
|
@@ -199,11 +189,9 @@ import {
|
|
|
199
189
|
updatePolicy,
|
|
200
190
|
writeToStderr,
|
|
201
191
|
writeToStdout
|
|
202
|
-
} from "./chunk-
|
|
192
|
+
} from "./chunk-DMWX7UP6.js";
|
|
203
193
|
import {
|
|
204
194
|
ASK_USER_TOOL_NAME,
|
|
205
|
-
ApprovalMode,
|
|
206
|
-
CoreEvent,
|
|
207
195
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
208
196
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
209
197
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -223,7 +211,6 @@ import {
|
|
|
223
211
|
FatalUntrustedWorkspaceError,
|
|
224
212
|
GEMINI_DIR,
|
|
225
213
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
226
|
-
Kind,
|
|
227
214
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
228
215
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
229
216
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -233,7 +220,6 @@ import {
|
|
|
233
220
|
REFERENCE_CONTENT_START,
|
|
234
221
|
Storage,
|
|
235
222
|
ToolConfirmationOutcome,
|
|
236
|
-
ToolErrorType,
|
|
237
223
|
coreEvents,
|
|
238
224
|
debugLogger,
|
|
239
225
|
external_exports,
|
|
@@ -247,7 +233,7 @@ import {
|
|
|
247
233
|
loadServerHierarchicalMemory,
|
|
248
234
|
resolveToRealPath,
|
|
249
235
|
setGeminiMdFilename
|
|
250
|
-
} from "./chunk-
|
|
236
|
+
} from "./chunk-ECNYAST2.js";
|
|
251
237
|
import "./chunk-664ZODQF.js";
|
|
252
238
|
import "./chunk-RJTRUG2J.js";
|
|
253
239
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5377,7 +5363,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5377
5363
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5378
5364
|
const isStdio = !!config.command;
|
|
5379
5365
|
if (isStdio && !isTrusted) {
|
|
5380
|
-
return
|
|
5366
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5381
5367
|
}
|
|
5382
5368
|
const client = new Client({
|
|
5383
5369
|
name: "mcp-test-client",
|
|
@@ -5413,7 +5399,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5413
5399
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5414
5400
|
} catch {
|
|
5415
5401
|
await client.close();
|
|
5416
|
-
return
|
|
5402
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5417
5403
|
}
|
|
5418
5404
|
try {
|
|
5419
5405
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5427,10 +5413,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5427
5413
|
);
|
|
5428
5414
|
}
|
|
5429
5415
|
await client.close();
|
|
5430
|
-
return
|
|
5416
|
+
return "connected" /* CONNECTED */;
|
|
5431
5417
|
} catch {
|
|
5432
5418
|
await transport.close();
|
|
5433
|
-
return
|
|
5419
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5434
5420
|
}
|
|
5435
5421
|
}
|
|
5436
5422
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5443,9 +5429,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5443
5429
|
});
|
|
5444
5430
|
if (!loadResult.allowed) {
|
|
5445
5431
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5446
|
-
return
|
|
5432
|
+
return "blocked" /* BLOCKED */;
|
|
5447
5433
|
}
|
|
5448
|
-
return
|
|
5434
|
+
return "disabled" /* DISABLED */;
|
|
5449
5435
|
}
|
|
5450
5436
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5451
5437
|
}
|
|
@@ -5479,23 +5465,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5479
5465
|
let statusIndicator = "";
|
|
5480
5466
|
let statusText = "";
|
|
5481
5467
|
switch (status) {
|
|
5482
|
-
case
|
|
5468
|
+
case "connected" /* CONNECTED */:
|
|
5483
5469
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5484
5470
|
statusText = "Connected";
|
|
5485
5471
|
break;
|
|
5486
|
-
case
|
|
5472
|
+
case "connecting" /* CONNECTING */:
|
|
5487
5473
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5488
5474
|
statusText = "Connecting";
|
|
5489
5475
|
break;
|
|
5490
|
-
case
|
|
5476
|
+
case "blocked" /* BLOCKED */:
|
|
5491
5477
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5492
5478
|
statusText = "Blocked";
|
|
5493
5479
|
break;
|
|
5494
|
-
case
|
|
5480
|
+
case "disabled" /* DISABLED */:
|
|
5495
5481
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5496
5482
|
statusText = "Disabled";
|
|
5497
5483
|
break;
|
|
5498
|
-
case
|
|
5484
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5499
5485
|
default:
|
|
5500
5486
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5501
5487
|
statusText = "Disconnected";
|
|
@@ -5781,7 +5767,7 @@ async function handleInstall(args) {
|
|
|
5781
5767
|
);
|
|
5782
5768
|
if (confirmed) {
|
|
5783
5769
|
const trustedFolders = loadTrustedFolders();
|
|
5784
|
-
await trustedFolders.setValue(realPath,
|
|
5770
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5785
5771
|
} else {
|
|
5786
5772
|
throw new Error(
|
|
5787
5773
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7826,7 +7812,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7826
7812
|
}
|
|
7827
7813
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7828
7814
|
const packageJson = await getPackageJson(__dirname3);
|
|
7829
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.42.0
|
|
7815
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.42.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7830
7816
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7831
7817
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7832
7818
|
}
|
|
@@ -7885,9 +7871,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7885
7871
|
cwd,
|
|
7886
7872
|
potentialWorkspacePoliciesDir
|
|
7887
7873
|
);
|
|
7888
|
-
if (integrityResult.status ===
|
|
7874
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7889
7875
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7890
|
-
} else if (integrityResult.status ===
|
|
7876
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7891
7877
|
workspacePoliciesDir = void 0;
|
|
7892
7878
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7893
7879
|
policyUpdateConfirmationRequest = {
|
|
@@ -8327,23 +8313,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8327
8313
|
if (rawApprovalMode) {
|
|
8328
8314
|
switch (rawApprovalMode) {
|
|
8329
8315
|
case "yolo":
|
|
8330
|
-
approvalMode =
|
|
8316
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8331
8317
|
break;
|
|
8332
8318
|
case "auto_edit":
|
|
8333
|
-
approvalMode =
|
|
8319
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8334
8320
|
break;
|
|
8335
8321
|
case "plan":
|
|
8336
8322
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8337
8323
|
debugLogger.warn(
|
|
8338
8324
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8339
8325
|
);
|
|
8340
|
-
approvalMode =
|
|
8326
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8341
8327
|
} else {
|
|
8342
|
-
approvalMode =
|
|
8328
|
+
approvalMode = "plan" /* PLAN */;
|
|
8343
8329
|
}
|
|
8344
8330
|
break;
|
|
8345
8331
|
case "default":
|
|
8346
|
-
approvalMode =
|
|
8332
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8347
8333
|
break;
|
|
8348
8334
|
default:
|
|
8349
8335
|
throw new Error(
|
|
@@ -8351,10 +8337,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8351
8337
|
);
|
|
8352
8338
|
}
|
|
8353
8339
|
} else {
|
|
8354
|
-
approvalMode =
|
|
8340
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8355
8341
|
}
|
|
8356
8342
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8357
|
-
if (approvalMode ===
|
|
8343
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8358
8344
|
if (settings.admin?.secureModeEnabled) {
|
|
8359
8345
|
debugLogger.error(
|
|
8360
8346
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8372,16 +8358,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8372
8358
|
)
|
|
8373
8359
|
);
|
|
8374
8360
|
}
|
|
8375
|
-
} else if (approvalMode ===
|
|
8361
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8376
8362
|
debugLogger.warn(
|
|
8377
8363
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8378
8364
|
);
|
|
8379
8365
|
}
|
|
8380
|
-
if (!trustedFolder && approvalMode !==
|
|
8366
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8381
8367
|
debugLogger.warn(
|
|
8382
8368
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8383
8369
|
);
|
|
8384
|
-
approvalMode =
|
|
8370
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8385
8371
|
}
|
|
8386
8372
|
let telemetrySettings;
|
|
8387
8373
|
try {
|
|
@@ -9802,7 +9788,7 @@ import path9 from "node:path";
|
|
|
9802
9788
|
import process4 from "node:process";
|
|
9803
9789
|
var homeDirectoryCheck = {
|
|
9804
9790
|
id: "home-directory",
|
|
9805
|
-
priority:
|
|
9791
|
+
priority: "low" /* Low */,
|
|
9806
9792
|
check: async (workspaceRoot, settings) => {
|
|
9807
9793
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9808
9794
|
return null;
|
|
@@ -9826,7 +9812,7 @@ var homeDirectoryCheck = {
|
|
|
9826
9812
|
};
|
|
9827
9813
|
var rootDirectoryCheck = {
|
|
9828
9814
|
id: "root-directory",
|
|
9829
|
-
priority:
|
|
9815
|
+
priority: "high" /* High */,
|
|
9830
9816
|
check: async (workspaceRoot, _settings) => {
|
|
9831
9817
|
try {
|
|
9832
9818
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9842,7 +9828,7 @@ var rootDirectoryCheck = {
|
|
|
9842
9828
|
};
|
|
9843
9829
|
var folderTrustCheck = {
|
|
9844
9830
|
id: "folder-trust",
|
|
9845
|
-
priority:
|
|
9831
|
+
priority: "high" /* High */,
|
|
9846
9832
|
check: async (workspaceRoot, settings) => {
|
|
9847
9833
|
if (!isFolderTrustEnabled(settings)) {
|
|
9848
9834
|
return null;
|
|
@@ -10032,12 +10018,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10032
10018
|
error,
|
|
10033
10019
|
config.getContentGeneratorConfig()?.authType
|
|
10034
10020
|
);
|
|
10035
|
-
if (config.getOutputFormat() ===
|
|
10021
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10036
10022
|
const streamFormatter = new StreamJsonFormatter();
|
|
10037
10023
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10038
10024
|
const metrics = uiTelemetryService.getMetrics();
|
|
10039
10025
|
streamFormatter.emitEvent({
|
|
10040
|
-
type:
|
|
10026
|
+
type: "result" /* RESULT */,
|
|
10041
10027
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10042
10028
|
status: "error",
|
|
10043
10029
|
error: {
|
|
@@ -10048,7 +10034,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10048
10034
|
});
|
|
10049
10035
|
runSyncCleanup();
|
|
10050
10036
|
process.exit(getNumericExitCode(errorCode));
|
|
10051
|
-
} else if (config.getOutputFormat() ===
|
|
10037
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10052
10038
|
const formatter = new JsonFormatter();
|
|
10053
10039
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10054
10040
|
const formattedError = formatter.formatError(
|
|
@@ -10068,11 +10054,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10068
10054
|
const isFatal = isFatalToolError(errorType);
|
|
10069
10055
|
if (isFatal) {
|
|
10070
10056
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10071
|
-
if (config.getOutputFormat() ===
|
|
10057
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10072
10058
|
const streamFormatter = new StreamJsonFormatter();
|
|
10073
10059
|
const metrics = uiTelemetryService.getMetrics();
|
|
10074
10060
|
streamFormatter.emitEvent({
|
|
10075
|
-
type:
|
|
10061
|
+
type: "result" /* RESULT */,
|
|
10076
10062
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10077
10063
|
status: "error",
|
|
10078
10064
|
error: {
|
|
@@ -10081,7 +10067,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10081
10067
|
},
|
|
10082
10068
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10083
10069
|
});
|
|
10084
|
-
} else if (config.getOutputFormat() ===
|
|
10070
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10085
10071
|
const formatter = new JsonFormatter();
|
|
10086
10072
|
const formattedError = formatter.formatError(
|
|
10087
10073
|
toolExecutionError,
|
|
@@ -10099,11 +10085,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10099
10085
|
}
|
|
10100
10086
|
function handleCancellationError(config) {
|
|
10101
10087
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10102
|
-
if (config.getOutputFormat() ===
|
|
10088
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10103
10089
|
const streamFormatter = new StreamJsonFormatter();
|
|
10104
10090
|
const metrics = uiTelemetryService.getMetrics();
|
|
10105
10091
|
streamFormatter.emitEvent({
|
|
10106
|
-
type:
|
|
10092
|
+
type: "result" /* RESULT */,
|
|
10107
10093
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10108
10094
|
status: "error",
|
|
10109
10095
|
error: {
|
|
@@ -10114,7 +10100,7 @@ function handleCancellationError(config) {
|
|
|
10114
10100
|
});
|
|
10115
10101
|
runSyncCleanup();
|
|
10116
10102
|
process.exit(cancellationError.exitCode);
|
|
10117
|
-
} else if (config.getOutputFormat() ===
|
|
10103
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10118
10104
|
const formatter = new JsonFormatter();
|
|
10119
10105
|
const formattedError = formatter.formatError(
|
|
10120
10106
|
cancellationError,
|
|
@@ -10134,11 +10120,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10134
10120
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10135
10121
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10136
10122
|
);
|
|
10137
|
-
if (config.getOutputFormat() ===
|
|
10123
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10138
10124
|
const streamFormatter = new StreamJsonFormatter();
|
|
10139
10125
|
const metrics = uiTelemetryService.getMetrics();
|
|
10140
10126
|
streamFormatter.emitEvent({
|
|
10141
|
-
type:
|
|
10127
|
+
type: "result" /* RESULT */,
|
|
10142
10128
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10143
10129
|
status: "error",
|
|
10144
10130
|
error: {
|
|
@@ -10149,7 +10135,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10149
10135
|
});
|
|
10150
10136
|
runSyncCleanup();
|
|
10151
10137
|
process.exit(maxTurnsError.exitCode);
|
|
10152
|
-
} else if (config.getOutputFormat() ===
|
|
10138
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10153
10139
|
const formatter = new JsonFormatter();
|
|
10154
10140
|
const formattedError = formatter.formatError(
|
|
10155
10141
|
maxTurnsError,
|
|
@@ -10229,7 +10215,7 @@ async function runNonInteractive({
|
|
|
10229
10215
|
}
|
|
10230
10216
|
});
|
|
10231
10217
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10232
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10218
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-TRDGMQLJ.js");
|
|
10233
10219
|
setupInitialActivityLogger(config);
|
|
10234
10220
|
}
|
|
10235
10221
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10245,7 +10231,7 @@ async function runNonInteractive({
|
|
|
10245
10231
|
}
|
|
10246
10232
|
};
|
|
10247
10233
|
const startTime = Date.now();
|
|
10248
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10234
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10249
10235
|
const abortController = new AbortController();
|
|
10250
10236
|
let isAborting = false;
|
|
10251
10237
|
let cancelMessageTimer = null;
|
|
@@ -10298,13 +10284,13 @@ async function runNonInteractive({
|
|
|
10298
10284
|
};
|
|
10299
10285
|
try {
|
|
10300
10286
|
consolePatcher.patch();
|
|
10301
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10287
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10302
10288
|
process.stderr.write(
|
|
10303
10289
|
"[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"
|
|
10304
10290
|
);
|
|
10305
10291
|
}
|
|
10306
10292
|
setupStdinCancellation();
|
|
10307
|
-
coreEvents.on(
|
|
10293
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10308
10294
|
coreEvents.drainBacklogs();
|
|
10309
10295
|
process.stdout.on("error", (err) => {
|
|
10310
10296
|
if (err.code === "EPIPE") {
|
|
@@ -10330,7 +10316,7 @@ async function runNonInteractive({
|
|
|
10330
10316
|
}
|
|
10331
10317
|
if (streamFormatter) {
|
|
10332
10318
|
streamFormatter.emitEvent({
|
|
10333
|
-
type:
|
|
10319
|
+
type: "init" /* INIT */,
|
|
10334
10320
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10335
10321
|
session_id: config.getSessionId(),
|
|
10336
10322
|
model: config.getModel()
|
|
@@ -10368,7 +10354,7 @@ async function runNonInteractive({
|
|
|
10368
10354
|
}
|
|
10369
10355
|
if (streamFormatter) {
|
|
10370
10356
|
streamFormatter.emitEvent({
|
|
10371
|
-
type:
|
|
10357
|
+
type: "message" /* MESSAGE */,
|
|
10372
10358
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10373
10359
|
role: "user",
|
|
10374
10360
|
content: input
|
|
@@ -10407,12 +10393,12 @@ async function runNonInteractive({
|
|
|
10407
10393
|
const metrics = uiTelemetryService.getMetrics();
|
|
10408
10394
|
const durationMs = Date.now() - startTime;
|
|
10409
10395
|
streamFormatter.emitEvent({
|
|
10410
|
-
type:
|
|
10396
|
+
type: "result" /* RESULT */,
|
|
10411
10397
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10412
10398
|
status: "success",
|
|
10413
10399
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10414
10400
|
});
|
|
10415
|
-
} else if (config.getOutputFormat() ===
|
|
10401
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10416
10402
|
const formatter = new JsonFormatter();
|
|
10417
10403
|
const stats = uiTelemetryService.getMetrics();
|
|
10418
10404
|
textOutput.write(
|
|
@@ -10505,13 +10491,13 @@ async function runNonInteractive({
|
|
|
10505
10491
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10506
10492
|
if (streamFormatter) {
|
|
10507
10493
|
streamFormatter.emitEvent({
|
|
10508
|
-
type:
|
|
10494
|
+
type: "message" /* MESSAGE */,
|
|
10509
10495
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10510
10496
|
role: "assistant",
|
|
10511
10497
|
content: output,
|
|
10512
10498
|
delta: true
|
|
10513
10499
|
});
|
|
10514
|
-
} else if (config.getOutputFormat() ===
|
|
10500
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10515
10501
|
responseText += output;
|
|
10516
10502
|
} else {
|
|
10517
10503
|
if (part.text) {
|
|
@@ -10524,13 +10510,13 @@ async function runNonInteractive({
|
|
|
10524
10510
|
break;
|
|
10525
10511
|
}
|
|
10526
10512
|
case "tool_request": {
|
|
10527
|
-
if (config.getOutputFormat() ===
|
|
10513
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10528
10514
|
preToolResponseText = responseText || preToolResponseText;
|
|
10529
10515
|
responseText = "";
|
|
10530
10516
|
}
|
|
10531
10517
|
if (streamFormatter) {
|
|
10532
10518
|
streamFormatter.emitEvent({
|
|
10533
|
-
type:
|
|
10519
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10534
10520
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10535
10521
|
tool_name: event.name,
|
|
10536
10522
|
tool_id: event.requestId,
|
|
@@ -10546,7 +10532,7 @@ async function runNonInteractive({
|
|
|
10546
10532
|
const displayText = displayContentToString(display);
|
|
10547
10533
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10548
10534
|
streamFormatter.emitEvent({
|
|
10549
|
-
type:
|
|
10535
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10550
10536
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10551
10537
|
tool_id: event.requestId,
|
|
10552
10538
|
status: event.isError ? "error" : "success",
|
|
@@ -10561,17 +10547,17 @@ async function runNonInteractive({
|
|
|
10561
10547
|
const display = event.display?.result;
|
|
10562
10548
|
const displayText = displayContentToString(display);
|
|
10563
10549
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10564
|
-
if (event.data?.["errorType"] ===
|
|
10565
|
-
if (config.getOutputFormat() ===
|
|
10550
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
10551
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
10566
10552
|
responseText = preToolResponseText;
|
|
10567
10553
|
}
|
|
10568
10554
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10569
|
-
if (config.getOutputFormat() ===
|
|
10555
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10570
10556
|
process.stderr.write(`${stopMessage}
|
|
10571
10557
|
`);
|
|
10572
10558
|
}
|
|
10573
10559
|
}
|
|
10574
|
-
if (event.data?.["errorType"] ===
|
|
10560
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
10575
10561
|
throw new FatalToolExecutionError(
|
|
10576
10562
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10577
10563
|
);
|
|
@@ -10593,12 +10579,12 @@ async function runNonInteractive({
|
|
|
10593
10579
|
const errorCode = event._meta?.["code"];
|
|
10594
10580
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10595
10581
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10596
|
-
if (config.getOutputFormat() ===
|
|
10582
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10597
10583
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10598
10584
|
`);
|
|
10599
10585
|
} else if (streamFormatter) {
|
|
10600
10586
|
streamFormatter.emitEvent({
|
|
10601
|
-
type:
|
|
10587
|
+
type: "error" /* ERROR */,
|
|
10602
10588
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10603
10589
|
severity: "warning",
|
|
10604
10590
|
message: stripAnsi(blockMessage)
|
|
@@ -10608,13 +10594,13 @@ async function runNonInteractive({
|
|
|
10608
10594
|
break;
|
|
10609
10595
|
}
|
|
10610
10596
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10611
|
-
if (config.getOutputFormat() ===
|
|
10597
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10612
10598
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10613
10599
|
`);
|
|
10614
10600
|
}
|
|
10615
10601
|
if (streamFormatter) {
|
|
10616
10602
|
streamFormatter.emitEvent({
|
|
10617
|
-
type:
|
|
10603
|
+
type: "error" /* ERROR */,
|
|
10618
10604
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10619
10605
|
severity,
|
|
10620
10606
|
message: stripAnsi(event.message)
|
|
@@ -10634,7 +10620,7 @@ async function runNonInteractive({
|
|
|
10634
10620
|
);
|
|
10635
10621
|
} else if (streamFormatter) {
|
|
10636
10622
|
streamFormatter.emitEvent({
|
|
10637
|
-
type:
|
|
10623
|
+
type: "error" /* ERROR */,
|
|
10638
10624
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10639
10625
|
severity: "error",
|
|
10640
10626
|
message: "Maximum session turns exceeded"
|
|
@@ -10642,7 +10628,7 @@ async function runNonInteractive({
|
|
|
10642
10628
|
}
|
|
10643
10629
|
}
|
|
10644
10630
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10645
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10631
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10646
10632
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10647
10633
|
`);
|
|
10648
10634
|
}
|
|
@@ -10672,7 +10658,7 @@ async function runNonInteractive({
|
|
|
10672
10658
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10673
10659
|
scheduler?.dispose();
|
|
10674
10660
|
consolePatcher.cleanup();
|
|
10675
|
-
coreEvents.off(
|
|
10661
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10676
10662
|
}
|
|
10677
10663
|
if (errorToHandle) {
|
|
10678
10664
|
handleError(errorToHandle, config);
|
|
@@ -10697,7 +10683,7 @@ async function runNonInteractive2(params) {
|
|
|
10697
10683
|
}
|
|
10698
10684
|
});
|
|
10699
10685
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10700
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10686
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-TRDGMQLJ.js");
|
|
10701
10687
|
setupInitialActivityLogger(config);
|
|
10702
10688
|
}
|
|
10703
10689
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10713,7 +10699,7 @@ async function runNonInteractive2(params) {
|
|
|
10713
10699
|
}
|
|
10714
10700
|
};
|
|
10715
10701
|
const startTime = Date.now();
|
|
10716
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10702
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10717
10703
|
const abortController = new AbortController();
|
|
10718
10704
|
let isAborting = false;
|
|
10719
10705
|
let cancelMessageTimer = null;
|
|
@@ -10764,13 +10750,13 @@ async function runNonInteractive2(params) {
|
|
|
10764
10750
|
let scheduler;
|
|
10765
10751
|
try {
|
|
10766
10752
|
consolePatcher.patch();
|
|
10767
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10753
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10768
10754
|
process.stderr.write(
|
|
10769
10755
|
"[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"
|
|
10770
10756
|
);
|
|
10771
10757
|
}
|
|
10772
10758
|
setupStdinCancellation();
|
|
10773
|
-
coreEvents.on(
|
|
10759
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10774
10760
|
coreEvents.drainBacklogs();
|
|
10775
10761
|
process.stdout.on("error", (err) => {
|
|
10776
10762
|
if (err.code === "EPIPE") {
|
|
@@ -10794,7 +10780,7 @@ async function runNonInteractive2(params) {
|
|
|
10794
10780
|
}
|
|
10795
10781
|
if (streamFormatter) {
|
|
10796
10782
|
streamFormatter.emitEvent({
|
|
10797
|
-
type:
|
|
10783
|
+
type: "init" /* INIT */,
|
|
10798
10784
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10799
10785
|
session_id: config.getSessionId(),
|
|
10800
10786
|
model: config.getModel()
|
|
@@ -10832,7 +10818,7 @@ async function runNonInteractive2(params) {
|
|
|
10832
10818
|
}
|
|
10833
10819
|
if (streamFormatter) {
|
|
10834
10820
|
streamFormatter.emitEvent({
|
|
10835
|
-
type:
|
|
10821
|
+
type: "message" /* MESSAGE */,
|
|
10836
10822
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10837
10823
|
role: "user",
|
|
10838
10824
|
content: input
|
|
@@ -10860,28 +10846,28 @@ async function runNonInteractive2(params) {
|
|
|
10860
10846
|
if (abortController.signal.aborted) {
|
|
10861
10847
|
handleCancellationError(config);
|
|
10862
10848
|
}
|
|
10863
|
-
if (event.type ===
|
|
10849
|
+
if (event.type === "content" /* Content */) {
|
|
10864
10850
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10865
10851
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10866
10852
|
if (streamFormatter) {
|
|
10867
10853
|
streamFormatter.emitEvent({
|
|
10868
|
-
type:
|
|
10854
|
+
type: "message" /* MESSAGE */,
|
|
10869
10855
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10870
10856
|
role: "assistant",
|
|
10871
10857
|
content: output,
|
|
10872
10858
|
delta: true
|
|
10873
10859
|
});
|
|
10874
|
-
} else if (config.getOutputFormat() ===
|
|
10860
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10875
10861
|
responseText += output;
|
|
10876
10862
|
} else {
|
|
10877
10863
|
if (event.value) {
|
|
10878
10864
|
textOutput.write(output);
|
|
10879
10865
|
}
|
|
10880
10866
|
}
|
|
10881
|
-
} else if (event.type ===
|
|
10867
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10882
10868
|
if (streamFormatter) {
|
|
10883
10869
|
streamFormatter.emitEvent({
|
|
10884
|
-
type:
|
|
10870
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10885
10871
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10886
10872
|
tool_name: event.value.name,
|
|
10887
10873
|
tool_id: event.value.callId,
|
|
@@ -10889,33 +10875,33 @@ async function runNonInteractive2(params) {
|
|
|
10889
10875
|
});
|
|
10890
10876
|
}
|
|
10891
10877
|
toolCallRequests.push(event.value);
|
|
10892
|
-
} else if (event.type ===
|
|
10878
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10893
10879
|
const message = "Loop detected, stopping execution";
|
|
10894
10880
|
if (streamFormatter) {
|
|
10895
10881
|
streamFormatter.emitEvent({
|
|
10896
|
-
type:
|
|
10882
|
+
type: "error" /* ERROR */,
|
|
10897
10883
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10898
10884
|
severity: "warning",
|
|
10899
10885
|
message
|
|
10900
10886
|
});
|
|
10901
10887
|
}
|
|
10902
10888
|
warnings.push(message);
|
|
10903
|
-
} else if (event.type ===
|
|
10889
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10904
10890
|
const message = "Maximum session turns exceeded";
|
|
10905
10891
|
if (streamFormatter) {
|
|
10906
10892
|
streamFormatter.emitEvent({
|
|
10907
|
-
type:
|
|
10893
|
+
type: "error" /* ERROR */,
|
|
10908
10894
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10909
10895
|
severity: "error",
|
|
10910
10896
|
message
|
|
10911
10897
|
});
|
|
10912
10898
|
}
|
|
10913
10899
|
warnings.push(message);
|
|
10914
|
-
} else if (event.type ===
|
|
10900
|
+
} else if (event.type === "error" /* Error */) {
|
|
10915
10901
|
throw event.value.error;
|
|
10916
|
-
} else if (event.type ===
|
|
10902
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10917
10903
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10918
|
-
if (config.getOutputFormat() ===
|
|
10904
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10919
10905
|
process.stderr.write(`${stopMessage}
|
|
10920
10906
|
`);
|
|
10921
10907
|
}
|
|
@@ -10923,7 +10909,7 @@ async function runNonInteractive2(params) {
|
|
|
10923
10909
|
const metrics = uiTelemetryService.getMetrics();
|
|
10924
10910
|
const durationMs = Date.now() - startTime;
|
|
10925
10911
|
streamFormatter.emitEvent({
|
|
10926
|
-
type:
|
|
10912
|
+
type: "result" /* RESULT */,
|
|
10927
10913
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10928
10914
|
status: "success",
|
|
10929
10915
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10933,30 +10919,30 @@ async function runNonInteractive2(params) {
|
|
|
10933
10919
|
});
|
|
10934
10920
|
}
|
|
10935
10921
|
return;
|
|
10936
|
-
} else if (event.type ===
|
|
10922
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
10937
10923
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10938
|
-
if (config.getOutputFormat() ===
|
|
10924
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10939
10925
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10940
10926
|
`);
|
|
10941
10927
|
} else if (streamFormatter) {
|
|
10942
10928
|
streamFormatter.emitEvent({
|
|
10943
|
-
type:
|
|
10929
|
+
type: "error" /* ERROR */,
|
|
10944
10930
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10945
10931
|
severity: "warning",
|
|
10946
10932
|
message: stripAnsi(blockMessage)
|
|
10947
10933
|
});
|
|
10948
10934
|
}
|
|
10949
10935
|
warnings.push(blockMessage);
|
|
10950
|
-
} else if (event.type ===
|
|
10936
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
10951
10937
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10952
10938
|
if (streamFormatter) {
|
|
10953
10939
|
streamFormatter.emitEvent({
|
|
10954
|
-
type:
|
|
10940
|
+
type: "error" /* ERROR */,
|
|
10955
10941
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10956
10942
|
severity: "error",
|
|
10957
10943
|
message: invalidStreamError
|
|
10958
10944
|
});
|
|
10959
|
-
} else if (config.getOutputFormat() ===
|
|
10945
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10960
10946
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10961
10947
|
`);
|
|
10962
10948
|
}
|
|
@@ -10976,7 +10962,7 @@ async function runNonInteractive2(params) {
|
|
|
10976
10962
|
const requestInfo = completedToolCall.request;
|
|
10977
10963
|
if (streamFormatter) {
|
|
10978
10964
|
streamFormatter.emitEvent({
|
|
10979
|
-
type:
|
|
10965
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10980
10966
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10981
10967
|
tool_id: requestInfo.callId,
|
|
10982
10968
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11010,11 +10996,11 @@ async function runNonInteractive2(params) {
|
|
|
11010
10996
|
);
|
|
11011
10997
|
}
|
|
11012
10998
|
const stopExecutionTool = completedToolCalls.find(
|
|
11013
|
-
(tc) => tc.response.errorType ===
|
|
10999
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11014
11000
|
);
|
|
11015
11001
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11016
11002
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11017
|
-
if (config.getOutputFormat() ===
|
|
11003
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11018
11004
|
process.stderr.write(`${stopMessage}
|
|
11019
11005
|
`);
|
|
11020
11006
|
}
|
|
@@ -11022,7 +11008,7 @@ async function runNonInteractive2(params) {
|
|
|
11022
11008
|
const metrics = uiTelemetryService.getMetrics();
|
|
11023
11009
|
const durationMs = Date.now() - startTime;
|
|
11024
11010
|
streamFormatter.emitEvent({
|
|
11025
|
-
type:
|
|
11011
|
+
type: "result" /* RESULT */,
|
|
11026
11012
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11027
11013
|
status: "success",
|
|
11028
11014
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11030,7 +11016,7 @@ async function runNonInteractive2(params) {
|
|
|
11030
11016
|
durationMs
|
|
11031
11017
|
)
|
|
11032
11018
|
});
|
|
11033
|
-
} else if (config.getOutputFormat() ===
|
|
11019
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11034
11020
|
const formatter = new JsonFormatter();
|
|
11035
11021
|
const stats = uiTelemetryService.getMetrics();
|
|
11036
11022
|
textOutput.write(
|
|
@@ -11053,12 +11039,12 @@ async function runNonInteractive2(params) {
|
|
|
11053
11039
|
const metrics = uiTelemetryService.getMetrics();
|
|
11054
11040
|
const durationMs = Date.now() - startTime;
|
|
11055
11041
|
streamFormatter.emitEvent({
|
|
11056
|
-
type:
|
|
11042
|
+
type: "result" /* RESULT */,
|
|
11057
11043
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11058
11044
|
status: invalidStreamError ? "error" : "success",
|
|
11059
11045
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11060
11046
|
});
|
|
11061
|
-
} else if (config.getOutputFormat() ===
|
|
11047
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11062
11048
|
const formatter = new JsonFormatter();
|
|
11063
11049
|
const stats = uiTelemetryService.getMetrics();
|
|
11064
11050
|
textOutput.write(
|
|
@@ -11082,7 +11068,7 @@ async function runNonInteractive2(params) {
|
|
|
11082
11068
|
cleanupStdinCancellation();
|
|
11083
11069
|
scheduler?.dispose();
|
|
11084
11070
|
consolePatcher.cleanup();
|
|
11085
|
-
coreEvents.off(
|
|
11071
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11086
11072
|
}
|
|
11087
11073
|
if (errorToHandle) {
|
|
11088
11074
|
handleError(errorToHandle, config);
|
|
@@ -13513,12 +13499,12 @@ function toToolCallContent(toolResult) {
|
|
|
13513
13499
|
}
|
|
13514
13500
|
var basicPermissionOptions = [
|
|
13515
13501
|
{
|
|
13516
|
-
optionId:
|
|
13502
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
13517
13503
|
name: "Allow",
|
|
13518
13504
|
kind: "allow_once"
|
|
13519
13505
|
},
|
|
13520
13506
|
{
|
|
13521
|
-
optionId:
|
|
13507
|
+
optionId: "cancel" /* Cancel */,
|
|
13522
13508
|
name: "Reject",
|
|
13523
13509
|
kind: "reject_once"
|
|
13524
13510
|
}
|
|
@@ -13530,13 +13516,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13530
13516
|
switch (confirmation.type) {
|
|
13531
13517
|
case "edit":
|
|
13532
13518
|
options.push({
|
|
13533
|
-
optionId:
|
|
13519
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13534
13520
|
name: "Allow for this session",
|
|
13535
13521
|
kind: "allow_always"
|
|
13536
13522
|
});
|
|
13537
13523
|
if (enablePermanentToolApproval) {
|
|
13538
13524
|
options.push({
|
|
13539
|
-
optionId:
|
|
13525
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13540
13526
|
name: "Allow for this file in all future sessions",
|
|
13541
13527
|
kind: "allow_always"
|
|
13542
13528
|
});
|
|
@@ -13544,13 +13530,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13544
13530
|
break;
|
|
13545
13531
|
case "exec":
|
|
13546
13532
|
options.push({
|
|
13547
|
-
optionId:
|
|
13533
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13548
13534
|
name: "Allow for this session",
|
|
13549
13535
|
kind: "allow_always"
|
|
13550
13536
|
});
|
|
13551
13537
|
if (enablePermanentToolApproval) {
|
|
13552
13538
|
options.push({
|
|
13553
|
-
optionId:
|
|
13539
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13554
13540
|
name: "Allow this command for all future sessions",
|
|
13555
13541
|
kind: "allow_always"
|
|
13556
13542
|
});
|
|
@@ -13559,19 +13545,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13559
13545
|
case "mcp":
|
|
13560
13546
|
options.push(
|
|
13561
13547
|
{
|
|
13562
|
-
optionId:
|
|
13548
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
13563
13549
|
name: "Allow all server tools for this session",
|
|
13564
13550
|
kind: "allow_always"
|
|
13565
13551
|
},
|
|
13566
13552
|
{
|
|
13567
|
-
optionId:
|
|
13553
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
13568
13554
|
name: "Allow tool for this session",
|
|
13569
13555
|
kind: "allow_always"
|
|
13570
13556
|
}
|
|
13571
13557
|
);
|
|
13572
13558
|
if (enablePermanentToolApproval) {
|
|
13573
13559
|
options.push({
|
|
13574
|
-
optionId:
|
|
13560
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13575
13561
|
name: "Allow tool for all future sessions",
|
|
13576
13562
|
kind: "allow_always"
|
|
13577
13563
|
});
|
|
@@ -13579,13 +13565,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13579
13565
|
break;
|
|
13580
13566
|
case "info":
|
|
13581
13567
|
options.push({
|
|
13582
|
-
optionId:
|
|
13568
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13583
13569
|
name: "Allow for this session",
|
|
13584
13570
|
kind: "allow_always"
|
|
13585
13571
|
});
|
|
13586
13572
|
if (enablePermanentToolApproval) {
|
|
13587
13573
|
options.push({
|
|
13588
|
-
optionId:
|
|
13574
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13589
13575
|
name: "Allow for all future sessions",
|
|
13590
13576
|
kind: "allow_always"
|
|
13591
13577
|
});
|
|
@@ -13617,21 +13603,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13617
13603
|
}
|
|
13618
13604
|
function toAcpToolKind(kind) {
|
|
13619
13605
|
switch (kind) {
|
|
13620
|
-
case
|
|
13621
|
-
case
|
|
13622
|
-
case
|
|
13623
|
-
case
|
|
13624
|
-
case
|
|
13625
|
-
case
|
|
13626
|
-
case
|
|
13627
|
-
case
|
|
13628
|
-
case
|
|
13629
|
-
case
|
|
13606
|
+
case "read" /* Read */:
|
|
13607
|
+
case "edit" /* Edit */:
|
|
13608
|
+
case "execute" /* Execute */:
|
|
13609
|
+
case "search" /* Search */:
|
|
13610
|
+
case "delete" /* Delete */:
|
|
13611
|
+
case "move" /* Move */:
|
|
13612
|
+
case "think" /* Think */:
|
|
13613
|
+
case "fetch" /* Fetch */:
|
|
13614
|
+
case "switch_mode" /* SwitchMode */:
|
|
13615
|
+
case "other" /* Other */:
|
|
13630
13616
|
return kind;
|
|
13631
|
-
case
|
|
13617
|
+
case "agent" /* Agent */:
|
|
13632
13618
|
return "think";
|
|
13633
|
-
case
|
|
13634
|
-
case
|
|
13619
|
+
case "plan" /* Plan */:
|
|
13620
|
+
case "communicate" /* Communicate */:
|
|
13635
13621
|
default:
|
|
13636
13622
|
return "other";
|
|
13637
13623
|
}
|
|
@@ -13639,24 +13625,24 @@ function toAcpToolKind(kind) {
|
|
|
13639
13625
|
function buildAvailableModes(isPlanEnabled) {
|
|
13640
13626
|
const modes = [
|
|
13641
13627
|
{
|
|
13642
|
-
id:
|
|
13628
|
+
id: "default" /* DEFAULT */,
|
|
13643
13629
|
name: "Default",
|
|
13644
13630
|
description: "Prompts for approval"
|
|
13645
13631
|
},
|
|
13646
13632
|
{
|
|
13647
|
-
id:
|
|
13633
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
13648
13634
|
name: "Auto Edit",
|
|
13649
13635
|
description: "Auto-approves edit tools"
|
|
13650
13636
|
},
|
|
13651
13637
|
{
|
|
13652
|
-
id:
|
|
13638
|
+
id: "yolo" /* YOLO */,
|
|
13653
13639
|
name: "YOLO",
|
|
13654
13640
|
description: "Auto-approves all tools"
|
|
13655
13641
|
}
|
|
13656
13642
|
];
|
|
13657
13643
|
if (isPlanEnabled) {
|
|
13658
13644
|
modes.push({
|
|
13659
|
-
id:
|
|
13645
|
+
id: "plan" /* PLAN */,
|
|
13660
13646
|
name: "Plan",
|
|
13661
13647
|
description: "Read-only mode"
|
|
13662
13648
|
});
|
|
@@ -13669,7 +13655,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13669
13655
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13670
13656
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
13671
13657
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13672
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13658
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
13673
13659
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13674
13660
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13675
13661
|
useGemini3_1: useGemini31,
|
|
@@ -13758,7 +13744,7 @@ var Session = class {
|
|
|
13758
13744
|
this.connection = connection;
|
|
13759
13745
|
this.settings = settings;
|
|
13760
13746
|
coreEvents.on(
|
|
13761
|
-
|
|
13747
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13762
13748
|
this.handleApprovalModeChanged
|
|
13763
13749
|
);
|
|
13764
13750
|
}
|
|
@@ -13781,7 +13767,7 @@ var Session = class {
|
|
|
13781
13767
|
};
|
|
13782
13768
|
dispose() {
|
|
13783
13769
|
coreEvents.off(
|
|
13784
|
-
|
|
13770
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13785
13771
|
this.handleApprovalModeChanged
|
|
13786
13772
|
);
|
|
13787
13773
|
}
|
|
@@ -13869,7 +13855,7 @@ ${thought.description}`;
|
|
|
13869
13855
|
await this.sendUpdate({
|
|
13870
13856
|
sessionUpdate: "tool_call",
|
|
13871
13857
|
toolCallId: toolCall.id,
|
|
13872
|
-
status: toolCall.status ===
|
|
13858
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
13873
13859
|
title: toolCall.displayName || toolCall.name,
|
|
13874
13860
|
content: toolCallContent,
|
|
13875
13861
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -13961,7 +13947,7 @@ ${thought.description}`;
|
|
|
13961
13947
|
return { stopReason: "cancelled" };
|
|
13962
13948
|
}
|
|
13963
13949
|
switch (event.type) {
|
|
13964
|
-
case
|
|
13950
|
+
case "content" /* Content */: {
|
|
13965
13951
|
const content = {
|
|
13966
13952
|
type: "text",
|
|
13967
13953
|
text: event.value
|
|
@@ -13972,7 +13958,7 @@ ${thought.description}`;
|
|
|
13972
13958
|
});
|
|
13973
13959
|
break;
|
|
13974
13960
|
}
|
|
13975
|
-
case
|
|
13961
|
+
case "thought" /* Thought */: {
|
|
13976
13962
|
const thoughtText = `**${event.value.subject}**
|
|
13977
13963
|
${event.value.description}`;
|
|
13978
13964
|
await this.sendUpdate({
|
|
@@ -13981,10 +13967,10 @@ ${event.value.description}`;
|
|
|
13981
13967
|
});
|
|
13982
13968
|
break;
|
|
13983
13969
|
}
|
|
13984
|
-
case
|
|
13970
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
13985
13971
|
toolCallRequests.push(event.value);
|
|
13986
13972
|
break;
|
|
13987
|
-
case
|
|
13973
|
+
case "finished" /* Finished */: {
|
|
13988
13974
|
const usage2 = event.value.usageMetadata;
|
|
13989
13975
|
if (usage2) {
|
|
13990
13976
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -13992,19 +13978,19 @@ ${event.value.description}`;
|
|
|
13992
13978
|
}
|
|
13993
13979
|
break;
|
|
13994
13980
|
}
|
|
13995
|
-
case
|
|
13981
|
+
case "model_info" /* ModelInfo */:
|
|
13996
13982
|
turnModelId = event.value;
|
|
13997
13983
|
break;
|
|
13998
|
-
case
|
|
13984
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
13999
13985
|
stopReason = "max_turn_requests";
|
|
14000
13986
|
break;
|
|
14001
|
-
case
|
|
13987
|
+
case "loop_detected" /* LoopDetected */:
|
|
14002
13988
|
stopReason = "max_turn_requests";
|
|
14003
13989
|
break;
|
|
14004
|
-
case
|
|
13990
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14005
13991
|
stopReason = "max_tokens";
|
|
14006
13992
|
break;
|
|
14007
|
-
case
|
|
13993
|
+
case "error" /* Error */: {
|
|
14008
13994
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14009
13995
|
event.value.error
|
|
14010
13996
|
);
|
|
@@ -14232,7 +14218,7 @@ ${event.value.description}`;
|
|
|
14232
14218
|
const output = RequestPermissionResponseSchema.parse(
|
|
14233
14219
|
await this.connection.requestPermission(params)
|
|
14234
14220
|
);
|
|
14235
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14221
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14236
14222
|
await confirmationDetails.onConfirm(outcome);
|
|
14237
14223
|
await updatePolicy(
|
|
14238
14224
|
tool,
|
|
@@ -14243,16 +14229,16 @@ ${event.value.description}`;
|
|
|
14243
14229
|
invocation
|
|
14244
14230
|
);
|
|
14245
14231
|
switch (outcome) {
|
|
14246
|
-
case
|
|
14232
|
+
case "cancel" /* Cancel */:
|
|
14247
14233
|
return errorResponse(
|
|
14248
14234
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14249
14235
|
);
|
|
14250
|
-
case
|
|
14251
|
-
case
|
|
14252
|
-
case
|
|
14253
|
-
case
|
|
14254
|
-
case
|
|
14255
|
-
case
|
|
14236
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14237
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14238
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14239
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14240
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14241
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14256
14242
|
break;
|
|
14257
14243
|
default: {
|
|
14258
14244
|
const resultOutcome = outcome;
|
|
@@ -14300,7 +14286,7 @@ ${event.value.description}`;
|
|
|
14300
14286
|
);
|
|
14301
14287
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14302
14288
|
{
|
|
14303
|
-
status:
|
|
14289
|
+
status: "success" /* Success */,
|
|
14304
14290
|
request: {
|
|
14305
14291
|
callId,
|
|
14306
14292
|
name: fc.name,
|
|
@@ -14345,7 +14331,7 @@ ${event.value.description}`;
|
|
|
14345
14331
|
});
|
|
14346
14332
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14347
14333
|
{
|
|
14348
|
-
status:
|
|
14334
|
+
status: "error" /* Error */,
|
|
14349
14335
|
request: {
|
|
14350
14336
|
callId,
|
|
14351
14337
|
name: fc.name,
|
|
@@ -14460,12 +14446,12 @@ ${event.value.description}`;
|
|
|
14460
14446
|
sessionId: this.id,
|
|
14461
14447
|
options: [
|
|
14462
14448
|
{
|
|
14463
|
-
optionId:
|
|
14449
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14464
14450
|
name: "Allow once",
|
|
14465
14451
|
kind: "allow_once"
|
|
14466
14452
|
},
|
|
14467
14453
|
{
|
|
14468
|
-
optionId:
|
|
14454
|
+
optionId: "cancel" /* Cancel */,
|
|
14469
14455
|
name: "Deny",
|
|
14470
14456
|
kind: "reject_once"
|
|
14471
14457
|
}
|
|
@@ -14490,8 +14476,8 @@ ${event.value.description}`;
|
|
|
14490
14476
|
const output = RequestPermissionResponseSchema.parse(
|
|
14491
14477
|
await this.connection.requestPermission(params)
|
|
14492
14478
|
);
|
|
14493
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14494
|
-
if (outcome ===
|
|
14479
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14480
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
14495
14481
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14496
14482
|
validationError = null;
|
|
14497
14483
|
} else {
|
|
@@ -14923,7 +14909,7 @@ var AcpSessionManager = class {
|
|
|
14923
14909
|
mcpServers,
|
|
14924
14910
|
loadedSettings
|
|
14925
14911
|
);
|
|
14926
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
14912
|
+
const authType = loadedSettings.merged.security.auth.selectedType || "gemini-api-key" /* USE_GEMINI */;
|
|
14927
14913
|
let isAuthenticated = false;
|
|
14928
14914
|
let authErrorMessage = "";
|
|
14929
14915
|
try {
|
|
@@ -14935,7 +14921,7 @@ var AcpSessionManager = class {
|
|
|
14935
14921
|
);
|
|
14936
14922
|
isAuthenticated = true;
|
|
14937
14923
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
14938
|
-
if (authType ===
|
|
14924
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
14939
14925
|
isAuthenticated = false;
|
|
14940
14926
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
14941
14927
|
}
|
|
@@ -15145,12 +15131,12 @@ var GeminiAgent = class {
|
|
|
15145
15131
|
}
|
|
15146
15132
|
const authMethods = [
|
|
15147
15133
|
{
|
|
15148
|
-
id:
|
|
15134
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
15149
15135
|
name: "Log in with Google",
|
|
15150
15136
|
description: "Log in with your Google account"
|
|
15151
15137
|
},
|
|
15152
15138
|
{
|
|
15153
|
-
id:
|
|
15139
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
15154
15140
|
name: "Gemini API key",
|
|
15155
15141
|
description: "Use an API key with Gemini Developer API",
|
|
15156
15142
|
_meta: {
|
|
@@ -15160,12 +15146,12 @@ var GeminiAgent = class {
|
|
|
15160
15146
|
}
|
|
15161
15147
|
},
|
|
15162
15148
|
{
|
|
15163
|
-
id:
|
|
15149
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
15164
15150
|
name: "Vertex AI",
|
|
15165
15151
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15166
15152
|
},
|
|
15167
15153
|
{
|
|
15168
|
-
id:
|
|
15154
|
+
id: "gateway" /* GATEWAY */,
|
|
15169
15155
|
name: "AI API Gateway",
|
|
15170
15156
|
description: "Use a custom AI API Gateway",
|
|
15171
15157
|
_meta: {
|
|
@@ -15338,7 +15324,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15338
15324
|
}
|
|
15339
15325
|
return authType;
|
|
15340
15326
|
} catch (error) {
|
|
15341
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15327
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
15342
15328
|
handleError(
|
|
15343
15329
|
error instanceof Error ? error : new Error(String(error)),
|
|
15344
15330
|
nonInteractiveConfig,
|
|
@@ -15534,10 +15520,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15534
15520
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15535
15521
|
}
|
|
15536
15522
|
start() {
|
|
15537
|
-
coreEvents.on(
|
|
15523
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15538
15524
|
}
|
|
15539
15525
|
stop() {
|
|
15540
|
-
coreEvents.off(
|
|
15526
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15541
15527
|
if (this.flushTimeout) {
|
|
15542
15528
|
clearTimeout(this.flushTimeout);
|
|
15543
15529
|
this.flushTimeout = null;
|
|
@@ -15760,7 +15746,7 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
|
|
|
15760
15746
|
}
|
|
15761
15747
|
}
|
|
15762
15748
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15763
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15749
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-MZFG35NB.js");
|
|
15764
15750
|
await doStartUI(
|
|
15765
15751
|
config,
|
|
15766
15752
|
settings,
|
|
@@ -15862,12 +15848,12 @@ async function main() {
|
|
|
15862
15848
|
dns.setDefaultResultOrder(
|
|
15863
15849
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
15864
15850
|
);
|
|
15865
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
15851
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
15866
15852
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
15867
15853
|
settings.setValue(
|
|
15868
15854
|
"User" /* User */,
|
|
15869
15855
|
"security.auth.selectedType",
|
|
15870
|
-
|
|
15856
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
15871
15857
|
);
|
|
15872
15858
|
}
|
|
15873
15859
|
}
|
|
@@ -15967,7 +15953,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15967
15953
|
await config.storage.initialize();
|
|
15968
15954
|
adminControlsListner.setConfig(config);
|
|
15969
15955
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15970
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
15956
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-TRDGMQLJ.js");
|
|
15971
15957
|
setupInitialActivityLogger(config);
|
|
15972
15958
|
}
|
|
15973
15959
|
registerTelemetryConfig(config);
|
|
@@ -15975,7 +15961,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15975
15961
|
const messageBus = config.getMessageBus();
|
|
15976
15962
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
15977
15963
|
registerCleanup(async () => {
|
|
15978
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
15964
|
+
await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
15979
15965
|
});
|
|
15980
15966
|
if (!config.getAcpMode()) {
|
|
15981
15967
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16026,7 +16012,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16026
16012
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16027
16013
|
const initializationResult = await initializeApp(config, settings);
|
|
16028
16014
|
initAppHandle?.end();
|
|
16029
|
-
import("./liteRtServerManager-
|
|
16015
|
+
import("./liteRtServerManager-S7WL25VD.js").then(({ LiteRtServerManager }) => {
|
|
16030
16016
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16031
16017
|
if (!mergedGemma) return;
|
|
16032
16018
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16036,7 +16022,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16036
16022
|
autoStartServer: userGemma?.autoStartServer
|
|
16037
16023
|
});
|
|
16038
16024
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16039
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16025
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
16040
16026
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16041
16027
|
}
|
|
16042
16028
|
if (config.getAcpMode()) {
|
|
@@ -16052,7 +16038,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16052
16038
|
...rawStartupWarnings.map((message) => ({
|
|
16053
16039
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16054
16040
|
message,
|
|
16055
|
-
priority:
|
|
16041
|
+
priority: "high" /* High */
|
|
16056
16042
|
})),
|
|
16057
16043
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16058
16044
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16089,7 +16075,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16089
16075
|
${input}` : stdinData;
|
|
16090
16076
|
}
|
|
16091
16077
|
}
|
|
16092
|
-
const sessionStartSource = resumedSessionData ?
|
|
16078
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
16093
16079
|
const hookSystem = config?.getHookSystem();
|
|
16094
16080
|
if (hookSystem) {
|
|
16095
16081
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16146,8 +16132,8 @@ ${input}` : wrappedContext;
|
|
|
16146
16132
|
}
|
|
16147
16133
|
}
|
|
16148
16134
|
function initializeOutputListenersAndFlush(config) {
|
|
16149
|
-
if (coreEvents.listenerCount(
|
|
16150
|
-
coreEvents.on(
|
|
16135
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
16136
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
16151
16137
|
if (payload.isStderr) {
|
|
16152
16138
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16153
16139
|
} else {
|
|
@@ -16155,8 +16141,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16155
16141
|
}
|
|
16156
16142
|
});
|
|
16157
16143
|
}
|
|
16158
|
-
if (coreEvents.listenerCount(
|
|
16159
|
-
coreEvents.on(
|
|
16144
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
16145
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
16160
16146
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16161
16147
|
writeToStderr(payload.content + "\n");
|
|
16162
16148
|
} else {
|
|
@@ -16164,8 +16150,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16164
16150
|
}
|
|
16165
16151
|
});
|
|
16166
16152
|
}
|
|
16167
|
-
if (coreEvents.listenerCount(
|
|
16168
|
-
coreEvents.on(
|
|
16153
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
16154
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
16169
16155
|
writeToStderr(payload.message + "\n");
|
|
16170
16156
|
});
|
|
16171
16157
|
}
|
|
@@ -16173,7 +16159,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16173
16159
|
const forceToStderr = outputFormat === "json";
|
|
16174
16160
|
coreEvents.drainBacklogs(
|
|
16175
16161
|
(event, args) => {
|
|
16176
|
-
if (forceToStderr && event ===
|
|
16162
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
16177
16163
|
const payload = args[0];
|
|
16178
16164
|
if (!payload.isStderr) {
|
|
16179
16165
|
return {
|