@google/gemini-cli 0.53.0-preview.0 → 0.53.1
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-5RDOS7UZ.js → chunk-2NH5AG3B.js} +175 -39
- package/bundle/{chunk-PVCJCQWY.js → chunk-2W4AGAXV.js} +1 -1
- package/bundle/{chunk-HF533LET.js → chunk-3A32ZSG7.js} +7774 -14246
- package/bundle/{chunk-BX6DTJOD.js → chunk-3QXIQPRB.js} +1 -1
- package/bundle/{chunk-SLQKIE73.js → chunk-4SJPXUBO.js} +1 -1
- package/bundle/{chunk-XH7QC2TB.js → chunk-4TO4ZFXG.js} +2 -2
- package/bundle/{chunk-PKFZO3SN.js → chunk-5544MKWC.js} +1 -1
- package/bundle/{chunk-27C6XFMY.js → chunk-5Y7N3RFB.js} +198 -42
- package/bundle/{chunk-4OVORMGE.js → chunk-AGHZJVUR.js} +1 -1
- package/bundle/{chunk-UJVAPQ7V.js → chunk-AT7LBPDZ.js} +1 -1
- package/bundle/{chunk-7VUO7T2C.js → chunk-EVNGSSTE.js} +3 -3
- package/bundle/{chunk-SXKIOLLX.js → chunk-I2LQOUTQ.js} +7 -7
- package/bundle/chunk-IU6WDAMY.js +1571 -0
- package/bundle/chunk-JEAU27VO.js +154 -0
- package/bundle/chunk-JR6IZCRZ.js +397034 -0
- package/bundle/{chunk-WVDR5L2V.js → chunk-KELPZKO5.js} +67 -54
- package/bundle/{chunk-PLMRBJEA.js → chunk-KNB5JW7H.js} +2 -2
- package/bundle/{chunk-IODN6H35.js → chunk-KUOIDGSH.js} +1 -1
- package/bundle/{chunk-UEI42N7R.js → chunk-KW3DD4IB.js} +3 -3
- package/bundle/{chunk-BDSSP5BZ.js → chunk-LPTVZ4FJ.js} +1 -1
- package/bundle/{chunk-BRZT2CQU.js → chunk-N2KH22XD.js} +1 -1
- package/bundle/{chunk-LUM47MYE.js → chunk-N4JX5RHY.js} +1 -1
- package/bundle/{chunk-6AD4A2WF.js → chunk-OFMYNLJO.js} +8 -5
- package/bundle/chunk-QUZIMBPB.js +102505 -0
- package/bundle/{chunk-HVYOZEAP.js → chunk-RDVVXMLN.js} +3 -3
- package/bundle/chunk-TAOISOL2.js +118 -0
- package/bundle/{chunk-CTNBR234.js → chunk-TIUOC6Z4.js} +2 -2
- package/bundle/chunk-UQGV7WFA.js +398 -0
- package/bundle/{chunk-GHVD6PXK.js → chunk-VQ5JKD47.js} +9 -8
- package/bundle/chunk-XV2XVUWW.js +512 -0
- package/bundle/{chunk-QSTUV3QH.js → chunk-YF4RJFUM.js} +7 -7
- package/bundle/chunk-ZJENN63T.js +17332 -0
- package/bundle/{cleanup-4FVUYQ7H.js → cleanup-CLX27ZSM.js} +2 -2
- package/bundle/{cleanup-XETKRH7X.js → cleanup-HE6L3KVJ.js} +2 -2
- package/bundle/{cleanup-ZR34H2GU.js → cleanup-QTYIWJJQ.js} +2 -2
- package/bundle/cleanup-WQLF5LTO.js +32 -0
- package/bundle/{core-PVG4D2MR.js → core-FG5GQN5T.js} +15 -1
- package/bundle/{devtoolsService-OUX7PWP3.js → devtoolsService-6MCOO7GD.js} +2 -2
- package/bundle/{devtoolsService-IVPTF5ZJ.js → devtoolsService-ALVEJOWU.js} +2 -2
- package/bundle/{devtoolsService-QYDPHHFN.js → devtoolsService-LWOTA4XY.js} +4 -3
- package/bundle/devtoolsService-NLJPFQBD.js +4359 -0
- package/bundle/{dist-PRJQFPSQ.js → dist-FACZYJNK.js} +15 -1
- package/bundle/{core-I73XKBPY.js → dist-KYMVPMD2.js} +15 -1
- package/bundle/dist-YR3L73K3.js +2168 -0
- package/bundle/{gemini-LA6TNI44.js → gemini-2TTBMK7L.js} +84 -20
- package/bundle/{gemini-QKB55UV6.js → gemini-EEGDTU6Z.js} +282 -202
- package/bundle/{gemini-E2E3U6PR.js → gemini-HMY2YBVR.js} +84 -20
- package/bundle/gemini-RNN5D7OL.js +16491 -0
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-OD2LO24X.js → interactiveCli-47BG5E33.js} +99 -9
- package/bundle/{interactiveCli-ADLAWPXN.js → interactiveCli-HJK54NFF.js} +406 -297
- package/bundle/{interactiveCli-FS3OVPXQ.js → interactiveCli-PIOEDBQZ.js} +99 -9
- package/bundle/interactiveCli-UQQGETBL.js +34906 -0
- package/bundle/{liteRtServerManager-O7PFOUFD.js → liteRtServerManager-BZXTWG2T.js} +4 -4
- package/bundle/{liteRtServerManager-T2Z3RLS3.js → liteRtServerManager-ULQCSZ6V.js} +4 -4
- package/bundle/{liteRtServerManager-3SKK7MNE.js → liteRtServerManager-YXO26SKL.js} +4 -4
- package/bundle/liteRtServerManager-ZN3L6BPO.js +65 -0
- package/bundle/{oauth2-provider-Q433RA6I.js → oauth2-provider-G4XOGQD7.js} +1 -1
- package/bundle/{oauth2-provider-E3S5DGLL.js → oauth2-provider-H33CP2XJ.js} +1 -1
- package/bundle/{oauth2-provider-DFVE3NYF.js → oauth2-provider-KEB5OWVK.js} +38 -72
- package/bundle/oauth2-provider-MZRAKSIZ.js +235 -0
- package/bundle/{start-5G2UDZZ6.js → start-AOVRZOK6.js} +6 -6
- package/bundle/{start-XMJ23QZN.js → start-JQESP66T.js} +6 -6
- package/bundle/{start-3FPYJBRX.js → start-KJPOXM4W.js} +6 -6
- package/bundle/start-UN2U7AFE.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-KW3DD4IB.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
updateAllUpdatableExtensions,
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-I2LQOUTQ.js";
|
|
49
49
|
import {
|
|
50
50
|
exitCli,
|
|
51
51
|
require_source
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-IU6WDAMY.js";
|
|
53
53
|
import {
|
|
54
54
|
appEvents
|
|
55
55
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange,
|
|
89
89
|
stripAnsi
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-N4JX5RHY.js";
|
|
91
91
|
import {
|
|
92
92
|
RELAUNCH_EXIT_CODE
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-4TO4ZFXG.js";
|
|
94
|
+
import "./chunk-VQ5JKD47.js";
|
|
95
95
|
import {
|
|
96
96
|
cleanupCheckpoints,
|
|
97
97
|
registerCleanup,
|
|
@@ -100,12 +100,15 @@ import {
|
|
|
100
100
|
runExitCleanup,
|
|
101
101
|
runSyncCleanup,
|
|
102
102
|
setupSignalHandlers
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-2W4AGAXV.js";
|
|
104
104
|
import {
|
|
105
105
|
ASK_USER_TOOL_NAME,
|
|
106
|
+
ApprovalMode,
|
|
106
107
|
AuthType,
|
|
107
108
|
Client,
|
|
108
109
|
Config,
|
|
110
|
+
CoreEvent,
|
|
111
|
+
CoreToolCallStatus,
|
|
109
112
|
DEFAULT_CONTEXT_FILENAME,
|
|
110
113
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
111
114
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -127,32 +130,51 @@ import {
|
|
|
127
130
|
FolderTrustDiscoveryService,
|
|
128
131
|
GEMINI_DIR,
|
|
129
132
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
133
|
+
GeminiEventType,
|
|
130
134
|
IdeClient,
|
|
135
|
+
IntegrityStatus,
|
|
131
136
|
InvalidStreamError,
|
|
132
137
|
JsonFormatter,
|
|
138
|
+
JsonStreamEventType,
|
|
139
|
+
Kind,
|
|
133
140
|
LegacyAgentSession,
|
|
134
141
|
Logger,
|
|
142
|
+
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
135
143
|
MCPServerConfig,
|
|
144
|
+
MCPServerStatus,
|
|
145
|
+
MessageBusType,
|
|
146
|
+
OTHER_BLOCKED_MESSAGE,
|
|
147
|
+
OutputFormat,
|
|
136
148
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
137
149
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
138
150
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
139
151
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
140
152
|
PREVIEW_GEMINI_MODEL,
|
|
153
|
+
PolicyDecision,
|
|
141
154
|
PolicyIntegrityManager,
|
|
155
|
+
RECITATION_BLOCKED_MESSAGE,
|
|
142
156
|
REFERENCE_CONTENT_START,
|
|
143
157
|
ROOT_SCHEDULER_ID,
|
|
144
158
|
ReadManyFilesTool,
|
|
159
|
+
SAFETY_BLOCKED_MESSAGE,
|
|
145
160
|
Scheduler,
|
|
161
|
+
SessionEndReason,
|
|
162
|
+
SessionStartSource,
|
|
146
163
|
ShellExecutionService,
|
|
147
164
|
SimpleExtensionLoader,
|
|
148
165
|
Storage,
|
|
149
166
|
StreamJsonFormatter,
|
|
167
|
+
THINKING_ONLY_COMPRESS_SUGGESTION,
|
|
168
|
+
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
150
169
|
ToolCallEvent,
|
|
151
170
|
ToolConfirmationOutcome,
|
|
171
|
+
ToolErrorType,
|
|
172
|
+
TrustLevel,
|
|
152
173
|
UserAccountManager,
|
|
153
174
|
UserPromptEvent,
|
|
154
175
|
ValidationCancelledError,
|
|
155
176
|
ValidationRequiredError,
|
|
177
|
+
WarningPriority,
|
|
156
178
|
applyAdminAllowlist,
|
|
157
179
|
applyRequiredServers,
|
|
158
180
|
clearCachedCredentialFile,
|
|
@@ -231,7 +253,7 @@ import {
|
|
|
231
253
|
updatePolicy,
|
|
232
254
|
writeToStderr,
|
|
233
255
|
writeToStdout
|
|
234
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-3A32ZSG7.js";
|
|
235
257
|
import "./chunk-664ZODQF.js";
|
|
236
258
|
import "./chunk-IUUIT4SU.js";
|
|
237
259
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -5361,7 +5383,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5361
5383
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5362
5384
|
const isStdio = !!config.command;
|
|
5363
5385
|
if (isStdio && !isTrusted) {
|
|
5364
|
-
return
|
|
5386
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5365
5387
|
}
|
|
5366
5388
|
const client = new Client({
|
|
5367
5389
|
name: "mcp-test-client",
|
|
@@ -5397,7 +5419,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5397
5419
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5398
5420
|
} catch {
|
|
5399
5421
|
await client.close();
|
|
5400
|
-
return
|
|
5422
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5401
5423
|
}
|
|
5402
5424
|
try {
|
|
5403
5425
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5411,10 +5433,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5411
5433
|
);
|
|
5412
5434
|
}
|
|
5413
5435
|
await client.close();
|
|
5414
|
-
return
|
|
5436
|
+
return MCPServerStatus.CONNECTED;
|
|
5415
5437
|
} catch {
|
|
5416
5438
|
await transport.close();
|
|
5417
|
-
return
|
|
5439
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5418
5440
|
}
|
|
5419
5441
|
}
|
|
5420
5442
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5427,12 +5449,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5427
5449
|
});
|
|
5428
5450
|
if (!loadResult.allowed) {
|
|
5429
5451
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5430
|
-
return
|
|
5452
|
+
return MCPServerStatus.BLOCKED;
|
|
5431
5453
|
}
|
|
5432
|
-
return
|
|
5454
|
+
return MCPServerStatus.DISABLED;
|
|
5433
5455
|
}
|
|
5434
5456
|
if (!isTrusted) {
|
|
5435
|
-
return
|
|
5457
|
+
return MCPServerStatus.DISABLED;
|
|
5436
5458
|
}
|
|
5437
5459
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5438
5460
|
}
|
|
@@ -5478,23 +5500,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5478
5500
|
let statusIndicator = "";
|
|
5479
5501
|
let statusText = "";
|
|
5480
5502
|
switch (status) {
|
|
5481
|
-
case
|
|
5503
|
+
case MCPServerStatus.CONNECTED:
|
|
5482
5504
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5483
5505
|
statusText = "Connected";
|
|
5484
5506
|
break;
|
|
5485
|
-
case
|
|
5507
|
+
case MCPServerStatus.CONNECTING:
|
|
5486
5508
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5487
5509
|
statusText = "Connecting";
|
|
5488
5510
|
break;
|
|
5489
|
-
case
|
|
5511
|
+
case MCPServerStatus.BLOCKED:
|
|
5490
5512
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5491
5513
|
statusText = "Blocked";
|
|
5492
5514
|
break;
|
|
5493
|
-
case
|
|
5515
|
+
case MCPServerStatus.DISABLED:
|
|
5494
5516
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5495
5517
|
statusText = "Disabled";
|
|
5496
5518
|
break;
|
|
5497
|
-
case
|
|
5519
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5498
5520
|
default:
|
|
5499
5521
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5500
5522
|
statusText = "Disconnected";
|
|
@@ -5780,7 +5802,7 @@ async function handleInstall(args) {
|
|
|
5780
5802
|
);
|
|
5781
5803
|
if (confirmed) {
|
|
5782
5804
|
const trustedFolders = loadTrustedFolders();
|
|
5783
|
-
await trustedFolders.setValue(realPath,
|
|
5805
|
+
await trustedFolders.setValue(realPath, TrustLevel.TRUST_FOLDER);
|
|
5784
5806
|
} else {
|
|
5785
5807
|
throw new Error(
|
|
5786
5808
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7825,7 +7847,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7825
7847
|
}
|
|
7826
7848
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7827
7849
|
const packageJson = await getPackageJson(__dirname3);
|
|
7828
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.53.0
|
|
7850
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.53.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7829
7851
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7830
7852
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7831
7853
|
}
|
|
@@ -7884,9 +7906,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7884
7906
|
cwd,
|
|
7885
7907
|
potentialWorkspacePoliciesDir
|
|
7886
7908
|
);
|
|
7887
|
-
if (integrityResult.status ===
|
|
7909
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7888
7910
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7889
|
-
} else if (integrityResult.status ===
|
|
7911
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7890
7912
|
workspacePoliciesDir = void 0;
|
|
7891
7913
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7892
7914
|
policyUpdateConfirmationRequest = {
|
|
@@ -8314,23 +8336,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8314
8336
|
if (rawApprovalMode) {
|
|
8315
8337
|
switch (rawApprovalMode) {
|
|
8316
8338
|
case "yolo":
|
|
8317
|
-
approvalMode =
|
|
8339
|
+
approvalMode = ApprovalMode.YOLO;
|
|
8318
8340
|
break;
|
|
8319
8341
|
case "auto_edit":
|
|
8320
|
-
approvalMode =
|
|
8342
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
8321
8343
|
break;
|
|
8322
8344
|
case "plan":
|
|
8323
8345
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8324
8346
|
debugLogger.warn(
|
|
8325
8347
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8326
8348
|
);
|
|
8327
|
-
approvalMode =
|
|
8349
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8328
8350
|
} else {
|
|
8329
|
-
approvalMode =
|
|
8351
|
+
approvalMode = ApprovalMode.PLAN;
|
|
8330
8352
|
}
|
|
8331
8353
|
break;
|
|
8332
8354
|
case "default":
|
|
8333
|
-
approvalMode =
|
|
8355
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8334
8356
|
break;
|
|
8335
8357
|
default:
|
|
8336
8358
|
throw new Error(
|
|
@@ -8338,10 +8360,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8338
8360
|
);
|
|
8339
8361
|
}
|
|
8340
8362
|
} else {
|
|
8341
|
-
approvalMode =
|
|
8363
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8342
8364
|
}
|
|
8343
8365
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8344
|
-
if (approvalMode ===
|
|
8366
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
8345
8367
|
if (settings.admin?.secureModeEnabled) {
|
|
8346
8368
|
debugLogger.error(
|
|
8347
8369
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8359,16 +8381,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8359
8381
|
)
|
|
8360
8382
|
);
|
|
8361
8383
|
}
|
|
8362
|
-
} else if (approvalMode ===
|
|
8384
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
8363
8385
|
debugLogger.warn(
|
|
8364
8386
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8365
8387
|
);
|
|
8366
8388
|
}
|
|
8367
|
-
if (!trustedFolder && approvalMode !==
|
|
8389
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
8368
8390
|
debugLogger.warn(
|
|
8369
8391
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8370
8392
|
);
|
|
8371
|
-
approvalMode =
|
|
8393
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
8372
8394
|
}
|
|
8373
8395
|
let telemetrySettings;
|
|
8374
8396
|
try {
|
|
@@ -9806,7 +9828,7 @@ import path9 from "node:path";
|
|
|
9806
9828
|
import process4 from "node:process";
|
|
9807
9829
|
var homeDirectoryCheck = {
|
|
9808
9830
|
id: "home-directory",
|
|
9809
|
-
priority:
|
|
9831
|
+
priority: WarningPriority.Low,
|
|
9810
9832
|
check: async (workspaceRoot, settings) => {
|
|
9811
9833
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9812
9834
|
return null;
|
|
@@ -9830,7 +9852,7 @@ var homeDirectoryCheck = {
|
|
|
9830
9852
|
};
|
|
9831
9853
|
var rootDirectoryCheck = {
|
|
9832
9854
|
id: "root-directory",
|
|
9833
|
-
priority:
|
|
9855
|
+
priority: WarningPriority.High,
|
|
9834
9856
|
check: async (workspaceRoot, _settings) => {
|
|
9835
9857
|
try {
|
|
9836
9858
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9846,7 +9868,7 @@ var rootDirectoryCheck = {
|
|
|
9846
9868
|
};
|
|
9847
9869
|
var folderTrustCheck = {
|
|
9848
9870
|
id: "folder-trust",
|
|
9849
|
-
priority:
|
|
9871
|
+
priority: WarningPriority.High,
|
|
9850
9872
|
check: async (workspaceRoot, settings) => {
|
|
9851
9873
|
if (!isFolderTrustEnabled(settings)) {
|
|
9852
9874
|
return null;
|
|
@@ -10036,12 +10058,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10036
10058
|
error,
|
|
10037
10059
|
config.getContentGeneratorConfig()?.authType
|
|
10038
10060
|
);
|
|
10039
|
-
if (config.getOutputFormat() ===
|
|
10061
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10040
10062
|
const streamFormatter = new StreamJsonFormatter();
|
|
10041
10063
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10042
10064
|
const metrics = uiTelemetryService.getMetrics();
|
|
10043
10065
|
streamFormatter.emitEvent({
|
|
10044
|
-
type:
|
|
10066
|
+
type: JsonStreamEventType.RESULT,
|
|
10045
10067
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10046
10068
|
status: "error",
|
|
10047
10069
|
error: {
|
|
@@ -10052,7 +10074,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10052
10074
|
});
|
|
10053
10075
|
runSyncCleanup();
|
|
10054
10076
|
process.exit(getNumericExitCode(errorCode));
|
|
10055
|
-
} else if (config.getOutputFormat() ===
|
|
10077
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10056
10078
|
const formatter = new JsonFormatter();
|
|
10057
10079
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10058
10080
|
const formattedError = formatter.formatError(
|
|
@@ -10072,11 +10094,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10072
10094
|
const isFatal = isFatalToolError(errorType);
|
|
10073
10095
|
if (isFatal) {
|
|
10074
10096
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10075
|
-
if (config.getOutputFormat() ===
|
|
10097
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10076
10098
|
const streamFormatter = new StreamJsonFormatter();
|
|
10077
10099
|
const metrics = uiTelemetryService.getMetrics();
|
|
10078
10100
|
streamFormatter.emitEvent({
|
|
10079
|
-
type:
|
|
10101
|
+
type: JsonStreamEventType.RESULT,
|
|
10080
10102
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10081
10103
|
status: "error",
|
|
10082
10104
|
error: {
|
|
@@ -10085,7 +10107,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10085
10107
|
},
|
|
10086
10108
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10087
10109
|
});
|
|
10088
|
-
} else if (config.getOutputFormat() ===
|
|
10110
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10089
10111
|
const formatter = new JsonFormatter();
|
|
10090
10112
|
const formattedError = formatter.formatError(
|
|
10091
10113
|
toolExecutionError,
|
|
@@ -10103,11 +10125,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10103
10125
|
}
|
|
10104
10126
|
function handleCancellationError(config) {
|
|
10105
10127
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10106
|
-
if (config.getOutputFormat() ===
|
|
10128
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10107
10129
|
const streamFormatter = new StreamJsonFormatter();
|
|
10108
10130
|
const metrics = uiTelemetryService.getMetrics();
|
|
10109
10131
|
streamFormatter.emitEvent({
|
|
10110
|
-
type:
|
|
10132
|
+
type: JsonStreamEventType.RESULT,
|
|
10111
10133
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10112
10134
|
status: "error",
|
|
10113
10135
|
error: {
|
|
@@ -10118,7 +10140,7 @@ function handleCancellationError(config) {
|
|
|
10118
10140
|
});
|
|
10119
10141
|
runSyncCleanup();
|
|
10120
10142
|
process.exit(cancellationError.exitCode);
|
|
10121
|
-
} else if (config.getOutputFormat() ===
|
|
10143
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10122
10144
|
const formatter = new JsonFormatter();
|
|
10123
10145
|
const formattedError = formatter.formatError(
|
|
10124
10146
|
cancellationError,
|
|
@@ -10138,11 +10160,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10138
10160
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10139
10161
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10140
10162
|
);
|
|
10141
|
-
if (config.getOutputFormat() ===
|
|
10163
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
10142
10164
|
const streamFormatter = new StreamJsonFormatter();
|
|
10143
10165
|
const metrics = uiTelemetryService.getMetrics();
|
|
10144
10166
|
streamFormatter.emitEvent({
|
|
10145
|
-
type:
|
|
10167
|
+
type: JsonStreamEventType.RESULT,
|
|
10146
10168
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10147
10169
|
status: "error",
|
|
10148
10170
|
error: {
|
|
@@ -10153,7 +10175,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10153
10175
|
});
|
|
10154
10176
|
runSyncCleanup();
|
|
10155
10177
|
process.exit(maxTurnsError.exitCode);
|
|
10156
|
-
} else if (config.getOutputFormat() ===
|
|
10178
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10157
10179
|
const formatter = new JsonFormatter();
|
|
10158
10180
|
const formattedError = formatter.formatError(
|
|
10159
10181
|
maxTurnsError,
|
|
@@ -10233,7 +10255,7 @@ async function runNonInteractive({
|
|
|
10233
10255
|
}
|
|
10234
10256
|
});
|
|
10235
10257
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10236
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10258
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-6MCOO7GD.js");
|
|
10237
10259
|
setupInitialActivityLogger(config);
|
|
10238
10260
|
}
|
|
10239
10261
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10249,7 +10271,7 @@ async function runNonInteractive({
|
|
|
10249
10271
|
}
|
|
10250
10272
|
};
|
|
10251
10273
|
const startTime = Date.now();
|
|
10252
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10274
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10253
10275
|
const abortController = new AbortController();
|
|
10254
10276
|
let isAborting = false;
|
|
10255
10277
|
let cancelMessageTimer = null;
|
|
@@ -10302,13 +10324,13 @@ async function runNonInteractive({
|
|
|
10302
10324
|
};
|
|
10303
10325
|
try {
|
|
10304
10326
|
consolePatcher.patch();
|
|
10305
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10327
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10306
10328
|
process.stderr.write(
|
|
10307
10329
|
"[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"
|
|
10308
10330
|
);
|
|
10309
10331
|
}
|
|
10310
10332
|
setupStdinCancellation();
|
|
10311
|
-
coreEvents.on(
|
|
10333
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10312
10334
|
coreEvents.drainBacklogs();
|
|
10313
10335
|
process.stdout.on("error", (err) => {
|
|
10314
10336
|
if (err.code === "EPIPE") {
|
|
@@ -10334,7 +10356,7 @@ async function runNonInteractive({
|
|
|
10334
10356
|
}
|
|
10335
10357
|
if (streamFormatter) {
|
|
10336
10358
|
streamFormatter.emitEvent({
|
|
10337
|
-
type:
|
|
10359
|
+
type: JsonStreamEventType.INIT,
|
|
10338
10360
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10339
10361
|
session_id: config.getSessionId(),
|
|
10340
10362
|
model: config.getModel()
|
|
@@ -10372,7 +10394,7 @@ async function runNonInteractive({
|
|
|
10372
10394
|
}
|
|
10373
10395
|
if (streamFormatter) {
|
|
10374
10396
|
streamFormatter.emitEvent({
|
|
10375
|
-
type:
|
|
10397
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10376
10398
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10377
10399
|
role: "user",
|
|
10378
10400
|
content: input
|
|
@@ -10406,17 +10428,17 @@ async function runNonInteractive({
|
|
|
10406
10428
|
const text = parts?.map((part) => part.type === "text" ? part.text : "").join("");
|
|
10407
10429
|
return text ? text : void 0;
|
|
10408
10430
|
};
|
|
10409
|
-
const
|
|
10431
|
+
const emitFinalResult = (errorPayload) => {
|
|
10410
10432
|
if (streamFormatter) {
|
|
10411
10433
|
const metrics = uiTelemetryService.getMetrics();
|
|
10412
10434
|
const durationMs = Date.now() - startTime;
|
|
10413
10435
|
streamFormatter.emitEvent({
|
|
10414
|
-
type:
|
|
10436
|
+
type: JsonStreamEventType.RESULT,
|
|
10415
10437
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10416
|
-
status: "success",
|
|
10438
|
+
status: errorPayload ? "error" : "success",
|
|
10417
10439
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10418
10440
|
});
|
|
10419
|
-
} else if (config.getOutputFormat() ===
|
|
10441
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10420
10442
|
const formatter = new JsonFormatter();
|
|
10421
10443
|
const stats = uiTelemetryService.getMetrics();
|
|
10422
10444
|
textOutput.write(
|
|
@@ -10424,7 +10446,7 @@ async function runNonInteractive({
|
|
|
10424
10446
|
config.getSessionId(),
|
|
10425
10447
|
responseText,
|
|
10426
10448
|
stats,
|
|
10427
|
-
|
|
10449
|
+
errorPayload,
|
|
10428
10450
|
warnings
|
|
10429
10451
|
)
|
|
10430
10452
|
);
|
|
@@ -10509,13 +10531,13 @@ async function runNonInteractive({
|
|
|
10509
10531
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10510
10532
|
if (streamFormatter) {
|
|
10511
10533
|
streamFormatter.emitEvent({
|
|
10512
|
-
type:
|
|
10534
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10513
10535
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10514
10536
|
role: "assistant",
|
|
10515
10537
|
content: output,
|
|
10516
10538
|
delta: true
|
|
10517
10539
|
});
|
|
10518
|
-
} else if (config.getOutputFormat() ===
|
|
10540
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10519
10541
|
responseText += output;
|
|
10520
10542
|
} else {
|
|
10521
10543
|
if (part.text) {
|
|
@@ -10528,13 +10550,13 @@ async function runNonInteractive({
|
|
|
10528
10550
|
break;
|
|
10529
10551
|
}
|
|
10530
10552
|
case "tool_request": {
|
|
10531
|
-
if (config.getOutputFormat() ===
|
|
10553
|
+
if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10532
10554
|
preToolResponseText = responseText || preToolResponseText;
|
|
10533
10555
|
responseText = "";
|
|
10534
10556
|
}
|
|
10535
10557
|
if (streamFormatter) {
|
|
10536
10558
|
streamFormatter.emitEvent({
|
|
10537
|
-
type:
|
|
10559
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10538
10560
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10539
10561
|
tool_name: event.name,
|
|
10540
10562
|
tool_id: event.requestId,
|
|
@@ -10550,7 +10572,7 @@ async function runNonInteractive({
|
|
|
10550
10572
|
const displayText = displayContentToString(display);
|
|
10551
10573
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10552
10574
|
streamFormatter.emitEvent({
|
|
10553
|
-
type:
|
|
10575
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
10554
10576
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10555
10577
|
tool_id: event.requestId,
|
|
10556
10578
|
status: event.isError ? "error" : "success",
|
|
@@ -10565,17 +10587,17 @@ async function runNonInteractive({
|
|
|
10565
10587
|
const display = event.display?.result;
|
|
10566
10588
|
const displayText = displayContentToString(display);
|
|
10567
10589
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10568
|
-
if (event.data?.["errorType"] ===
|
|
10569
|
-
if (config.getOutputFormat() ===
|
|
10590
|
+
if (event.data?.["errorType"] === ToolErrorType.STOP_EXECUTION) {
|
|
10591
|
+
if (config.getOutputFormat() === OutputFormat.JSON && !responseText && preToolResponseText) {
|
|
10570
10592
|
responseText = preToolResponseText;
|
|
10571
10593
|
}
|
|
10572
10594
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10573
|
-
if (config.getOutputFormat() ===
|
|
10595
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10574
10596
|
process.stderr.write(`${stopMessage}
|
|
10575
10597
|
`);
|
|
10576
10598
|
}
|
|
10577
10599
|
}
|
|
10578
|
-
if (event.data?.["errorType"] ===
|
|
10600
|
+
if (event.data?.["errorType"] === ToolErrorType.NO_SPACE_LEFT) {
|
|
10579
10601
|
throw new FatalToolExecutionError(
|
|
10580
10602
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10581
10603
|
);
|
|
@@ -10591,18 +10613,57 @@ async function runNonInteractive({
|
|
|
10591
10613
|
break;
|
|
10592
10614
|
}
|
|
10593
10615
|
case "error": {
|
|
10616
|
+
if (event._meta?.["code"] === "INVALID_STREAM") {
|
|
10617
|
+
const errorTypeVal = event._meta?.["errorType"];
|
|
10618
|
+
const errorType = typeof errorTypeVal === "string" ? errorTypeVal : void 0;
|
|
10619
|
+
let errorMessage = event.message;
|
|
10620
|
+
if (errorType === "NO_RESPONSE_TEXT") {
|
|
10621
|
+
errorMessage = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
10622
|
+
} else if (errorType === "THINKING_ONLY_RESPONSE") {
|
|
10623
|
+
errorMessage = THINKING_ONLY_COMPRESS_SUGGESTION;
|
|
10624
|
+
} else if (errorType === "MAX_TOKENS_EXCEEDED") {
|
|
10625
|
+
errorMessage = MAX_TOKENS_EXCEEDED_SUGGESTION;
|
|
10626
|
+
} else if (errorType === "SAFETY_BLOCKED") {
|
|
10627
|
+
errorMessage = SAFETY_BLOCKED_MESSAGE;
|
|
10628
|
+
} else if (errorType === "RECITATION_BLOCKED") {
|
|
10629
|
+
errorMessage = RECITATION_BLOCKED_MESSAGE;
|
|
10630
|
+
} else if (errorType === "OTHER_BLOCKED") {
|
|
10631
|
+
errorMessage = OTHER_BLOCKED_MESSAGE;
|
|
10632
|
+
}
|
|
10633
|
+
if (streamFormatter) {
|
|
10634
|
+
streamFormatter.emitEvent({
|
|
10635
|
+
type: JsonStreamEventType.ERROR,
|
|
10636
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10637
|
+
severity: "error",
|
|
10638
|
+
message: errorMessage
|
|
10639
|
+
});
|
|
10640
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10641
|
+
process.stderr.write(`[ERROR] ${errorMessage}
|
|
10642
|
+
`);
|
|
10643
|
+
}
|
|
10644
|
+
uiTelemetryService.recordSemanticValidationError(
|
|
10645
|
+
geminiClient.getCurrentSequenceModel() ?? config.getModel(),
|
|
10646
|
+
errorType || "INVALID_STREAM"
|
|
10647
|
+
);
|
|
10648
|
+
emitFinalResult({
|
|
10649
|
+
type: "INVALID_STREAM",
|
|
10650
|
+
message: errorMessage
|
|
10651
|
+
});
|
|
10652
|
+
streamEnded = true;
|
|
10653
|
+
break;
|
|
10654
|
+
}
|
|
10594
10655
|
if (event.fatal) {
|
|
10595
10656
|
throw reconstructFatalError(event);
|
|
10596
10657
|
}
|
|
10597
10658
|
const errorCode = event._meta?.["code"];
|
|
10598
10659
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10599
10660
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10600
|
-
if (config.getOutputFormat() ===
|
|
10661
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10601
10662
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10602
10663
|
`);
|
|
10603
10664
|
} else if (streamFormatter) {
|
|
10604
10665
|
streamFormatter.emitEvent({
|
|
10605
|
-
type:
|
|
10666
|
+
type: JsonStreamEventType.ERROR,
|
|
10606
10667
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10607
10668
|
severity: "warning",
|
|
10608
10669
|
message: stripAnsi(blockMessage)
|
|
@@ -10612,13 +10673,13 @@ async function runNonInteractive({
|
|
|
10612
10673
|
break;
|
|
10613
10674
|
}
|
|
10614
10675
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10615
|
-
if (config.getOutputFormat() ===
|
|
10676
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10616
10677
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10617
10678
|
`);
|
|
10618
10679
|
}
|
|
10619
10680
|
if (streamFormatter) {
|
|
10620
10681
|
streamFormatter.emitEvent({
|
|
10621
|
-
type:
|
|
10682
|
+
type: JsonStreamEventType.ERROR,
|
|
10622
10683
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10623
10684
|
severity,
|
|
10624
10685
|
message: stripAnsi(event.message)
|
|
@@ -10638,7 +10699,7 @@ async function runNonInteractive({
|
|
|
10638
10699
|
);
|
|
10639
10700
|
} else if (streamFormatter) {
|
|
10640
10701
|
streamFormatter.emitEvent({
|
|
10641
|
-
type:
|
|
10702
|
+
type: JsonStreamEventType.ERROR,
|
|
10642
10703
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10643
10704
|
severity: "error",
|
|
10644
10705
|
message: "Maximum session turns exceeded"
|
|
@@ -10646,11 +10707,11 @@ async function runNonInteractive({
|
|
|
10646
10707
|
}
|
|
10647
10708
|
}
|
|
10648
10709
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10649
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10710
|
+
if (stopMessage && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10650
10711
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10651
10712
|
`);
|
|
10652
10713
|
}
|
|
10653
|
-
|
|
10714
|
+
emitFinalResult();
|
|
10654
10715
|
streamEnded = true;
|
|
10655
10716
|
break;
|
|
10656
10717
|
}
|
|
@@ -10676,7 +10737,7 @@ async function runNonInteractive({
|
|
|
10676
10737
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10677
10738
|
scheduler?.dispose();
|
|
10678
10739
|
consolePatcher.cleanup();
|
|
10679
|
-
coreEvents.off(
|
|
10740
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10680
10741
|
}
|
|
10681
10742
|
if (errorToHandle) {
|
|
10682
10743
|
handleError(errorToHandle, config);
|
|
@@ -10704,7 +10765,7 @@ async function runNonInteractive2(params) {
|
|
|
10704
10765
|
}
|
|
10705
10766
|
});
|
|
10706
10767
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10707
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10768
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-6MCOO7GD.js");
|
|
10708
10769
|
setupInitialActivityLogger(config);
|
|
10709
10770
|
}
|
|
10710
10771
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10720,7 +10781,7 @@ async function runNonInteractive2(params) {
|
|
|
10720
10781
|
}
|
|
10721
10782
|
};
|
|
10722
10783
|
const startTime = Date.now();
|
|
10723
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10784
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
10724
10785
|
const abortController = new AbortController();
|
|
10725
10786
|
let isAborting = false;
|
|
10726
10787
|
let cancelMessageTimer = null;
|
|
@@ -10771,13 +10832,13 @@ async function runNonInteractive2(params) {
|
|
|
10771
10832
|
let scheduler;
|
|
10772
10833
|
try {
|
|
10773
10834
|
consolePatcher.patch();
|
|
10774
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10835
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10775
10836
|
process.stderr.write(
|
|
10776
10837
|
"[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"
|
|
10777
10838
|
);
|
|
10778
10839
|
}
|
|
10779
10840
|
setupStdinCancellation();
|
|
10780
|
-
coreEvents.on(
|
|
10841
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
10781
10842
|
coreEvents.drainBacklogs();
|
|
10782
10843
|
process.stdout.on("error", (err) => {
|
|
10783
10844
|
if (err.code === "EPIPE") {
|
|
@@ -10801,7 +10862,7 @@ async function runNonInteractive2(params) {
|
|
|
10801
10862
|
}
|
|
10802
10863
|
if (streamFormatter) {
|
|
10803
10864
|
streamFormatter.emitEvent({
|
|
10804
|
-
type:
|
|
10865
|
+
type: JsonStreamEventType.INIT,
|
|
10805
10866
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10806
10867
|
session_id: config.getSessionId(),
|
|
10807
10868
|
model: config.getModel()
|
|
@@ -10839,7 +10900,7 @@ async function runNonInteractive2(params) {
|
|
|
10839
10900
|
}
|
|
10840
10901
|
if (streamFormatter) {
|
|
10841
10902
|
streamFormatter.emitEvent({
|
|
10842
|
-
type:
|
|
10903
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10843
10904
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10844
10905
|
role: "user",
|
|
10845
10906
|
content: input
|
|
@@ -10867,28 +10928,28 @@ async function runNonInteractive2(params) {
|
|
|
10867
10928
|
if (abortController.signal.aborted) {
|
|
10868
10929
|
handleCancellationError(config);
|
|
10869
10930
|
}
|
|
10870
|
-
if (event.type ===
|
|
10931
|
+
if (event.type === GeminiEventType.Content) {
|
|
10871
10932
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10872
10933
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10873
10934
|
if (streamFormatter) {
|
|
10874
10935
|
streamFormatter.emitEvent({
|
|
10875
|
-
type:
|
|
10936
|
+
type: JsonStreamEventType.MESSAGE,
|
|
10876
10937
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10877
10938
|
role: "assistant",
|
|
10878
10939
|
content: output,
|
|
10879
10940
|
delta: true
|
|
10880
10941
|
});
|
|
10881
|
-
} else if (config.getOutputFormat() ===
|
|
10942
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10882
10943
|
responseText += output;
|
|
10883
10944
|
} else {
|
|
10884
10945
|
if (event.value) {
|
|
10885
10946
|
textOutput.write(output);
|
|
10886
10947
|
}
|
|
10887
10948
|
}
|
|
10888
|
-
} else if (event.type ===
|
|
10949
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
10889
10950
|
if (streamFormatter) {
|
|
10890
10951
|
streamFormatter.emitEvent({
|
|
10891
|
-
type:
|
|
10952
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
10892
10953
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10893
10954
|
tool_name: event.value.name,
|
|
10894
10955
|
tool_id: event.value.callId,
|
|
@@ -10896,33 +10957,33 @@ async function runNonInteractive2(params) {
|
|
|
10896
10957
|
});
|
|
10897
10958
|
}
|
|
10898
10959
|
toolCallRequests.push(event.value);
|
|
10899
|
-
} else if (event.type ===
|
|
10960
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
10900
10961
|
const message = "Loop detected, stopping execution";
|
|
10901
10962
|
if (streamFormatter) {
|
|
10902
10963
|
streamFormatter.emitEvent({
|
|
10903
|
-
type:
|
|
10964
|
+
type: JsonStreamEventType.ERROR,
|
|
10904
10965
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10905
10966
|
severity: "warning",
|
|
10906
10967
|
message
|
|
10907
10968
|
});
|
|
10908
10969
|
}
|
|
10909
10970
|
warnings.push(message);
|
|
10910
|
-
} else if (event.type ===
|
|
10971
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
10911
10972
|
const message = "Maximum session turns exceeded";
|
|
10912
10973
|
if (streamFormatter) {
|
|
10913
10974
|
streamFormatter.emitEvent({
|
|
10914
|
-
type:
|
|
10975
|
+
type: JsonStreamEventType.ERROR,
|
|
10915
10976
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10916
10977
|
severity: "error",
|
|
10917
10978
|
message
|
|
10918
10979
|
});
|
|
10919
10980
|
}
|
|
10920
10981
|
warnings.push(message);
|
|
10921
|
-
} else if (event.type ===
|
|
10982
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
10922
10983
|
throw event.value.error;
|
|
10923
|
-
} else if (event.type ===
|
|
10984
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
10924
10985
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10925
|
-
if (config.getOutputFormat() ===
|
|
10986
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10926
10987
|
process.stderr.write(`${stopMessage}
|
|
10927
10988
|
`);
|
|
10928
10989
|
}
|
|
@@ -10930,7 +10991,7 @@ async function runNonInteractive2(params) {
|
|
|
10930
10991
|
const metrics = uiTelemetryService.getMetrics();
|
|
10931
10992
|
const durationMs = Date.now() - startTime;
|
|
10932
10993
|
streamFormatter.emitEvent({
|
|
10933
|
-
type:
|
|
10994
|
+
type: JsonStreamEventType.RESULT,
|
|
10934
10995
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10935
10996
|
status: "success",
|
|
10936
10997
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10938,7 +10999,7 @@ async function runNonInteractive2(params) {
|
|
|
10938
10999
|
durationMs
|
|
10939
11000
|
)
|
|
10940
11001
|
});
|
|
10941
|
-
} else if (config.getOutputFormat() ===
|
|
11002
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10942
11003
|
const formatter = new JsonFormatter();
|
|
10943
11004
|
const stats = uiTelemetryService.getMetrics();
|
|
10944
11005
|
textOutput.write(
|
|
@@ -10954,30 +11015,49 @@ async function runNonInteractive2(params) {
|
|
|
10954
11015
|
textOutput.ensureTrailingNewline();
|
|
10955
11016
|
}
|
|
10956
11017
|
return;
|
|
10957
|
-
} else if (event.type ===
|
|
11018
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
10958
11019
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10959
|
-
if (config.getOutputFormat() ===
|
|
11020
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10960
11021
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10961
11022
|
`);
|
|
10962
11023
|
} else if (streamFormatter) {
|
|
10963
11024
|
streamFormatter.emitEvent({
|
|
10964
|
-
type:
|
|
11025
|
+
type: JsonStreamEventType.ERROR,
|
|
10965
11026
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10966
11027
|
severity: "warning",
|
|
10967
11028
|
message: stripAnsi(blockMessage)
|
|
10968
11029
|
});
|
|
10969
11030
|
}
|
|
10970
11031
|
warnings.push(blockMessage);
|
|
10971
|
-
} else if (event.type ===
|
|
10972
|
-
|
|
11032
|
+
} else if (event.type === GeminiEventType.InvalidStream) {
|
|
11033
|
+
const eventValue = event.value;
|
|
11034
|
+
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
11035
|
+
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
11036
|
+
} else if (eventValue?.type === "THINKING_ONLY_RESPONSE") {
|
|
11037
|
+
invalidStreamError = THINKING_ONLY_COMPRESS_SUGGESTION;
|
|
11038
|
+
} else if (eventValue?.type === "MAX_TOKENS_EXCEEDED") {
|
|
11039
|
+
invalidStreamError = MAX_TOKENS_EXCEEDED_SUGGESTION;
|
|
11040
|
+
} else if (eventValue?.type === "SAFETY_BLOCKED") {
|
|
11041
|
+
invalidStreamError = SAFETY_BLOCKED_MESSAGE;
|
|
11042
|
+
} else if (eventValue?.type === "RECITATION_BLOCKED") {
|
|
11043
|
+
invalidStreamError = RECITATION_BLOCKED_MESSAGE;
|
|
11044
|
+
} else if (eventValue?.type === "OTHER_BLOCKED") {
|
|
11045
|
+
invalidStreamError = OTHER_BLOCKED_MESSAGE;
|
|
11046
|
+
} else {
|
|
11047
|
+
invalidStreamError = eventValue?.message?.trim() || "Invalid stream: The model returned an empty response or malformed tool call.";
|
|
11048
|
+
}
|
|
11049
|
+
uiTelemetryService.recordSemanticValidationError(
|
|
11050
|
+
geminiClient.getCurrentSequenceModel() ?? config.getModel(),
|
|
11051
|
+
eventValue?.type || "INVALID_STREAM"
|
|
11052
|
+
);
|
|
10973
11053
|
if (streamFormatter) {
|
|
10974
11054
|
streamFormatter.emitEvent({
|
|
10975
|
-
type:
|
|
11055
|
+
type: JsonStreamEventType.ERROR,
|
|
10976
11056
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10977
11057
|
severity: "error",
|
|
10978
11058
|
message: invalidStreamError
|
|
10979
11059
|
});
|
|
10980
|
-
} else if (config.getOutputFormat() ===
|
|
11060
|
+
} else if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
10981
11061
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
10982
11062
|
`);
|
|
10983
11063
|
}
|
|
@@ -10997,7 +11077,7 @@ async function runNonInteractive2(params) {
|
|
|
10997
11077
|
const requestInfo = completedToolCall.request;
|
|
10998
11078
|
if (streamFormatter) {
|
|
10999
11079
|
streamFormatter.emitEvent({
|
|
11000
|
-
type:
|
|
11080
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
11001
11081
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11002
11082
|
tool_id: requestInfo.callId,
|
|
11003
11083
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11031,11 +11111,11 @@ async function runNonInteractive2(params) {
|
|
|
11031
11111
|
);
|
|
11032
11112
|
}
|
|
11033
11113
|
const stopExecutionTool = completedToolCalls.find(
|
|
11034
|
-
(tc) => tc.response.errorType ===
|
|
11114
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
11035
11115
|
);
|
|
11036
11116
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11037
11117
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11038
|
-
if (config.getOutputFormat() ===
|
|
11118
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
11039
11119
|
process.stderr.write(`${stopMessage}
|
|
11040
11120
|
`);
|
|
11041
11121
|
}
|
|
@@ -11043,7 +11123,7 @@ async function runNonInteractive2(params) {
|
|
|
11043
11123
|
const metrics = uiTelemetryService.getMetrics();
|
|
11044
11124
|
const durationMs = Date.now() - startTime;
|
|
11045
11125
|
streamFormatter.emitEvent({
|
|
11046
|
-
type:
|
|
11126
|
+
type: JsonStreamEventType.RESULT,
|
|
11047
11127
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11048
11128
|
status: "success",
|
|
11049
11129
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11051,7 +11131,7 @@ async function runNonInteractive2(params) {
|
|
|
11051
11131
|
durationMs
|
|
11052
11132
|
)
|
|
11053
11133
|
});
|
|
11054
|
-
} else if (config.getOutputFormat() ===
|
|
11134
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11055
11135
|
const formatter = new JsonFormatter();
|
|
11056
11136
|
const stats = uiTelemetryService.getMetrics();
|
|
11057
11137
|
textOutput.write(
|
|
@@ -11074,12 +11154,12 @@ async function runNonInteractive2(params) {
|
|
|
11074
11154
|
const metrics = uiTelemetryService.getMetrics();
|
|
11075
11155
|
const durationMs = Date.now() - startTime;
|
|
11076
11156
|
streamFormatter.emitEvent({
|
|
11077
|
-
type:
|
|
11157
|
+
type: JsonStreamEventType.RESULT,
|
|
11078
11158
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11079
11159
|
status: invalidStreamError ? "error" : "success",
|
|
11080
11160
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11081
11161
|
});
|
|
11082
|
-
} else if (config.getOutputFormat() ===
|
|
11162
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
11083
11163
|
const formatter = new JsonFormatter();
|
|
11084
11164
|
const stats = uiTelemetryService.getMetrics();
|
|
11085
11165
|
textOutput.write(
|
|
@@ -11103,7 +11183,7 @@ async function runNonInteractive2(params) {
|
|
|
11103
11183
|
cleanupStdinCancellation();
|
|
11104
11184
|
scheduler?.dispose();
|
|
11105
11185
|
consolePatcher.cleanup();
|
|
11106
|
-
coreEvents.off(
|
|
11186
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
11107
11187
|
}
|
|
11108
11188
|
if (errorToHandle) {
|
|
11109
11189
|
handleError(errorToHandle, config);
|
|
@@ -13494,12 +13574,12 @@ function toToolCallContent(toolResult) {
|
|
|
13494
13574
|
}
|
|
13495
13575
|
var basicPermissionOptions = [
|
|
13496
13576
|
{
|
|
13497
|
-
optionId:
|
|
13577
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
13498
13578
|
name: "Allow",
|
|
13499
13579
|
kind: "allow_once"
|
|
13500
13580
|
},
|
|
13501
13581
|
{
|
|
13502
|
-
optionId:
|
|
13582
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
13503
13583
|
name: "Reject",
|
|
13504
13584
|
kind: "reject_once"
|
|
13505
13585
|
}
|
|
@@ -13511,13 +13591,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13511
13591
|
switch (confirmation.type) {
|
|
13512
13592
|
case "edit":
|
|
13513
13593
|
options.push({
|
|
13514
|
-
optionId:
|
|
13594
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13515
13595
|
name: "Allow for this session",
|
|
13516
13596
|
kind: "allow_always"
|
|
13517
13597
|
});
|
|
13518
13598
|
if (enablePermanentToolApproval) {
|
|
13519
13599
|
options.push({
|
|
13520
|
-
optionId:
|
|
13600
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13521
13601
|
name: "Allow for this file in all future sessions",
|
|
13522
13602
|
kind: "allow_always"
|
|
13523
13603
|
});
|
|
@@ -13525,13 +13605,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13525
13605
|
break;
|
|
13526
13606
|
case "exec":
|
|
13527
13607
|
options.push({
|
|
13528
|
-
optionId:
|
|
13608
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13529
13609
|
name: "Allow for this session",
|
|
13530
13610
|
kind: "allow_always"
|
|
13531
13611
|
});
|
|
13532
13612
|
if (enablePermanentToolApproval) {
|
|
13533
13613
|
options.push({
|
|
13534
|
-
optionId:
|
|
13614
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13535
13615
|
name: "Allow this command for all future sessions",
|
|
13536
13616
|
kind: "allow_always"
|
|
13537
13617
|
});
|
|
@@ -13540,19 +13620,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13540
13620
|
case "mcp":
|
|
13541
13621
|
options.push(
|
|
13542
13622
|
{
|
|
13543
|
-
optionId:
|
|
13623
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
13544
13624
|
name: "Allow all server tools for this session",
|
|
13545
13625
|
kind: "allow_always"
|
|
13546
13626
|
},
|
|
13547
13627
|
{
|
|
13548
|
-
optionId:
|
|
13628
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
13549
13629
|
name: "Allow tool for this session",
|
|
13550
13630
|
kind: "allow_always"
|
|
13551
13631
|
}
|
|
13552
13632
|
);
|
|
13553
13633
|
if (enablePermanentToolApproval) {
|
|
13554
13634
|
options.push({
|
|
13555
|
-
optionId:
|
|
13635
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13556
13636
|
name: "Allow tool for all future sessions",
|
|
13557
13637
|
kind: "allow_always"
|
|
13558
13638
|
});
|
|
@@ -13560,13 +13640,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13560
13640
|
break;
|
|
13561
13641
|
case "info":
|
|
13562
13642
|
options.push({
|
|
13563
|
-
optionId:
|
|
13643
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13564
13644
|
name: "Allow for this session",
|
|
13565
13645
|
kind: "allow_always"
|
|
13566
13646
|
});
|
|
13567
13647
|
if (enablePermanentToolApproval) {
|
|
13568
13648
|
options.push({
|
|
13569
|
-
optionId:
|
|
13649
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysAndSave,
|
|
13570
13650
|
name: "Allow for all future sessions",
|
|
13571
13651
|
kind: "allow_always"
|
|
13572
13652
|
});
|
|
@@ -13598,21 +13678,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13598
13678
|
}
|
|
13599
13679
|
function toAcpToolKind(kind) {
|
|
13600
13680
|
switch (kind) {
|
|
13601
|
-
case
|
|
13602
|
-
case
|
|
13603
|
-
case
|
|
13604
|
-
case
|
|
13605
|
-
case
|
|
13606
|
-
case
|
|
13607
|
-
case
|
|
13608
|
-
case
|
|
13609
|
-
case
|
|
13610
|
-
case
|
|
13681
|
+
case Kind.Read:
|
|
13682
|
+
case Kind.Edit:
|
|
13683
|
+
case Kind.Execute:
|
|
13684
|
+
case Kind.Search:
|
|
13685
|
+
case Kind.Delete:
|
|
13686
|
+
case Kind.Move:
|
|
13687
|
+
case Kind.Think:
|
|
13688
|
+
case Kind.Fetch:
|
|
13689
|
+
case Kind.SwitchMode:
|
|
13690
|
+
case Kind.Other:
|
|
13611
13691
|
return kind;
|
|
13612
|
-
case
|
|
13692
|
+
case Kind.Agent:
|
|
13613
13693
|
return "think";
|
|
13614
|
-
case
|
|
13615
|
-
case
|
|
13694
|
+
case Kind.Plan:
|
|
13695
|
+
case Kind.Communicate:
|
|
13616
13696
|
default:
|
|
13617
13697
|
return "other";
|
|
13618
13698
|
}
|
|
@@ -13620,24 +13700,24 @@ function toAcpToolKind(kind) {
|
|
|
13620
13700
|
function buildAvailableModes(isPlanEnabled) {
|
|
13621
13701
|
const modes = [
|
|
13622
13702
|
{
|
|
13623
|
-
id:
|
|
13703
|
+
id: ApprovalMode.DEFAULT,
|
|
13624
13704
|
name: "Default",
|
|
13625
13705
|
description: "Prompts for approval"
|
|
13626
13706
|
},
|
|
13627
13707
|
{
|
|
13628
|
-
id:
|
|
13708
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
13629
13709
|
name: "Auto Edit",
|
|
13630
13710
|
description: "Auto-approves edit tools"
|
|
13631
13711
|
},
|
|
13632
13712
|
{
|
|
13633
|
-
id:
|
|
13713
|
+
id: ApprovalMode.YOLO,
|
|
13634
13714
|
name: "YOLO",
|
|
13635
13715
|
description: "Auto-approves all tools"
|
|
13636
13716
|
}
|
|
13637
13717
|
];
|
|
13638
13718
|
if (isPlanEnabled) {
|
|
13639
13719
|
modes.push({
|
|
13640
|
-
id:
|
|
13720
|
+
id: ApprovalMode.PLAN,
|
|
13641
13721
|
name: "Plan",
|
|
13642
13722
|
description: "Read-only mode"
|
|
13643
13723
|
});
|
|
@@ -13650,7 +13730,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13650
13730
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13651
13731
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
13652
13732
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13653
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13733
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
13654
13734
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13655
13735
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13656
13736
|
useGemini3_1: useGemini31,
|
|
@@ -13736,11 +13816,11 @@ var Session = class {
|
|
|
13736
13816
|
this.connection = connection;
|
|
13737
13817
|
this.settings = settings;
|
|
13738
13818
|
coreEvents.on(
|
|
13739
|
-
|
|
13819
|
+
CoreEvent.ApprovalModeChanged,
|
|
13740
13820
|
this.handleApprovalModeChanged
|
|
13741
13821
|
);
|
|
13742
13822
|
this.context.config.getMessageBus()?.subscribe(
|
|
13743
|
-
|
|
13823
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
13744
13824
|
this.handleToolConfirmationRequest,
|
|
13745
13825
|
{ signal: this.disposeController.signal }
|
|
13746
13826
|
);
|
|
@@ -13764,7 +13844,7 @@ var Session = class {
|
|
|
13764
13844
|
"Policy engine missing. Denying tool confirmation request."
|
|
13765
13845
|
);
|
|
13766
13846
|
await messageBus.publish({
|
|
13767
|
-
type:
|
|
13847
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13768
13848
|
correlationId: request.correlationId,
|
|
13769
13849
|
confirmed: false,
|
|
13770
13850
|
requiresUserConfirmation: false
|
|
@@ -13777,7 +13857,7 @@ var Session = class {
|
|
|
13777
13857
|
"Tool confirmation request missing tool name. Denying."
|
|
13778
13858
|
);
|
|
13779
13859
|
await messageBus.publish({
|
|
13780
|
-
type:
|
|
13860
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13781
13861
|
correlationId: request.correlationId,
|
|
13782
13862
|
confirmed: false,
|
|
13783
13863
|
requiresUserConfirmation: false
|
|
@@ -13790,7 +13870,7 @@ var Session = class {
|
|
|
13790
13870
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
13791
13871
|
);
|
|
13792
13872
|
await messageBus.publish({
|
|
13793
|
-
type:
|
|
13873
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13794
13874
|
correlationId: request.correlationId,
|
|
13795
13875
|
confirmed: false,
|
|
13796
13876
|
requiresUserConfirmation: false
|
|
@@ -13806,15 +13886,15 @@ var Session = class {
|
|
|
13806
13886
|
request.subagent
|
|
13807
13887
|
);
|
|
13808
13888
|
await messageBus.publish({
|
|
13809
|
-
type:
|
|
13889
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13810
13890
|
correlationId: request.correlationId,
|
|
13811
|
-
confirmed: result.decision ===
|
|
13812
|
-
requiresUserConfirmation: result.decision ===
|
|
13891
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
13892
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
13813
13893
|
});
|
|
13814
13894
|
} catch (error) {
|
|
13815
13895
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
13816
13896
|
await this.context.config.getMessageBus()?.publish({
|
|
13817
|
-
type:
|
|
13897
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13818
13898
|
correlationId: request.correlationId,
|
|
13819
13899
|
confirmed: false,
|
|
13820
13900
|
requiresUserConfirmation: false
|
|
@@ -13834,7 +13914,7 @@ var Session = class {
|
|
|
13834
13914
|
};
|
|
13835
13915
|
dispose() {
|
|
13836
13916
|
coreEvents.off(
|
|
13837
|
-
|
|
13917
|
+
CoreEvent.ApprovalModeChanged,
|
|
13838
13918
|
this.handleApprovalModeChanged
|
|
13839
13919
|
);
|
|
13840
13920
|
this.disposeController.abort();
|
|
@@ -13923,7 +14003,7 @@ ${thought.description}`;
|
|
|
13923
14003
|
await this.sendUpdate({
|
|
13924
14004
|
sessionUpdate: "tool_call",
|
|
13925
14005
|
toolCallId: toolCall.id,
|
|
13926
|
-
status: toolCall.status ===
|
|
14006
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
13927
14007
|
title: toolCall.displayName || toolCall.name,
|
|
13928
14008
|
content: toolCallContent,
|
|
13929
14009
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14015,7 +14095,7 @@ ${thought.description}`;
|
|
|
14015
14095
|
return { stopReason: "cancelled" };
|
|
14016
14096
|
}
|
|
14017
14097
|
switch (event.type) {
|
|
14018
|
-
case
|
|
14098
|
+
case GeminiEventType.Content: {
|
|
14019
14099
|
const content = {
|
|
14020
14100
|
type: "text",
|
|
14021
14101
|
text: event.value
|
|
@@ -14026,7 +14106,7 @@ ${thought.description}`;
|
|
|
14026
14106
|
});
|
|
14027
14107
|
break;
|
|
14028
14108
|
}
|
|
14029
|
-
case
|
|
14109
|
+
case GeminiEventType.Thought: {
|
|
14030
14110
|
const thoughtText = `**${event.value.subject}**
|
|
14031
14111
|
${event.value.description}`;
|
|
14032
14112
|
await this.sendUpdate({
|
|
@@ -14035,10 +14115,10 @@ ${event.value.description}`;
|
|
|
14035
14115
|
});
|
|
14036
14116
|
break;
|
|
14037
14117
|
}
|
|
14038
|
-
case
|
|
14118
|
+
case GeminiEventType.ToolCallRequest:
|
|
14039
14119
|
toolCallRequests.push(event.value);
|
|
14040
14120
|
break;
|
|
14041
|
-
case
|
|
14121
|
+
case GeminiEventType.Finished: {
|
|
14042
14122
|
const usage2 = event.value.usageMetadata;
|
|
14043
14123
|
if (usage2) {
|
|
14044
14124
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14046,19 +14126,19 @@ ${event.value.description}`;
|
|
|
14046
14126
|
}
|
|
14047
14127
|
break;
|
|
14048
14128
|
}
|
|
14049
|
-
case
|
|
14129
|
+
case GeminiEventType.ModelInfo:
|
|
14050
14130
|
turnModelId = event.value;
|
|
14051
14131
|
break;
|
|
14052
|
-
case
|
|
14132
|
+
case GeminiEventType.MaxSessionTurns:
|
|
14053
14133
|
stopReason = "max_turn_requests";
|
|
14054
14134
|
break;
|
|
14055
|
-
case
|
|
14135
|
+
case GeminiEventType.LoopDetected:
|
|
14056
14136
|
stopReason = "max_turn_requests";
|
|
14057
14137
|
break;
|
|
14058
|
-
case
|
|
14138
|
+
case GeminiEventType.ContextWindowWillOverflow:
|
|
14059
14139
|
stopReason = "max_tokens";
|
|
14060
14140
|
break;
|
|
14061
|
-
case
|
|
14141
|
+
case GeminiEventType.Error: {
|
|
14062
14142
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14063
14143
|
event.value.error
|
|
14064
14144
|
);
|
|
@@ -14085,7 +14165,7 @@ ${event.value.description}`;
|
|
|
14085
14165
|
if (error instanceof RequestError) {
|
|
14086
14166
|
throw error;
|
|
14087
14167
|
}
|
|
14088
|
-
if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL")) {
|
|
14168
|
+
if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL" || error.type === "MAX_TOKENS_EXCEEDED" || error.type === "SAFETY_BLOCKED" || error.type === "RECITATION_BLOCKED" || error.type === "OTHER_BLOCKED" || error.type === "THINKING_ONLY_RESPONSE")) {
|
|
14089
14169
|
return {
|
|
14090
14170
|
stopReason: "end_turn",
|
|
14091
14171
|
_meta: {
|
|
@@ -14286,7 +14366,7 @@ ${event.value.description}`;
|
|
|
14286
14366
|
const output = RequestPermissionResponseSchema.parse(
|
|
14287
14367
|
await this.connection.requestPermission(params)
|
|
14288
14368
|
);
|
|
14289
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14369
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14290
14370
|
await confirmationDetails.onConfirm(outcome);
|
|
14291
14371
|
await updatePolicy(
|
|
14292
14372
|
tool,
|
|
@@ -14297,16 +14377,16 @@ ${event.value.description}`;
|
|
|
14297
14377
|
invocation
|
|
14298
14378
|
);
|
|
14299
14379
|
switch (outcome) {
|
|
14300
|
-
case
|
|
14380
|
+
case ToolConfirmationOutcome.Cancel:
|
|
14301
14381
|
return errorResponse(
|
|
14302
14382
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14303
14383
|
);
|
|
14304
|
-
case
|
|
14305
|
-
case
|
|
14306
|
-
case
|
|
14307
|
-
case
|
|
14308
|
-
case
|
|
14309
|
-
case
|
|
14384
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
14385
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
14386
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
14387
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
14388
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
14389
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
14310
14390
|
break;
|
|
14311
14391
|
default: {
|
|
14312
14392
|
const resultOutcome = outcome;
|
|
@@ -14360,7 +14440,7 @@ ${event.value.description}`;
|
|
|
14360
14440
|
);
|
|
14361
14441
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14362
14442
|
{
|
|
14363
|
-
status:
|
|
14443
|
+
status: CoreToolCallStatus.Success,
|
|
14364
14444
|
request: {
|
|
14365
14445
|
callId,
|
|
14366
14446
|
name: fc.name,
|
|
@@ -14405,7 +14485,7 @@ ${event.value.description}`;
|
|
|
14405
14485
|
});
|
|
14406
14486
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14407
14487
|
{
|
|
14408
|
-
status:
|
|
14488
|
+
status: CoreToolCallStatus.Error,
|
|
14409
14489
|
request: {
|
|
14410
14490
|
callId,
|
|
14411
14491
|
name: fc.name,
|
|
@@ -14533,12 +14613,12 @@ ${event.value.description}`;
|
|
|
14533
14613
|
sessionId: this.id,
|
|
14534
14614
|
options: [
|
|
14535
14615
|
{
|
|
14536
|
-
optionId:
|
|
14616
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14537
14617
|
name: "Allow once",
|
|
14538
14618
|
kind: "allow_once"
|
|
14539
14619
|
},
|
|
14540
14620
|
{
|
|
14541
|
-
optionId:
|
|
14621
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14542
14622
|
name: "Deny",
|
|
14543
14623
|
kind: "reject_once"
|
|
14544
14624
|
}
|
|
@@ -14563,8 +14643,8 @@ ${event.value.description}`;
|
|
|
14563
14643
|
const output = RequestPermissionResponseSchema.parse(
|
|
14564
14644
|
await this.connection.requestPermission(params)
|
|
14565
14645
|
);
|
|
14566
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14567
|
-
if (outcome ===
|
|
14646
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14647
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14568
14648
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14569
14649
|
validationError = null;
|
|
14570
14650
|
} else {
|
|
@@ -15001,7 +15081,7 @@ var AcpSessionManager = class {
|
|
|
15001
15081
|
mcpServers,
|
|
15002
15082
|
loadedSettings
|
|
15003
15083
|
);
|
|
15004
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15084
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
15005
15085
|
let isAuthenticated = false;
|
|
15006
15086
|
let authErrorMessage = "";
|
|
15007
15087
|
try {
|
|
@@ -15013,7 +15093,7 @@ var AcpSessionManager = class {
|
|
|
15013
15093
|
);
|
|
15014
15094
|
isAuthenticated = true;
|
|
15015
15095
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15016
|
-
if (authType ===
|
|
15096
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15017
15097
|
isAuthenticated = false;
|
|
15018
15098
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15019
15099
|
}
|
|
@@ -15122,7 +15202,7 @@ var AcpSessionManager = class {
|
|
|
15122
15202
|
return response;
|
|
15123
15203
|
}
|
|
15124
15204
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15125
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15205
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
15126
15206
|
if (!selectedAuthType) {
|
|
15127
15207
|
throw RequestError.authRequired();
|
|
15128
15208
|
}
|
|
@@ -15223,12 +15303,12 @@ var GeminiAgent = class {
|
|
|
15223
15303
|
}
|
|
15224
15304
|
const authMethods = [
|
|
15225
15305
|
{
|
|
15226
|
-
id:
|
|
15306
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
15227
15307
|
name: "Log in with Google",
|
|
15228
15308
|
description: "Log in with your Google account"
|
|
15229
15309
|
},
|
|
15230
15310
|
{
|
|
15231
|
-
id:
|
|
15311
|
+
id: AuthType.USE_GEMINI,
|
|
15232
15312
|
name: "Gemini API key",
|
|
15233
15313
|
description: "Use an API key with Gemini Developer API",
|
|
15234
15314
|
_meta: {
|
|
@@ -15238,12 +15318,12 @@ var GeminiAgent = class {
|
|
|
15238
15318
|
}
|
|
15239
15319
|
},
|
|
15240
15320
|
{
|
|
15241
|
-
id:
|
|
15321
|
+
id: AuthType.USE_VERTEX_AI,
|
|
15242
15322
|
name: "Vertex AI",
|
|
15243
15323
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15244
15324
|
},
|
|
15245
15325
|
{
|
|
15246
|
-
id:
|
|
15326
|
+
id: AuthType.GATEWAY,
|
|
15247
15327
|
name: "AI API Gateway",
|
|
15248
15328
|
description: "Use a custom AI API Gateway",
|
|
15249
15329
|
_meta: {
|
|
@@ -15416,7 +15496,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15416
15496
|
}
|
|
15417
15497
|
return authType;
|
|
15418
15498
|
} catch (error) {
|
|
15419
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15499
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
15420
15500
|
handleError(
|
|
15421
15501
|
error instanceof Error ? error : new Error(String(error)),
|
|
15422
15502
|
nonInteractiveConfig,
|
|
@@ -15611,10 +15691,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15611
15691
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15612
15692
|
}
|
|
15613
15693
|
start() {
|
|
15614
|
-
coreEvents.on(
|
|
15694
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15615
15695
|
}
|
|
15616
15696
|
stop() {
|
|
15617
|
-
coreEvents.off(
|
|
15697
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
15618
15698
|
if (this.flushTimeout) {
|
|
15619
15699
|
clearTimeout(this.flushTimeout);
|
|
15620
15700
|
this.flushTimeout = null;
|
|
@@ -15895,7 +15975,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15895
15975
|
}
|
|
15896
15976
|
}
|
|
15897
15977
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15898
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15978
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-UQQGETBL.js");
|
|
15899
15979
|
await doStartUI(
|
|
15900
15980
|
config,
|
|
15901
15981
|
settings,
|
|
@@ -15998,12 +16078,12 @@ async function main() {
|
|
|
15998
16078
|
dns.setDefaultResultOrder(
|
|
15999
16079
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16000
16080
|
);
|
|
16001
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16081
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
16002
16082
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16003
16083
|
settings.setValue(
|
|
16004
16084
|
"User" /* User */,
|
|
16005
16085
|
"security.auth.selectedType",
|
|
16006
|
-
|
|
16086
|
+
AuthType.COMPUTE_ADC
|
|
16007
16087
|
);
|
|
16008
16088
|
}
|
|
16009
16089
|
}
|
|
@@ -16104,7 +16184,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16104
16184
|
await config.storage.initialize();
|
|
16105
16185
|
adminControlsListner.setConfig(config);
|
|
16106
16186
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16107
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16187
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-6MCOO7GD.js");
|
|
16108
16188
|
setupInitialActivityLogger(config);
|
|
16109
16189
|
}
|
|
16110
16190
|
registerTelemetryConfig(config);
|
|
@@ -16112,7 +16192,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16112
16192
|
const messageBus = config.getMessageBus();
|
|
16113
16193
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16114
16194
|
registerCleanup(async () => {
|
|
16115
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
16195
|
+
await config?.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
16116
16196
|
});
|
|
16117
16197
|
if (!config.getAcpMode()) {
|
|
16118
16198
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16163,7 +16243,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16163
16243
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16164
16244
|
const initializationResult = await initializeApp(config, settings);
|
|
16165
16245
|
initAppHandle?.end();
|
|
16166
|
-
import("./liteRtServerManager-
|
|
16246
|
+
import("./liteRtServerManager-YXO26SKL.js").then(({ LiteRtServerManager }) => {
|
|
16167
16247
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16168
16248
|
if (!mergedGemma) return;
|
|
16169
16249
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16173,7 +16253,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16173
16253
|
autoStartServer: userGemma?.autoStartServer
|
|
16174
16254
|
});
|
|
16175
16255
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16176
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16256
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
16177
16257
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16178
16258
|
}
|
|
16179
16259
|
if (config.getAcpMode()) {
|
|
@@ -16189,7 +16269,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16189
16269
|
...rawStartupWarnings.map((message) => ({
|
|
16190
16270
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16191
16271
|
message,
|
|
16192
|
-
priority:
|
|
16272
|
+
priority: WarningPriority.High
|
|
16193
16273
|
})),
|
|
16194
16274
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16195
16275
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16226,7 +16306,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16226
16306
|
${input}` : stdinData;
|
|
16227
16307
|
}
|
|
16228
16308
|
}
|
|
16229
|
-
const sessionStartSource = resumedSessionData ?
|
|
16309
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
16230
16310
|
const hookSystem = config?.getHookSystem();
|
|
16231
16311
|
if (hookSystem) {
|
|
16232
16312
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16283,8 +16363,8 @@ ${input}` : wrappedContext;
|
|
|
16283
16363
|
}
|
|
16284
16364
|
}
|
|
16285
16365
|
function initializeOutputListenersAndFlush(config) {
|
|
16286
|
-
if (coreEvents.listenerCount(
|
|
16287
|
-
coreEvents.on(
|
|
16366
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
16367
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
16288
16368
|
if (payload.isStderr) {
|
|
16289
16369
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16290
16370
|
} else {
|
|
@@ -16292,8 +16372,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16292
16372
|
}
|
|
16293
16373
|
});
|
|
16294
16374
|
}
|
|
16295
|
-
if (coreEvents.listenerCount(
|
|
16296
|
-
coreEvents.on(
|
|
16375
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
16376
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
16297
16377
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16298
16378
|
writeToStderr(payload.content + "\n");
|
|
16299
16379
|
} else {
|
|
@@ -16301,8 +16381,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16301
16381
|
}
|
|
16302
16382
|
});
|
|
16303
16383
|
}
|
|
16304
|
-
if (coreEvents.listenerCount(
|
|
16305
|
-
coreEvents.on(
|
|
16384
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
16385
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
16306
16386
|
writeToStderr(payload.message + "\n");
|
|
16307
16387
|
});
|
|
16308
16388
|
}
|
|
@@ -16310,7 +16390,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16310
16390
|
const forceToStderr = outputFormat === "json";
|
|
16311
16391
|
coreEvents.drainBacklogs(
|
|
16312
16392
|
(event, args) => {
|
|
16313
|
-
if (forceToStderr && event ===
|
|
16393
|
+
if (forceToStderr && event === CoreEvent.Output) {
|
|
16314
16394
|
const payload = args[0];
|
|
16315
16395
|
if (!payload.isStderr) {
|
|
16316
16396
|
return {
|