@google/gemini-cli 0.60.0-nightly.20260908.g85aca163f → 0.60.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-G4V32KTT.js → chunk-2CNCBL5E.js} +1 -1
- package/bundle/{chunk-3QU7MFQ7.js → chunk-2VRC3EDT.js} +8 -9
- package/bundle/{chunk-3CDPEGVA.js → chunk-32DXU4EF.js} +1 -1
- package/bundle/{chunk-TVCSMCKT.js → chunk-4IIDTAFR.js} +1 -1
- package/bundle/{chunk-FX53IMQ4.js → chunk-7QC7KWAE.js} +1 -1
- package/bundle/{chunk-L5DTYBPR.js → chunk-CMLALLX3.js} +7 -7
- package/bundle/{chunk-OSSPFBB5.js → chunk-D3BC6B5F.js} +1 -1
- package/bundle/{chunk-ACSEKHMC.js → chunk-E62PES2E.js} +2 -2
- package/bundle/{chunk-YMZA4EO3.js → chunk-GFHSA4BE.js} +1 -1
- package/bundle/{chunk-A6IXIFRW.js → chunk-GNCCSIBA.js} +7 -7
- package/bundle/{chunk-FYCX7S2H.js → chunk-JJLODN2F.js} +1 -1
- package/bundle/{chunk-VIXOL23X.js → chunk-KAXMFUK5.js} +1 -1
- package/bundle/{chunk-AXAX7FSE.js → chunk-M6NSK26M.js} +123 -104
- package/bundle/{chunk-FIESYQDV.js → chunk-MOYC3UGL.js} +127 -106
- package/bundle/{chunk-BOGYC66X.js → chunk-OCLZG6C5.js} +1 -1
- package/bundle/{chunk-OI5WY42W.js → chunk-P3SNRA43.js} +2 -2
- package/bundle/{chunk-XTLORUWQ.js → chunk-PJREBWY3.js} +2 -2
- package/bundle/{chunk-N7PUYZ2C.js → chunk-QRYVAS35.js} +3 -3
- package/bundle/{chunk-4YTSRQAI.js → chunk-RZALYEQN.js} +1 -1
- package/bundle/{chunk-J5XD2NH2.js → chunk-S7PDUHJI.js} +3 -3
- package/bundle/{chunk-JE7V5AAP.js → chunk-UEQMLKXK.js} +3 -3
- package/bundle/{chunk-GD2JGMGI.js → chunk-VCAJDPDX.js} +14699 -7842
- package/bundle/{chunk-CYA6LLPT.js → chunk-WRNJPSJG.js} +5 -8
- package/bundle/{chunk-AL25HEEO.js → chunk-XRNOQZLR.js} +54 -67
- package/bundle/{cleanup-4FION7X5.js → cleanup-HEQUL3UY.js} +2 -2
- package/bundle/{cleanup-GWIY2YES.js → cleanup-THNE7RD2.js} +2 -2
- package/bundle/{cleanup-SXOQFKSA.js → cleanup-XYVEFB7E.js} +2 -2
- package/bundle/{core-T6ZA3RPN.js → core-A6JH6DY6.js} +5 -1
- package/bundle/{dist-CUTV6FXO.js → core-PCNYIQML.js} +5 -1
- package/bundle/{devtoolsService-FPEN37GX.js → devtoolsService-J7SM2WQQ.js} +2 -2
- package/bundle/{devtoolsService-J5IMHON6.js → devtoolsService-TEWMGXKI.js} +2 -2
- package/bundle/{devtoolsService-HJR727UG.js → devtoolsService-YPPCMYGQ.js} +3 -4
- package/bundle/{dist-IYMU3MAT.js → dist-PD4ABRTS.js} +5 -1
- package/bundle/{gemini-RLSAAMB2.js → gemini-7INSUCPB.js} +318 -272
- package/bundle/{gemini-FPHQ6YA6.js → gemini-LUNNHKPJ.js} +134 -72
- package/bundle/{gemini-DM7UHG5I.js → gemini-ZTU7EMI3.js} +134 -72
- package/bundle/gemini.js +7 -7
- package/bundle/{interactiveCli-BNCDBJK2.js → interactiveCli-COQJBPC2.js} +8 -8
- package/bundle/{interactiveCli-NC7ZBX74.js → interactiveCli-NQE3X2WY.js} +8 -8
- package/bundle/{interactiveCli-SWGF5F7W.js → interactiveCli-X63QLGIH.js} +296 -315
- package/bundle/{liteRtServerManager-6VWY6OO6.js → liteRtServerManager-5YXPHG3Q.js} +4 -4
- package/bundle/{liteRtServerManager-HE2FE4FH.js → liteRtServerManager-7W4APCRB.js} +4 -4
- package/bundle/{liteRtServerManager-JSW26OPJ.js → liteRtServerManager-PEAZFGHW.js} +4 -4
- package/bundle/{oauth2-provider-IGJGMQ4U.js → oauth2-provider-H2X6UMUS.js} +1 -1
- package/bundle/{oauth2-provider-I665TJQN.js → oauth2-provider-M3PIKLLI.js} +1 -1
- package/bundle/{oauth2-provider-T2HJJ7SP.js → oauth2-provider-WINJTB44.js} +72 -38
- package/bundle/{start-AA23VJDL.js → start-AH7HKN5D.js} +6 -6
- package/bundle/{start-EQIIZYZY.js → start-J5DOY6JW.js} +6 -6
- package/bundle/{start-QHU4R4ZE.js → start-QYNDA2U4.js} +6 -6
- package/package.json +1 -1
- package/bundle/chunk-5AXHFT2M.js +0 -512
- package/bundle/chunk-JIOJKKRV.js +0 -1571
- package/bundle/chunk-JIXDRDKL.js +0 -17353
- package/bundle/chunk-M24MUPYL.js +0 -398992
- package/bundle/chunk-MI66NSWG.js +0 -154
- package/bundle/chunk-R55JHECT.js +0 -102670
- package/bundle/chunk-RRTGK7KM.js +0 -118
- package/bundle/chunk-WET7Q2Z2.js +0 -398
- package/bundle/cleanup-XSTC4XRT.js +0 -32
- package/bundle/devtoolsService-R3332TAT.js +0 -4359
- package/bundle/dist-VMLS7TDS.js +0 -2212
- package/bundle/gemini-ZT27CSNJ.js +0 -17370
- package/bundle/interactiveCli-WG2TABNS.js +0 -34983
- package/bundle/liteRtServerManager-Y7KT37QX.js +0 -65
- package/bundle/oauth2-provider-WUYROQ6O.js +0 -235
- package/bundle/start-WLQTESZU.js +0 -18
|
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
|
|
|
2
2
|
import {
|
|
3
3
|
startCommand,
|
|
4
4
|
startServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-S7PDUHJI.js";
|
|
6
6
|
import {
|
|
7
7
|
BuiltinCommandLoader,
|
|
8
8
|
CommandService,
|
|
@@ -46,11 +46,11 @@ import {
|
|
|
46
46
|
updateExtension,
|
|
47
47
|
validateAuthMethod,
|
|
48
48
|
validateContextFilePath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-XRNOQZLR.js";
|
|
50
50
|
import {
|
|
51
51
|
exitCli,
|
|
52
52
|
require_source
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-JJLODN2F.js";
|
|
54
54
|
import {
|
|
55
55
|
appEvents
|
|
56
56
|
} from "./chunk-5PS3AYFU.js";
|
|
@@ -88,11 +88,11 @@ import {
|
|
|
88
88
|
resolveGemmaConfig,
|
|
89
89
|
saveModelChange,
|
|
90
90
|
stripAnsi
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-KAXMFUK5.js";
|
|
92
92
|
import {
|
|
93
93
|
RELAUNCH_EXIT_CODE
|
|
94
|
-
} from "./chunk-
|
|
95
|
-
import "./chunk-
|
|
94
|
+
} from "./chunk-E62PES2E.js";
|
|
95
|
+
import "./chunk-2VRC3EDT.js";
|
|
96
96
|
import {
|
|
97
97
|
cleanupCheckpoints,
|
|
98
98
|
registerCleanup,
|
|
@@ -101,15 +101,12 @@ import {
|
|
|
101
101
|
runExitCleanup,
|
|
102
102
|
runSyncCleanup,
|
|
103
103
|
setupSignalHandlers
|
|
104
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-D3BC6B5F.js";
|
|
105
105
|
import {
|
|
106
106
|
ASK_USER_TOOL_NAME,
|
|
107
|
-
ApprovalMode,
|
|
108
107
|
AuthType,
|
|
109
108
|
Client,
|
|
110
109
|
Config,
|
|
111
|
-
CoreEvent,
|
|
112
|
-
CoreToolCallStatus,
|
|
113
110
|
DEFAULT_CONTEXT_FILENAME,
|
|
114
111
|
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
115
112
|
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
@@ -131,27 +128,19 @@ import {
|
|
|
131
128
|
FolderTrustDiscoveryService,
|
|
132
129
|
GEMINI_DIR,
|
|
133
130
|
GEMINI_MODEL_ALIAS_AUTO,
|
|
134
|
-
GeminiEventType,
|
|
135
131
|
IdeClient,
|
|
136
|
-
IntegrityStatus,
|
|
137
132
|
InvalidStreamError,
|
|
138
133
|
JsonFormatter,
|
|
139
|
-
JsonStreamEventType,
|
|
140
|
-
Kind,
|
|
141
134
|
LegacyAgentSession,
|
|
142
135
|
Logger,
|
|
143
136
|
MAX_TOKENS_EXCEEDED_SUGGESTION,
|
|
144
137
|
MCPServerConfig,
|
|
145
|
-
MCPServerStatus,
|
|
146
|
-
MessageBusType,
|
|
147
138
|
OTHER_BLOCKED_MESSAGE,
|
|
148
|
-
OutputFormat,
|
|
149
139
|
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
150
140
|
PREVIEW_GEMINI_3_1_MODEL,
|
|
151
141
|
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
152
142
|
PREVIEW_GEMINI_FLASH_MODEL,
|
|
153
143
|
PREVIEW_GEMINI_MODEL,
|
|
154
|
-
PolicyDecision,
|
|
155
144
|
PolicyIntegrityManager,
|
|
156
145
|
RECITATION_BLOCKED_MESSAGE,
|
|
157
146
|
REFERENCE_CONTENT_START,
|
|
@@ -159,8 +148,6 @@ import {
|
|
|
159
148
|
ReadManyFilesTool,
|
|
160
149
|
SAFETY_BLOCKED_MESSAGE,
|
|
161
150
|
Scheduler,
|
|
162
|
-
SessionEndReason,
|
|
163
|
-
SessionStartSource,
|
|
164
151
|
ShellExecutionService,
|
|
165
152
|
SimpleExtensionLoader,
|
|
166
153
|
Storage,
|
|
@@ -169,13 +156,10 @@ import {
|
|
|
169
156
|
TRUE_EMPTY_RESPONSE_MESSAGE,
|
|
170
157
|
ToolCallEvent,
|
|
171
158
|
ToolConfirmationOutcome,
|
|
172
|
-
ToolErrorType,
|
|
173
|
-
TrustLevel,
|
|
174
159
|
UserAccountManager,
|
|
175
160
|
UserPromptEvent,
|
|
176
161
|
ValidationCancelledError,
|
|
177
162
|
ValidationRequiredError,
|
|
178
|
-
WarningPriority,
|
|
179
163
|
applyAdminAllowlist,
|
|
180
164
|
applyRequiredServers,
|
|
181
165
|
clearCachedCredentialFile,
|
|
@@ -255,7 +239,7 @@ import {
|
|
|
255
239
|
updatePolicy,
|
|
256
240
|
writeToStderr,
|
|
257
241
|
writeToStdout
|
|
258
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-MOYC3UGL.js";
|
|
259
243
|
import "./chunk-664ZODQF.js";
|
|
260
244
|
import "./chunk-IUUIT4SU.js";
|
|
261
245
|
import "./chunk-TUDYL3X4.js";
|
|
@@ -1540,11 +1524,11 @@ var parser = new YargsParser({
|
|
|
1540
1524
|
resolve: resolve2,
|
|
1541
1525
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
1542
1526
|
// we can exercise all the lines below:
|
|
1543
|
-
require: (
|
|
1527
|
+
require: (path17) => {
|
|
1544
1528
|
if (typeof __require !== "undefined") {
|
|
1545
|
-
return __require(
|
|
1546
|
-
} else if (
|
|
1547
|
-
return JSON.parse(readFileSync(
|
|
1529
|
+
return __require(path17);
|
|
1530
|
+
} else if (path17.match(/\.json$/)) {
|
|
1531
|
+
return JSON.parse(readFileSync(path17, "utf8"));
|
|
1548
1532
|
} else {
|
|
1549
1533
|
throw Error("only .json config files are supported in ESM");
|
|
1550
1534
|
}
|
|
@@ -5385,7 +5369,7 @@ var MCP_LIST_DEFAULT_TIMEOUT_MSEC = 5e3;
|
|
|
5385
5369
|
async function testMCPConnection(serverName, config, isTrusted, activeSettings) {
|
|
5386
5370
|
const isStdio = !!config.command;
|
|
5387
5371
|
if (isStdio && !isTrusted) {
|
|
5388
|
-
return
|
|
5372
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5389
5373
|
}
|
|
5390
5374
|
const client = new Client({
|
|
5391
5375
|
name: "mcp-test-client",
|
|
@@ -5421,7 +5405,7 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5421
5405
|
transport = await createTransport(serverName, config, false, mcpContext);
|
|
5422
5406
|
} catch {
|
|
5423
5407
|
await client.close();
|
|
5424
|
-
return
|
|
5408
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5425
5409
|
}
|
|
5426
5410
|
try {
|
|
5427
5411
|
const timeout = config.timeout ?? MCP_LIST_DEFAULT_TIMEOUT_MSEC;
|
|
@@ -5435,10 +5419,10 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5435
5419
|
);
|
|
5436
5420
|
}
|
|
5437
5421
|
await client.close();
|
|
5438
|
-
return
|
|
5422
|
+
return "connected" /* CONNECTED */;
|
|
5439
5423
|
} catch {
|
|
5440
5424
|
await transport.close();
|
|
5441
|
-
return
|
|
5425
|
+
return "disconnected" /* DISCONNECTED */;
|
|
5442
5426
|
}
|
|
5443
5427
|
}
|
|
5444
5428
|
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
@@ -5451,12 +5435,12 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings, co
|
|
|
5451
5435
|
});
|
|
5452
5436
|
if (!loadResult.allowed) {
|
|
5453
5437
|
if (loadResult.blockType === "admin" || loadResult.blockType === "allowlist" || loadResult.blockType === "excludelist") {
|
|
5454
|
-
return
|
|
5438
|
+
return "blocked" /* BLOCKED */;
|
|
5455
5439
|
}
|
|
5456
|
-
return
|
|
5440
|
+
return "disabled" /* DISABLED */;
|
|
5457
5441
|
}
|
|
5458
5442
|
if (!isTrusted) {
|
|
5459
|
-
return
|
|
5443
|
+
return "disabled" /* DISABLED */;
|
|
5460
5444
|
}
|
|
5461
5445
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5462
5446
|
}
|
|
@@ -5502,23 +5486,23 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5502
5486
|
let statusIndicator = "";
|
|
5503
5487
|
let statusText = "";
|
|
5504
5488
|
switch (status) {
|
|
5505
|
-
case
|
|
5489
|
+
case "connected" /* CONNECTED */:
|
|
5506
5490
|
statusIndicator = import_chalk.default.green("\u2713");
|
|
5507
5491
|
statusText = "Connected";
|
|
5508
5492
|
break;
|
|
5509
|
-
case
|
|
5493
|
+
case "connecting" /* CONNECTING */:
|
|
5510
5494
|
statusIndicator = import_chalk.default.yellow("\u2026");
|
|
5511
5495
|
statusText = "Connecting";
|
|
5512
5496
|
break;
|
|
5513
|
-
case
|
|
5497
|
+
case "blocked" /* BLOCKED */:
|
|
5514
5498
|
statusIndicator = import_chalk.default.red("\u26D4");
|
|
5515
5499
|
statusText = "Blocked";
|
|
5516
5500
|
break;
|
|
5517
|
-
case
|
|
5501
|
+
case "disabled" /* DISABLED */:
|
|
5518
5502
|
statusIndicator = import_chalk.default.gray("\u25CB");
|
|
5519
5503
|
statusText = "Disabled";
|
|
5520
5504
|
break;
|
|
5521
|
-
case
|
|
5505
|
+
case "disconnected" /* DISCONNECTED */:
|
|
5522
5506
|
default:
|
|
5523
5507
|
statusIndicator = import_chalk.default.red("\u2717");
|
|
5524
5508
|
statusText = "Disconnected";
|
|
@@ -5804,7 +5788,7 @@ async function handleInstall(args) {
|
|
|
5804
5788
|
);
|
|
5805
5789
|
if (confirmed) {
|
|
5806
5790
|
const trustedFolders = loadTrustedFolders();
|
|
5807
|
-
await trustedFolders.setValue(realPath,
|
|
5791
|
+
await trustedFolders.setValue(realPath, "TRUST_FOLDER" /* TRUST_FOLDER */);
|
|
5808
5792
|
} else {
|
|
5809
5793
|
throw new Error(
|
|
5810
5794
|
`Installation aborted: Folder "${absolutePath}" is not trusted.`
|
|
@@ -6329,27 +6313,27 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
6329
6313
|
var __filename = fileURLToPath2(import.meta.url);
|
|
6330
6314
|
var __dirname2 = dirname3(__filename);
|
|
6331
6315
|
var EXAMPLES_PATH = join(__dirname2, "examples");
|
|
6332
|
-
async function pathExists(
|
|
6316
|
+
async function pathExists(path17) {
|
|
6333
6317
|
try {
|
|
6334
|
-
await access(
|
|
6318
|
+
await access(path17);
|
|
6335
6319
|
return true;
|
|
6336
6320
|
} catch {
|
|
6337
6321
|
return false;
|
|
6338
6322
|
}
|
|
6339
6323
|
}
|
|
6340
|
-
async function createDirectory(
|
|
6341
|
-
if (await pathExists(
|
|
6342
|
-
throw new Error(`Path already exists: ${
|
|
6324
|
+
async function createDirectory(path17) {
|
|
6325
|
+
if (await pathExists(path17)) {
|
|
6326
|
+
throw new Error(`Path already exists: ${path17}`);
|
|
6343
6327
|
}
|
|
6344
|
-
await mkdir(
|
|
6328
|
+
await mkdir(path17, { recursive: true });
|
|
6345
6329
|
}
|
|
6346
|
-
async function copyDirectory(template,
|
|
6347
|
-
await createDirectory(
|
|
6330
|
+
async function copyDirectory(template, path17) {
|
|
6331
|
+
await createDirectory(path17);
|
|
6348
6332
|
const examplePath = join(EXAMPLES_PATH, template);
|
|
6349
6333
|
const entries = await readdir(examplePath, { withFileTypes: true });
|
|
6350
6334
|
for (const entry of entries) {
|
|
6351
6335
|
const srcPath = join(examplePath, entry.name);
|
|
6352
|
-
const destPath = join(
|
|
6336
|
+
const destPath = join(path17, entry.name);
|
|
6353
6337
|
await cp(srcPath, destPath, { recursive: true });
|
|
6354
6338
|
}
|
|
6355
6339
|
}
|
|
@@ -6630,7 +6614,7 @@ async function handleEnable3(args) {
|
|
|
6630
6614
|
const result = enableSkill(settings, name);
|
|
6631
6615
|
const feedback = renderSkillActionFeedback(
|
|
6632
6616
|
result,
|
|
6633
|
-
(label,
|
|
6617
|
+
(label, path17) => `${import_chalk5.default.bold(label)} (${import_chalk5.default.dim(path17)})`
|
|
6634
6618
|
);
|
|
6635
6619
|
debugLogger.log(feedback);
|
|
6636
6620
|
}
|
|
@@ -6660,7 +6644,7 @@ async function handleDisable3(args) {
|
|
|
6660
6644
|
const result = disableSkill(settings, name, scope);
|
|
6661
6645
|
const feedback = renderSkillActionFeedback(
|
|
6662
6646
|
result,
|
|
6663
|
-
(label,
|
|
6647
|
+
(label, path17) => `${import_chalk6.default.bold(label)} (${import_chalk6.default.dim(path17)})`
|
|
6664
6648
|
);
|
|
6665
6649
|
debugLogger.log(feedback);
|
|
6666
6650
|
}
|
|
@@ -7855,7 +7839,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7855
7839
|
}
|
|
7856
7840
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7857
7841
|
const packageJson = await getPackageJson(__dirname3);
|
|
7858
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.60.0-
|
|
7842
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.60.0-preview.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7859
7843
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7860
7844
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7861
7845
|
}
|
|
@@ -7914,9 +7898,9 @@ async function resolveWorkspacePolicyState(options) {
|
|
|
7914
7898
|
cwd,
|
|
7915
7899
|
potentialWorkspacePoliciesDir
|
|
7916
7900
|
);
|
|
7917
|
-
if (integrityResult.status ===
|
|
7901
|
+
if (integrityResult.status === "MATCH" /* MATCH */) {
|
|
7918
7902
|
workspacePoliciesDir = potentialWorkspacePoliciesDir;
|
|
7919
|
-
} else if (integrityResult.status ===
|
|
7903
|
+
} else if (integrityResult.status === "NEW" /* NEW */ && integrityResult.fileCount === 0) {
|
|
7920
7904
|
workspacePoliciesDir = void 0;
|
|
7921
7905
|
} else if (interactive && !autoAcceptWorkspacePolicies) {
|
|
7922
7906
|
policyUpdateConfirmationRequest = {
|
|
@@ -8344,23 +8328,23 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8344
8328
|
if (rawApprovalMode) {
|
|
8345
8329
|
switch (rawApprovalMode) {
|
|
8346
8330
|
case "yolo":
|
|
8347
|
-
approvalMode =
|
|
8331
|
+
approvalMode = "yolo" /* YOLO */;
|
|
8348
8332
|
break;
|
|
8349
8333
|
case "auto_edit":
|
|
8350
|
-
approvalMode =
|
|
8334
|
+
approvalMode = "autoEdit" /* AUTO_EDIT */;
|
|
8351
8335
|
break;
|
|
8352
8336
|
case "plan":
|
|
8353
8337
|
if (!(settings.general?.plan?.enabled ?? true)) {
|
|
8354
8338
|
debugLogger.warn(
|
|
8355
8339
|
'Approval mode "plan" is disabled in your settings. Falling back to "default".'
|
|
8356
8340
|
);
|
|
8357
|
-
approvalMode =
|
|
8341
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8358
8342
|
} else {
|
|
8359
|
-
approvalMode =
|
|
8343
|
+
approvalMode = "plan" /* PLAN */;
|
|
8360
8344
|
}
|
|
8361
8345
|
break;
|
|
8362
8346
|
case "default":
|
|
8363
|
-
approvalMode =
|
|
8347
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8364
8348
|
break;
|
|
8365
8349
|
default:
|
|
8366
8350
|
throw new Error(
|
|
@@ -8368,10 +8352,10 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8368
8352
|
);
|
|
8369
8353
|
}
|
|
8370
8354
|
} else {
|
|
8371
|
-
approvalMode =
|
|
8355
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8372
8356
|
}
|
|
8373
8357
|
if (settings.security?.disableYoloMode || settings.admin?.secureModeEnabled) {
|
|
8374
|
-
if (approvalMode ===
|
|
8358
|
+
if (approvalMode === "yolo" /* YOLO */) {
|
|
8375
8359
|
if (settings.admin?.secureModeEnabled) {
|
|
8376
8360
|
debugLogger.error(
|
|
8377
8361
|
'YOLO mode is disabled by "secureModeEnabled" setting.'
|
|
@@ -8389,16 +8373,16 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8389
8373
|
)
|
|
8390
8374
|
);
|
|
8391
8375
|
}
|
|
8392
|
-
} else if (approvalMode ===
|
|
8376
|
+
} else if (approvalMode === "yolo" /* YOLO */) {
|
|
8393
8377
|
debugLogger.warn(
|
|
8394
8378
|
"YOLO mode is enabled. All tool calls will be automatically approved."
|
|
8395
8379
|
);
|
|
8396
8380
|
}
|
|
8397
|
-
if (!trustedFolder && approvalMode !==
|
|
8381
|
+
if (!trustedFolder && approvalMode !== "default" /* DEFAULT */) {
|
|
8398
8382
|
debugLogger.warn(
|
|
8399
8383
|
`Approval mode overridden to "default" because the current folder is not trusted.`
|
|
8400
8384
|
);
|
|
8401
|
-
approvalMode =
|
|
8385
|
+
approvalMode = "default" /* DEFAULT */;
|
|
8402
8386
|
}
|
|
8403
8387
|
let telemetrySettings;
|
|
8404
8388
|
try {
|
|
@@ -8790,7 +8774,7 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
8790
8774
|
import v8 from "node:v8";
|
|
8791
8775
|
import os6 from "node:os";
|
|
8792
8776
|
import dns from "node:dns";
|
|
8793
|
-
import * as
|
|
8777
|
+
import * as path16 from "node:path";
|
|
8794
8778
|
import * as fsPromises from "node:fs/promises";
|
|
8795
8779
|
|
|
8796
8780
|
// packages/cli/src/utils/sandbox.ts
|
|
@@ -8802,7 +8786,7 @@ import {
|
|
|
8802
8786
|
spawn as spawn2,
|
|
8803
8787
|
spawnSync
|
|
8804
8788
|
} from "node:child_process";
|
|
8805
|
-
import
|
|
8789
|
+
import path9 from "node:path";
|
|
8806
8790
|
import fs7 from "node:fs";
|
|
8807
8791
|
import os3 from "node:os";
|
|
8808
8792
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
@@ -8813,6 +8797,7 @@ import { randomBytes } from "node:crypto";
|
|
|
8813
8797
|
var import_shell_quote = __toESM(require_shell_quote(), 1);
|
|
8814
8798
|
import os2 from "node:os";
|
|
8815
8799
|
import fs6 from "node:fs";
|
|
8800
|
+
import path8 from "node:path";
|
|
8816
8801
|
import { readFile } from "node:fs/promises";
|
|
8817
8802
|
var LOCAL_DEV_SANDBOX_IMAGE_NAME = "gemini-cli-sandbox";
|
|
8818
8803
|
var SANDBOX_NETWORK_NAME = "gemini-cli-sandbox";
|
|
@@ -8827,6 +8812,58 @@ var BUILTIN_SEATBELT_PROFILES = [
|
|
|
8827
8812
|
"strict-open",
|
|
8828
8813
|
"strict-proxied"
|
|
8829
8814
|
];
|
|
8815
|
+
var SENSITIVE_SETTINGS_FILENAMES = /* @__PURE__ */ new Set([
|
|
8816
|
+
"oauth_creds.json",
|
|
8817
|
+
"google_accounts.json",
|
|
8818
|
+
"gemini-credentials.json",
|
|
8819
|
+
"mcp-oauth-tokens.json",
|
|
8820
|
+
"a2a-oauth-tokens.json"
|
|
8821
|
+
]);
|
|
8822
|
+
function isCredentialOrSensitivePath(targetPath, rootDir) {
|
|
8823
|
+
if (rootDir && path8.resolve(targetPath) === path8.resolve(rootDir)) {
|
|
8824
|
+
return false;
|
|
8825
|
+
}
|
|
8826
|
+
const base = path8.basename(targetPath).toLowerCase();
|
|
8827
|
+
if (SENSITIVE_SETTINGS_FILENAMES.has(base)) {
|
|
8828
|
+
return true;
|
|
8829
|
+
}
|
|
8830
|
+
const isRootChild = rootDir ? path8.dirname(path8.resolve(targetPath)) === path8.resolve(rootDir) : true;
|
|
8831
|
+
if (isRootChild && (base === "history" || base === "tmp" || base === "bin")) {
|
|
8832
|
+
return true;
|
|
8833
|
+
}
|
|
8834
|
+
const hasSensitiveSuffix = (s) => {
|
|
8835
|
+
if (base === s) return true;
|
|
8836
|
+
if (base.endsWith(s)) {
|
|
8837
|
+
const charBefore = base.charAt(base.length - s.length - 1);
|
|
8838
|
+
return charBefore === "-" || charBefore === "_" || charBefore === ".";
|
|
8839
|
+
}
|
|
8840
|
+
return false;
|
|
8841
|
+
};
|
|
8842
|
+
if (base.endsWith(".credentials") || hasSensitiveSuffix("credentials") || hasSensitiveSuffix("credentials.json") || hasSensitiveSuffix("tokens.json") || hasSensitiveSuffix("token.json") || hasSensitiveSuffix("token") || hasSensitiveSuffix("creds.json") || hasSensitiveSuffix("cred.json") || base.endsWith(".env") || base.endsWith(".key") || base.endsWith(".pem") || base.endsWith(".p12") || hasSensitiveSuffix("key.json")) {
|
|
8843
|
+
return true;
|
|
8844
|
+
}
|
|
8845
|
+
return false;
|
|
8846
|
+
}
|
|
8847
|
+
function prepareIsolatedSettingsDir(userSettingsDirOnHost) {
|
|
8848
|
+
const baseTmpDir = os2.tmpdir() || "/tmp";
|
|
8849
|
+
const isolatedDir = fs6.mkdtempSync(
|
|
8850
|
+
path8.join(baseTmpDir, "gemini-sandbox-settings-")
|
|
8851
|
+
);
|
|
8852
|
+
fs6.chmodSync(isolatedDir, 448);
|
|
8853
|
+
if (fs6.existsSync(userSettingsDirOnHost)) {
|
|
8854
|
+
try {
|
|
8855
|
+
fs6.cpSync(userSettingsDirOnHost, isolatedDir, {
|
|
8856
|
+
recursive: true,
|
|
8857
|
+
filter: (source) => !isCredentialOrSensitivePath(source, userSettingsDirOnHost)
|
|
8858
|
+
});
|
|
8859
|
+
} catch (err) {
|
|
8860
|
+
debugLogger.warn(
|
|
8861
|
+
`Failed to copy user settings to sandbox directory: ${err instanceof Error ? err.message : String(err)}`
|
|
8862
|
+
);
|
|
8863
|
+
}
|
|
8864
|
+
}
|
|
8865
|
+
return isolatedDir;
|
|
8866
|
+
}
|
|
8830
8867
|
function getContainerPath(hostPath) {
|
|
8831
8868
|
if (os2.platform() !== "win32") {
|
|
8832
8869
|
return hostPath;
|
|
@@ -9729,7 +9766,18 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9729
9766
|
let stopProxy = void 0;
|
|
9730
9767
|
let tempProfileFile = null;
|
|
9731
9768
|
let sandboxTmpDir = null;
|
|
9769
|
+
let isolatedSettingsDir = null;
|
|
9732
9770
|
const cleanup = () => {
|
|
9771
|
+
if (isolatedSettingsDir) {
|
|
9772
|
+
const dirToDelete = isolatedSettingsDir;
|
|
9773
|
+
isolatedSettingsDir = null;
|
|
9774
|
+
try {
|
|
9775
|
+
if (fs7.existsSync(dirToDelete)) {
|
|
9776
|
+
fs7.rmSync(dirToDelete, { recursive: true, force: true });
|
|
9777
|
+
}
|
|
9778
|
+
} catch {
|
|
9779
|
+
}
|
|
9780
|
+
}
|
|
9733
9781
|
if (sandboxTmpDir) {
|
|
9734
9782
|
const dirToDelete = sandboxTmpDir;
|
|
9735
9783
|
sandboxTmpDir = null;
|
|
@@ -9782,10 +9830,10 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9782
9830
|
new URL(`sandbox-macos-${profile}.sb`, import.meta.url)
|
|
9783
9831
|
);
|
|
9784
9832
|
if (!BUILTIN_SEATBELT_PROFILES.includes(profile)) {
|
|
9785
|
-
const safeProfile =
|
|
9833
|
+
const safeProfile = path9.basename(profile);
|
|
9786
9834
|
const fileName = `sandbox-macos-${safeProfile}.sb`;
|
|
9787
|
-
const userProfileFile =
|
|
9788
|
-
const projectProfileFile =
|
|
9835
|
+
const userProfileFile = path9.join(homedir(), GEMINI_DIR, fileName);
|
|
9836
|
+
const projectProfileFile = path9.join(GEMINI_DIR, fileName);
|
|
9789
9837
|
profileFile = fs7.existsSync(userProfileFile) ? userProfileFile : projectProfileFile;
|
|
9790
9838
|
} else {
|
|
9791
9839
|
if (!fs7.existsSync(profileFile)) {
|
|
@@ -9794,7 +9842,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9794
9842
|
try {
|
|
9795
9843
|
const tempDir = fs7.realpathSync(os3.tmpdir());
|
|
9796
9844
|
const rand = randomBytes(8).toString("hex");
|
|
9797
|
-
tempProfileFile =
|
|
9845
|
+
tempProfileFile = path9.join(
|
|
9798
9846
|
tempDir,
|
|
9799
9847
|
`gemini-sandbox-macos-${profile}-${rand}.sb`
|
|
9800
9848
|
);
|
|
@@ -9824,7 +9872,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9824
9872
|
].join(" ");
|
|
9825
9873
|
const hostTmpDir = fs7.realpathSync(os3.tmpdir());
|
|
9826
9874
|
const resolvedTmpDir = fs7.mkdtempSync(
|
|
9827
|
-
|
|
9875
|
+
path9.join(hostTmpDir, "gemini-sandbox-")
|
|
9828
9876
|
);
|
|
9829
9877
|
sandboxTmpDir = resolvedTmpDir;
|
|
9830
9878
|
const args2 = [
|
|
@@ -9852,7 +9900,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9852
9900
|
}
|
|
9853
9901
|
if (config.allowedPaths) {
|
|
9854
9902
|
for (const hostPath of config.allowedPaths) {
|
|
9855
|
-
if (hostPath &&
|
|
9903
|
+
if (hostPath && path9.isAbsolute(hostPath) && fs7.existsSync(hostPath)) {
|
|
9856
9904
|
const realDir = fs7.realpathSync(hostPath);
|
|
9857
9905
|
if (!includedDirs.includes(realDir) && realDir !== targetDir) {
|
|
9858
9906
|
includedDirs.push(realDir);
|
|
@@ -9958,7 +10006,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9958
10006
|
if (!command2) throw new FatalSandboxError("Sandbox command is required");
|
|
9959
10007
|
debugLogger.log(`hopping into sandbox (command: ${command2}) ...`);
|
|
9960
10008
|
const gcPath = process.argv[1] ? fs7.realpathSync(process.argv[1]) : "";
|
|
9961
|
-
const projectSandboxDockerfile =
|
|
10009
|
+
const projectSandboxDockerfile = path9.join(
|
|
9962
10010
|
GEMINI_DIR,
|
|
9963
10011
|
"sandbox.Dockerfile"
|
|
9964
10012
|
);
|
|
@@ -9967,7 +10015,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9967
10015
|
if (!image) throw new FatalSandboxError("Sandbox image is required");
|
|
9968
10016
|
if (!/^[a-zA-Z0-9_.:/-]+$/.test(image))
|
|
9969
10017
|
throw new FatalSandboxError("Invalid sandbox image name");
|
|
9970
|
-
const workdir =
|
|
10018
|
+
const workdir = path9.resolve(process.cwd());
|
|
9971
10019
|
const containerWorkdir = getContainerPath(workdir);
|
|
9972
10020
|
if (process.env["BUILD_SANDBOX"]) {
|
|
9973
10021
|
if (!gcPath.includes("gemini-cli/packages/")) {
|
|
@@ -9978,13 +10026,13 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9978
10026
|
debugLogger.log("building sandbox ...");
|
|
9979
10027
|
const gcRoot = gcPath.split("/packages/")[0];
|
|
9980
10028
|
let buildArgs = "";
|
|
9981
|
-
const projectSandboxDockerfile2 =
|
|
10029
|
+
const projectSandboxDockerfile2 = path9.join(
|
|
9982
10030
|
GEMINI_DIR,
|
|
9983
10031
|
"sandbox.Dockerfile"
|
|
9984
10032
|
);
|
|
9985
10033
|
if (isCustomProjectSandbox) {
|
|
9986
10034
|
debugLogger.log(`using ${projectSandboxDockerfile2} for sandbox`);
|
|
9987
|
-
buildArgs += `-f ${
|
|
10035
|
+
buildArgs += `-f ${path9.resolve(projectSandboxDockerfile2)} -i ${image}`;
|
|
9988
10036
|
}
|
|
9989
10037
|
execSync(
|
|
9990
10038
|
`cd ${gcRoot} && node scripts/build_sandbox.js -s ${buildArgs}`,
|
|
@@ -10028,18 +10076,16 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10028
10076
|
if (!fs7.existsSync(userHomeDirOnHost)) {
|
|
10029
10077
|
fs7.mkdirSync(userHomeDirOnHost, { recursive: true });
|
|
10030
10078
|
}
|
|
10031
|
-
const userSettingsDirOnHost =
|
|
10079
|
+
const userSettingsDirOnHost = path9.join(userHomeDirOnHost, GEMINI_DIR);
|
|
10032
10080
|
if (!fs7.existsSync(userSettingsDirOnHost)) {
|
|
10033
10081
|
fs7.mkdirSync(userSettingsDirOnHost, { recursive: true });
|
|
10034
10082
|
}
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
`${userSettingsDirOnHost}:${userSettingsDirInSandbox}`
|
|
10038
|
-
);
|
|
10083
|
+
isolatedSettingsDir = prepareIsolatedSettingsDir(userSettingsDirOnHost);
|
|
10084
|
+
args.push("--volume", `${isolatedSettingsDir}:${userSettingsDirInSandbox}`);
|
|
10039
10085
|
if (userSettingsDirInSandbox !== getContainerPath(userSettingsDirOnHost)) {
|
|
10040
10086
|
args.push(
|
|
10041
10087
|
"--volume",
|
|
10042
|
-
`${
|
|
10088
|
+
`${isolatedSettingsDir}:${getContainerPath(userSettingsDirOnHost)}`
|
|
10043
10089
|
);
|
|
10044
10090
|
}
|
|
10045
10091
|
args.push("--volume", `${os3.tmpdir()}:${getContainerPath(os3.tmpdir())}`);
|
|
@@ -10049,7 +10095,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10049
10095
|
`${userHomeDirOnHost}:${getContainerPath(userHomeDirOnHost)}`
|
|
10050
10096
|
);
|
|
10051
10097
|
}
|
|
10052
|
-
const gcloudConfigDir =
|
|
10098
|
+
const gcloudConfigDir = path9.join(homedir(), ".config", "gcloud");
|
|
10053
10099
|
if (fs7.existsSync(gcloudConfigDir)) {
|
|
10054
10100
|
args.push(
|
|
10055
10101
|
"--volume",
|
|
@@ -10073,7 +10119,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10073
10119
|
to = to || from;
|
|
10074
10120
|
opts = opts || "ro";
|
|
10075
10121
|
mount = `${from}:${to}:${opts}`;
|
|
10076
|
-
if (!
|
|
10122
|
+
if (!path9.isAbsolute(from)) {
|
|
10077
10123
|
throw new FatalSandboxError(
|
|
10078
10124
|
`Path '${from}' listed in SANDBOX_MOUNTS must be absolute`
|
|
10079
10125
|
);
|
|
@@ -10090,7 +10136,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10090
10136
|
}
|
|
10091
10137
|
if (config.allowedPaths) {
|
|
10092
10138
|
for (const hostPath of config.allowedPaths) {
|
|
10093
|
-
if (hostPath &&
|
|
10139
|
+
if (hostPath && path9.isAbsolute(hostPath) && fs7.existsSync(hostPath)) {
|
|
10094
10140
|
const containerPath = getContainerPath(hostPath);
|
|
10095
10141
|
debugLogger.log(
|
|
10096
10142
|
`Config allowedPath: ${hostPath} -> ${containerPath} (ro)`
|
|
@@ -10210,7 +10256,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10210
10256
|
}
|
|
10211
10257
|
}
|
|
10212
10258
|
if (process.env["VIRTUAL_ENV"]?.toLowerCase().startsWith(workdir.toLowerCase())) {
|
|
10213
|
-
const sandboxVenvPath =
|
|
10259
|
+
const sandboxVenvPath = path9.resolve(GEMINI_DIR, "sandbox.venv");
|
|
10214
10260
|
if (!fs7.existsSync(sandboxVenvPath)) {
|
|
10215
10261
|
fs7.mkdirSync(sandboxVenvPath, { recursive: true });
|
|
10216
10262
|
}
|
|
@@ -10247,7 +10293,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10247
10293
|
}
|
|
10248
10294
|
args.push("--env", `SANDBOX=${containerName}`);
|
|
10249
10295
|
if (command2 === "podman") {
|
|
10250
|
-
const emptyAuthFilePath =
|
|
10296
|
+
const emptyAuthFilePath = path9.join(os3.tmpdir(), "empty_auth.json");
|
|
10251
10297
|
fs7.writeFileSync(emptyAuthFilePath, "{}", "utf-8");
|
|
10252
10298
|
args.push("--authfile", emptyAuthFilePath);
|
|
10253
10299
|
}
|
|
@@ -10376,7 +10422,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
10376
10422
|
}
|
|
10377
10423
|
async function start_lxc_sandbox(config, nodeArgs = [], cliArgs = []) {
|
|
10378
10424
|
const containerName = config.image || "gemini-sandbox";
|
|
10379
|
-
const workdir =
|
|
10425
|
+
const workdir = path9.resolve(process.cwd());
|
|
10380
10426
|
debugLogger.log(
|
|
10381
10427
|
`starting lxc sandbox (container: ${containerName}, workdir: ${workdir}) ...`
|
|
10382
10428
|
);
|
|
@@ -10457,7 +10503,7 @@ async function start_lxc_sandbox(config, nodeArgs = [], cliArgs = []) {
|
|
|
10457
10503
|
}
|
|
10458
10504
|
if (config.allowedPaths) {
|
|
10459
10505
|
for (const hostPath of config.allowedPaths) {
|
|
10460
|
-
if (hostPath &&
|
|
10506
|
+
if (hostPath && path9.isAbsolute(hostPath) && fs7.existsSync(hostPath)) {
|
|
10461
10507
|
const allowedDeviceName = `gemini-allowed-${randomBytes(4).toString(
|
|
10462
10508
|
"hex"
|
|
10463
10509
|
)}`;
|
|
@@ -10703,11 +10749,11 @@ async function getStartupWarnings() {
|
|
|
10703
10749
|
// packages/cli/src/utils/userStartupWarnings.ts
|
|
10704
10750
|
import fs9 from "node:fs/promises";
|
|
10705
10751
|
import { homedir as osHomedir } from "node:os";
|
|
10706
|
-
import
|
|
10752
|
+
import path10 from "node:path";
|
|
10707
10753
|
import process4 from "node:process";
|
|
10708
10754
|
var homeDirectoryCheck = {
|
|
10709
10755
|
id: "home-directory",
|
|
10710
|
-
priority:
|
|
10756
|
+
priority: "low" /* Low */,
|
|
10711
10757
|
check: async (workspaceRoot, settings) => {
|
|
10712
10758
|
if (settings.ui?.showHomeDirectoryWarning === false) {
|
|
10713
10759
|
return null;
|
|
@@ -10717,7 +10763,7 @@ var homeDirectoryCheck = {
|
|
|
10717
10763
|
fs9.realpath(workspaceRoot),
|
|
10718
10764
|
fs9.realpath(osHomedir())
|
|
10719
10765
|
]);
|
|
10720
|
-
if (
|
|
10766
|
+
if (path10.resolve(workspaceRealPath) === path10.resolve(homeRealPath)) {
|
|
10721
10767
|
if (isFolderTrustEnabled(settings) && isWorkspaceTrusted(settings).isTrusted) {
|
|
10722
10768
|
return null;
|
|
10723
10769
|
}
|
|
@@ -10731,12 +10777,12 @@ var homeDirectoryCheck = {
|
|
|
10731
10777
|
};
|
|
10732
10778
|
var rootDirectoryCheck = {
|
|
10733
10779
|
id: "root-directory",
|
|
10734
|
-
priority:
|
|
10780
|
+
priority: "high" /* High */,
|
|
10735
10781
|
check: async (workspaceRoot, _settings) => {
|
|
10736
10782
|
try {
|
|
10737
10783
|
const workspaceRealPath = await fs9.realpath(workspaceRoot);
|
|
10738
10784
|
const errorMessage = "Warning: You are running Gemini CLI in the root directory. Your entire folder structure will be used for context. It is strongly recommended to run in a project-specific directory.";
|
|
10739
|
-
if (
|
|
10785
|
+
if (path10.dirname(workspaceRealPath) === workspaceRealPath) {
|
|
10740
10786
|
return errorMessage;
|
|
10741
10787
|
}
|
|
10742
10788
|
return null;
|
|
@@ -10747,7 +10793,7 @@ var rootDirectoryCheck = {
|
|
|
10747
10793
|
};
|
|
10748
10794
|
var folderTrustCheck = {
|
|
10749
10795
|
id: "folder-trust",
|
|
10750
|
-
priority:
|
|
10796
|
+
priority: "high" /* High */,
|
|
10751
10797
|
check: async (workspaceRoot, settings) => {
|
|
10752
10798
|
if (!isFolderTrustEnabled(settings)) {
|
|
10753
10799
|
return null;
|
|
@@ -10937,12 +10983,12 @@ function handleError(error, config, customErrorCode) {
|
|
|
10937
10983
|
error,
|
|
10938
10984
|
config.getContentGeneratorConfig()?.authType
|
|
10939
10985
|
);
|
|
10940
|
-
if (config.getOutputFormat() ===
|
|
10986
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10941
10987
|
const streamFormatter = new StreamJsonFormatter();
|
|
10942
10988
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10943
10989
|
const metrics = uiTelemetryService.getMetrics();
|
|
10944
10990
|
streamFormatter.emitEvent({
|
|
10945
|
-
type:
|
|
10991
|
+
type: "result" /* RESULT */,
|
|
10946
10992
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10947
10993
|
status: "error",
|
|
10948
10994
|
error: {
|
|
@@ -10953,7 +10999,7 @@ function handleError(error, config, customErrorCode) {
|
|
|
10953
10999
|
});
|
|
10954
11000
|
runSyncCleanup();
|
|
10955
11001
|
process.exit(getNumericExitCode(errorCode));
|
|
10956
|
-
} else if (config.getOutputFormat() ===
|
|
11002
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10957
11003
|
const formatter = new JsonFormatter();
|
|
10958
11004
|
const errorCode = customErrorCode ?? extractErrorCode(error);
|
|
10959
11005
|
const formattedError = formatter.formatError(
|
|
@@ -10973,11 +11019,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10973
11019
|
const isFatal = isFatalToolError(errorType);
|
|
10974
11020
|
if (isFatal) {
|
|
10975
11021
|
const toolExecutionError = new FatalToolExecutionError(errorMessage);
|
|
10976
|
-
if (config.getOutputFormat() ===
|
|
11022
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
10977
11023
|
const streamFormatter = new StreamJsonFormatter();
|
|
10978
11024
|
const metrics = uiTelemetryService.getMetrics();
|
|
10979
11025
|
streamFormatter.emitEvent({
|
|
10980
|
-
type:
|
|
11026
|
+
type: "result" /* RESULT */,
|
|
10981
11027
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10982
11028
|
status: "error",
|
|
10983
11029
|
error: {
|
|
@@ -10986,7 +11032,7 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
10986
11032
|
},
|
|
10987
11033
|
stats: streamFormatter.convertToStreamStats(metrics, 0)
|
|
10988
11034
|
});
|
|
10989
|
-
} else if (config.getOutputFormat() ===
|
|
11035
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
10990
11036
|
const formatter = new JsonFormatter();
|
|
10991
11037
|
const formattedError = formatter.formatError(
|
|
10992
11038
|
toolExecutionError,
|
|
@@ -11004,11 +11050,11 @@ function handleToolError(toolName, toolError, config, errorType, resultDisplay)
|
|
|
11004
11050
|
}
|
|
11005
11051
|
function handleCancellationError(config) {
|
|
11006
11052
|
const cancellationError = new FatalCancellationError("Operation cancelled.");
|
|
11007
|
-
if (config.getOutputFormat() ===
|
|
11053
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11008
11054
|
const streamFormatter = new StreamJsonFormatter();
|
|
11009
11055
|
const metrics = uiTelemetryService.getMetrics();
|
|
11010
11056
|
streamFormatter.emitEvent({
|
|
11011
|
-
type:
|
|
11057
|
+
type: "result" /* RESULT */,
|
|
11012
11058
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11013
11059
|
status: "error",
|
|
11014
11060
|
error: {
|
|
@@ -11019,7 +11065,7 @@ function handleCancellationError(config) {
|
|
|
11019
11065
|
});
|
|
11020
11066
|
runSyncCleanup();
|
|
11021
11067
|
process.exit(cancellationError.exitCode);
|
|
11022
|
-
} else if (config.getOutputFormat() ===
|
|
11068
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11023
11069
|
const formatter = new JsonFormatter();
|
|
11024
11070
|
const formattedError = formatter.formatError(
|
|
11025
11071
|
cancellationError,
|
|
@@ -11039,11 +11085,11 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11039
11085
|
const maxTurnsError = new FatalTurnLimitedError(
|
|
11040
11086
|
"Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json."
|
|
11041
11087
|
);
|
|
11042
|
-
if (config.getOutputFormat() ===
|
|
11088
|
+
if (config.getOutputFormat() === "stream-json" /* STREAM_JSON */) {
|
|
11043
11089
|
const streamFormatter = new StreamJsonFormatter();
|
|
11044
11090
|
const metrics = uiTelemetryService.getMetrics();
|
|
11045
11091
|
streamFormatter.emitEvent({
|
|
11046
|
-
type:
|
|
11092
|
+
type: "result" /* RESULT */,
|
|
11047
11093
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11048
11094
|
status: "error",
|
|
11049
11095
|
error: {
|
|
@@ -11054,7 +11100,7 @@ function handleMaxTurnsExceededError(config) {
|
|
|
11054
11100
|
});
|
|
11055
11101
|
runSyncCleanup();
|
|
11056
11102
|
process.exit(maxTurnsError.exitCode);
|
|
11057
|
-
} else if (config.getOutputFormat() ===
|
|
11103
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11058
11104
|
const formatter = new JsonFormatter();
|
|
11059
11105
|
const formattedError = formatter.formatError(
|
|
11060
11106
|
maxTurnsError,
|
|
@@ -11134,7 +11180,7 @@ async function runNonInteractive({
|
|
|
11134
11180
|
}
|
|
11135
11181
|
});
|
|
11136
11182
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11137
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11183
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-YPPCMYGQ.js");
|
|
11138
11184
|
setupInitialActivityLogger(config);
|
|
11139
11185
|
}
|
|
11140
11186
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11150,7 +11196,7 @@ async function runNonInteractive({
|
|
|
11150
11196
|
}
|
|
11151
11197
|
};
|
|
11152
11198
|
const startTime = Date.now();
|
|
11153
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11199
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11154
11200
|
const abortController = new AbortController();
|
|
11155
11201
|
let isAborting = false;
|
|
11156
11202
|
let cancelMessageTimer = null;
|
|
@@ -11203,13 +11249,13 @@ async function runNonInteractive({
|
|
|
11203
11249
|
};
|
|
11204
11250
|
try {
|
|
11205
11251
|
consolePatcher.patch();
|
|
11206
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11252
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11207
11253
|
process.stderr.write(
|
|
11208
11254
|
"[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"
|
|
11209
11255
|
);
|
|
11210
11256
|
}
|
|
11211
11257
|
setupStdinCancellation();
|
|
11212
|
-
coreEvents.on(
|
|
11258
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11213
11259
|
coreEvents.drainBacklogs();
|
|
11214
11260
|
process.stdout.on("error", (err) => {
|
|
11215
11261
|
if (err.code === "EPIPE") {
|
|
@@ -11235,7 +11281,7 @@ async function runNonInteractive({
|
|
|
11235
11281
|
}
|
|
11236
11282
|
if (streamFormatter) {
|
|
11237
11283
|
streamFormatter.emitEvent({
|
|
11238
|
-
type:
|
|
11284
|
+
type: "init" /* INIT */,
|
|
11239
11285
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11240
11286
|
session_id: config.getSessionId(),
|
|
11241
11287
|
model: config.getModel()
|
|
@@ -11273,7 +11319,7 @@ async function runNonInteractive({
|
|
|
11273
11319
|
}
|
|
11274
11320
|
if (streamFormatter) {
|
|
11275
11321
|
streamFormatter.emitEvent({
|
|
11276
|
-
type:
|
|
11322
|
+
type: "message" /* MESSAGE */,
|
|
11277
11323
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11278
11324
|
role: "user",
|
|
11279
11325
|
content: input
|
|
@@ -11312,12 +11358,12 @@ async function runNonInteractive({
|
|
|
11312
11358
|
const metrics = uiTelemetryService.getMetrics();
|
|
11313
11359
|
const durationMs = Date.now() - startTime;
|
|
11314
11360
|
streamFormatter.emitEvent({
|
|
11315
|
-
type:
|
|
11361
|
+
type: "result" /* RESULT */,
|
|
11316
11362
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11317
11363
|
status: errorPayload ? "error" : "success",
|
|
11318
11364
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
11319
11365
|
});
|
|
11320
|
-
} else if (config.getOutputFormat() ===
|
|
11366
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11321
11367
|
const formatter = new JsonFormatter();
|
|
11322
11368
|
const stats = uiTelemetryService.getMetrics();
|
|
11323
11369
|
textOutput.write(
|
|
@@ -11410,13 +11456,13 @@ async function runNonInteractive({
|
|
|
11410
11456
|
const output = isRaw ? part.text : stripAnsi(part.text);
|
|
11411
11457
|
if (streamFormatter) {
|
|
11412
11458
|
streamFormatter.emitEvent({
|
|
11413
|
-
type:
|
|
11459
|
+
type: "message" /* MESSAGE */,
|
|
11414
11460
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11415
11461
|
role: "assistant",
|
|
11416
11462
|
content: output,
|
|
11417
11463
|
delta: true
|
|
11418
11464
|
});
|
|
11419
|
-
} else if (config.getOutputFormat() ===
|
|
11465
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11420
11466
|
responseText += output;
|
|
11421
11467
|
} else {
|
|
11422
11468
|
if (part.text) {
|
|
@@ -11429,13 +11475,13 @@ async function runNonInteractive({
|
|
|
11429
11475
|
break;
|
|
11430
11476
|
}
|
|
11431
11477
|
case "tool_request": {
|
|
11432
|
-
if (config.getOutputFormat() ===
|
|
11478
|
+
if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11433
11479
|
preToolResponseText = responseText || preToolResponseText;
|
|
11434
11480
|
responseText = "";
|
|
11435
11481
|
}
|
|
11436
11482
|
if (streamFormatter) {
|
|
11437
11483
|
streamFormatter.emitEvent({
|
|
11438
|
-
type:
|
|
11484
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11439
11485
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11440
11486
|
tool_name: event.name,
|
|
11441
11487
|
tool_id: event.requestId,
|
|
@@ -11451,7 +11497,7 @@ async function runNonInteractive({
|
|
|
11451
11497
|
const displayText = displayContentToString(display);
|
|
11452
11498
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11453
11499
|
streamFormatter.emitEvent({
|
|
11454
|
-
type:
|
|
11500
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11455
11501
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11456
11502
|
tool_id: event.requestId,
|
|
11457
11503
|
status: event.isError ? "error" : "success",
|
|
@@ -11466,17 +11512,17 @@ async function runNonInteractive({
|
|
|
11466
11512
|
const display = event.display?.result;
|
|
11467
11513
|
const displayText = displayContentToString(display);
|
|
11468
11514
|
const errorMsg = getTextContent(event.content) ?? "Tool error";
|
|
11469
|
-
if (event.data?.["errorType"] ===
|
|
11470
|
-
if (config.getOutputFormat() ===
|
|
11515
|
+
if (event.data?.["errorType"] === "stop_execution" /* STOP_EXECUTION */) {
|
|
11516
|
+
if (config.getOutputFormat() === "json" /* JSON */ && !responseText && preToolResponseText) {
|
|
11471
11517
|
responseText = preToolResponseText;
|
|
11472
11518
|
}
|
|
11473
11519
|
const stopMessage = `Agent execution stopped: ${errorMsg}`;
|
|
11474
|
-
if (config.getOutputFormat() ===
|
|
11520
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11475
11521
|
process.stderr.write(`${stopMessage}
|
|
11476
11522
|
`);
|
|
11477
11523
|
}
|
|
11478
11524
|
}
|
|
11479
|
-
if (event.data?.["errorType"] ===
|
|
11525
|
+
if (event.data?.["errorType"] === "no_space_left" /* NO_SPACE_LEFT */) {
|
|
11480
11526
|
throw new FatalToolExecutionError(
|
|
11481
11527
|
"Error executing tool " + event.name + ": " + (displayText || errorMsg)
|
|
11482
11528
|
);
|
|
@@ -11511,12 +11557,12 @@ async function runNonInteractive({
|
|
|
11511
11557
|
}
|
|
11512
11558
|
if (streamFormatter) {
|
|
11513
11559
|
streamFormatter.emitEvent({
|
|
11514
|
-
type:
|
|
11560
|
+
type: "error" /* ERROR */,
|
|
11515
11561
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11516
11562
|
severity: "error",
|
|
11517
11563
|
message: errorMessage
|
|
11518
11564
|
});
|
|
11519
|
-
} else if (config.getOutputFormat() ===
|
|
11565
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11520
11566
|
process.stderr.write(`[ERROR] ${errorMessage}
|
|
11521
11567
|
`);
|
|
11522
11568
|
}
|
|
@@ -11537,12 +11583,12 @@ async function runNonInteractive({
|
|
|
11537
11583
|
const errorCode = event._meta?.["code"];
|
|
11538
11584
|
if (errorCode === "AGENT_EXECUTION_BLOCKED") {
|
|
11539
11585
|
const blockMessage = `Agent execution blocked: ${event.message.trim()}`;
|
|
11540
|
-
if (config.getOutputFormat() ===
|
|
11586
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11541
11587
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11542
11588
|
`);
|
|
11543
11589
|
} else if (streamFormatter) {
|
|
11544
11590
|
streamFormatter.emitEvent({
|
|
11545
|
-
type:
|
|
11591
|
+
type: "error" /* ERROR */,
|
|
11546
11592
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11547
11593
|
severity: "warning",
|
|
11548
11594
|
message: stripAnsi(blockMessage)
|
|
@@ -11552,13 +11598,13 @@ async function runNonInteractive({
|
|
|
11552
11598
|
break;
|
|
11553
11599
|
}
|
|
11554
11600
|
const severity = event.status === "RESOURCE_EXHAUSTED" ? "error" : "warning";
|
|
11555
|
-
if (config.getOutputFormat() ===
|
|
11601
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11556
11602
|
process.stderr.write(`[WARNING] ${event.message}
|
|
11557
11603
|
`);
|
|
11558
11604
|
}
|
|
11559
11605
|
if (streamFormatter) {
|
|
11560
11606
|
streamFormatter.emitEvent({
|
|
11561
|
-
type:
|
|
11607
|
+
type: "error" /* ERROR */,
|
|
11562
11608
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11563
11609
|
severity,
|
|
11564
11610
|
message: stripAnsi(event.message)
|
|
@@ -11578,7 +11624,7 @@ async function runNonInteractive({
|
|
|
11578
11624
|
);
|
|
11579
11625
|
} else if (streamFormatter) {
|
|
11580
11626
|
streamFormatter.emitEvent({
|
|
11581
|
-
type:
|
|
11627
|
+
type: "error" /* ERROR */,
|
|
11582
11628
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11583
11629
|
severity: "error",
|
|
11584
11630
|
message: "Maximum session turns exceeded"
|
|
@@ -11586,7 +11632,7 @@ async function runNonInteractive({
|
|
|
11586
11632
|
}
|
|
11587
11633
|
}
|
|
11588
11634
|
const stopMessage = typeof event.data?.["message"] === "string" ? event.data["message"] : "";
|
|
11589
|
-
if (stopMessage && config.getOutputFormat() ===
|
|
11635
|
+
if (stopMessage && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11590
11636
|
process.stderr.write(`Agent execution stopped: ${stopMessage}
|
|
11591
11637
|
`);
|
|
11592
11638
|
}
|
|
@@ -11616,7 +11662,7 @@ async function runNonInteractive({
|
|
|
11616
11662
|
abortController.signal.removeEventListener("abort", abortSession);
|
|
11617
11663
|
scheduler?.dispose();
|
|
11618
11664
|
consolePatcher.cleanup();
|
|
11619
|
-
coreEvents.off(
|
|
11665
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11620
11666
|
}
|
|
11621
11667
|
if (errorToHandle) {
|
|
11622
11668
|
handleError(errorToHandle, config);
|
|
@@ -11644,7 +11690,7 @@ async function runNonInteractive2(params) {
|
|
|
11644
11690
|
}
|
|
11645
11691
|
});
|
|
11646
11692
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
11647
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
11693
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-YPPCMYGQ.js");
|
|
11648
11694
|
setupInitialActivityLogger(config);
|
|
11649
11695
|
}
|
|
11650
11696
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -11660,7 +11706,7 @@ async function runNonInteractive2(params) {
|
|
|
11660
11706
|
}
|
|
11661
11707
|
};
|
|
11662
11708
|
const startTime = Date.now();
|
|
11663
|
-
const streamFormatter = config.getOutputFormat() ===
|
|
11709
|
+
const streamFormatter = config.getOutputFormat() === "stream-json" /* STREAM_JSON */ ? new StreamJsonFormatter() : null;
|
|
11664
11710
|
const abortController = new AbortController();
|
|
11665
11711
|
let isAborting = false;
|
|
11666
11712
|
let cancelMessageTimer = null;
|
|
@@ -11711,13 +11757,13 @@ async function runNonInteractive2(params) {
|
|
|
11711
11757
|
let scheduler;
|
|
11712
11758
|
try {
|
|
11713
11759
|
consolePatcher.patch();
|
|
11714
|
-
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() ===
|
|
11760
|
+
if (config.getRawOutput() && !config.getAcceptRawOutputRisk() && config.getOutputFormat() === "text" /* TEXT */) {
|
|
11715
11761
|
process.stderr.write(
|
|
11716
11762
|
"[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"
|
|
11717
11763
|
);
|
|
11718
11764
|
}
|
|
11719
11765
|
setupStdinCancellation();
|
|
11720
|
-
coreEvents.on(
|
|
11766
|
+
coreEvents.on("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
11721
11767
|
coreEvents.drainBacklogs();
|
|
11722
11768
|
process.stdout.on("error", (err) => {
|
|
11723
11769
|
if (err.code === "EPIPE") {
|
|
@@ -11741,7 +11787,7 @@ async function runNonInteractive2(params) {
|
|
|
11741
11787
|
}
|
|
11742
11788
|
if (streamFormatter) {
|
|
11743
11789
|
streamFormatter.emitEvent({
|
|
11744
|
-
type:
|
|
11790
|
+
type: "init" /* INIT */,
|
|
11745
11791
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11746
11792
|
session_id: config.getSessionId(),
|
|
11747
11793
|
model: config.getModel()
|
|
@@ -11779,7 +11825,7 @@ async function runNonInteractive2(params) {
|
|
|
11779
11825
|
}
|
|
11780
11826
|
if (streamFormatter) {
|
|
11781
11827
|
streamFormatter.emitEvent({
|
|
11782
|
-
type:
|
|
11828
|
+
type: "message" /* MESSAGE */,
|
|
11783
11829
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11784
11830
|
role: "user",
|
|
11785
11831
|
content: input
|
|
@@ -11807,28 +11853,28 @@ async function runNonInteractive2(params) {
|
|
|
11807
11853
|
if (abortController.signal.aborted) {
|
|
11808
11854
|
handleCancellationError(config);
|
|
11809
11855
|
}
|
|
11810
|
-
if (event.type ===
|
|
11856
|
+
if (event.type === "content" /* Content */) {
|
|
11811
11857
|
const isRaw = config.getRawOutput() || config.getAcceptRawOutputRisk();
|
|
11812
11858
|
const output = isRaw ? event.value : stripAnsi(event.value);
|
|
11813
11859
|
if (streamFormatter) {
|
|
11814
11860
|
streamFormatter.emitEvent({
|
|
11815
|
-
type:
|
|
11861
|
+
type: "message" /* MESSAGE */,
|
|
11816
11862
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11817
11863
|
role: "assistant",
|
|
11818
11864
|
content: output,
|
|
11819
11865
|
delta: true
|
|
11820
11866
|
});
|
|
11821
|
-
} else if (config.getOutputFormat() ===
|
|
11867
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11822
11868
|
responseText += output;
|
|
11823
11869
|
} else {
|
|
11824
11870
|
if (event.value) {
|
|
11825
11871
|
textOutput.write(output);
|
|
11826
11872
|
}
|
|
11827
11873
|
}
|
|
11828
|
-
} else if (event.type ===
|
|
11874
|
+
} else if (event.type === "tool_call_request" /* ToolCallRequest */) {
|
|
11829
11875
|
if (streamFormatter) {
|
|
11830
11876
|
streamFormatter.emitEvent({
|
|
11831
|
-
type:
|
|
11877
|
+
type: "tool_use" /* TOOL_USE */,
|
|
11832
11878
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11833
11879
|
tool_name: event.value.name,
|
|
11834
11880
|
tool_id: event.value.callId,
|
|
@@ -11836,33 +11882,33 @@ async function runNonInteractive2(params) {
|
|
|
11836
11882
|
});
|
|
11837
11883
|
}
|
|
11838
11884
|
toolCallRequests.push(event.value);
|
|
11839
|
-
} else if (event.type ===
|
|
11885
|
+
} else if (event.type === "loop_detected" /* LoopDetected */) {
|
|
11840
11886
|
const message = "Loop detected, stopping execution";
|
|
11841
11887
|
if (streamFormatter) {
|
|
11842
11888
|
streamFormatter.emitEvent({
|
|
11843
|
-
type:
|
|
11889
|
+
type: "error" /* ERROR */,
|
|
11844
11890
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11845
11891
|
severity: "warning",
|
|
11846
11892
|
message
|
|
11847
11893
|
});
|
|
11848
11894
|
}
|
|
11849
11895
|
warnings.push(message);
|
|
11850
|
-
} else if (event.type ===
|
|
11896
|
+
} else if (event.type === "max_session_turns" /* MaxSessionTurns */) {
|
|
11851
11897
|
const message = "Maximum session turns exceeded";
|
|
11852
11898
|
if (streamFormatter) {
|
|
11853
11899
|
streamFormatter.emitEvent({
|
|
11854
|
-
type:
|
|
11900
|
+
type: "error" /* ERROR */,
|
|
11855
11901
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11856
11902
|
severity: "error",
|
|
11857
11903
|
message
|
|
11858
11904
|
});
|
|
11859
11905
|
}
|
|
11860
11906
|
warnings.push(message);
|
|
11861
|
-
} else if (event.type ===
|
|
11907
|
+
} else if (event.type === "error" /* Error */) {
|
|
11862
11908
|
throw event.value.error;
|
|
11863
|
-
} else if (event.type ===
|
|
11909
|
+
} else if (event.type === "agent_execution_stopped" /* AgentExecutionStopped */) {
|
|
11864
11910
|
const stopMessage = `Agent execution stopped: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11865
|
-
if (config.getOutputFormat() ===
|
|
11911
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11866
11912
|
process.stderr.write(`${stopMessage}
|
|
11867
11913
|
`);
|
|
11868
11914
|
}
|
|
@@ -11870,7 +11916,7 @@ async function runNonInteractive2(params) {
|
|
|
11870
11916
|
const metrics = uiTelemetryService.getMetrics();
|
|
11871
11917
|
const durationMs = Date.now() - startTime;
|
|
11872
11918
|
streamFormatter.emitEvent({
|
|
11873
|
-
type:
|
|
11919
|
+
type: "result" /* RESULT */,
|
|
11874
11920
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11875
11921
|
status: "success",
|
|
11876
11922
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -11878,7 +11924,7 @@ async function runNonInteractive2(params) {
|
|
|
11878
11924
|
durationMs
|
|
11879
11925
|
)
|
|
11880
11926
|
});
|
|
11881
|
-
} else if (config.getOutputFormat() ===
|
|
11927
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
11882
11928
|
const formatter = new JsonFormatter();
|
|
11883
11929
|
const stats = uiTelemetryService.getMetrics();
|
|
11884
11930
|
textOutput.write(
|
|
@@ -11894,21 +11940,21 @@ async function runNonInteractive2(params) {
|
|
|
11894
11940
|
textOutput.ensureTrailingNewline();
|
|
11895
11941
|
}
|
|
11896
11942
|
return;
|
|
11897
|
-
} else if (event.type ===
|
|
11943
|
+
} else if (event.type === "agent_execution_blocked" /* AgentExecutionBlocked */) {
|
|
11898
11944
|
const blockMessage = `Agent execution blocked: ${event.value.systemMessage?.trim() || event.value.reason}`;
|
|
11899
|
-
if (config.getOutputFormat() ===
|
|
11945
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11900
11946
|
process.stderr.write(`[WARNING] ${blockMessage}
|
|
11901
11947
|
`);
|
|
11902
11948
|
} else if (streamFormatter) {
|
|
11903
11949
|
streamFormatter.emitEvent({
|
|
11904
|
-
type:
|
|
11950
|
+
type: "error" /* ERROR */,
|
|
11905
11951
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11906
11952
|
severity: "warning",
|
|
11907
11953
|
message: stripAnsi(blockMessage)
|
|
11908
11954
|
});
|
|
11909
11955
|
}
|
|
11910
11956
|
warnings.push(blockMessage);
|
|
11911
|
-
} else if (event.type ===
|
|
11957
|
+
} else if (event.type === "invalid_stream" /* InvalidStream */) {
|
|
11912
11958
|
const eventValue = event.value;
|
|
11913
11959
|
if (eventValue?.type === "NO_RESPONSE_TEXT") {
|
|
11914
11960
|
invalidStreamError = TRUE_EMPTY_RESPONSE_MESSAGE;
|
|
@@ -11931,12 +11977,12 @@ async function runNonInteractive2(params) {
|
|
|
11931
11977
|
);
|
|
11932
11978
|
if (streamFormatter) {
|
|
11933
11979
|
streamFormatter.emitEvent({
|
|
11934
|
-
type:
|
|
11980
|
+
type: "error" /* ERROR */,
|
|
11935
11981
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11936
11982
|
severity: "error",
|
|
11937
11983
|
message: invalidStreamError
|
|
11938
11984
|
});
|
|
11939
|
-
} else if (config.getOutputFormat() ===
|
|
11985
|
+
} else if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11940
11986
|
process.stderr.write(`[ERROR] ${invalidStreamError}
|
|
11941
11987
|
`);
|
|
11942
11988
|
}
|
|
@@ -11956,7 +12002,7 @@ async function runNonInteractive2(params) {
|
|
|
11956
12002
|
const requestInfo = completedToolCall.request;
|
|
11957
12003
|
if (streamFormatter) {
|
|
11958
12004
|
streamFormatter.emitEvent({
|
|
11959
|
-
type:
|
|
12005
|
+
type: "tool_result" /* TOOL_RESULT */,
|
|
11960
12006
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11961
12007
|
tool_id: requestInfo.callId,
|
|
11962
12008
|
status: completedToolCall.status === "error" ? "error" : "success",
|
|
@@ -11990,11 +12036,11 @@ async function runNonInteractive2(params) {
|
|
|
11990
12036
|
);
|
|
11991
12037
|
}
|
|
11992
12038
|
const stopExecutionTool = completedToolCalls.find(
|
|
11993
|
-
(tc) => tc.response.errorType ===
|
|
12039
|
+
(tc) => tc.response.errorType === "stop_execution" /* STOP_EXECUTION */
|
|
11994
12040
|
);
|
|
11995
12041
|
if (stopExecutionTool && stopExecutionTool.response.error) {
|
|
11996
12042
|
const stopMessage = `Agent execution stopped: ${stopExecutionTool.response.error.message}`;
|
|
11997
|
-
if (config.getOutputFormat() ===
|
|
12043
|
+
if (config.getOutputFormat() === "text" /* TEXT */) {
|
|
11998
12044
|
process.stderr.write(`${stopMessage}
|
|
11999
12045
|
`);
|
|
12000
12046
|
}
|
|
@@ -12002,7 +12048,7 @@ async function runNonInteractive2(params) {
|
|
|
12002
12048
|
const metrics = uiTelemetryService.getMetrics();
|
|
12003
12049
|
const durationMs = Date.now() - startTime;
|
|
12004
12050
|
streamFormatter.emitEvent({
|
|
12005
|
-
type:
|
|
12051
|
+
type: "result" /* RESULT */,
|
|
12006
12052
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12007
12053
|
status: "success",
|
|
12008
12054
|
stats: streamFormatter.convertToStreamStats(
|
|
@@ -12010,7 +12056,7 @@ async function runNonInteractive2(params) {
|
|
|
12010
12056
|
durationMs
|
|
12011
12057
|
)
|
|
12012
12058
|
});
|
|
12013
|
-
} else if (config.getOutputFormat() ===
|
|
12059
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12014
12060
|
const formatter = new JsonFormatter();
|
|
12015
12061
|
const stats = uiTelemetryService.getMetrics();
|
|
12016
12062
|
textOutput.write(
|
|
@@ -12033,12 +12079,12 @@ async function runNonInteractive2(params) {
|
|
|
12033
12079
|
const metrics = uiTelemetryService.getMetrics();
|
|
12034
12080
|
const durationMs = Date.now() - startTime;
|
|
12035
12081
|
streamFormatter.emitEvent({
|
|
12036
|
-
type:
|
|
12082
|
+
type: "result" /* RESULT */,
|
|
12037
12083
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12038
12084
|
status: invalidStreamError ? "error" : "success",
|
|
12039
12085
|
stats: streamFormatter.convertToStreamStats(metrics, durationMs)
|
|
12040
12086
|
});
|
|
12041
|
-
} else if (config.getOutputFormat() ===
|
|
12087
|
+
} else if (config.getOutputFormat() === "json" /* JSON */) {
|
|
12042
12088
|
const formatter = new JsonFormatter();
|
|
12043
12089
|
const stats = uiTelemetryService.getMetrics();
|
|
12044
12090
|
textOutput.write(
|
|
@@ -12062,7 +12108,7 @@ async function runNonInteractive2(params) {
|
|
|
12062
12108
|
cleanupStdinCancellation();
|
|
12063
12109
|
scheduler?.dispose();
|
|
12064
12110
|
consolePatcher.cleanup();
|
|
12065
|
-
coreEvents.off(
|
|
12111
|
+
coreEvents.off("user-feedback" /* UserFeedback */, handleUserFeedback);
|
|
12066
12112
|
}
|
|
12067
12113
|
if (errorToHandle) {
|
|
12068
12114
|
handleError(errorToHandle, config);
|
|
@@ -13635,7 +13681,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
13635
13681
|
|
|
13636
13682
|
// packages/cli/src/acp/acpSession.ts
|
|
13637
13683
|
import * as fs12 from "node:fs/promises";
|
|
13638
|
-
import * as
|
|
13684
|
+
import * as path13 from "node:path";
|
|
13639
13685
|
import { randomUUID } from "node:crypto";
|
|
13640
13686
|
|
|
13641
13687
|
// packages/cli/src/acp/commands/commandRegistry.ts
|
|
@@ -14077,7 +14123,7 @@ var UpdateExtensionCommand = class {
|
|
|
14077
14123
|
|
|
14078
14124
|
// packages/cli/src/acp/commands/init.ts
|
|
14079
14125
|
import * as fs10 from "node:fs";
|
|
14080
|
-
import * as
|
|
14126
|
+
import * as path11 from "node:path";
|
|
14081
14127
|
var InitCommand = class {
|
|
14082
14128
|
name = "init";
|
|
14083
14129
|
description = "Analyzes the project and creates a tailored GEMINI.md file";
|
|
@@ -14087,7 +14133,7 @@ var InitCommand = class {
|
|
|
14087
14133
|
if (!targetDir) {
|
|
14088
14134
|
throw new Error("Command requires a workspace.");
|
|
14089
14135
|
}
|
|
14090
|
-
const geminiMdPath =
|
|
14136
|
+
const geminiMdPath = path11.join(targetDir, "GEMINI.md");
|
|
14091
14137
|
const result = performInit(fs10.existsSync(geminiMdPath));
|
|
14092
14138
|
switch (result.type) {
|
|
14093
14139
|
case "message":
|
|
@@ -14120,7 +14166,7 @@ ${result.content}`
|
|
|
14120
14166
|
|
|
14121
14167
|
// packages/cli/src/acp/commands/restore.ts
|
|
14122
14168
|
import * as fs11 from "node:fs/promises";
|
|
14123
|
-
import * as
|
|
14169
|
+
import * as path12 from "node:path";
|
|
14124
14170
|
var RestoreCommand = class {
|
|
14125
14171
|
name = "restore";
|
|
14126
14172
|
description = "Restore to a previous checkpoint, or list available checkpoints to restore. This will reset the conversation and file history to the state it was in when the checkpoint was created";
|
|
@@ -14142,7 +14188,7 @@ var RestoreCommand = class {
|
|
|
14142
14188
|
}
|
|
14143
14189
|
const selectedFile = argsStr.endsWith(".json") ? argsStr : `${argsStr}.json`;
|
|
14144
14190
|
const checkpointDir = config.storage.getProjectTempCheckpointsDir();
|
|
14145
|
-
const filePath =
|
|
14191
|
+
const filePath = path12.join(checkpointDir, selectedFile);
|
|
14146
14192
|
let data;
|
|
14147
14193
|
try {
|
|
14148
14194
|
data = await fs11.readFile(filePath, "utf-8");
|
|
@@ -14216,7 +14262,7 @@ var ListCheckpointsCommand = class {
|
|
|
14216
14262
|
}
|
|
14217
14263
|
const checkpointFiles = /* @__PURE__ */ new Map();
|
|
14218
14264
|
for (const file of jsonFiles) {
|
|
14219
|
-
const filePath =
|
|
14265
|
+
const filePath = path12.join(checkpointDir, file);
|
|
14220
14266
|
const data = await fs11.readFile(filePath, "utf-8");
|
|
14221
14267
|
checkpointFiles.set(file, data);
|
|
14222
14268
|
}
|
|
@@ -14453,12 +14499,12 @@ function toToolCallContent(toolResult) {
|
|
|
14453
14499
|
}
|
|
14454
14500
|
var basicPermissionOptions = [
|
|
14455
14501
|
{
|
|
14456
|
-
optionId:
|
|
14502
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
14457
14503
|
name: "Allow",
|
|
14458
14504
|
kind: "allow_once"
|
|
14459
14505
|
},
|
|
14460
14506
|
{
|
|
14461
|
-
optionId:
|
|
14507
|
+
optionId: "cancel" /* Cancel */,
|
|
14462
14508
|
name: "Reject",
|
|
14463
14509
|
kind: "reject_once"
|
|
14464
14510
|
}
|
|
@@ -14470,13 +14516,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14470
14516
|
switch (confirmation.type) {
|
|
14471
14517
|
case "edit":
|
|
14472
14518
|
options.push({
|
|
14473
|
-
optionId:
|
|
14519
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14474
14520
|
name: "Allow for this session",
|
|
14475
14521
|
kind: "allow_always"
|
|
14476
14522
|
});
|
|
14477
14523
|
if (enablePermanentToolApproval) {
|
|
14478
14524
|
options.push({
|
|
14479
|
-
optionId:
|
|
14525
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14480
14526
|
name: "Allow for this file in all future sessions",
|
|
14481
14527
|
kind: "allow_always"
|
|
14482
14528
|
});
|
|
@@ -14484,13 +14530,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14484
14530
|
break;
|
|
14485
14531
|
case "exec":
|
|
14486
14532
|
options.push({
|
|
14487
|
-
optionId:
|
|
14533
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14488
14534
|
name: "Allow for this session",
|
|
14489
14535
|
kind: "allow_always"
|
|
14490
14536
|
});
|
|
14491
14537
|
if (enablePermanentToolApproval) {
|
|
14492
14538
|
options.push({
|
|
14493
|
-
optionId:
|
|
14539
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14494
14540
|
name: "Allow this command for all future sessions",
|
|
14495
14541
|
kind: "allow_always"
|
|
14496
14542
|
});
|
|
@@ -14499,19 +14545,19 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14499
14545
|
case "mcp":
|
|
14500
14546
|
options.push(
|
|
14501
14547
|
{
|
|
14502
|
-
optionId:
|
|
14548
|
+
optionId: "proceed_always_server" /* ProceedAlwaysServer */,
|
|
14503
14549
|
name: "Allow all server tools for this session",
|
|
14504
14550
|
kind: "allow_always"
|
|
14505
14551
|
},
|
|
14506
14552
|
{
|
|
14507
|
-
optionId:
|
|
14553
|
+
optionId: "proceed_always_tool" /* ProceedAlwaysTool */,
|
|
14508
14554
|
name: "Allow tool for this session",
|
|
14509
14555
|
kind: "allow_always"
|
|
14510
14556
|
}
|
|
14511
14557
|
);
|
|
14512
14558
|
if (enablePermanentToolApproval) {
|
|
14513
14559
|
options.push({
|
|
14514
|
-
optionId:
|
|
14560
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14515
14561
|
name: "Allow tool for all future sessions",
|
|
14516
14562
|
kind: "allow_always"
|
|
14517
14563
|
});
|
|
@@ -14519,13 +14565,13 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14519
14565
|
break;
|
|
14520
14566
|
case "info":
|
|
14521
14567
|
options.push({
|
|
14522
|
-
optionId:
|
|
14568
|
+
optionId: "proceed_always" /* ProceedAlways */,
|
|
14523
14569
|
name: "Allow for this session",
|
|
14524
14570
|
kind: "allow_always"
|
|
14525
14571
|
});
|
|
14526
14572
|
if (enablePermanentToolApproval) {
|
|
14527
14573
|
options.push({
|
|
14528
|
-
optionId:
|
|
14574
|
+
optionId: "proceed_always_and_save" /* ProceedAlwaysAndSave */,
|
|
14529
14575
|
name: "Allow for all future sessions",
|
|
14530
14576
|
kind: "allow_always"
|
|
14531
14577
|
});
|
|
@@ -14557,21 +14603,21 @@ function toPermissionOptions(confirmation, config, enablePermanentToolApproval =
|
|
|
14557
14603
|
}
|
|
14558
14604
|
function toAcpToolKind(kind) {
|
|
14559
14605
|
switch (kind) {
|
|
14560
|
-
case
|
|
14561
|
-
case
|
|
14562
|
-
case
|
|
14563
|
-
case
|
|
14564
|
-
case
|
|
14565
|
-
case
|
|
14566
|
-
case
|
|
14567
|
-
case
|
|
14568
|
-
case
|
|
14569
|
-
case
|
|
14606
|
+
case "read" /* Read */:
|
|
14607
|
+
case "edit" /* Edit */:
|
|
14608
|
+
case "execute" /* Execute */:
|
|
14609
|
+
case "search" /* Search */:
|
|
14610
|
+
case "delete" /* Delete */:
|
|
14611
|
+
case "move" /* Move */:
|
|
14612
|
+
case "think" /* Think */:
|
|
14613
|
+
case "fetch" /* Fetch */:
|
|
14614
|
+
case "switch_mode" /* SwitchMode */:
|
|
14615
|
+
case "other" /* Other */:
|
|
14570
14616
|
return kind;
|
|
14571
|
-
case
|
|
14617
|
+
case "agent" /* Agent */:
|
|
14572
14618
|
return "think";
|
|
14573
|
-
case
|
|
14574
|
-
case
|
|
14619
|
+
case "plan" /* Plan */:
|
|
14620
|
+
case "communicate" /* Communicate */:
|
|
14575
14621
|
default:
|
|
14576
14622
|
return "other";
|
|
14577
14623
|
}
|
|
@@ -14579,24 +14625,24 @@ function toAcpToolKind(kind) {
|
|
|
14579
14625
|
function buildAvailableModes(isPlanEnabled) {
|
|
14580
14626
|
const modes = [
|
|
14581
14627
|
{
|
|
14582
|
-
id:
|
|
14628
|
+
id: "default" /* DEFAULT */,
|
|
14583
14629
|
name: "Default",
|
|
14584
14630
|
description: "Prompts for approval"
|
|
14585
14631
|
},
|
|
14586
14632
|
{
|
|
14587
|
-
id:
|
|
14633
|
+
id: "autoEdit" /* AUTO_EDIT */,
|
|
14588
14634
|
name: "Auto Edit",
|
|
14589
14635
|
description: "Auto-approves edit tools"
|
|
14590
14636
|
},
|
|
14591
14637
|
{
|
|
14592
|
-
id:
|
|
14638
|
+
id: "yolo" /* YOLO */,
|
|
14593
14639
|
name: "YOLO",
|
|
14594
14640
|
description: "Auto-approves all tools"
|
|
14595
14641
|
}
|
|
14596
14642
|
];
|
|
14597
14643
|
if (isPlanEnabled) {
|
|
14598
14644
|
modes.push({
|
|
14599
|
-
id:
|
|
14645
|
+
id: "plan" /* PLAN */,
|
|
14600
14646
|
name: "Plan",
|
|
14601
14647
|
description: "Read-only mode"
|
|
14602
14648
|
});
|
|
@@ -14609,7 +14655,7 @@ function buildAvailableModels(config, settings) {
|
|
|
14609
14655
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
14610
14656
|
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
14611
14657
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
14612
|
-
const useCustomToolModel = useGemini31 && selectedAuthType ===
|
|
14658
|
+
const useCustomToolModel = useGemini31 && selectedAuthType === "gemini-api-key" /* USE_GEMINI */;
|
|
14613
14659
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
14614
14660
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
14615
14661
|
useGemini3_1: useGemini31,
|
|
@@ -14695,11 +14741,11 @@ var Session = class {
|
|
|
14695
14741
|
this.connection = connection;
|
|
14696
14742
|
this.settings = settings;
|
|
14697
14743
|
coreEvents.on(
|
|
14698
|
-
|
|
14744
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
14699
14745
|
this.handleApprovalModeChanged
|
|
14700
14746
|
);
|
|
14701
14747
|
this.context.config.getMessageBus()?.subscribe(
|
|
14702
|
-
|
|
14748
|
+
"tool-confirmation-request" /* TOOL_CONFIRMATION_REQUEST */,
|
|
14703
14749
|
this.handleToolConfirmationRequest,
|
|
14704
14750
|
{ signal: this.disposeController.signal }
|
|
14705
14751
|
);
|
|
@@ -14723,7 +14769,7 @@ var Session = class {
|
|
|
14723
14769
|
"Policy engine missing. Denying tool confirmation request."
|
|
14724
14770
|
);
|
|
14725
14771
|
await messageBus.publish({
|
|
14726
|
-
type:
|
|
14772
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14727
14773
|
correlationId: request.correlationId,
|
|
14728
14774
|
confirmed: false,
|
|
14729
14775
|
requiresUserConfirmation: false
|
|
@@ -14736,7 +14782,7 @@ var Session = class {
|
|
|
14736
14782
|
"Tool confirmation request missing tool name. Denying."
|
|
14737
14783
|
);
|
|
14738
14784
|
await messageBus.publish({
|
|
14739
|
-
type:
|
|
14785
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14740
14786
|
correlationId: request.correlationId,
|
|
14741
14787
|
confirmed: false,
|
|
14742
14788
|
requiresUserConfirmation: false
|
|
@@ -14749,7 +14795,7 @@ var Session = class {
|
|
|
14749
14795
|
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
14750
14796
|
);
|
|
14751
14797
|
await messageBus.publish({
|
|
14752
|
-
type:
|
|
14798
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14753
14799
|
correlationId: request.correlationId,
|
|
14754
14800
|
confirmed: false,
|
|
14755
14801
|
requiresUserConfirmation: false
|
|
@@ -14765,15 +14811,15 @@ var Session = class {
|
|
|
14765
14811
|
request.subagent
|
|
14766
14812
|
);
|
|
14767
14813
|
await messageBus.publish({
|
|
14768
|
-
type:
|
|
14814
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14769
14815
|
correlationId: request.correlationId,
|
|
14770
|
-
confirmed: result.decision ===
|
|
14771
|
-
requiresUserConfirmation: result.decision ===
|
|
14816
|
+
confirmed: result.decision === "allow" /* ALLOW */,
|
|
14817
|
+
requiresUserConfirmation: result.decision === "ask_user" /* ASK_USER */
|
|
14772
14818
|
});
|
|
14773
14819
|
} catch (error) {
|
|
14774
14820
|
debugLogger.error("Error handling tool confirmation request:", error);
|
|
14775
14821
|
await this.context.config.getMessageBus()?.publish({
|
|
14776
|
-
type:
|
|
14822
|
+
type: "tool-confirmation-response" /* TOOL_CONFIRMATION_RESPONSE */,
|
|
14777
14823
|
correlationId: request.correlationId,
|
|
14778
14824
|
confirmed: false,
|
|
14779
14825
|
requiresUserConfirmation: false
|
|
@@ -14793,7 +14839,7 @@ var Session = class {
|
|
|
14793
14839
|
};
|
|
14794
14840
|
dispose() {
|
|
14795
14841
|
coreEvents.off(
|
|
14796
|
-
|
|
14842
|
+
"approval-mode-changed" /* ApprovalModeChanged */,
|
|
14797
14843
|
this.handleApprovalModeChanged
|
|
14798
14844
|
);
|
|
14799
14845
|
this.disposeController.abort();
|
|
@@ -14882,7 +14928,7 @@ ${thought.description}`;
|
|
|
14882
14928
|
await this.sendUpdate({
|
|
14883
14929
|
sessionUpdate: "tool_call",
|
|
14884
14930
|
toolCallId: toolCall.id,
|
|
14885
|
-
status: toolCall.status ===
|
|
14931
|
+
status: toolCall.status === "success" /* Success */ ? "completed" : "failed",
|
|
14886
14932
|
title: toolCall.displayName || toolCall.name,
|
|
14887
14933
|
content: toolCallContent,
|
|
14888
14934
|
kind: tool ? toAcpToolKind(tool.kind) : "other"
|
|
@@ -14974,7 +15020,7 @@ ${thought.description}`;
|
|
|
14974
15020
|
return { stopReason: "cancelled" };
|
|
14975
15021
|
}
|
|
14976
15022
|
switch (event.type) {
|
|
14977
|
-
case
|
|
15023
|
+
case "content" /* Content */: {
|
|
14978
15024
|
const content = {
|
|
14979
15025
|
type: "text",
|
|
14980
15026
|
text: event.value
|
|
@@ -14985,7 +15031,7 @@ ${thought.description}`;
|
|
|
14985
15031
|
});
|
|
14986
15032
|
break;
|
|
14987
15033
|
}
|
|
14988
|
-
case
|
|
15034
|
+
case "thought" /* Thought */: {
|
|
14989
15035
|
const thoughtText = `**${event.value.subject}**
|
|
14990
15036
|
${event.value.description}`;
|
|
14991
15037
|
await this.sendUpdate({
|
|
@@ -14994,10 +15040,10 @@ ${event.value.description}`;
|
|
|
14994
15040
|
});
|
|
14995
15041
|
break;
|
|
14996
15042
|
}
|
|
14997
|
-
case
|
|
15043
|
+
case "tool_call_request" /* ToolCallRequest */:
|
|
14998
15044
|
toolCallRequests.push(event.value);
|
|
14999
15045
|
break;
|
|
15000
|
-
case
|
|
15046
|
+
case "finished" /* Finished */: {
|
|
15001
15047
|
const usage2 = event.value.usageMetadata;
|
|
15002
15048
|
if (usage2) {
|
|
15003
15049
|
turnInputTokens = usage2.promptTokenCount ?? turnInputTokens;
|
|
@@ -15005,19 +15051,19 @@ ${event.value.description}`;
|
|
|
15005
15051
|
}
|
|
15006
15052
|
break;
|
|
15007
15053
|
}
|
|
15008
|
-
case
|
|
15054
|
+
case "model_info" /* ModelInfo */:
|
|
15009
15055
|
turnModelId = event.value;
|
|
15010
15056
|
break;
|
|
15011
|
-
case
|
|
15057
|
+
case "max_session_turns" /* MaxSessionTurns */:
|
|
15012
15058
|
stopReason = "max_turn_requests";
|
|
15013
15059
|
break;
|
|
15014
|
-
case
|
|
15060
|
+
case "loop_detected" /* LoopDetected */:
|
|
15015
15061
|
stopReason = "max_turn_requests";
|
|
15016
15062
|
break;
|
|
15017
|
-
case
|
|
15063
|
+
case "context_window_will_overflow" /* ContextWindowWillOverflow */:
|
|
15018
15064
|
stopReason = "max_tokens";
|
|
15019
15065
|
break;
|
|
15020
|
-
case
|
|
15066
|
+
case "error" /* Error */: {
|
|
15021
15067
|
const parseResult = StructuredErrorSchema.safeParse(
|
|
15022
15068
|
event.value.error
|
|
15023
15069
|
);
|
|
@@ -15245,7 +15291,7 @@ ${event.value.description}`;
|
|
|
15245
15291
|
const output = RequestPermissionResponseSchema.parse(
|
|
15246
15292
|
await this.connection.requestPermission(params)
|
|
15247
15293
|
);
|
|
15248
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15294
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15249
15295
|
await confirmationDetails.onConfirm(outcome);
|
|
15250
15296
|
await updatePolicy(
|
|
15251
15297
|
tool,
|
|
@@ -15256,16 +15302,16 @@ ${event.value.description}`;
|
|
|
15256
15302
|
invocation
|
|
15257
15303
|
);
|
|
15258
15304
|
switch (outcome) {
|
|
15259
|
-
case
|
|
15305
|
+
case "cancel" /* Cancel */:
|
|
15260
15306
|
return errorResponse(
|
|
15261
15307
|
new Error(`Tool "${fc.name}" was canceled by the user.`)
|
|
15262
15308
|
);
|
|
15263
|
-
case
|
|
15264
|
-
case
|
|
15265
|
-
case
|
|
15266
|
-
case
|
|
15267
|
-
case
|
|
15268
|
-
case
|
|
15309
|
+
case "proceed_once" /* ProceedOnce */:
|
|
15310
|
+
case "proceed_always" /* ProceedAlways */:
|
|
15311
|
+
case "proceed_always_and_save" /* ProceedAlwaysAndSave */:
|
|
15312
|
+
case "proceed_always_server" /* ProceedAlwaysServer */:
|
|
15313
|
+
case "proceed_always_tool" /* ProceedAlwaysTool */:
|
|
15314
|
+
case "modify_with_editor" /* ModifyWithEditor */:
|
|
15269
15315
|
break;
|
|
15270
15316
|
default: {
|
|
15271
15317
|
const resultOutcome = outcome;
|
|
@@ -15319,7 +15365,7 @@ ${event.value.description}`;
|
|
|
15319
15365
|
);
|
|
15320
15366
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15321
15367
|
{
|
|
15322
|
-
status:
|
|
15368
|
+
status: "success" /* Success */,
|
|
15323
15369
|
request: {
|
|
15324
15370
|
callId,
|
|
15325
15371
|
name: fc.name,
|
|
@@ -15364,7 +15410,7 @@ ${event.value.description}`;
|
|
|
15364
15410
|
});
|
|
15365
15411
|
this.chat.recordCompletedToolCalls(this.context.config.getActiveModel(), [
|
|
15366
15412
|
{
|
|
15367
|
-
status:
|
|
15413
|
+
status: "error" /* Error */,
|
|
15368
15414
|
request: {
|
|
15369
15415
|
callId,
|
|
15370
15416
|
name: fc.name,
|
|
@@ -15478,7 +15524,7 @@ ${event.value.description}`;
|
|
|
15478
15524
|
} else if (result.status === "invalid") {
|
|
15479
15525
|
continue;
|
|
15480
15526
|
} else {
|
|
15481
|
-
absolutePath =
|
|
15527
|
+
absolutePath = path13.resolve(
|
|
15482
15528
|
this.context.config.getTargetDir(),
|
|
15483
15529
|
pathName
|
|
15484
15530
|
);
|
|
@@ -15492,12 +15538,12 @@ ${event.value.description}`;
|
|
|
15492
15538
|
sessionId: this.id,
|
|
15493
15539
|
options: [
|
|
15494
15540
|
{
|
|
15495
|
-
optionId:
|
|
15541
|
+
optionId: "proceed_once" /* ProceedOnce */,
|
|
15496
15542
|
name: "Allow once",
|
|
15497
15543
|
kind: "allow_once"
|
|
15498
15544
|
},
|
|
15499
15545
|
{
|
|
15500
|
-
optionId:
|
|
15546
|
+
optionId: "cancel" /* Cancel */,
|
|
15501
15547
|
name: "Deny",
|
|
15502
15548
|
kind: "reject_once"
|
|
15503
15549
|
}
|
|
@@ -15522,8 +15568,8 @@ ${event.value.description}`;
|
|
|
15522
15568
|
const output = RequestPermissionResponseSchema.parse(
|
|
15523
15569
|
await this.connection.requestPermission(params)
|
|
15524
15570
|
);
|
|
15525
|
-
const outcome = output.outcome.outcome === "cancelled" ?
|
|
15526
|
-
if (outcome ===
|
|
15571
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
15572
|
+
if (outcome === "proceed_once" /* ProceedOnce */) {
|
|
15527
15573
|
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
15528
15574
|
validationError = null;
|
|
15529
15575
|
} else {
|
|
@@ -15552,7 +15598,7 @@ ${event.value.description}`;
|
|
|
15552
15598
|
}
|
|
15553
15599
|
try {
|
|
15554
15600
|
if (!validationError) {
|
|
15555
|
-
if ((
|
|
15601
|
+
if ((path13.isAbsolute(pathName) || !isWithinRoot(
|
|
15556
15602
|
absolutePath,
|
|
15557
15603
|
this.context.config.getTargetDir()
|
|
15558
15604
|
)) && !readDirectly) {
|
|
@@ -15656,7 +15702,7 @@ ${contentToPush}`;
|
|
|
15656
15702
|
const lines = globResult.llmContent.split("\n");
|
|
15657
15703
|
if (lines.length > 1 && lines[1]) {
|
|
15658
15704
|
const firstMatchAbsolute = lines[1].trim();
|
|
15659
|
-
currentPathSpec =
|
|
15705
|
+
currentPathSpec = path13.relative(
|
|
15660
15706
|
this.context.config.getTargetDir(),
|
|
15661
15707
|
firstMatchAbsolute
|
|
15662
15708
|
);
|
|
@@ -15874,7 +15920,7 @@ Content from @${contextPart.uri}:
|
|
|
15874
15920
|
|
|
15875
15921
|
// packages/cli/src/acp/acpFileSystemService.ts
|
|
15876
15922
|
import os5 from "node:os";
|
|
15877
|
-
import
|
|
15923
|
+
import path14 from "node:path";
|
|
15878
15924
|
var AcpFileSystemService = class {
|
|
15879
15925
|
constructor(connection, sessionId, capabilities, fallback, root) {
|
|
15880
15926
|
this.connection = connection;
|
|
@@ -15883,7 +15929,7 @@ var AcpFileSystemService = class {
|
|
|
15883
15929
|
this.fallback = fallback;
|
|
15884
15930
|
this.root = root;
|
|
15885
15931
|
}
|
|
15886
|
-
geminiDir =
|
|
15932
|
+
geminiDir = path14.join(os5.homedir(), ".gemini");
|
|
15887
15933
|
shouldUseFallback(filePath) {
|
|
15888
15934
|
return !isWithinRoot(filePath, this.root) || isWithinRoot(filePath, this.geminiDir);
|
|
15889
15935
|
}
|
|
@@ -15960,7 +16006,7 @@ var AcpSessionManager = class {
|
|
|
15960
16006
|
mcpServers,
|
|
15961
16007
|
loadedSettings
|
|
15962
16008
|
);
|
|
15963
|
-
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16009
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : "gemini-api-key" /* USE_GEMINI */);
|
|
15964
16010
|
let isAuthenticated = false;
|
|
15965
16011
|
let authErrorMessage = "";
|
|
15966
16012
|
try {
|
|
@@ -15972,7 +16018,7 @@ var AcpSessionManager = class {
|
|
|
15972
16018
|
);
|
|
15973
16019
|
isAuthenticated = true;
|
|
15974
16020
|
const contentGeneratorConfig = config.getContentGeneratorConfig();
|
|
15975
|
-
if (authType ===
|
|
16021
|
+
if (authType === "gemini-api-key" /* USE_GEMINI */ && (!contentGeneratorConfig || !contentGeneratorConfig.apiKey)) {
|
|
15976
16022
|
isAuthenticated = false;
|
|
15977
16023
|
authErrorMessage = "Gemini API key is missing or not configured.";
|
|
15978
16024
|
}
|
|
@@ -16081,7 +16127,7 @@ var AcpSessionManager = class {
|
|
|
16081
16127
|
return response;
|
|
16082
16128
|
}
|
|
16083
16129
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
16084
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ?
|
|
16130
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? "gateway" /* GATEWAY */ : void 0);
|
|
16085
16131
|
if (!selectedAuthType) {
|
|
16086
16132
|
throw RequestError.authRequired();
|
|
16087
16133
|
}
|
|
@@ -16182,12 +16228,12 @@ var GeminiAgent = class {
|
|
|
16182
16228
|
}
|
|
16183
16229
|
const authMethods = [
|
|
16184
16230
|
{
|
|
16185
|
-
id:
|
|
16231
|
+
id: "oauth-personal" /* LOGIN_WITH_GOOGLE */,
|
|
16186
16232
|
name: "Log in with Google",
|
|
16187
16233
|
description: "Log in with your Google account"
|
|
16188
16234
|
},
|
|
16189
16235
|
{
|
|
16190
|
-
id:
|
|
16236
|
+
id: "gemini-api-key" /* USE_GEMINI */,
|
|
16191
16237
|
name: "Gemini API key",
|
|
16192
16238
|
description: "Use an API key with Gemini Developer API",
|
|
16193
16239
|
_meta: {
|
|
@@ -16197,12 +16243,12 @@ var GeminiAgent = class {
|
|
|
16197
16243
|
}
|
|
16198
16244
|
},
|
|
16199
16245
|
{
|
|
16200
|
-
id:
|
|
16246
|
+
id: "vertex-ai" /* USE_VERTEX_AI */,
|
|
16201
16247
|
name: "Vertex AI",
|
|
16202
16248
|
description: "Use an API key with Vertex AI GenAI API"
|
|
16203
16249
|
},
|
|
16204
16250
|
{
|
|
16205
|
-
id:
|
|
16251
|
+
id: "gateway" /* GATEWAY */,
|
|
16206
16252
|
name: "AI API Gateway",
|
|
16207
16253
|
description: "Use a custom AI API Gateway",
|
|
16208
16254
|
_meta: {
|
|
@@ -16375,7 +16421,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
16375
16421
|
}
|
|
16376
16422
|
return authType;
|
|
16377
16423
|
} catch (error) {
|
|
16378
|
-
if (nonInteractiveConfig.getOutputFormat() ===
|
|
16424
|
+
if (nonInteractiveConfig.getOutputFormat() === "json" /* JSON */) {
|
|
16379
16425
|
handleError(
|
|
16380
16426
|
error instanceof Error ? error : new Error(String(error)),
|
|
16381
16427
|
nonInteractiveConfig,
|
|
@@ -16519,7 +16565,7 @@ async function setupTerminalAndTheme(config, settings) {
|
|
|
16519
16565
|
|
|
16520
16566
|
// packages/cli/src/utils/logCleanup.ts
|
|
16521
16567
|
import { promises as fs13 } from "node:fs";
|
|
16522
|
-
import * as
|
|
16568
|
+
import * as path15 from "node:path";
|
|
16523
16569
|
var RETENTION_PERIOD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
16524
16570
|
async function cleanupBackgroundLogs(debugMode = false) {
|
|
16525
16571
|
try {
|
|
@@ -16534,7 +16580,7 @@ async function cleanupBackgroundLogs(debugMode = false) {
|
|
|
16534
16580
|
let deletedCount = 0;
|
|
16535
16581
|
for (const entry of entries) {
|
|
16536
16582
|
if (entry.isFile() && entry.name.endsWith(".log")) {
|
|
16537
|
-
const filePath =
|
|
16583
|
+
const filePath = path15.join(logDir, entry.name);
|
|
16538
16584
|
try {
|
|
16539
16585
|
const stats = await fs13.stat(filePath);
|
|
16540
16586
|
if (now - stats.mtime.getTime() > RETENTION_PERIOD_MS) {
|
|
@@ -16570,10 +16616,10 @@ var SlashCommandConflictHandler = class {
|
|
|
16570
16616
|
this.handleConflicts = this.handleConflicts.bind(this);
|
|
16571
16617
|
}
|
|
16572
16618
|
start() {
|
|
16573
|
-
coreEvents.on(
|
|
16619
|
+
coreEvents.on("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
16574
16620
|
}
|
|
16575
16621
|
stop() {
|
|
16576
|
-
coreEvents.off(
|
|
16622
|
+
coreEvents.off("slash-command-conflicts" /* SlashCommandConflicts */, this.handleConflicts);
|
|
16577
16623
|
if (this.flushTimeout) {
|
|
16578
16624
|
clearTimeout(this.flushTimeout);
|
|
16579
16625
|
this.flushTimeout = null;
|
|
@@ -16785,8 +16831,8 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16785
16831
|
sessionData.projectHash = getProjectHash(storage.getProjectRoot());
|
|
16786
16832
|
sessionData.startTime = isoNow;
|
|
16787
16833
|
sessionData.lastUpdated = isoNow;
|
|
16788
|
-
const chatsDir =
|
|
16789
|
-
const newSessionPath =
|
|
16834
|
+
const chatsDir = path16.join(storage.getProjectTempDir(), "chats");
|
|
16835
|
+
const newSessionPath = path16.join(
|
|
16790
16836
|
chatsDir,
|
|
16791
16837
|
`session-${now}-${newSessionId.slice(0, 8)}.jsonl`
|
|
16792
16838
|
);
|
|
@@ -16854,7 +16900,7 @@ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
|
16854
16900
|
}
|
|
16855
16901
|
}
|
|
16856
16902
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
16857
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
16903
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-X63QLGIH.js");
|
|
16858
16904
|
await doStartUI(
|
|
16859
16905
|
config,
|
|
16860
16906
|
settings,
|
|
@@ -16957,12 +17003,12 @@ async function main() {
|
|
|
16957
17003
|
dns.setDefaultResultOrder(
|
|
16958
17004
|
validateDnsResolutionOrder(settings.merged.advanced.dnsResolutionOrder)
|
|
16959
17005
|
);
|
|
16960
|
-
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType ===
|
|
17006
|
+
if (!settings.merged.security.auth.selectedType || settings.merged.security.auth.selectedType === "cloud-shell" /* LEGACY_CLOUD_SHELL */) {
|
|
16961
17007
|
if (process.env["CLOUD_SHELL"] === "true" || process.env["GEMINI_CLI_USE_COMPUTE_ADC"] === "true") {
|
|
16962
17008
|
settings.setValue(
|
|
16963
17009
|
"User" /* User */,
|
|
16964
17010
|
"security.auth.selectedType",
|
|
16965
|
-
|
|
17011
|
+
"compute-default-credentials" /* COMPUTE_ADC */
|
|
16966
17012
|
);
|
|
16967
17013
|
}
|
|
16968
17014
|
}
|
|
@@ -17063,7 +17109,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17063
17109
|
await config.storage.initialize();
|
|
17064
17110
|
adminControlsListner.setConfig(config);
|
|
17065
17111
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
17066
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
17112
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-YPPCMYGQ.js");
|
|
17067
17113
|
setupInitialActivityLogger(config);
|
|
17068
17114
|
}
|
|
17069
17115
|
registerTelemetryConfig(config);
|
|
@@ -17071,7 +17117,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17071
17117
|
const messageBus = config.getMessageBus();
|
|
17072
17118
|
createPolicyUpdater2(policyEngine, messageBus, config.storage);
|
|
17073
17119
|
registerCleanup(async () => {
|
|
17074
|
-
await config?.getHookSystem()?.fireSessionEndEvent(
|
|
17120
|
+
await config?.getHookSystem()?.fireSessionEndEvent("exit" /* Exit */);
|
|
17075
17121
|
});
|
|
17076
17122
|
if (!config.getAcpMode()) {
|
|
17077
17123
|
registerCleanup(consolePatcher.cleanup);
|
|
@@ -17122,7 +17168,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17122
17168
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
17123
17169
|
const initializationResult = await initializeApp(config, settings);
|
|
17124
17170
|
initAppHandle?.end();
|
|
17125
|
-
import("./liteRtServerManager-
|
|
17171
|
+
import("./liteRtServerManager-7W4APCRB.js").then(({ LiteRtServerManager }) => {
|
|
17126
17172
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
17127
17173
|
if (!mergedGemma) return;
|
|
17128
17174
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|
|
@@ -17132,7 +17178,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17132
17178
|
autoStartServer: userGemma?.autoStartServer
|
|
17133
17179
|
});
|
|
17134
17180
|
}).catch((e) => debugLogger.warn("LiteRT auto-start import failed:", e));
|
|
17135
|
-
if (settings.merged.security.auth.selectedType ===
|
|
17181
|
+
if (settings.merged.security.auth.selectedType === "oauth-personal" /* LOGIN_WITH_GOOGLE */ && config.isBrowserLaunchSuppressed()) {
|
|
17136
17182
|
await getOauthClient(settings.merged.security.auth.selectedType, config);
|
|
17137
17183
|
}
|
|
17138
17184
|
if (config.getAcpMode()) {
|
|
@@ -17148,7 +17194,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17148
17194
|
...rawStartupWarnings.map((message) => ({
|
|
17149
17195
|
id: `startup-${createHash2("sha256").update(message).digest("hex").substring(0, 16)}`,
|
|
17150
17196
|
message,
|
|
17151
|
-
priority:
|
|
17197
|
+
priority: "high" /* High */
|
|
17152
17198
|
})),
|
|
17153
17199
|
...await getUserStartupWarnings(settings.merged, void 0, {
|
|
17154
17200
|
isAlternateBuffer: useAlternateBuffer
|
|
@@ -17185,7 +17231,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
17185
17231
|
${input}` : stdinData;
|
|
17186
17232
|
}
|
|
17187
17233
|
}
|
|
17188
|
-
const sessionStartSource = resumedSessionData ?
|
|
17234
|
+
const sessionStartSource = resumedSessionData ? "resume" /* Resume */ : "startup" /* Startup */;
|
|
17189
17235
|
const hookSystem = config?.getHookSystem();
|
|
17190
17236
|
if (hookSystem) {
|
|
17191
17237
|
const result = await hookSystem.fireSessionStartEvent(sessionStartSource);
|
|
@@ -17242,8 +17288,8 @@ ${input}` : wrappedContext;
|
|
|
17242
17288
|
}
|
|
17243
17289
|
}
|
|
17244
17290
|
function initializeOutputListenersAndFlush(config) {
|
|
17245
|
-
if (coreEvents.listenerCount(
|
|
17246
|
-
coreEvents.on(
|
|
17291
|
+
if (coreEvents.listenerCount("output" /* Output */) === 0) {
|
|
17292
|
+
coreEvents.on("output" /* Output */, (payload) => {
|
|
17247
17293
|
if (payload.isStderr) {
|
|
17248
17294
|
writeToStderr(payload.chunk, payload.encoding);
|
|
17249
17295
|
} else {
|
|
@@ -17251,8 +17297,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17251
17297
|
}
|
|
17252
17298
|
});
|
|
17253
17299
|
}
|
|
17254
|
-
if (coreEvents.listenerCount(
|
|
17255
|
-
coreEvents.on(
|
|
17300
|
+
if (coreEvents.listenerCount("console-log" /* ConsoleLog */) === 0) {
|
|
17301
|
+
coreEvents.on("console-log" /* ConsoleLog */, (payload) => {
|
|
17256
17302
|
if (payload.type === "error" || payload.type === "warn") {
|
|
17257
17303
|
writeToStderr(payload.content + "\n");
|
|
17258
17304
|
} else {
|
|
@@ -17260,8 +17306,8 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17260
17306
|
}
|
|
17261
17307
|
});
|
|
17262
17308
|
}
|
|
17263
|
-
if (coreEvents.listenerCount(
|
|
17264
|
-
coreEvents.on(
|
|
17309
|
+
if (coreEvents.listenerCount("user-feedback" /* UserFeedback */) === 0) {
|
|
17310
|
+
coreEvents.on("user-feedback" /* UserFeedback */, (payload) => {
|
|
17265
17311
|
writeToStderr(payload.message + "\n");
|
|
17266
17312
|
});
|
|
17267
17313
|
}
|
|
@@ -17269,7 +17315,7 @@ function initializeOutputListenersAndFlush(config) {
|
|
|
17269
17315
|
const forceToStderr = outputFormat === "json";
|
|
17270
17316
|
coreEvents.drainBacklogs(
|
|
17271
17317
|
(event, args) => {
|
|
17272
|
-
if (forceToStderr && event ===
|
|
17318
|
+
if (forceToStderr && event === "output" /* Output */) {
|
|
17273
17319
|
const payload = args[0];
|
|
17274
17320
|
if (!payload.isStderr) {
|
|
17275
17321
|
return {
|