@google/gemini-cli 0.36.0-preview.0 → 0.36.0-preview.2
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-K2M7OTIP.js → chunk-25V3TYNR.js} +9 -10
- package/bundle/{chunk-N7MAJ3JD.js → chunk-6F64DR53.js} +6 -6
- package/bundle/{chunk-6UAL5KXG.js → chunk-EUXACAGL.js} +9 -12
- package/bundle/{chunk-BE2CAP4N.js → chunk-HLML5SVJ.js} +29 -27
- package/bundle/{chunk-3HNPGRRW.js → chunk-IOJJTEIC.js} +2 -2
- package/bundle/{chunk-S36ET7IB.js → chunk-KGPUJGU6.js} +6 -6
- package/bundle/{chunk-3XQWOVPH.js → chunk-MRJRXC63.js} +2 -2
- package/bundle/{chunk-HXZPARYO.js → chunk-MXNIJ4RK.js} +2 -2
- package/bundle/{chunk-4NIOHPQN.js → chunk-NKTSTYJO.js} +72 -60
- package/bundle/chunk-NT4MG3B6.js +93175 -0
- package/bundle/chunk-OOZG4FMQ.js +137 -0
- package/bundle/{chunk-PVQN7ZVP.js → chunk-PXG3YTLU.js} +42 -27
- package/bundle/{chunk-CDXJ3P4V.js → chunk-SV2TJWFU.js} +5596 -10443
- package/bundle/chunk-WHT3ZS7S.js +354051 -0
- package/bundle/{cleanup-6R6IEU7T.js → cleanup-2WKEMFXG.js} +3 -3
- package/bundle/{cleanup-I7KFQ3LC.js → cleanup-B67M5WAO.js} +3 -3
- package/bundle/{cleanup-R6KR4XCS.js → cleanup-PJ323T24.js} +3 -3
- package/bundle/cleanup-PKVUY3XO.js +29 -0
- package/bundle/{core-IZK42CWE.js → core-7GUY3XKQ.js} +2 -2
- package/bundle/{devtoolsService-HLM6BC5R.js → devtoolsService-B7OD724C.js} +3 -3
- package/bundle/{devtoolsService-GIESJD2E.js → devtoolsService-JGPJ2GN4.js} +5 -4
- package/bundle/{devtoolsService-PGDD2J4F.js → devtoolsService-LU3DLIVB.js} +3 -3
- package/bundle/devtoolsService-RGAOIVMN.js +854 -0
- package/bundle/{core-J3CTNETR.js → dist-DTCLJTHN.js} +2 -2
- package/bundle/{dist-6WEZWPRQ.js → dist-X3ESBKEG.js} +2 -2
- package/bundle/dist-YQXQRQYA.js +1882 -0
- package/bundle/docs/reference/configuration.md +1 -1
- package/bundle/{gemini-AI362DTR.js → gemini-7BPDTLSV.js} +7 -7
- package/bundle/{gemini-GZFHIDDH.js → gemini-CJ5HU32O.js} +155 -140
- package/bundle/{gemini-5ARDVELJ.js → gemini-GA5SXGI6.js} +7 -7
- package/bundle/gemini-RFUB3W5S.js +14455 -0
- package/bundle/gemini.js +4 -4
- package/bundle/{interactiveCli-OYO74BPW.js → interactiveCli-2EVI7UVZ.js} +5 -5
- package/bundle/{interactiveCli-LGOLNK44.js → interactiveCli-2OAVBJCC.js} +253 -236
- package/bundle/{interactiveCli-PXX77G77.js → interactiveCli-CRDA6GQ7.js} +5 -5
- package/bundle/interactiveCli-SHFDAMKC.js +49314 -0
- package/bundle/{memoryDiscovery-WPGC7DAZ.js → memoryDiscovery-JXHCZBWK.js} +1 -1
- package/bundle/{memoryDiscovery-FNLUOGLO.js → memoryDiscovery-VQKOP6YW.js} +1 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
- package/bundle/{oauth2-provider-X3F7PSVB.js → oauth2-provider-D6HJJAVX.js} +2 -2
- package/bundle/{oauth2-provider-I6AYNUSI.js → oauth2-provider-KEZJCOYM.js} +39 -73
- package/bundle/oauth2-provider-TSEQG63I.js +237 -0
- package/bundle/{oauth2-provider-G7GIGUQF.js → oauth2-provider-ZT3CIEZO.js} +2 -2
- package/bundle/policies/plan.toml +10 -0
- package/package.json +1 -1
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
updateAllUpdatableExtensions,
|
|
60
60
|
updateExtension,
|
|
61
61
|
validateAuthMethod
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-NKTSTYJO.js";
|
|
63
63
|
import {
|
|
64
64
|
cleanupCheckpoints,
|
|
65
65
|
registerCleanup,
|
|
@@ -68,28 +68,39 @@ import {
|
|
|
68
68
|
runExitCleanup,
|
|
69
69
|
runSyncCleanup,
|
|
70
70
|
setupSignalHandlers
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-MRJRXC63.js";
|
|
72
72
|
import {
|
|
73
73
|
AuthType,
|
|
74
74
|
ChatRecordingService,
|
|
75
75
|
Client,
|
|
76
76
|
Config,
|
|
77
|
+
CoreToolCallStatus,
|
|
77
78
|
ExitCodes,
|
|
78
79
|
FileDiscoveryService,
|
|
79
80
|
FolderTrustDiscoveryService,
|
|
81
|
+
GeminiEventType,
|
|
82
|
+
IntegrityStatus,
|
|
80
83
|
JsonFormatter,
|
|
84
|
+
JsonStreamEventType,
|
|
85
|
+
LlmRole,
|
|
81
86
|
Logger,
|
|
82
87
|
MCPServerConfig,
|
|
88
|
+
MCPServerStatus,
|
|
89
|
+
OutputFormat,
|
|
83
90
|
PolicyIntegrityManager,
|
|
84
91
|
ROOT_SCHEDULER_ID,
|
|
85
92
|
ReadManyFilesTool,
|
|
86
93
|
Scheduler,
|
|
94
|
+
SessionEndReason,
|
|
95
|
+
SessionStartSource,
|
|
87
96
|
ShellExecutionService,
|
|
97
|
+
StreamEventType,
|
|
88
98
|
StreamJsonFormatter,
|
|
89
99
|
ToolCallEvent,
|
|
90
100
|
UserPromptEvent,
|
|
91
101
|
ValidationCancelledError,
|
|
92
102
|
ValidationRequiredError,
|
|
103
|
+
WarningPriority,
|
|
93
104
|
addMemory,
|
|
94
105
|
applyAdminAllowlist,
|
|
95
106
|
applyRequiredServers,
|
|
@@ -143,9 +154,11 @@ import {
|
|
|
143
154
|
uiTelemetryService,
|
|
144
155
|
writeToStderr,
|
|
145
156
|
writeToStdout
|
|
146
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-EUXACAGL.js";
|
|
147
158
|
import {
|
|
148
159
|
ASK_USER_TOOL_NAME,
|
|
160
|
+
ApprovalMode,
|
|
161
|
+
CoreEvent,
|
|
149
162
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
150
163
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
151
164
|
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
@@ -162,6 +175,7 @@ import {
|
|
|
162
175
|
FatalTurnLimitedError,
|
|
163
176
|
GEMINI_DIR,
|
|
164
177
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
178
|
+
Kind,
|
|
165
179
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
166
180
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
167
181
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
@@ -170,6 +184,7 @@ import {
|
|
|
170
184
|
REFERENCE_CONTENT_START,
|
|
171
185
|
Storage,
|
|
172
186
|
ToolConfirmationOutcome,
|
|
187
|
+
ToolErrorType,
|
|
173
188
|
coreEvents,
|
|
174
189
|
debugLogger,
|
|
175
190
|
external_exports,
|
|
@@ -183,7 +198,7 @@ import {
|
|
|
183
198
|
resolveModel,
|
|
184
199
|
resolveToRealPath,
|
|
185
200
|
setGeminiMdFilename
|
|
186
|
-
} from "./chunk-
|
|
201
|
+
} from "./chunk-HLML5SVJ.js";
|
|
187
202
|
import "./chunk-664ZODQF.js";
|
|
188
203
|
import "./chunk-RJTRUG2J.js";
|
|
189
204
|
import "./chunk-IUUIT4SU.js";
|
|
@@ -5474,7 +5489,7 @@ async function getMcpServersFromConfig(settings) {
|
|
|
5474
5489
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5475
5490
|
const isStdio = !!config.command;
|
|
5476
5491
|
if (isStdio && !isTrusted) {
|
|
5477
|
-
return
|
|
5492
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5478
5493
|
}
|
|
5479
5494
|
const client = new Client({
|
|
5480
5495
|
name: "mcp-test-client",
|
|
@@ -5510,16 +5525,16 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5510
5525
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5511
5526
|
} catch (_error) {
|
|
5512
5527
|
await client.close();
|
|
5513
|
-
return
|
|
5528
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5514
5529
|
}
|
|
5515
5530
|
try {
|
|
5516
5531
|
await client.connect(transport, { timeout: 5e3 });
|
|
5517
5532
|
await client.ping();
|
|
5518
5533
|
await client.close();
|
|
5519
|
-
return
|
|
5534
|
+
return MCPServerStatus.CONNECTED;
|
|
5520
5535
|
} catch (_error) {
|
|
5521
5536
|
await transport.close();
|
|
5522
|
-
return
|
|
5537
|
+
return MCPServerStatus.DISCONNECTED;
|
|
5523
5538
|
}
|
|
5524
5539
|
}
|
|
5525
5540
|
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
@@ -5532,9 +5547,9 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5532
5547
|
});
|
|
5533
5548
|
if (!loadResult.allowed) {
|
|
5534
5549
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5535
|
-
return
|
|
5550
|
+
return MCPServerStatus.BLOCKED;
|
|
5536
5551
|
}
|
|
5537
|
-
return
|
|
5552
|
+
return MCPServerStatus.DISABLED;
|
|
5538
5553
|
}
|
|
5539
5554
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5540
5555
|
}
|
|
@@ -5568,23 +5583,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5568
5583
|
let statusIndicator = "";
|
|
5569
5584
|
let statusText = "";
|
|
5570
5585
|
switch (status) {
|
|
5571
|
-
case
|
|
5586
|
+
case MCPServerStatus.CONNECTED:
|
|
5572
5587
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5573
5588
|
statusText = "Connected";
|
|
5574
5589
|
break;
|
|
5575
|
-
case
|
|
5590
|
+
case MCPServerStatus.CONNECTING:
|
|
5576
5591
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5577
5592
|
statusText = "Connecting";
|
|
5578
5593
|
break;
|
|
5579
|
-
case
|
|
5594
|
+
case MCPServerStatus.BLOCKED:
|
|
5580
5595
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5581
5596
|
statusText = "Blocked";
|
|
5582
5597
|
break;
|
|
5583
|
-
case
|
|
5598
|
+
case MCPServerStatus.DISABLED:
|
|
5584
5599
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5585
5600
|
statusText = "Disabled";
|
|
5586
5601
|
break;
|
|
5587
|
-
case
|
|
5602
|
+
case MCPServerStatus.DISCONNECTED:
|
|
5588
5603
|
default:
|
|
5589
5604
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5590
5605
|
statusText = "Disconnected";
|
|
@@ -7230,7 +7245,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7230
7245
|
}
|
|
7231
7246
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7232
7247
|
const packageJson = await getPackageJson(__dirname3);
|
|
7233
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.36.0-
|
|
7248
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.36.0-preview.2" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7234
7249
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7235
7250
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7236
7251
|
}
|
|
@@ -7284,9 +7299,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7284
7299
|
cwd,
|
|
7285
7300
|
potentialWorkspacePoliciesDir
|
|
7286
7301
|
);
|
|
7287
|
-
if (integrityResult.status ===
|
|
7302
|
+
if (integrityResult.status === IntegrityStatus.MATCH) {
|
|
7288
7303
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7289
|
-
} else if (integrityResult.status ===
|
|
7304
|
+
} else if (integrityResult.status === IntegrityStatus.NEW && integrityResult.fileCount === 0) {
|
|
7290
7305
|
workspacePoliciesDir = void 0;
|
|
7291
7306
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7292
7307
|
policyUpdateConfirmationRequest = {
|
|
@@ -7679,23 +7694,23 @@ async function loadCliConfig(settings, sessionId2, argv, options = {}) {
|
|
|
7679
7694
|
if (rawApprovalMode) {
|
|
7680
7695
|
switch (rawApprovalMode) {
|
|
7681
7696
|
case "yolo":
|
|
7682
|
-
approvalMode =
|
|
7697
|
+
approvalMode = ApprovalMode.YOLO;
|
|
7683
7698
|
break;
|
|
7684
7699
|
case "auto_edit":
|
|
7685
|
-
approvalMode =
|
|
7700
|
+
approvalMode = ApprovalMode.AUTO_EDIT;
|
|
7686
7701
|
break;
|
|
7687
7702
|
case "plan":
|
|
7688
7703
|
if (!(settings.experimental?.plan ?? false)) {
|
|
7689
7704
|
debugLogger.warn(
|
|
7690
7705
|
'Approval mode "plan" is only available when experimental.plan is enabled. Falling back to "default".'
|
|
7691
7706
|
);
|
|
7692
|
-
approvalMode =
|
|
7707
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
7693
7708
|
} else {
|
|
7694
|
-
approvalMode =
|
|
7709
|
+
approvalMode = ApprovalMode.PLAN;
|
|
7695
7710
|
}
|
|
7696
7711
|
break;
|
|
7697
7712
|
case "default":
|
|
7698
|
-
approvalMode =
|
|
7713
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
7699
7714
|
break;
|
|
7700
7715
|
default:
|
|
7701
7716
|
throw new Error(
|
|
@@ -7703,10 +7718,10 @@ async function loadCliConfig(settings, sessionId2, argv, options = {}) {
|
|
|
7703
7718
|
);
|
|
7704
7719
|
}
|
|
7705
7720
|
} else {
|
|
7706
|
-
approvalMode =
|
|
7721
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
7707
7722
|
}
|
|
7708
7723
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
7709
|
-
if (approvalMode ===
|
|
7724
|
+
if (approvalMode === ApprovalMode.YOLO) {
|
|
7710
7725
|
if (settings.admin?.secureModeEnabled) {
|
|
7711
7726
|
debugLogger.error(
|
|
7712
7727
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -7724,16 +7739,16 @@ async function loadCliConfig(settings, sessionId2, argv, options = {}) {
|
|
|
7724
7739
|
)
|
|
7725
7740
|
);
|
|
7726
7741
|
}
|
|
7727
|
-
} else if (approvalMode ===
|
|
7742
|
+
} else if (approvalMode === ApprovalMode.YOLO) {
|
|
7728
7743
|
debugLogger.warn(
|
|
7729
7744
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
7730
7745
|
);
|
|
7731
7746
|
}
|
|
7732
|
-
if (!trustedFolder && approvalMode !==
|
|
7747
|
+
if (!trustedFolder && approvalMode !== ApprovalMode.DEFAULT) {
|
|
7733
7748
|
debugLogger.warn(
|
|
7734
7749
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
7735
7750
|
);
|
|
7736
|
-
approvalMode =
|
|
7751
|
+
approvalMode = ApprovalMode.DEFAULT;
|
|
7737
7752
|
}
|
|
7738
7753
|
let telemetrySettings;
|
|
7739
7754
|
try {
|
|
@@ -9103,7 +9118,7 @@ import path8 from "node:path";
|
|
|
9103
9118
|
import process4 from "node:process";
|
|
9104
9119
|
var homeDirectoryCheck = {
|
|
9105
9120
|
id: "home-directory",
|
|
9106
|
-
priority:
|
|
9121
|
+
priority: WarningPriority.Low,
|
|
9107
9122
|
check: async (workspaceRoot, settings) => {
|
|
9108
9123
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
9109
9124
|
return null;
|
|
@@ -9127,7 +9142,7 @@ var homeDirectoryCheck = {
|
|
|
9127
9142
|
};
|
|
9128
9143
|
var rootDirectoryCheck = {
|
|
9129
9144
|
id: "root-directory",
|
|
9130
|
-
priority:
|
|
9145
|
+
priority: WarningPriority.High,
|
|
9131
9146
|
check: async (workspaceRoot, _settings) => {
|
|
9132
9147
|
try {
|
|
9133
9148
|
const workspaceRealPath = await fs6.realpath(workspaceRoot);
|
|
@@ -9311,12 +9326,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
9311
9326
|
error,
|
|
9312
9327
|
config.getContentGeneratorConfig()?.authType
|
|
9313
9328
|
);
|
|
9314
|
-
if (config.getOutputFormat() ===
|
|
9329
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
9315
9330
|
const streamFormatter = new StreamJsonFormatter();
|
|
9316
9331
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
9317
9332
|
const metrics = uiTelemetryService.getMetrics();
|
|
9318
9333
|
streamFormatter.emitEvent({
|
|
9319
|
-
type:
|
|
9334
|
+
type: JsonStreamEventType.RESULT,
|
|
9320
9335
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9321
9336
|
status: "error",
|
|
9322
9337
|
error: {
|
|
@@ -9327,7 +9342,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
9327
9342
|
});
|
|
9328
9343
|
runSyncCleanup();
|
|
9329
9344
|
process.exit(getNumericExitCode(errorCode));
|
|
9330
|
-
} else if (config.getOutputFormat() ===
|
|
9345
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9331
9346
|
const formatter = new JsonFormatter();
|
|
9332
9347
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
9333
9348
|
const formattedError = formatter.formatError(
|
|
@@ -9347,11 +9362,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
9347
9362
|
const isFatal = isFatalToolError(errorType);
|
|
9348
9363
|
if (isFatal) {
|
|
9349
9364
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
9350
|
-
if (config.getOutputFormat() ===
|
|
9365
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
9351
9366
|
const streamFormatter = new StreamJsonFormatter();
|
|
9352
9367
|
const metrics = uiTelemetryService.getMetrics();
|
|
9353
9368
|
streamFormatter.emitEvent({
|
|
9354
|
-
type:
|
|
9369
|
+
type: JsonStreamEventType.RESULT,
|
|
9355
9370
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9356
9371
|
status: "error",
|
|
9357
9372
|
error: {
|
|
@@ -9360,7 +9375,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
9360
9375
|
},
|
|
9361
9376
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
9362
9377
|
});
|
|
9363
|
-
} else if (config.getOutputFormat() ===
|
|
9378
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9364
9379
|
const formatter = new JsonFormatter();
|
|
9365
9380
|
const formattedError = formatter.formatError(
|
|
9366
9381
|
toolExecutionError,
|
|
@@ -9378,11 +9393,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
9378
9393
|
}
|
|
9379
9394
|
function handleCancellationError(config) {
|
|
9380
9395
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
9381
|
-
if (config.getOutputFormat() ===
|
|
9396
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
9382
9397
|
const streamFormatter = new StreamJsonFormatter();
|
|
9383
9398
|
const metrics = uiTelemetryService.getMetrics();
|
|
9384
9399
|
streamFormatter.emitEvent({
|
|
9385
|
-
type:
|
|
9400
|
+
type: JsonStreamEventType.RESULT,
|
|
9386
9401
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9387
9402
|
status: "error",
|
|
9388
9403
|
error: {
|
|
@@ -9393,7 +9408,7 @@ function handleCancellationError(config) {
|
|
|
9393
9408
|
});
|
|
9394
9409
|
runSyncCleanup();
|
|
9395
9410
|
process.exit(cancellationError.exitCode);
|
|
9396
|
-
} else if (config.getOutputFormat() ===
|
|
9411
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9397
9412
|
const formatter = new JsonFormatter();
|
|
9398
9413
|
const formattedError = formatter.formatError(
|
|
9399
9414
|
cancellationError,
|
|
@@ -9413,11 +9428,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
9413
9428
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
9414
9429
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
9415
9430
|
);
|
|
9416
|
-
if (config.getOutputFormat() ===
|
|
9431
|
+
if (config.getOutputFormat() === OutputFormat.STREAM_JSON) {
|
|
9417
9432
|
const streamFormatter = new StreamJsonFormatter();
|
|
9418
9433
|
const metrics = uiTelemetryService.getMetrics();
|
|
9419
9434
|
streamFormatter.emitEvent({
|
|
9420
|
-
type:
|
|
9435
|
+
type: JsonStreamEventType.RESULT,
|
|
9421
9436
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9422
9437
|
status: "error",
|
|
9423
9438
|
error: {
|
|
@@ -9428,7 +9443,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
9428
9443
|
});
|
|
9429
9444
|
runSyncCleanup();
|
|
9430
9445
|
process.exit(maxTurnsError.exitCode);
|
|
9431
|
-
} else if (config.getOutputFormat() ===
|
|
9446
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9432
9447
|
const formatter = new JsonFormatter();
|
|
9433
9448
|
const formattedError = formatter.formatError(
|
|
9434
9449
|
maxTurnsError,
|
|
@@ -9506,7 +9521,7 @@ async function runNonInteractive({
|
|
|
9506
9521
|
}
|
|
9507
9522
|
});
|
|
9508
9523
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
9509
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
9524
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-B7OD724C.js");
|
|
9510
9525
|
await setupInitialActivityLogger(config);
|
|
9511
9526
|
}
|
|
9512
9527
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -9522,7 +9537,7 @@ async function runNonInteractive({
|
|
|
9522
9537
|
}
|
|
9523
9538
|
};
|
|
9524
9539
|
const startTime = Date.now();
|
|
9525
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
9540
|
+
const streamFormatter = config.getOutputFormat() === OutputFormat.STREAM_JSON ? new StreamJsonFormatter() : null;
|
|
9526
9541
|
const abortController = new AbortController();
|
|
9527
9542
|
let isAborting = false;
|
|
9528
9543
|
let cancelMessageTimer = null;
|
|
@@ -9572,13 +9587,13 @@ async function runNonInteractive({
|
|
|
9572
9587
|
let errorToHandle;
|
|
9573
9588
|
try {
|
|
9574
9589
|
consolePatcher.patch();
|
|
9575
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
9590
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === OutputFormat.TEXT) {
|
|
9576
9591
|
process.stderr.write(
|
|
9577
9592
|
"[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"
|
|
9578
9593
|
);
|
|
9579
9594
|
}
|
|
9580
9595
|
setupStdinCancellation();
|
|
9581
|
-
coreEvents.on(
|
|
9596
|
+
coreEvents.on(CoreEvent.UserFeedback, handleUserFeedback);
|
|
9582
9597
|
coreEvents.drainBacklogs();
|
|
9583
9598
|
process.stdout.on("error", (err) => {
|
|
9584
9599
|
if (err.code === "EPIPE") {
|
|
@@ -9602,7 +9617,7 @@ async function runNonInteractive({
|
|
|
9602
9617
|
}
|
|
9603
9618
|
if (streamFormatter) {
|
|
9604
9619
|
streamFormatter.emitEvent({
|
|
9605
|
-
type:
|
|
9620
|
+
type: JsonStreamEventType.INIT,
|
|
9606
9621
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9607
9622
|
session_id: config.getSessionId(),
|
|
9608
9623
|
model: config.getModel()
|
|
@@ -9640,7 +9655,7 @@ async function runNonInteractive({
|
|
|
9640
9655
|
}
|
|
9641
9656
|
if (streamFormatter) {
|
|
9642
9657
|
streamFormatter.emitEvent({
|
|
9643
|
-
type:
|
|
9658
|
+
type: JsonStreamEventType.MESSAGE,
|
|
9644
9659
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9645
9660
|
role: "user",
|
|
9646
9661
|
content: input
|
|
@@ -9667,28 +9682,28 @@ async function runNonInteractive({
|
|
|
9667
9682
|
if (abortController.signal.aborted) {
|
|
9668
9683
|
handleCancellationError(config);
|
|
9669
9684
|
}
|
|
9670
|
-
if (event.type ===
|
|
9685
|
+
if (event.type === GeminiEventType.Content) {
|
|
9671
9686
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
9672
9687
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
9673
9688
|
if (streamFormatter) {
|
|
9674
9689
|
streamFormatter.emitEvent({
|
|
9675
|
-
type:
|
|
9690
|
+
type: JsonStreamEventType.MESSAGE,
|
|
9676
9691
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9677
9692
|
role: "assistant",
|
|
9678
9693
|
content: output,
|
|
9679
9694
|
delta: true
|
|
9680
9695
|
});
|
|
9681
|
-
} else if (config.getOutputFormat() ===
|
|
9696
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9682
9697
|
responseText += output;
|
|
9683
9698
|
} else {
|
|
9684
9699
|
if (event.value) {
|
|
9685
9700
|
textOutput.write(output);
|
|
9686
9701
|
}
|
|
9687
9702
|
}
|
|
9688
|
-
} else if (event.type ===
|
|
9703
|
+
} else if (event.type === GeminiEventType.ToolCallRequest) {
|
|
9689
9704
|
if (streamFormatter) {
|
|
9690
9705
|
streamFormatter.emitEvent({
|
|
9691
|
-
type:
|
|
9706
|
+
type: JsonStreamEventType.TOOL_USE,
|
|
9692
9707
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9693
9708
|
tool_name: event.value.name,
|
|
9694
9709
|
tool_id: event.value.callId,
|
|
@@ -9696,29 +9711,29 @@ async function runNonInteractive({
|
|
|
9696
9711
|
});
|
|
9697
9712
|
}
|
|
9698
9713
|
toolCallRequests.push(event.value);
|
|
9699
|
-
} else if (event.type ===
|
|
9714
|
+
} else if (event.type === GeminiEventType.LoopDetected) {
|
|
9700
9715
|
if (streamFormatter) {
|
|
9701
9716
|
streamFormatter.emitEvent({
|
|
9702
|
-
type:
|
|
9717
|
+
type: JsonStreamEventType.ERROR,
|
|
9703
9718
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9704
9719
|
severity: "warning",
|
|
9705
9720
|
message: "Loop detected, stopping execution"
|
|
9706
9721
|
});
|
|
9707
9722
|
}
|
|
9708
|
-
} else if (event.type ===
|
|
9723
|
+
} else if (event.type === GeminiEventType.MaxSessionTurns) {
|
|
9709
9724
|
if (streamFormatter) {
|
|
9710
9725
|
streamFormatter.emitEvent({
|
|
9711
|
-
type:
|
|
9726
|
+
type: JsonStreamEventType.ERROR,
|
|
9712
9727
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9713
9728
|
severity: "error",
|
|
9714
9729
|
message: "Maximum session turns exceeded"
|
|
9715
9730
|
});
|
|
9716
9731
|
}
|
|
9717
|
-
} else if (event.type ===
|
|
9732
|
+
} else if (event.type === GeminiEventType.Error) {
|
|
9718
9733
|
throw event.value.error;
|
|
9719
|
-
} else if (event.type ===
|
|
9734
|
+
} else if (event.type === GeminiEventType.AgentExecutionStopped) {
|
|
9720
9735
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
9721
|
-
if (config.getOutputFormat() ===
|
|
9736
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
9722
9737
|
process.stderr.write(`${stopMessage}
|
|
9723
9738
|
`);
|
|
9724
9739
|
}
|
|
@@ -9726,7 +9741,7 @@ async function runNonInteractive({
|
|
|
9726
9741
|
const metrics = uiTelemetryService.getMetrics();
|
|
9727
9742
|
const durationMs = Date.now() - startTime;
|
|
9728
9743
|
streamFormatter.emitEvent({
|
|
9729
|
-
type:
|
|
9744
|
+
type: JsonStreamEventType.RESULT,
|
|
9730
9745
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9731
9746
|
status: "success",
|
|
9732
9747
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -9736,9 +9751,9 @@ async function runNonInteractive({
|
|
|
9736
9751
|
});
|
|
9737
9752
|
}
|
|
9738
9753
|
return;
|
|
9739
|
-
} else if (event.type ===
|
|
9754
|
+
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
9740
9755
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
9741
|
-
if (config.getOutputFormat() ===
|
|
9756
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
9742
9757
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
9743
9758
|
`);
|
|
9744
9759
|
}
|
|
@@ -9756,7 +9771,7 @@ async function runNonInteractive({
|
|
|
9756
9771
|
const requestInfo = completedToolCall.request;
|
|
9757
9772
|
if (streamFormatter) {
|
|
9758
9773
|
streamFormatter.emitEvent({
|
|
9759
|
-
type:
|
|
9774
|
+
type: JsonStreamEventType.TOOL_RESULT,
|
|
9760
9775
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9761
9776
|
tool_id: requestInfo.callId,
|
|
9762
9777
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -9790,11 +9805,11 @@ async function runNonInteractive({
|
|
|
9790
9805
|
);
|
|
9791
9806
|
}
|
|
9792
9807
|
const stopExecutionTool = completedToolCalls.find(
|
|
9793
|
-
(tc) => tc.response.errorType ===
|
|
9808
|
+
(tc) => tc.response.errorType === ToolErrorType.STOP_EXECUTION
|
|
9794
9809
|
);
|
|
9795
9810
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
9796
9811
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
9797
|
-
if (config.getOutputFormat() ===
|
|
9812
|
+
if (config.getOutputFormat() === OutputFormat.TEXT) {
|
|
9798
9813
|
process.stderr.write(`${stopMessage}
|
|
9799
9814
|
`);
|
|
9800
9815
|
}
|
|
@@ -9802,7 +9817,7 @@ async function runNonInteractive({
|
|
|
9802
9817
|
const metrics = uiTelemetryService.getMetrics();
|
|
9803
9818
|
const durationMs = Date.now() - startTime;
|
|
9804
9819
|
streamFormatter.emitEvent({
|
|
9805
|
-
type:
|
|
9820
|
+
type: JsonStreamEventType.RESULT,
|
|
9806
9821
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9807
9822
|
status: "success",
|
|
9808
9823
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -9810,7 +9825,7 @@ async function runNonInteractive({
|
|
|
9810
9825
|
durationMs
|
|
9811
9826
|
)
|
|
9812
9827
|
});
|
|
9813
|
-
} else if (config.getOutputFormat() ===
|
|
9828
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9814
9829
|
const formatter = new JsonFormatter();
|
|
9815
9830
|
const stats = uiTelemetryService.getMetrics();
|
|
9816
9831
|
textOutput.write(
|
|
@@ -9827,12 +9842,12 @@ async function runNonInteractive({
|
|
|
9827
9842
|
const metrics = uiTelemetryService.getMetrics();
|
|
9828
9843
|
const durationMs = Date.now() - startTime;
|
|
9829
9844
|
streamFormatter.emitEvent({
|
|
9830
|
-
type:
|
|
9845
|
+
type: JsonStreamEventType.RESULT,
|
|
9831
9846
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9832
9847
|
status: "success",
|
|
9833
9848
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
9834
9849
|
});
|
|
9835
|
-
} else if (config.getOutputFormat() ===
|
|
9850
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
9836
9851
|
const formatter = new JsonFormatter();
|
|
9837
9852
|
const stats = uiTelemetryService.getMetrics();
|
|
9838
9853
|
textOutput.write(
|
|
@@ -9849,7 +9864,7 @@ async function runNonInteractive({
|
|
|
9849
9864
|
} finally {
|
|
9850
9865
|
cleanupStdinCancellation();
|
|
9851
9866
|
consolePatcher.cleanup();
|
|
9852
|
-
coreEvents.off(
|
|
9867
|
+
coreEvents.off(CoreEvent.UserFeedback, handleUserFeedback);
|
|
9853
9868
|
}
|
|
9854
9869
|
if (errorToHandle) {
|
|
9855
9870
|
handleError(errorToHandle, config);
|
|
@@ -12195,12 +12210,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12195
12210
|
this.clientCapabilities = args.clientCapabilities;
|
|
12196
12211
|
const authMethods = [
|
|
12197
12212
|
{
|
|
12198
|
-
id:
|
|
12213
|
+
id: AuthType.LOGIN_WITH_GOOGLE,
|
|
12199
12214
|
name: "Log in with Google",
|
|
12200
12215
|
description: "Log in with your Google account"
|
|
12201
12216
|
},
|
|
12202
12217
|
{
|
|
12203
|
-
id:
|
|
12218
|
+
id: AuthType.USE_GEMINI,
|
|
12204
12219
|
name: "Gemini API key",
|
|
12205
12220
|
description: "Use an API key with Gemini Developer API",
|
|
12206
12221
|
_meta: {
|
|
@@ -12210,12 +12225,12 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12210
12225
|
}
|
|
12211
12226
|
},
|
|
12212
12227
|
{
|
|
12213
|
-
id:
|
|
12228
|
+
id: AuthType.USE_VERTEX_AI,
|
|
12214
12229
|
name: "Vertex AI",
|
|
12215
12230
|
description: "Use an API key with Vertex AI GenAI API"
|
|
12216
12231
|
},
|
|
12217
12232
|
{
|
|
12218
|
-
id:
|
|
12233
|
+
id: AuthType.GATEWAY,
|
|
12219
12234
|
name: "AI API Gateway",
|
|
12220
12235
|
description: "Use a custom AI API Gateway",
|
|
12221
12236
|
_meta: {
|
|
@@ -12310,7 +12325,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12310
12325
|
mcpServers,
|
|
12311
12326
|
loadedSettings
|
|
12312
12327
|
);
|
|
12313
|
-
const authType = loadedSettings.merged.security.auth.selectedType ||
|
|
12328
|
+
const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
|
|
12314
12329
|
let isAuthenticated = false;
|
|
12315
12330
|
let authErrorMessage = "";
|
|
12316
12331
|
try {
|
|
@@ -12322,7 +12337,7 @@ var GeminiAgent = class _GeminiAgent {
|
|
|
12322
12337
|
);
|
|
12323
12338
|
isAuthenticated = true;
|
|
12324
12339
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
12325
|
-
if (authType ===
|
|
12340
|
+
if (authType === AuthType.USE_GEMINI && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
12326
12341
|
isAuthenticated = false;
|
|
12327
12342
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
12328
12343
|
}
|
|
@@ -12625,7 +12640,7 @@ ${thought.description}`;
|
|
|
12625
12640
|
await this.sendUpdate({
|
|
12626
12641
|
sessionUpdate: "tool_call",
|
|
12627
12642
|
toolCallId: toolCall.id,
|
|
12628
|
-
status: toolCall.status ===
|
|
12643
|
+
status: toolCall.status === CoreToolCallStatus.Success ? "completed" : "failed",
|
|
12629
12644
|
title: toolCall.displayName || toolCall.name,
|
|
12630
12645
|
content: toolCallContent,
|
|
12631
12646
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -12678,7 +12693,7 @@ ${thought.description}`;
|
|
|
12678
12693
|
while (nextMessage !== null) {
|
|
12679
12694
|
if (pendingSend.signal.aborted) {
|
|
12680
12695
|
chat.addHistory(nextMessage);
|
|
12681
|
-
return { stopReason:
|
|
12696
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
12682
12697
|
}
|
|
12683
12698
|
const functionCalls = [];
|
|
12684
12699
|
try {
|
|
@@ -12691,7 +12706,7 @@ ${thought.description}`;
|
|
|
12691
12706
|
nextMessage?.parts ?? [],
|
|
12692
12707
|
promptId,
|
|
12693
12708
|
pendingSend.signal,
|
|
12694
|
-
|
|
12709
|
+
LlmRole.MAIN
|
|
12695
12710
|
);
|
|
12696
12711
|
nextMessage = null;
|
|
12697
12712
|
let turnInputTokens = 0;
|
|
@@ -12699,16 +12714,16 @@ ${thought.description}`;
|
|
|
12699
12714
|
let turnModelId = model;
|
|
12700
12715
|
for await (const resp of responseStream) {
|
|
12701
12716
|
if (pendingSend.signal.aborted) {
|
|
12702
|
-
return { stopReason:
|
|
12717
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
12703
12718
|
}
|
|
12704
|
-
if (resp.type ===
|
|
12719
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.usageMetadata) {
|
|
12705
12720
|
turnInputTokens = resp.value.usageMetadata.promptTokenCount ?? turnInputTokens;
|
|
12706
12721
|
turnOutputTokens = resp.value.usageMetadata.candidatesTokenCount ?? turnOutputTokens;
|
|
12707
12722
|
if (resp.value.modelVersion) {
|
|
12708
12723
|
turnModelId = resp.value.modelVersion;
|
|
12709
12724
|
}
|
|
12710
12725
|
}
|
|
12711
|
-
if (resp.type ===
|
|
12726
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.candidates && resp.value.candidates.length > 0) {
|
|
12712
12727
|
const candidate = resp.value.candidates[0];
|
|
12713
12728
|
for (const part of candidate.content?.parts ?? []) {
|
|
12714
12729
|
if (!part.text) {
|
|
@@ -12724,7 +12739,7 @@ ${thought.description}`;
|
|
|
12724
12739
|
});
|
|
12725
12740
|
}
|
|
12726
12741
|
}
|
|
12727
|
-
if (resp.type ===
|
|
12742
|
+
if (resp.type === StreamEventType.CHUNK && resp.value.functionCalls) {
|
|
12728
12743
|
functionCalls.push(...resp.value.functionCalls);
|
|
12729
12744
|
}
|
|
12730
12745
|
}
|
|
@@ -12740,7 +12755,7 @@ ${thought.description}`;
|
|
|
12740
12755
|
modelUsageMap.set(turnModelId, existing);
|
|
12741
12756
|
}
|
|
12742
12757
|
if (pendingSend.signal.aborted) {
|
|
12743
|
-
return { stopReason:
|
|
12758
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
12744
12759
|
}
|
|
12745
12760
|
} catch (error) {
|
|
12746
12761
|
if (getErrorStatus(error) === 429) {
|
|
@@ -12750,7 +12765,7 @@ ${thought.description}`;
|
|
|
12750
12765
|
);
|
|
12751
12766
|
}
|
|
12752
12767
|
if (pendingSend.signal.aborted || error instanceof Error && error.name === "AbortError") {
|
|
12753
|
-
return { stopReason:
|
|
12768
|
+
return { stopReason: CoreToolCallStatus.Cancelled };
|
|
12754
12769
|
}
|
|
12755
12770
|
throw new RequestError(
|
|
12756
12771
|
getErrorStatus(error) || 500,
|
|
@@ -12889,19 +12904,19 @@ ${thought.description}`;
|
|
|
12889
12904
|
}
|
|
12890
12905
|
};
|
|
12891
12906
|
const output = await this.connection.requestPermission(params);
|
|
12892
|
-
const outcome = output.outcome.outcome ===
|
|
12907
|
+
const outcome = output.outcome.outcome === CoreToolCallStatus.Cancelled ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
12893
12908
|
await confirmationDetails.onConfirm(outcome);
|
|
12894
12909
|
switch (outcome) {
|
|
12895
|
-
case
|
|
12910
|
+
case ToolConfirmationOutcome.Cancel:
|
|
12896
12911
|
return errorResponse(
|
|
12897
12912
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
12898
12913
|
);
|
|
12899
|
-
case
|
|
12900
|
-
case
|
|
12901
|
-
case
|
|
12902
|
-
case
|
|
12903
|
-
case
|
|
12904
|
-
case
|
|
12914
|
+
case ToolConfirmationOutcome.ProceedOnce:
|
|
12915
|
+
case ToolConfirmationOutcome.ProceedAlways:
|
|
12916
|
+
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
|
12917
|
+
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
|
12918
|
+
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
|
12919
|
+
case ToolConfirmationOutcome.ModifyWithEditor:
|
|
12905
12920
|
break;
|
|
12906
12921
|
default: {
|
|
12907
12922
|
const resultOutcome = outcome;
|
|
@@ -12947,7 +12962,7 @@ ${thought.description}`;
|
|
|
12947
12962
|
);
|
|
12948
12963
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
12949
12964
|
{
|
|
12950
|
-
status:
|
|
12965
|
+
status: CoreToolCallStatus.Success,
|
|
12951
12966
|
request: {
|
|
12952
12967
|
callId,
|
|
12953
12968
|
name: fc.name,
|
|
@@ -12992,7 +13007,7 @@ ${thought.description}`;
|
|
|
12992
13007
|
});
|
|
12993
13008
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
12994
13009
|
{
|
|
12995
|
-
status:
|
|
13010
|
+
status: CoreToolCallStatus.Error,
|
|
12996
13011
|
request: {
|
|
12997
13012
|
callId,
|
|
12998
13013
|
name: fc.name,
|
|
@@ -13346,12 +13361,12 @@ function toToolCallContent(toolResult) {
|
|
|
13346
13361
|
}
|
|
13347
13362
|
var basicPermissionOptions = [
|
|
13348
13363
|
{
|
|
13349
|
-
optionId:
|
|
13364
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
13350
13365
|
name: "Allow",
|
|
13351
13366
|
kind: "allow_once"
|
|
13352
13367
|
},
|
|
13353
13368
|
{
|
|
13354
|
-
optionId:
|
|
13369
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
13355
13370
|
name: "Reject",
|
|
13356
13371
|
kind: "reject_once"
|
|
13357
13372
|
}
|
|
@@ -13363,14 +13378,14 @@ function toPermissionOptions(confirmation, config) {
|
|
|
13363
13378
|
switch (confirmation.type) {
|
|
13364
13379
|
case "edit":
|
|
13365
13380
|
options.push({
|
|
13366
|
-
optionId:
|
|
13381
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13367
13382
|
name: "Allow All Edits",
|
|
13368
13383
|
kind: "allow_always"
|
|
13369
13384
|
});
|
|
13370
13385
|
break;
|
|
13371
13386
|
case "exec":
|
|
13372
13387
|
options.push({
|
|
13373
|
-
optionId:
|
|
13388
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13374
13389
|
name: `Always Allow ${confirmation.rootCommand}`,
|
|
13375
13390
|
kind: "allow_always"
|
|
13376
13391
|
});
|
|
@@ -13378,12 +13393,12 @@ function toPermissionOptions(confirmation, config) {
|
|
|
13378
13393
|
case "mcp":
|
|
13379
13394
|
options.push(
|
|
13380
13395
|
{
|
|
13381
|
-
optionId:
|
|
13396
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysServer,
|
|
13382
13397
|
name: `Always Allow ${confirmation.serverName}`,
|
|
13383
13398
|
kind: "allow_always"
|
|
13384
13399
|
},
|
|
13385
13400
|
{
|
|
13386
|
-
optionId:
|
|
13401
|
+
optionId: ToolConfirmationOutcome.ProceedAlwaysTool,
|
|
13387
13402
|
name: `Always Allow ${confirmation.toolName}`,
|
|
13388
13403
|
kind: "allow_always"
|
|
13389
13404
|
}
|
|
@@ -13391,7 +13406,7 @@ function toPermissionOptions(confirmation, config) {
|
|
|
13391
13406
|
break;
|
|
13392
13407
|
case "info":
|
|
13393
13408
|
options.push({
|
|
13394
|
-
optionId:
|
|
13409
|
+
optionId: ToolConfirmationOutcome.ProceedAlways,
|
|
13395
13410
|
name: `Always Allow`,
|
|
13396
13411
|
kind: "allow_always"
|
|
13397
13412
|
});
|
|
@@ -13422,21 +13437,21 @@ function toPermissionOptions(confirmation, config) {
|
|
|
13422
13437
|
}
|
|
13423
13438
|
function toAcpToolKind(kind) {
|
|
13424
13439
|
switch (kind) {
|
|
13425
|
-
case
|
|
13426
|
-
case
|
|
13427
|
-
case
|
|
13428
|
-
case
|
|
13429
|
-
case
|
|
13430
|
-
case
|
|
13431
|
-
case
|
|
13432
|
-
case
|
|
13433
|
-
case
|
|
13434
|
-
case
|
|
13440
|
+
case Kind.Read:
|
|
13441
|
+
case Kind.Edit:
|
|
13442
|
+
case Kind.Execute:
|
|
13443
|
+
case Kind.Search:
|
|
13444
|
+
case Kind.Delete:
|
|
13445
|
+
case Kind.Move:
|
|
13446
|
+
case Kind.Think:
|
|
13447
|
+
case Kind.Fetch:
|
|
13448
|
+
case Kind.SwitchMode:
|
|
13449
|
+
case Kind.Other:
|
|
13435
13450
|
return kind;
|
|
13436
|
-
case
|
|
13451
|
+
case Kind.Agent:
|
|
13437
13452
|
return "think";
|
|
13438
|
-
case
|
|
13439
|
-
case
|
|
13453
|
+
case Kind.Plan:
|
|
13454
|
+
case Kind.Communicate:
|
|
13440
13455
|
default:
|
|
13441
13456
|
return "other";
|
|
13442
13457
|
}
|
|
@@ -13444,24 +13459,24 @@ function toAcpToolKind(kind) {
|
|
|
13444
13459
|
function buildAvailableModes(isPlanEnabled) {
|
|
13445
13460
|
const modes = [
|
|
13446
13461
|
{
|
|
13447
|
-
id:
|
|
13462
|
+
id: ApprovalMode.DEFAULT,
|
|
13448
13463
|
name: "Default",
|
|
13449
13464
|
description: "Prompts for approval"
|
|
13450
13465
|
},
|
|
13451
13466
|
{
|
|
13452
|
-
id:
|
|
13467
|
+
id: ApprovalMode.AUTO_EDIT,
|
|
13453
13468
|
name: "Auto Edit",
|
|
13454
13469
|
description: "Auto-approves edit tools"
|
|
13455
13470
|
},
|
|
13456
13471
|
{
|
|
13457
|
-
id:
|
|
13472
|
+
id: ApprovalMode.YOLO,
|
|
13458
13473
|
name: "YOLO",
|
|
13459
13474
|
description: "Auto-approves all tools"
|
|
13460
13475
|
}
|
|
13461
13476
|
];
|
|
13462
13477
|
if (isPlanEnabled) {
|
|
13463
13478
|
modes.push({
|
|
13464
|
-
id:
|
|
13479
|
+
id: ApprovalMode.PLAN,
|
|
13465
13480
|
name: "Plan",
|
|
13466
13481
|
description: "Read-only mode"
|
|
13467
13482
|
});
|
|
@@ -13473,7 +13488,7 @@ function buildAvailableModels(config, settings) {
|
|
|
13473
13488
|
const shouldShowPreviewModels = config.getHasAccessToPreviewModel();
|
|
13474
13489
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13475
13490
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13476
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
13491
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
13477
13492
|
const mainOptions = [
|
|
13478
13493
|
{
|
|
13479
13494
|
value: DEFAULT_GEMINI_MODEL_AUTO,
|
|
@@ -13552,7 +13567,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
13552
13567
|
}
|
|
13553
13568
|
return authType;
|
|
13554
13569
|
} catch (error) {
|
|
13555
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
13570
|
+
if (nonInteractiveConfig.getOutputFormat() === OutputFormat.JSON) {
|
|
13556
13571
|
handleError(
|
|
13557
13572
|
error instanceof Error ? error : new Error(String(error)),
|
|
13558
13573
|
nonInteractiveConfig,
|
|
@@ -13788,10 +13803,10 @@ var SlashCommandConflictHandler = class {
|
|
|
13788
13803
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
13789
13804
|
}
|
|
13790
13805
|
start() {
|
|
13791
|
-
coreEvents.on(
|
|
13806
|
+
coreEvents.on(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
13792
13807
|
}
|
|
13793
13808
|
stop() {
|
|
13794
|
-
coreEvents.off(
|
|
13809
|
+
coreEvents.off(CoreEvent.SlashCommandConflicts, this.handleConflicts);
|
|
13795
13810
|
if (this.flushTimeout) {
|
|
13796
13811
|
clearTimeout(this.flushTimeout);
|
|
13797
13812
|
this.flushTimeout = null;
|
|
@@ -13959,7 +13974,7 @@ ${reason.stack}` : ""}`;
|
|
|
13959
13974
|
});
|
|
13960
13975
|
}
|
|
13961
13976
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
13962
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
13977
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-2OAVBJCC.js");
|
|
13963
13978
|
await doStartUI(
|
|
13964
13979
|
config,
|
|
13965
13980
|
settings,
|
|
@@ -14056,12 +14071,12 @@ async function main() {
|
|
|
14056
14071
|
dns.setDefaultResultOrder(
|
|
14057
14072
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
14058
14073
|
);
|
|
14059
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
14074
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === AuthType.LEGACY_CLOUD_SHELL) {
|
|
14060
14075
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
14061
14076
|
settings.setValue(
|
|
14062
14077
|
"User" /* User */,
|
|
14063
14078
|
"security.auth.selectedType",
|
|
14064
|
-
|
|
14079
|
+
AuthType.COMPUTE_ADC
|
|
14065
14080
|
);
|
|
14066
14081
|
}
|
|
14067
14082
|
}
|
|
@@ -14155,7 +14170,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
14155
14170
|
await config.storage.initialize();
|
|
14156
14171
|
adminControlsListner.setConfig(config);
|
|
14157
14172
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
14158
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
14173
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-B7OD724C.js");
|
|
14159
14174
|
await setupInitialActivityLogger(config);
|
|
14160
14175
|
}
|
|
14161
14176
|
registerTelemetryConfig(config);
|
|
@@ -14163,7 +14178,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
14163
14178
|
const messageBus = config.getMessageBus();
|
|
14164
14179
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
14165
14180
|
registerCleanup(async () => {
|
|
14166
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
14181
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
14167
14182
|
});
|
|
14168
14183
|
cleanupExpiredSessions(config, settings.merged).catch((e) => {
|
|
14169
14184
|
debugLogger.error("Failed to cleanup expired sessions:", e);
|
|
@@ -14211,7 +14226,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
14211
14226
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
14212
14227
|
const initializationResult = await initializeApp(config, settings);
|
|
14213
14228
|
initAppHandle?.end();
|
|
14214
|
-
if (settings.merged.security.auth.selectedType ===
|
|
14229
|
+
if (settings.merged.security.auth.selectedType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()) {
|
|
14215
14230
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
14216
14231
|
}
|
|
14217
14232
|
if (config.getAcpMode()) {
|
|
@@ -14227,7 +14242,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
14227
14242
|
...rawStartupWarnings.map((message) => ({
|
|
14228
14243
|
id: `startup-${createHash("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
14229
14244
|
message,
|
|
14230
|
-
priority:
|
|
14245
|
+
priority: WarningPriority.High
|
|
14231
14246
|
})),
|
|
14232
14247
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
14233
14248
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -14248,7 +14263,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
14248
14263
|
startupWarnings.push({
|
|
14249
14264
|
id: "resume-no-sessions",
|
|
14250
14265
|
message: error.message,
|
|
14251
|
-
priority:
|
|
14266
|
+
priority: WarningPriority.High
|
|
14252
14267
|
});
|
|
14253
14268
|
} else {
|
|
14254
14269
|
coreEvents.emitFeedback(
|
|
@@ -14283,7 +14298,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
14283
14298
|
${input}` : stdinData;
|
|
14284
14299
|
}
|
|
14285
14300
|
}
|
|
14286
|
-
const sessionStartSource = resumedSessionData ?
|
|
14301
|
+
const sessionStartSource = resumedSessionData ? SessionStartSource.Resume : SessionStartSource.Startup;
|
|
14287
14302
|
const hookSystem = config?.getHookSystem();
|
|
14288
14303
|
if (hookSystem) {
|
|
14289
14304
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -14301,7 +14316,7 @@ ${input}` : wrappedContext;
|
|
|
14301
14316
|
}
|
|
14302
14317
|
}
|
|
14303
14318
|
registerCleanup(async () => {
|
|
14304
|
-
await config.getHookSystem()?.fireSessionEndEvent(
|
|
14319
|
+
await config.getHookSystem()?.fireSessionEndEvent(SessionEndReason.Exit);
|
|
14305
14320
|
});
|
|
14306
14321
|
if (!input) {
|
|
14307
14322
|
debugLogger.error(
|
|
@@ -14343,16 +14358,16 @@ ${input}` : wrappedContext;
|
|
|
14343
14358
|
}
|
|
14344
14359
|
}
|
|
14345
14360
|
function initializeOutputListenersAndFlush() {
|
|
14346
|
-
if (coreEvents.listenerCount(
|
|
14347
|
-
coreEvents.on(
|
|
14361
|
+
if (coreEvents.listenerCount(CoreEvent.Output) === 0) {
|
|
14362
|
+
coreEvents.on(CoreEvent.Output, (payload) => {
|
|
14348
14363
|
if (payload.isStderr) {
|
|
14349
14364
|
writeToStderr(payload.chunk, payload.encoding);
|
|
14350
14365
|
} else {
|
|
14351
14366
|
writeToStdout(payload.chunk, payload.encoding);
|
|
14352
14367
|
}
|
|
14353
14368
|
});
|
|
14354
|
-
if (coreEvents.listenerCount(
|
|
14355
|
-
coreEvents.on(
|
|
14369
|
+
if (coreEvents.listenerCount(CoreEvent.ConsoleLog) === 0) {
|
|
14370
|
+
coreEvents.on(CoreEvent.ConsoleLog, (payload) => {
|
|
14356
14371
|
if (payload.type === "error" || payload.type === "warn") {
|
|
14357
14372
|
writeToStderr(payload.content);
|
|
14358
14373
|
} else {
|
|
@@ -14360,8 +14375,8 @@ function initializeOutputListenersAndFlush() {
|
|
|
14360
14375
|
}
|
|
14361
14376
|
});
|
|
14362
14377
|
}
|
|
14363
|
-
if (coreEvents.listenerCount(
|
|
14364
|
-
coreEvents.on(
|
|
14378
|
+
if (coreEvents.listenerCount(CoreEvent.UserFeedback) === 0) {
|
|
14379
|
+
coreEvents.on(CoreEvent.UserFeedback, (payload) => {
|
|
14365
14380
|
if (payload.severity === "error" || payload.severity === "warning") {
|
|
14366
14381
|
writeToStderr(payload.message);
|
|
14367
14382
|
} else {
|