@google/gemini-cli 0.64.0-preview.0 → 0.65.0-nightly.20261007.gef59c532f
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-EDVFNWRG.js → chunk-2QX7AFU2.js} +1 -1
- package/bundle/{chunk-EDYPRCAA.js → chunk-354KMHUX.js} +2 -2
- package/bundle/{chunk-UFQDAROY.js → chunk-3F7OA7UU.js} +1 -1
- package/bundle/{chunk-HN74ORTP.js → chunk-46A63GIT.js} +27 -4
- package/bundle/{chunk-ZQW7OGUO.js → chunk-6FH32SR7.js} +184 -45
- package/bundle/{chunk-SDWOC67Z.js → chunk-7NUXN3UV.js} +1 -1
- package/bundle/{chunk-Y2HXXBXI.js → chunk-ASQYH7O3.js} +1 -1
- package/bundle/{chunk-EBP6K2WG.js → chunk-BT4BJCGX.js} +32 -16
- package/bundle/{chunk-UBGF6JU5.js → chunk-CIKQQ32X.js} +1 -1
- package/bundle/chunk-DIMRHS5O.js +154 -0
- package/bundle/{chunk-NX7TO2DU.js → chunk-EIHDEZQ3.js} +1 -1
- package/bundle/{chunk-QUCRASYB.js → chunk-FE5UXCSL.js} +1 -1
- package/bundle/{chunk-EFX5XL6M.js → chunk-FTB4FVEK.js} +2 -2
- package/bundle/{chunk-A4TO2DY2.js → chunk-HYF74TEA.js} +8018 -14883
- package/bundle/{chunk-6OFXOGEG.js → chunk-JYWQ73Z5.js} +193 -47
- package/bundle/{chunk-HSZIYPL6.js → chunk-KHG7NKQK.js} +3 -3
- package/bundle/chunk-KTOZF7BG.js +401335 -0
- package/bundle/{chunk-2NQXIWQK.js → chunk-KV6RPWUP.js} +27 -4
- package/bundle/{chunk-KCCVXZ52.js → chunk-LNFN3PQL.js} +32 -16
- package/bundle/{chunk-MLSLNORV.js → chunk-LS355CSQ.js} +3 -3
- package/bundle/{chunk-2VN53SWW.js → chunk-NDVLWD4V.js} +9 -8
- package/bundle/{chunk-ZOHM7BPT.js → chunk-NUWDVBI7.js} +1 -1
- package/bundle/{chunk-VJYKQD5D.js → chunk-PYD373NJ.js} +3 -3
- package/bundle/{chunk-VBVCLWLA.js → chunk-QTGBWTWR.js} +2 -2
- package/bundle/chunk-U6ZQ2RUE.js +1571 -0
- package/bundle/chunk-UV4NDIKL.js +118 -0
- package/bundle/{chunk-U76XPSKR.js → chunk-VAONEIPY.js} +96 -67
- package/bundle/chunk-WGJZZTZY.js +425 -0
- package/bundle/{chunk-ZPLFLZQA.js → chunk-WXXOP3OP.js} +33 -8
- package/bundle/chunk-XOG2HJ3Y.js +17530 -0
- package/bundle/chunk-YSKY65XX.js +512 -0
- package/bundle/chunk-ZTPICUAP.js +103137 -0
- package/bundle/{cleanup-GGCB2LVD.js → cleanup-3V27AYOD.js} +2 -2
- package/bundle/{cleanup-JRDG3OTL.js → cleanup-4G3NPQT4.js} +2 -2
- package/bundle/{cleanup-SSW6IXTR.js → cleanup-5XQCOW5U.js} +2 -2
- package/bundle/cleanup-BBUUFPW4.js +32 -0
- package/bundle/{core-IUIZE6JW.js → core-AAGHH24E.js} +1 -1
- package/bundle/{devtoolsService-XZCKFZP5.js → devtoolsService-EVGTOLCK.js} +2 -2
- package/bundle/{devtoolsService-3SADPKKB.js → devtoolsService-J7VIMPHG.js} +2 -2
- package/bundle/{devtoolsService-MF6JKRUV.js → devtoolsService-PZBHHYCE.js} +4 -3
- package/bundle/devtoolsService-Z4ND55GM.js +4359 -0
- package/bundle/{dist-7L3BRW6V.js → dist-6PBUOORE.js} +1 -1
- package/bundle/{core-6HRWFQZW.js → dist-Q7B3BSZW.js} +1 -1
- package/bundle/dist-Z23CJKTC.js +2252 -0
- package/bundle/docs/changelogs/index.md +14 -0
- package/bundle/docs/changelogs/latest.md +55 -34
- package/bundle/docs/changelogs/preview.md +59 -54
- package/bundle/docs/tools/mcp-server.md +41 -12
- package/bundle/{gemini-JPMMQ3KA.js → gemini-2ZS4H5D5.js} +41 -21
- package/bundle/{gemini-QOQNG5VY.js → gemini-NHT6XRJ6.js} +241 -205
- package/bundle/gemini-ORQLMSXW.js +17954 -0
- package/bundle/{gemini-ZMMDUAQJ.js → gemini-YDK3BHCP.js} +41 -21
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-R3P4A3FC.js → interactiveCli-22MUJI66.js} +23 -14
- package/bundle/{interactiveCli-UDWGRVJL.js → interactiveCli-2JNS4RJW.js} +23 -14
- package/bundle/{interactiveCli-3I4TG5SK.js → interactiveCli-EHUGFQPB.js} +327 -299
- package/bundle/interactiveCli-YANG53MI.js +34988 -0
- package/bundle/{liteRtServerManager-OVPUSK2T.js → liteRtServerManager-PGT3WQWS.js} +4 -4
- package/bundle/{liteRtServerManager-RAV63AGE.js → liteRtServerManager-TW45VSAX.js} +4 -4
- package/bundle/{liteRtServerManager-4MWCEVVM.js → liteRtServerManager-VCTOOEN4.js} +4 -4
- package/bundle/liteRtServerManager-Y2QFKZ5W.js +65 -0
- package/bundle/{oauth2-provider-XFP63FGJ.js → oauth2-provider-4AK74O2H.js} +1 -1
- package/bundle/{oauth2-provider-FVTRRJZR.js → oauth2-provider-IUYZ2A7H.js} +1 -1
- package/bundle/{oauth2-provider-EWOA64PR.js → oauth2-provider-JCJGEWMM.js} +38 -72
- package/bundle/oauth2-provider-QTTPZS6I.js +235 -0
- package/bundle/{start-DJAIXPPY.js → start-4O4IKUM4.js} +6 -6
- package/bundle/{start-VQQ2Q5KT.js → start-74BH6SEW.js} +6 -6
- package/bundle/{start-5O7TBK5L.js → start-EDAVUSEX.js} +6 -6
- package/bundle/start-Q6WRPG2O.js +18 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LS355CSQ.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod,
|
|
48
48
|
validateContextFilePath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-BT4BJCGX.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-NUWDVBI7.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
SessionError,
|
|
63
63
|
SessionSelector,
|
|
64
64
|
SettingScope,
|
|
65
|
+
UNTRUSTED_WORKSPACE_SETTINGS_ERROR,
|
|
65
66
|
USER_SETTINGS_PATH,
|
|
66
67
|
cleanupExpiredSessions,
|
|
67
68
|
cleanupToolOutputFiles,
|
|
@@ -88,11 +89,11 @@ import {
|
|
|
88
89
|
resolveGemmaConfig,
|
|
89
90
|
saveModelChange,
|
|
90
91
|
stripAnsi
|
|
91
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-XOG2HJ3Y.js";
|
|
92
93
|
import {
|
|
93
94
|
RELAUNCH_EXIT_CODE
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
95
|
+
} from "./chunk-WGJZZTZY.js";
|
|
96
|
+
import "./chunk-NDVLWD4V.js";
|
|
96
97
|
import {
|
|
97
98
|
cleanupCheckpoints,
|
|
98
99
|
registerCleanup,
|
|
@@ -101,12 +102,15 @@ import {
|
|
|
101
102
|
runExitCleanup,
|
|
102
103
|
runSyncCleanup,
|
|
103
104
|
setupSignalHandlers
|
|
104
|
-
} from "./chunk-
|
|
105
|
+
} from "./chunk-3F7OA7UU.js";
|
|
105
106
|
import {
|
|
106
107
|
ASK_USER_TOOL_NAME,
|
|
108
|
+
ApprovalMode,
|
|
107
109
|
AuthType,
|
|
108
110
|
Client,
|
|
109
111
|
Config,
|
|
112
|
+
CoreEvent,
|
|
113
|
+
CoreToolCallStatus,
|
|
110
114
|
DEFAULT_CONTEXT_FILENAME,
|
|
111
115
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
112
116
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -128,19 +132,27 @@ import {
|
|
|
128
132
|
FolderTrustDiscoveryService,
|
|
129
133
|
GEMINI_DIR,
|
|
130
134
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
135
|
+
GeminiEventType,
|
|
131
136
|
IdeClient,
|
|
137
|
+
IntegrityStatus,
|
|
132
138
|
InvalidStreamError,
|
|
133
139
|
JsonFormatter,
|
|
140
|
+
JsonStreamEventType,
|
|
141
|
+
Kind,
|
|
134
142
|
LegacyAgentSession,
|
|
135
143
|
Logger,
|
|
136
144
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
137
145
|
MCPServerConfig,
|
|
146
|
+
MCPServerStatus,
|
|
147
|
+
MessageBusType,
|
|
138
148
|
OTHER_BLOCKED_MESSAGE,
|
|
149
|
+
OutputFormat,
|
|
139
150
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
140
151
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
141
152
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
142
153
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
143
154
|
PREVIEW_GEMINI_MODEL,
|
|
155
|
+
PolicyDecision,
|
|
144
156
|
PolicyIntegrityManager,
|
|
145
157
|
RECITATION_BLOCKED_MESSAGE,
|
|
146
158
|
REFERENCE_CONTENT_START,
|
|
@@ -148,6 +160,8 @@ import {
|
|
|
148
160
|
ReadManyFilesTool,
|
|
149
161
|
SAFETY_BLOCKED_MESSAGE,
|
|
150
162
|
Scheduler,
|
|
163
|
+
SessionEndReason,
|
|
164
|
+
SessionStartSource,
|
|
151
165
|
ShellExecutionService,
|
|
152
166
|
SimpleExtensionLoader,
|
|
153
167
|
Storage,
|
|
@@ -156,10 +170,13 @@ import {
|
|
|
156
170
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
157
171
|
ToolCallEvent,
|
|
158
172
|
ToolConfirmationOutcome,
|
|
173
|
+
ToolErrorType,
|
|
174
|
+
TrustLevel,
|
|
159
175
|
UserAccountManager,
|
|
160
176
|
UserPromptEvent,
|
|
161
177
|
ValidationCancelledError,
|
|
162
178
|
ValidationRequiredError,
|
|
179
|
+
WarningPriority,
|
|
163
180
|
applyAdminAllowlist,
|
|
164
181
|
applyRequiredServers,
|
|
165
182
|
clearCachedCredentialFile,
|
|
@@ -240,7 +257,7 @@ import {
|
|
|
240
257
|
updatePolicy,
|
|
241
258
|
writeToStderr,
|
|
242
259
|
writeToStdout
|
|
243
|
-
} from "./chunk-
|
|
260
|
+
} from "./chunk-6FH32SR7.js";
|
|
244
261
|
import "./chunk-664ZODQF.js";
|
|
245
262
|
import "./chunk-IUUIT4SU.js";
|
|
246
263
|
import "./chunk-L6PII3GR.js";
|
|
@@ -5116,14 +5133,20 @@ async function addMcpServer(name, commandOrUrl, args, options) {
|
|
|
5116
5133
|
excludeTools
|
|
5117
5134
|
} = options;
|
|
5118
5135
|
const settings = loadSettings(process.cwd());
|
|
5119
|
-
const inHome = settings.workspace.path === settings.user.path;
|
|
5120
|
-
if (scope === "project" && inHome) {
|
|
5121
|
-
debugLogger.error(
|
|
5122
|
-
"Error: Please use --scope user to edit settings in the home directory."
|
|
5123
|
-
);
|
|
5124
|
-
process.exit(1);
|
|
5125
|
-
}
|
|
5126
5136
|
const settingsScope = scope === "user" ? "User" /* User */ : "Workspace" /* Workspace */;
|
|
5137
|
+
if (settingsScope === "Workspace" /* Workspace */) {
|
|
5138
|
+
const inHome = settings.workspace.path === "" || settings.workspace.path === settings.user.path;
|
|
5139
|
+
if (inHome) {
|
|
5140
|
+
debugLogger.error(
|
|
5141
|
+
"Error: Please use --scope user to edit settings in the home directory."
|
|
5142
|
+
);
|
|
5143
|
+
process.exit(1);
|
|
5144
|
+
}
|
|
5145
|
+
if ((settings.forScope(settingsScope).readOnly ?? false) || settings.isTrusted === false) {
|
|
5146
|
+
debugLogger.error(`Error: ${UNTRUSTED_WORKSPACE_SETTINGS_ERROR}`);
|
|
5147
|
+
process.exit(1);
|
|
5148
|
+
}
|
|
5149
|
+
}
|
|
5127
5150
|
let newServer = {};
|
|
5128
5151
|
const headers = header?.reduce(
|
|
5129
5152
|
(acc, curr) => {
|
|
@@ -5303,6 +5326,19 @@ async function removeMcpServer(name, options) {
|
|
|
5303
5326
|
const { scope } = options;
|
|
5304
5327
|
const settingsScope = scope === "user" ? "User" /* User */ : "Workspace" /* Workspace */;
|
|
5305
5328
|
const settings = loadSettings();
|
|
5329
|
+
if (settingsScope === "Workspace" /* Workspace */) {
|
|
5330
|
+
const inHome = settings.workspace.path === "" || settings.workspace.path === settings.user.path;
|
|
5331
|
+
if (inHome) {
|
|
5332
|
+
debugLogger.error(
|
|
5333
|
+
"Error: Please use --scope user to edit settings in the home directory."
|
|
5334
|
+
);
|
|
5335
|
+
process.exit(1);
|
|
5336
|
+
}
|
|
5337
|
+
if ((settings.forScope(settingsScope).readOnly ?? false) || settings.isTrusted === false) {
|
|
5338
|
+
debugLogger.error(`Error: ${UNTRUSTED_WORKSPACE_SETTINGS_ERROR}`);
|
|
5339
|
+
process.exit(1);
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5306
5342
|
const existingSettings = settings.forScope(settingsScope).settings;
|
|
5307
5343
|
const mcpServers = existingSettings.mcpServers || {};
|
|
5308
5344
|
if (!mcpServers[name]) {
|
|
@@ -5370,7 +5406,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5370
5406
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5371
5407
|
const isStdio = !!config.command;
|
|
5372
5408
|
if (isStdio && !isTrusted) {
|
|
5373
|
-
return
|
|
5409
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5374
5410
|
}
|
|
5375
5411
|
const client = new Client({
|
|
5376
5412
|
name: "mcp-test-client",
|
|
@@ -5406,7 +5442,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5406
5442
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5407
5443
|
} catch {
|
|
5408
5444
|
await client.close();
|
|
5409
|
-
return
|
|
5445
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5410
5446
|
}
|
|
5411
5447
|
try {
|
|
5412
5448
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5420,10 +5456,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5420
5456
|
);
|
|
5421
5457
|
}
|
|
5422
5458
|
await client.close();
|
|
5423
|
-
return
|
|
5459
|
+
return MCPServerStatus.CONNECTED;
|
|
5424
5460
|
} catch {
|
|
5425
5461
|
await transport.close();
|
|
5426
|
-
return
|
|
5462
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5427
5463
|
}
|
|
5428
5464
|
}
|
|
5429
5465
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5436,12 +5472,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5436
5472
|
});
|
|
5437
5473
|
if (!loadResult.allowed) {
|
|
5438
5474
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5439
|
-
return
|
|
5475
|
+
return MCPServerStatus.BLOCKED;
|
|
5440
5476
|
}
|
|
5441
|
-
return
|
|
5477
|
+
return MCPServerStatus.DISABLED;
|
|
5442
5478
|
}
|
|
5443
5479
|
if (!isTrusted) {
|
|
5444
|
-
return
|
|
5480
|
+
return MCPServerStatus.DISABLED;
|
|
5445
5481
|
}
|
|
5446
5482
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5447
5483
|
}
|
|
@@ -5487,23 +5523,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5487
5523
|
let statusIndicator = "";
|
|
5488
5524
|
let statusText = "";
|
|
5489
5525
|
switch (status) {
|
|
5490
|
-
case
|
|
5526
|
+
case MCPServerStatus.CONNECTED:
|
|
5491
5527
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5492
5528
|
statusText = "Connected";
|
|
5493
5529
|
break;
|
|
5494
|
-
case
|
|
5530
|
+
case MCPServerStatus.CONNECTING:
|
|
5495
5531
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5496
5532
|
statusText = "Connecting";
|
|
5497
5533
|
break;
|
|
5498
|
-
case
|
|
5534
|
+
case MCPServerStatus.BLOCKED:
|
|
5499
5535
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5500
5536
|
statusText = "Blocked";
|
|
5501
5537
|
break;
|
|
5502
|
-
case
|
|
5538
|
+
case MCPServerStatus.DISABLED:
|
|
5503
5539
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5504
5540
|
statusText = "Disabled";
|
|
5505
5541
|
break;
|
|
5506
|
-
case
|
|
5542
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5507
5543
|
default:
|
|
5508
5544
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5509
5545
|
statusText = "Disconnected";
|
|
@@ -5789,7 +5825,7 @@ async function handleInstall(args) {
|
|
|
5789
5825
|
);
|
|
5790
5826
|
if (confirmed) {
|
|
5791
5827
|
const trustedFolders = loadTrustedFolders();
|
|
5792
|
-
await trustedFolders.setValue(realPath,
|
|
5828
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5793
5829
|
} else {
|
|
5794
5830
|
throw new Error(
|
|
5795
5831
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7840,7 +7876,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7840
7876
|
}
|
|
7841
7877
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7842
7878
|
const packageJson = await getPackageJson(__dirname3);
|
|
7843
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.
|
|
7879
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.65.0-nightly.20261007.gef59c532f" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7844
7880
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7845
7881
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7846
7882
|
}
|
|
@@ -7899,9 +7935,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7899
7935
|
cwd,
|
|
7900
7936
|
potentialWorkspacePoliciesDir
|
|
7901
7937
|
);
|
|
7902
|
-
if (integrityResult.status ===
|
|
7938
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7903
7939
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7904
|
-
} else if (integrityResult.status ===
|
|
7940
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7905
7941
|
workspacePoliciesDir = void 0;
|
|
7906
7942
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7907
7943
|
policyUpdateConfirmationRequest = {
|
|
@@ -8329,23 +8365,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8329
8365
|
if (rawApprovalMode) {
|
|
8330
8366
|
switch (rawApprovalMode) {
|
|
8331
8367
|
case "yolo":
|
|
8332
|
-
approvalMode =
|
|
8368
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8333
8369
|
break;
|
|
8334
8370
|
case "auto_edit":
|
|
8335
|
-
approvalMode =
|
|
8371
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8336
8372
|
break;
|
|
8337
8373
|
case "plan":
|
|
8338
8374
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8339
8375
|
debugLogger.warn(
|
|
8340
8376
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8341
8377
|
);
|
|
8342
|
-
approvalMode =
|
|
8378
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8343
8379
|
} else {
|
|
8344
|
-
approvalMode =
|
|
8380
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8345
8381
|
}
|
|
8346
8382
|
break;
|
|
8347
8383
|
case "default":
|
|
8348
|
-
approvalMode =
|
|
8384
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8349
8385
|
break;
|
|
8350
8386
|
default:
|
|
8351
8387
|
throw new Error(
|
|
@@ -8353,10 +8389,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8353
8389
|
);
|
|
8354
8390
|
}
|
|
8355
8391
|
} else {
|
|
8356
|
-
approvalMode =
|
|
8392
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8357
8393
|
}
|
|
8358
8394
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8359
|
-
if (approvalMode ===
|
|
8395
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8360
8396
|
if (settings.admin?.secureModeEnabled) {
|
|
8361
8397
|
debugLogger.error(
|
|
8362
8398
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8374,16 +8410,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8374
8410
|
)
|
|
8375
8411
|
);
|
|
8376
8412
|
}
|
|
8377
|
-
} else if (approvalMode ===
|
|
8413
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8378
8414
|
debugLogger.warn(
|
|
8379
8415
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8380
8416
|
);
|
|
8381
8417
|
}
|
|
8382
|
-
if (!trustedFolder && approvalMode !==
|
|
8418
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8383
8419
|
debugLogger.warn(
|
|
8384
8420
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8385
8421
|
);
|
|
8386
|
-
approvalMode =
|
|
8422
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8387
8423
|
}
|
|
8388
8424
|
let telemetrySettings;
|
|
8389
8425
|
try {
|
|
@@ -11084,7 +11120,7 @@ import path10 from "node:path";
|
|
|
11084
11120
|
import process4 from "node:process";
|
|
11085
11121
|
var homeDirectoryCheck = {
|
|
11086
11122
|
id: "home-directory",
|
|
11087
|
-
priority:
|
|
11123
|
+
priority: WarningPriority.Low,
|
|
11088
11124
|
check: async (workspaceRoot, settings) => {
|
|
11089
11125
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
11090
11126
|
return null;
|
|
@@ -11108,7 +11144,7 @@ var homeDirectoryCheck = {
|
|
|
11108
11144
|
};
|
|
11109
11145
|
var rootDirectoryCheck = {
|
|
11110
11146
|
id: "root-directory",
|
|
11111
|
-
priority:
|
|
11147
|
+
priority: WarningPriority.High,
|
|
11112
11148
|
check: async (workspaceRoot, _settings) => {
|
|
11113
11149
|
try {
|
|
11114
11150
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -11124,7 +11160,7 @@ var rootDirectoryCheck = {
|
|
|
11124
11160
|
};
|
|
11125
11161
|
var folderTrustCheck = {
|
|
11126
11162
|
id: "folder-trust",
|
|
11127
|
-
priority:
|
|
11163
|
+
priority: WarningPriority.High,
|
|
11128
11164
|
check: async (workspaceRoot, settings) => {
|
|
11129
11165
|
if (!isFolderTrustEnabled(settings)) {
|
|
11130
11166
|
return null;
|
|
@@ -11314,12 +11350,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
11314
11350
|
error,
|
|
11315
11351
|
config.getContentGeneratorConfig()?.authType
|
|
11316
11352
|
);
|
|
11317
|
-
if (config.getOutputFormat() ===
|
|
11353
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11318
11354
|
const streamFormatter = new StreamJsonFormatter();
|
|
11319
11355
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11320
11356
|
const metrics = uiTelemetryService.getMetrics();
|
|
11321
11357
|
streamFormatter.emitEvent({
|
|
11322
|
-
type:
|
|
11358
|
+
type: JsonStreamEventType.RESULT,
|
|
11323
11359
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11324
11360
|
status: "error",
|
|
11325
11361
|
error: {
|
|
@@ -11330,7 +11366,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
11330
11366
|
});
|
|
11331
11367
|
runSyncCleanup();
|
|
11332
11368
|
process.exit(getNumericExitCode(errorCode));
|
|
11333
|
-
} else if (config.getOutputFormat() ===
|
|
11369
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11334
11370
|
const formatter = new JsonFormatter();
|
|
11335
11371
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
11336
11372
|
const formattedError = formatter.formatError(
|
|
@@ -11350,11 +11386,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11350
11386
|
const isFatal = isFatalToolError(errorType);
|
|
11351
11387
|
if (isFatal) {
|
|
11352
11388
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
11353
|
-
if (config.getOutputFormat() ===
|
|
11389
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11354
11390
|
const streamFormatter = new StreamJsonFormatter();
|
|
11355
11391
|
const metrics = uiTelemetryService.getMetrics();
|
|
11356
11392
|
streamFormatter.emitEvent({
|
|
11357
|
-
type:
|
|
11393
|
+
type: JsonStreamEventType.RESULT,
|
|
11358
11394
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11359
11395
|
status: "error",
|
|
11360
11396
|
error: {
|
|
@@ -11363,7 +11399,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11363
11399
|
},
|
|
11364
11400
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
11365
11401
|
});
|
|
11366
|
-
} else if (config.getOutputFormat() ===
|
|
11402
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11367
11403
|
const formatter = new JsonFormatter();
|
|
11368
11404
|
const formattedError = formatter.formatError(
|
|
11369
11405
|
toolExecutionError,
|
|
@@ -11381,11 +11417,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11381
11417
|
}
|
|
11382
11418
|
function handleCancellationError(config) {
|
|
11383
11419
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
11384
|
-
if (config.getOutputFormat() ===
|
|
11420
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11385
11421
|
const streamFormatter = new StreamJsonFormatter();
|
|
11386
11422
|
const metrics = uiTelemetryService.getMetrics();
|
|
11387
11423
|
streamFormatter.emitEvent({
|
|
11388
|
-
type:
|
|
11424
|
+
type: JsonStreamEventType.RESULT,
|
|
11389
11425
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11390
11426
|
status: "error",
|
|
11391
11427
|
error: {
|
|
@@ -11396,7 +11432,7 @@ function handleCancellationError(config) {
|
|
|
11396
11432
|
});
|
|
11397
11433
|
runSyncCleanup();
|
|
11398
11434
|
process.exit(cancellationError.exitCode);
|
|
11399
|
-
} else if (config.getOutputFormat() ===
|
|
11435
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11400
11436
|
const formatter = new JsonFormatter();
|
|
11401
11437
|
const formattedError = formatter.formatError(
|
|
11402
11438
|
cancellationError,
|
|
@@ -11416,11 +11452,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11416
11452
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11417
11453
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11418
11454
|
);
|
|
11419
|
-
if (config.getOutputFormat() ===
|
|
11455
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
11420
11456
|
const streamFormatter = new StreamJsonFormatter();
|
|
11421
11457
|
const metrics = uiTelemetryService.getMetrics();
|
|
11422
11458
|
streamFormatter.emitEvent({
|
|
11423
|
-
type:
|
|
11459
|
+
type: JsonStreamEventType.RESULT,
|
|
11424
11460
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11425
11461
|
status: "error",
|
|
11426
11462
|
error: {
|
|
@@ -11431,7 +11467,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11431
11467
|
});
|
|
11432
11468
|
runSyncCleanup();
|
|
11433
11469
|
process.exit(maxTurnsError.exitCode);
|
|
11434
|
-
} else if (config.getOutputFormat() ===
|
|
11470
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11435
11471
|
const formatter = new JsonFormatter();
|
|
11436
11472
|
const formattedError = formatter.formatError(
|
|
11437
11473
|
maxTurnsError,
|
|
@@ -11511,7 +11547,7 @@ async function runNonInteractive({
|
|
|
11511
11547
|
}
|
|
11512
11548
|
});
|
|
11513
11549
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11514
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11550
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-Z4ND55GM.js");
|
|
11515
11551
|
setupInitialActivityLogger(config);
|
|
11516
11552
|
}
|
|
11517
11553
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11527,7 +11563,7 @@ async function runNonInteractive({
|
|
|
11527
11563
|
}
|
|
11528
11564
|
};
|
|
11529
11565
|
const startTime = Date.now();
|
|
11530
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11566
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
11531
11567
|
const abortController = new AbortController();
|
|
11532
11568
|
let isAborting = false;
|
|
11533
11569
|
let cancelMessageTimer = null;
|
|
@@ -11580,13 +11616,13 @@ async function runNonInteractive({
|
|
|
11580
11616
|
};
|
|
11581
11617
|
try {
|
|
11582
11618
|
consolePatcher.patch();
|
|
11583
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11619
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11584
11620
|
process.stderr.write(
|
|
11585
11621
|
"[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"
|
|
11586
11622
|
);
|
|
11587
11623
|
}
|
|
11588
11624
|
setupStdinCancellation();
|
|
11589
|
-
coreEvents.on(
|
|
11625
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11590
11626
|
coreEvents.drainBacklogs();
|
|
11591
11627
|
process.stdout.on("error", (err) => {
|
|
11592
11628
|
if (err.code === "EPIPE") {
|
|
@@ -11612,7 +11648,7 @@ async function runNonInteractive({
|
|
|
11612
11648
|
}
|
|
11613
11649
|
if (streamFormatter) {
|
|
11614
11650
|
streamFormatter.emitEvent({
|
|
11615
|
-
type:
|
|
11651
|
+
type: JsonStreamEventType.INIT,
|
|
11616
11652
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11617
11653
|
session_id: config.getSessionId(),
|
|
11618
11654
|
model: config.getModel()
|
|
@@ -11650,7 +11686,7 @@ async function runNonInteractive({
|
|
|
11650
11686
|
}
|
|
11651
11687
|
if (streamFormatter) {
|
|
11652
11688
|
streamFormatter.emitEvent({
|
|
11653
|
-
type:
|
|
11689
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11654
11690
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11655
11691
|
role: "user",
|
|
11656
11692
|
content: input
|
|
@@ -11689,12 +11725,12 @@ async function runNonInteractive({
|
|
|
11689
11725
|
const metrics = uiTelemetryService.getMetrics();
|
|
11690
11726
|
const durationMs = Date.now() - startTime;
|
|
11691
11727
|
streamFormatter.emitEvent({
|
|
11692
|
-
type:
|
|
11728
|
+
type: JsonStreamEventType.RESULT,
|
|
11693
11729
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11694
11730
|
status: errorPayload ? "error" : "success",
|
|
11695
11731
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11696
11732
|
});
|
|
11697
|
-
} else if (config.getOutputFormat() ===
|
|
11733
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11698
11734
|
const formatter = new JsonFormatter();
|
|
11699
11735
|
const stats = uiTelemetryService.getMetrics();
|
|
11700
11736
|
textOutput.write(
|
|
@@ -11787,13 +11823,13 @@ async function runNonInteractive({
|
|
|
11787
11823
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11788
11824
|
if (streamFormatter) {
|
|
11789
11825
|
streamFormatter.emitEvent({
|
|
11790
|
-
type:
|
|
11826
|
+
type: JsonStreamEventType.MESSAGE,
|
|
11791
11827
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11792
11828
|
role: "assistant",
|
|
11793
11829
|
content: output,
|
|
11794
11830
|
delta: true
|
|
11795
11831
|
});
|
|
11796
|
-
} else if (config.getOutputFormat() ===
|
|
11832
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11797
11833
|
responseText += output;
|
|
11798
11834
|
} else {
|
|
11799
11835
|
if (part.text) {
|
|
@@ -11806,13 +11842,13 @@ async function runNonInteractive({
|
|
|
11806
11842
|
break;
|
|
11807
11843
|
}
|
|
11808
11844
|
case "tool_request": {
|
|
11809
|
-
if (config.getOutputFormat() ===
|
|
11845
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11810
11846
|
preToolResponseText = responseText || preToolResponseText;
|
|
11811
11847
|
responseText = "";
|
|
11812
11848
|
}
|
|
11813
11849
|
if (streamFormatter) {
|
|
11814
11850
|
streamFormatter.emitEvent({
|
|
11815
|
-
type:
|
|
11851
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
11816
11852
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11817
11853
|
tool_name: event.name,
|
|
11818
11854
|
tool_id: event.requestId,
|
|
@@ -11828,7 +11864,7 @@ async function runNonInteractive({
|
|
|
11828
11864
|
const displayText = displayContentToString(display);
|
|
11829
11865
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11830
11866
|
streamFormatter.emitEvent({
|
|
11831
|
-
type:
|
|
11867
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11832
11868
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11833
11869
|
tool_id: event.requestId,
|
|
11834
11870
|
status: event.isError ? "error" : "success",
|
|
@@ -11843,17 +11879,17 @@ async function runNonInteractive({
|
|
|
11843
11879
|
const display = event.display?.result;
|
|
11844
11880
|
const displayText = displayContentToString(display);
|
|
11845
11881
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11846
|
-
if (event.data?.["errorType"] ===
|
|
11847
|
-
if (config.getOutputFormat() ===
|
|
11882
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
11883
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
11848
11884
|
responseText = preToolResponseText;
|
|
11849
11885
|
}
|
|
11850
11886
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11851
|
-
if (config.getOutputFormat() ===
|
|
11887
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11852
11888
|
process.stderr.write(`${stopMessage}
|
|
11853
11889
|
`);
|
|
11854
11890
|
}
|
|
11855
11891
|
}
|
|
11856
|
-
if (event.data?.["errorType"] ===
|
|
11892
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
11857
11893
|
throw new FatalToolExecutionError(
|
|
11858
11894
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11859
11895
|
);
|
|
@@ -11888,12 +11924,12 @@ async function runNonInteractive({
|
|
|
11888
11924
|
}
|
|
11889
11925
|
if (streamFormatter) {
|
|
11890
11926
|
streamFormatter.emitEvent({
|
|
11891
|
-
type:
|
|
11927
|
+
type: JsonStreamEventType.ERROR,
|
|
11892
11928
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11893
11929
|
severity: "error",
|
|
11894
11930
|
message: errorMessage
|
|
11895
11931
|
});
|
|
11896
|
-
} else if (config.getOutputFormat() ===
|
|
11932
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11897
11933
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11898
11934
|
`);
|
|
11899
11935
|
}
|
|
@@ -11914,12 +11950,12 @@ async function runNonInteractive({
|
|
|
11914
11950
|
const errorCode = event._meta?.["code"];
|
|
11915
11951
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11916
11952
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11917
|
-
if (config.getOutputFormat() ===
|
|
11953
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11918
11954
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11919
11955
|
`);
|
|
11920
11956
|
} else if (streamFormatter) {
|
|
11921
11957
|
streamFormatter.emitEvent({
|
|
11922
|
-
type:
|
|
11958
|
+
type: JsonStreamEventType.ERROR,
|
|
11923
11959
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11924
11960
|
severity: "warning",
|
|
11925
11961
|
message: stripAnsi(blockMessage)
|
|
@@ -11929,13 +11965,13 @@ async function runNonInteractive({
|
|
|
11929
11965
|
break;
|
|
11930
11966
|
}
|
|
11931
11967
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11932
|
-
if (config.getOutputFormat() ===
|
|
11968
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11933
11969
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11934
11970
|
`);
|
|
11935
11971
|
}
|
|
11936
11972
|
if (streamFormatter) {
|
|
11937
11973
|
streamFormatter.emitEvent({
|
|
11938
|
-
type:
|
|
11974
|
+
type: JsonStreamEventType.ERROR,
|
|
11939
11975
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11940
11976
|
severity,
|
|
11941
11977
|
message: stripAnsi(event.message)
|
|
@@ -11955,7 +11991,7 @@ async function runNonInteractive({
|
|
|
11955
11991
|
);
|
|
11956
11992
|
} else if (streamFormatter) {
|
|
11957
11993
|
streamFormatter.emitEvent({
|
|
11958
|
-
type:
|
|
11994
|
+
type: JsonStreamEventType.ERROR,
|
|
11959
11995
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11960
11996
|
severity: "error",
|
|
11961
11997
|
message: "Maximum session turns exceeded"
|
|
@@ -11963,7 +11999,7 @@ async function runNonInteractive({
|
|
|
11963
11999
|
}
|
|
11964
12000
|
}
|
|
11965
12001
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11966
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
12002
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11967
12003
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11968
12004
|
`);
|
|
11969
12005
|
}
|
|
@@ -11993,7 +12029,7 @@ async function runNonInteractive({
|
|
|
11993
12029
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11994
12030
|
scheduler?.dispose();
|
|
11995
12031
|
consolePatcher.cleanup();
|
|
11996
|
-
coreEvents.off(
|
|
12032
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11997
12033
|
}
|
|
11998
12034
|
if (errorToHandle) {
|
|
11999
12035
|
handleError(errorToHandle, config);
|
|
@@ -12021,7 +12057,7 @@ async function runNonInteractive2(params) {
|
|
|
12021
12057
|
}
|
|
12022
12058
|
});
|
|
12023
12059
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
12024
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
12060
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-Z4ND55GM.js");
|
|
12025
12061
|
setupInitialActivityLogger(config);
|
|
12026
12062
|
}
|
|
12027
12063
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -12037,7 +12073,7 @@ async function runNonInteractive2(params) {
|
|
|
12037
12073
|
}
|
|
12038
12074
|
};
|
|
12039
12075
|
const startTime = Date.now();
|
|
12040
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
12076
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
12041
12077
|
const abortController = new AbortController();
|
|
12042
12078
|
let isAborting = false;
|
|
12043
12079
|
let cancelMessageTimer = null;
|
|
@@ -12088,13 +12124,13 @@ async function runNonInteractive2(params) {
|
|
|
12088
12124
|
let scheduler;
|
|
12089
12125
|
try {
|
|
12090
12126
|
consolePatcher.patch();
|
|
12091
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
12127
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12092
12128
|
process.stderr.write(
|
|
12093
12129
|
"[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"
|
|
12094
12130
|
);
|
|
12095
12131
|
}
|
|
12096
12132
|
setupStdinCancellation();
|
|
12097
|
-
coreEvents.on(
|
|
12133
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
12098
12134
|
coreEvents.drainBacklogs();
|
|
12099
12135
|
process.stdout.on("error", (err) => {
|
|
12100
12136
|
if (err.code === "EPIPE") {
|
|
@@ -12118,7 +12154,7 @@ async function runNonInteractive2(params) {
|
|
|
12118
12154
|
}
|
|
12119
12155
|
if (streamFormatter) {
|
|
12120
12156
|
streamFormatter.emitEvent({
|
|
12121
|
-
type:
|
|
12157
|
+
type: JsonStreamEventType.INIT,
|
|
12122
12158
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12123
12159
|
session_id: config.getSessionId(),
|
|
12124
12160
|
model: config.getModel()
|
|
@@ -12156,7 +12192,7 @@ async function runNonInteractive2(params) {
|
|
|
12156
12192
|
}
|
|
12157
12193
|
if (streamFormatter) {
|
|
12158
12194
|
streamFormatter.emitEvent({
|
|
12159
|
-
type:
|
|
12195
|
+
type: JsonStreamEventType.MESSAGE,
|
|
12160
12196
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12161
12197
|
role: "user",
|
|
12162
12198
|
content: input
|
|
@@ -12184,28 +12220,28 @@ async function runNonInteractive2(params) {
|
|
|
12184
12220
|
if (abortController.signal.aborted) {
|
|
12185
12221
|
handleCancellationError(config);
|
|
12186
12222
|
}
|
|
12187
|
-
if (event.type ===
|
|
12223
|
+
if (event.type === GeminiEventType.Content) {
|
|
12188
12224
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
12189
12225
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
12190
12226
|
if (streamFormatter) {
|
|
12191
12227
|
streamFormatter.emitEvent({
|
|
12192
|
-
type:
|
|
12228
|
+
type: JsonStreamEventType.MESSAGE,
|
|
12193
12229
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12194
12230
|
role: "assistant",
|
|
12195
12231
|
content: output,
|
|
12196
12232
|
delta: true
|
|
12197
12233
|
});
|
|
12198
|
-
} else if (config.getOutputFormat() ===
|
|
12234
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12199
12235
|
responseText += output;
|
|
12200
12236
|
} else {
|
|
12201
12237
|
if (event.value) {
|
|
12202
12238
|
textOutput.write(output);
|
|
12203
12239
|
}
|
|
12204
12240
|
}
|
|
12205
|
-
} else if (event.type ===
|
|
12241
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
12206
12242
|
if (streamFormatter) {
|
|
12207
12243
|
streamFormatter.emitEvent({
|
|
12208
|
-
type:
|
|
12244
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
12209
12245
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12210
12246
|
tool_name: event.value.name,
|
|
12211
12247
|
tool_id: event.value.callId,
|
|
@@ -12213,33 +12249,33 @@ async function runNonInteractive2(params) {
|
|
|
12213
12249
|
});
|
|
12214
12250
|
}
|
|
12215
12251
|
toolCallRequests.push(event.value);
|
|
12216
|
-
} else if (event.type ===
|
|
12252
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
12217
12253
|
const message = "Loop detected, stopping execution";
|
|
12218
12254
|
if (streamFormatter) {
|
|
12219
12255
|
streamFormatter.emitEvent({
|
|
12220
|
-
type:
|
|
12256
|
+
type: JsonStreamEventType.ERROR,
|
|
12221
12257
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12222
12258
|
severity: "warning",
|
|
12223
12259
|
message
|
|
12224
12260
|
});
|
|
12225
12261
|
}
|
|
12226
12262
|
warnings.push(message);
|
|
12227
|
-
} else if (event.type ===
|
|
12263
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
12228
12264
|
const message = "Maximum session turns exceeded";
|
|
12229
12265
|
if (streamFormatter) {
|
|
12230
12266
|
streamFormatter.emitEvent({
|
|
12231
|
-
type:
|
|
12267
|
+
type: JsonStreamEventType.ERROR,
|
|
12232
12268
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12233
12269
|
severity: "error",
|
|
12234
12270
|
message
|
|
12235
12271
|
});
|
|
12236
12272
|
}
|
|
12237
12273
|
warnings.push(message);
|
|
12238
|
-
} else if (event.type ===
|
|
12274
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
12239
12275
|
throw event.value.error;
|
|
12240
|
-
} else if (event.type ===
|
|
12276
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
12241
12277
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12242
|
-
if (config.getOutputFormat() ===
|
|
12278
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12243
12279
|
process.stderr.write(`${stopMessage}
|
|
12244
12280
|
`);
|
|
12245
12281
|
}
|
|
@@ -12247,7 +12283,7 @@ async function runNonInteractive2(params) {
|
|
|
12247
12283
|
const metrics = uiTelemetryService.getMetrics();
|
|
12248
12284
|
const durationMs = Date.now() - startTime;
|
|
12249
12285
|
streamFormatter.emitEvent({
|
|
12250
|
-
type:
|
|
12286
|
+
type: JsonStreamEventType.RESULT,
|
|
12251
12287
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12252
12288
|
status: "success",
|
|
12253
12289
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12255,7 +12291,7 @@ async function runNonInteractive2(params) {
|
|
|
12255
12291
|
durationMs
|
|
12256
12292
|
)
|
|
12257
12293
|
});
|
|
12258
|
-
} else if (config.getOutputFormat() ===
|
|
12294
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12259
12295
|
const formatter = new JsonFormatter();
|
|
12260
12296
|
const stats = uiTelemetryService.getMetrics();
|
|
12261
12297
|
textOutput.write(
|
|
@@ -12271,21 +12307,21 @@ async function runNonInteractive2(params) {
|
|
|
12271
12307
|
textOutput.ensureTrailingNewline();
|
|
12272
12308
|
}
|
|
12273
12309
|
return;
|
|
12274
|
-
} else if (event.type ===
|
|
12310
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
12275
12311
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
12276
|
-
if (config.getOutputFormat() ===
|
|
12312
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12277
12313
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
12278
12314
|
`);
|
|
12279
12315
|
} else if (streamFormatter) {
|
|
12280
12316
|
streamFormatter.emitEvent({
|
|
12281
|
-
type:
|
|
12317
|
+
type: JsonStreamEventType.ERROR,
|
|
12282
12318
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12283
12319
|
severity: "warning",
|
|
12284
12320
|
message: stripAnsi(blockMessage)
|
|
12285
12321
|
});
|
|
12286
12322
|
}
|
|
12287
12323
|
warnings.push(blockMessage);
|
|
12288
|
-
} else if (event.type ===
|
|
12324
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
12289
12325
|
const eventValue = event.value;
|
|
12290
12326
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
12291
12327
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -12308,12 +12344,12 @@ async function runNonInteractive2(params) {
|
|
|
12308
12344
|
);
|
|
12309
12345
|
if (streamFormatter) {
|
|
12310
12346
|
streamFormatter.emitEvent({
|
|
12311
|
-
type:
|
|
12347
|
+
type: JsonStreamEventType.ERROR,
|
|
12312
12348
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12313
12349
|
severity: "error",
|
|
12314
12350
|
message: invalidStreamError
|
|
12315
12351
|
});
|
|
12316
|
-
} else if (config.getOutputFormat() ===
|
|
12352
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12317
12353
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
12318
12354
|
`);
|
|
12319
12355
|
}
|
|
@@ -12333,7 +12369,7 @@ async function runNonInteractive2(params) {
|
|
|
12333
12369
|
const requestInfo = completedToolCall.request;
|
|
12334
12370
|
if (streamFormatter) {
|
|
12335
12371
|
streamFormatter.emitEvent({
|
|
12336
|
-
type:
|
|
12372
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
12337
12373
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12338
12374
|
tool_id: requestInfo.callId,
|
|
12339
12375
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -12367,11 +12403,11 @@ async function runNonInteractive2(params) {
|
|
|
12367
12403
|
);
|
|
12368
12404
|
}
|
|
12369
12405
|
const stopExecutionTool = completedToolCalls.find(
|
|
12370
|
-
(tc) => tc.response.errorType ===
|
|
12406
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
12371
12407
|
);
|
|
12372
12408
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
12373
12409
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
12374
|
-
if (config.getOutputFormat() ===
|
|
12410
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
12375
12411
|
process.stderr.write(`${stopMessage}
|
|
12376
12412
|
`);
|
|
12377
12413
|
}
|
|
@@ -12379,7 +12415,7 @@ async function runNonInteractive2(params) {
|
|
|
12379
12415
|
const metrics = uiTelemetryService.getMetrics();
|
|
12380
12416
|
const durationMs = Date.now() - startTime;
|
|
12381
12417
|
streamFormatter.emitEvent({
|
|
12382
|
-
type:
|
|
12418
|
+
type: JsonStreamEventType.RESULT,
|
|
12383
12419
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12384
12420
|
status: "success",
|
|
12385
12421
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12387,7 +12423,7 @@ async function runNonInteractive2(params) {
|
|
|
12387
12423
|
durationMs
|
|
12388
12424
|
)
|
|
12389
12425
|
});
|
|
12390
|
-
} else if (config.getOutputFormat() ===
|
|
12426
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12391
12427
|
const formatter = new JsonFormatter();
|
|
12392
12428
|
const stats = uiTelemetryService.getMetrics();
|
|
12393
12429
|
textOutput.write(
|
|
@@ -12410,12 +12446,12 @@ async function runNonInteractive2(params) {
|
|
|
12410
12446
|
const metrics = uiTelemetryService.getMetrics();
|
|
12411
12447
|
const durationMs = Date.now() - startTime;
|
|
12412
12448
|
streamFormatter.emitEvent({
|
|
12413
|
-
type:
|
|
12449
|
+
type: JsonStreamEventType.RESULT,
|
|
12414
12450
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12415
12451
|
status: invalidStreamError ? "error" : "success",
|
|
12416
12452
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12417
12453
|
});
|
|
12418
|
-
} else if (config.getOutputFormat() ===
|
|
12454
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
12419
12455
|
const formatter = new JsonFormatter();
|
|
12420
12456
|
const stats = uiTelemetryService.getMetrics();
|
|
12421
12457
|
textOutput.write(
|
|
@@ -12439,7 +12475,7 @@ async function runNonInteractive2(params) {
|
|
|
12439
12475
|
cleanupStdinCancellation();
|
|
12440
12476
|
scheduler?.dispose();
|
|
12441
12477
|
consolePatcher.cleanup();
|
|
12442
|
-
coreEvents.off(
|
|
12478
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
12443
12479
|
}
|
|
12444
12480
|
if (errorToHandle) {
|
|
12445
12481
|
handleError(errorToHandle, config);
|
|
@@ -14830,12 +14866,12 @@ function toToolCallContent(toolResult) {
|
|
|
14830
14866
|
}
|
|
14831
14867
|
var basicPermissionOptions = [
|
|
14832
14868
|
{
|
|
14833
|
-
optionId:
|
|
14869
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14834
14870
|
name: "Allow",
|
|
14835
14871
|
kind: "allow_once"
|
|
14836
14872
|
},
|
|
14837
14873
|
{
|
|
14838
|
-
optionId:
|
|
14874
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14839
14875
|
name: "Reject",
|
|
14840
14876
|
kind: "reject_once"
|
|
14841
14877
|
}
|
|
@@ -14847,13 +14883,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14847
14883
|
switch (confirmation.type) {
|
|
14848
14884
|
case "edit":
|
|
14849
14885
|
options.push({
|
|
14850
|
-
optionId:
|
|
14886
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14851
14887
|
name: "Allow for this session",
|
|
14852
14888
|
kind: "allow_always"
|
|
14853
14889
|
});
|
|
14854
14890
|
if (enablePermanentToolApproval) {
|
|
14855
14891
|
options.push({
|
|
14856
|
-
optionId:
|
|
14892
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14857
14893
|
name: "Allow for this file in all future sessions",
|
|
14858
14894
|
kind: "allow_always"
|
|
14859
14895
|
});
|
|
@@ -14861,13 +14897,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14861
14897
|
break;
|
|
14862
14898
|
case "exec":
|
|
14863
14899
|
options.push({
|
|
14864
|
-
optionId:
|
|
14900
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14865
14901
|
name: "Allow for this session",
|
|
14866
14902
|
kind: "allow_always"
|
|
14867
14903
|
});
|
|
14868
14904
|
if (enablePermanentToolApproval) {
|
|
14869
14905
|
options.push({
|
|
14870
|
-
optionId:
|
|
14906
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14871
14907
|
name: "Allow this command for all future sessions",
|
|
14872
14908
|
kind: "allow_always"
|
|
14873
14909
|
});
|
|
@@ -14876,19 +14912,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14876
14912
|
case "mcp":
|
|
14877
14913
|
options.push(
|
|
14878
14914
|
{
|
|
14879
|
-
optionId:
|
|
14915
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
14880
14916
|
name: "Allow all server tools for this session",
|
|
14881
14917
|
kind: "allow_always"
|
|
14882
14918
|
},
|
|
14883
14919
|
{
|
|
14884
|
-
optionId:
|
|
14920
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
14885
14921
|
name: "Allow tool for this session",
|
|
14886
14922
|
kind: "allow_always"
|
|
14887
14923
|
}
|
|
14888
14924
|
);
|
|
14889
14925
|
if (enablePermanentToolApproval) {
|
|
14890
14926
|
options.push({
|
|
14891
|
-
optionId:
|
|
14927
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14892
14928
|
name: "Allow tool for all future sessions",
|
|
14893
14929
|
kind: "allow_always"
|
|
14894
14930
|
});
|
|
@@ -14896,13 +14932,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14896
14932
|
break;
|
|
14897
14933
|
case "info":
|
|
14898
14934
|
options.push({
|
|
14899
|
-
optionId:
|
|
14935
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
14900
14936
|
name: "Allow for this session",
|
|
14901
14937
|
kind: "allow_always"
|
|
14902
14938
|
});
|
|
14903
14939
|
if (enablePermanentToolApproval) {
|
|
14904
14940
|
options.push({
|
|
14905
|
-
optionId:
|
|
14941
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
14906
14942
|
name: "Allow for all future sessions",
|
|
14907
14943
|
kind: "allow_always"
|
|
14908
14944
|
});
|
|
@@ -14934,21 +14970,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14934
14970
|
}
|
|
14935
14971
|
function toAcpToolKind(kind) {
|
|
14936
14972
|
switch (kind) {
|
|
14937
|
-
case
|
|
14938
|
-
case
|
|
14939
|
-
case
|
|
14940
|
-
case
|
|
14941
|
-
case
|
|
14942
|
-
case
|
|
14943
|
-
case
|
|
14944
|
-
case
|
|
14945
|
-
case
|
|
14946
|
-
case
|
|
14973
|
+
case Kind.Read:
|
|
14974
|
+
case Kind.Edit:
|
|
14975
|
+
case Kind.Execute:
|
|
14976
|
+
case Kind.Search:
|
|
14977
|
+
case Kind.Delete:
|
|
14978
|
+
case Kind.Move:
|
|
14979
|
+
case Kind.Think:
|
|
14980
|
+
case Kind.Fetch:
|
|
14981
|
+
case Kind.SwitchMode:
|
|
14982
|
+
case Kind.Other:
|
|
14947
14983
|
return kind;
|
|
14948
|
-
case
|
|
14984
|
+
case Kind.Agent:
|
|
14949
14985
|
return "think";
|
|
14950
|
-
case
|
|
14951
|
-
case
|
|
14986
|
+
case Kind.Plan:
|
|
14987
|
+
case Kind.Communicate:
|
|
14952
14988
|
default:
|
|
14953
14989
|
return "other";
|
|
14954
14990
|
}
|
|
@@ -14956,24 +14992,24 @@ function toAcpToolKind(kind) {
|
|
|
14956
14992
|
function buildAvailableModes(isPlanEnabled) {
|
|
14957
14993
|
const modes = [
|
|
14958
14994
|
{
|
|
14959
|
-
id:
|
|
14995
|
+
id: ApprovalMode.DEFAULT,
|
|
14960
14996
|
name: "Default",
|
|
14961
14997
|
description: "Prompts for approval"
|
|
14962
14998
|
},
|
|
14963
14999
|
{
|
|
14964
|
-
id:
|
|
15000
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
14965
15001
|
name: "Auto Edit",
|
|
14966
15002
|
description: "Auto-approves edit tools"
|
|
14967
15003
|
},
|
|
14968
15004
|
{
|
|
14969
|
-
id:
|
|
15005
|
+
id: ApprovalMode.YOLO,
|
|
14970
15006
|
name: "YOLO",
|
|
14971
15007
|
description: "Auto-approves all tools"
|
|
14972
15008
|
}
|
|
14973
15009
|
];
|
|
14974
15010
|
if (isPlanEnabled) {
|
|
14975
15011
|
modes.push({
|
|
14976
|
-
id:
|
|
15012
|
+
id: ApprovalMode.PLAN,
|
|
14977
15013
|
name: "Plan",
|
|
14978
15014
|
description: "Read-only mode"
|
|
14979
15015
|
});
|
|
@@ -14987,7 +15023,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14987
15023
|
const useLatestFlash = config.hasLatestFlashGAAccess?.() ?? false;
|
|
14988
15024
|
const useLatestFlashLite = config.hasLatestFlashLiteGAAccess?.() ?? false;
|
|
14989
15025
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14990
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
15026
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
14991
15027
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14992
15028
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14993
15029
|
useGemini3_1: useGemini31,
|
|
@@ -15074,11 +15110,11 @@ var Session = class {
|
|
|
15074
15110
|
this.connection = connection;
|
|
15075
15111
|
this.settings = settings;
|
|
15076
15112
|
coreEvents.on(
|
|
15077
|
-
|
|
15113
|
+
CoreEvent.ApprovalModeChanged,
|
|
15078
15114
|
this.handleApprovalModeChanged
|
|
15079
15115
|
);
|
|
15080
15116
|
this.context.config.getMessageBus()?.subscribe(
|
|
15081
|
-
|
|
15117
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
15082
15118
|
this.handleToolConfirmationRequest,
|
|
15083
15119
|
{ signal: this.disposeController.signal }
|
|
15084
15120
|
);
|
|
@@ -15102,7 +15138,7 @@ var Session = class {
|
|
|
15102
15138
|
"Policy engine missing. Denying tool confirmation request."
|
|
15103
15139
|
);
|
|
15104
15140
|
await messageBus.publish({
|
|
15105
|
-
type:
|
|
15141
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15106
15142
|
correlationId: request.correlationId,
|
|
15107
15143
|
confirmed: false,
|
|
15108
15144
|
requiresUserConfirmation: false
|
|
@@ -15115,7 +15151,7 @@ var Session = class {
|
|
|
15115
15151
|
"Tool confirmation request missing tool name. Denying."
|
|
15116
15152
|
);
|
|
15117
15153
|
await messageBus.publish({
|
|
15118
|
-
type:
|
|
15154
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15119
15155
|
correlationId: request.correlationId,
|
|
15120
15156
|
confirmed: false,
|
|
15121
15157
|
requiresUserConfirmation: false
|
|
@@ -15128,7 +15164,7 @@ var Session = class {
|
|
|
15128
15164
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
15129
15165
|
);
|
|
15130
15166
|
await messageBus.publish({
|
|
15131
|
-
type:
|
|
15167
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15132
15168
|
correlationId: request.correlationId,
|
|
15133
15169
|
confirmed: false,
|
|
15134
15170
|
requiresUserConfirmation: false
|
|
@@ -15144,15 +15180,15 @@ var Session = class {
|
|
|
15144
15180
|
request.subagent
|
|
15145
15181
|
);
|
|
15146
15182
|
await messageBus.publish({
|
|
15147
|
-
type:
|
|
15183
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15148
15184
|
correlationId: request.correlationId,
|
|
15149
|
-
confirmed: result.decision ===
|
|
15150
|
-
requiresUserConfirmation: result.decision ===
|
|
15185
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
15186
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
15151
15187
|
});
|
|
15152
15188
|
} catch (error) {
|
|
15153
15189
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
15154
15190
|
await this.context.config.getMessageBus()?.publish({
|
|
15155
|
-
type:
|
|
15191
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
15156
15192
|
correlationId: request.correlationId,
|
|
15157
15193
|
confirmed: false,
|
|
15158
15194
|
requiresUserConfirmation: false
|
|
@@ -15172,7 +15208,7 @@ var Session = class {
|
|
|
15172
15208
|
};
|
|
15173
15209
|
async dispose() {
|
|
15174
15210
|
coreEvents.off(
|
|
15175
|
-
|
|
15211
|
+
CoreEvent.ApprovalModeChanged,
|
|
15176
15212
|
this.handleApprovalModeChanged
|
|
15177
15213
|
);
|
|
15178
15214
|
this.disposeController.abort();
|
|
@@ -15268,7 +15304,7 @@ ${thought.description}`;
|
|
|
15268
15304
|
await this.sendUpdate({
|
|
15269
15305
|
sessionUpdate: "tool_call",
|
|
15270
15306
|
toolCallId: toolCall.id,
|
|
15271
|
-
status: toolCall.status ===
|
|
15307
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
15272
15308
|
title: toolCall.displayName || toolCall.name,
|
|
15273
15309
|
content: toolCallContent,
|
|
15274
15310
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -15377,7 +15413,7 @@ ${thought.description}`;
|
|
|
15377
15413
|
return { stopReason: "cancelled" };
|
|
15378
15414
|
}
|
|
15379
15415
|
switch (event.type) {
|
|
15380
|
-
case
|
|
15416
|
+
case GeminiEventType.Content: {
|
|
15381
15417
|
const content = {
|
|
15382
15418
|
type: "text",
|
|
15383
15419
|
text: event.value
|
|
@@ -15388,7 +15424,7 @@ ${thought.description}`;
|
|
|
15388
15424
|
});
|
|
15389
15425
|
break;
|
|
15390
15426
|
}
|
|
15391
|
-
case
|
|
15427
|
+
case GeminiEventType.Thought: {
|
|
15392
15428
|
const thoughtText = `**${event.value.subject}**
|
|
15393
15429
|
${event.value.description}`;
|
|
15394
15430
|
await this.sendUpdate({
|
|
@@ -15397,10 +15433,10 @@ ${event.value.description}`;
|
|
|
15397
15433
|
});
|
|
15398
15434
|
break;
|
|
15399
15435
|
}
|
|
15400
|
-
case
|
|
15436
|
+
case GeminiEventType.ToolCallRequest:
|
|
15401
15437
|
toolCallRequests.push(event.value);
|
|
15402
15438
|
break;
|
|
15403
|
-
case
|
|
15439
|
+
case GeminiEventType.Finished: {
|
|
15404
15440
|
const usage2 = event.value.usageMetadata;
|
|
15405
15441
|
if (usage2) {
|
|
15406
15442
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -15417,19 +15453,19 @@ ${event.value.description}`;
|
|
|
15417
15453
|
}
|
|
15418
15454
|
break;
|
|
15419
15455
|
}
|
|
15420
|
-
case
|
|
15456
|
+
case GeminiEventType.ModelInfo:
|
|
15421
15457
|
turnModelId = event.value;
|
|
15422
15458
|
break;
|
|
15423
|
-
case
|
|
15459
|
+
case GeminiEventType.MaxSessionTurns:
|
|
15424
15460
|
stopReason = "max_turn_requests";
|
|
15425
15461
|
break;
|
|
15426
|
-
case
|
|
15462
|
+
case GeminiEventType.LoopDetected:
|
|
15427
15463
|
stopReason = "max_turn_requests";
|
|
15428
15464
|
break;
|
|
15429
|
-
case
|
|
15465
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
15430
15466
|
stopReason = "max_tokens";
|
|
15431
15467
|
break;
|
|
15432
|
-
case
|
|
15468
|
+
case GeminiEventType.Error: {
|
|
15433
15469
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
15434
15470
|
event.value.error
|
|
15435
15471
|
);
|
|
@@ -15610,7 +15646,7 @@ ${event.value.description}`;
|
|
|
15610
15646
|
const output = RequestPermissionResponseSchema.parse(
|
|
15611
15647
|
await this.connection.requestPermission(params)
|
|
15612
15648
|
);
|
|
15613
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15649
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15614
15650
|
await confirmationDetails.onConfirm(outcome);
|
|
15615
15651
|
await updatePolicy(
|
|
15616
15652
|
tool,
|
|
@@ -15621,7 +15657,7 @@ ${event.value.description}`;
|
|
|
15621
15657
|
invocation
|
|
15622
15658
|
);
|
|
15623
15659
|
switch (outcome) {
|
|
15624
|
-
case
|
|
15660
|
+
case ToolConfirmationOutcome.Cancel: {
|
|
15625
15661
|
const cancelError = new Error(
|
|
15626
15662
|
`Tool "${fc.name}" was canceled by the user.`
|
|
15627
15663
|
);
|
|
@@ -15639,12 +15675,12 @@ ${event.value.description}`;
|
|
|
15639
15675
|
});
|
|
15640
15676
|
return errorResponse(cancelError);
|
|
15641
15677
|
}
|
|
15642
|
-
case
|
|
15643
|
-
case
|
|
15644
|
-
case
|
|
15645
|
-
case
|
|
15646
|
-
case
|
|
15647
|
-
case
|
|
15678
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
15679
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
15680
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
15681
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
15682
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
15683
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
15648
15684
|
break;
|
|
15649
15685
|
default: {
|
|
15650
15686
|
const resultOutcome = outcome;
|
|
@@ -15698,7 +15734,7 @@ ${event.value.description}`;
|
|
|
15698
15734
|
);
|
|
15699
15735
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15700
15736
|
{
|
|
15701
|
-
status:
|
|
15737
|
+
status: CoreToolCallStatus.Success,
|
|
15702
15738
|
request: {
|
|
15703
15739
|
callId,
|
|
15704
15740
|
name: fc.name,
|
|
@@ -15743,7 +15779,7 @@ ${event.value.description}`;
|
|
|
15743
15779
|
});
|
|
15744
15780
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15745
15781
|
{
|
|
15746
|
-
status:
|
|
15782
|
+
status: CoreToolCallStatus.Error,
|
|
15747
15783
|
request: {
|
|
15748
15784
|
callId,
|
|
15749
15785
|
name: fc.name,
|
|
@@ -15871,12 +15907,12 @@ ${event.value.description}`;
|
|
|
15871
15907
|
sessionId: this.id,
|
|
15872
15908
|
options: [
|
|
15873
15909
|
{
|
|
15874
|
-
optionId:
|
|
15910
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
15875
15911
|
name: "Allow once",
|
|
15876
15912
|
kind: "allow_once"
|
|
15877
15913
|
},
|
|
15878
15914
|
{
|
|
15879
|
-
optionId:
|
|
15915
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
15880
15916
|
name: "Deny",
|
|
15881
15917
|
kind: "reject_once"
|
|
15882
15918
|
}
|
|
@@ -15901,8 +15937,8 @@ ${event.value.description}`;
|
|
|
15901
15937
|
const output = RequestPermissionResponseSchema.parse(
|
|
15902
15938
|
await this.connection.requestPermission(params)
|
|
15903
15939
|
);
|
|
15904
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15905
|
-
if (outcome ===
|
|
15940
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15941
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
15906
15942
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15907
15943
|
validationError = null;
|
|
15908
15944
|
} else {
|
|
@@ -16347,7 +16383,7 @@ var AcpSessionManager = class {
|
|
|
16347
16383
|
mcpServers,
|
|
16348
16384
|
loadedSettings
|
|
16349
16385
|
);
|
|
16350
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16386
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
16351
16387
|
let isAuthenticated = false;
|
|
16352
16388
|
let authErrorMessage = "";
|
|
16353
16389
|
try {
|
|
@@ -16359,7 +16395,7 @@ var AcpSessionManager = class {
|
|
|
16359
16395
|
);
|
|
16360
16396
|
isAuthenticated = true;
|
|
16361
16397
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
16362
|
-
if (authType ===
|
|
16398
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
16363
16399
|
isAuthenticated = false;
|
|
16364
16400
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
16365
16401
|
}
|
|
@@ -16543,7 +16579,7 @@ var AcpSessionManager = class {
|
|
|
16543
16579
|
}
|
|
16544
16580
|
}
|
|
16545
16581
|
async prepareSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16546
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16582
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
16547
16583
|
if (!selectedAuthType) {
|
|
16548
16584
|
throw RequestError.authRequired();
|
|
16549
16585
|
}
|
|
@@ -16655,12 +16691,12 @@ var GeminiAgent = class {
|
|
|
16655
16691
|
}
|
|
16656
16692
|
const authMethods = [
|
|
16657
16693
|
{
|
|
16658
|
-
id:
|
|
16694
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
16659
16695
|
name: "Log in with Google",
|
|
16660
16696
|
description: "Log in with your Google account"
|
|
16661
16697
|
},
|
|
16662
16698
|
{
|
|
16663
|
-
id:
|
|
16699
|
+
id: AuthType.USE_GEMINI,
|
|
16664
16700
|
name: "Gemini API key",
|
|
16665
16701
|
description: "Use an API key with Gemini Developer API",
|
|
16666
16702
|
_meta: {
|
|
@@ -16670,12 +16706,12 @@ var GeminiAgent = class {
|
|
|
16670
16706
|
}
|
|
16671
16707
|
},
|
|
16672
16708
|
{
|
|
16673
|
-
id:
|
|
16709
|
+
id: AuthType.USE_VERTEX_AI,
|
|
16674
16710
|
name: "Vertex AI",
|
|
16675
16711
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16676
16712
|
},
|
|
16677
16713
|
{
|
|
16678
|
-
id:
|
|
16714
|
+
id: AuthType.GATEWAY,
|
|
16679
16715
|
name: "AI API Gateway",
|
|
16680
16716
|
description: "Use a custom AI API Gateway",
|
|
16681
16717
|
_meta: {
|
|
@@ -16848,7 +16884,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16848
16884
|
}
|
|
16849
16885
|
return authType;
|
|
16850
16886
|
} catch (error) {
|
|
16851
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16887
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
16852
16888
|
handleError(
|
|
16853
16889
|
error instanceof Error ? error : new Error(String(error)),
|
|
16854
16890
|
nonInteractiveConfig,
|
|
@@ -17043,10 +17079,10 @@ var SlashCommandConflictHandler = class {
|
|
|
17043
17079
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
17044
17080
|
}
|
|
17045
17081
|
start() {
|
|
17046
|
-
coreEvents.on(
|
|
17082
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
17047
17083
|
}
|
|
17048
17084
|
stop() {
|
|
17049
|
-
coreEvents.off(
|
|
17085
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
17050
17086
|
if (this.flushTimeout) {
|
|
17051
17087
|
clearTimeout(this.flushTimeout);
|
|
17052
17088
|
this.flushTimeout = null;
|
|
@@ -17402,7 +17438,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
17402
17438
|
}
|
|
17403
17439
|
}
|
|
17404
17440
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
17405
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
17441
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-YANG53MI.js");
|
|
17406
17442
|
await doStartUI(
|
|
17407
17443
|
config,
|
|
17408
17444
|
settings,
|
|
@@ -17505,12 +17541,12 @@ async function main() {
|
|
|
17505
17541
|
dns.setDefaultResultOrder(
|
|
17506
17542
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
17507
17543
|
);
|
|
17508
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
17544
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
17509
17545
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
17510
17546
|
settings.setValue(
|
|
17511
17547
|
"User" /* User */,
|
|
17512
17548
|
"security.auth.selectedType",
|
|
17513
|
-
|
|
17549
|
+
AuthType.COMPUTE_ADC
|
|
17514
17550
|
);
|
|
17515
17551
|
}
|
|
17516
17552
|
}
|
|
@@ -17611,7 +17647,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17611
17647
|
await config.storage.initialize();
|
|
17612
17648
|
adminControlsListner.setConfig(config);
|
|
17613
17649
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17614
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17650
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-Z4ND55GM.js");
|
|
17615
17651
|
setupInitialActivityLogger(config);
|
|
17616
17652
|
}
|
|
17617
17653
|
registerTelemetryConfig(config);
|
|
@@ -17619,7 +17655,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17619
17655
|
const messageBus = config.getMessageBus();
|
|
17620
17656
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17621
17657
|
registerCleanup(async () => {
|
|
17622
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17658
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
17623
17659
|
});
|
|
17624
17660
|
if (!config.getAcpMode()) {
|
|
17625
17661
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17670,7 +17706,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17670
17706
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17671
17707
|
const initializationResult = await initializeApp(config, settings);
|
|
17672
17708
|
initAppHandle?.end();
|
|
17673
|
-
import("./liteRtServerManager-
|
|
17709
|
+
import("./liteRtServerManager-PGT3WQWS.js").then(({ LiteRtServerManager }) => {
|
|
17674
17710
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17675
17711
|
if (!mergedGemma) return;
|
|
17676
17712
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17680,7 +17716,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17680
17716
|
autoStartServer: userGemma?.autoStartServer
|
|
17681
17717
|
});
|
|
17682
17718
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17683
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17719
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
17684
17720
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17685
17721
|
}
|
|
17686
17722
|
if (config.getAcpMode()) {
|
|
@@ -17696,7 +17732,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17696
17732
|
...rawStartupWarnings.map((message) => ({
|
|
17697
17733
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17698
17734
|
message,
|
|
17699
|
-
priority:
|
|
17735
|
+
priority: WarningPriority.High
|
|
17700
17736
|
})),
|
|
17701
17737
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17702
17738
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17733,7 +17769,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17733
17769
|
${input}` : stdinData;
|
|
17734
17770
|
}
|
|
17735
17771
|
}
|
|
17736
|
-
const sessionStartSource = resumedSessionData ?
|
|
17772
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
17737
17773
|
const hookSystem = config?.getHookSystem();
|
|
17738
17774
|
if (hookSystem) {
|
|
17739
17775
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17790,8 +17826,8 @@ ${input}` : wrappedContext;
|
|
|
17790
17826
|
}
|
|
17791
17827
|
}
|
|
17792
17828
|
function initializeOutputListenersAndFlush(config) {
|
|
17793
|
-
if (coreEvents.listenerCount(
|
|
17794
|
-
coreEvents.on(
|
|
17829
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
17830
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
17795
17831
|
if (payload.isStderr) {
|
|
17796
17832
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17797
17833
|
} else {
|
|
@@ -17799,8 +17835,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17799
17835
|
}
|
|
17800
17836
|
});
|
|
17801
17837
|
}
|
|
17802
|
-
if (coreEvents.listenerCount(
|
|
17803
|
-
coreEvents.on(
|
|
17838
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
17839
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
17804
17840
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17805
17841
|
writeToStderr(payload.content + "\n");
|
|
17806
17842
|
} else {
|
|
@@ -17808,8 +17844,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17808
17844
|
}
|
|
17809
17845
|
});
|
|
17810
17846
|
}
|
|
17811
|
-
if (coreEvents.listenerCount(
|
|
17812
|
-
coreEvents.on(
|
|
17847
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
17848
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
17813
17849
|
writeToStderr(payload.message + "\n");
|
|
17814
17850
|
});
|
|
17815
17851
|
}
|
|
@@ -17817,7 +17853,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17817
17853
|
const forceToStderr = outputFormat === "json";
|
|
17818
17854
|
coreEvents.drainBacklogs(
|
|
17819
17855
|
(event, args) => {
|
|
17820
|
-
if (forceToStderr && event ===
|
|
17856
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
17821
17857
|
const payload = args[0];
|
|
17822
17858
|
if (!payload.isStderr) {
|
|
17823
17859
|
return {
|