@google/gemini-cli 0.39.0-preview.2 → 0.39.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-TKGFTY3B.js → chunk-3YUTTNJ7.js} +4 -4
- package/bundle/{chunk-3R2FLB3Z.js → chunk-5GTZHSZV.js} +4 -4
- package/bundle/{chunk-N3GUGFOL.js → chunk-6NW5RNNH.js} +60 -72
- package/bundle/{chunk-AZ7QQWNX.js → chunk-BL3XXS2L.js} +1 -1
- package/bundle/{chunk-QC6EGBZW.js → chunk-LUWQB4AS.js} +1 -1
- package/bundle/{chunk-GX4YOB7T.js → chunk-NWD4JYMB.js} +4 -4
- package/bundle/{chunk-4UUOHXDW.js → chunk-RTKRL6Y5.js} +11669 -6238
- package/bundle/{chunk-OXCH4FS3.js → chunk-UQGLVPZQ.js} +4 -4
- package/bundle/{chunk-45GIY5RT.js → chunk-YYY7NKKR.js} +2 -2
- package/bundle/{cleanup-6N6E742H.js → cleanup-3LELZME2.js} +2 -2
- package/bundle/{cleanup-3EICKDDN.js → cleanup-JJEXOHOA.js} +2 -2
- package/bundle/{cleanup-4SLYOL44.js → cleanup-TTGHQXQN.js} +3 -3
- package/bundle/{core-KLYK3V6Z.js → core-LKKLDF4Z.js} +1 -1
- package/bundle/{dist-P4XAO4SC.js → core-Z2SYVMM5.js} +2 -2
- package/bundle/{devtoolsService-X4577PYZ.js → devtoolsService-H64VB4IA.js} +2 -2
- package/bundle/{devtoolsService-FS7WXGBF.js → devtoolsService-L5LFSMIR.js} +2 -2
- package/bundle/{devtoolsService-K4DENTYF.js → devtoolsService-UQCUIXV5.js} +4 -5
- package/bundle/{dist-5ET5G5PC.js → dist-FWHS5IHN.js} +1 -1
- package/bundle/{gemini-6GWCDHXK.js → gemini-BI2PCDUT.js} +8 -8
- package/bundle/{gemini-NBKLSVA3.js → gemini-CMXEUOSI.js} +169 -184
- package/bundle/{gemini-FLGPH5GJ.js → gemini-YNLABPKW.js} +8 -8
- package/bundle/gemini.js +3 -3
- package/bundle/{interactiveCli-AGSLCKNH.js → interactiveCli-C46TDPVW.js} +4 -4
- package/bundle/{interactiveCli-NAPN3E2K.js → interactiveCli-LXXBYVNU.js} +258 -275
- package/bundle/{interactiveCli-H3NLGP7Z.js → interactiveCli-P35Q3KZ2.js} +4 -4
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-CWUR5RGE.js → oauth2-provider-7ZDLUOSM.js} +1 -1
- package/bundle/{oauth2-provider-YKYTKUWD.js → oauth2-provider-CRWFOXYR.js} +1 -1
- package/bundle/{oauth2-provider-EA452S4C.js → oauth2-provider-FEM5AIRT.js} +73 -39
- package/package.json +1 -1
- package/bundle/chunk-5J5LWISO.js +0 -360288
- package/bundle/chunk-RTX4LTWK.js +0 -101702
- package/bundle/chunk-SS4CWRZ5.js +0 -156
- package/bundle/cleanup-OG2MXKZ7.js +0 -33
- package/bundle/devtoolsService-RLXZWLDT.js +0 -871
- package/bundle/dist-DQVXGLSO.js +0 -2010
- package/bundle/gemini-YOFQ5KF4.js +0 -15321
- package/bundle/interactiveCli-TCZBSTKU.js +0 -34493
- package/bundle/oauth2-provider-LV6VPYTU.js +0 -237
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
updateAllUpdatableExtensions,
|
|
59
59
|
updateExtension,
|
|
60
60
|
validateAuthMethod
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-6NW5RNNH.js";
|
|
62
62
|
import {
|
|
63
63
|
appEvents
|
|
64
64
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -70,43 +70,32 @@ import {
|
|
|
70
70
|
runExitCleanup,
|
|
71
71
|
runSyncCleanup,
|
|
72
72
|
setupSignalHandlers
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-LUWQB4AS.js";
|
|
74
74
|
import {
|
|
75
75
|
AuthType,
|
|
76
76
|
ChatRecordingService,
|
|
77
77
|
Client,
|
|
78
78
|
Config,
|
|
79
|
-
CoreToolCallStatus,
|
|
80
79
|
ExitCodes,
|
|
81
80
|
FileDiscoveryService,
|
|
82
81
|
FolderTrustDiscoveryService,
|
|
83
|
-
GeminiEventType,
|
|
84
82
|
IdeClient,
|
|
85
|
-
IntegrityStatus,
|
|
86
83
|
InvalidStreamError,
|
|
87
84
|
JsonFormatter,
|
|
88
|
-
JsonStreamEventType,
|
|
89
85
|
LegacyAgentSession,
|
|
90
|
-
LlmRole,
|
|
91
86
|
Logger,
|
|
92
87
|
MCPServerConfig,
|
|
93
|
-
MCPServerStatus,
|
|
94
|
-
OutputFormat,
|
|
95
88
|
PolicyIntegrityManager,
|
|
96
89
|
ROOT_SCHEDULER_ID,
|
|
97
90
|
ReadManyFilesTool,
|
|
98
91
|
Scheduler,
|
|
99
|
-
SessionEndReason,
|
|
100
|
-
SessionStartSource,
|
|
101
92
|
ShellExecutionService,
|
|
102
|
-
StreamEventType,
|
|
103
93
|
StreamJsonFormatter,
|
|
104
94
|
ToolCallEvent,
|
|
105
95
|
UserAccountManager,
|
|
106
96
|
UserPromptEvent,
|
|
107
97
|
ValidationCancelledError,
|
|
108
98
|
ValidationRequiredError,
|
|
109
|
-
WarningPriority,
|
|
110
99
|
addMemory,
|
|
111
100
|
applyAdminAllowlist,
|
|
112
101
|
applyRequiredServers,
|
|
@@ -167,11 +156,9 @@ import {
|
|
|
167
156
|
updatePolicy,
|
|
168
157
|
writeToStderr,
|
|
169
158
|
writeToStdout
|
|
170
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-RTKRL6Y5.js";
|
|
171
160
|
import {
|
|
172
161
|
ASK_USER_TOOL_NAME,
|
|
173
|
-
ApprovalMode,
|
|
174
|
-
CoreEvent,
|
|
175
162
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
176
163
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
177
164
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -190,7 +177,6 @@ import {
|
|
|
190
177
|
FatalTurnLimitedError,
|
|
191
178
|
GEMINI_DIR,
|
|
192
179
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
193
|
-
Kind,
|
|
194
180
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
195
181
|
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
196
182
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
@@ -200,7 +186,6 @@ import {
|
|
|
200
186
|
REFERENCE_CONTENT_START,
|
|
201
187
|
Storage,
|
|
202
188
|
ToolConfirmationOutcome,
|
|
203
|
-
ToolErrorType,
|
|
204
189
|
coreEvents,
|
|
205
190
|
debugLogger,
|
|
206
191
|
external_exports,
|
|
@@ -214,7 +199,7 @@ import {
|
|
|
214
199
|
loadServerHierarchicalMemory,
|
|
215
200
|
resolveToRealPath,
|
|
216
201
|
setGeminiMdFilename
|
|
217
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-QM5IP3NK.js";
|
|
218
203
|
import "./chunk-664ZODQF.js";
|
|
219
204
|
import "./chunk-RJTRUG2J.js";
|
|
220
205
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5505,7 +5490,7 @@ async function getMcpServersFromConfig(settings) {
|
|
|
5505
5490
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5506
5491
|
const isStdio = !!config.command;
|
|
5507
5492
|
if (isStdio && !isTrusted) {
|
|
5508
|
-
return
|
|
5493
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5509
5494
|
}
|
|
5510
5495
|
const client = new Client({
|
|
5511
5496
|
name: "mcp-test-client",
|
|
@@ -5541,16 +5526,16 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5541
5526
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5542
5527
|
} catch {
|
|
5543
5528
|
await client.close();
|
|
5544
|
-
return
|
|
5529
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5545
5530
|
}
|
|
5546
5531
|
try {
|
|
5547
5532
|
await client.connect(transport, { timeout: 5e3 });
|
|
5548
5533
|
await client.ping();
|
|
5549
5534
|
await client.close();
|
|
5550
|
-
return
|
|
5535
|
+
return "connected" /* CONNECTED */;
|
|
5551
5536
|
} catch {
|
|
5552
5537
|
await transport.close();
|
|
5553
|
-
return
|
|
5538
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5554
5539
|
}
|
|
5555
5540
|
}
|
|
5556
5541
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5563,9 +5548,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5563
5548
|
});
|
|
5564
5549
|
if (!loadResult.allowed) {
|
|
5565
5550
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5566
|
-
return
|
|
5551
|
+
return "blocked" /* BLOCKED */;
|
|
5567
5552
|
}
|
|
5568
|
-
return
|
|
5553
|
+
return "disabled" /* DISABLED */;
|
|
5569
5554
|
}
|
|
5570
5555
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5571
5556
|
}
|
|
@@ -5599,23 +5584,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5599
5584
|
let statusIndicator = "";
|
|
5600
5585
|
let statusText = "";
|
|
5601
5586
|
switch (status) {
|
|
5602
|
-
case
|
|
5587
|
+
case "connected" /* CONNECTED */:
|
|
5603
5588
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5604
5589
|
statusText = "Connected";
|
|
5605
5590
|
break;
|
|
5606
|
-
case
|
|
5591
|
+
case "connecting" /* CONNECTING */:
|
|
5607
5592
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5608
5593
|
statusText = "Connecting";
|
|
5609
5594
|
break;
|
|
5610
|
-
case
|
|
5595
|
+
case "blocked" /* BLOCKED */:
|
|
5611
5596
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5612
5597
|
statusText = "Blocked";
|
|
5613
5598
|
break;
|
|
5614
|
-
case
|
|
5599
|
+
case "disabled" /* DISABLED */:
|
|
5615
5600
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5616
5601
|
statusText = "Disabled";
|
|
5617
5602
|
break;
|
|
5618
|
-
case
|
|
5603
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5619
5604
|
default:
|
|
5620
5605
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5621
5606
|
statusText = "Disconnected";
|
|
@@ -7265,7 +7250,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7265
7250
|
}
|
|
7266
7251
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7267
7252
|
const packageJson = await getPackageJson(__dirname3);
|
|
7268
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.39.0
|
|
7253
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.39.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7269
7254
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7270
7255
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7271
7256
|
}
|
|
@@ -7324,9 +7309,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7324
7309
|
cwd,
|
|
7325
7310
|
potentialWorkspacePoliciesDir
|
|
7326
7311
|
);
|
|
7327
|
-
if (integrityResult.status ===
|
|
7312
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7328
7313
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7329
|
-
} else if (integrityResult.status ===
|
|
7314
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7330
7315
|
workspacePoliciesDir = void 0;
|
|
7331
7316
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7332
7317
|
policyUpdateConfirmationRequest = {
|
|
@@ -7720,23 +7705,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
7720
7705
|
if (rawApprovalMode) {
|
|
7721
7706
|
switch (rawApprovalMode) {
|
|
7722
7707
|
case "yolo":
|
|
7723
|
-
approvalMode =
|
|
7708
|
+
approvalMode = "yolo" /* YOLO */;
|
|
7724
7709
|
break;
|
|
7725
7710
|
case "auto_edit":
|
|
7726
|
-
approvalMode =
|
|
7711
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
7727
7712
|
break;
|
|
7728
7713
|
case "plan":
|
|
7729
7714
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
7730
7715
|
debugLogger.warn(
|
|
7731
7716
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
7732
7717
|
);
|
|
7733
|
-
approvalMode =
|
|
7718
|
+
approvalMode = "default" /* DEFAULT */;
|
|
7734
7719
|
} else {
|
|
7735
|
-
approvalMode =
|
|
7720
|
+
approvalMode = "plan" /* PLAN */;
|
|
7736
7721
|
}
|
|
7737
7722
|
break;
|
|
7738
7723
|
case "default":
|
|
7739
|
-
approvalMode =
|
|
7724
|
+
approvalMode = "default" /* DEFAULT */;
|
|
7740
7725
|
break;
|
|
7741
7726
|
default:
|
|
7742
7727
|
throw new Error(
|
|
@@ -7744,10 +7729,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
7744
7729
|
);
|
|
7745
7730
|
}
|
|
7746
7731
|
} else {
|
|
7747
|
-
approvalMode =
|
|
7732
|
+
approvalMode = "default" /* DEFAULT */;
|
|
7748
7733
|
}
|
|
7749
7734
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
7750
|
-
if (approvalMode ===
|
|
7735
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
7751
7736
|
if (settings.admin?.secureModeEnabled) {
|
|
7752
7737
|
debugLogger.error(
|
|
7753
7738
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -7765,16 +7750,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
7765
7750
|
)
|
|
7766
7751
|
);
|
|
7767
7752
|
}
|
|
7768
|
-
} else if (approvalMode ===
|
|
7753
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
7769
7754
|
debugLogger.warn(
|
|
7770
7755
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
7771
7756
|
);
|
|
7772
7757
|
}
|
|
7773
|
-
if (!trustedFolder && approvalMode !==
|
|
7758
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
7774
7759
|
debugLogger.warn(
|
|
7775
7760
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
7776
7761
|
);
|
|
7777
|
-
approvalMode =
|
|
7762
|
+
approvalMode = "default" /* DEFAULT */;
|
|
7778
7763
|
}
|
|
7779
7764
|
let telemetrySettings;
|
|
7780
7765
|
try {
|
|
@@ -9157,7 +9142,7 @@ import path8 from "node:path";
|
|
|
9157
9142
|
import process4 from "node:process";
|
|
9158
9143
|
var homeDirectoryCheck = {
|
|
9159
9144
|
id: "home-directory",
|
|
9160
|
-
priority:
|
|
9145
|
+
priority: "low" /* Low */,
|
|
9161
9146
|
check: async (workspaceRoot, settings) => {
|
|
9162
9147
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9163
9148
|
return null;
|
|
@@ -9181,7 +9166,7 @@ var homeDirectoryCheck = {
|
|
|
9181
9166
|
};
|
|
9182
9167
|
var rootDirectoryCheck = {
|
|
9183
9168
|
id: "root-directory",
|
|
9184
|
-
priority:
|
|
9169
|
+
priority: "high" /* High */,
|
|
9185
9170
|
check: async (workspaceRoot, _settings) => {
|
|
9186
9171
|
try {
|
|
9187
9172
|
const workspaceRealPath = await fs6.realpath(workspaceRoot);
|
|
@@ -9365,12 +9350,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
9365
9350
|
error,
|
|
9366
9351
|
config.getContentGeneratorConfig()?.authType
|
|
9367
9352
|
);
|
|
9368
|
-
if (config.getOutputFormat() ===
|
|
9353
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
9369
9354
|
const streamFormatter = new StreamJsonFormatter();
|
|
9370
9355
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
9371
9356
|
const metrics = uiTelemetryService.getMetrics();
|
|
9372
9357
|
streamFormatter.emitEvent({
|
|
9373
|
-
type:
|
|
9358
|
+
type: "result" /* RESULT */,
|
|
9374
9359
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9375
9360
|
status: "error",
|
|
9376
9361
|
error: {
|
|
@@ -9381,7 +9366,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
9381
9366
|
});
|
|
9382
9367
|
runSyncCleanup();
|
|
9383
9368
|
process.exit(getNumericExitCode(errorCode));
|
|
9384
|
-
} else if (config.getOutputFormat() ===
|
|
9369
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9385
9370
|
const formatter = new JsonFormatter();
|
|
9386
9371
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
9387
9372
|
const formattedError = formatter.formatError(
|
|
@@ -9401,11 +9386,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
9401
9386
|
const isFatal = isFatalToolError(errorType);
|
|
9402
9387
|
if (isFatal) {
|
|
9403
9388
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
9404
|
-
if (config.getOutputFormat() ===
|
|
9389
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
9405
9390
|
const streamFormatter = new StreamJsonFormatter();
|
|
9406
9391
|
const metrics = uiTelemetryService.getMetrics();
|
|
9407
9392
|
streamFormatter.emitEvent({
|
|
9408
|
-
type:
|
|
9393
|
+
type: "result" /* RESULT */,
|
|
9409
9394
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9410
9395
|
status: "error",
|
|
9411
9396
|
error: {
|
|
@@ -9414,7 +9399,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
9414
9399
|
},
|
|
9415
9400
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
9416
9401
|
});
|
|
9417
|
-
} else if (config.getOutputFormat() ===
|
|
9402
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9418
9403
|
const formatter = new JsonFormatter();
|
|
9419
9404
|
const formattedError = formatter.formatError(
|
|
9420
9405
|
toolExecutionError,
|
|
@@ -9432,11 +9417,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
9432
9417
|
}
|
|
9433
9418
|
function handleCancellationError(config) {
|
|
9434
9419
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
9435
|
-
if (config.getOutputFormat() ===
|
|
9420
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
9436
9421
|
const streamFormatter = new StreamJsonFormatter();
|
|
9437
9422
|
const metrics = uiTelemetryService.getMetrics();
|
|
9438
9423
|
streamFormatter.emitEvent({
|
|
9439
|
-
type:
|
|
9424
|
+
type: "result" /* RESULT */,
|
|
9440
9425
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9441
9426
|
status: "error",
|
|
9442
9427
|
error: {
|
|
@@ -9447,7 +9432,7 @@ function handleCancellationError(config) {
|
|
|
9447
9432
|
});
|
|
9448
9433
|
runSyncCleanup();
|
|
9449
9434
|
process.exit(cancellationError.exitCode);
|
|
9450
|
-
} else if (config.getOutputFormat() ===
|
|
9435
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9451
9436
|
const formatter = new JsonFormatter();
|
|
9452
9437
|
const formattedError = formatter.formatError(
|
|
9453
9438
|
cancellationError,
|
|
@@ -9467,11 +9452,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
9467
9452
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
9468
9453
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
9469
9454
|
);
|
|
9470
|
-
if (config.getOutputFormat() ===
|
|
9455
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
9471
9456
|
const streamFormatter = new StreamJsonFormatter();
|
|
9472
9457
|
const metrics = uiTelemetryService.getMetrics();
|
|
9473
9458
|
streamFormatter.emitEvent({
|
|
9474
|
-
type:
|
|
9459
|
+
type: "result" /* RESULT */,
|
|
9475
9460
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9476
9461
|
status: "error",
|
|
9477
9462
|
error: {
|
|
@@ -9482,7 +9467,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
9482
9467
|
});
|
|
9483
9468
|
runSyncCleanup();
|
|
9484
9469
|
process.exit(maxTurnsError.exitCode);
|
|
9485
|
-
} else if (config.getOutputFormat() ===
|
|
9470
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9486
9471
|
const formatter = new JsonFormatter();
|
|
9487
9472
|
const formattedError = formatter.formatError(
|
|
9488
9473
|
maxTurnsError,
|
|
@@ -9562,7 +9547,7 @@ async function runNonInteractive({
|
|
|
9562
9547
|
}
|
|
9563
9548
|
});
|
|
9564
9549
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
9565
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
9550
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-L5LFSMIR.js");
|
|
9566
9551
|
await setupInitialActivityLogger(config);
|
|
9567
9552
|
}
|
|
9568
9553
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -9578,7 +9563,7 @@ async function runNonInteractive({
|
|
|
9578
9563
|
}
|
|
9579
9564
|
};
|
|
9580
9565
|
const startTime = Date.now();
|
|
9581
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
9566
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
9582
9567
|
const abortController = new AbortController();
|
|
9583
9568
|
let isAborting = false;
|
|
9584
9569
|
let cancelMessageTimer = null;
|
|
@@ -9631,13 +9616,13 @@ async function runNonInteractive({
|
|
|
9631
9616
|
};
|
|
9632
9617
|
try {
|
|
9633
9618
|
consolePatcher.patch();
|
|
9634
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
9619
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
9635
9620
|
process.stderr.write(
|
|
9636
9621
|
"[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"
|
|
9637
9622
|
);
|
|
9638
9623
|
}
|
|
9639
9624
|
setupStdinCancellation();
|
|
9640
|
-
coreEvents.on(
|
|
9625
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
9641
9626
|
coreEvents.drainBacklogs();
|
|
9642
9627
|
process.stdout.on("error", (err) => {
|
|
9643
9628
|
if (err.code === "EPIPE") {
|
|
@@ -9663,7 +9648,7 @@ async function runNonInteractive({
|
|
|
9663
9648
|
}
|
|
9664
9649
|
if (streamFormatter) {
|
|
9665
9650
|
streamFormatter.emitEvent({
|
|
9666
|
-
type:
|
|
9651
|
+
type: "init" /* INIT */,
|
|
9667
9652
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9668
9653
|
session_id: config.getSessionId(),
|
|
9669
9654
|
model: config.getModel()
|
|
@@ -9701,7 +9686,7 @@ async function runNonInteractive({
|
|
|
9701
9686
|
}
|
|
9702
9687
|
if (streamFormatter) {
|
|
9703
9688
|
streamFormatter.emitEvent({
|
|
9704
|
-
type:
|
|
9689
|
+
type: "message" /* MESSAGE */,
|
|
9705
9690
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9706
9691
|
role: "user",
|
|
9707
9692
|
content: input
|
|
@@ -9740,12 +9725,12 @@ async function runNonInteractive({
|
|
|
9740
9725
|
const metrics = uiTelemetryService.getMetrics();
|
|
9741
9726
|
const durationMs = Date.now() - startTime;
|
|
9742
9727
|
streamFormatter.emitEvent({
|
|
9743
|
-
type:
|
|
9728
|
+
type: "result" /* RESULT */,
|
|
9744
9729
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9745
9730
|
status: "success",
|
|
9746
9731
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
9747
9732
|
});
|
|
9748
|
-
} else if (config.getOutputFormat() ===
|
|
9733
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9749
9734
|
const formatter = new JsonFormatter();
|
|
9750
9735
|
const stats = uiTelemetryService.getMetrics();
|
|
9751
9736
|
textOutput.write(
|
|
@@ -9831,13 +9816,13 @@ async function runNonInteractive({
|
|
|
9831
9816
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
9832
9817
|
if (streamFormatter) {
|
|
9833
9818
|
streamFormatter.emitEvent({
|
|
9834
|
-
type:
|
|
9819
|
+
type: "message" /* MESSAGE */,
|
|
9835
9820
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9836
9821
|
role: "assistant",
|
|
9837
9822
|
content: output,
|
|
9838
9823
|
delta: true
|
|
9839
9824
|
});
|
|
9840
|
-
} else if (config.getOutputFormat() ===
|
|
9825
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9841
9826
|
responseText += output;
|
|
9842
9827
|
} else {
|
|
9843
9828
|
if (part.text) {
|
|
@@ -9850,13 +9835,13 @@ async function runNonInteractive({
|
|
|
9850
9835
|
break;
|
|
9851
9836
|
}
|
|
9852
9837
|
case "tool_request": {
|
|
9853
|
-
if (config.getOutputFormat() ===
|
|
9838
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
9854
9839
|
preToolResponseText = responseText || preToolResponseText;
|
|
9855
9840
|
responseText = "";
|
|
9856
9841
|
}
|
|
9857
9842
|
if (streamFormatter) {
|
|
9858
9843
|
streamFormatter.emitEvent({
|
|
9859
|
-
type:
|
|
9844
|
+
type: "tool_use" /* TOOL_USE */,
|
|
9860
9845
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9861
9846
|
tool_name: event.name,
|
|
9862
9847
|
tool_id: event.requestId,
|
|
@@ -9872,7 +9857,7 @@ async function runNonInteractive({
|
|
|
9872
9857
|
const displayText = displayContentToString(display);
|
|
9873
9858
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
9874
9859
|
streamFormatter.emitEvent({
|
|
9875
|
-
type:
|
|
9860
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
9876
9861
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9877
9862
|
tool_id: event.requestId,
|
|
9878
9863
|
status: event.isError ? "error" : "success",
|
|
@@ -9887,17 +9872,17 @@ async function runNonInteractive({
|
|
|
9887
9872
|
const display = event.display?.result;
|
|
9888
9873
|
const displayText = displayContentToString(display);
|
|
9889
9874
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
9890
|
-
if (event.data?.["errorType"] ===
|
|
9891
|
-
if (config.getOutputFormat() ===
|
|
9875
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
9876
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
9892
9877
|
responseText = preToolResponseText;
|
|
9893
9878
|
}
|
|
9894
9879
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
9895
|
-
if (config.getOutputFormat() ===
|
|
9880
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
9896
9881
|
process.stderr.write(`${stopMessage}
|
|
9897
9882
|
`);
|
|
9898
9883
|
}
|
|
9899
9884
|
}
|
|
9900
|
-
if (event.data?.["errorType"] ===
|
|
9885
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
9901
9886
|
throw new FatalToolExecutionError(
|
|
9902
9887
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
9903
9888
|
);
|
|
@@ -9918,20 +9903,20 @@ async function runNonInteractive({
|
|
|
9918
9903
|
}
|
|
9919
9904
|
const errorCode = event._meta?.["code"];
|
|
9920
9905
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
9921
|
-
if (config.getOutputFormat() ===
|
|
9906
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
9922
9907
|
process.stderr.write(`[WARNING] ${event.message}
|
|
9923
9908
|
`);
|
|
9924
9909
|
}
|
|
9925
9910
|
break;
|
|
9926
9911
|
}
|
|
9927
9912
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
9928
|
-
if (config.getOutputFormat() ===
|
|
9913
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
9929
9914
|
process.stderr.write(`[WARNING] ${event.message}
|
|
9930
9915
|
`);
|
|
9931
9916
|
}
|
|
9932
9917
|
if (streamFormatter) {
|
|
9933
9918
|
streamFormatter.emitEvent({
|
|
9934
|
-
type:
|
|
9919
|
+
type: "error" /* ERROR */,
|
|
9935
9920
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9936
9921
|
severity,
|
|
9937
9922
|
message: event.message
|
|
@@ -9950,7 +9935,7 @@ async function runNonInteractive({
|
|
|
9950
9935
|
);
|
|
9951
9936
|
} else if (streamFormatter) {
|
|
9952
9937
|
streamFormatter.emitEvent({
|
|
9953
|
-
type:
|
|
9938
|
+
type: "error" /* ERROR */,
|
|
9954
9939
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9955
9940
|
severity: "error",
|
|
9956
9941
|
message: "Maximum session turns exceeded"
|
|
@@ -9958,7 +9943,7 @@ async function runNonInteractive({
|
|
|
9958
9943
|
}
|
|
9959
9944
|
}
|
|
9960
9945
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
9961
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
9946
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
9962
9947
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
9963
9948
|
`);
|
|
9964
9949
|
}
|
|
@@ -9988,7 +9973,7 @@ async function runNonInteractive({
|
|
|
9988
9973
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
9989
9974
|
scheduler?.dispose();
|
|
9990
9975
|
consolePatcher.cleanup();
|
|
9991
|
-
coreEvents.off(
|
|
9976
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
9992
9977
|
}
|
|
9993
9978
|
if (errorToHandle) {
|
|
9994
9979
|
handleError(errorToHandle, config);
|
|
@@ -10013,7 +9998,7 @@ async function runNonInteractive2(params) {
|
|
|
10013
9998
|
}
|
|
10014
9999
|
});
|
|
10015
10000
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10016
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10001
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-L5LFSMIR.js");
|
|
10017
10002
|
await setupInitialActivityLogger(config);
|
|
10018
10003
|
}
|
|
10019
10004
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10029,7 +10014,7 @@ async function runNonInteractive2(params) {
|
|
|
10029
10014
|
}
|
|
10030
10015
|
};
|
|
10031
10016
|
const startTime = Date.now();
|
|
10032
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
10017
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
10033
10018
|
const abortController = new AbortController();
|
|
10034
10019
|
let isAborting = false;
|
|
10035
10020
|
let cancelMessageTimer = null;
|
|
@@ -10080,13 +10065,13 @@ async function runNonInteractive2(params) {
|
|
|
10080
10065
|
let scheduler;
|
|
10081
10066
|
try {
|
|
10082
10067
|
consolePatcher.patch();
|
|
10083
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
10068
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
10084
10069
|
process.stderr.write(
|
|
10085
10070
|
"[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"
|
|
10086
10071
|
);
|
|
10087
10072
|
}
|
|
10088
10073
|
setupStdinCancellation();
|
|
10089
|
-
coreEvents.on(
|
|
10074
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10090
10075
|
coreEvents.drainBacklogs();
|
|
10091
10076
|
process.stdout.on("error", (err) => {
|
|
10092
10077
|
if (err.code === "EPIPE") {
|
|
@@ -10110,7 +10095,7 @@ async function runNonInteractive2(params) {
|
|
|
10110
10095
|
}
|
|
10111
10096
|
if (streamFormatter) {
|
|
10112
10097
|
streamFormatter.emitEvent({
|
|
10113
|
-
type:
|
|
10098
|
+
type: "init" /* INIT */,
|
|
10114
10099
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10115
10100
|
session_id: config.getSessionId(),
|
|
10116
10101
|
model: config.getModel()
|
|
@@ -10148,7 +10133,7 @@ async function runNonInteractive2(params) {
|
|
|
10148
10133
|
}
|
|
10149
10134
|
if (streamFormatter) {
|
|
10150
10135
|
streamFormatter.emitEvent({
|
|
10151
|
-
type:
|
|
10136
|
+
type: "message" /* MESSAGE */,
|
|
10152
10137
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10153
10138
|
role: "user",
|
|
10154
10139
|
content: input
|
|
@@ -10175,28 +10160,28 @@ async function runNonInteractive2(params) {
|
|
|
10175
10160
|
if (abortController.signal.aborted) {
|
|
10176
10161
|
handleCancellationError(config);
|
|
10177
10162
|
}
|
|
10178
|
-
if (event.type ===
|
|
10163
|
+
if (event.type === "content" /* Content */) {
|
|
10179
10164
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
10180
10165
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
10181
10166
|
if (streamFormatter) {
|
|
10182
10167
|
streamFormatter.emitEvent({
|
|
10183
|
-
type:
|
|
10168
|
+
type: "message" /* MESSAGE */,
|
|
10184
10169
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10185
10170
|
role: "assistant",
|
|
10186
10171
|
content: output,
|
|
10187
10172
|
delta: true
|
|
10188
10173
|
});
|
|
10189
|
-
} else if (config.getOutputFormat() ===
|
|
10174
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10190
10175
|
responseText += output;
|
|
10191
10176
|
} else {
|
|
10192
10177
|
if (event.value) {
|
|
10193
10178
|
textOutput.write(output);
|
|
10194
10179
|
}
|
|
10195
10180
|
}
|
|
10196
|
-
} else if (event.type ===
|
|
10181
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
10197
10182
|
if (streamFormatter) {
|
|
10198
10183
|
streamFormatter.emitEvent({
|
|
10199
|
-
type:
|
|
10184
|
+
type: "tool_use" /* TOOL_USE */,
|
|
10200
10185
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10201
10186
|
tool_name: event.value.name,
|
|
10202
10187
|
tool_id: event.value.callId,
|
|
@@ -10204,29 +10189,29 @@ async function runNonInteractive2(params) {
|
|
|
10204
10189
|
});
|
|
10205
10190
|
}
|
|
10206
10191
|
toolCallRequests.push(event.value);
|
|
10207
|
-
} else if (event.type ===
|
|
10192
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
10208
10193
|
if (streamFormatter) {
|
|
10209
10194
|
streamFormatter.emitEvent({
|
|
10210
|
-
type:
|
|
10195
|
+
type: "error" /* ERROR */,
|
|
10211
10196
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10212
10197
|
severity: "warning",
|
|
10213
10198
|
message: "Loop detected, stopping execution"
|
|
10214
10199
|
});
|
|
10215
10200
|
}
|
|
10216
|
-
} else if (event.type ===
|
|
10201
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
10217
10202
|
if (streamFormatter) {
|
|
10218
10203
|
streamFormatter.emitEvent({
|
|
10219
|
-
type:
|
|
10204
|
+
type: "error" /* ERROR */,
|
|
10220
10205
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10221
10206
|
severity: "error",
|
|
10222
10207
|
message: "Maximum session turns exceeded"
|
|
10223
10208
|
});
|
|
10224
10209
|
}
|
|
10225
|
-
} else if (event.type ===
|
|
10210
|
+
} else if (event.type === "error" /* Error */) {
|
|
10226
10211
|
throw event.value.error;
|
|
10227
|
-
} else if (event.type ===
|
|
10212
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
10228
10213
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10229
|
-
if (config.getOutputFormat() ===
|
|
10214
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10230
10215
|
process.stderr.write(`${stopMessage}
|
|
10231
10216
|
`);
|
|
10232
10217
|
}
|
|
@@ -10234,7 +10219,7 @@ async function runNonInteractive2(params) {
|
|
|
10234
10219
|
const metrics = uiTelemetryService.getMetrics();
|
|
10235
10220
|
const durationMs = Date.now() - startTime;
|
|
10236
10221
|
streamFormatter.emitEvent({
|
|
10237
|
-
type:
|
|
10222
|
+
type: "result" /* RESULT */,
|
|
10238
10223
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10239
10224
|
status: "success",
|
|
10240
10225
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10244,9 +10229,9 @@ async function runNonInteractive2(params) {
|
|
|
10244
10229
|
});
|
|
10245
10230
|
}
|
|
10246
10231
|
return;
|
|
10247
|
-
} else if (event.type ===
|
|
10232
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
10248
10233
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
10249
|
-
if (config.getOutputFormat() ===
|
|
10234
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10250
10235
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
10251
10236
|
`);
|
|
10252
10237
|
}
|
|
@@ -10264,7 +10249,7 @@ async function runNonInteractive2(params) {
|
|
|
10264
10249
|
const requestInfo = completedToolCall.request;
|
|
10265
10250
|
if (streamFormatter) {
|
|
10266
10251
|
streamFormatter.emitEvent({
|
|
10267
|
-
type:
|
|
10252
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
10268
10253
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10269
10254
|
tool_id: requestInfo.callId,
|
|
10270
10255
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -10298,11 +10283,11 @@ async function runNonInteractive2(params) {
|
|
|
10298
10283
|
);
|
|
10299
10284
|
}
|
|
10300
10285
|
const stopExecutionTool = completedToolCalls.find(
|
|
10301
|
-
(tc) => tc.response.errorType ===
|
|
10286
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
10302
10287
|
);
|
|
10303
10288
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
10304
10289
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
10305
|
-
if (config.getOutputFormat() ===
|
|
10290
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
10306
10291
|
process.stderr.write(`${stopMessage}
|
|
10307
10292
|
`);
|
|
10308
10293
|
}
|
|
@@ -10310,7 +10295,7 @@ async function runNonInteractive2(params) {
|
|
|
10310
10295
|
const metrics = uiTelemetryService.getMetrics();
|
|
10311
10296
|
const durationMs = Date.now() - startTime;
|
|
10312
10297
|
streamFormatter.emitEvent({
|
|
10313
|
-
type:
|
|
10298
|
+
type: "result" /* RESULT */,
|
|
10314
10299
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10315
10300
|
status: "success",
|
|
10316
10301
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -10318,7 +10303,7 @@ async function runNonInteractive2(params) {
|
|
|
10318
10303
|
durationMs
|
|
10319
10304
|
)
|
|
10320
10305
|
});
|
|
10321
|
-
} else if (config.getOutputFormat() ===
|
|
10306
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10322
10307
|
const formatter = new JsonFormatter();
|
|
10323
10308
|
const stats = uiTelemetryService.getMetrics();
|
|
10324
10309
|
textOutput.write(
|
|
@@ -10335,12 +10320,12 @@ async function runNonInteractive2(params) {
|
|
|
10335
10320
|
const metrics = uiTelemetryService.getMetrics();
|
|
10336
10321
|
const durationMs = Date.now() - startTime;
|
|
10337
10322
|
streamFormatter.emitEvent({
|
|
10338
|
-
type:
|
|
10323
|
+
type: "result" /* RESULT */,
|
|
10339
10324
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10340
10325
|
status: "success",
|
|
10341
10326
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
10342
10327
|
});
|
|
10343
|
-
} else if (config.getOutputFormat() ===
|
|
10328
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10344
10329
|
const formatter = new JsonFormatter();
|
|
10345
10330
|
const stats = uiTelemetryService.getMetrics();
|
|
10346
10331
|
textOutput.write(
|
|
@@ -10358,7 +10343,7 @@ async function runNonInteractive2(params) {
|
|
|
10358
10343
|
cleanupStdinCancellation();
|
|
10359
10344
|
scheduler?.dispose();
|
|
10360
10345
|
consolePatcher.cleanup();
|
|
10361
|
-
coreEvents.off(
|
|
10346
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
10362
10347
|
}
|
|
10363
10348
|
if (errorToHandle) {
|
|
10364
10349
|
handleError(errorToHandle, config);
|
|
@@ -12829,12 +12814,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12829
12814
|
this.clientCapabilities = args.clientCapabilities;
|
|
12830
12815
|
const authMethods = [
|
|
12831
12816
|
{
|
|
12832
|
-
id:
|
|
12817
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
12833
12818
|
name: "Log in with Google",
|
|
12834
12819
|
description: "Log in with your Google account"
|
|
12835
12820
|
},
|
|
12836
12821
|
{
|
|
12837
|
-
id:
|
|
12822
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
12838
12823
|
name: "Gemini API key",
|
|
12839
12824
|
description: "Use an API key with Gemini Developer API",
|
|
12840
12825
|
_meta: {
|
|
@@ -12844,12 +12829,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12844
12829
|
}
|
|
12845
12830
|
},
|
|
12846
12831
|
{
|
|
12847
|
-
id:
|
|
12832
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
12848
12833
|
name: "Vertex AI",
|
|
12849
12834
|
description: "Use an API key with Vertex AI GenAI API"
|
|
12850
12835
|
},
|
|
12851
12836
|
{
|
|
12852
|
-
id:
|
|
12837
|
+
id: "gateway" /* GATEWAY */,
|
|
12853
12838
|
name: "AI API Gateway",
|
|
12854
12839
|
description: "Use a custom AI API Gateway",
|
|
12855
12840
|
_meta: {
|
|
@@ -12944,7 +12929,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12944
12929
|
mcpServers,
|
|
12945
12930
|
loadedSettings
|
|
12946
12931
|
);
|
|
12947
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
12932
|
+
const authType = loadedSettings.merged.security.auth.selectedType || "gemini-api-key" /* USE_GEMINI */;
|
|
12948
12933
|
let isAuthenticated = false;
|
|
12949
12934
|
let authErrorMessage = "";
|
|
12950
12935
|
try {
|
|
@@ -12956,7 +12941,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12956
12941
|
);
|
|
12957
12942
|
isAuthenticated = true;
|
|
12958
12943
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
12959
|
-
if (authType ===
|
|
12944
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
12960
12945
|
isAuthenticated = false;
|
|
12961
12946
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
12962
12947
|
}
|
|
@@ -13264,7 +13249,7 @@ ${thought.description}`;
|
|
|
13264
13249
|
await this.sendUpdate({
|
|
13265
13250
|
sessionUpdate: "tool_call",
|
|
13266
13251
|
toolCallId: toolCall.id,
|
|
13267
|
-
status: toolCall.status ===
|
|
13252
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
13268
13253
|
title: toolCall.displayName || toolCall.name,
|
|
13269
13254
|
content: toolCallContent,
|
|
13270
13255
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -13317,7 +13302,7 @@ ${thought.description}`;
|
|
|
13317
13302
|
while (nextMessage !== null) {
|
|
13318
13303
|
if (pendingSend.signal.aborted) {
|
|
13319
13304
|
chat.addHistory(nextMessage);
|
|
13320
|
-
return { stopReason:
|
|
13305
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
13321
13306
|
}
|
|
13322
13307
|
const functionCalls = [];
|
|
13323
13308
|
try {
|
|
@@ -13337,7 +13322,7 @@ ${thought.description}`;
|
|
|
13337
13322
|
nextMessage?.parts ?? [],
|
|
13338
13323
|
promptId,
|
|
13339
13324
|
pendingSend.signal,
|
|
13340
|
-
|
|
13325
|
+
"main" /* MAIN */
|
|
13341
13326
|
);
|
|
13342
13327
|
nextMessage = null;
|
|
13343
13328
|
let turnInputTokens = 0;
|
|
@@ -13345,16 +13330,16 @@ ${thought.description}`;
|
|
|
13345
13330
|
let turnModelId = model;
|
|
13346
13331
|
for await (const resp of responseStream) {
|
|
13347
13332
|
if (pendingSend.signal.aborted) {
|
|
13348
|
-
return { stopReason:
|
|
13333
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
13349
13334
|
}
|
|
13350
|
-
if (resp.type ===
|
|
13335
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.usageMetadata) {
|
|
13351
13336
|
turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
|
|
13352
13337
|
turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
|
|
13353
13338
|
if (resp.value.modelVersion) {
|
|
13354
13339
|
turnModelId = resp.value.modelVersion;
|
|
13355
13340
|
}
|
|
13356
13341
|
}
|
|
13357
|
-
if (resp.type ===
|
|
13342
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
13358
13343
|
const candidate = resp.value.candidates[0];
|
|
13359
13344
|
for (const part of candidate.content?.parts ?? []) {
|
|
13360
13345
|
if (!part.text) {
|
|
@@ -13370,7 +13355,7 @@ ${thought.description}`;
|
|
|
13370
13355
|
});
|
|
13371
13356
|
}
|
|
13372
13357
|
}
|
|
13373
|
-
if (resp.type ===
|
|
13358
|
+
if (resp.type === "chunk" /* CHUNK */ && resp.value.functionCalls) {
|
|
13374
13359
|
functionCalls.push(...resp.value.functionCalls);
|
|
13375
13360
|
}
|
|
13376
13361
|
}
|
|
@@ -13386,7 +13371,7 @@ ${thought.description}`;
|
|
|
13386
13371
|
modelUsageMap.set(turnModelId, existing);
|
|
13387
13372
|
}
|
|
13388
13373
|
if (pendingSend.signal.aborted) {
|
|
13389
|
-
return { stopReason:
|
|
13374
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
13390
13375
|
}
|
|
13391
13376
|
} catch (error) {
|
|
13392
13377
|
if (getErrorStatus(error) === 429) {
|
|
@@ -13396,7 +13381,7 @@ ${thought.description}`;
|
|
|
13396
13381
|
);
|
|
13397
13382
|
}
|
|
13398
13383
|
if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
|
|
13399
|
-
return { stopReason:
|
|
13384
|
+
return { stopReason: "cancelled" /* Cancelled */ };
|
|
13400
13385
|
}
|
|
13401
13386
|
if (error instanceof InvalidStreamError || error && typeof error === "object" && "type" in error && (error.type === "NO_RESPONSE_TEXT" || error.type === "NO_FINISH_REASON" || error.type === "MALFORMED_FUNCTION_CALL" || error.type === "UNEXPECTED_TOOL_CALL")) {
|
|
13402
13387
|
return {
|
|
@@ -13560,7 +13545,7 @@ ${thought.description}`;
|
|
|
13560
13545
|
const output = RequestPermissionResponseSchema.parse(
|
|
13561
13546
|
await this.connection.requestPermission(params)
|
|
13562
13547
|
);
|
|
13563
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
13548
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
13564
13549
|
await confirmationDetails.onConfirm(outcome);
|
|
13565
13550
|
await updatePolicy(
|
|
13566
13551
|
tool,
|
|
@@ -13571,16 +13556,16 @@ ${thought.description}`;
|
|
|
13571
13556
|
invocation
|
|
13572
13557
|
);
|
|
13573
13558
|
switch (outcome) {
|
|
13574
|
-
case
|
|
13559
|
+
case "cancel" /* Cancel */:
|
|
13575
13560
|
return errorResponse(
|
|
13576
13561
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
13577
13562
|
);
|
|
13578
|
-
case
|
|
13579
|
-
case
|
|
13580
|
-
case
|
|
13581
|
-
case
|
|
13582
|
-
case
|
|
13583
|
-
case
|
|
13563
|
+
case "proceed_once" /* ProceedOnce */:
|
|
13564
|
+
case "proceed_always" /* ProceedAlways */:
|
|
13565
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
13566
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
13567
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
13568
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
13584
13569
|
break;
|
|
13585
13570
|
default: {
|
|
13586
13571
|
const resultOutcome = outcome;
|
|
@@ -13628,7 +13613,7 @@ ${thought.description}`;
|
|
|
13628
13613
|
);
|
|
13629
13614
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
13630
13615
|
{
|
|
13631
|
-
status:
|
|
13616
|
+
status: "success" /* Success */,
|
|
13632
13617
|
request: {
|
|
13633
13618
|
callId,
|
|
13634
13619
|
name: fc.name,
|
|
@@ -13673,7 +13658,7 @@ ${thought.description}`;
|
|
|
13673
13658
|
});
|
|
13674
13659
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
13675
13660
|
{
|
|
13676
|
-
status:
|
|
13661
|
+
status: "error" /* Error */,
|
|
13677
13662
|
request: {
|
|
13678
13663
|
callId,
|
|
13679
13664
|
name: fc.name,
|
|
@@ -13788,12 +13773,12 @@ ${thought.description}`;
|
|
|
13788
13773
|
sessionId: this.id,
|
|
13789
13774
|
options: [
|
|
13790
13775
|
{
|
|
13791
|
-
optionId:
|
|
13776
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
13792
13777
|
name: "Allow once",
|
|
13793
13778
|
kind: "allow_once"
|
|
13794
13779
|
},
|
|
13795
13780
|
{
|
|
13796
|
-
optionId:
|
|
13781
|
+
optionId: "cancel" /* Cancel */,
|
|
13797
13782
|
name: "Deny",
|
|
13798
13783
|
kind: "reject_once"
|
|
13799
13784
|
}
|
|
@@ -13818,8 +13803,8 @@ ${thought.description}`;
|
|
|
13818
13803
|
const output = RequestPermissionResponseSchema.parse(
|
|
13819
13804
|
await this.connection.requestPermission(params)
|
|
13820
13805
|
);
|
|
13821
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
13822
|
-
if (outcome ===
|
|
13806
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
13807
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
13823
13808
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
13824
13809
|
validationError = null;
|
|
13825
13810
|
} else {
|
|
@@ -14196,12 +14181,12 @@ function toToolCallContent(toolResult) {
|
|
|
14196
14181
|
}
|
|
14197
14182
|
var basicPermissionOptions = [
|
|
14198
14183
|
{
|
|
14199
|
-
optionId:
|
|
14184
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14200
14185
|
name: "Allow",
|
|
14201
14186
|
kind: "allow_once"
|
|
14202
14187
|
},
|
|
14203
14188
|
{
|
|
14204
|
-
optionId:
|
|
14189
|
+
optionId: "cancel" /* Cancel */,
|
|
14205
14190
|
name: "Reject",
|
|
14206
14191
|
kind: "reject_once"
|
|
14207
14192
|
}
|
|
@@ -14213,13 +14198,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14213
14198
|
switch (confirmation.type) {
|
|
14214
14199
|
case "edit":
|
|
14215
14200
|
options.push({
|
|
14216
|
-
optionId:
|
|
14201
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14217
14202
|
name: "Allow for this session",
|
|
14218
14203
|
kind: "allow_always"
|
|
14219
14204
|
});
|
|
14220
14205
|
if (enablePermanentToolApproval) {
|
|
14221
14206
|
options.push({
|
|
14222
|
-
optionId:
|
|
14207
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14223
14208
|
name: "Allow for this file in all future sessions",
|
|
14224
14209
|
kind: "allow_always"
|
|
14225
14210
|
});
|
|
@@ -14227,13 +14212,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14227
14212
|
break;
|
|
14228
14213
|
case "exec":
|
|
14229
14214
|
options.push({
|
|
14230
|
-
optionId:
|
|
14215
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14231
14216
|
name: "Allow for this session",
|
|
14232
14217
|
kind: "allow_always"
|
|
14233
14218
|
});
|
|
14234
14219
|
if (enablePermanentToolApproval) {
|
|
14235
14220
|
options.push({
|
|
14236
|
-
optionId:
|
|
14221
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14237
14222
|
name: "Allow this command for all future sessions",
|
|
14238
14223
|
kind: "allow_always"
|
|
14239
14224
|
});
|
|
@@ -14242,19 +14227,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14242
14227
|
case "mcp":
|
|
14243
14228
|
options.push(
|
|
14244
14229
|
{
|
|
14245
|
-
optionId:
|
|
14230
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14246
14231
|
name: "Allow all server tools for this session",
|
|
14247
14232
|
kind: "allow_always"
|
|
14248
14233
|
},
|
|
14249
14234
|
{
|
|
14250
|
-
optionId:
|
|
14235
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14251
14236
|
name: "Allow tool for this session",
|
|
14252
14237
|
kind: "allow_always"
|
|
14253
14238
|
}
|
|
14254
14239
|
);
|
|
14255
14240
|
if (enablePermanentToolApproval) {
|
|
14256
14241
|
options.push({
|
|
14257
|
-
optionId:
|
|
14242
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14258
14243
|
name: "Allow tool for all future sessions",
|
|
14259
14244
|
kind: "allow_always"
|
|
14260
14245
|
});
|
|
@@ -14262,13 +14247,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14262
14247
|
break;
|
|
14263
14248
|
case "info":
|
|
14264
14249
|
options.push({
|
|
14265
|
-
optionId:
|
|
14250
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14266
14251
|
name: "Allow for this session",
|
|
14267
14252
|
kind: "allow_always"
|
|
14268
14253
|
});
|
|
14269
14254
|
if (enablePermanentToolApproval) {
|
|
14270
14255
|
options.push({
|
|
14271
|
-
optionId:
|
|
14256
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14272
14257
|
name: "Allow for all future sessions",
|
|
14273
14258
|
kind: "allow_always"
|
|
14274
14259
|
});
|
|
@@ -14300,21 +14285,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14300
14285
|
}
|
|
14301
14286
|
function toAcpToolKind(kind) {
|
|
14302
14287
|
switch (kind) {
|
|
14303
|
-
case
|
|
14304
|
-
case
|
|
14305
|
-
case
|
|
14306
|
-
case
|
|
14307
|
-
case
|
|
14308
|
-
case
|
|
14309
|
-
case
|
|
14310
|
-
case
|
|
14311
|
-
case
|
|
14312
|
-
case
|
|
14288
|
+
case "read" /* Read */:
|
|
14289
|
+
case "edit" /* Edit */:
|
|
14290
|
+
case "execute" /* Execute */:
|
|
14291
|
+
case "search" /* Search */:
|
|
14292
|
+
case "delete" /* Delete */:
|
|
14293
|
+
case "move" /* Move */:
|
|
14294
|
+
case "think" /* Think */:
|
|
14295
|
+
case "fetch" /* Fetch */:
|
|
14296
|
+
case "switch_mode" /* SwitchMode */:
|
|
14297
|
+
case "other" /* Other */:
|
|
14313
14298
|
return kind;
|
|
14314
|
-
case
|
|
14299
|
+
case "agent" /* Agent */:
|
|
14315
14300
|
return "think";
|
|
14316
|
-
case
|
|
14317
|
-
case
|
|
14301
|
+
case "plan" /* Plan */:
|
|
14302
|
+
case "communicate" /* Communicate */:
|
|
14318
14303
|
default:
|
|
14319
14304
|
return "other";
|
|
14320
14305
|
}
|
|
@@ -14322,24 +14307,24 @@ function toAcpToolKind(kind) {
|
|
|
14322
14307
|
function buildAvailableModes(isPlanEnabled) {
|
|
14323
14308
|
const modes = [
|
|
14324
14309
|
{
|
|
14325
|
-
id:
|
|
14310
|
+
id: "default" /* DEFAULT */,
|
|
14326
14311
|
name: "Default",
|
|
14327
14312
|
description: "Prompts for approval"
|
|
14328
14313
|
},
|
|
14329
14314
|
{
|
|
14330
|
-
id:
|
|
14315
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
14331
14316
|
name: "Auto Edit",
|
|
14332
14317
|
description: "Auto-approves edit tools"
|
|
14333
14318
|
},
|
|
14334
14319
|
{
|
|
14335
|
-
id:
|
|
14320
|
+
id: "yolo" /* YOLO */,
|
|
14336
14321
|
name: "YOLO",
|
|
14337
14322
|
description: "Auto-approves all tools"
|
|
14338
14323
|
}
|
|
14339
14324
|
];
|
|
14340
14325
|
if (isPlanEnabled) {
|
|
14341
14326
|
modes.push({
|
|
14342
|
-
id:
|
|
14327
|
+
id: "plan" /* PLAN */,
|
|
14343
14328
|
name: "Plan",
|
|
14344
14329
|
description: "Read-only mode"
|
|
14345
14330
|
});
|
|
@@ -14352,7 +14337,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14352
14337
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14353
14338
|
const useGemini31FlashLite = config.getGemini31FlashLiteLaunchedSync?.() ?? false;
|
|
14354
14339
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14355
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14340
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
14356
14341
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14357
14342
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14358
14343
|
useGemini3_1: useGemini31,
|
|
@@ -14450,7 +14435,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
14450
14435
|
}
|
|
14451
14436
|
return authType;
|
|
14452
14437
|
} catch (error) {
|
|
14453
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
14438
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
14454
14439
|
handleError(
|
|
14455
14440
|
error instanceof Error ? error : new Error(String(error)),
|
|
14456
14441
|
nonInteractiveConfig,
|
|
@@ -14646,10 +14631,10 @@ var SlashCommandConflictHandler = class {
|
|
|
14646
14631
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
14647
14632
|
}
|
|
14648
14633
|
start() {
|
|
14649
|
-
coreEvents.on(
|
|
14634
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
14650
14635
|
}
|
|
14651
14636
|
stop() {
|
|
14652
|
-
coreEvents.off(
|
|
14637
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
14653
14638
|
if (this.flushTimeout) {
|
|
14654
14639
|
clearTimeout(this.flushTimeout);
|
|
14655
14640
|
this.flushTimeout = null;
|
|
@@ -14860,7 +14845,7 @@ async function resolveSessionId(resumeArg) {
|
|
|
14860
14845
|
}
|
|
14861
14846
|
}
|
|
14862
14847
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
14863
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
14848
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-C46TDPVW.js");
|
|
14864
14849
|
await doStartUI(
|
|
14865
14850
|
config,
|
|
14866
14851
|
settings,
|
|
@@ -14959,12 +14944,12 @@ async function main() {
|
|
|
14959
14944
|
dns.setDefaultResultOrder(
|
|
14960
14945
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
14961
14946
|
);
|
|
14962
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
14947
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
14963
14948
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
14964
14949
|
settings.setValue(
|
|
14965
14950
|
"User" /* User */,
|
|
14966
14951
|
"security.auth.selectedType",
|
|
14967
|
-
|
|
14952
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
14968
14953
|
);
|
|
14969
14954
|
}
|
|
14970
14955
|
}
|
|
@@ -15062,7 +15047,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15062
15047
|
await config.storage.initialize();
|
|
15063
15048
|
adminControlsListner.setConfig(config);
|
|
15064
15049
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15065
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
15050
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-L5LFSMIR.js");
|
|
15066
15051
|
await setupInitialActivityLogger(config);
|
|
15067
15052
|
}
|
|
15068
15053
|
registerTelemetryConfig(config);
|
|
@@ -15070,7 +15055,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15070
15055
|
const messageBus = config.getMessageBus();
|
|
15071
15056
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
15072
15057
|
registerCleanup(async () => {
|
|
15073
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
15058
|
+
await config.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
15074
15059
|
});
|
|
15075
15060
|
cleanupExpiredSessions(config, settings.merged).catch((e) => {
|
|
15076
15061
|
debugLogger.error("Failed to cleanup expired sessions:", e);
|
|
@@ -15118,7 +15103,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15118
15103
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
15119
15104
|
const initializationResult = await initializeApp(config, settings);
|
|
15120
15105
|
initAppHandle?.end();
|
|
15121
|
-
if (settings.merged.security.auth.selectedType ===
|
|
15106
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
15122
15107
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
15123
15108
|
}
|
|
15124
15109
|
if (config.getAcpMode()) {
|
|
@@ -15134,7 +15119,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15134
15119
|
...rawStartupWarnings.map((message) => ({
|
|
15135
15120
|
id: `startup-${createHash("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
15136
15121
|
message,
|
|
15137
|
-
priority:
|
|
15122
|
+
priority: "high" /* High */
|
|
15138
15123
|
})),
|
|
15139
15124
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
15140
15125
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -15166,7 +15151,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15166
15151
|
${input}` : stdinData;
|
|
15167
15152
|
}
|
|
15168
15153
|
}
|
|
15169
|
-
const sessionStartSource = resumedSessionData ?
|
|
15154
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
15170
15155
|
const hookSystem = config?.getHookSystem();
|
|
15171
15156
|
if (hookSystem) {
|
|
15172
15157
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -15223,16 +15208,16 @@ ${input}` : wrappedContext;
|
|
|
15223
15208
|
}
|
|
15224
15209
|
}
|
|
15225
15210
|
function initializeOutputListenersAndFlush() {
|
|
15226
|
-
if (coreEvents.listenerCount(
|
|
15227
|
-
coreEvents.on(
|
|
15211
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
15212
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
15228
15213
|
if (payload.isStderr) {
|
|
15229
15214
|
writeToStderr(payload.chunk, payload.encoding);
|
|
15230
15215
|
} else {
|
|
15231
15216
|
writeToStdout(payload.chunk, payload.encoding);
|
|
15232
15217
|
}
|
|
15233
15218
|
});
|
|
15234
|
-
if (coreEvents.listenerCount(
|
|
15235
|
-
coreEvents.on(
|
|
15219
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
15220
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
15236
15221
|
if (payload.type === "error" || payload.type === "warn") {
|
|
15237
15222
|
writeToStderr(payload.content);
|
|
15238
15223
|
} else {
|
|
@@ -15240,8 +15225,8 @@ function initializeOutputListenersAndFlush() {
|
|
|
15240
15225
|
}
|
|
15241
15226
|
});
|
|
15242
15227
|
}
|
|
15243
|
-
if (coreEvents.listenerCount(
|
|
15244
|
-
coreEvents.on(
|
|
15228
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
15229
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
15245
15230
|
if (payload.severity === "error" || payload.severity === "warning") {
|
|
15246
15231
|
writeToStderr(payload.message);
|
|
15247
15232
|
} else {
|