@google/gemini-cli 0.54.0-preview.1 → 0.54.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-525VQXSC.js → chunk-2MRUXBJ5.js} +7 -7
- package/bundle/{chunk-JIT42EQ2.js → chunk-43HYOV6F.js} +1 -1
- package/bundle/{chunk-DPIHBZAT.js → chunk-5SMD2SLQ.js} +2 -2
- package/bundle/{chunk-SBSLQYOV.js → chunk-BBNFLOXC.js} +1 -1
- package/bundle/{chunk-OGXJPYSG.js → chunk-F6IU45OZ.js} +4 -4
- package/bundle/{chunk-UZMDXL7Q.js → chunk-G7VQ6O6G.js} +1 -1
- package/bundle/{chunk-DIJ6I3G3.js → chunk-GOQJOV4P.js} +1 -1
- package/bundle/{chunk-TNVY3HW2.js → chunk-HS7THREL.js} +4 -4
- package/bundle/{chunk-FMTFTARW.js → chunk-IM5WJKYT.js} +1 -1
- package/bundle/{chunk-VA3G5QBP.js → chunk-JPCDQXHB.js} +1 -1
- package/bundle/{chunk-IYJYJHOC.js → chunk-LH73BY77.js} +7 -7
- package/bundle/{chunk-CULEIHKX.js → chunk-MOGTJC2T.js} +1 -1
- package/bundle/{chunk-SMLDN56O.js → chunk-MZBH35ZS.js} +1 -1
- package/bundle/{chunk-PEJMTAMT.js → chunk-NZ6P6XKP.js} +2 -2
- package/bundle/{chunk-D2EAX3ZX.js → chunk-OYZ2XVON.js} +3 -3
- package/bundle/{chunk-MSUXP6KY.js → chunk-RHINAWEP.js} +54 -67
- package/bundle/{chunk-FXXIWHGQ.js → chunk-SHZORH3T.js} +1 -1
- package/bundle/{chunk-Z62YA2V7.js → chunk-SQWRALPF.js} +1 -1
- package/bundle/{chunk-T6U6FIO7.js → chunk-TZAOURRV.js} +8 -9
- package/bundle/{chunk-RCBLHUUY.js → chunk-UTXCUPDT.js} +2 -2
- package/bundle/{chunk-K3SJRITH.js → chunk-UW4NSSB6.js} +3 -3
- package/bundle/{chunk-AFGG2RPD.js → chunk-VIQEWLM4.js} +5 -8
- package/bundle/{chunk-RDYXVWPW.js → chunk-WJKZRJIC.js} +3 -3
- package/bundle/{chunk-RO4LFQ22.js → chunk-YYWWE5GW.js} +14263 -7626
- package/bundle/{cleanup-HQV2IFKH.js → cleanup-5UYKVLIF.js} +2 -2
- package/bundle/{cleanup-L5VWLPP4.js → cleanup-6OO5MA6W.js} +2 -2
- package/bundle/{cleanup-XXP2E7MI.js → cleanup-ODOGWYRM.js} +2 -2
- package/bundle/{core-57QOTUGQ.js → core-JL633Z4N.js} +1 -1
- package/bundle/{dist-47AO7W6O.js → core-S5B3NEKC.js} +1 -1
- package/bundle/{devtoolsService-ZSEA3CMZ.js → devtoolsService-FUTPYP6V.js} +2 -2
- package/bundle/{devtoolsService-3CR2FLT6.js → devtoolsService-NZQZUVCI.js} +3 -4
- package/bundle/{devtoolsService-35UP55Q3.js → devtoolsService-YWNTGRUE.js} +2 -2
- package/bundle/{dist-H6O2HKLX.js → dist-DB6LWOKZ.js} +1 -1
- package/bundle/{gemini-LO7DND33.js → gemini-AQASGK5V.js} +14 -14
- package/bundle/{gemini-UCXGGSBW.js → gemini-D3BRVDVJ.js} +14 -14
- package/bundle/{gemini-IDZJKL5P.js → gemini-PPNY5YY6.js} +198 -214
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-6R7JZJ2X.js → interactiveCli-CXCZMXKQ.js} +8 -8
- package/bundle/{interactiveCli-TRSGHNSO.js → interactiveCli-P7QQLIDS.js} +8 -8
- package/bundle/{interactiveCli-EHIAN3B3.js → interactiveCli-RU7LCVXL.js} +296 -315
- package/bundle/{liteRtServerManager-3VYWFFDR.js → liteRtServerManager-FIVLVXQJ.js} +4 -4
- package/bundle/{liteRtServerManager-E5CRSVVL.js → liteRtServerManager-ISKYY742.js} +4 -4
- package/bundle/{liteRtServerManager-VFS4GSUO.js → liteRtServerManager-MPPOFOTR.js} +4 -4
- package/bundle/{oauth2-provider-66YNXHST.js → oauth2-provider-DOIL6PEC.js} +1 -1
- package/bundle/{oauth2-provider-3UXFRSIK.js → oauth2-provider-G6DF4NEU.js} +1 -1
- package/bundle/{oauth2-provider-54DMURL5.js → oauth2-provider-XR5UQYQV.js} +72 -38
- package/bundle/{start-2X7CSHIJ.js → start-AJW7OVPU.js} +6 -6
- package/bundle/{start-JT4SJ6FO.js → start-S77W5RNK.js} +6 -6
- package/bundle/{start-LZJM7TIF.js → start-YWT3TSZW.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-CVUISPMN.js +0 -398
- package/bundle/chunk-IO55T6DE.js +0 -118
- package/bundle/chunk-TTNCL6R2.js +0 -154
- package/bundle/chunk-UUIODUV3.js +0 -102505
- package/bundle/chunk-XE7YFMNO.js +0 -1571
- package/bundle/chunk-YDQPFZ2Y.js +0 -512
- package/bundle/chunk-ZHTU5ILJ.js +0 -397085
- package/bundle/chunk-ZPRVIRJI.js +0 -17332
- package/bundle/cleanup-ZVT5D3O6.js +0 -32
- package/bundle/devtoolsService-6ODDI2AX.js +0 -4359
- package/bundle/dist-OQCDYU7F.js +0 -2170
- package/bundle/gemini-HAONW54R.js +0 -16491
- package/bundle/interactiveCli-3ACLI4L7.js +0 -34906
- package/bundle/liteRtServerManager-XWQ4FJKY.js +0 -65
- package/bundle/oauth2-provider-JGXWLD5K.js +0 -235
- package/bundle/start-YHTESBGR.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-UW4NSSB6.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-RHINAWEP.js";
|
|
49
49
|
import {
|
|
50
50
|
exitCli,
|
|
51
51
|
require_source
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-BBNFLOXC.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-VIQEWLM4.js";
|
|
91
91
|
import {
|
|
92
92
|
RELAUNCH_EXIT_CODE
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
93
|
+
} from "./chunk-UTXCUPDT.js";
|
|
94
|
+
import "./chunk-SQWRALPF.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-43HYOV6F.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,
|
|
@@ -253,7 +237,7 @@ import {
|
|
|
253
237
|
updatePolicy,
|
|
254
238
|
writeToStderr,
|
|
255
239
|
writeToStdout
|
|
256
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-HS7THREL.js";
|
|
257
241
|
import "./chunk-664ZODQF.js";
|
|
258
242
|
import "./chunk-IUUIT4SU.js";
|
|
259
243
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -5383,7 +5367,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5383
5367
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5384
5368
|
const isStdio = !!config.command;
|
|
5385
5369
|
if (isStdio && !isTrusted) {
|
|
5386
|
-
return
|
|
5370
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5387
5371
|
}
|
|
5388
5372
|
const client = new Client({
|
|
5389
5373
|
name: "mcp-test-client",
|
|
@@ -5419,7 +5403,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5419
5403
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5420
5404
|
} catch {
|
|
5421
5405
|
await client.close();
|
|
5422
|
-
return
|
|
5406
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5423
5407
|
}
|
|
5424
5408
|
try {
|
|
5425
5409
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5433,10 +5417,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5433
5417
|
);
|
|
5434
5418
|
}
|
|
5435
5419
|
await client.close();
|
|
5436
|
-
return
|
|
5420
|
+
return "connected" /* CONNECTED */;
|
|
5437
5421
|
} catch {
|
|
5438
5422
|
await transport.close();
|
|
5439
|
-
return
|
|
5423
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5440
5424
|
}
|
|
5441
5425
|
}
|
|
5442
5426
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5449,12 +5433,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5449
5433
|
});
|
|
5450
5434
|
if (!loadResult.allowed) {
|
|
5451
5435
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5452
|
-
return
|
|
5436
|
+
return "blocked" /* BLOCKED */;
|
|
5453
5437
|
}
|
|
5454
|
-
return
|
|
5438
|
+
return "disabled" /* DISABLED */;
|
|
5455
5439
|
}
|
|
5456
5440
|
if (!isTrusted) {
|
|
5457
|
-
return
|
|
5441
|
+
return "disabled" /* DISABLED */;
|
|
5458
5442
|
}
|
|
5459
5443
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5460
5444
|
}
|
|
@@ -5500,23 +5484,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5500
5484
|
let statusIndicator = "";
|
|
5501
5485
|
let statusText = "";
|
|
5502
5486
|
switch (status) {
|
|
5503
|
-
case
|
|
5487
|
+
case "connected" /* CONNECTED */:
|
|
5504
5488
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5505
5489
|
statusText = "Connected";
|
|
5506
5490
|
break;
|
|
5507
|
-
case
|
|
5491
|
+
case "connecting" /* CONNECTING */:
|
|
5508
5492
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5509
5493
|
statusText = "Connecting";
|
|
5510
5494
|
break;
|
|
5511
|
-
case
|
|
5495
|
+
case "blocked" /* BLOCKED */:
|
|
5512
5496
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5513
5497
|
statusText = "Blocked";
|
|
5514
5498
|
break;
|
|
5515
|
-
case
|
|
5499
|
+
case "disabled" /* DISABLED */:
|
|
5516
5500
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5517
5501
|
statusText = "Disabled";
|
|
5518
5502
|
break;
|
|
5519
|
-
case
|
|
5503
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5520
5504
|
default:
|
|
5521
5505
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5522
5506
|
statusText = "Disconnected";
|
|
@@ -5802,7 +5786,7 @@ async function handleInstall(args) {
|
|
|
5802
5786
|
);
|
|
5803
5787
|
if (confirmed) {
|
|
5804
5788
|
const trustedFolders = loadTrustedFolders();
|
|
5805
|
-
await trustedFolders.setValue(realPath,
|
|
5789
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5806
5790
|
} else {
|
|
5807
5791
|
throw new Error(
|
|
5808
5792
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -7847,7 +7831,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7847
7831
|
}
|
|
7848
7832
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7849
7833
|
const packageJson = await getPackageJson(__dirname3);
|
|
7850
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.54.0
|
|
7834
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.54.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7851
7835
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7852
7836
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7853
7837
|
}
|
|
@@ -7906,9 +7890,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7906
7890
|
cwd,
|
|
7907
7891
|
potentialWorkspacePoliciesDir
|
|
7908
7892
|
);
|
|
7909
|
-
if (integrityResult.status ===
|
|
7893
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7910
7894
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7911
|
-
} else if (integrityResult.status ===
|
|
7895
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7912
7896
|
workspacePoliciesDir = void 0;
|
|
7913
7897
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7914
7898
|
policyUpdateConfirmationRequest = {
|
|
@@ -8336,23 +8320,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8336
8320
|
if (rawApprovalMode) {
|
|
8337
8321
|
switch (rawApprovalMode) {
|
|
8338
8322
|
case "yolo":
|
|
8339
|
-
approvalMode =
|
|
8323
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8340
8324
|
break;
|
|
8341
8325
|
case "auto_edit":
|
|
8342
|
-
approvalMode =
|
|
8326
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8343
8327
|
break;
|
|
8344
8328
|
case "plan":
|
|
8345
8329
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8346
8330
|
debugLogger.warn(
|
|
8347
8331
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8348
8332
|
);
|
|
8349
|
-
approvalMode =
|
|
8333
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8350
8334
|
} else {
|
|
8351
|
-
approvalMode =
|
|
8335
|
+
approvalMode = "plan" /* PLAN */;
|
|
8352
8336
|
}
|
|
8353
8337
|
break;
|
|
8354
8338
|
case "default":
|
|
8355
|
-
approvalMode =
|
|
8339
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8356
8340
|
break;
|
|
8357
8341
|
default:
|
|
8358
8342
|
throw new Error(
|
|
@@ -8360,10 +8344,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8360
8344
|
);
|
|
8361
8345
|
}
|
|
8362
8346
|
} else {
|
|
8363
|
-
approvalMode =
|
|
8347
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8364
8348
|
}
|
|
8365
8349
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8366
|
-
if (approvalMode ===
|
|
8350
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8367
8351
|
if (settings.admin?.secureModeEnabled) {
|
|
8368
8352
|
debugLogger.error(
|
|
8369
8353
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8381,16 +8365,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8381
8365
|
)
|
|
8382
8366
|
);
|
|
8383
8367
|
}
|
|
8384
|
-
} else if (approvalMode ===
|
|
8368
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8385
8369
|
debugLogger.warn(
|
|
8386
8370
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8387
8371
|
);
|
|
8388
8372
|
}
|
|
8389
|
-
if (!trustedFolder && approvalMode !==
|
|
8373
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8390
8374
|
debugLogger.warn(
|
|
8391
8375
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8392
8376
|
);
|
|
8393
|
-
approvalMode =
|
|
8377
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8394
8378
|
}
|
|
8395
8379
|
let telemetrySettings;
|
|
8396
8380
|
try {
|
|
@@ -9828,7 +9812,7 @@ import path9 from "node:path";
|
|
|
9828
9812
|
import process4 from "node:process";
|
|
9829
9813
|
var homeDirectoryCheck = {
|
|
9830
9814
|
id: "home-directory",
|
|
9831
|
-
priority:
|
|
9815
|
+
priority: "low" /* Low */,
|
|
9832
9816
|
check: async (workspaceRoot, settings) => {
|
|
9833
9817
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9834
9818
|
return null;
|
|
@@ -9852,7 +9836,7 @@ var homeDirectoryCheck = {
|
|
|
9852
9836
|
};
|
|
9853
9837
|
var rootDirectoryCheck = {
|
|
9854
9838
|
id: "root-directory",
|
|
9855
|
-
priority:
|
|
9839
|
+
priority: "high" /* High */,
|
|
9856
9840
|
check: async (workspaceRoot, _settings) => {
|
|
9857
9841
|
try {
|
|
9858
9842
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
@@ -9868,7 +9852,7 @@ var rootDirectoryCheck = {
|
|
|
9868
9852
|
};
|
|
9869
9853
|
var folderTrustCheck = {
|
|
9870
9854
|
id: "folder-trust",
|
|
9871
|
-
priority:
|
|
9855
|
+
priority: "high" /* High */,
|
|
9872
9856
|
check: async (workspaceRoot, settings) => {
|
|
9873
9857
|
if (!isFolderTrustEnabled(settings)) {
|
|
9874
9858
|
return null;
|
|
@@ -10058,12 +10042,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10058
10042
|
error,
|
|
10059
10043
|
config.getContentGeneratorConfig()?.authType
|
|
10060
10044
|
);
|
|
10061
|
-
if (config.getOutputFormat() ===
|
|
10045
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10062
10046
|
const streamFormatter = new StreamJsonFormatter();
|
|
10063
10047
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10064
10048
|
const metrics = uiTelemetryService.getMetrics();
|
|
10065
10049
|
streamFormatter.emitEvent({
|
|
10066
|
-
type:
|
|
10050
|
+
type: "result" /* RESULT */,
|
|
10067
10051
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10068
10052
|
status: "error",
|
|
10069
10053
|
error: {
|
|
@@ -10074,7 +10058,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10074
10058
|
});
|
|
10075
10059
|
runSyncCleanup();
|
|
10076
10060
|
process.exit(getNumericExitCode(errorCode));
|
|
10077
|
-
} else if (config.getOutputFormat() ===
|
|
10061
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10078
10062
|
const formatter = new JsonFormatter();
|
|
10079
10063
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10080
10064
|
const formattedError = formatter.formatError(
|
|
@@ -10094,11 +10078,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10094
10078
|
const isFatal = isFatalToolError(errorType);
|
|
10095
10079
|
if (isFatal) {
|
|
10096
10080
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10097
|
-
if (config.getOutputFormat() ===
|
|
10081
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10098
10082
|
const streamFormatter = new StreamJsonFormatter();
|
|
10099
10083
|
const metrics = uiTelemetryService.getMetrics();
|
|
10100
10084
|
streamFormatter.emitEvent({
|
|
10101
|
-
type:
|
|
10085
|
+
type: "result" /* RESULT */,
|
|
10102
10086
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10103
10087
|
status: "error",
|
|
10104
10088
|
error: {
|
|
@@ -10107,7 +10091,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10107
10091
|
},
|
|
10108
10092
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10109
10093
|
});
|
|
10110
|
-
} else if (config.getOutputFormat() ===
|
|
10094
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10111
10095
|
const formatter = new JsonFormatter();
|
|
10112
10096
|
const formattedError = formatter.formatError(
|
|
10113
10097
|
toolExecutionError,
|
|
@@ -10125,11 +10109,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10125
10109
|
}
|
|
10126
10110
|
function handleCancellationError(config) {
|
|
10127
10111
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
10128
|
-
if (config.getOutputFormat() ===
|
|
10112
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10129
10113
|
const streamFormatter = new StreamJsonFormatter();
|
|
10130
10114
|
const metrics = uiTelemetryService.getMetrics();
|
|
10131
10115
|
streamFormatter.emitEvent({
|
|
10132
|
-
type:
|
|
10116
|
+
type: "result" /* RESULT */,
|
|
10133
10117
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10134
10118
|
status: "error",
|
|
10135
10119
|
error: {
|
|
@@ -10140,7 +10124,7 @@ function handleCancellationError(config) {
|
|
|
10140
10124
|
});
|
|
10141
10125
|
runSyncCleanup();
|
|
10142
10126
|
process.exit(cancellationError.exitCode);
|
|
10143
|
-
} else if (config.getOutputFormat() ===
|
|
10127
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10144
10128
|
const formatter = new JsonFormatter();
|
|
10145
10129
|
const formattedError = formatter.formatError(
|
|
10146
10130
|
cancellationError,
|
|
@@ -10160,11 +10144,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10160
10144
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
10161
10145
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
10162
10146
|
);
|
|
10163
|
-
if (config.getOutputFormat() ===
|
|
10147
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10164
10148
|
const streamFormatter = new StreamJsonFormatter();
|
|
10165
10149
|
const metrics = uiTelemetryService.getMetrics();
|
|
10166
10150
|
streamFormatter.emitEvent({
|
|
10167
|
-
type:
|
|
10151
|
+
type: "result" /* RESULT */,
|
|
10168
10152
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10169
10153
|
status: "error",
|
|
10170
10154
|
error: {
|
|
@@ -10175,7 +10159,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
10175
10159
|
});
|
|
10176
10160
|
runSyncCleanup();
|
|
10177
10161
|
process.exit(maxTurnsError.exitCode);
|
|
10178
|
-
} else if (config.getOutputFormat() ===
|
|
10162
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10179
10163
|
const formatter = new JsonFormatter();
|
|
10180
10164
|
const formattedError = formatter.formatError(
|
|
10181
10165
|
maxTurnsError,
|
|
@@ -10255,7 +10239,7 @@ async function runNonInteractive({
|
|
|
10255
10239
|
}
|
|
10256
10240
|
});
|
|
10257
10241
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10258
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10242
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-FUTPYP6V.js");
|
|
10259
10243
|
setupInitialActivityLogger(config);
|
|
10260
10244
|
}
|
|
10261
10245
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10271,7 +10255,7 @@ async function runNonInteractive({
|
|
|
10271
10255
|
}
|
|
10272
10256
|
};
|
|
10273
10257
|
const startTime = Date.now();
|
|
10274
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10258
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10275
10259
|
const abortController = new AbortController();
|
|
10276
10260
|
let isAborting = false;
|
|
10277
10261
|
let cancelMessageTimer = null;
|
|
@@ -10324,13 +10308,13 @@ async function runNonInteractive({
|
|
|
10324
10308
|
};
|
|
10325
10309
|
try {
|
|
10326
10310
|
consolePatcher.patch();
|
|
10327
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10311
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10328
10312
|
process.stderr.write(
|
|
10329
10313
|
"[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"
|
|
10330
10314
|
);
|
|
10331
10315
|
}
|
|
10332
10316
|
setupStdinCancellation();
|
|
10333
|
-
coreEvents.on(
|
|
10317
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10334
10318
|
coreEvents.drainBacklogs();
|
|
10335
10319
|
process.stdout.on("error", (err) => {
|
|
10336
10320
|
if (err.code === "EPIPE") {
|
|
@@ -10356,7 +10340,7 @@ async function runNonInteractive({
|
|
|
10356
10340
|
}
|
|
10357
10341
|
if (streamFormatter) {
|
|
10358
10342
|
streamFormatter.emitEvent({
|
|
10359
|
-
type:
|
|
10343
|
+
type: "init" /* INIT */,
|
|
10360
10344
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10361
10345
|
session_id: config.getSessionId(),
|
|
10362
10346
|
model: config.getModel()
|
|
@@ -10394,7 +10378,7 @@ async function runNonInteractive({
|
|
|
10394
10378
|
}
|
|
10395
10379
|
if (streamFormatter) {
|
|
10396
10380
|
streamFormatter.emitEvent({
|
|
10397
|
-
type:
|
|
10381
|
+
type: "message" /* MESSAGE */,
|
|
10398
10382
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10399
10383
|
role: "user",
|
|
10400
10384
|
content: input
|
|
@@ -10433,12 +10417,12 @@ async function runNonInteractive({
|
|
|
10433
10417
|
const metrics = uiTelemetryService.getMetrics();
|
|
10434
10418
|
const durationMs = Date.now() - startTime;
|
|
10435
10419
|
streamFormatter.emitEvent({
|
|
10436
|
-
type:
|
|
10420
|
+
type: "result" /* RESULT */,
|
|
10437
10421
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10438
10422
|
status: errorPayload ? "error" : "success",
|
|
10439
10423
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10440
10424
|
});
|
|
10441
|
-
} else if (config.getOutputFormat() ===
|
|
10425
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10442
10426
|
const formatter = new JsonFormatter();
|
|
10443
10427
|
const stats = uiTelemetryService.getMetrics();
|
|
10444
10428
|
textOutput.write(
|
|
@@ -10531,13 +10515,13 @@ async function runNonInteractive({
|
|
|
10531
10515
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
10532
10516
|
if (streamFormatter) {
|
|
10533
10517
|
streamFormatter.emitEvent({
|
|
10534
|
-
type:
|
|
10518
|
+
type: "message" /* MESSAGE */,
|
|
10535
10519
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10536
10520
|
role: "assistant",
|
|
10537
10521
|
content: output,
|
|
10538
10522
|
delta: true
|
|
10539
10523
|
});
|
|
10540
|
-
} else if (config.getOutputFormat() ===
|
|
10524
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10541
10525
|
responseText += output;
|
|
10542
10526
|
} else {
|
|
10543
10527
|
if (part.text) {
|
|
@@ -10550,13 +10534,13 @@ async function runNonInteractive({
|
|
|
10550
10534
|
break;
|
|
10551
10535
|
}
|
|
10552
10536
|
case "tool_request": {
|
|
10553
|
-
if (config.getOutputFormat() ===
|
|
10537
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10554
10538
|
preToolResponseText = responseText || preToolResponseText;
|
|
10555
10539
|
responseText = "";
|
|
10556
10540
|
}
|
|
10557
10541
|
if (streamFormatter) {
|
|
10558
10542
|
streamFormatter.emitEvent({
|
|
10559
|
-
type:
|
|
10543
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10560
10544
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10561
10545
|
tool_name: event.name,
|
|
10562
10546
|
tool_id: event.requestId,
|
|
@@ -10572,7 +10556,7 @@ async function runNonInteractive({
|
|
|
10572
10556
|
const displayText = displayContentToString(display);
|
|
10573
10557
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10574
10558
|
streamFormatter.emitEvent({
|
|
10575
|
-
type:
|
|
10559
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10576
10560
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10577
10561
|
tool_id: event.requestId,
|
|
10578
10562
|
status: event.isError ? "error" : "success",
|
|
@@ -10587,17 +10571,17 @@ async function runNonInteractive({
|
|
|
10587
10571
|
const display = event.display?.result;
|
|
10588
10572
|
const displayText = displayContentToString(display);
|
|
10589
10573
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
10590
|
-
if (event.data?.["errorType"] ===
|
|
10591
|
-
if (config.getOutputFormat() ===
|
|
10574
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
10575
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
10592
10576
|
responseText = preToolResponseText;
|
|
10593
10577
|
}
|
|
10594
10578
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
10595
|
-
if (config.getOutputFormat() ===
|
|
10579
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10596
10580
|
process.stderr.write(`${stopMessage}
|
|
10597
10581
|
`);
|
|
10598
10582
|
}
|
|
10599
10583
|
}
|
|
10600
|
-
if (event.data?.["errorType"] ===
|
|
10584
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
10601
10585
|
throw new FatalToolExecutionError(
|
|
10602
10586
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
10603
10587
|
);
|
|
@@ -10632,12 +10616,12 @@ async function runNonInteractive({
|
|
|
10632
10616
|
}
|
|
10633
10617
|
if (streamFormatter) {
|
|
10634
10618
|
streamFormatter.emitEvent({
|
|
10635
|
-
type:
|
|
10619
|
+
type: "error" /* ERROR */,
|
|
10636
10620
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10637
10621
|
severity: "error",
|
|
10638
10622
|
message: errorMessage
|
|
10639
10623
|
});
|
|
10640
|
-
} else if (config.getOutputFormat() ===
|
|
10624
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10641
10625
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
10642
10626
|
`);
|
|
10643
10627
|
}
|
|
@@ -10658,12 +10642,12 @@ async function runNonInteractive({
|
|
|
10658
10642
|
const errorCode = event._meta?.["code"];
|
|
10659
10643
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
10660
10644
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
10661
|
-
if (config.getOutputFormat() ===
|
|
10645
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10662
10646
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10663
10647
|
`);
|
|
10664
10648
|
} else if (streamFormatter) {
|
|
10665
10649
|
streamFormatter.emitEvent({
|
|
10666
|
-
type:
|
|
10650
|
+
type: "error" /* ERROR */,
|
|
10667
10651
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10668
10652
|
severity: "warning",
|
|
10669
10653
|
message: stripAnsi(blockMessage)
|
|
@@ -10673,13 +10657,13 @@ async function runNonInteractive({
|
|
|
10673
10657
|
break;
|
|
10674
10658
|
}
|
|
10675
10659
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
10676
|
-
if (config.getOutputFormat() ===
|
|
10660
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10677
10661
|
process.stderr.write(`[WARNING] ${event.message}
|
|
10678
10662
|
`);
|
|
10679
10663
|
}
|
|
10680
10664
|
if (streamFormatter) {
|
|
10681
10665
|
streamFormatter.emitEvent({
|
|
10682
|
-
type:
|
|
10666
|
+
type: "error" /* ERROR */,
|
|
10683
10667
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10684
10668
|
severity,
|
|
10685
10669
|
message: stripAnsi(event.message)
|
|
@@ -10699,7 +10683,7 @@ async function runNonInteractive({
|
|
|
10699
10683
|
);
|
|
10700
10684
|
} else if (streamFormatter) {
|
|
10701
10685
|
streamFormatter.emitEvent({
|
|
10702
|
-
type:
|
|
10686
|
+
type: "error" /* ERROR */,
|
|
10703
10687
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10704
10688
|
severity: "error",
|
|
10705
10689
|
message: "Maximum session turns exceeded"
|
|
@@ -10707,7 +10691,7 @@ async function runNonInteractive({
|
|
|
10707
10691
|
}
|
|
10708
10692
|
}
|
|
10709
10693
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
10710
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
10694
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10711
10695
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
10712
10696
|
`);
|
|
10713
10697
|
}
|
|
@@ -10737,7 +10721,7 @@ async function runNonInteractive({
|
|
|
10737
10721
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
10738
10722
|
scheduler?.dispose();
|
|
10739
10723
|
consolePatcher.cleanup();
|
|
10740
|
-
coreEvents.off(
|
|
10724
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10741
10725
|
}
|
|
10742
10726
|
if (errorToHandle) {
|
|
10743
10727
|
handleError(errorToHandle, config);
|
|
@@ -10765,7 +10749,7 @@ async function runNonInteractive2(params) {
|
|
|
10765
10749
|
}
|
|
10766
10750
|
});
|
|
10767
10751
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10768
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10752
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-FUTPYP6V.js");
|
|
10769
10753
|
setupInitialActivityLogger(config);
|
|
10770
10754
|
}
|
|
10771
10755
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10781,7 +10765,7 @@ async function runNonInteractive2(params) {
|
|
|
10781
10765
|
}
|
|
10782
10766
|
};
|
|
10783
10767
|
const startTime = Date.now();
|
|
10784
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10768
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10785
10769
|
const abortController = new AbortController();
|
|
10786
10770
|
let isAborting = false;
|
|
10787
10771
|
let cancelMessageTimer = null;
|
|
@@ -10832,13 +10816,13 @@ async function runNonInteractive2(params) {
|
|
|
10832
10816
|
let scheduler;
|
|
10833
10817
|
try {
|
|
10834
10818
|
consolePatcher.patch();
|
|
10835
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10819
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10836
10820
|
process.stderr.write(
|
|
10837
10821
|
"[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"
|
|
10838
10822
|
);
|
|
10839
10823
|
}
|
|
10840
10824
|
setupStdinCancellation();
|
|
10841
|
-
coreEvents.on(
|
|
10825
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10842
10826
|
coreEvents.drainBacklogs();
|
|
10843
10827
|
process.stdout.on("error", (err) => {
|
|
10844
10828
|
if (err.code === "EPIPE") {
|
|
@@ -10862,7 +10846,7 @@ async function runNonInteractive2(params) {
|
|
|
10862
10846
|
}
|
|
10863
10847
|
if (streamFormatter) {
|
|
10864
10848
|
streamFormatter.emitEvent({
|
|
10865
|
-
type:
|
|
10849
|
+
type: "init" /* INIT */,
|
|
10866
10850
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10867
10851
|
session_id: config.getSessionId(),
|
|
10868
10852
|
model: config.getModel()
|
|
@@ -10900,7 +10884,7 @@ async function runNonInteractive2(params) {
|
|
|
10900
10884
|
}
|
|
10901
10885
|
if (streamFormatter) {
|
|
10902
10886
|
streamFormatter.emitEvent({
|
|
10903
|
-
type:
|
|
10887
|
+
type: "message" /* MESSAGE */,
|
|
10904
10888
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10905
10889
|
role: "user",
|
|
10906
10890
|
content: input
|
|
@@ -10928,28 +10912,28 @@ async function runNonInteractive2(params) {
|
|
|
10928
10912
|
if (abortController.signal.aborted) {
|
|
10929
10913
|
handleCancellationError(config);
|
|
10930
10914
|
}
|
|
10931
|
-
if (event.type ===
|
|
10915
|
+
if (event.type === "content" /* Content */) {
|
|
10932
10916
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10933
10917
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10934
10918
|
if (streamFormatter) {
|
|
10935
10919
|
streamFormatter.emitEvent({
|
|
10936
|
-
type:
|
|
10920
|
+
type: "message" /* MESSAGE */,
|
|
10937
10921
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10938
10922
|
role: "assistant",
|
|
10939
10923
|
content: output,
|
|
10940
10924
|
delta: true
|
|
10941
10925
|
});
|
|
10942
|
-
} else if (config.getOutputFormat() ===
|
|
10926
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10943
10927
|
responseText += output;
|
|
10944
10928
|
} else {
|
|
10945
10929
|
if (event.value) {
|
|
10946
10930
|
textOutput.write(output);
|
|
10947
10931
|
}
|
|
10948
10932
|
}
|
|
10949
|
-
} else if (event.type ===
|
|
10933
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10950
10934
|
if (streamFormatter) {
|
|
10951
10935
|
streamFormatter.emitEvent({
|
|
10952
|
-
type:
|
|
10936
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10953
10937
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10954
10938
|
tool_name: event.value.name,
|
|
10955
10939
|
tool_id: event.value.callId,
|
|
@@ -10957,33 +10941,33 @@ async function runNonInteractive2(params) {
|
|
|
10957
10941
|
});
|
|
10958
10942
|
}
|
|
10959
10943
|
toolCallRequests.push(event.value);
|
|
10960
|
-
} else if (event.type ===
|
|
10944
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10961
10945
|
const message = "Loop detected, stopping execution";
|
|
10962
10946
|
if (streamFormatter) {
|
|
10963
10947
|
streamFormatter.emitEvent({
|
|
10964
|
-
type:
|
|
10948
|
+
type: "error" /* ERROR */,
|
|
10965
10949
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10966
10950
|
severity: "warning",
|
|
10967
10951
|
message
|
|
10968
10952
|
});
|
|
10969
10953
|
}
|
|
10970
10954
|
warnings.push(message);
|
|
10971
|
-
} else if (event.type ===
|
|
10955
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10972
10956
|
const message = "Maximum session turns exceeded";
|
|
10973
10957
|
if (streamFormatter) {
|
|
10974
10958
|
streamFormatter.emitEvent({
|
|
10975
|
-
type:
|
|
10959
|
+
type: "error" /* ERROR */,
|
|
10976
10960
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10977
10961
|
severity: "error",
|
|
10978
10962
|
message
|
|
10979
10963
|
});
|
|
10980
10964
|
}
|
|
10981
10965
|
warnings.push(message);
|
|
10982
|
-
} else if (event.type ===
|
|
10966
|
+
} else if (event.type === "error" /* Error */) {
|
|
10983
10967
|
throw event.value.error;
|
|
10984
|
-
} else if (event.type ===
|
|
10968
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10985
10969
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10986
|
-
if (config.getOutputFormat() ===
|
|
10970
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10987
10971
|
process.stderr.write(`${stopMessage}
|
|
10988
10972
|
`);
|
|
10989
10973
|
}
|
|
@@ -10991,7 +10975,7 @@ async function runNonInteractive2(params) {
|
|
|
10991
10975
|
const metrics = uiTelemetryService.getMetrics();
|
|
10992
10976
|
const durationMs = Date.now() - startTime;
|
|
10993
10977
|
streamFormatter.emitEvent({
|
|
10994
|
-
type:
|
|
10978
|
+
type: "result" /* RESULT */,
|
|
10995
10979
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10996
10980
|
status: "success",
|
|
10997
10981
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10999,7 +10983,7 @@ async function runNonInteractive2(params) {
|
|
|
10999
10983
|
durationMs
|
|
11000
10984
|
)
|
|
11001
10985
|
});
|
|
11002
|
-
} else if (config.getOutputFormat() ===
|
|
10986
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11003
10987
|
const formatter = new JsonFormatter();
|
|
11004
10988
|
const stats = uiTelemetryService.getMetrics();
|
|
11005
10989
|
textOutput.write(
|
|
@@ -11015,21 +10999,21 @@ async function runNonInteractive2(params) {
|
|
|
11015
10999
|
textOutput.ensureTrailingNewline();
|
|
11016
11000
|
}
|
|
11017
11001
|
return;
|
|
11018
|
-
} else if (event.type ===
|
|
11002
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
11019
11003
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11020
|
-
if (config.getOutputFormat() ===
|
|
11004
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11021
11005
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11022
11006
|
`);
|
|
11023
11007
|
} else if (streamFormatter) {
|
|
11024
11008
|
streamFormatter.emitEvent({
|
|
11025
|
-
type:
|
|
11009
|
+
type: "error" /* ERROR */,
|
|
11026
11010
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11027
11011
|
severity: "warning",
|
|
11028
11012
|
message: stripAnsi(blockMessage)
|
|
11029
11013
|
});
|
|
11030
11014
|
}
|
|
11031
11015
|
warnings.push(blockMessage);
|
|
11032
|
-
} else if (event.type ===
|
|
11016
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
11033
11017
|
const eventValue = event.value;
|
|
11034
11018
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
11035
11019
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -11052,12 +11036,12 @@ async function runNonInteractive2(params) {
|
|
|
11052
11036
|
);
|
|
11053
11037
|
if (streamFormatter) {
|
|
11054
11038
|
streamFormatter.emitEvent({
|
|
11055
|
-
type:
|
|
11039
|
+
type: "error" /* ERROR */,
|
|
11056
11040
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11057
11041
|
severity: "error",
|
|
11058
11042
|
message: invalidStreamError
|
|
11059
11043
|
});
|
|
11060
|
-
} else if (config.getOutputFormat() ===
|
|
11044
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11061
11045
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
11062
11046
|
`);
|
|
11063
11047
|
}
|
|
@@ -11077,7 +11061,7 @@ async function runNonInteractive2(params) {
|
|
|
11077
11061
|
const requestInfo = completedToolCall.request;
|
|
11078
11062
|
if (streamFormatter) {
|
|
11079
11063
|
streamFormatter.emitEvent({
|
|
11080
|
-
type:
|
|
11064
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11081
11065
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11082
11066
|
tool_id: requestInfo.callId,
|
|
11083
11067
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11111,11 +11095,11 @@ async function runNonInteractive2(params) {
|
|
|
11111
11095
|
);
|
|
11112
11096
|
}
|
|
11113
11097
|
const stopExecutionTool = completedToolCalls.find(
|
|
11114
|
-
(tc) => tc.response.errorType ===
|
|
11098
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11115
11099
|
);
|
|
11116
11100
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11117
11101
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11118
|
-
if (config.getOutputFormat() ===
|
|
11102
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11119
11103
|
process.stderr.write(`${stopMessage}
|
|
11120
11104
|
`);
|
|
11121
11105
|
}
|
|
@@ -11123,7 +11107,7 @@ async function runNonInteractive2(params) {
|
|
|
11123
11107
|
const metrics = uiTelemetryService.getMetrics();
|
|
11124
11108
|
const durationMs = Date.now() - startTime;
|
|
11125
11109
|
streamFormatter.emitEvent({
|
|
11126
|
-
type:
|
|
11110
|
+
type: "result" /* RESULT */,
|
|
11127
11111
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11128
11112
|
status: "success",
|
|
11129
11113
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11131,7 +11115,7 @@ async function runNonInteractive2(params) {
|
|
|
11131
11115
|
durationMs
|
|
11132
11116
|
)
|
|
11133
11117
|
});
|
|
11134
|
-
} else if (config.getOutputFormat() ===
|
|
11118
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11135
11119
|
const formatter = new JsonFormatter();
|
|
11136
11120
|
const stats = uiTelemetryService.getMetrics();
|
|
11137
11121
|
textOutput.write(
|
|
@@ -11154,12 +11138,12 @@ async function runNonInteractive2(params) {
|
|
|
11154
11138
|
const metrics = uiTelemetryService.getMetrics();
|
|
11155
11139
|
const durationMs = Date.now() - startTime;
|
|
11156
11140
|
streamFormatter.emitEvent({
|
|
11157
|
-
type:
|
|
11141
|
+
type: "result" /* RESULT */,
|
|
11158
11142
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11159
11143
|
status: invalidStreamError ? "error" : "success",
|
|
11160
11144
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11161
11145
|
});
|
|
11162
|
-
} else if (config.getOutputFormat() ===
|
|
11146
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11163
11147
|
const formatter = new JsonFormatter();
|
|
11164
11148
|
const stats = uiTelemetryService.getMetrics();
|
|
11165
11149
|
textOutput.write(
|
|
@@ -11183,7 +11167,7 @@ async function runNonInteractive2(params) {
|
|
|
11183
11167
|
cleanupStdinCancellation();
|
|
11184
11168
|
scheduler?.dispose();
|
|
11185
11169
|
consolePatcher.cleanup();
|
|
11186
|
-
coreEvents.off(
|
|
11170
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11187
11171
|
}
|
|
11188
11172
|
if (errorToHandle) {
|
|
11189
11173
|
handleError(errorToHandle, config);
|
|
@@ -13574,12 +13558,12 @@ function toToolCallContent(toolResult) {
|
|
|
13574
13558
|
}
|
|
13575
13559
|
var basicPermissionOptions = [
|
|
13576
13560
|
{
|
|
13577
|
-
optionId:
|
|
13561
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
13578
13562
|
name: "Allow",
|
|
13579
13563
|
kind: "allow_once"
|
|
13580
13564
|
},
|
|
13581
13565
|
{
|
|
13582
|
-
optionId:
|
|
13566
|
+
optionId: "cancel" /* Cancel */,
|
|
13583
13567
|
name: "Reject",
|
|
13584
13568
|
kind: "reject_once"
|
|
13585
13569
|
}
|
|
@@ -13591,13 +13575,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13591
13575
|
switch (confirmation.type) {
|
|
13592
13576
|
case "edit":
|
|
13593
13577
|
options.push({
|
|
13594
|
-
optionId:
|
|
13578
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13595
13579
|
name: "Allow for this session",
|
|
13596
13580
|
kind: "allow_always"
|
|
13597
13581
|
});
|
|
13598
13582
|
if (enablePermanentToolApproval) {
|
|
13599
13583
|
options.push({
|
|
13600
|
-
optionId:
|
|
13584
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13601
13585
|
name: "Allow for this file in all future sessions",
|
|
13602
13586
|
kind: "allow_always"
|
|
13603
13587
|
});
|
|
@@ -13605,13 +13589,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13605
13589
|
break;
|
|
13606
13590
|
case "exec":
|
|
13607
13591
|
options.push({
|
|
13608
|
-
optionId:
|
|
13592
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13609
13593
|
name: "Allow for this session",
|
|
13610
13594
|
kind: "allow_always"
|
|
13611
13595
|
});
|
|
13612
13596
|
if (enablePermanentToolApproval) {
|
|
13613
13597
|
options.push({
|
|
13614
|
-
optionId:
|
|
13598
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13615
13599
|
name: "Allow this command for all future sessions",
|
|
13616
13600
|
kind: "allow_always"
|
|
13617
13601
|
});
|
|
@@ -13620,19 +13604,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13620
13604
|
case "mcp":
|
|
13621
13605
|
options.push(
|
|
13622
13606
|
{
|
|
13623
|
-
optionId:
|
|
13607
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
13624
13608
|
name: "Allow all server tools for this session",
|
|
13625
13609
|
kind: "allow_always"
|
|
13626
13610
|
},
|
|
13627
13611
|
{
|
|
13628
|
-
optionId:
|
|
13612
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
13629
13613
|
name: "Allow tool for this session",
|
|
13630
13614
|
kind: "allow_always"
|
|
13631
13615
|
}
|
|
13632
13616
|
);
|
|
13633
13617
|
if (enablePermanentToolApproval) {
|
|
13634
13618
|
options.push({
|
|
13635
|
-
optionId:
|
|
13619
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13636
13620
|
name: "Allow tool for all future sessions",
|
|
13637
13621
|
kind: "allow_always"
|
|
13638
13622
|
});
|
|
@@ -13640,13 +13624,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13640
13624
|
break;
|
|
13641
13625
|
case "info":
|
|
13642
13626
|
options.push({
|
|
13643
|
-
optionId:
|
|
13627
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
13644
13628
|
name: "Allow for this session",
|
|
13645
13629
|
kind: "allow_always"
|
|
13646
13630
|
});
|
|
13647
13631
|
if (enablePermanentToolApproval) {
|
|
13648
13632
|
options.push({
|
|
13649
|
-
optionId:
|
|
13633
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
13650
13634
|
name: "Allow for all future sessions",
|
|
13651
13635
|
kind: "allow_always"
|
|
13652
13636
|
});
|
|
@@ -13678,21 +13662,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
13678
13662
|
}
|
|
13679
13663
|
function toAcpToolKind(kind) {
|
|
13680
13664
|
switch (kind) {
|
|
13681
|
-
case
|
|
13682
|
-
case
|
|
13683
|
-
case
|
|
13684
|
-
case
|
|
13685
|
-
case
|
|
13686
|
-
case
|
|
13687
|
-
case
|
|
13688
|
-
case
|
|
13689
|
-
case
|
|
13690
|
-
case
|
|
13665
|
+
case "read" /* Read */:
|
|
13666
|
+
case "edit" /* Edit */:
|
|
13667
|
+
case "execute" /* Execute */:
|
|
13668
|
+
case "search" /* Search */:
|
|
13669
|
+
case "delete" /* Delete */:
|
|
13670
|
+
case "move" /* Move */:
|
|
13671
|
+
case "think" /* Think */:
|
|
13672
|
+
case "fetch" /* Fetch */:
|
|
13673
|
+
case "switch_mode" /* SwitchMode */:
|
|
13674
|
+
case "other" /* Other */:
|
|
13691
13675
|
return kind;
|
|
13692
|
-
case
|
|
13676
|
+
case "agent" /* Agent */:
|
|
13693
13677
|
return "think";
|
|
13694
|
-
case
|
|
13695
|
-
case
|
|
13678
|
+
case "plan" /* Plan */:
|
|
13679
|
+
case "communicate" /* Communicate */:
|
|
13696
13680
|
default:
|
|
13697
13681
|
return "other";
|
|
13698
13682
|
}
|
|
@@ -13700,24 +13684,24 @@ function toAcpToolKind(kind) {
|
|
|
13700
13684
|
function buildAvailableModes(isPlanEnabled) {
|
|
13701
13685
|
const modes = [
|
|
13702
13686
|
{
|
|
13703
|
-
id:
|
|
13687
|
+
id: "default" /* DEFAULT */,
|
|
13704
13688
|
name: "Default",
|
|
13705
13689
|
description: "Prompts for approval"
|
|
13706
13690
|
},
|
|
13707
13691
|
{
|
|
13708
|
-
id:
|
|
13692
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
13709
13693
|
name: "Auto Edit",
|
|
13710
13694
|
description: "Auto-approves edit tools"
|
|
13711
13695
|
},
|
|
13712
13696
|
{
|
|
13713
|
-
id:
|
|
13697
|
+
id: "yolo" /* YOLO */,
|
|
13714
13698
|
name: "YOLO",
|
|
13715
13699
|
description: "Auto-approves all tools"
|
|
13716
13700
|
}
|
|
13717
13701
|
];
|
|
13718
13702
|
if (isPlanEnabled) {
|
|
13719
13703
|
modes.push({
|
|
13720
|
-
id:
|
|
13704
|
+
id: "plan" /* PLAN */,
|
|
13721
13705
|
name: "Plan",
|
|
13722
13706
|
description: "Read-only mode"
|
|
13723
13707
|
});
|
|
@@ -13730,7 +13714,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13730
13714
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13731
13715
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
13732
13716
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13733
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13717
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
13734
13718
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13735
13719
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13736
13720
|
useGemini3_1: useGemini31,
|
|
@@ -13816,11 +13800,11 @@ var Session = class {
|
|
|
13816
13800
|
this.connection = connection;
|
|
13817
13801
|
this.settings = settings;
|
|
13818
13802
|
coreEvents.on(
|
|
13819
|
-
|
|
13803
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13820
13804
|
this.handleApprovalModeChanged
|
|
13821
13805
|
);
|
|
13822
13806
|
this.context.config.getMessageBus()?.subscribe(
|
|
13823
|
-
|
|
13807
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
13824
13808
|
this.handleToolConfirmationRequest,
|
|
13825
13809
|
{ signal: this.disposeController.signal }
|
|
13826
13810
|
);
|
|
@@ -13844,7 +13828,7 @@ var Session = class {
|
|
|
13844
13828
|
"Policy engine missing. Denying tool confirmation request."
|
|
13845
13829
|
);
|
|
13846
13830
|
await messageBus.publish({
|
|
13847
|
-
type:
|
|
13831
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13848
13832
|
correlationId: request.correlationId,
|
|
13849
13833
|
confirmed: false,
|
|
13850
13834
|
requiresUserConfirmation: false
|
|
@@ -13857,7 +13841,7 @@ var Session = class {
|
|
|
13857
13841
|
"Tool confirmation request missing tool name. Denying."
|
|
13858
13842
|
);
|
|
13859
13843
|
await messageBus.publish({
|
|
13860
|
-
type:
|
|
13844
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13861
13845
|
correlationId: request.correlationId,
|
|
13862
13846
|
confirmed: false,
|
|
13863
13847
|
requiresUserConfirmation: false
|
|
@@ -13870,7 +13854,7 @@ var Session = class {
|
|
|
13870
13854
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
13871
13855
|
);
|
|
13872
13856
|
await messageBus.publish({
|
|
13873
|
-
type:
|
|
13857
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13874
13858
|
correlationId: request.correlationId,
|
|
13875
13859
|
confirmed: false,
|
|
13876
13860
|
requiresUserConfirmation: false
|
|
@@ -13886,15 +13870,15 @@ var Session = class {
|
|
|
13886
13870
|
request.subagent
|
|
13887
13871
|
);
|
|
13888
13872
|
await messageBus.publish({
|
|
13889
|
-
type:
|
|
13873
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13890
13874
|
correlationId: request.correlationId,
|
|
13891
|
-
confirmed: result.decision ===
|
|
13892
|
-
requiresUserConfirmation: result.decision ===
|
|
13875
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
13876
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
13893
13877
|
});
|
|
13894
13878
|
} catch (error) {
|
|
13895
13879
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
13896
13880
|
await this.context.config.getMessageBus()?.publish({
|
|
13897
|
-
type:
|
|
13881
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
13898
13882
|
correlationId: request.correlationId,
|
|
13899
13883
|
confirmed: false,
|
|
13900
13884
|
requiresUserConfirmation: false
|
|
@@ -13914,7 +13898,7 @@ var Session = class {
|
|
|
13914
13898
|
};
|
|
13915
13899
|
dispose() {
|
|
13916
13900
|
coreEvents.off(
|
|
13917
|
-
|
|
13901
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
13918
13902
|
this.handleApprovalModeChanged
|
|
13919
13903
|
);
|
|
13920
13904
|
this.disposeController.abort();
|
|
@@ -14003,7 +13987,7 @@ ${thought.description}`;
|
|
|
14003
13987
|
await this.sendUpdate({
|
|
14004
13988
|
sessionUpdate: "tool_call",
|
|
14005
13989
|
toolCallId: toolCall.id,
|
|
14006
|
-
status: toolCall.status ===
|
|
13990
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
14007
13991
|
title: toolCall.displayName || toolCall.name,
|
|
14008
13992
|
content: toolCallContent,
|
|
14009
13993
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14095,7 +14079,7 @@ ${thought.description}`;
|
|
|
14095
14079
|
return { stopReason: "cancelled" };
|
|
14096
14080
|
}
|
|
14097
14081
|
switch (event.type) {
|
|
14098
|
-
case
|
|
14082
|
+
case "content" /* Content */: {
|
|
14099
14083
|
const content = {
|
|
14100
14084
|
type: "text",
|
|
14101
14085
|
text: event.value
|
|
@@ -14106,7 +14090,7 @@ ${thought.description}`;
|
|
|
14106
14090
|
});
|
|
14107
14091
|
break;
|
|
14108
14092
|
}
|
|
14109
|
-
case
|
|
14093
|
+
case "thought" /* Thought */: {
|
|
14110
14094
|
const thoughtText = `**${event.value.subject}**
|
|
14111
14095
|
${event.value.description}`;
|
|
14112
14096
|
await this.sendUpdate({
|
|
@@ -14115,10 +14099,10 @@ ${event.value.description}`;
|
|
|
14115
14099
|
});
|
|
14116
14100
|
break;
|
|
14117
14101
|
}
|
|
14118
|
-
case
|
|
14102
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14119
14103
|
toolCallRequests.push(event.value);
|
|
14120
14104
|
break;
|
|
14121
|
-
case
|
|
14105
|
+
case "finished" /* Finished */: {
|
|
14122
14106
|
const usage2 = event.value.usageMetadata;
|
|
14123
14107
|
if (usage2) {
|
|
14124
14108
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -14126,19 +14110,19 @@ ${event.value.description}`;
|
|
|
14126
14110
|
}
|
|
14127
14111
|
break;
|
|
14128
14112
|
}
|
|
14129
|
-
case
|
|
14113
|
+
case "model_info" /* ModelInfo */:
|
|
14130
14114
|
turnModelId = event.value;
|
|
14131
14115
|
break;
|
|
14132
|
-
case
|
|
14116
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
14133
14117
|
stopReason = "max_turn_requests";
|
|
14134
14118
|
break;
|
|
14135
|
-
case
|
|
14119
|
+
case "loop_detected" /* LoopDetected */:
|
|
14136
14120
|
stopReason = "max_turn_requests";
|
|
14137
14121
|
break;
|
|
14138
|
-
case
|
|
14122
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
14139
14123
|
stopReason = "max_tokens";
|
|
14140
14124
|
break;
|
|
14141
|
-
case
|
|
14125
|
+
case "error" /* Error */: {
|
|
14142
14126
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
14143
14127
|
event.value.error
|
|
14144
14128
|
);
|
|
@@ -14366,7 +14350,7 @@ ${event.value.description}`;
|
|
|
14366
14350
|
const output = RequestPermissionResponseSchema.parse(
|
|
14367
14351
|
await this.connection.requestPermission(params)
|
|
14368
14352
|
);
|
|
14369
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14353
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14370
14354
|
await confirmationDetails.onConfirm(outcome);
|
|
14371
14355
|
await updatePolicy(
|
|
14372
14356
|
tool,
|
|
@@ -14377,16 +14361,16 @@ ${event.value.description}`;
|
|
|
14377
14361
|
invocation
|
|
14378
14362
|
);
|
|
14379
14363
|
switch (outcome) {
|
|
14380
|
-
case
|
|
14364
|
+
case "cancel" /* Cancel */:
|
|
14381
14365
|
return errorResponse(
|
|
14382
14366
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
14383
14367
|
);
|
|
14384
|
-
case
|
|
14385
|
-
case
|
|
14386
|
-
case
|
|
14387
|
-
case
|
|
14388
|
-
case
|
|
14389
|
-
case
|
|
14368
|
+
case "proceed_once" /* ProceedOnce */:
|
|
14369
|
+
case "proceed_always" /* ProceedAlways */:
|
|
14370
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
14371
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
14372
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
14373
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
14390
14374
|
break;
|
|
14391
14375
|
default: {
|
|
14392
14376
|
const resultOutcome = outcome;
|
|
@@ -14440,7 +14424,7 @@ ${event.value.description}`;
|
|
|
14440
14424
|
);
|
|
14441
14425
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14442
14426
|
{
|
|
14443
|
-
status:
|
|
14427
|
+
status: "success" /* Success */,
|
|
14444
14428
|
request: {
|
|
14445
14429
|
callId,
|
|
14446
14430
|
name: fc.name,
|
|
@@ -14485,7 +14469,7 @@ ${event.value.description}`;
|
|
|
14485
14469
|
});
|
|
14486
14470
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
14487
14471
|
{
|
|
14488
|
-
status:
|
|
14472
|
+
status: "error" /* Error */,
|
|
14489
14473
|
request: {
|
|
14490
14474
|
callId,
|
|
14491
14475
|
name: fc.name,
|
|
@@ -14613,12 +14597,12 @@ ${event.value.description}`;
|
|
|
14613
14597
|
sessionId: this.id,
|
|
14614
14598
|
options: [
|
|
14615
14599
|
{
|
|
14616
|
-
optionId:
|
|
14600
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14617
14601
|
name: "Allow once",
|
|
14618
14602
|
kind: "allow_once"
|
|
14619
14603
|
},
|
|
14620
14604
|
{
|
|
14621
|
-
optionId:
|
|
14605
|
+
optionId: "cancel" /* Cancel */,
|
|
14622
14606
|
name: "Deny",
|
|
14623
14607
|
kind: "reject_once"
|
|
14624
14608
|
}
|
|
@@ -14643,8 +14627,8 @@ ${event.value.description}`;
|
|
|
14643
14627
|
const output = RequestPermissionResponseSchema.parse(
|
|
14644
14628
|
await this.connection.requestPermission(params)
|
|
14645
14629
|
);
|
|
14646
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
14647
|
-
if (outcome ===
|
|
14630
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14631
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
14648
14632
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14649
14633
|
validationError = null;
|
|
14650
14634
|
} else {
|
|
@@ -15081,7 +15065,7 @@ var AcpSessionManager = class {
|
|
|
15081
15065
|
mcpServers,
|
|
15082
15066
|
loadedSettings
|
|
15083
15067
|
);
|
|
15084
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15068
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
15085
15069
|
let isAuthenticated = false;
|
|
15086
15070
|
let authErrorMessage = "";
|
|
15087
15071
|
try {
|
|
@@ -15093,7 +15077,7 @@ var AcpSessionManager = class {
|
|
|
15093
15077
|
);
|
|
15094
15078
|
isAuthenticated = true;
|
|
15095
15079
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15096
|
-
if (authType ===
|
|
15080
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15097
15081
|
isAuthenticated = false;
|
|
15098
15082
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15099
15083
|
}
|
|
@@ -15202,7 +15186,7 @@ var AcpSessionManager = class {
|
|
|
15202
15186
|
return response;
|
|
15203
15187
|
}
|
|
15204
15188
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15205
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
15189
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
15206
15190
|
if (!selectedAuthType) {
|
|
15207
15191
|
throw RequestError.authRequired();
|
|
15208
15192
|
}
|
|
@@ -15303,12 +15287,12 @@ var GeminiAgent = class {
|
|
|
15303
15287
|
}
|
|
15304
15288
|
const authMethods = [
|
|
15305
15289
|
{
|
|
15306
|
-
id:
|
|
15290
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
15307
15291
|
name: "Log in with Google",
|
|
15308
15292
|
description: "Log in with your Google account"
|
|
15309
15293
|
},
|
|
15310
15294
|
{
|
|
15311
|
-
id:
|
|
15295
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
15312
15296
|
name: "Gemini API key",
|
|
15313
15297
|
description: "Use an API key with Gemini Developer API",
|
|
15314
15298
|
_meta: {
|
|
@@ -15318,12 +15302,12 @@ var GeminiAgent = class {
|
|
|
15318
15302
|
}
|
|
15319
15303
|
},
|
|
15320
15304
|
{
|
|
15321
|
-
id:
|
|
15305
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
15322
15306
|
name: "Vertex AI",
|
|
15323
15307
|
description: "Use an API key with Vertex AI GenAI API"
|
|
15324
15308
|
},
|
|
15325
15309
|
{
|
|
15326
|
-
id:
|
|
15310
|
+
id: "gateway" /* GATEWAY */,
|
|
15327
15311
|
name: "AI API Gateway",
|
|
15328
15312
|
description: "Use a custom AI API Gateway",
|
|
15329
15313
|
_meta: {
|
|
@@ -15496,7 +15480,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15496
15480
|
}
|
|
15497
15481
|
return authType;
|
|
15498
15482
|
} catch (error) {
|
|
15499
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
15483
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
15500
15484
|
handleError(
|
|
15501
15485
|
error instanceof Error ? error : new Error(String(error)),
|
|
15502
15486
|
nonInteractiveConfig,
|
|
@@ -15691,10 +15675,10 @@ var SlashCommandConflictHandler = class {
|
|
|
15691
15675
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
15692
15676
|
}
|
|
15693
15677
|
start() {
|
|
15694
|
-
coreEvents.on(
|
|
15678
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15695
15679
|
}
|
|
15696
15680
|
stop() {
|
|
15697
|
-
coreEvents.off(
|
|
15681
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
15698
15682
|
if (this.flushTimeout) {
|
|
15699
15683
|
clearTimeout(this.flushTimeout);
|
|
15700
15684
|
this.flushTimeout = null;
|
|
@@ -15975,7 +15959,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
15975
15959
|
}
|
|
15976
15960
|
}
|
|
15977
15961
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15978
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15962
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-P7QQLIDS.js");
|
|
15979
15963
|
await doStartUI(
|
|
15980
15964
|
config,
|
|
15981
15965
|
settings,
|
|
@@ -16078,12 +16062,12 @@ async function main() {
|
|
|
16078
16062
|
dns.setDefaultResultOrder(
|
|
16079
16063
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16080
16064
|
);
|
|
16081
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
16065
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
16082
16066
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16083
16067
|
settings.setValue(
|
|
16084
16068
|
"User" /* User */,
|
|
16085
16069
|
"security.auth.selectedType",
|
|
16086
|
-
|
|
16070
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
16087
16071
|
);
|
|
16088
16072
|
}
|
|
16089
16073
|
}
|
|
@@ -16184,7 +16168,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16184
16168
|
await config.storage.initialize();
|
|
16185
16169
|
adminControlsListner.setConfig(config);
|
|
16186
16170
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
16187
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16171
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-FUTPYP6V.js");
|
|
16188
16172
|
setupInitialActivityLogger(config);
|
|
16189
16173
|
}
|
|
16190
16174
|
registerTelemetryConfig(config);
|
|
@@ -16192,7 +16176,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16192
16176
|
const messageBus = config.getMessageBus();
|
|
16193
16177
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
16194
16178
|
registerCleanup(async () => {
|
|
16195
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
16179
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
16196
16180
|
});
|
|
16197
16181
|
if (!config.getAcpMode()) {
|
|
16198
16182
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -16243,7 +16227,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16243
16227
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16244
16228
|
const initializationResult = await initializeApp(config, settings);
|
|
16245
16229
|
initAppHandle?.end();
|
|
16246
|
-
import("./liteRtServerManager-
|
|
16230
|
+
import("./liteRtServerManager-FIVLVXQJ.js").then(({ LiteRtServerManager }) => {
|
|
16247
16231
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16248
16232
|
if (!mergedGemma) return;
|
|
16249
16233
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -16253,7 +16237,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16253
16237
|
autoStartServer: userGemma?.autoStartServer
|
|
16254
16238
|
});
|
|
16255
16239
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
16256
|
-
if (settings.merged.security.auth.selectedType ===
|
|
16240
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
16257
16241
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
16258
16242
|
}
|
|
16259
16243
|
if (config.getAcpMode()) {
|
|
@@ -16269,7 +16253,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16269
16253
|
...rawStartupWarnings.map((message) => ({
|
|
16270
16254
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
16271
16255
|
message,
|
|
16272
|
-
priority:
|
|
16256
|
+
priority: "high" /* High */
|
|
16273
16257
|
})),
|
|
16274
16258
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
16275
16259
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -16306,7 +16290,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16306
16290
|
${input}` : stdinData;
|
|
16307
16291
|
}
|
|
16308
16292
|
}
|
|
16309
|
-
const sessionStartSource = resumedSessionData ?
|
|
16293
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
16310
16294
|
const hookSystem = config?.getHookSystem();
|
|
16311
16295
|
if (hookSystem) {
|
|
16312
16296
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -16363,8 +16347,8 @@ ${input}` : wrappedContext;
|
|
|
16363
16347
|
}
|
|
16364
16348
|
}
|
|
16365
16349
|
function initializeOutputListenersAndFlush(config) {
|
|
16366
|
-
if (coreEvents.listenerCount(
|
|
16367
|
-
coreEvents.on(
|
|
16350
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
16351
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
16368
16352
|
if (payload.isStderr) {
|
|
16369
16353
|
writeToStderr(payload.chunk, payload.encoding);
|
|
16370
16354
|
} else {
|
|
@@ -16372,8 +16356,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16372
16356
|
}
|
|
16373
16357
|
});
|
|
16374
16358
|
}
|
|
16375
|
-
if (coreEvents.listenerCount(
|
|
16376
|
-
coreEvents.on(
|
|
16359
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
16360
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
16377
16361
|
if (payload.type === "error" || payload.type === "warn") {
|
|
16378
16362
|
writeToStderr(payload.content + "\n");
|
|
16379
16363
|
} else {
|
|
@@ -16381,8 +16365,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16381
16365
|
}
|
|
16382
16366
|
});
|
|
16383
16367
|
}
|
|
16384
|
-
if (coreEvents.listenerCount(
|
|
16385
|
-
coreEvents.on(
|
|
16368
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
16369
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
16386
16370
|
writeToStderr(payload.message + "\n");
|
|
16387
16371
|
});
|
|
16388
16372
|
}
|
|
@@ -16390,7 +16374,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
16390
16374
|
const forceToStderr = outputFormat === "json";
|
|
16391
16375
|
coreEvents.drainBacklogs(
|
|
16392
16376
|
(event, args) => {
|
|
16393
|
-
if (forceToStderr && event ===
|
|
16377
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
16394
16378
|
const payload = args[0];
|
|
16395
16379
|
if (!payload.isStderr) {
|
|
16396
16380
|
return {
|