@google/gemini-cli 0.46.0-preview.2 → 0.46.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/builtin/antigravity-support/SKILL.md +58 -0
- package/bundle/{chunk-PIZZXDDG.js → chunk-46UNR4SE.js} +1 -1
- package/bundle/{chunk-E5QEVDYZ.js → chunk-6ZHP2EJW.js} +77 -12
- package/bundle/{chunk-PE7HOVW5.js → chunk-7EBO46BD.js} +2 -2
- package/bundle/{chunk-2K6L5FOH.js → chunk-BM5TFZWV.js} +1 -1
- package/bundle/{chunk-R4U5N4EA.js → chunk-CSKXYL76.js} +2 -2
- package/bundle/{chunk-RS7XVABE.js → chunk-EMVR5JTF.js} +8 -9
- package/bundle/{chunk-27JE2WT6.js → chunk-FC67CGD5.js} +1 -1
- package/bundle/{chunk-O6PTG534.js → chunk-G33JEOEV.js} +14132 -7532
- package/bundle/{chunk-J5LPI3LE.js → chunk-GPDO3T5B.js} +3 -3
- package/bundle/{chunk-7JQYEHGG.js → chunk-I4F637TN.js} +1 -1
- package/bundle/{chunk-LEOT5EUQ.js → chunk-IZGZZO6A.js} +1 -1
- package/bundle/{chunk-CRQJBWDY.js → chunk-IZZGJPR3.js} +1 -1
- package/bundle/{chunk-PRRK6JDC.js → chunk-JOFGDFVN.js} +3 -3
- package/bundle/{chunk-B5F4VQB4.js → chunk-MKQJU6N7.js} +1 -1
- package/bundle/{chunk-CWVF4ZTK.js → chunk-O3ZM34A3.js} +1 -1
- package/bundle/{chunk-EI75YPWJ.js → chunk-RCJSF5RP.js} +64 -8
- package/bundle/{chunk-SIKHBFAN.js → chunk-S5WKKTEF.js} +3 -3
- package/bundle/{chunk-QB7YVNGV.js → chunk-SCXTH56Q.js} +165 -114
- package/bundle/{chunk-5IDNG2OG.js → chunk-T55FPMGN.js} +212 -174
- package/bundle/{chunk-QW5AOX4N.js → chunk-V2OCZBTI.js} +5 -8
- package/bundle/{chunk-WUZJ6YCQ.js → chunk-VFPQ45DS.js} +2 -2
- package/bundle/{chunk-22XWYJCL.js → chunk-XWSJWBAL.js} +165 -114
- package/bundle/{chunk-RHCHEKOW.js → chunk-YIJWUMMP.js} +1 -1
- package/bundle/{chunk-7PDJUYG7.js → chunk-YIKH5LDT.js} +1 -1
- package/bundle/{cleanup-I5FUY2UQ.js → cleanup-HCSVNXSL.js} +2 -2
- package/bundle/{cleanup-OIBS4TJ5.js → cleanup-KA5YYXS3.js} +2 -2
- package/bundle/{cleanup-RODT76X7.js → cleanup-SBGWM3G7.js} +2 -2
- package/bundle/{dist-XLM4ONR2.js → core-K77SYAQL.js} +3 -1
- package/bundle/{core-DU2UPBEJ.js → core-LVRAYGT3.js} +3 -1
- package/bundle/{devtoolsService-C64GR2SQ.js → devtoolsService-ADGLR4UM.js} +2 -2
- package/bundle/{devtoolsService-U7Z6S7CA.js → devtoolsService-ORERBA72.js} +3 -4
- package/bundle/{devtoolsService-EJVCNXD4.js → devtoolsService-WRHZUKOW.js} +2 -2
- package/bundle/{dist-CEGGZCD6.js → dist-6R4J6OFH.js} +3 -1
- package/bundle/{gemini-EEFZ4W4N.js → gemini-LOO67E54.js} +196 -212
- package/bundle/{gemini-D5Y26G7I.js → gemini-STIONCRJ.js} +14 -14
- package/bundle/{gemini-3AA27X7W.js → gemini-YXO2QQ66.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-B5QE2YQH.js → interactiveCli-F337IDVS.js} +30 -20
- package/bundle/{interactiveCli-5L4XUO4D.js → interactiveCli-NKTBHB7O.js} +30 -20
- package/bundle/{interactiveCli-S4W3W3HM.js → interactiveCli-OYDA765S.js} +317 -326
- package/bundle/{liteRtServerManager-2IHVDPV4.js → liteRtServerManager-6CQ3NBHQ.js} +4 -4
- package/bundle/{liteRtServerManager-7CA6UZB6.js → liteRtServerManager-N7CBKKD6.js} +4 -4
- package/bundle/{liteRtServerManager-P4UUE4PT.js → liteRtServerManager-YBJANX3B.js} +4 -4
- package/bundle/{oauth2-provider-WD62E6UF.js → oauth2-provider-AAJFAFW6.js} +1 -1
- package/bundle/{oauth2-provider-5IAYEVTS.js → oauth2-provider-CYIU4X4W.js} +1 -1
- package/bundle/{oauth2-provider-NQK2KDLL.js → oauth2-provider-YNWUFCNW.js} +72 -38
- package/bundle/{start-AAWVXW3L.js → start-CNBBYSNI.js} +6 -6
- package/bundle/{start-EHQUCJL4.js → start-DEWQ46DT.js} +6 -6
- package/bundle/{start-EJWSTD4L.js → start-H7TCWGQL.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-3RBWPCUC.js +0 -154
- package/bundle/chunk-IPUQ7EE3.js +0 -81685
- package/bundle/chunk-NV6UIB5A.js +0 -1571
- package/bundle/chunk-R4UEOSDC.js +0 -398
- package/bundle/chunk-UEE43LJM.js +0 -118
- package/bundle/chunk-UHZJ6CQN.js +0 -17320
- package/bundle/chunk-USOBCNPR.js +0 -394545
- package/bundle/chunk-ZXFPRK6W.js +0 -512
- package/bundle/cleanup-WY7MMPH7.js +0 -32
- package/bundle/devtoolsService-LQXWZBCZ.js +0 -856
- package/bundle/dist-F4ZLD67R.js +0 -2140
- package/bundle/gemini-TPWWVYVB.js +0 -16409
- package/bundle/interactiveCli-CFKGEXFE.js +0 -34742
- package/bundle/liteRtServerManager-YN3VGMDA.js +0 -65
- package/bundle/oauth2-provider-WGTNZKF7.js +0 -235
- package/bundle/start-LAOVDDQF.js +0 -18
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-SCXTH56Q.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-GPDO3T5B.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-IZZGJPR3.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-V2OCZBTI.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-7EBO46BD.js";
|
|
93
|
+
import "./chunk-BM5TFZWV.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,15 +99,12 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-46UNR4SE.js";
|
|
103
103
|
import {
|
|
104
104
|
ASK_USER_TOOL_NAME,
|
|
105
|
-
ApprovalMode,
|
|
106
105
|
AuthType,
|
|
107
106
|
Client,
|
|
108
107
|
Config,
|
|
109
|
-
CoreEvent,
|
|
110
|
-
CoreToolCallStatus,
|
|
111
108
|
DEFAULT_CONTEXT_FILENAME,
|
|
112
109
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
113
110
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -129,45 +126,32 @@ import {
|
|
|
129
126
|
FolderTrustDiscoveryService,
|
|
130
127
|
GEMINI_DIR,
|
|
131
128
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
132
|
-
GeminiEventType,
|
|
133
129
|
IdeClient,
|
|
134
|
-
IntegrityStatus,
|
|
135
130
|
InvalidStreamError,
|
|
136
131
|
JsonFormatter,
|
|
137
|
-
JsonStreamEventType,
|
|
138
|
-
Kind,
|
|
139
132
|
LegacyAgentSession,
|
|
140
133
|
Logger,
|
|
141
134
|
MCPServerConfig,
|
|
142
|
-
MCPServerStatus,
|
|
143
|
-
MessageBusType,
|
|
144
|
-
OutputFormat,
|
|
145
135
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
146
136
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
147
137
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
148
138
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
149
139
|
PREVIEW_GEMINI_MODEL,
|
|
150
|
-
PolicyDecision,
|
|
151
140
|
PolicyIntegrityManager,
|
|
152
141
|
REFERENCE_CONTENT_START,
|
|
153
142
|
ROOT_SCHEDULER_ID,
|
|
154
143
|
ReadManyFilesTool,
|
|
155
144
|
Scheduler,
|
|
156
|
-
SessionEndReason,
|
|
157
|
-
SessionStartSource,
|
|
158
145
|
ShellExecutionService,
|
|
159
146
|
SimpleExtensionLoader,
|
|
160
147
|
Storage,
|
|
161
148
|
StreamJsonFormatter,
|
|
162
149
|
ToolCallEvent,
|
|
163
150
|
ToolConfirmationOutcome,
|
|
164
|
-
ToolErrorType,
|
|
165
|
-
TrustLevel,
|
|
166
151
|
UserAccountManager,
|
|
167
152
|
UserPromptEvent,
|
|
168
153
|
ValidationCancelledError,
|
|
169
154
|
ValidationRequiredError,
|
|
170
|
-
WarningPriority,
|
|
171
155
|
applyAdminAllowlist,
|
|
172
156
|
applyRequiredServers,
|
|
173
157
|
clearCachedCredentialFile,
|
|
@@ -247,7 +231,7 @@ import {
|
|
|
247
231
|
updatePolicy,
|
|
248
232
|
writeToStderr,
|
|
249
233
|
writeToStdout
|
|
250
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-6ZHP2EJW.js";
|
|
251
235
|
import "./chunk-6HI7VNOG.js";
|
|
252
236
|
import "./chunk-TUDYL3X4.js";
|
|
253
237
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5377,7 +5361,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5377
5361
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5378
5362
|
const isStdio = !!config.command;
|
|
5379
5363
|
if (isStdio && !isTrusted) {
|
|
5380
|
-
return
|
|
5364
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5381
5365
|
}
|
|
5382
5366
|
const client = new Client({
|
|
5383
5367
|
name: "mcp-test-client",
|
|
@@ -5413,7 +5397,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5413
5397
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5414
5398
|
} catch {
|
|
5415
5399
|
await client.close();
|
|
5416
|
-
return
|
|
5400
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5417
5401
|
}
|
|
5418
5402
|
try {
|
|
5419
5403
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5427,10 +5411,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5427
5411
|
);
|
|
5428
5412
|
}
|
|
5429
5413
|
await client.close();
|
|
5430
|
-
return
|
|
5414
|
+
return "connected" /* CONNECTED */;
|
|
5431
5415
|
} catch {
|
|
5432
5416
|
await transport.close();
|
|
5433
|
-
return
|
|
5417
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5434
5418
|
}
|
|
5435
5419
|
}
|
|
5436
5420
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5443,12 +5427,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5443
5427
|
});
|
|
5444
5428
|
if (!loadResult.allowed) {
|
|
5445
5429
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5446
|
-
return
|
|
5430
|
+
return "blocked" /* BLOCKED */;
|
|
5447
5431
|
}
|
|
5448
|
-
return
|
|
5432
|
+
return "disabled" /* DISABLED */;
|
|
5449
5433
|
}
|
|
5450
5434
|
if (!isTrusted) {
|
|
5451
|
-
return
|
|
5435
|
+
return "disabled" /* DISABLED */;
|
|
5452
5436
|
}
|
|
5453
5437
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5454
5438
|
}
|
|
@@ -5494,23 +5478,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5494
5478
|
let statusIndicator = "";
|
|
5495
5479
|
let statusText = "";
|
|
5496
5480
|
switch (status) {
|
|
5497
|
-
case
|
|
5481
|
+
case "connected" /* CONNECTED */:
|
|
5498
5482
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5499
5483
|
statusText = "Connected";
|
|
5500
5484
|
break;
|
|
5501
|
-
case
|
|
5485
|
+
case "connecting" /* CONNECTING */:
|
|
5502
5486
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5503
5487
|
statusText = "Connecting";
|
|
5504
5488
|
break;
|
|
5505
|
-
case
|
|
5489
|
+
case "blocked" /* BLOCKED */:
|
|
5506
5490
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5507
5491
|
statusText = "Blocked";
|
|
5508
5492
|
break;
|
|
5509
|
-
case
|
|
5493
|
+
case "disabled" /* DISABLED */:
|
|
5510
5494
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5511
5495
|
statusText = "Disabled";
|
|
5512
5496
|
break;
|
|
5513
|
-
case
|
|
5497
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5514
5498
|
default:
|
|
5515
5499
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5516
5500
|
statusText = "Disconnected";
|
|
@@ -5796,7 +5780,7 @@ async function handleInstall(args) {
|
|
|
5796
5780
|
);
|
|
5797
5781
|
if (confirmed) {
|
|
5798
5782
|
const trustedFolders = loadTrustedFolders();
|
|
5799
|
-
await trustedFolders.setValue(realPath,
|
|
5783
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5800
5784
|
} else {
|
|
5801
5785
|
throw new Error(
|
|
5802
5786
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7841,7 +7825,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7841
7825
|
}
|
|
7842
7826
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7843
7827
|
const packageJson = await getPackageJson(__dirname3);
|
|
7844
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.46.0
|
|
7828
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.46.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7845
7829
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7846
7830
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7847
7831
|
}
|
|
@@ -7900,9 +7884,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7900
7884
|
cwd,
|
|
7901
7885
|
potentialWorkspacePoliciesDir
|
|
7902
7886
|
);
|
|
7903
|
-
if (integrityResult.status ===
|
|
7887
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7904
7888
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7905
|
-
} else if (integrityResult.status ===
|
|
7889
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7906
7890
|
workspacePoliciesDir = void 0;
|
|
7907
7891
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7908
7892
|
policyUpdateConfirmationRequest = {
|
|
@@ -8330,23 +8314,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8330
8314
|
if (rawApprovalMode) {
|
|
8331
8315
|
switch (rawApprovalMode) {
|
|
8332
8316
|
case "yolo":
|
|
8333
|
-
approvalMode =
|
|
8317
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8334
8318
|
break;
|
|
8335
8319
|
case "auto_edit":
|
|
8336
|
-
approvalMode =
|
|
8320
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8337
8321
|
break;
|
|
8338
8322
|
case "plan":
|
|
8339
8323
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8340
8324
|
debugLogger.warn(
|
|
8341
8325
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8342
8326
|
);
|
|
8343
|
-
approvalMode =
|
|
8327
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8344
8328
|
} else {
|
|
8345
|
-
approvalMode =
|
|
8329
|
+
approvalMode = "plan" /* PLAN */;
|
|
8346
8330
|
}
|
|
8347
8331
|
break;
|
|
8348
8332
|
case "default":
|
|
8349
|
-
approvalMode =
|
|
8333
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8350
8334
|
break;
|
|
8351
8335
|
default:
|
|
8352
8336
|
throw new Error(
|
|
@@ -8354,10 +8338,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8354
8338
|
);
|
|
8355
8339
|
}
|
|
8356
8340
|
} else {
|
|
8357
|
-
approvalMode =
|
|
8341
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8358
8342
|
}
|
|
8359
8343
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8360
|
-
if (approvalMode ===
|
|
8344
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8361
8345
|
if (settings.admin?.secureModeEnabled) {
|
|
8362
8346
|
debugLogger.error(
|
|
8363
8347
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8375,16 +8359,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8375
8359
|
)
|
|
8376
8360
|
);
|
|
8377
8361
|
}
|
|
8378
|
-
} else if (approvalMode ===
|
|
8362
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8379
8363
|
debugLogger.warn(
|
|
8380
8364
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8381
8365
|
);
|
|
8382
8366
|
}
|
|
8383
|
-
if (!trustedFolder && approvalMode !==
|
|
8367
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8384
8368
|
debugLogger.warn(
|
|
8385
8369
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8386
8370
|
);
|
|
8387
|
-
approvalMode =
|
|
8371
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8388
8372
|
}
|
|
8389
8373
|
let telemetrySettings;
|
|
8390
8374
|
try {
|
|
@@ -9822,7 +9806,7 @@ import path9 from "node:path";
|
|
|
9822
9806
|
import process4 from "node:process";
|
|
9823
9807
|
var homeDirectoryCheck = {
|
|
9824
9808
|
id: "home-directory",
|
|
9825
|
-
priority:
|
|
9809
|
+
priority: "low" /* Low */,
|
|
9826
9810
|
check: async (workspaceRoot, settings) => {
|
|
9827
9811
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9828
9812
|
return null;
|
|
@@ -9846,7 +9830,7 @@ var homeDirectoryCheck = {
|
|
|
9846
9830
|
};
|
|
9847
9831
|
var rootDirectoryCheck = {
|
|
9848
9832
|
id: "root-directory",
|
|
9849
|
-
priority:
|
|
9833
|
+
priority: "high" /* High */,
|
|
9850
9834
|
check: async (workspaceRoot, _settings) => {
|
|
9851
9835
|
try {
|
|
9852
9836
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9862,7 +9846,7 @@ var rootDirectoryCheck = {
|
|
|
9862
9846
|
};
|
|
9863
9847
|
var folderTrustCheck = {
|
|
9864
9848
|
id: "folder-trust",
|
|
9865
|
-
priority:
|
|
9849
|
+
priority: "high" /* High */,
|
|
9866
9850
|
check: async (workspaceRoot, settings) => {
|
|
9867
9851
|
if (!isFolderTrustEnabled(settings)) {
|
|
9868
9852
|
return null;
|
|
@@ -10052,12 +10036,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10052
10036
|
error,
|
|
10053
10037
|
config.getContentGeneratorConfig()?.authType
|
|
10054
10038
|
);
|
|
10055
|
-
if (config.getOutputFormat() ===
|
|
10039
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10056
10040
|
const streamFormatter = new StreamJsonFormatter();
|
|
10057
10041
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10058
10042
|
const metrics = uiTelemetryService.getMetrics();
|
|
10059
10043
|
streamFormatter.emitEvent({
|
|
10060
|
-
type:
|
|
10044
|
+
type: "result" /* RESULT */,
|
|
10061
10045
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10062
10046
|
status: "error",
|
|
10063
10047
|
error: {
|
|
@@ -10068,7 +10052,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10068
10052
|
});
|
|
10069
10053
|
runSyncCleanup();
|
|
10070
10054
|
process.exit(getNumericExitCode(errorCode));
|
|
10071
|
-
} else if (config.getOutputFormat() ===
|
|
10055
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10072
10056
|
const formatter = new JsonFormatter();
|
|
10073
10057
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10074
10058
|
const formattedError = formatter.formatError(
|
|
@@ -10088,11 +10072,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10088
10072
|
const isFatal = isFatalToolError(errorType);
|
|
10089
10073
|
if (isFatal) {
|
|
10090
10074
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10091
|
-
if (config.getOutputFormat() ===
|
|
10075
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10092
10076
|
const streamFormatter = new StreamJsonFormatter();
|
|
10093
10077
|
const metrics = uiTelemetryService.getMetrics();
|
|
10094
10078
|
streamFormatter.emitEvent({
|
|
10095
|
-
type:
|
|
10079
|
+
type: "result" /* RESULT */,
|
|
10096
10080
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10097
10081
|
status: "error",
|
|
10098
10082
|
error: {
|
|
@@ -10101,7 +10085,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10101
10085
|
},
|
|
10102
10086
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10103
10087
|
});
|
|
10104
|
-
} else if (config.getOutputFormat() ===
|
|
10088
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10105
10089
|
const formatter = new JsonFormatter();
|
|
10106
10090
|
const formattedError = formatter.formatError(
|
|
10107
10091
|
toolExecutionError,
|
|
@@ -10119,11 +10103,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10119
10103
|
}
|
|
10120
10104
|
function handleCancellationError(config) {
|
|
10121
10105
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10122
|
-
if (config.getOutputFormat() ===
|
|
10106
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10123
10107
|
const streamFormatter = new StreamJsonFormatter();
|
|
10124
10108
|
const metrics = uiTelemetryService.getMetrics();
|
|
10125
10109
|
streamFormatter.emitEvent({
|
|
10126
|
-
type:
|
|
10110
|
+
type: "result" /* RESULT */,
|
|
10127
10111
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10128
10112
|
status: "error",
|
|
10129
10113
|
error: {
|
|
@@ -10134,7 +10118,7 @@ function handleCancellationError(config) {
|
|
|
10134
10118
|
});
|
|
10135
10119
|
runSyncCleanup();
|
|
10136
10120
|
process.exit(cancellationError.exitCode);
|
|
10137
|
-
} else if (config.getOutputFormat() ===
|
|
10121
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10138
10122
|
const formatter = new JsonFormatter();
|
|
10139
10123
|
const formattedError = formatter.formatError(
|
|
10140
10124
|
cancellationError,
|
|
@@ -10154,11 +10138,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10154
10138
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10155
10139
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10156
10140
|
);
|
|
10157
|
-
if (config.getOutputFormat() ===
|
|
10141
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10158
10142
|
const streamFormatter = new StreamJsonFormatter();
|
|
10159
10143
|
const metrics = uiTelemetryService.getMetrics();
|
|
10160
10144
|
streamFormatter.emitEvent({
|
|
10161
|
-
type:
|
|
10145
|
+
type: "result" /* RESULT */,
|
|
10162
10146
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10163
10147
|
status: "error",
|
|
10164
10148
|
error: {
|
|
@@ -10169,7 +10153,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10169
10153
|
});
|
|
10170
10154
|
runSyncCleanup();
|
|
10171
10155
|
process.exit(maxTurnsError.exitCode);
|
|
10172
|
-
} else if (config.getOutputFormat() ===
|
|
10156
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10173
10157
|
const formatter = new JsonFormatter();
|
|
10174
10158
|
const formattedError = formatter.formatError(
|
|
10175
10159
|
maxTurnsError,
|
|
@@ -10249,7 +10233,7 @@ async function runNonInteractive({
|
|
|
10249
10233
|
}
|
|
10250
10234
|
});
|
|
10251
10235
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10252
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10236
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-ADGLR4UM.js");
|
|
10253
10237
|
setupInitialActivityLogger(config);
|
|
10254
10238
|
}
|
|
10255
10239
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10265,7 +10249,7 @@ async function runNonInteractive({
|
|
|
10265
10249
|
}
|
|
10266
10250
|
};
|
|
10267
10251
|
const startTime = Date.now();
|
|
10268
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10252
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10269
10253
|
const abortController = new AbortController();
|
|
10270
10254
|
let isAborting = false;
|
|
10271
10255
|
let cancelMessageTimer = null;
|
|
@@ -10318,13 +10302,13 @@ async function runNonInteractive({
|
|
|
10318
10302
|
};
|
|
10319
10303
|
try {
|
|
10320
10304
|
consolePatcher.patch();
|
|
10321
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10305
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10322
10306
|
process.stderr.write(
|
|
10323
10307
|
"[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"
|
|
10324
10308
|
);
|
|
10325
10309
|
}
|
|
10326
10310
|
setupStdinCancellation();
|
|
10327
|
-
coreEvents.on(
|
|
10311
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10328
10312
|
coreEvents.drainBacklogs();
|
|
10329
10313
|
process.stdout.on("error", (err) => {
|
|
10330
10314
|
if (err.code === "EPIPE") {
|
|
@@ -10350,7 +10334,7 @@ async function runNonInteractive({
|
|
|
10350
10334
|
}
|
|
10351
10335
|
if (streamFormatter) {
|
|
10352
10336
|
streamFormatter.emitEvent({
|
|
10353
|
-
type:
|
|
10337
|
+
type: "init" /* INIT */,
|
|
10354
10338
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10355
10339
|
session_id: config.getSessionId(),
|
|
10356
10340
|
model: config.getModel()
|
|
@@ -10388,7 +10372,7 @@ async function runNonInteractive({
|
|
|
10388
10372
|
}
|
|
10389
10373
|
if (streamFormatter) {
|
|
10390
10374
|
streamFormatter.emitEvent({
|
|
10391
|
-
type:
|
|
10375
|
+
type: "message" /* MESSAGE */,
|
|
10392
10376
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10393
10377
|
role: "user",
|
|
10394
10378
|
content: input
|
|
@@ -10427,12 +10411,12 @@ async function runNonInteractive({
|
|
|
10427
10411
|
const metrics = uiTelemetryService.getMetrics();
|
|
10428
10412
|
const durationMs = Date.now() - startTime;
|
|
10429
10413
|
streamFormatter.emitEvent({
|
|
10430
|
-
type:
|
|
10414
|
+
type: "result" /* RESULT */,
|
|
10431
10415
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10432
10416
|
status: "success",
|
|
10433
10417
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10434
10418
|
});
|
|
10435
|
-
} else if (config.getOutputFormat() ===
|
|
10419
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10436
10420
|
const formatter = new JsonFormatter();
|
|
10437
10421
|
const stats = uiTelemetryService.getMetrics();
|
|
10438
10422
|
textOutput.write(
|
|
@@ -10525,13 +10509,13 @@ async function runNonInteractive({
|
|
|
10525
10509
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10526
10510
|
if (streamFormatter) {
|
|
10527
10511
|
streamFormatter.emitEvent({
|
|
10528
|
-
type:
|
|
10512
|
+
type: "message" /* MESSAGE */,
|
|
10529
10513
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10530
10514
|
role: "assistant",
|
|
10531
10515
|
content: output,
|
|
10532
10516
|
delta: true
|
|
10533
10517
|
});
|
|
10534
|
-
} else if (config.getOutputFormat() ===
|
|
10518
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10535
10519
|
responseText += output;
|
|
10536
10520
|
} else {
|
|
10537
10521
|
if (part.text) {
|
|
@@ -10544,13 +10528,13 @@ async function runNonInteractive({
|
|
|
10544
10528
|
break;
|
|
10545
10529
|
}
|
|
10546
10530
|
case "tool_request": {
|
|
10547
|
-
if (config.getOutputFormat() ===
|
|
10531
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10548
10532
|
preToolResponseText = responseText || preToolResponseText;
|
|
10549
10533
|
responseText = "";
|
|
10550
10534
|
}
|
|
10551
10535
|
if (streamFormatter) {
|
|
10552
10536
|
streamFormatter.emitEvent({
|
|
10553
|
-
type:
|
|
10537
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10554
10538
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10555
10539
|
tool_name: event.name,
|
|
10556
10540
|
tool_id: event.requestId,
|
|
@@ -10566,7 +10550,7 @@ async function runNonInteractive({
|
|
|
10566
10550
|
const displayText = displayContentToString(display);
|
|
10567
10551
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10568
10552
|
streamFormatter.emitEvent({
|
|
10569
|
-
type:
|
|
10553
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10570
10554
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10571
10555
|
tool_id: event.requestId,
|
|
10572
10556
|
status: event.isError ? "error" : "success",
|
|
@@ -10581,17 +10565,17 @@ async function runNonInteractive({
|
|
|
10581
10565
|
const display = event.display?.result;
|
|
10582
10566
|
const displayText = displayContentToString(display);
|
|
10583
10567
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10584
|
-
if (event.data?.["errorType"] ===
|
|
10585
|
-
if (config.getOutputFormat() ===
|
|
10568
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
10569
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
10586
10570
|
responseText = preToolResponseText;
|
|
10587
10571
|
}
|
|
10588
10572
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10589
|
-
if (config.getOutputFormat() ===
|
|
10573
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10590
10574
|
process.stderr.write(`${stopMessage}
|
|
10591
10575
|
`);
|
|
10592
10576
|
}
|
|
10593
10577
|
}
|
|
10594
|
-
if (event.data?.["errorType"] ===
|
|
10578
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
10595
10579
|
throw new FatalToolExecutionError(
|
|
10596
10580
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10597
10581
|
);
|
|
@@ -10613,12 +10597,12 @@ async function runNonInteractive({
|
|
|
10613
10597
|
const errorCode = event._meta?.["code"];
|
|
10614
10598
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10615
10599
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10616
|
-
if (config.getOutputFormat() ===
|
|
10600
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10617
10601
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10618
10602
|
`);
|
|
10619
10603
|
} else if (streamFormatter) {
|
|
10620
10604
|
streamFormatter.emitEvent({
|
|
10621
|
-
type:
|
|
10605
|
+
type: "error" /* ERROR */,
|
|
10622
10606
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10623
10607
|
severity: "warning",
|
|
10624
10608
|
message: stripAnsi(blockMessage)
|
|
@@ -10628,13 +10612,13 @@ async function runNonInteractive({
|
|
|
10628
10612
|
break;
|
|
10629
10613
|
}
|
|
10630
10614
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10631
|
-
if (config.getOutputFormat() ===
|
|
10615
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10632
10616
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10633
10617
|
`);
|
|
10634
10618
|
}
|
|
10635
10619
|
if (streamFormatter) {
|
|
10636
10620
|
streamFormatter.emitEvent({
|
|
10637
|
-
type:
|
|
10621
|
+
type: "error" /* ERROR */,
|
|
10638
10622
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10639
10623
|
severity,
|
|
10640
10624
|
message: stripAnsi(event.message)
|
|
@@ -10654,7 +10638,7 @@ async function runNonInteractive({
|
|
|
10654
10638
|
);
|
|
10655
10639
|
} else if (streamFormatter) {
|
|
10656
10640
|
streamFormatter.emitEvent({
|
|
10657
|
-
type:
|
|
10641
|
+
type: "error" /* ERROR */,
|
|
10658
10642
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10659
10643
|
severity: "error",
|
|
10660
10644
|
message: "Maximum session turns exceeded"
|
|
@@ -10662,7 +10646,7 @@ async function runNonInteractive({
|
|
|
10662
10646
|
}
|
|
10663
10647
|
}
|
|
10664
10648
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10665
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10649
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10666
10650
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10667
10651
|
`);
|
|
10668
10652
|
}
|
|
@@ -10692,7 +10676,7 @@ async function runNonInteractive({
|
|
|
10692
10676
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10693
10677
|
scheduler?.dispose();
|
|
10694
10678
|
consolePatcher.cleanup();
|
|
10695
|
-
coreEvents.off(
|
|
10679
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10696
10680
|
}
|
|
10697
10681
|
if (errorToHandle) {
|
|
10698
10682
|
handleError(errorToHandle, config);
|
|
@@ -10720,7 +10704,7 @@ async function runNonInteractive2(params) {
|
|
|
10720
10704
|
}
|
|
10721
10705
|
});
|
|
10722
10706
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10723
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10707
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-ADGLR4UM.js");
|
|
10724
10708
|
setupInitialActivityLogger(config);
|
|
10725
10709
|
}
|
|
10726
10710
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10736,7 +10720,7 @@ async function runNonInteractive2(params) {
|
|
|
10736
10720
|
}
|
|
10737
10721
|
};
|
|
10738
10722
|
const startTime = Date.now();
|
|
10739
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10723
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10740
10724
|
const abortController = new AbortController();
|
|
10741
10725
|
let isAborting = false;
|
|
10742
10726
|
let cancelMessageTimer = null;
|
|
@@ -10787,13 +10771,13 @@ async function runNonInteractive2(params) {
|
|
|
10787
10771
|
let scheduler;
|
|
10788
10772
|
try {
|
|
10789
10773
|
consolePatcher.patch();
|
|
10790
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10774
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10791
10775
|
process.stderr.write(
|
|
10792
10776
|
"[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"
|
|
10793
10777
|
);
|
|
10794
10778
|
}
|
|
10795
10779
|
setupStdinCancellation();
|
|
10796
|
-
coreEvents.on(
|
|
10780
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10797
10781
|
coreEvents.drainBacklogs();
|
|
10798
10782
|
process.stdout.on("error", (err) => {
|
|
10799
10783
|
if (err.code === "EPIPE") {
|
|
@@ -10817,7 +10801,7 @@ async function runNonInteractive2(params) {
|
|
|
10817
10801
|
}
|
|
10818
10802
|
if (streamFormatter) {
|
|
10819
10803
|
streamFormatter.emitEvent({
|
|
10820
|
-
type:
|
|
10804
|
+
type: "init" /* INIT */,
|
|
10821
10805
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10822
10806
|
session_id: config.getSessionId(),
|
|
10823
10807
|
model: config.getModel()
|
|
@@ -10855,7 +10839,7 @@ async function runNonInteractive2(params) {
|
|
|
10855
10839
|
}
|
|
10856
10840
|
if (streamFormatter) {
|
|
10857
10841
|
streamFormatter.emitEvent({
|
|
10858
|
-
type:
|
|
10842
|
+
type: "message" /* MESSAGE */,
|
|
10859
10843
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10860
10844
|
role: "user",
|
|
10861
10845
|
content: input
|
|
@@ -10883,28 +10867,28 @@ async function runNonInteractive2(params) {
|
|
|
10883
10867
|
if (abortController.signal.aborted) {
|
|
10884
10868
|
handleCancellationError(config);
|
|
10885
10869
|
}
|
|
10886
|
-
if (event.type ===
|
|
10870
|
+
if (event.type === "content" /* Content */) {
|
|
10887
10871
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10888
10872
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10889
10873
|
if (streamFormatter) {
|
|
10890
10874
|
streamFormatter.emitEvent({
|
|
10891
|
-
type:
|
|
10875
|
+
type: "message" /* MESSAGE */,
|
|
10892
10876
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10893
10877
|
role: "assistant",
|
|
10894
10878
|
content: output,
|
|
10895
10879
|
delta: true
|
|
10896
10880
|
});
|
|
10897
|
-
} else if (config.getOutputFormat() ===
|
|
10881
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10898
10882
|
responseText += output;
|
|
10899
10883
|
} else {
|
|
10900
10884
|
if (event.value) {
|
|
10901
10885
|
textOutput.write(output);
|
|
10902
10886
|
}
|
|
10903
10887
|
}
|
|
10904
|
-
} else if (event.type ===
|
|
10888
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10905
10889
|
if (streamFormatter) {
|
|
10906
10890
|
streamFormatter.emitEvent({
|
|
10907
|
-
type:
|
|
10891
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10908
10892
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10909
10893
|
tool_name: event.value.name,
|
|
10910
10894
|
tool_id: event.value.callId,
|
|
@@ -10912,33 +10896,33 @@ async function runNonInteractive2(params) {
|
|
|
10912
10896
|
});
|
|
10913
10897
|
}
|
|
10914
10898
|
toolCallRequests.push(event.value);
|
|
10915
|
-
} else if (event.type ===
|
|
10899
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10916
10900
|
const message = "Loop detected, stopping execution";
|
|
10917
10901
|
if (streamFormatter) {
|
|
10918
10902
|
streamFormatter.emitEvent({
|
|
10919
|
-
type:
|
|
10903
|
+
type: "error" /* ERROR */,
|
|
10920
10904
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10921
10905
|
severity: "warning",
|
|
10922
10906
|
message
|
|
10923
10907
|
});
|
|
10924
10908
|
}
|
|
10925
10909
|
warnings.push(message);
|
|
10926
|
-
} else if (event.type ===
|
|
10910
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10927
10911
|
const message = "Maximum session turns exceeded";
|
|
10928
10912
|
if (streamFormatter) {
|
|
10929
10913
|
streamFormatter.emitEvent({
|
|
10930
|
-
type:
|
|
10914
|
+
type: "error" /* ERROR */,
|
|
10931
10915
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10932
10916
|
severity: "error",
|
|
10933
10917
|
message
|
|
10934
10918
|
});
|
|
10935
10919
|
}
|
|
10936
10920
|
warnings.push(message);
|
|
10937
|
-
} else if (event.type ===
|
|
10921
|
+
} else if (event.type === "error" /* Error */) {
|
|
10938
10922
|
throw event.value.error;
|
|
10939
|
-
} else if (event.type ===
|
|
10923
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10940
10924
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10941
|
-
if (config.getOutputFormat() ===
|
|
10925
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10942
10926
|
process.stderr.write(`${stopMessage}
|
|
10943
10927
|
`);
|
|
10944
10928
|
}
|
|
@@ -10946,7 +10930,7 @@ async function runNonInteractive2(params) {
|
|
|
10946
10930
|
const metrics = uiTelemetryService.getMetrics();
|
|
10947
10931
|
const durationMs = Date.now() - startTime;
|
|
10948
10932
|
streamFormatter.emitEvent({
|
|
10949
|
-
type:
|
|
10933
|
+
type: "result" /* RESULT */,
|
|
10950
10934
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10951
10935
|
status: "success",
|
|
10952
10936
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10954,7 +10938,7 @@ async function runNonInteractive2(params) {
|
|
|
10954
10938
|
durationMs
|
|
10955
10939
|
)
|
|
10956
10940
|
});
|
|
10957
|
-
} else if (config.getOutputFormat() ===
|
|
10941
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10958
10942
|
const formatter = new JsonFormatter();
|
|
10959
10943
|
const stats = uiTelemetryService.getMetrics();
|
|
10960
10944
|
textOutput.write(
|
|
@@ -10970,30 +10954,30 @@ async function runNonInteractive2(params) {
|
|
|
10970
10954
|
textOutput.ensureTrailingNewline();
|
|
10971
10955
|
}
|
|
10972
10956
|
return;
|
|
10973
|
-
} else if (event.type ===
|
|
10957
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
10974
10958
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10975
|
-
if (config.getOutputFormat() ===
|
|
10959
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10976
10960
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10977
10961
|
`);
|
|
10978
10962
|
} else if (streamFormatter) {
|
|
10979
10963
|
streamFormatter.emitEvent({
|
|
10980
|
-
type:
|
|
10964
|
+
type: "error" /* ERROR */,
|
|
10981
10965
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10982
10966
|
severity: "warning",
|
|
10983
10967
|
message: stripAnsi(blockMessage)
|
|
10984
10968
|
});
|
|
10985
10969
|
}
|
|
10986
10970
|
warnings.push(blockMessage);
|
|
10987
|
-
} else if (event.type ===
|
|
10971
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
10988
10972
|
invalidStreamError = "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
10989
10973
|
if (streamFormatter) {
|
|
10990
10974
|
streamFormatter.emitEvent({
|
|
10991
|
-
type:
|
|
10975
|
+
type: "error" /* ERROR */,
|
|
10992
10976
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10993
10977
|
severity: "error",
|
|
10994
10978
|
message: invalidStreamError
|
|
10995
10979
|
});
|
|
10996
|
-
} else if (config.getOutputFormat() ===
|
|
10980
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10997
10981
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10998
10982
|
`);
|
|
10999
10983
|
}
|
|
@@ -11013,7 +10997,7 @@ async function runNonInteractive2(params) {
|
|
|
11013
10997
|
const requestInfo = completedToolCall.request;
|
|
11014
10998
|
if (streamFormatter) {
|
|
11015
10999
|
streamFormatter.emitEvent({
|
|
11016
|
-
type:
|
|
11000
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11017
11001
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11018
11002
|
tool_id: requestInfo.callId,
|
|
11019
11003
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11047,11 +11031,11 @@ async function runNonInteractive2(params) {
|
|
|
11047
11031
|
);
|
|
11048
11032
|
}
|
|
11049
11033
|
const stopExecutionTool = completedToolCalls.find(
|
|
11050
|
-
(tc) => tc.response.errorType ===
|
|
11034
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11051
11035
|
);
|
|
11052
11036
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11053
11037
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11054
|
-
if (config.getOutputFormat() ===
|
|
11038
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11055
11039
|
process.stderr.write(`${stopMessage}
|
|
11056
11040
|
`);
|
|
11057
11041
|
}
|
|
@@ -11059,7 +11043,7 @@ async function runNonInteractive2(params) {
|
|
|
11059
11043
|
const metrics = uiTelemetryService.getMetrics();
|
|
11060
11044
|
const durationMs = Date.now() - startTime;
|
|
11061
11045
|
streamFormatter.emitEvent({
|
|
11062
|
-
type:
|
|
11046
|
+
type: "result" /* RESULT */,
|
|
11063
11047
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11064
11048
|
status: "success",
|
|
11065
11049
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11067,7 +11051,7 @@ async function runNonInteractive2(params) {
|
|
|
11067
11051
|
durationMs
|
|
11068
11052
|
)
|
|
11069
11053
|
});
|
|
11070
|
-
} else if (config.getOutputFormat() ===
|
|
11054
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11071
11055
|
const formatter = new JsonFormatter();
|
|
11072
11056
|
const stats = uiTelemetryService.getMetrics();
|
|
11073
11057
|
textOutput.write(
|
|
@@ -11090,12 +11074,12 @@ async function runNonInteractive2(params) {
|
|
|
11090
11074
|
const metrics = uiTelemetryService.getMetrics();
|
|
11091
11075
|
const durationMs = Date.now() - startTime;
|
|
11092
11076
|
streamFormatter.emitEvent({
|
|
11093
|
-
type:
|
|
11077
|
+
type: "result" /* RESULT */,
|
|
11094
11078
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11095
11079
|
status: invalidStreamError ? "error" : "success",
|
|
11096
11080
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11097
11081
|
});
|
|
11098
|
-
} else if (config.getOutputFormat() ===
|
|
11082
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11099
11083
|
const formatter = new JsonFormatter();
|
|
11100
11084
|
const stats = uiTelemetryService.getMetrics();
|
|
11101
11085
|
textOutput.write(
|
|
@@ -11119,7 +11103,7 @@ async function runNonInteractive2(params) {
|
|
|
11119
11103
|
cleanupStdinCancellation();
|
|
11120
11104
|
scheduler?.dispose();
|
|
11121
11105
|
consolePatcher.cleanup();
|
|
11122
|
-
coreEvents.off(
|
|
11106
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11123
11107
|
}
|
|
11124
11108
|
if (errorToHandle) {
|
|
11125
11109
|
handleError(errorToHandle, config);
|
|
@@ -13510,12 +13494,12 @@ function toToolCallContent(toolResult) {
|
|
|
13510
13494
|
}
|
|
13511
13495
|
var basicPermissionOptions = [
|
|
13512
13496
|
{
|
|
13513
|
-
optionId:
|
|
13497
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
13514
13498
|
name: "Allow",
|
|
13515
13499
|
kind: "allow_once"
|
|
13516
13500
|
},
|
|
13517
13501
|
{
|
|
13518
|
-
optionId:
|
|
13502
|
+
optionId: "cancel" /* Cancel */,
|
|
13519
13503
|
name: "Reject",
|
|
13520
13504
|
kind: "reject_once"
|
|
13521
13505
|
}
|
|
@@ -13527,13 +13511,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13527
13511
|
switch (confirmation.type) {
|
|
13528
13512
|
case "edit":
|
|
13529
13513
|
options.push({
|
|
13530
|
-
optionId:
|
|
13514
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13531
13515
|
name: "Allow for this session",
|
|
13532
13516
|
kind: "allow_always"
|
|
13533
13517
|
});
|
|
13534
13518
|
if (enablePermanentToolApproval) {
|
|
13535
13519
|
options.push({
|
|
13536
|
-
optionId:
|
|
13520
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13537
13521
|
name: "Allow for this file in all future sessions",
|
|
13538
13522
|
kind: "allow_always"
|
|
13539
13523
|
});
|
|
@@ -13541,13 +13525,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13541
13525
|
break;
|
|
13542
13526
|
case "exec":
|
|
13543
13527
|
options.push({
|
|
13544
|
-
optionId:
|
|
13528
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13545
13529
|
name: "Allow for this session",
|
|
13546
13530
|
kind: "allow_always"
|
|
13547
13531
|
});
|
|
13548
13532
|
if (enablePermanentToolApproval) {
|
|
13549
13533
|
options.push({
|
|
13550
|
-
optionId:
|
|
13534
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13551
13535
|
name: "Allow this command for all future sessions",
|
|
13552
13536
|
kind: "allow_always"
|
|
13553
13537
|
});
|
|
@@ -13556,19 +13540,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13556
13540
|
case "mcp":
|
|
13557
13541
|
options.push(
|
|
13558
13542
|
{
|
|
13559
|
-
optionId:
|
|
13543
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
13560
13544
|
name: "Allow all server tools for this session",
|
|
13561
13545
|
kind: "allow_always"
|
|
13562
13546
|
},
|
|
13563
13547
|
{
|
|
13564
|
-
optionId:
|
|
13548
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
13565
13549
|
name: "Allow tool for this session",
|
|
13566
13550
|
kind: "allow_always"
|
|
13567
13551
|
}
|
|
13568
13552
|
);
|
|
13569
13553
|
if (enablePermanentToolApproval) {
|
|
13570
13554
|
options.push({
|
|
13571
|
-
optionId:
|
|
13555
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13572
13556
|
name: "Allow tool for all future sessions",
|
|
13573
13557
|
kind: "allow_always"
|
|
13574
13558
|
});
|
|
@@ -13576,13 +13560,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13576
13560
|
break;
|
|
13577
13561
|
case "info":
|
|
13578
13562
|
options.push({
|
|
13579
|
-
optionId:
|
|
13563
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13580
13564
|
name: "Allow for this session",
|
|
13581
13565
|
kind: "allow_always"
|
|
13582
13566
|
});
|
|
13583
13567
|
if (enablePermanentToolApproval) {
|
|
13584
13568
|
options.push({
|
|
13585
|
-
optionId:
|
|
13569
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13586
13570
|
name: "Allow for all future sessions",
|
|
13587
13571
|
kind: "allow_always"
|
|
13588
13572
|
});
|
|
@@ -13614,21 +13598,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13614
13598
|
}
|
|
13615
13599
|
function toAcpToolKind(kind) {
|
|
13616
13600
|
switch (kind) {
|
|
13617
|
-
case
|
|
13618
|
-
case
|
|
13619
|
-
case
|
|
13620
|
-
case
|
|
13621
|
-
case
|
|
13622
|
-
case
|
|
13623
|
-
case
|
|
13624
|
-
case
|
|
13625
|
-
case
|
|
13626
|
-
case
|
|
13601
|
+
case "read" /* Read */:
|
|
13602
|
+
case "edit" /* Edit */:
|
|
13603
|
+
case "execute" /* Execute */:
|
|
13604
|
+
case "search" /* Search */:
|
|
13605
|
+
case "delete" /* Delete */:
|
|
13606
|
+
case "move" /* Move */:
|
|
13607
|
+
case "think" /* Think */:
|
|
13608
|
+
case "fetch" /* Fetch */:
|
|
13609
|
+
case "switch_mode" /* SwitchMode */:
|
|
13610
|
+
case "other" /* Other */:
|
|
13627
13611
|
return kind;
|
|
13628
|
-
case
|
|
13612
|
+
case "agent" /* Agent */:
|
|
13629
13613
|
return "think";
|
|
13630
|
-
case
|
|
13631
|
-
case
|
|
13614
|
+
case "plan" /* Plan */:
|
|
13615
|
+
case "communicate" /* Communicate */:
|
|
13632
13616
|
default:
|
|
13633
13617
|
return "other";
|
|
13634
13618
|
}
|
|
@@ -13636,24 +13620,24 @@ function toAcpToolKind(kind) {
|
|
|
13636
13620
|
function buildAvailableModes(isPlanEnabled) {
|
|
13637
13621
|
const modes = [
|
|
13638
13622
|
{
|
|
13639
|
-
id:
|
|
13623
|
+
id: "default" /* DEFAULT */,
|
|
13640
13624
|
name: "Default",
|
|
13641
13625
|
description: "Prompts for approval"
|
|
13642
13626
|
},
|
|
13643
13627
|
{
|
|
13644
|
-
id:
|
|
13628
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
13645
13629
|
name: "Auto Edit",
|
|
13646
13630
|
description: "Auto-approves edit tools"
|
|
13647
13631
|
},
|
|
13648
13632
|
{
|
|
13649
|
-
id:
|
|
13633
|
+
id: "yolo" /* YOLO */,
|
|
13650
13634
|
name: "YOLO",
|
|
13651
13635
|
description: "Auto-approves all tools"
|
|
13652
13636
|
}
|
|
13653
13637
|
];
|
|
13654
13638
|
if (isPlanEnabled) {
|
|
13655
13639
|
modes.push({
|
|
13656
|
-
id:
|
|
13640
|
+
id: "plan" /* PLAN */,
|
|
13657
13641
|
name: "Plan",
|
|
13658
13642
|
description: "Read-only mode"
|
|
13659
13643
|
});
|
|
@@ -13666,7 +13650,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13666
13650
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13667
13651
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
13668
13652
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13669
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13653
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
13670
13654
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13671
13655
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13672
13656
|
useGemini3_1: useGemini31,
|
|
@@ -13752,11 +13736,11 @@ var Session = class {
|
|
|
13752
13736
|
this.connection = connection;
|
|
13753
13737
|
this.settings = settings;
|
|
13754
13738
|
coreEvents.on(
|
|
13755
|
-
|
|
13739
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13756
13740
|
this.handleApprovalModeChanged
|
|
13757
13741
|
);
|
|
13758
13742
|
this.context.config.getMessageBus()?.subscribe(
|
|
13759
|
-
|
|
13743
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
13760
13744
|
this.handleToolConfirmationRequest,
|
|
13761
13745
|
{ signal: this.disposeController.signal }
|
|
13762
13746
|
);
|
|
@@ -13780,7 +13764,7 @@ var Session = class {
|
|
|
13780
13764
|
"Policy engine missing. Denying tool confirmation request."
|
|
13781
13765
|
);
|
|
13782
13766
|
await messageBus.publish({
|
|
13783
|
-
type:
|
|
13767
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13784
13768
|
correlationId: request.correlationId,
|
|
13785
13769
|
confirmed: false,
|
|
13786
13770
|
requiresUserConfirmation: false
|
|
@@ -13793,7 +13777,7 @@ var Session = class {
|
|
|
13793
13777
|
"Tool confirmation request missing tool name. Denying."
|
|
13794
13778
|
);
|
|
13795
13779
|
await messageBus.publish({
|
|
13796
|
-
type:
|
|
13780
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13797
13781
|
correlationId: request.correlationId,
|
|
13798
13782
|
confirmed: false,
|
|
13799
13783
|
requiresUserConfirmation: false
|
|
@@ -13806,7 +13790,7 @@ var Session = class {
|
|
|
13806
13790
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
13807
13791
|
);
|
|
13808
13792
|
await messageBus.publish({
|
|
13809
|
-
type:
|
|
13793
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13810
13794
|
correlationId: request.correlationId,
|
|
13811
13795
|
confirmed: false,
|
|
13812
13796
|
requiresUserConfirmation: false
|
|
@@ -13822,15 +13806,15 @@ var Session = class {
|
|
|
13822
13806
|
request.subagent
|
|
13823
13807
|
);
|
|
13824
13808
|
await messageBus.publish({
|
|
13825
|
-
type:
|
|
13809
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13826
13810
|
correlationId: request.correlationId,
|
|
13827
|
-
confirmed: result.decision ===
|
|
13828
|
-
requiresUserConfirmation: result.decision ===
|
|
13811
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
13812
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
13829
13813
|
});
|
|
13830
13814
|
} catch (error) {
|
|
13831
13815
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
13832
13816
|
await this.context.config.getMessageBus()?.publish({
|
|
13833
|
-
type:
|
|
13817
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13834
13818
|
correlationId: request.correlationId,
|
|
13835
13819
|
confirmed: false,
|
|
13836
13820
|
requiresUserConfirmation: false
|
|
@@ -13850,7 +13834,7 @@ var Session = class {
|
|
|
13850
13834
|
};
|
|
13851
13835
|
dispose() {
|
|
13852
13836
|
coreEvents.off(
|
|
13853
|
-
|
|
13837
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13854
13838
|
this.handleApprovalModeChanged
|
|
13855
13839
|
);
|
|
13856
13840
|
this.disposeController.abort();
|
|
@@ -13939,7 +13923,7 @@ ${thought.description}`;
|
|
|
13939
13923
|
await this.sendUpdate({
|
|
13940
13924
|
sessionUpdate: "tool_call",
|
|
13941
13925
|
toolCallId: toolCall.id,
|
|
13942
|
-
status: toolCall.status ===
|
|
13926
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
13943
13927
|
title: toolCall.displayName || toolCall.name,
|
|
13944
13928
|
content: toolCallContent,
|
|
13945
13929
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14031,7 +14015,7 @@ ${thought.description}`;
|
|
|
14031
14015
|
return { stopReason: "cancelled" };
|
|
14032
14016
|
}
|
|
14033
14017
|
switch (event.type) {
|
|
14034
|
-
case
|
|
14018
|
+
case "content" /* Content */: {
|
|
14035
14019
|
const content = {
|
|
14036
14020
|
type: "text",
|
|
14037
14021
|
text: event.value
|
|
@@ -14042,7 +14026,7 @@ ${thought.description}`;
|
|
|
14042
14026
|
});
|
|
14043
14027
|
break;
|
|
14044
14028
|
}
|
|
14045
|
-
case
|
|
14029
|
+
case "thought" /* Thought */: {
|
|
14046
14030
|
const thoughtText = `**${event.value.subject}**
|
|
14047
14031
|
${event.value.description}`;
|
|
14048
14032
|
await this.sendUpdate({
|
|
@@ -14051,10 +14035,10 @@ ${event.value.description}`;
|
|
|
14051
14035
|
});
|
|
14052
14036
|
break;
|
|
14053
14037
|
}
|
|
14054
|
-
case
|
|
14038
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14055
14039
|
toolCallRequests.push(event.value);
|
|
14056
14040
|
break;
|
|
14057
|
-
case
|
|
14041
|
+
case "finished" /* Finished */: {
|
|
14058
14042
|
const usage2 = event.value.usageMetadata;
|
|
14059
14043
|
if (usage2) {
|
|
14060
14044
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14062,19 +14046,19 @@ ${event.value.description}`;
|
|
|
14062
14046
|
}
|
|
14063
14047
|
break;
|
|
14064
14048
|
}
|
|
14065
|
-
case
|
|
14049
|
+
case "model_info" /* ModelInfo */:
|
|
14066
14050
|
turnModelId = event.value;
|
|
14067
14051
|
break;
|
|
14068
|
-
case
|
|
14052
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
14069
14053
|
stopReason = "max_turn_requests";
|
|
14070
14054
|
break;
|
|
14071
|
-
case
|
|
14055
|
+
case "loop_detected" /* LoopDetected */:
|
|
14072
14056
|
stopReason = "max_turn_requests";
|
|
14073
14057
|
break;
|
|
14074
|
-
case
|
|
14058
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14075
14059
|
stopReason = "max_tokens";
|
|
14076
14060
|
break;
|
|
14077
|
-
case
|
|
14061
|
+
case "error" /* Error */: {
|
|
14078
14062
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14079
14063
|
event.value.error
|
|
14080
14064
|
);
|
|
@@ -14302,7 +14286,7 @@ ${event.value.description}`;
|
|
|
14302
14286
|
const output = RequestPermissionResponseSchema.parse(
|
|
14303
14287
|
await this.connection.requestPermission(params)
|
|
14304
14288
|
);
|
|
14305
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14289
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14306
14290
|
await confirmationDetails.onConfirm(outcome);
|
|
14307
14291
|
await updatePolicy(
|
|
14308
14292
|
tool,
|
|
@@ -14313,16 +14297,16 @@ ${event.value.description}`;
|
|
|
14313
14297
|
invocation
|
|
14314
14298
|
);
|
|
14315
14299
|
switch (outcome) {
|
|
14316
|
-
case
|
|
14300
|
+
case "cancel" /* Cancel */:
|
|
14317
14301
|
return errorResponse(
|
|
14318
14302
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14319
14303
|
);
|
|
14320
|
-
case
|
|
14321
|
-
case
|
|
14322
|
-
case
|
|
14323
|
-
case
|
|
14324
|
-
case
|
|
14325
|
-
case
|
|
14304
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14305
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14306
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14307
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14308
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14309
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14326
14310
|
break;
|
|
14327
14311
|
default: {
|
|
14328
14312
|
const resultOutcome = outcome;
|
|
@@ -14376,7 +14360,7 @@ ${event.value.description}`;
|
|
|
14376
14360
|
);
|
|
14377
14361
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14378
14362
|
{
|
|
14379
|
-
status:
|
|
14363
|
+
status: "success" /* Success */,
|
|
14380
14364
|
request: {
|
|
14381
14365
|
callId,
|
|
14382
14366
|
name: fc.name,
|
|
@@ -14421,7 +14405,7 @@ ${event.value.description}`;
|
|
|
14421
14405
|
});
|
|
14422
14406
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14423
14407
|
{
|
|
14424
|
-
status:
|
|
14408
|
+
status: "error" /* Error */,
|
|
14425
14409
|
request: {
|
|
14426
14410
|
callId,
|
|
14427
14411
|
name: fc.name,
|
|
@@ -14549,12 +14533,12 @@ ${event.value.description}`;
|
|
|
14549
14533
|
sessionId: this.id,
|
|
14550
14534
|
options: [
|
|
14551
14535
|
{
|
|
14552
|
-
optionId:
|
|
14536
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14553
14537
|
name: "Allow once",
|
|
14554
14538
|
kind: "allow_once"
|
|
14555
14539
|
},
|
|
14556
14540
|
{
|
|
14557
|
-
optionId:
|
|
14541
|
+
optionId: "cancel" /* Cancel */,
|
|
14558
14542
|
name: "Deny",
|
|
14559
14543
|
kind: "reject_once"
|
|
14560
14544
|
}
|
|
@@ -14579,8 +14563,8 @@ ${event.value.description}`;
|
|
|
14579
14563
|
const output = RequestPermissionResponseSchema.parse(
|
|
14580
14564
|
await this.connection.requestPermission(params)
|
|
14581
14565
|
);
|
|
14582
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14583
|
-
if (outcome ===
|
|
14566
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14567
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
14584
14568
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14585
14569
|
validationError = null;
|
|
14586
14570
|
} else {
|
|
@@ -15017,7 +15001,7 @@ var AcpSessionManager = class {
|
|
|
15017
15001
|
mcpServers,
|
|
15018
15002
|
loadedSettings
|
|
15019
15003
|
);
|
|
15020
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15004
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
15021
15005
|
let isAuthenticated = false;
|
|
15022
15006
|
let authErrorMessage = "";
|
|
15023
15007
|
try {
|
|
@@ -15029,7 +15013,7 @@ var AcpSessionManager = class {
|
|
|
15029
15013
|
);
|
|
15030
15014
|
isAuthenticated = true;
|
|
15031
15015
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15032
|
-
if (authType ===
|
|
15016
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15033
15017
|
isAuthenticated = false;
|
|
15034
15018
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15035
15019
|
}
|
|
@@ -15138,7 +15122,7 @@ var AcpSessionManager = class {
|
|
|
15138
15122
|
return response;
|
|
15139
15123
|
}
|
|
15140
15124
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15141
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15125
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
15142
15126
|
if (!selectedAuthType) {
|
|
15143
15127
|
throw RequestError.authRequired();
|
|
15144
15128
|
}
|
|
@@ -15239,12 +15223,12 @@ var GeminiAgent = class {
|
|
|
15239
15223
|
}
|
|
15240
15224
|
const authMethods = [
|
|
15241
15225
|
{
|
|
15242
|
-
id:
|
|
15226
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
15243
15227
|
name: "Log in with Google",
|
|
15244
15228
|
description: "Log in with your Google account"
|
|
15245
15229
|
},
|
|
15246
15230
|
{
|
|
15247
|
-
id:
|
|
15231
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
15248
15232
|
name: "Gemini API key",
|
|
15249
15233
|
description: "Use an API key with Gemini Developer API",
|
|
15250
15234
|
_meta: {
|
|
@@ -15254,12 +15238,12 @@ var GeminiAgent = class {
|
|
|
15254
15238
|
}
|
|
15255
15239
|
},
|
|
15256
15240
|
{
|
|
15257
|
-
id:
|
|
15241
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
15258
15242
|
name: "Vertex AI",
|
|
15259
15243
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15260
15244
|
},
|
|
15261
15245
|
{
|
|
15262
|
-
id:
|
|
15246
|
+
id: "gateway" /* GATEWAY */,
|
|
15263
15247
|
name: "AI API Gateway",
|
|
15264
15248
|
description: "Use a custom AI API Gateway",
|
|
15265
15249
|
_meta: {
|
|
@@ -15432,7 +15416,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15432
15416
|
}
|
|
15433
15417
|
return authType;
|
|
15434
15418
|
} catch (error) {
|
|
15435
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15419
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
15436
15420
|
handleError(
|
|
15437
15421
|
error instanceof Error ? error : new Error(String(error)),
|
|
15438
15422
|
nonInteractiveConfig,
|
|
@@ -15627,10 +15611,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15627
15611
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15628
15612
|
}
|
|
15629
15613
|
start() {
|
|
15630
|
-
coreEvents.on(
|
|
15614
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15631
15615
|
}
|
|
15632
15616
|
stop() {
|
|
15633
|
-
coreEvents.off(
|
|
15617
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15634
15618
|
if (this.flushTimeout) {
|
|
15635
15619
|
clearTimeout(this.flushTimeout);
|
|
15636
15620
|
this.flushTimeout = null;
|
|
@@ -15911,7 +15895,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15911
15895
|
}
|
|
15912
15896
|
}
|
|
15913
15897
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15914
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15898
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-F337IDVS.js");
|
|
15915
15899
|
await doStartUI(
|
|
15916
15900
|
config,
|
|
15917
15901
|
settings,
|
|
@@ -16014,12 +15998,12 @@ async function main() {
|
|
|
16014
15998
|
dns.setDefaultResultOrder(
|
|
16015
15999
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16016
16000
|
);
|
|
16017
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16001
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
16018
16002
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16019
16003
|
settings.setValue(
|
|
16020
16004
|
"User" /* User */,
|
|
16021
16005
|
"security.auth.selectedType",
|
|
16022
|
-
|
|
16006
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
16023
16007
|
);
|
|
16024
16008
|
}
|
|
16025
16009
|
}
|
|
@@ -16120,7 +16104,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16120
16104
|
await config.storage.initialize();
|
|
16121
16105
|
adminControlsListner.setConfig(config);
|
|
16122
16106
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16123
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16107
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-ADGLR4UM.js");
|
|
16124
16108
|
setupInitialActivityLogger(config);
|
|
16125
16109
|
}
|
|
16126
16110
|
registerTelemetryConfig(config);
|
|
@@ -16128,7 +16112,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16128
16112
|
const messageBus = config.getMessageBus();
|
|
16129
16113
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16130
16114
|
registerCleanup(async () => {
|
|
16131
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
16115
|
+
await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
16132
16116
|
});
|
|
16133
16117
|
if (!config.getAcpMode()) {
|
|
16134
16118
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16179,7 +16163,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16179
16163
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16180
16164
|
const initializationResult = await initializeApp(config, settings);
|
|
16181
16165
|
initAppHandle?.end();
|
|
16182
|
-
import("./liteRtServerManager-
|
|
16166
|
+
import("./liteRtServerManager-N7CBKKD6.js").then(({ LiteRtServerManager }) => {
|
|
16183
16167
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16184
16168
|
if (!mergedGemma) return;
|
|
16185
16169
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16189,7 +16173,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16189
16173
|
autoStartServer: userGemma?.autoStartServer
|
|
16190
16174
|
});
|
|
16191
16175
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16192
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16176
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
16193
16177
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16194
16178
|
}
|
|
16195
16179
|
if (config.getAcpMode()) {
|
|
@@ -16205,7 +16189,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16205
16189
|
...rawStartupWarnings.map((message) => ({
|
|
16206
16190
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16207
16191
|
message,
|
|
16208
|
-
priority:
|
|
16192
|
+
priority: "high" /* High */
|
|
16209
16193
|
})),
|
|
16210
16194
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16211
16195
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16242,7 +16226,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16242
16226
|
${input}` : stdinData;
|
|
16243
16227
|
}
|
|
16244
16228
|
}
|
|
16245
|
-
const sessionStartSource = resumedSessionData ?
|
|
16229
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
16246
16230
|
const hookSystem = config?.getHookSystem();
|
|
16247
16231
|
if (hookSystem) {
|
|
16248
16232
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16299,8 +16283,8 @@ ${input}` : wrappedContext;
|
|
|
16299
16283
|
}
|
|
16300
16284
|
}
|
|
16301
16285
|
function initializeOutputListenersAndFlush(config) {
|
|
16302
|
-
if (coreEvents.listenerCount(
|
|
16303
|
-
coreEvents.on(
|
|
16286
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
16287
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
16304
16288
|
if (payload.isStderr) {
|
|
16305
16289
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16306
16290
|
} else {
|
|
@@ -16308,8 +16292,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16308
16292
|
}
|
|
16309
16293
|
});
|
|
16310
16294
|
}
|
|
16311
|
-
if (coreEvents.listenerCount(
|
|
16312
|
-
coreEvents.on(
|
|
16295
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
16296
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
16313
16297
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16314
16298
|
writeToStderr(payload.content + "\n");
|
|
16315
16299
|
} else {
|
|
@@ -16317,8 +16301,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16317
16301
|
}
|
|
16318
16302
|
});
|
|
16319
16303
|
}
|
|
16320
|
-
if (coreEvents.listenerCount(
|
|
16321
|
-
coreEvents.on(
|
|
16304
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
16305
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
16322
16306
|
writeToStderr(payload.message + "\n");
|
|
16323
16307
|
});
|
|
16324
16308
|
}
|
|
@@ -16326,7 +16310,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16326
16310
|
const forceToStderr = outputFormat === "json";
|
|
16327
16311
|
coreEvents.drainBacklogs(
|
|
16328
16312
|
(event, args) => {
|
|
16329
|
-
if (forceToStderr && event ===
|
|
16313
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
16330
16314
|
const payload = args[0];
|
|
16331
16315
|
if (!payload.isStderr) {
|
|
16332
16316
|
return {
|