@google/gemini-cli 0.59.0-nightly.20260902.g4963a4456 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/{chunk-Q5JIA6GT.js → chunk-5MBZBBH2.js} +1 -1
- package/bundle/{chunk-HLKUJQDM.js → chunk-AB5FS4AA.js} +3 -3
- package/bundle/{chunk-T7ZX2IIA.js → chunk-CFD5V7JP.js} +1 -1
- package/bundle/{chunk-CPY5OHHN.js → chunk-CUTHWG3H.js} +8 -8
- package/bundle/{chunk-KWV4AQUZ.js → chunk-EXIGMSNQ.js} +8 -8
- package/bundle/{chunk-C6ZWHKCF.js → chunk-EZCKZ4FP.js} +8 -9
- package/bundle/{chunk-UEJPTQC6.js → chunk-HWQPEGPU.js} +3 -3
- package/bundle/{chunk-IA7Q3KXH.js → chunk-LZ4UWPZ4.js} +1 -1
- package/bundle/{chunk-IJEAUNNQ.js → chunk-MBUPFP25.js} +1 -1
- package/bundle/{chunk-IWRJCZ6U.js → chunk-NBDWOAFH.js} +1 -1
- package/bundle/{chunk-NMQMMCVT.js → chunk-NNFB47JH.js} +1 -1
- package/bundle/{chunk-GSIUURFM.js → chunk-NWWZRJGH.js} +1 -1
- package/bundle/{chunk-JHQHEMVA.js → chunk-O4TDK2BP.js} +2 -2
- package/bundle/{chunk-3VZPRWHY.js → chunk-OXQLGDKV.js} +1 -1
- package/bundle/{chunk-KKCOXPHQ.js → chunk-PC2G646B.js} +5 -8
- package/bundle/{chunk-TZIBDTO2.js → chunk-QEMQJ5WC.js} +55 -68
- package/bundle/{chunk-V6Z4ITCV.js → chunk-QTWDMFI7.js} +2 -2
- package/bundle/{chunk-YUQC6NAA.js → chunk-RSFMNCZQ.js} +3 -3
- package/bundle/{chunk-DIOSE3BS.js → chunk-S4PJ76PA.js} +83 -232
- package/bundle/{chunk-IGCPJWUF.js → chunk-SM627E5R.js} +14467 -7859
- package/bundle/{chunk-DASQGJ7I.js → chunk-WQ6KAW5H.js} +2 -2
- package/bundle/{chunk-6GUIIVVA.js → chunk-YINIG2CS.js} +1 -1
- package/bundle/{chunk-ER2BMKIS.js → chunk-YSBB75DZ.js} +80 -208
- package/bundle/{chunk-7JLIYXNU.js → chunk-ZEWQGTD3.js} +1 -1
- package/bundle/{cleanup-25YS5RTX.js → cleanup-V6FPOSLQ.js} +2 -2
- package/bundle/{cleanup-6GCA4T3P.js → cleanup-XITK52PU.js} +2 -2
- package/bundle/{cleanup-LZUO77TQ.js → cleanup-XLXFAFOM.js} +2 -2
- package/bundle/{core-2TCJDOL6.js → core-3RU5PE2Y.js} +1 -9
- package/bundle/{dist-U5EX4CQJ.js → core-W643DPU2.js} +1 -9
- package/bundle/{devtoolsService-2IXJHCHW.js → devtoolsService-6HD2JXSA.js} +2 -2
- package/bundle/{devtoolsService-CU22AZND.js → devtoolsService-MHCZCWFY.js} +2 -2
- package/bundle/{devtoolsService-BJMUO2XL.js → devtoolsService-QCWLN43R.js} +3 -4
- package/bundle/{dist-VR7BVPAT.js → dist-LLWWE5PU.js} +1 -9
- package/bundle/docs/reference/tools.md +4 -4
- package/bundle/docs/tools/web-fetch.md +3 -7
- package/bundle/{gemini-636YD7YV.js → gemini-CQYKWDIK.js} +14 -14
- package/bundle/{gemini-K4CRJOXJ.js → gemini-LLTPU73C.js} +198 -214
- package/bundle/{gemini-4QZGW7SH.js → gemini-OENNDR6N.js} +14 -14
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-CS35GNLK.js → interactiveCli-7H2PS7RG.js} +8 -8
- package/bundle/{interactiveCli-2DBA2EUZ.js → interactiveCli-HHIJH7BL.js} +8 -8
- package/bundle/{interactiveCli-3JQSLUI7.js → interactiveCli-RIVGDZH4.js} +296 -315
- package/bundle/{liteRtServerManager-3TZXC7UK.js → liteRtServerManager-3QXIGTR3.js} +4 -4
- package/bundle/{liteRtServerManager-ACIGCEO2.js → liteRtServerManager-ALSWB4ZD.js} +4 -4
- package/bundle/{liteRtServerManager-HSGAX7EP.js → liteRtServerManager-XQKFTZNQ.js} +4 -4
- package/bundle/{oauth2-provider-JRSE3A7L.js → oauth2-provider-JV5L5XL4.js} +1 -1
- package/bundle/{oauth2-provider-7VIOBXML.js → oauth2-provider-KT5RTHDD.js} +1 -1
- package/bundle/{oauth2-provider-PYJGQTFU.js → oauth2-provider-NJUM2T72.js} +72 -38
- package/bundle/{start-6Q4QBVPO.js → start-AGMWAQ3H.js} +6 -6
- package/bundle/{start-HU7I3QO3.js → start-EKWDEYRS.js} +6 -6
- package/bundle/{start-MHK6JBHQ.js → start-LY3VMFGC.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-BOFHLQOG.js +0 -17332
- package/bundle/chunk-F5IP5MHL.js +0 -398
- package/bundle/chunk-I4Y2QIDJ.js +0 -102506
- package/bundle/chunk-JPE4HCHY.js +0 -398010
- package/bundle/chunk-OGVFULXC.js +0 -1571
- package/bundle/chunk-OXMZP3AS.js +0 -118
- package/bundle/chunk-VIH2NMBW.js +0 -512
- package/bundle/chunk-XIHG4K2H.js +0 -154
- package/bundle/cleanup-NCHJS2BY.js +0 -32
- package/bundle/devtoolsService-VC3YH4D2.js +0 -4359
- package/bundle/dist-YZRGVHWZ.js +0 -2196
- package/bundle/gemini-PXW4RELH.js +0 -17337
- package/bundle/interactiveCli-FBKOZYFH.js +0 -34983
- package/bundle/liteRtServerManager-IOJ5CIAG.js +0 -65
- package/bundle/oauth2-provider-QEEGBDTU.js +0 -235
- package/bundle/start-NIWCTDHI.js +0 -18
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HWQPEGPU.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-EXIGMSNQ.js";
|
|
49
49
|
import {
|
|
50
50
|
exitCli,
|
|
51
51
|
require_source
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-ZEWQGTD3.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-PC2G646B.js";
|
|
91
91
|
import {
|
|
92
92
|
RELAUNCH_EXIT_CODE
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-QTWDMFI7.js";
|
|
94
|
+
import "./chunk-CFD5V7JP.js";
|
|
95
95
|
import {
|
|
96
96
|
cleanupCheckpoints,
|
|
97
97
|
registerCleanup,
|
|
@@ -100,15 +100,12 @@ import {
|
|
|
100
100
|
runExitCleanup,
|
|
101
101
|
runSyncCleanup,
|
|
102
102
|
setupSignalHandlers
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-NBDWOAFH.js";
|
|
104
104
|
import {
|
|
105
105
|
ASK_USER_TOOL_NAME,
|
|
106
|
-
ApprovalMode,
|
|
107
106
|
AuthType,
|
|
108
107
|
Client,
|
|
109
108
|
Config,
|
|
110
|
-
CoreEvent,
|
|
111
|
-
CoreToolCallStatus,
|
|
112
109
|
DEFAULT_CONTEXT_FILENAME,
|
|
113
110
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
114
111
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -130,27 +127,19 @@ import {
|
|
|
130
127
|
FolderTrustDiscoveryService,
|
|
131
128
|
GEMINI_DIR,
|
|
132
129
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
133
|
-
GeminiEventType,
|
|
134
130
|
IdeClient,
|
|
135
|
-
IntegrityStatus,
|
|
136
131
|
InvalidStreamError,
|
|
137
132
|
JsonFormatter,
|
|
138
|
-
JsonStreamEventType,
|
|
139
|
-
Kind,
|
|
140
133
|
LegacyAgentSession,
|
|
141
134
|
Logger,
|
|
142
135
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
143
136
|
MCPServerConfig,
|
|
144
|
-
MCPServerStatus,
|
|
145
|
-
MessageBusType,
|
|
146
137
|
OTHER_BLOCKED_MESSAGE,
|
|
147
|
-
OutputFormat,
|
|
148
138
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
149
139
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
150
140
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
151
141
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
152
142
|
PREVIEW_GEMINI_MODEL,
|
|
153
|
-
PolicyDecision,
|
|
154
143
|
PolicyIntegrityManager,
|
|
155
144
|
RECITATION_BLOCKED_MESSAGE,
|
|
156
145
|
REFERENCE_CONTENT_START,
|
|
@@ -158,8 +147,6 @@ import {
|
|
|
158
147
|
ReadManyFilesTool,
|
|
159
148
|
SAFETY_BLOCKED_MESSAGE,
|
|
160
149
|
Scheduler,
|
|
161
|
-
SessionEndReason,
|
|
162
|
-
SessionStartSource,
|
|
163
150
|
ShellExecutionService,
|
|
164
151
|
SimpleExtensionLoader,
|
|
165
152
|
Storage,
|
|
@@ -168,13 +155,10 @@ import {
|
|
|
168
155
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
169
156
|
ToolCallEvent,
|
|
170
157
|
ToolConfirmationOutcome,
|
|
171
|
-
ToolErrorType,
|
|
172
|
-
TrustLevel,
|
|
173
158
|
UserAccountManager,
|
|
174
159
|
UserPromptEvent,
|
|
175
160
|
ValidationCancelledError,
|
|
176
161
|
ValidationRequiredError,
|
|
177
|
-
WarningPriority,
|
|
178
162
|
applyAdminAllowlist,
|
|
179
163
|
applyRequiredServers,
|
|
180
164
|
clearCachedCredentialFile,
|
|
@@ -254,7 +238,7 @@ import {
|
|
|
254
238
|
updatePolicy,
|
|
255
239
|
writeToStderr,
|
|
256
240
|
writeToStdout
|
|
257
|
-
} from "./chunk-
|
|
241
|
+
} from "./chunk-S4PJ76PA.js";
|
|
258
242
|
import "./chunk-664ZODQF.js";
|
|
259
243
|
import "./chunk-IUUIT4SU.js";
|
|
260
244
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -5384,7 +5368,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5384
5368
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5385
5369
|
const isStdio = !!config.command;
|
|
5386
5370
|
if (isStdio && !isTrusted) {
|
|
5387
|
-
return
|
|
5371
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5388
5372
|
}
|
|
5389
5373
|
const client = new Client({
|
|
5390
5374
|
name: "mcp-test-client",
|
|
@@ -5420,7 +5404,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5420
5404
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5421
5405
|
} catch {
|
|
5422
5406
|
await client.close();
|
|
5423
|
-
return
|
|
5407
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5424
5408
|
}
|
|
5425
5409
|
try {
|
|
5426
5410
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5434,10 +5418,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5434
5418
|
);
|
|
5435
5419
|
}
|
|
5436
5420
|
await client.close();
|
|
5437
|
-
return
|
|
5421
|
+
return "connected" /* CONNECTED */;
|
|
5438
5422
|
} catch {
|
|
5439
5423
|
await transport.close();
|
|
5440
|
-
return
|
|
5424
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5441
5425
|
}
|
|
5442
5426
|
}
|
|
5443
5427
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5450,12 +5434,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5450
5434
|
});
|
|
5451
5435
|
if (!loadResult.allowed) {
|
|
5452
5436
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5453
|
-
return
|
|
5437
|
+
return "blocked" /* BLOCKED */;
|
|
5454
5438
|
}
|
|
5455
|
-
return
|
|
5439
|
+
return "disabled" /* DISABLED */;
|
|
5456
5440
|
}
|
|
5457
5441
|
if (!isTrusted) {
|
|
5458
|
-
return
|
|
5442
|
+
return "disabled" /* DISABLED */;
|
|
5459
5443
|
}
|
|
5460
5444
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5461
5445
|
}
|
|
@@ -5501,23 +5485,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5501
5485
|
let statusIndicator = "";
|
|
5502
5486
|
let statusText = "";
|
|
5503
5487
|
switch (status) {
|
|
5504
|
-
case
|
|
5488
|
+
case "connected" /* CONNECTED */:
|
|
5505
5489
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5506
5490
|
statusText = "Connected";
|
|
5507
5491
|
break;
|
|
5508
|
-
case
|
|
5492
|
+
case "connecting" /* CONNECTING */:
|
|
5509
5493
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5510
5494
|
statusText = "Connecting";
|
|
5511
5495
|
break;
|
|
5512
|
-
case
|
|
5496
|
+
case "blocked" /* BLOCKED */:
|
|
5513
5497
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5514
5498
|
statusText = "Blocked";
|
|
5515
5499
|
break;
|
|
5516
|
-
case
|
|
5500
|
+
case "disabled" /* DISABLED */:
|
|
5517
5501
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5518
5502
|
statusText = "Disabled";
|
|
5519
5503
|
break;
|
|
5520
|
-
case
|
|
5504
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5521
5505
|
default:
|
|
5522
5506
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5523
5507
|
statusText = "Disconnected";
|
|
@@ -5803,7 +5787,7 @@ async function handleInstall(args) {
|
|
|
5803
5787
|
);
|
|
5804
5788
|
if (confirmed) {
|
|
5805
5789
|
const trustedFolders = loadTrustedFolders();
|
|
5806
|
-
await trustedFolders.setValue(realPath,
|
|
5790
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5807
5791
|
} else {
|
|
5808
5792
|
throw new Error(
|
|
5809
5793
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7848,7 +7832,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7848
7832
|
}
|
|
7849
7833
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7850
7834
|
const packageJson = await getPackageJson(__dirname3);
|
|
7851
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.59.0
|
|
7835
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.59.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7852
7836
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7853
7837
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7854
7838
|
}
|
|
@@ -7907,9 +7891,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7907
7891
|
cwd,
|
|
7908
7892
|
potentialWorkspacePoliciesDir
|
|
7909
7893
|
);
|
|
7910
|
-
if (integrityResult.status ===
|
|
7894
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7911
7895
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7912
|
-
} else if (integrityResult.status ===
|
|
7896
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7913
7897
|
workspacePoliciesDir = void 0;
|
|
7914
7898
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7915
7899
|
policyUpdateConfirmationRequest = {
|
|
@@ -8337,23 +8321,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8337
8321
|
if (rawApprovalMode) {
|
|
8338
8322
|
switch (rawApprovalMode) {
|
|
8339
8323
|
case "yolo":
|
|
8340
|
-
approvalMode =
|
|
8324
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8341
8325
|
break;
|
|
8342
8326
|
case "auto_edit":
|
|
8343
|
-
approvalMode =
|
|
8327
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8344
8328
|
break;
|
|
8345
8329
|
case "plan":
|
|
8346
8330
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8347
8331
|
debugLogger.warn(
|
|
8348
8332
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8349
8333
|
);
|
|
8350
|
-
approvalMode =
|
|
8334
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8351
8335
|
} else {
|
|
8352
|
-
approvalMode =
|
|
8336
|
+
approvalMode = "plan" /* PLAN */;
|
|
8353
8337
|
}
|
|
8354
8338
|
break;
|
|
8355
8339
|
case "default":
|
|
8356
|
-
approvalMode =
|
|
8340
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8357
8341
|
break;
|
|
8358
8342
|
default:
|
|
8359
8343
|
throw new Error(
|
|
@@ -8361,10 +8345,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8361
8345
|
);
|
|
8362
8346
|
}
|
|
8363
8347
|
} else {
|
|
8364
|
-
approvalMode =
|
|
8348
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8365
8349
|
}
|
|
8366
8350
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8367
|
-
if (approvalMode ===
|
|
8351
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8368
8352
|
if (settings.admin?.secureModeEnabled) {
|
|
8369
8353
|
debugLogger.error(
|
|
8370
8354
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8382,16 +8366,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8382
8366
|
)
|
|
8383
8367
|
);
|
|
8384
8368
|
}
|
|
8385
|
-
} else if (approvalMode ===
|
|
8369
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8386
8370
|
debugLogger.warn(
|
|
8387
8371
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8388
8372
|
);
|
|
8389
8373
|
}
|
|
8390
|
-
if (!trustedFolder && approvalMode !==
|
|
8374
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8391
8375
|
debugLogger.warn(
|
|
8392
8376
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8393
8377
|
);
|
|
8394
|
-
approvalMode =
|
|
8378
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8395
8379
|
}
|
|
8396
8380
|
let telemetrySettings;
|
|
8397
8381
|
try {
|
|
@@ -10674,7 +10658,7 @@ import path9 from "node:path";
|
|
|
10674
10658
|
import process4 from "node:process";
|
|
10675
10659
|
var homeDirectoryCheck = {
|
|
10676
10660
|
id: "home-directory",
|
|
10677
|
-
priority:
|
|
10661
|
+
priority: "low" /* Low */,
|
|
10678
10662
|
check: async (workspaceRoot, settings) => {
|
|
10679
10663
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
10680
10664
|
return null;
|
|
@@ -10698,7 +10682,7 @@ var homeDirectoryCheck = {
|
|
|
10698
10682
|
};
|
|
10699
10683
|
var rootDirectoryCheck = {
|
|
10700
10684
|
id: "root-directory",
|
|
10701
|
-
priority:
|
|
10685
|
+
priority: "high" /* High */,
|
|
10702
10686
|
check: async (workspaceRoot, _settings) => {
|
|
10703
10687
|
try {
|
|
10704
10688
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -10714,7 +10698,7 @@ var rootDirectoryCheck = {
|
|
|
10714
10698
|
};
|
|
10715
10699
|
var folderTrustCheck = {
|
|
10716
10700
|
id: "folder-trust",
|
|
10717
|
-
priority:
|
|
10701
|
+
priority: "high" /* High */,
|
|
10718
10702
|
check: async (workspaceRoot, settings) => {
|
|
10719
10703
|
if (!isFolderTrustEnabled(settings)) {
|
|
10720
10704
|
return null;
|
|
@@ -10904,12 +10888,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10904
10888
|
error,
|
|
10905
10889
|
config.getContentGeneratorConfig()?.authType
|
|
10906
10890
|
);
|
|
10907
|
-
if (config.getOutputFormat() ===
|
|
10891
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10908
10892
|
const streamFormatter = new StreamJsonFormatter();
|
|
10909
10893
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10910
10894
|
const metrics = uiTelemetryService.getMetrics();
|
|
10911
10895
|
streamFormatter.emitEvent({
|
|
10912
|
-
type:
|
|
10896
|
+
type: "result" /* RESULT */,
|
|
10913
10897
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10914
10898
|
status: "error",
|
|
10915
10899
|
error: {
|
|
@@ -10920,7 +10904,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10920
10904
|
});
|
|
10921
10905
|
runSyncCleanup();
|
|
10922
10906
|
process.exit(getNumericExitCode(errorCode));
|
|
10923
|
-
} else if (config.getOutputFormat() ===
|
|
10907
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10924
10908
|
const formatter = new JsonFormatter();
|
|
10925
10909
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10926
10910
|
const formattedError = formatter.formatError(
|
|
@@ -10940,11 +10924,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10940
10924
|
const isFatal = isFatalToolError(errorType);
|
|
10941
10925
|
if (isFatal) {
|
|
10942
10926
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10943
|
-
if (config.getOutputFormat() ===
|
|
10927
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10944
10928
|
const streamFormatter = new StreamJsonFormatter();
|
|
10945
10929
|
const metrics = uiTelemetryService.getMetrics();
|
|
10946
10930
|
streamFormatter.emitEvent({
|
|
10947
|
-
type:
|
|
10931
|
+
type: "result" /* RESULT */,
|
|
10948
10932
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10949
10933
|
status: "error",
|
|
10950
10934
|
error: {
|
|
@@ -10953,7 +10937,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10953
10937
|
},
|
|
10954
10938
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10955
10939
|
});
|
|
10956
|
-
} else if (config.getOutputFormat() ===
|
|
10940
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10957
10941
|
const formatter = new JsonFormatter();
|
|
10958
10942
|
const formattedError = formatter.formatError(
|
|
10959
10943
|
toolExecutionError,
|
|
@@ -10971,11 +10955,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10971
10955
|
}
|
|
10972
10956
|
function handleCancellationError(config) {
|
|
10973
10957
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10974
|
-
if (config.getOutputFormat() ===
|
|
10958
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10975
10959
|
const streamFormatter = new StreamJsonFormatter();
|
|
10976
10960
|
const metrics = uiTelemetryService.getMetrics();
|
|
10977
10961
|
streamFormatter.emitEvent({
|
|
10978
|
-
type:
|
|
10962
|
+
type: "result" /* RESULT */,
|
|
10979
10963
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10980
10964
|
status: "error",
|
|
10981
10965
|
error: {
|
|
@@ -10986,7 +10970,7 @@ function handleCancellationError(config) {
|
|
|
10986
10970
|
});
|
|
10987
10971
|
runSyncCleanup();
|
|
10988
10972
|
process.exit(cancellationError.exitCode);
|
|
10989
|
-
} else if (config.getOutputFormat() ===
|
|
10973
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10990
10974
|
const formatter = new JsonFormatter();
|
|
10991
10975
|
const formattedError = formatter.formatError(
|
|
10992
10976
|
cancellationError,
|
|
@@ -11006,11 +10990,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11006
10990
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11007
10991
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11008
10992
|
);
|
|
11009
|
-
if (config.getOutputFormat() ===
|
|
10993
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11010
10994
|
const streamFormatter = new StreamJsonFormatter();
|
|
11011
10995
|
const metrics = uiTelemetryService.getMetrics();
|
|
11012
10996
|
streamFormatter.emitEvent({
|
|
11013
|
-
type:
|
|
10997
|
+
type: "result" /* RESULT */,
|
|
11014
10998
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11015
10999
|
status: "error",
|
|
11016
11000
|
error: {
|
|
@@ -11021,7 +11005,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11021
11005
|
});
|
|
11022
11006
|
runSyncCleanup();
|
|
11023
11007
|
process.exit(maxTurnsError.exitCode);
|
|
11024
|
-
} else if (config.getOutputFormat() ===
|
|
11008
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11025
11009
|
const formatter = new JsonFormatter();
|
|
11026
11010
|
const formattedError = formatter.formatError(
|
|
11027
11011
|
maxTurnsError,
|
|
@@ -11101,7 +11085,7 @@ async function runNonInteractive({
|
|
|
11101
11085
|
}
|
|
11102
11086
|
});
|
|
11103
11087
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11104
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11088
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-MHCZCWFY.js");
|
|
11105
11089
|
setupInitialActivityLogger(config);
|
|
11106
11090
|
}
|
|
11107
11091
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11117,7 +11101,7 @@ async function runNonInteractive({
|
|
|
11117
11101
|
}
|
|
11118
11102
|
};
|
|
11119
11103
|
const startTime = Date.now();
|
|
11120
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11104
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11121
11105
|
const abortController = new AbortController();
|
|
11122
11106
|
let isAborting = false;
|
|
11123
11107
|
let cancelMessageTimer = null;
|
|
@@ -11170,13 +11154,13 @@ async function runNonInteractive({
|
|
|
11170
11154
|
};
|
|
11171
11155
|
try {
|
|
11172
11156
|
consolePatcher.patch();
|
|
11173
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11157
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11174
11158
|
process.stderr.write(
|
|
11175
11159
|
"[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"
|
|
11176
11160
|
);
|
|
11177
11161
|
}
|
|
11178
11162
|
setupStdinCancellation();
|
|
11179
|
-
coreEvents.on(
|
|
11163
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11180
11164
|
coreEvents.drainBacklogs();
|
|
11181
11165
|
process.stdout.on("error", (err) => {
|
|
11182
11166
|
if (err.code === "EPIPE") {
|
|
@@ -11202,7 +11186,7 @@ async function runNonInteractive({
|
|
|
11202
11186
|
}
|
|
11203
11187
|
if (streamFormatter) {
|
|
11204
11188
|
streamFormatter.emitEvent({
|
|
11205
|
-
type:
|
|
11189
|
+
type: "init" /* INIT */,
|
|
11206
11190
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11207
11191
|
session_id: config.getSessionId(),
|
|
11208
11192
|
model: config.getModel()
|
|
@@ -11240,7 +11224,7 @@ async function runNonInteractive({
|
|
|
11240
11224
|
}
|
|
11241
11225
|
if (streamFormatter) {
|
|
11242
11226
|
streamFormatter.emitEvent({
|
|
11243
|
-
type:
|
|
11227
|
+
type: "message" /* MESSAGE */,
|
|
11244
11228
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11245
11229
|
role: "user",
|
|
11246
11230
|
content: input
|
|
@@ -11279,12 +11263,12 @@ async function runNonInteractive({
|
|
|
11279
11263
|
const metrics = uiTelemetryService.getMetrics();
|
|
11280
11264
|
const durationMs = Date.now() - startTime;
|
|
11281
11265
|
streamFormatter.emitEvent({
|
|
11282
|
-
type:
|
|
11266
|
+
type: "result" /* RESULT */,
|
|
11283
11267
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11284
11268
|
status: errorPayload ? "error" : "success",
|
|
11285
11269
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11286
11270
|
});
|
|
11287
|
-
} else if (config.getOutputFormat() ===
|
|
11271
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11288
11272
|
const formatter = new JsonFormatter();
|
|
11289
11273
|
const stats = uiTelemetryService.getMetrics();
|
|
11290
11274
|
textOutput.write(
|
|
@@ -11377,13 +11361,13 @@ async function runNonInteractive({
|
|
|
11377
11361
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11378
11362
|
if (streamFormatter) {
|
|
11379
11363
|
streamFormatter.emitEvent({
|
|
11380
|
-
type:
|
|
11364
|
+
type: "message" /* MESSAGE */,
|
|
11381
11365
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11382
11366
|
role: "assistant",
|
|
11383
11367
|
content: output,
|
|
11384
11368
|
delta: true
|
|
11385
11369
|
});
|
|
11386
|
-
} else if (config.getOutputFormat() ===
|
|
11370
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11387
11371
|
responseText += output;
|
|
11388
11372
|
} else {
|
|
11389
11373
|
if (part.text) {
|
|
@@ -11396,13 +11380,13 @@ async function runNonInteractive({
|
|
|
11396
11380
|
break;
|
|
11397
11381
|
}
|
|
11398
11382
|
case "tool_request": {
|
|
11399
|
-
if (config.getOutputFormat() ===
|
|
11383
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11400
11384
|
preToolResponseText = responseText || preToolResponseText;
|
|
11401
11385
|
responseText = "";
|
|
11402
11386
|
}
|
|
11403
11387
|
if (streamFormatter) {
|
|
11404
11388
|
streamFormatter.emitEvent({
|
|
11405
|
-
type:
|
|
11389
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11406
11390
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11407
11391
|
tool_name: event.name,
|
|
11408
11392
|
tool_id: event.requestId,
|
|
@@ -11418,7 +11402,7 @@ async function runNonInteractive({
|
|
|
11418
11402
|
const displayText = displayContentToString(display);
|
|
11419
11403
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11420
11404
|
streamFormatter.emitEvent({
|
|
11421
|
-
type:
|
|
11405
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11422
11406
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11423
11407
|
tool_id: event.requestId,
|
|
11424
11408
|
status: event.isError ? "error" : "success",
|
|
@@ -11433,17 +11417,17 @@ async function runNonInteractive({
|
|
|
11433
11417
|
const display = event.display?.result;
|
|
11434
11418
|
const displayText = displayContentToString(display);
|
|
11435
11419
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11436
|
-
if (event.data?.["errorType"] ===
|
|
11437
|
-
if (config.getOutputFormat() ===
|
|
11420
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
11421
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
11438
11422
|
responseText = preToolResponseText;
|
|
11439
11423
|
}
|
|
11440
11424
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11441
|
-
if (config.getOutputFormat() ===
|
|
11425
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11442
11426
|
process.stderr.write(`${stopMessage}
|
|
11443
11427
|
`);
|
|
11444
11428
|
}
|
|
11445
11429
|
}
|
|
11446
|
-
if (event.data?.["errorType"] ===
|
|
11430
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
11447
11431
|
throw new FatalToolExecutionError(
|
|
11448
11432
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11449
11433
|
);
|
|
@@ -11478,12 +11462,12 @@ async function runNonInteractive({
|
|
|
11478
11462
|
}
|
|
11479
11463
|
if (streamFormatter) {
|
|
11480
11464
|
streamFormatter.emitEvent({
|
|
11481
|
-
type:
|
|
11465
|
+
type: "error" /* ERROR */,
|
|
11482
11466
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11483
11467
|
severity: "error",
|
|
11484
11468
|
message: errorMessage
|
|
11485
11469
|
});
|
|
11486
|
-
} else if (config.getOutputFormat() ===
|
|
11470
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11487
11471
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11488
11472
|
`);
|
|
11489
11473
|
}
|
|
@@ -11504,12 +11488,12 @@ async function runNonInteractive({
|
|
|
11504
11488
|
const errorCode = event._meta?.["code"];
|
|
11505
11489
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11506
11490
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11507
|
-
if (config.getOutputFormat() ===
|
|
11491
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11508
11492
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11509
11493
|
`);
|
|
11510
11494
|
} else if (streamFormatter) {
|
|
11511
11495
|
streamFormatter.emitEvent({
|
|
11512
|
-
type:
|
|
11496
|
+
type: "error" /* ERROR */,
|
|
11513
11497
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11514
11498
|
severity: "warning",
|
|
11515
11499
|
message: stripAnsi(blockMessage)
|
|
@@ -11519,13 +11503,13 @@ async function runNonInteractive({
|
|
|
11519
11503
|
break;
|
|
11520
11504
|
}
|
|
11521
11505
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11522
|
-
if (config.getOutputFormat() ===
|
|
11506
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11523
11507
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11524
11508
|
`);
|
|
11525
11509
|
}
|
|
11526
11510
|
if (streamFormatter) {
|
|
11527
11511
|
streamFormatter.emitEvent({
|
|
11528
|
-
type:
|
|
11512
|
+
type: "error" /* ERROR */,
|
|
11529
11513
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11530
11514
|
severity,
|
|
11531
11515
|
message: stripAnsi(event.message)
|
|
@@ -11545,7 +11529,7 @@ async function runNonInteractive({
|
|
|
11545
11529
|
);
|
|
11546
11530
|
} else if (streamFormatter) {
|
|
11547
11531
|
streamFormatter.emitEvent({
|
|
11548
|
-
type:
|
|
11532
|
+
type: "error" /* ERROR */,
|
|
11549
11533
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11550
11534
|
severity: "error",
|
|
11551
11535
|
message: "Maximum session turns exceeded"
|
|
@@ -11553,7 +11537,7 @@ async function runNonInteractive({
|
|
|
11553
11537
|
}
|
|
11554
11538
|
}
|
|
11555
11539
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11556
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11540
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11557
11541
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11558
11542
|
`);
|
|
11559
11543
|
}
|
|
@@ -11583,7 +11567,7 @@ async function runNonInteractive({
|
|
|
11583
11567
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11584
11568
|
scheduler?.dispose();
|
|
11585
11569
|
consolePatcher.cleanup();
|
|
11586
|
-
coreEvents.off(
|
|
11570
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11587
11571
|
}
|
|
11588
11572
|
if (errorToHandle) {
|
|
11589
11573
|
handleError(errorToHandle, config);
|
|
@@ -11611,7 +11595,7 @@ async function runNonInteractive2(params) {
|
|
|
11611
11595
|
}
|
|
11612
11596
|
});
|
|
11613
11597
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11614
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11598
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-MHCZCWFY.js");
|
|
11615
11599
|
setupInitialActivityLogger(config);
|
|
11616
11600
|
}
|
|
11617
11601
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11627,7 +11611,7 @@ async function runNonInteractive2(params) {
|
|
|
11627
11611
|
}
|
|
11628
11612
|
};
|
|
11629
11613
|
const startTime = Date.now();
|
|
11630
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11614
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11631
11615
|
const abortController = new AbortController();
|
|
11632
11616
|
let isAborting = false;
|
|
11633
11617
|
let cancelMessageTimer = null;
|
|
@@ -11678,13 +11662,13 @@ async function runNonInteractive2(params) {
|
|
|
11678
11662
|
let scheduler;
|
|
11679
11663
|
try {
|
|
11680
11664
|
consolePatcher.patch();
|
|
11681
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11665
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11682
11666
|
process.stderr.write(
|
|
11683
11667
|
"[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"
|
|
11684
11668
|
);
|
|
11685
11669
|
}
|
|
11686
11670
|
setupStdinCancellation();
|
|
11687
|
-
coreEvents.on(
|
|
11671
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11688
11672
|
coreEvents.drainBacklogs();
|
|
11689
11673
|
process.stdout.on("error", (err) => {
|
|
11690
11674
|
if (err.code === "EPIPE") {
|
|
@@ -11708,7 +11692,7 @@ async function runNonInteractive2(params) {
|
|
|
11708
11692
|
}
|
|
11709
11693
|
if (streamFormatter) {
|
|
11710
11694
|
streamFormatter.emitEvent({
|
|
11711
|
-
type:
|
|
11695
|
+
type: "init" /* INIT */,
|
|
11712
11696
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11713
11697
|
session_id: config.getSessionId(),
|
|
11714
11698
|
model: config.getModel()
|
|
@@ -11746,7 +11730,7 @@ async function runNonInteractive2(params) {
|
|
|
11746
11730
|
}
|
|
11747
11731
|
if (streamFormatter) {
|
|
11748
11732
|
streamFormatter.emitEvent({
|
|
11749
|
-
type:
|
|
11733
|
+
type: "message" /* MESSAGE */,
|
|
11750
11734
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11751
11735
|
role: "user",
|
|
11752
11736
|
content: input
|
|
@@ -11774,28 +11758,28 @@ async function runNonInteractive2(params) {
|
|
|
11774
11758
|
if (abortController.signal.aborted) {
|
|
11775
11759
|
handleCancellationError(config);
|
|
11776
11760
|
}
|
|
11777
|
-
if (event.type ===
|
|
11761
|
+
if (event.type === "content" /* Content */) {
|
|
11778
11762
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
11779
11763
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
11780
11764
|
if (streamFormatter) {
|
|
11781
11765
|
streamFormatter.emitEvent({
|
|
11782
|
-
type:
|
|
11766
|
+
type: "message" /* MESSAGE */,
|
|
11783
11767
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11784
11768
|
role: "assistant",
|
|
11785
11769
|
content: output,
|
|
11786
11770
|
delta: true
|
|
11787
11771
|
});
|
|
11788
|
-
} else if (config.getOutputFormat() ===
|
|
11772
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11789
11773
|
responseText += output;
|
|
11790
11774
|
} else {
|
|
11791
11775
|
if (event.value) {
|
|
11792
11776
|
textOutput.write(output);
|
|
11793
11777
|
}
|
|
11794
11778
|
}
|
|
11795
|
-
} else if (event.type ===
|
|
11779
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
11796
11780
|
if (streamFormatter) {
|
|
11797
11781
|
streamFormatter.emitEvent({
|
|
11798
|
-
type:
|
|
11782
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11799
11783
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11800
11784
|
tool_name: event.value.name,
|
|
11801
11785
|
tool_id: event.value.callId,
|
|
@@ -11803,33 +11787,33 @@ async function runNonInteractive2(params) {
|
|
|
11803
11787
|
});
|
|
11804
11788
|
}
|
|
11805
11789
|
toolCallRequests.push(event.value);
|
|
11806
|
-
} else if (event.type ===
|
|
11790
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
11807
11791
|
const message = "Loop detected, stopping execution";
|
|
11808
11792
|
if (streamFormatter) {
|
|
11809
11793
|
streamFormatter.emitEvent({
|
|
11810
|
-
type:
|
|
11794
|
+
type: "error" /* ERROR */,
|
|
11811
11795
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11812
11796
|
severity: "warning",
|
|
11813
11797
|
message
|
|
11814
11798
|
});
|
|
11815
11799
|
}
|
|
11816
11800
|
warnings.push(message);
|
|
11817
|
-
} else if (event.type ===
|
|
11801
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
11818
11802
|
const message = "Maximum session turns exceeded";
|
|
11819
11803
|
if (streamFormatter) {
|
|
11820
11804
|
streamFormatter.emitEvent({
|
|
11821
|
-
type:
|
|
11805
|
+
type: "error" /* ERROR */,
|
|
11822
11806
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11823
11807
|
severity: "error",
|
|
11824
11808
|
message
|
|
11825
11809
|
});
|
|
11826
11810
|
}
|
|
11827
11811
|
warnings.push(message);
|
|
11828
|
-
} else if (event.type ===
|
|
11812
|
+
} else if (event.type === "error" /* Error */) {
|
|
11829
11813
|
throw event.value.error;
|
|
11830
|
-
} else if (event.type ===
|
|
11814
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
11831
11815
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11832
|
-
if (config.getOutputFormat() ===
|
|
11816
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11833
11817
|
process.stderr.write(`${stopMessage}
|
|
11834
11818
|
`);
|
|
11835
11819
|
}
|
|
@@ -11837,7 +11821,7 @@ async function runNonInteractive2(params) {
|
|
|
11837
11821
|
const metrics = uiTelemetryService.getMetrics();
|
|
11838
11822
|
const durationMs = Date.now() - startTime;
|
|
11839
11823
|
streamFormatter.emitEvent({
|
|
11840
|
-
type:
|
|
11824
|
+
type: "result" /* RESULT */,
|
|
11841
11825
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11842
11826
|
status: "success",
|
|
11843
11827
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11845,7 +11829,7 @@ async function runNonInteractive2(params) {
|
|
|
11845
11829
|
durationMs
|
|
11846
11830
|
)
|
|
11847
11831
|
});
|
|
11848
|
-
} else if (config.getOutputFormat() ===
|
|
11832
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11849
11833
|
const formatter = new JsonFormatter();
|
|
11850
11834
|
const stats = uiTelemetryService.getMetrics();
|
|
11851
11835
|
textOutput.write(
|
|
@@ -11861,21 +11845,21 @@ async function runNonInteractive2(params) {
|
|
|
11861
11845
|
textOutput.ensureTrailingNewline();
|
|
11862
11846
|
}
|
|
11863
11847
|
return;
|
|
11864
|
-
} else if (event.type ===
|
|
11848
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
11865
11849
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11866
|
-
if (config.getOutputFormat() ===
|
|
11850
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11867
11851
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11868
11852
|
`);
|
|
11869
11853
|
} else if (streamFormatter) {
|
|
11870
11854
|
streamFormatter.emitEvent({
|
|
11871
|
-
type:
|
|
11855
|
+
type: "error" /* ERROR */,
|
|
11872
11856
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11873
11857
|
severity: "warning",
|
|
11874
11858
|
message: stripAnsi(blockMessage)
|
|
11875
11859
|
});
|
|
11876
11860
|
}
|
|
11877
11861
|
warnings.push(blockMessage);
|
|
11878
|
-
} else if (event.type ===
|
|
11862
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
11879
11863
|
const eventValue = event.value;
|
|
11880
11864
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
11881
11865
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -11898,12 +11882,12 @@ async function runNonInteractive2(params) {
|
|
|
11898
11882
|
);
|
|
11899
11883
|
if (streamFormatter) {
|
|
11900
11884
|
streamFormatter.emitEvent({
|
|
11901
|
-
type:
|
|
11885
|
+
type: "error" /* ERROR */,
|
|
11902
11886
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11903
11887
|
severity: "error",
|
|
11904
11888
|
message: invalidStreamError
|
|
11905
11889
|
});
|
|
11906
|
-
} else if (config.getOutputFormat() ===
|
|
11890
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11907
11891
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
11908
11892
|
`);
|
|
11909
11893
|
}
|
|
@@ -11923,7 +11907,7 @@ async function runNonInteractive2(params) {
|
|
|
11923
11907
|
const requestInfo = completedToolCall.request;
|
|
11924
11908
|
if (streamFormatter) {
|
|
11925
11909
|
streamFormatter.emitEvent({
|
|
11926
|
-
type:
|
|
11910
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11927
11911
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11928
11912
|
tool_id: requestInfo.callId,
|
|
11929
11913
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11957,11 +11941,11 @@ async function runNonInteractive2(params) {
|
|
|
11957
11941
|
);
|
|
11958
11942
|
}
|
|
11959
11943
|
const stopExecutionTool = completedToolCalls.find(
|
|
11960
|
-
(tc) => tc.response.errorType ===
|
|
11944
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11961
11945
|
);
|
|
11962
11946
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11963
11947
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11964
|
-
if (config.getOutputFormat() ===
|
|
11948
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11965
11949
|
process.stderr.write(`${stopMessage}
|
|
11966
11950
|
`);
|
|
11967
11951
|
}
|
|
@@ -11969,7 +11953,7 @@ async function runNonInteractive2(params) {
|
|
|
11969
11953
|
const metrics = uiTelemetryService.getMetrics();
|
|
11970
11954
|
const durationMs = Date.now() - startTime;
|
|
11971
11955
|
streamFormatter.emitEvent({
|
|
11972
|
-
type:
|
|
11956
|
+
type: "result" /* RESULT */,
|
|
11973
11957
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11974
11958
|
status: "success",
|
|
11975
11959
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11977,7 +11961,7 @@ async function runNonInteractive2(params) {
|
|
|
11977
11961
|
durationMs
|
|
11978
11962
|
)
|
|
11979
11963
|
});
|
|
11980
|
-
} else if (config.getOutputFormat() ===
|
|
11964
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11981
11965
|
const formatter = new JsonFormatter();
|
|
11982
11966
|
const stats = uiTelemetryService.getMetrics();
|
|
11983
11967
|
textOutput.write(
|
|
@@ -12000,12 +11984,12 @@ async function runNonInteractive2(params) {
|
|
|
12000
11984
|
const metrics = uiTelemetryService.getMetrics();
|
|
12001
11985
|
const durationMs = Date.now() - startTime;
|
|
12002
11986
|
streamFormatter.emitEvent({
|
|
12003
|
-
type:
|
|
11987
|
+
type: "result" /* RESULT */,
|
|
12004
11988
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12005
11989
|
status: invalidStreamError ? "error" : "success",
|
|
12006
11990
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12007
11991
|
});
|
|
12008
|
-
} else if (config.getOutputFormat() ===
|
|
11992
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12009
11993
|
const formatter = new JsonFormatter();
|
|
12010
11994
|
const stats = uiTelemetryService.getMetrics();
|
|
12011
11995
|
textOutput.write(
|
|
@@ -12029,7 +12013,7 @@ async function runNonInteractive2(params) {
|
|
|
12029
12013
|
cleanupStdinCancellation();
|
|
12030
12014
|
scheduler?.dispose();
|
|
12031
12015
|
consolePatcher.cleanup();
|
|
12032
|
-
coreEvents.off(
|
|
12016
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12033
12017
|
}
|
|
12034
12018
|
if (errorToHandle) {
|
|
12035
12019
|
handleError(errorToHandle, config);
|
|
@@ -14420,12 +14404,12 @@ function toToolCallContent(toolResult) {
|
|
|
14420
14404
|
}
|
|
14421
14405
|
var basicPermissionOptions = [
|
|
14422
14406
|
{
|
|
14423
|
-
optionId:
|
|
14407
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14424
14408
|
name: "Allow",
|
|
14425
14409
|
kind: "allow_once"
|
|
14426
14410
|
},
|
|
14427
14411
|
{
|
|
14428
|
-
optionId:
|
|
14412
|
+
optionId: "cancel" /* Cancel */,
|
|
14429
14413
|
name: "Reject",
|
|
14430
14414
|
kind: "reject_once"
|
|
14431
14415
|
}
|
|
@@ -14437,13 +14421,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14437
14421
|
switch (confirmation.type) {
|
|
14438
14422
|
case "edit":
|
|
14439
14423
|
options.push({
|
|
14440
|
-
optionId:
|
|
14424
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14441
14425
|
name: "Allow for this session",
|
|
14442
14426
|
kind: "allow_always"
|
|
14443
14427
|
});
|
|
14444
14428
|
if (enablePermanentToolApproval) {
|
|
14445
14429
|
options.push({
|
|
14446
|
-
optionId:
|
|
14430
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14447
14431
|
name: "Allow for this file in all future sessions",
|
|
14448
14432
|
kind: "allow_always"
|
|
14449
14433
|
});
|
|
@@ -14451,13 +14435,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14451
14435
|
break;
|
|
14452
14436
|
case "exec":
|
|
14453
14437
|
options.push({
|
|
14454
|
-
optionId:
|
|
14438
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14455
14439
|
name: "Allow for this session",
|
|
14456
14440
|
kind: "allow_always"
|
|
14457
14441
|
});
|
|
14458
14442
|
if (enablePermanentToolApproval) {
|
|
14459
14443
|
options.push({
|
|
14460
|
-
optionId:
|
|
14444
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14461
14445
|
name: "Allow this command for all future sessions",
|
|
14462
14446
|
kind: "allow_always"
|
|
14463
14447
|
});
|
|
@@ -14466,19 +14450,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14466
14450
|
case "mcp":
|
|
14467
14451
|
options.push(
|
|
14468
14452
|
{
|
|
14469
|
-
optionId:
|
|
14453
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14470
14454
|
name: "Allow all server tools for this session",
|
|
14471
14455
|
kind: "allow_always"
|
|
14472
14456
|
},
|
|
14473
14457
|
{
|
|
14474
|
-
optionId:
|
|
14458
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14475
14459
|
name: "Allow tool for this session",
|
|
14476
14460
|
kind: "allow_always"
|
|
14477
14461
|
}
|
|
14478
14462
|
);
|
|
14479
14463
|
if (enablePermanentToolApproval) {
|
|
14480
14464
|
options.push({
|
|
14481
|
-
optionId:
|
|
14465
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14482
14466
|
name: "Allow tool for all future sessions",
|
|
14483
14467
|
kind: "allow_always"
|
|
14484
14468
|
});
|
|
@@ -14486,13 +14470,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14486
14470
|
break;
|
|
14487
14471
|
case "info":
|
|
14488
14472
|
options.push({
|
|
14489
|
-
optionId:
|
|
14473
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14490
14474
|
name: "Allow for this session",
|
|
14491
14475
|
kind: "allow_always"
|
|
14492
14476
|
});
|
|
14493
14477
|
if (enablePermanentToolApproval) {
|
|
14494
14478
|
options.push({
|
|
14495
|
-
optionId:
|
|
14479
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14496
14480
|
name: "Allow for all future sessions",
|
|
14497
14481
|
kind: "allow_always"
|
|
14498
14482
|
});
|
|
@@ -14524,21 +14508,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14524
14508
|
}
|
|
14525
14509
|
function toAcpToolKind(kind) {
|
|
14526
14510
|
switch (kind) {
|
|
14527
|
-
case
|
|
14528
|
-
case
|
|
14529
|
-
case
|
|
14530
|
-
case
|
|
14531
|
-
case
|
|
14532
|
-
case
|
|
14533
|
-
case
|
|
14534
|
-
case
|
|
14535
|
-
case
|
|
14536
|
-
case
|
|
14511
|
+
case "read" /* Read */:
|
|
14512
|
+
case "edit" /* Edit */:
|
|
14513
|
+
case "execute" /* Execute */:
|
|
14514
|
+
case "search" /* Search */:
|
|
14515
|
+
case "delete" /* Delete */:
|
|
14516
|
+
case "move" /* Move */:
|
|
14517
|
+
case "think" /* Think */:
|
|
14518
|
+
case "fetch" /* Fetch */:
|
|
14519
|
+
case "switch_mode" /* SwitchMode */:
|
|
14520
|
+
case "other" /* Other */:
|
|
14537
14521
|
return kind;
|
|
14538
|
-
case
|
|
14522
|
+
case "agent" /* Agent */:
|
|
14539
14523
|
return "think";
|
|
14540
|
-
case
|
|
14541
|
-
case
|
|
14524
|
+
case "plan" /* Plan */:
|
|
14525
|
+
case "communicate" /* Communicate */:
|
|
14542
14526
|
default:
|
|
14543
14527
|
return "other";
|
|
14544
14528
|
}
|
|
@@ -14546,24 +14530,24 @@ function toAcpToolKind(kind) {
|
|
|
14546
14530
|
function buildAvailableModes(isPlanEnabled) {
|
|
14547
14531
|
const modes = [
|
|
14548
14532
|
{
|
|
14549
|
-
id:
|
|
14533
|
+
id: "default" /* DEFAULT */,
|
|
14550
14534
|
name: "Default",
|
|
14551
14535
|
description: "Prompts for approval"
|
|
14552
14536
|
},
|
|
14553
14537
|
{
|
|
14554
|
-
id:
|
|
14538
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
14555
14539
|
name: "Auto Edit",
|
|
14556
14540
|
description: "Auto-approves edit tools"
|
|
14557
14541
|
},
|
|
14558
14542
|
{
|
|
14559
|
-
id:
|
|
14543
|
+
id: "yolo" /* YOLO */,
|
|
14560
14544
|
name: "YOLO",
|
|
14561
14545
|
description: "Auto-approves all tools"
|
|
14562
14546
|
}
|
|
14563
14547
|
];
|
|
14564
14548
|
if (isPlanEnabled) {
|
|
14565
14549
|
modes.push({
|
|
14566
|
-
id:
|
|
14550
|
+
id: "plan" /* PLAN */,
|
|
14567
14551
|
name: "Plan",
|
|
14568
14552
|
description: "Read-only mode"
|
|
14569
14553
|
});
|
|
@@ -14576,7 +14560,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14576
14560
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14577
14561
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
14578
14562
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14579
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14563
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
14580
14564
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14581
14565
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14582
14566
|
useGemini3_1: useGemini31,
|
|
@@ -14662,11 +14646,11 @@ var Session = class {
|
|
|
14662
14646
|
this.connection = connection;
|
|
14663
14647
|
this.settings = settings;
|
|
14664
14648
|
coreEvents.on(
|
|
14665
|
-
|
|
14649
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
14666
14650
|
this.handleApprovalModeChanged
|
|
14667
14651
|
);
|
|
14668
14652
|
this.context.config.getMessageBus()?.subscribe(
|
|
14669
|
-
|
|
14653
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
14670
14654
|
this.handleToolConfirmationRequest,
|
|
14671
14655
|
{ signal: this.disposeController.signal }
|
|
14672
14656
|
);
|
|
@@ -14690,7 +14674,7 @@ var Session = class {
|
|
|
14690
14674
|
"Policy engine missing. Denying tool confirmation request."
|
|
14691
14675
|
);
|
|
14692
14676
|
await messageBus.publish({
|
|
14693
|
-
type:
|
|
14677
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14694
14678
|
correlationId: request.correlationId,
|
|
14695
14679
|
confirmed: false,
|
|
14696
14680
|
requiresUserConfirmation: false
|
|
@@ -14703,7 +14687,7 @@ var Session = class {
|
|
|
14703
14687
|
"Tool confirmation request missing tool name. Denying."
|
|
14704
14688
|
);
|
|
14705
14689
|
await messageBus.publish({
|
|
14706
|
-
type:
|
|
14690
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14707
14691
|
correlationId: request.correlationId,
|
|
14708
14692
|
confirmed: false,
|
|
14709
14693
|
requiresUserConfirmation: false
|
|
@@ -14716,7 +14700,7 @@ var Session = class {
|
|
|
14716
14700
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
14717
14701
|
);
|
|
14718
14702
|
await messageBus.publish({
|
|
14719
|
-
type:
|
|
14703
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14720
14704
|
correlationId: request.correlationId,
|
|
14721
14705
|
confirmed: false,
|
|
14722
14706
|
requiresUserConfirmation: false
|
|
@@ -14732,15 +14716,15 @@ var Session = class {
|
|
|
14732
14716
|
request.subagent
|
|
14733
14717
|
);
|
|
14734
14718
|
await messageBus.publish({
|
|
14735
|
-
type:
|
|
14719
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14736
14720
|
correlationId: request.correlationId,
|
|
14737
|
-
confirmed: result.decision ===
|
|
14738
|
-
requiresUserConfirmation: result.decision ===
|
|
14721
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
14722
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
14739
14723
|
});
|
|
14740
14724
|
} catch (error) {
|
|
14741
14725
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
14742
14726
|
await this.context.config.getMessageBus()?.publish({
|
|
14743
|
-
type:
|
|
14727
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14744
14728
|
correlationId: request.correlationId,
|
|
14745
14729
|
confirmed: false,
|
|
14746
14730
|
requiresUserConfirmation: false
|
|
@@ -14760,7 +14744,7 @@ var Session = class {
|
|
|
14760
14744
|
};
|
|
14761
14745
|
dispose() {
|
|
14762
14746
|
coreEvents.off(
|
|
14763
|
-
|
|
14747
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
14764
14748
|
this.handleApprovalModeChanged
|
|
14765
14749
|
);
|
|
14766
14750
|
this.disposeController.abort();
|
|
@@ -14849,7 +14833,7 @@ ${thought.description}`;
|
|
|
14849
14833
|
await this.sendUpdate({
|
|
14850
14834
|
sessionUpdate: "tool_call",
|
|
14851
14835
|
toolCallId: toolCall.id,
|
|
14852
|
-
status: toolCall.status ===
|
|
14836
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
14853
14837
|
title: toolCall.displayName || toolCall.name,
|
|
14854
14838
|
content: toolCallContent,
|
|
14855
14839
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14941,7 +14925,7 @@ ${thought.description}`;
|
|
|
14941
14925
|
return { stopReason: "cancelled" };
|
|
14942
14926
|
}
|
|
14943
14927
|
switch (event.type) {
|
|
14944
|
-
case
|
|
14928
|
+
case "content" /* Content */: {
|
|
14945
14929
|
const content = {
|
|
14946
14930
|
type: "text",
|
|
14947
14931
|
text: event.value
|
|
@@ -14952,7 +14936,7 @@ ${thought.description}`;
|
|
|
14952
14936
|
});
|
|
14953
14937
|
break;
|
|
14954
14938
|
}
|
|
14955
|
-
case
|
|
14939
|
+
case "thought" /* Thought */: {
|
|
14956
14940
|
const thoughtText = `**${event.value.subject}**
|
|
14957
14941
|
${event.value.description}`;
|
|
14958
14942
|
await this.sendUpdate({
|
|
@@ -14961,10 +14945,10 @@ ${event.value.description}`;
|
|
|
14961
14945
|
});
|
|
14962
14946
|
break;
|
|
14963
14947
|
}
|
|
14964
|
-
case
|
|
14948
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14965
14949
|
toolCallRequests.push(event.value);
|
|
14966
14950
|
break;
|
|
14967
|
-
case
|
|
14951
|
+
case "finished" /* Finished */: {
|
|
14968
14952
|
const usage2 = event.value.usageMetadata;
|
|
14969
14953
|
if (usage2) {
|
|
14970
14954
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14972,19 +14956,19 @@ ${event.value.description}`;
|
|
|
14972
14956
|
}
|
|
14973
14957
|
break;
|
|
14974
14958
|
}
|
|
14975
|
-
case
|
|
14959
|
+
case "model_info" /* ModelInfo */:
|
|
14976
14960
|
turnModelId = event.value;
|
|
14977
14961
|
break;
|
|
14978
|
-
case
|
|
14962
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
14979
14963
|
stopReason = "max_turn_requests";
|
|
14980
14964
|
break;
|
|
14981
|
-
case
|
|
14965
|
+
case "loop_detected" /* LoopDetected */:
|
|
14982
14966
|
stopReason = "max_turn_requests";
|
|
14983
14967
|
break;
|
|
14984
|
-
case
|
|
14968
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14985
14969
|
stopReason = "max_tokens";
|
|
14986
14970
|
break;
|
|
14987
|
-
case
|
|
14971
|
+
case "error" /* Error */: {
|
|
14988
14972
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14989
14973
|
event.value.error
|
|
14990
14974
|
);
|
|
@@ -15212,7 +15196,7 @@ ${event.value.description}`;
|
|
|
15212
15196
|
const output = RequestPermissionResponseSchema.parse(
|
|
15213
15197
|
await this.connection.requestPermission(params)
|
|
15214
15198
|
);
|
|
15215
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15199
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15216
15200
|
await confirmationDetails.onConfirm(outcome);
|
|
15217
15201
|
await updatePolicy(
|
|
15218
15202
|
tool,
|
|
@@ -15223,16 +15207,16 @@ ${event.value.description}`;
|
|
|
15223
15207
|
invocation
|
|
15224
15208
|
);
|
|
15225
15209
|
switch (outcome) {
|
|
15226
|
-
case
|
|
15210
|
+
case "cancel" /* Cancel */:
|
|
15227
15211
|
return errorResponse(
|
|
15228
15212
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
15229
15213
|
);
|
|
15230
|
-
case
|
|
15231
|
-
case
|
|
15232
|
-
case
|
|
15233
|
-
case
|
|
15234
|
-
case
|
|
15235
|
-
case
|
|
15214
|
+
case "proceed_once" /* ProceedOnce */:
|
|
15215
|
+
case "proceed_always" /* ProceedAlways */:
|
|
15216
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
15217
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
15218
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
15219
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
15236
15220
|
break;
|
|
15237
15221
|
default: {
|
|
15238
15222
|
const resultOutcome = outcome;
|
|
@@ -15286,7 +15270,7 @@ ${event.value.description}`;
|
|
|
15286
15270
|
);
|
|
15287
15271
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15288
15272
|
{
|
|
15289
|
-
status:
|
|
15273
|
+
status: "success" /* Success */,
|
|
15290
15274
|
request: {
|
|
15291
15275
|
callId,
|
|
15292
15276
|
name: fc.name,
|
|
@@ -15331,7 +15315,7 @@ ${event.value.description}`;
|
|
|
15331
15315
|
});
|
|
15332
15316
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15333
15317
|
{
|
|
15334
|
-
status:
|
|
15318
|
+
status: "error" /* Error */,
|
|
15335
15319
|
request: {
|
|
15336
15320
|
callId,
|
|
15337
15321
|
name: fc.name,
|
|
@@ -15459,12 +15443,12 @@ ${event.value.description}`;
|
|
|
15459
15443
|
sessionId: this.id,
|
|
15460
15444
|
options: [
|
|
15461
15445
|
{
|
|
15462
|
-
optionId:
|
|
15446
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
15463
15447
|
name: "Allow once",
|
|
15464
15448
|
kind: "allow_once"
|
|
15465
15449
|
},
|
|
15466
15450
|
{
|
|
15467
|
-
optionId:
|
|
15451
|
+
optionId: "cancel" /* Cancel */,
|
|
15468
15452
|
name: "Deny",
|
|
15469
15453
|
kind: "reject_once"
|
|
15470
15454
|
}
|
|
@@ -15489,8 +15473,8 @@ ${event.value.description}`;
|
|
|
15489
15473
|
const output = RequestPermissionResponseSchema.parse(
|
|
15490
15474
|
await this.connection.requestPermission(params)
|
|
15491
15475
|
);
|
|
15492
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15493
|
-
if (outcome ===
|
|
15476
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15477
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
15494
15478
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15495
15479
|
validationError = null;
|
|
15496
15480
|
} else {
|
|
@@ -15927,7 +15911,7 @@ var AcpSessionManager = class {
|
|
|
15927
15911
|
mcpServers,
|
|
15928
15912
|
loadedSettings
|
|
15929
15913
|
);
|
|
15930
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15914
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
15931
15915
|
let isAuthenticated = false;
|
|
15932
15916
|
let authErrorMessage = "";
|
|
15933
15917
|
try {
|
|
@@ -15939,7 +15923,7 @@ var AcpSessionManager = class {
|
|
|
15939
15923
|
);
|
|
15940
15924
|
isAuthenticated = true;
|
|
15941
15925
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15942
|
-
if (authType ===
|
|
15926
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15943
15927
|
isAuthenticated = false;
|
|
15944
15928
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15945
15929
|
}
|
|
@@ -16048,7 +16032,7 @@ var AcpSessionManager = class {
|
|
|
16048
16032
|
return response;
|
|
16049
16033
|
}
|
|
16050
16034
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16051
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16035
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
16052
16036
|
if (!selectedAuthType) {
|
|
16053
16037
|
throw RequestError.authRequired();
|
|
16054
16038
|
}
|
|
@@ -16149,12 +16133,12 @@ var GeminiAgent = class {
|
|
|
16149
16133
|
}
|
|
16150
16134
|
const authMethods = [
|
|
16151
16135
|
{
|
|
16152
|
-
id:
|
|
16136
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
16153
16137
|
name: "Log in with Google",
|
|
16154
16138
|
description: "Log in with your Google account"
|
|
16155
16139
|
},
|
|
16156
16140
|
{
|
|
16157
|
-
id:
|
|
16141
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
16158
16142
|
name: "Gemini API key",
|
|
16159
16143
|
description: "Use an API key with Gemini Developer API",
|
|
16160
16144
|
_meta: {
|
|
@@ -16164,12 +16148,12 @@ var GeminiAgent = class {
|
|
|
16164
16148
|
}
|
|
16165
16149
|
},
|
|
16166
16150
|
{
|
|
16167
|
-
id:
|
|
16151
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
16168
16152
|
name: "Vertex AI",
|
|
16169
16153
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16170
16154
|
},
|
|
16171
16155
|
{
|
|
16172
|
-
id:
|
|
16156
|
+
id: "gateway" /* GATEWAY */,
|
|
16173
16157
|
name: "AI API Gateway",
|
|
16174
16158
|
description: "Use a custom AI API Gateway",
|
|
16175
16159
|
_meta: {
|
|
@@ -16342,7 +16326,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16342
16326
|
}
|
|
16343
16327
|
return authType;
|
|
16344
16328
|
} catch (error) {
|
|
16345
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16329
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
16346
16330
|
handleError(
|
|
16347
16331
|
error instanceof Error ? error : new Error(String(error)),
|
|
16348
16332
|
nonInteractiveConfig,
|
|
@@ -16537,10 +16521,10 @@ var SlashCommandConflictHandler = class {
|
|
|
16537
16521
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
16538
16522
|
}
|
|
16539
16523
|
start() {
|
|
16540
|
-
coreEvents.on(
|
|
16524
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
16541
16525
|
}
|
|
16542
16526
|
stop() {
|
|
16543
|
-
coreEvents.off(
|
|
16527
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
16544
16528
|
if (this.flushTimeout) {
|
|
16545
16529
|
clearTimeout(this.flushTimeout);
|
|
16546
16530
|
this.flushTimeout = null;
|
|
@@ -16821,7 +16805,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16821
16805
|
}
|
|
16822
16806
|
}
|
|
16823
16807
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
16824
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
16808
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-RIVGDZH4.js");
|
|
16825
16809
|
await doStartUI(
|
|
16826
16810
|
config,
|
|
16827
16811
|
settings,
|
|
@@ -16924,12 +16908,12 @@ async function main() {
|
|
|
16924
16908
|
dns.setDefaultResultOrder(
|
|
16925
16909
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16926
16910
|
);
|
|
16927
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16911
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
16928
16912
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16929
16913
|
settings.setValue(
|
|
16930
16914
|
"User" /* User */,
|
|
16931
16915
|
"security.auth.selectedType",
|
|
16932
|
-
|
|
16916
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
16933
16917
|
);
|
|
16934
16918
|
}
|
|
16935
16919
|
}
|
|
@@ -17030,7 +17014,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17030
17014
|
await config.storage.initialize();
|
|
17031
17015
|
adminControlsListner.setConfig(config);
|
|
17032
17016
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17033
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17017
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-MHCZCWFY.js");
|
|
17034
17018
|
setupInitialActivityLogger(config);
|
|
17035
17019
|
}
|
|
17036
17020
|
registerTelemetryConfig(config);
|
|
@@ -17038,7 +17022,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17038
17022
|
const messageBus = config.getMessageBus();
|
|
17039
17023
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17040
17024
|
registerCleanup(async () => {
|
|
17041
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17025
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
17042
17026
|
});
|
|
17043
17027
|
if (!config.getAcpMode()) {
|
|
17044
17028
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17089,7 +17073,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17089
17073
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17090
17074
|
const initializationResult = await initializeApp(config, settings);
|
|
17091
17075
|
initAppHandle?.end();
|
|
17092
|
-
import("./liteRtServerManager-
|
|
17076
|
+
import("./liteRtServerManager-ALSWB4ZD.js").then(({ LiteRtServerManager }) => {
|
|
17093
17077
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17094
17078
|
if (!mergedGemma) return;
|
|
17095
17079
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17099,7 +17083,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17099
17083
|
autoStartServer: userGemma?.autoStartServer
|
|
17100
17084
|
});
|
|
17101
17085
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17102
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17086
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
17103
17087
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17104
17088
|
}
|
|
17105
17089
|
if (config.getAcpMode()) {
|
|
@@ -17115,7 +17099,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17115
17099
|
...rawStartupWarnings.map((message) => ({
|
|
17116
17100
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17117
17101
|
message,
|
|
17118
|
-
priority:
|
|
17102
|
+
priority: "high" /* High */
|
|
17119
17103
|
})),
|
|
17120
17104
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17121
17105
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17152,7 +17136,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17152
17136
|
${input}` : stdinData;
|
|
17153
17137
|
}
|
|
17154
17138
|
}
|
|
17155
|
-
const sessionStartSource = resumedSessionData ?
|
|
17139
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
17156
17140
|
const hookSystem = config?.getHookSystem();
|
|
17157
17141
|
if (hookSystem) {
|
|
17158
17142
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17209,8 +17193,8 @@ ${input}` : wrappedContext;
|
|
|
17209
17193
|
}
|
|
17210
17194
|
}
|
|
17211
17195
|
function initializeOutputListenersAndFlush(config) {
|
|
17212
|
-
if (coreEvents.listenerCount(
|
|
17213
|
-
coreEvents.on(
|
|
17196
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
17197
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
17214
17198
|
if (payload.isStderr) {
|
|
17215
17199
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17216
17200
|
} else {
|
|
@@ -17218,8 +17202,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17218
17202
|
}
|
|
17219
17203
|
});
|
|
17220
17204
|
}
|
|
17221
|
-
if (coreEvents.listenerCount(
|
|
17222
|
-
coreEvents.on(
|
|
17205
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
17206
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
17223
17207
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17224
17208
|
writeToStderr(payload.content + "\n");
|
|
17225
17209
|
} else {
|
|
@@ -17227,8 +17211,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17227
17211
|
}
|
|
17228
17212
|
});
|
|
17229
17213
|
}
|
|
17230
|
-
if (coreEvents.listenerCount(
|
|
17231
|
-
coreEvents.on(
|
|
17214
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
17215
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
17232
17216
|
writeToStderr(payload.message + "\n");
|
|
17233
17217
|
});
|
|
17234
17218
|
}
|
|
@@ -17236,7 +17220,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17236
17220
|
const forceToStderr = outputFormat === "json";
|
|
17237
17221
|
coreEvents.drainBacklogs(
|
|
17238
17222
|
(event, args) => {
|
|
17239
|
-
if (forceToStderr && event ===
|
|
17223
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
17240
17224
|
const payload = args[0];
|
|
17241
17225
|
if (!payload.isStderr) {
|
|
17242
17226
|
return {
|