@mmmbuto/gemini-cli-termux 0.42.0-termux → 0.46.0-termux
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/README.md +22 -2
- package/bundle/builtin/antigravity-support/SKILL.md +58 -0
- package/bundle/{chunk-BF6DCDLJ.js → chunk-4TSWR3AN.js} +145 -55
- package/bundle/{chunk-PL5MCDGY.js → chunk-6HI7VNOG.js} +55 -70
- package/bundle/{chunk-6PXDEURC.js → chunk-7QZTHDKK.js} +2 -4
- package/bundle/{chunk-ORXUJRZC.js → chunk-B7I47N5E.js} +3 -3
- package/bundle/{chunk-EHTAR2YP.js → chunk-G2G6HEZZ.js} +1 -1
- package/bundle/{chunk-LX6GOGBA.js → chunk-IB4Q6NBY.js} +123186 -73766
- package/bundle/{chunk-MP2YMAMR.js → chunk-IT3YFQ3I.js} +1 -1
- package/bundle/{chunk-RJTRUG2J.js → chunk-TUDYL3X4.js} +29 -5
- package/bundle/{chunk-A6KCGXPK.js → chunk-WUVOS6TV.js} +13 -6
- package/bundle/{chunk-SLMD2AMF.js → chunk-YGU42N5I.js} +847 -655
- package/bundle/{cleanup-RTDYF5DD.js → cleanup-GEP2OOHM.js} +4 -5
- package/bundle/{devtools-ZLHMA45S.js → devtools-V7NE4CQA.js} +1 -1
- package/bundle/{devtoolsService-SKRXJOXW.js → devtoolsService-EVM2JJLB.js} +5 -6
- package/bundle/{dist-B3HBIK36.js → dist-R3LOFA4X.js} +331 -285
- package/bundle/docs/changelogs/index.md +59 -0
- package/bundle/docs/changelogs/latest.md +201 -167
- package/bundle/docs/changelogs/preview.md +45 -102
- package/bundle/docs/cli/auto-memory.md +61 -40
- package/bundle/docs/cli/gemini-md.md +0 -2
- package/bundle/docs/cli/plan-mode.md +0 -1
- package/bundle/docs/cli/settings.md +19 -19
- package/bundle/docs/cli/tutorials/memory-management.md +3 -3
- package/bundle/docs/extensions/reference.md +16 -0
- package/bundle/docs/extensions/releasing.md +58 -24
- package/bundle/docs/extensions/writing-extensions.md +7 -0
- package/bundle/docs/get-started/installation.mdx +2 -2
- package/bundle/docs/issue-and-pr-automation.md +29 -1
- package/bundle/docs/reference/commands.md +0 -3
- package/bundle/docs/reference/configuration.md +173 -78
- package/bundle/docs/reference/keyboard-shortcuts.md +23 -0
- package/bundle/docs/reference/tools.md +0 -2
- package/bundle/docs/tools/mcp-server.md +24 -3
- package/bundle/docs/tools/memory.md +10 -13
- package/bundle/examples/custom-commands/commands/fs/grep-code.toml +6 -0
- package/bundle/examples/custom-commands/gemini-extension.json +4 -0
- package/bundle/examples/exclude-tools/gemini-extension.json +5 -0
- package/bundle/examples/hooks/gemini-extension.json +4 -0
- package/bundle/examples/hooks/hooks/hooks.json +14 -0
- package/bundle/examples/hooks/scripts/on-start.js +8 -0
- package/bundle/examples/mcp-server/README.md +35 -0
- package/bundle/examples/mcp-server/example.js +60 -0
- package/bundle/examples/mcp-server/gemini-extension.json +11 -0
- package/bundle/examples/mcp-server/package.json +11 -0
- package/bundle/examples/policies/README.md +41 -0
- package/bundle/examples/policies/gemini-extension.json +5 -0
- package/bundle/examples/policies/policies/policies.toml +28 -0
- package/bundle/examples/skills/gemini-extension.json +4 -0
- package/bundle/examples/skills/skills/greeter/SKILL.md +7 -0
- package/bundle/examples/themes-example/README.md +31 -0
- package/bundle/examples/themes-example/gemini-extension.json +29 -0
- package/bundle/{gemini-NJWIVDFH.js → gemini-SGAFQX2R.js} +450 -297
- package/bundle/gemini.js +18 -13
- package/bundle/{dist-T73EYRDX.js → https-proxy-agent-AVGR4LHR.js} +8 -3
- package/bundle/{interactiveCli-QHKQZZJU.js → interactiveCli-MEEXSI2X.js} +1922 -1675
- package/bundle/{liteRtServerManager-USDJEPCM.js → liteRtServerManager-3EZO3JZ5.js} +6 -7
- package/bundle/{oauth2-provider-ARATJNEE.js → oauth2-provider-AJMTKEL6.js} +8 -10
- package/bundle/package.json +1 -1
- package/bundle/policies/plan.toml +1 -1
- package/bundle/policies/write.toml +0 -7
- package/bundle/src-LG4OHBW7.js +343 -0
- package/bundle/{start-IWR7MCIR.js → start-YW7YIVR7.js} +8 -9
- package/bundle/worker/worker-entry.js +7863 -0
- package/package.json +3 -3
- package/bundle/chunk-2X6HJV2G.js +0 -52710
- package/bundle/memoryDiscovery-EEGUKQ5C.js +0 -29
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js +0 -96
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.d.ts +0 -7
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js +0 -9
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js.map +0 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.d.ts +0 -48
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js +0 -333
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js.map +0 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.d.ts +0 -36
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js +0 -7
- package/bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js.map +0 -1
- package/bundle/node_modules/@google/gemini-cli-devtools/package.json +0 -33
- package/bundle/policies/memory-manager.toml +0 -20
|
@@ -41,18 +41,18 @@ import {
|
|
|
41
41
|
updateAllUpdatableExtensions,
|
|
42
42
|
updateExtension,
|
|
43
43
|
validateAuthMethod
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-YGU42N5I.js";
|
|
45
45
|
import {
|
|
46
46
|
appEvents
|
|
47
47
|
} from "./chunk-5PS3AYFU.js";
|
|
48
48
|
import {
|
|
49
49
|
startCommand,
|
|
50
50
|
startServer
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-B7I47N5E.js";
|
|
52
52
|
import {
|
|
53
53
|
exitCli,
|
|
54
54
|
require_source
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-G2G6HEZZ.js";
|
|
56
56
|
import {
|
|
57
57
|
DEFAULT_PORT,
|
|
58
58
|
GEMMA_MODEL_NAME,
|
|
@@ -86,11 +86,11 @@ import {
|
|
|
86
86
|
readServerProcessInfo,
|
|
87
87
|
resolveGemmaConfig,
|
|
88
88
|
saveModelChange
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-4TSWR3AN.js";
|
|
90
90
|
import {
|
|
91
91
|
RELAUNCH_EXIT_CODE
|
|
92
|
-
} from "./chunk-
|
|
93
|
-
import "./chunk-
|
|
92
|
+
} from "./chunk-WUVOS6TV.js";
|
|
93
|
+
import "./chunk-IT3YFQ3I.js";
|
|
94
94
|
import {
|
|
95
95
|
cleanupCheckpoints,
|
|
96
96
|
registerCleanup,
|
|
@@ -99,28 +99,57 @@ import {
|
|
|
99
99
|
runExitCleanup,
|
|
100
100
|
runSyncCleanup,
|
|
101
101
|
setupSignalHandlers
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-7QZTHDKK.js";
|
|
103
103
|
import {
|
|
104
|
+
ASK_USER_TOOL_NAME,
|
|
105
|
+
ApprovalMode,
|
|
104
106
|
AuthType,
|
|
105
|
-
ChatRecordingService,
|
|
106
107
|
Client,
|
|
107
108
|
Config,
|
|
109
|
+
CoreEvent,
|
|
108
110
|
CoreToolCallStatus,
|
|
111
|
+
DEFAULT_CONTEXT_FILENAME,
|
|
112
|
+
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
113
|
+
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
114
|
+
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
115
|
+
DEFAULT_GEMINI_FLASH_MODEL,
|
|
116
|
+
DEFAULT_GEMINI_MODEL,
|
|
117
|
+
DiscoveredMCPTool,
|
|
109
118
|
ExitCodes,
|
|
119
|
+
FatalAuthenticationError,
|
|
120
|
+
FatalCancellationError,
|
|
121
|
+
FatalConfigError,
|
|
122
|
+
FatalError,
|
|
123
|
+
FatalInputError,
|
|
124
|
+
FatalSandboxError,
|
|
125
|
+
FatalToolExecutionError,
|
|
126
|
+
FatalTurnLimitedError,
|
|
127
|
+
FatalUntrustedWorkspaceError,
|
|
110
128
|
FileDiscoveryService,
|
|
111
129
|
FolderTrustDiscoveryService,
|
|
130
|
+
GEMINI_DIR,
|
|
131
|
+
GEMINI_MODEL_ALIAS_AUTO,
|
|
112
132
|
GeminiEventType,
|
|
113
133
|
IdeClient,
|
|
114
134
|
IntegrityStatus,
|
|
115
135
|
InvalidStreamError,
|
|
116
136
|
JsonFormatter,
|
|
117
137
|
JsonStreamEventType,
|
|
138
|
+
Kind,
|
|
118
139
|
LegacyAgentSession,
|
|
119
140
|
Logger,
|
|
120
141
|
MCPServerConfig,
|
|
121
142
|
MCPServerStatus,
|
|
143
|
+
MessageBusType,
|
|
122
144
|
OutputFormat,
|
|
145
|
+
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
146
|
+
PREVIEW_GEMINI_3_1_MODEL,
|
|
147
|
+
PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
148
|
+
PREVIEW_GEMINI_FLASH_MODEL,
|
|
149
|
+
PREVIEW_GEMINI_MODEL,
|
|
150
|
+
PolicyDecision,
|
|
123
151
|
PolicyIntegrityManager,
|
|
152
|
+
REFERENCE_CONTENT_START,
|
|
124
153
|
ROOT_SCHEDULER_ID,
|
|
125
154
|
ReadManyFilesTool,
|
|
126
155
|
Scheduler,
|
|
@@ -128,47 +157,61 @@ import {
|
|
|
128
157
|
SessionStartSource,
|
|
129
158
|
ShellExecutionService,
|
|
130
159
|
SimpleExtensionLoader,
|
|
160
|
+
Storage,
|
|
131
161
|
StreamJsonFormatter,
|
|
132
162
|
ToolCallEvent,
|
|
163
|
+
ToolConfirmationOutcome,
|
|
164
|
+
ToolErrorType,
|
|
133
165
|
TrustLevel,
|
|
134
166
|
UserAccountManager,
|
|
135
167
|
UserPromptEvent,
|
|
136
168
|
ValidationCancelledError,
|
|
137
169
|
ValidationRequiredError,
|
|
138
170
|
WarningPriority,
|
|
139
|
-
addMemory,
|
|
140
171
|
applyAdminAllowlist,
|
|
141
172
|
applyRequiredServers,
|
|
142
173
|
clearCachedCredentialFile,
|
|
143
174
|
convertSessionToClientHistory,
|
|
144
175
|
convertToFunctionResponse,
|
|
176
|
+
coreEvents,
|
|
145
177
|
createPolicyEngineConfig,
|
|
146
178
|
createPolicyUpdater,
|
|
147
179
|
createSessionId,
|
|
148
180
|
createTransport,
|
|
149
181
|
createWorkingStdio,
|
|
150
182
|
createWorktreeService,
|
|
183
|
+
debugLogger,
|
|
184
|
+
deleteStoredSession,
|
|
151
185
|
detectIdeFromEnv,
|
|
152
186
|
displayContentToString,
|
|
153
187
|
execa,
|
|
154
|
-
external_exports
|
|
188
|
+
external_exports,
|
|
189
|
+
external_exports2,
|
|
155
190
|
geminiPartsToContentParts,
|
|
156
191
|
generateSummary,
|
|
157
192
|
getAdminBlockedMcpServersMessage,
|
|
158
193
|
getAdminErrorMessage,
|
|
159
194
|
getAuthTypeFromEnv,
|
|
195
|
+
getAutoModelDescription,
|
|
160
196
|
getCheckpointInfoList,
|
|
161
197
|
getCompatibilityWarnings,
|
|
198
|
+
getDisplayString,
|
|
199
|
+
getErrorMessage,
|
|
162
200
|
getErrorStatus,
|
|
201
|
+
getErrorType,
|
|
163
202
|
getOauthClient,
|
|
164
203
|
getPackageJson,
|
|
204
|
+
getProjectHash,
|
|
165
205
|
getProjectRootForWorktree,
|
|
166
206
|
getPty,
|
|
167
207
|
getRealPath,
|
|
168
208
|
getToolCallDataSchema,
|
|
169
209
|
getVersion,
|
|
210
|
+
homedir,
|
|
211
|
+
isFatalToolError,
|
|
170
212
|
isGeminiWorktree,
|
|
171
213
|
isHeadlessMode,
|
|
214
|
+
isNodeError,
|
|
172
215
|
isTextPart,
|
|
173
216
|
isWithinRoot,
|
|
174
217
|
listExtensions,
|
|
@@ -176,6 +219,7 @@ import {
|
|
|
176
219
|
listInboxPatches,
|
|
177
220
|
listInboxSkills,
|
|
178
221
|
listMemoryFiles,
|
|
222
|
+
loadConversationRecord,
|
|
179
223
|
logToolCall,
|
|
180
224
|
logUserPrompt,
|
|
181
225
|
parseAndFormatApiError,
|
|
@@ -190,7 +234,11 @@ import {
|
|
|
190
234
|
require_command_exists,
|
|
191
235
|
require_shell_quote,
|
|
192
236
|
require_strip_json_comments,
|
|
237
|
+
resetGeminiMdFilename,
|
|
238
|
+
resolveAtCommandPath,
|
|
193
239
|
resolveTelemetrySettings,
|
|
240
|
+
resolveToRealPath,
|
|
241
|
+
setGeminiMdFilename,
|
|
194
242
|
shouldEnterAlternateScreen,
|
|
195
243
|
showMemory,
|
|
196
244
|
startupProfiler,
|
|
@@ -199,57 +247,9 @@ import {
|
|
|
199
247
|
updatePolicy,
|
|
200
248
|
writeToStderr,
|
|
201
249
|
writeToStdout
|
|
202
|
-
} from "./chunk-
|
|
203
|
-
import
|
|
204
|
-
|
|
205
|
-
ApprovalMode,
|
|
206
|
-
CoreEvent,
|
|
207
|
-
DEFAULT_FILE_FILTERING_OPTIONS,
|
|
208
|
-
DEFAULT_GEMINI_EMBEDDING_MODEL,
|
|
209
|
-
DEFAULT_GEMINI_FLASH_LITE_MODEL,
|
|
210
|
-
DEFAULT_GEMINI_FLASH_MODEL,
|
|
211
|
-
DEFAULT_GEMINI_MODEL,
|
|
212
|
-
DEFAULT_GEMINI_MODEL_AUTO,
|
|
213
|
-
DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
|
214
|
-
DiscoveredMCPTool,
|
|
215
|
-
FatalAuthenticationError,
|
|
216
|
-
FatalCancellationError,
|
|
217
|
-
FatalConfigError,
|
|
218
|
-
FatalError,
|
|
219
|
-
FatalInputError,
|
|
220
|
-
FatalSandboxError,
|
|
221
|
-
FatalToolExecutionError,
|
|
222
|
-
FatalTurnLimitedError,
|
|
223
|
-
FatalUntrustedWorkspaceError,
|
|
224
|
-
GEMINI_DIR,
|
|
225
|
-
GEMINI_MODEL_ALIAS_AUTO,
|
|
226
|
-
Kind,
|
|
227
|
-
PREVIEW_GEMINI_3_1_CUSTOM_TOOLS_MODEL,
|
|
228
|
-
PREVIEW_GEMINI_3_1_FLASH_LITE_MODEL,
|
|
229
|
-
PREVIEW_GEMINI_3_1_MODEL,
|
|
230
|
-
PREVIEW_GEMINI_FLASH_MODEL,
|
|
231
|
-
PREVIEW_GEMINI_MODEL,
|
|
232
|
-
PREVIEW_GEMINI_MODEL_AUTO,
|
|
233
|
-
REFERENCE_CONTENT_START,
|
|
234
|
-
Storage,
|
|
235
|
-
ToolConfirmationOutcome,
|
|
236
|
-
ToolErrorType,
|
|
237
|
-
coreEvents,
|
|
238
|
-
debugLogger,
|
|
239
|
-
external_exports,
|
|
240
|
-
getCurrentGeminiMdFilename,
|
|
241
|
-
getDisplayString,
|
|
242
|
-
getErrorMessage,
|
|
243
|
-
getErrorType,
|
|
244
|
-
homedir,
|
|
245
|
-
isFatalToolError,
|
|
246
|
-
isNodeError,
|
|
247
|
-
loadServerHierarchicalMemory,
|
|
248
|
-
resolveToRealPath,
|
|
249
|
-
setGeminiMdFilename
|
|
250
|
-
} from "./chunk-2X6HJV2G.js";
|
|
251
|
-
import "./chunk-PL5MCDGY.js";
|
|
252
|
-
import "./chunk-RJTRUG2J.js";
|
|
250
|
+
} from "./chunk-IB4Q6NBY.js";
|
|
251
|
+
import "./chunk-6HI7VNOG.js";
|
|
252
|
+
import "./chunk-TUDYL3X4.js";
|
|
253
253
|
import "./chunk-IUUIT4SU.js";
|
|
254
254
|
import {
|
|
255
255
|
__require,
|
|
@@ -1532,11 +1532,11 @@ var parser = new YargsParser({
|
|
|
1532
1532
|
resolve: resolve2,
|
|
1533
1533
|
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
1534
1534
|
// we can exercise all the lines below:
|
|
1535
|
-
require: (
|
|
1535
|
+
require: (path16) => {
|
|
1536
1536
|
if (typeof __require !== "undefined") {
|
|
1537
|
-
return __require(
|
|
1538
|
-
} else if (
|
|
1539
|
-
return JSON.parse(readFileSync(
|
|
1537
|
+
return __require(path16);
|
|
1538
|
+
} else if (path16.match(/\.json$/)) {
|
|
1539
|
+
return JSON.parse(readFileSync(path16, "utf8"));
|
|
1540
1540
|
} else {
|
|
1541
1541
|
throw Error("only .json config files are supported in ESM");
|
|
1542
1542
|
}
|
|
@@ -5433,12 +5433,12 @@ async function testMCPConnection(serverName, config, isTrusted, activeSettings)
|
|
|
5433
5433
|
return MCPServerStatus.DISCONNECTED;
|
|
5434
5434
|
}
|
|
5435
5435
|
}
|
|
5436
|
-
async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
5436
|
+
async function getServerStatus(serverName, server, isTrusted, activeSettings, consolidatedExcluded, consolidatedAllowed) {
|
|
5437
5437
|
const mcpEnablementManager = McpServerEnablementManager.getInstance();
|
|
5438
5438
|
const loadResult = await canLoadServer(serverName, {
|
|
5439
5439
|
adminMcpEnabled: activeSettings.admin?.mcp?.enabled ?? true,
|
|
5440
|
-
allowedList:
|
|
5441
|
-
excludedList:
|
|
5440
|
+
allowedList: consolidatedAllowed,
|
|
5441
|
+
excludedList: consolidatedExcluded.length > 0 ? consolidatedExcluded : void 0,
|
|
5442
5442
|
enablement: mcpEnablementManager.getEnablementCallbacks()
|
|
5443
5443
|
});
|
|
5444
5444
|
if (!loadResult.allowed) {
|
|
@@ -5447,12 +5447,16 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
|
|
|
5447
5447
|
}
|
|
5448
5448
|
return MCPServerStatus.DISABLED;
|
|
5449
5449
|
}
|
|
5450
|
+
if (!isTrusted) {
|
|
5451
|
+
return MCPServerStatus.DISABLED;
|
|
5452
|
+
}
|
|
5450
5453
|
return testMCPConnection(serverName, server, isTrusted, activeSettings);
|
|
5451
5454
|
}
|
|
5452
5455
|
async function listMcpServers(loadedSettingsArg) {
|
|
5453
5456
|
const loadedSettings = loadedSettingsArg ?? loadSettings();
|
|
5454
5457
|
const activeSettings = loadedSettings.merged;
|
|
5455
|
-
const
|
|
5458
|
+
const allSettings = !loadedSettings.isTrusted ? loadedSettings.getMergedSettingsAsIfTrusted() : activeSettings;
|
|
5459
|
+
const { mcpServers, blockedServerNames } = await getMcpServersFromConfig(allSettings);
|
|
5456
5460
|
const serverNames = Object.keys(mcpServers);
|
|
5457
5461
|
if (blockedServerNames.length > 0) {
|
|
5458
5462
|
const message = getAdminBlockedMcpServersMessage(
|
|
@@ -5467,6 +5471,15 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5467
5471
|
}
|
|
5468
5472
|
return;
|
|
5469
5473
|
}
|
|
5474
|
+
if (!loadedSettings.isTrusted) {
|
|
5475
|
+
debugLogger.log(
|
|
5476
|
+
import_chalk.default.yellow(
|
|
5477
|
+
"Warning: MCP servers are configured but disabled because this folder is untrusted.\nUser-level servers are also suppressed in untrusted folders to prevent accidental side-effects.\n"
|
|
5478
|
+
)
|
|
5479
|
+
);
|
|
5480
|
+
}
|
|
5481
|
+
const consolidatedExcluded = loadedSettings.getConsolidatedExcludedMcpServers();
|
|
5482
|
+
const consolidatedAllowed = loadedSettings.getConsolidatedAllowedMcpServers();
|
|
5470
5483
|
debugLogger.log("Configured MCP servers:\n");
|
|
5471
5484
|
for (const serverName of serverNames) {
|
|
5472
5485
|
const server = mcpServers[serverName];
|
|
@@ -5474,7 +5487,9 @@ async function listMcpServers(loadedSettingsArg) {
|
|
|
5474
5487
|
serverName,
|
|
5475
5488
|
server,
|
|
5476
5489
|
loadedSettings.isTrusted,
|
|
5477
|
-
activeSettings
|
|
5490
|
+
activeSettings,
|
|
5491
|
+
consolidatedExcluded,
|
|
5492
|
+
consolidatedAllowed
|
|
5478
5493
|
);
|
|
5479
5494
|
let statusIndicator = "";
|
|
5480
5495
|
let statusText = "";
|
|
@@ -6306,27 +6321,27 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
6306
6321
|
var __filename = fileURLToPath2(import.meta.url);
|
|
6307
6322
|
var __dirname2 = dirname3(__filename);
|
|
6308
6323
|
var EXAMPLES_PATH = join(__dirname2, "examples");
|
|
6309
|
-
async function pathExists(
|
|
6324
|
+
async function pathExists(path16) {
|
|
6310
6325
|
try {
|
|
6311
|
-
await access(
|
|
6326
|
+
await access(path16);
|
|
6312
6327
|
return true;
|
|
6313
6328
|
} catch {
|
|
6314
6329
|
return false;
|
|
6315
6330
|
}
|
|
6316
6331
|
}
|
|
6317
|
-
async function createDirectory(
|
|
6318
|
-
if (await pathExists(
|
|
6319
|
-
throw new Error(`Path already exists: ${
|
|
6332
|
+
async function createDirectory(path16) {
|
|
6333
|
+
if (await pathExists(path16)) {
|
|
6334
|
+
throw new Error(`Path already exists: ${path16}`);
|
|
6320
6335
|
}
|
|
6321
|
-
await mkdir(
|
|
6336
|
+
await mkdir(path16, { recursive: true });
|
|
6322
6337
|
}
|
|
6323
|
-
async function copyDirectory(template,
|
|
6324
|
-
await createDirectory(
|
|
6338
|
+
async function copyDirectory(template, path16) {
|
|
6339
|
+
await createDirectory(path16);
|
|
6325
6340
|
const examplePath = join(EXAMPLES_PATH, template);
|
|
6326
6341
|
const entries = await readdir(examplePath, { withFileTypes: true });
|
|
6327
6342
|
for (const entry of entries) {
|
|
6328
6343
|
const srcPath = join(examplePath, entry.name);
|
|
6329
|
-
const destPath = join(
|
|
6344
|
+
const destPath = join(path16, entry.name);
|
|
6330
6345
|
await cp(srcPath, destPath, { recursive: true });
|
|
6331
6346
|
}
|
|
6332
6347
|
}
|
|
@@ -6601,7 +6616,7 @@ async function handleEnable3(args) {
|
|
|
6601
6616
|
const result = enableSkill(settings, name);
|
|
6602
6617
|
const feedback = renderSkillActionFeedback(
|
|
6603
6618
|
result,
|
|
6604
|
-
(label,
|
|
6619
|
+
(label, path16) => `${import_chalk5.default.bold(label)} (${import_chalk5.default.dim(path16)})`
|
|
6605
6620
|
);
|
|
6606
6621
|
debugLogger.log(feedback);
|
|
6607
6622
|
}
|
|
@@ -6631,7 +6646,7 @@ async function handleDisable3(args) {
|
|
|
6631
6646
|
const result = disableSkill(settings, name, scope);
|
|
6632
6647
|
const feedback = renderSkillActionFeedback(
|
|
6633
6648
|
result,
|
|
6634
|
-
(label,
|
|
6649
|
+
(label, path16) => `${import_chalk6.default.bold(label)} (${import_chalk6.default.dim(path16)})`
|
|
6635
6650
|
);
|
|
6636
6651
|
debugLogger.log(feedback);
|
|
6637
6652
|
}
|
|
@@ -7826,7 +7841,7 @@ async function loadSandboxConfig(settings, argv) {
|
|
|
7826
7841
|
}
|
|
7827
7842
|
const command2 = getSandboxCommand(sandboxValue);
|
|
7828
7843
|
const packageJson = await getPackageJson(__dirname3);
|
|
7829
|
-
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "ghcr.io/mmmbuto/gemini-cli-termux:0.
|
|
7844
|
+
const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "ghcr.io/mmmbuto/gemini-cli-termux:0.46.0-termux" ?? customImage ?? packageJson?.config?.sandboxImageUri;
|
|
7830
7845
|
const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
|
|
7831
7846
|
return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
|
|
7832
7847
|
}
|
|
@@ -7994,8 +8009,13 @@ async function parseArguments(settings) {
|
|
|
7994
8009
|
const queryArg2 = argv["query"];
|
|
7995
8010
|
const query = typeof queryArg2 === "string" || Array.isArray(queryArg2) ? queryArg2 : void 0;
|
|
7996
8011
|
const hasPositionalQuery = Array.isArray(query) ? query.length > 0 : !!query;
|
|
7997
|
-
|
|
7998
|
-
|
|
8012
|
+
const sessionFlags = [
|
|
8013
|
+
argv["resume"] !== void 0,
|
|
8014
|
+
argv["session-id"] !== void 0,
|
|
8015
|
+
argv["session-file"] !== void 0
|
|
8016
|
+
].filter(Boolean).length;
|
|
8017
|
+
if (sessionFlags > 1) {
|
|
8018
|
+
return "The flags --resume, --session-id, and --session-file are mutually exclusive. Please provide only one.";
|
|
7999
8019
|
}
|
|
8000
8020
|
if (argv["prompt"] && hasPositionalQuery) {
|
|
8001
8021
|
return "Cannot use both a positional prompt and the --prompt (-p) flag together";
|
|
@@ -8126,6 +8146,10 @@ async function parseArguments(settings) {
|
|
|
8126
8146
|
}
|
|
8127
8147
|
return trimmed;
|
|
8128
8148
|
}
|
|
8149
|
+
}).option("session-file", {
|
|
8150
|
+
type: "string",
|
|
8151
|
+
nargs: 1,
|
|
8152
|
+
description: "Load a session from a JSON file"
|
|
8129
8153
|
}).option("session-id", {
|
|
8130
8154
|
type: "string",
|
|
8131
8155
|
nargs: 1,
|
|
@@ -8167,6 +8191,10 @@ async function parseArguments(settings) {
|
|
|
8167
8191
|
type: "string",
|
|
8168
8192
|
description: "Path to a file with fake model responses for testing.",
|
|
8169
8193
|
hidden: true
|
|
8194
|
+
}).option("fake-responses-non-strict", {
|
|
8195
|
+
type: "string",
|
|
8196
|
+
description: "Path to a file with fake model responses for testing (non-strict mode).",
|
|
8197
|
+
hidden: true
|
|
8170
8198
|
}).option("record-responses", {
|
|
8171
8199
|
type: "string",
|
|
8172
8200
|
description: "Path to a file to record model responses for testing.",
|
|
@@ -8232,14 +8260,13 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8232
8260
|
cwd = process3.cwd(),
|
|
8233
8261
|
projectHooks,
|
|
8234
8262
|
skipExtensions = false,
|
|
8235
|
-
|
|
8263
|
+
loadedSettings
|
|
8236
8264
|
} = options;
|
|
8237
8265
|
const debugMode = isDebugMode(argv);
|
|
8238
8266
|
const worktreeSettings = options.worktreeSettings ?? await resolveWorktreeSettings(cwd);
|
|
8239
8267
|
if (argv.sandbox) {
|
|
8240
8268
|
process3.env["GEMINI_SANDBOX"] = "true";
|
|
8241
8269
|
}
|
|
8242
|
-
const memoryImportFormat = settings.context?.importFormat || "tree";
|
|
8243
8270
|
const includeDirectoryTree = settings.context?.includeDirectoryTree ?? true;
|
|
8244
8271
|
const ideMode = settings.ide?.enabled ?? false;
|
|
8245
8272
|
const folderTrust = process3.env["GEMINI_CLI_INTEGRATION_TEST"] === "true" || process3.env["VITEST"] === "true" ? false : settings.security?.folderTrust?.enabled ?? false;
|
|
@@ -8250,13 +8277,9 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8250
8277
|
if (settings.context?.fileName) {
|
|
8251
8278
|
setGeminiMdFilename(settings.context.fileName);
|
|
8252
8279
|
} else {
|
|
8253
|
-
|
|
8280
|
+
resetGeminiMdFilename(DEFAULT_CONTEXT_FILENAME);
|
|
8254
8281
|
}
|
|
8255
8282
|
const fileService = new FileDiscoveryService(cwd);
|
|
8256
|
-
const memoryFileFiltering = {
|
|
8257
|
-
...DEFAULT_MEMORY_FILE_FILTERING_OPTIONS,
|
|
8258
|
-
...settings.context?.fileFiltering
|
|
8259
|
-
};
|
|
8260
8283
|
const fileFiltering = {
|
|
8261
8284
|
...DEFAULT_FILE_FILTERING_OPTIONS,
|
|
8262
8285
|
...settings.context?.fileFiltering
|
|
@@ -8294,33 +8317,13 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8294
8317
|
await extensionManager.loadExtensions();
|
|
8295
8318
|
}
|
|
8296
8319
|
const extensionPlanSettings = extensionManager?.getExtensions()?.find((ext) => ext.isActive && ext.plan?.directory)?.plan;
|
|
8297
|
-
const experimentalJitContext = settings.experimental.jitContext ?? true;
|
|
8298
8320
|
let extensionRegistryURI = process3.env["GEMINI_CLI_EXTENSION_REGISTRY_URI"] ?? (trustedFolder ? settings.experimental?.extensionRegistryURI : void 0);
|
|
8299
8321
|
if (extensionRegistryURI && !extensionRegistryURI.startsWith("http")) {
|
|
8300
8322
|
extensionRegistryURI = resolveToRealPath(
|
|
8301
8323
|
path7.resolve(cwd, resolvePath(extensionRegistryURI))
|
|
8302
8324
|
);
|
|
8303
8325
|
}
|
|
8304
|
-
let memoryContent = "";
|
|
8305
|
-
let fileCount = 0;
|
|
8306
|
-
let filePaths = [];
|
|
8307
8326
|
const finalExtensionLoader = extensionManager ?? new SimpleExtensionLoader([]);
|
|
8308
|
-
if (!experimentalJitContext && !skipMemoryLoad) {
|
|
8309
|
-
const result = await loadServerHierarchicalMemory(
|
|
8310
|
-
cwd,
|
|
8311
|
-
settings.context?.loadMemoryFromIncludeDirectories || false ? includeDirectories : [],
|
|
8312
|
-
fileService,
|
|
8313
|
-
finalExtensionLoader,
|
|
8314
|
-
trustedFolder,
|
|
8315
|
-
memoryImportFormat,
|
|
8316
|
-
memoryFileFiltering,
|
|
8317
|
-
settings.context?.discoveryMaxDirs,
|
|
8318
|
-
settings.context?.memoryBoundaryMarkers
|
|
8319
|
-
);
|
|
8320
|
-
memoryContent = result.memoryContent;
|
|
8321
|
-
fileCount = result.fileCount;
|
|
8322
|
-
filePaths = result.filePaths;
|
|
8323
|
-
}
|
|
8324
8327
|
const question = argv.promptInteractive || argv.prompt || "";
|
|
8325
8328
|
let approvalMode;
|
|
8326
8329
|
const rawApprovalMode = argv.approvalMode || (argv.yolo ? "yolo" : void 0) || (settings.general?.defaultApprovalMode !== "yolo" ? settings.general?.defaultApprovalMode : void 0);
|
|
@@ -8435,7 +8438,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8435
8438
|
workspacePoliciesDir,
|
|
8436
8439
|
interactive
|
|
8437
8440
|
);
|
|
8438
|
-
const defaultModel =
|
|
8441
|
+
const defaultModel = GEMINI_MODEL_ALIAS_AUTO;
|
|
8439
8442
|
const rawModel = argv.model || process3.env["GEMINI_MODEL"] || settings.model?.name;
|
|
8440
8443
|
const specifiedModel = Array.isArray(rawModel) ? String(rawModel.at(-1) ?? "").trim() || "" : rawModel === void 0 ? void 0 : String(rawModel ?? "").trim() || "";
|
|
8441
8444
|
const resolvedModel = specifiedModel === GEMINI_MODEL_ALIAS_AUTO ? defaultModel : specifiedModel || defaultModel;
|
|
@@ -8505,6 +8508,8 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8505
8508
|
let profileSelector = void 0;
|
|
8506
8509
|
if (settings.experimental?.stressTestProfile) {
|
|
8507
8510
|
profileSelector = "stressTestProfile";
|
|
8511
|
+
} else if (settings.experimental?.powerUserProfile) {
|
|
8512
|
+
profileSelector = "powerUserProfile";
|
|
8508
8513
|
} else if (settings.experimental?.generalistProfile || settings.experimental?.contextManagement) {
|
|
8509
8514
|
profileSelector = "generalistProfile";
|
|
8510
8515
|
}
|
|
@@ -8544,14 +8549,11 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8544
8549
|
extensionsEnabled,
|
|
8545
8550
|
agents: settings.agents,
|
|
8546
8551
|
adminSkillsEnabled,
|
|
8547
|
-
allowedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ?? settings.mcp?.allowed : void 0,
|
|
8548
|
-
blockedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ? void 0 : settings.mcp?.excluded : void 0,
|
|
8552
|
+
allowedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ?? (loadedSettings ? loadedSettings.getConsolidatedAllowedMcpServers() : settings.mcp?.allowed) : void 0,
|
|
8553
|
+
blockedMcpServers: mcpEnabled ? argv.allowedMcpServerNames ? void 0 : loadedSettings ? loadedSettings.getConsolidatedExcludedMcpServers() : settings.mcp?.excluded : void 0,
|
|
8549
8554
|
blockedEnvironmentVariables: settings.security?.environmentVariableRedaction?.blocked,
|
|
8550
8555
|
allowedEnvironmentVariables: settings.security?.environmentVariableRedaction?.allowed,
|
|
8551
8556
|
enableEnvironmentVariableRedaction: settings.security?.environmentVariableRedaction?.enabled,
|
|
8552
|
-
userMemory: memoryContent,
|
|
8553
|
-
geminiMdFileCount: fileCount,
|
|
8554
|
-
geminiMdFilePaths: filePaths,
|
|
8555
8557
|
approvalMode,
|
|
8556
8558
|
disableYoloMode: settings.security?.disableYoloMode || settings.admin?.secureModeEnabled,
|
|
8557
8559
|
disableAlwaysAllow: settings.security?.disableAlwaysAllow || settings.admin?.secureModeEnabled,
|
|
@@ -8586,8 +8588,6 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8586
8588
|
enableEventDrivenScheduler: true,
|
|
8587
8589
|
skillsSupport: settings.skills?.enabled ?? true,
|
|
8588
8590
|
disabledSkills: settings.skills?.disabled,
|
|
8589
|
-
experimentalJitContext,
|
|
8590
|
-
experimentalMemoryV2: settings.experimental?.memoryV2,
|
|
8591
8591
|
experimentalAutoMemory: settings.experimental?.autoMemory,
|
|
8592
8592
|
experimentalGemma: settings.experimental?.gemma,
|
|
8593
8593
|
contextManagement,
|
|
@@ -8610,7 +8610,11 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8610
8610
|
shellBackgroundCompletionBehavior: settings.tools?.shell?.backgroundCompletionBehavior,
|
|
8611
8611
|
shellToolInactivityTimeout: settings.tools?.shell?.inactivityTimeout,
|
|
8612
8612
|
enableShellOutputEfficiency: settings.tools?.shell?.enableShellOutputEfficiency ?? true,
|
|
8613
|
-
|
|
8613
|
+
// In ACP mode, always skip the next-speaker check. This check triggers
|
|
8614
|
+
// recursive continuation turns inside GeminiClient.processTurn() that
|
|
8615
|
+
// conflict with ACP's explicit turn management via session/prompt,
|
|
8616
|
+
// causing infinite agent_thought_chunk loops.
|
|
8617
|
+
skipNextSpeakerCheck: isAcpMode || settings.model?.skipNextSpeakerCheck,
|
|
8614
8618
|
truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
|
|
8615
8619
|
eventEmitter: coreEvents,
|
|
8616
8620
|
useWriteTodos: argv.useWriteTodos ?? settings.useWriteTodos,
|
|
@@ -8621,6 +8625,7 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
|
|
|
8621
8625
|
gemmaModelRouter: settings.experimental?.gemmaModelRouter,
|
|
8622
8626
|
adk: settings.experimental?.adk,
|
|
8623
8627
|
fakeResponses: argv.fakeResponses,
|
|
8628
|
+
fakeResponsesNonStrict: argv.fakeResponsesNonStrict,
|
|
8624
8629
|
recordResponses: argv.recordResponses,
|
|
8625
8630
|
retryFetchErrors: settings.general?.retryFetchErrors,
|
|
8626
8631
|
billing: settings.billing,
|
|
@@ -8769,6 +8774,8 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
8769
8774
|
import v8 from "node:v8";
|
|
8770
8775
|
import os6 from "node:os";
|
|
8771
8776
|
import dns from "node:dns";
|
|
8777
|
+
import * as path15 from "node:path";
|
|
8778
|
+
import * as fsPromises from "node:fs/promises";
|
|
8772
8779
|
|
|
8773
8780
|
// packages/cli/src/utils/sandbox.ts
|
|
8774
8781
|
var import_shell_quote2 = __toESM(require_shell_quote(), 1);
|
|
@@ -8824,16 +8831,26 @@ async function shouldUseCurrentUserInSandbox() {
|
|
|
8824
8831
|
if (os2.platform() === "linux") {
|
|
8825
8832
|
try {
|
|
8826
8833
|
const osReleaseContent = await readFile("/etc/os-release", "utf8");
|
|
8827
|
-
|
|
8828
|
-
|
|
8834
|
+
const isSupportedDistro = osReleaseContent.match(
|
|
8835
|
+
/^ID=["']?(?:debian|ubuntu|nixos|arch|fedora|suse|opensuse)/m
|
|
8836
|
+
) || osReleaseContent.match(
|
|
8837
|
+
/^ID_LIKE=["']?.*(?:debian|ubuntu|arch|fedora|suse).*/m
|
|
8838
|
+
);
|
|
8839
|
+
if (isSupportedDistro) {
|
|
8829
8840
|
debugLogger.log(
|
|
8830
|
-
"Defaulting to use current user UID/GID for
|
|
8841
|
+
"Defaulting to use current user UID/GID for supported Linux distribution."
|
|
8831
8842
|
);
|
|
8832
8843
|
return true;
|
|
8833
8844
|
}
|
|
8845
|
+
const uid = os2.userInfo().uid;
|
|
8846
|
+
if (uid !== 1e3 && uid !== 0) {
|
|
8847
|
+
debugLogger.warn(
|
|
8848
|
+
`Warning: Host UID mismatch detected (current UID: ${uid}). If you encounter permission errors in the sandbox, try setting SANDBOX_SET_UID_GID=true.`
|
|
8849
|
+
);
|
|
8850
|
+
}
|
|
8834
8851
|
} catch {
|
|
8835
8852
|
debugLogger.warn(
|
|
8836
|
-
"Warning: Could not read /etc/os-release to auto-detect
|
|
8853
|
+
"Warning: Could not read /etc/os-release to auto-detect Linux distribution for UID/GID default."
|
|
8837
8854
|
);
|
|
8838
8855
|
}
|
|
8839
8856
|
}
|
|
@@ -9099,6 +9116,7 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9099
9116
|
);
|
|
9100
9117
|
}
|
|
9101
9118
|
const args = ["run", "-i", "--rm", "--init", "--workdir", containerWorkdir];
|
|
9119
|
+
args.push("--entrypoint", "");
|
|
9102
9120
|
if (config.command === "runsc") {
|
|
9103
9121
|
args.push("--runtime=runsc");
|
|
9104
9122
|
}
|
|
@@ -9229,21 +9247,11 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9229
9247
|
}
|
|
9230
9248
|
const imageName = parseImageName(image);
|
|
9231
9249
|
const isIntegrationTest = process.env["GEMINI_CLI_INTEGRATION_TEST"] === "true";
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
debugLogger.log(`ContainerName: ${containerName}`);
|
|
9238
|
-
} else {
|
|
9239
|
-
let index = 0;
|
|
9240
|
-
const containerNameCheck = (await execAsync(`${command2} ps -a --format "{{.Names}}"`)).stdout.trim();
|
|
9241
|
-
while (containerNameCheck.includes(`${imageName}-${index}`)) {
|
|
9242
|
-
index++;
|
|
9243
|
-
}
|
|
9244
|
-
containerName = `${imageName}-${index}`;
|
|
9245
|
-
debugLogger.log(`ContainerName (regular): ${containerName}`);
|
|
9246
|
-
}
|
|
9250
|
+
const containerNamePrefix = isIntegrationTest ? "gemini-cli-integration-test" : imageName;
|
|
9251
|
+
const containerName = `${containerNamePrefix}-${randomBytes(6).toString(
|
|
9252
|
+
"hex"
|
|
9253
|
+
)}`;
|
|
9254
|
+
debugLogger.log(`ContainerName: ${containerName}`);
|
|
9247
9255
|
args.push("--name", containerName, "--hostname", containerName);
|
|
9248
9256
|
if (process.env["GEMINI_CLI_TEST_VAR"]) {
|
|
9249
9257
|
args.push(
|
|
@@ -9364,16 +9372,26 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9364
9372
|
const gid = (await execAsync("id -g")).stdout.trim();
|
|
9365
9373
|
const username = "gemini";
|
|
9366
9374
|
const homeDir = getContainerPath(homedir());
|
|
9367
|
-
const
|
|
9368
|
-
// Use -f with groupadd to avoid errors if the group already exists.
|
|
9369
|
-
`groupadd -f -g ${gid} ${username}`,
|
|
9370
|
-
// Create user only if it doesn't exist. Use -o for non-unique UID.
|
|
9371
|
-
`id -u ${username} &>/dev/null || useradd -o -u ${uid} -g ${gid} -d ${homeDir} -s /bin/bash ${username}`
|
|
9372
|
-
].join(" && ");
|
|
9375
|
+
const quotedHomeDir = (0, import_shell_quote2.quote)([homeDir]);
|
|
9373
9376
|
const originalCommand = finalEntrypoint[2];
|
|
9374
9377
|
const escapedOriginalCommand = originalCommand.replace(/'/g, "'\\''");
|
|
9375
|
-
const
|
|
9376
|
-
|
|
9378
|
+
const defensiveEntrypoint = [
|
|
9379
|
+
`if command -v useradd >/dev/null 2>&1; then`,
|
|
9380
|
+
` (groupadd -g ${gid} -o ${username} 2>/dev/null || true) &&`,
|
|
9381
|
+
` (id ${uid} >/dev/null 2>&1 || useradd -o -u ${uid} -g ${gid} -d ${quotedHomeDir} -s /bin/bash ${username} 2>/dev/null || true) &&`,
|
|
9382
|
+
` USER_NAME=$(id -nu ${uid} 2>/dev/null);`,
|
|
9383
|
+
` if [ -n "$USER_NAME" ]; then`,
|
|
9384
|
+
` su -p "$USER_NAME" -c '${escapedOriginalCommand}';`,
|
|
9385
|
+
` else`,
|
|
9386
|
+
` echo "Error: Failed to map host UID ${uid} to a user in the container." >&2;`,
|
|
9387
|
+
` exit 1;`,
|
|
9388
|
+
` fi`,
|
|
9389
|
+
`else`,
|
|
9390
|
+
` echo "Error: 'useradd' not found in container. UID/GID mapping is required for Linux distros like NixOS/Arch to avoid permission issues. Please use a container image that includes standard user management tools (like 'ubuntu' or 'debian')." >&2;`,
|
|
9391
|
+
` exit 1;`,
|
|
9392
|
+
`fi`
|
|
9393
|
+
].join("\n");
|
|
9394
|
+
finalEntrypoint[2] = defensiveEntrypoint;
|
|
9377
9395
|
userFlag = `--user ${uid}:${gid}`;
|
|
9378
9396
|
args.push("--env", `HOME=${homedir()}`);
|
|
9379
9397
|
}
|
|
@@ -9386,6 +9404,8 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
|
|
|
9386
9404
|
"run",
|
|
9387
9405
|
"--rm",
|
|
9388
9406
|
"--init",
|
|
9407
|
+
"--entrypoint",
|
|
9408
|
+
"",
|
|
9389
9409
|
...userFlag ? userFlag.split(" ") : [],
|
|
9390
9410
|
"--name",
|
|
9391
9411
|
SANDBOX_PROXY_NAME,
|
|
@@ -10229,7 +10249,7 @@ async function runNonInteractive({
|
|
|
10229
10249
|
}
|
|
10230
10250
|
});
|
|
10231
10251
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10232
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10252
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-EVM2JJLB.js");
|
|
10233
10253
|
setupInitialActivityLogger(config);
|
|
10234
10254
|
}
|
|
10235
10255
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10684,6 +10704,9 @@ async function runNonInteractive({
|
|
|
10684
10704
|
async function runNonInteractive2(params) {
|
|
10685
10705
|
const useAgentSession = params.config.getAgentSessionNoninteractiveEnabled();
|
|
10686
10706
|
if (useAgentSession) {
|
|
10707
|
+
debugLogger.debug(
|
|
10708
|
+
"[ADK] Running non-interactive mode with ADK agent session"
|
|
10709
|
+
);
|
|
10687
10710
|
return runNonInteractive(params);
|
|
10688
10711
|
}
|
|
10689
10712
|
const { config, settings, input, prompt_id, resumedSessionData } = params;
|
|
@@ -10697,7 +10720,7 @@ async function runNonInteractive2(params) {
|
|
|
10697
10720
|
}
|
|
10698
10721
|
});
|
|
10699
10722
|
if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
|
|
10700
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
10723
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-EVM2JJLB.js");
|
|
10701
10724
|
setupInitialActivityLogger(config);
|
|
10702
10725
|
}
|
|
10703
10726
|
const { stdout: workingStdout } = createWorkingStdio();
|
|
@@ -10931,6 +10954,20 @@ async function runNonInteractive2(params) {
|
|
|
10931
10954
|
durationMs
|
|
10932
10955
|
)
|
|
10933
10956
|
});
|
|
10957
|
+
} else if (config.getOutputFormat() === OutputFormat.JSON) {
|
|
10958
|
+
const formatter = new JsonFormatter();
|
|
10959
|
+
const stats = uiTelemetryService.getMetrics();
|
|
10960
|
+
textOutput.write(
|
|
10961
|
+
formatter.format(
|
|
10962
|
+
config.getSessionId(),
|
|
10963
|
+
responseText,
|
|
10964
|
+
stats,
|
|
10965
|
+
void 0,
|
|
10966
|
+
[...warnings, stopMessage]
|
|
10967
|
+
)
|
|
10968
|
+
);
|
|
10969
|
+
} else {
|
|
10970
|
+
textOutput.ensureTrailingNewline();
|
|
10934
10971
|
}
|
|
10935
10972
|
return;
|
|
10936
10973
|
} else if (event.type === GeminiEventType.AgentExecutionBlocked) {
|
|
@@ -12680,11 +12717,6 @@ var CommandRegistry = class {
|
|
|
12680
12717
|
};
|
|
12681
12718
|
|
|
12682
12719
|
// packages/cli/src/acp/commands/memory.ts
|
|
12683
|
-
var DEFAULT_SANITIZATION_CONFIG = {
|
|
12684
|
-
allowedEnvironmentVariables: [],
|
|
12685
|
-
blockedEnvironmentVariables: [],
|
|
12686
|
-
enableEnvironmentVariableRedaction: false
|
|
12687
|
-
};
|
|
12688
12720
|
var MemoryCommand = class {
|
|
12689
12721
|
name = "memory";
|
|
12690
12722
|
description = "Manage memory.";
|
|
@@ -12692,7 +12724,6 @@ var MemoryCommand = class {
|
|
|
12692
12724
|
new ShowMemoryCommand(),
|
|
12693
12725
|
new RefreshMemoryCommand(),
|
|
12694
12726
|
new ListMemoryCommand(),
|
|
12695
|
-
new AddMemoryCommand(),
|
|
12696
12727
|
new InboxMemoryCommand()
|
|
12697
12728
|
];
|
|
12698
12729
|
requiresWorkspace = true;
|
|
@@ -12725,40 +12756,6 @@ var ListMemoryCommand = class {
|
|
|
12725
12756
|
return { name: this.name, data: result.content };
|
|
12726
12757
|
}
|
|
12727
12758
|
};
|
|
12728
|
-
var AddMemoryCommand = class {
|
|
12729
|
-
name = "memory add";
|
|
12730
|
-
description = "Add content to the memory.";
|
|
12731
|
-
async execute(context, args) {
|
|
12732
|
-
const textToAdd = args.join(" ").trim();
|
|
12733
|
-
const result = addMemory(textToAdd);
|
|
12734
|
-
if (result.type === "message") {
|
|
12735
|
-
return { name: this.name, data: result.content };
|
|
12736
|
-
}
|
|
12737
|
-
const toolRegistry = context.agentContext.toolRegistry;
|
|
12738
|
-
const tool = toolRegistry.getTool(result.toolName);
|
|
12739
|
-
if (tool) {
|
|
12740
|
-
const abortController = new AbortController();
|
|
12741
|
-
const signal = abortController.signal;
|
|
12742
|
-
await context.sendMessage(`Saving memory via ${result.toolName}...`);
|
|
12743
|
-
await tool.buildAndExecute(result.toolArgs, signal, void 0, {
|
|
12744
|
-
shellExecutionConfig: {
|
|
12745
|
-
sanitizationConfig: DEFAULT_SANITIZATION_CONFIG,
|
|
12746
|
-
sandboxManager: context.agentContext.sandboxManager
|
|
12747
|
-
}
|
|
12748
|
-
});
|
|
12749
|
-
await refreshMemory(context.agentContext.config);
|
|
12750
|
-
return {
|
|
12751
|
-
name: this.name,
|
|
12752
|
-
data: `Added memory: "${textToAdd}"`
|
|
12753
|
-
};
|
|
12754
|
-
} else {
|
|
12755
|
-
return {
|
|
12756
|
-
name: this.name,
|
|
12757
|
-
data: `Error: Tool ${result.toolName} not found.`
|
|
12758
|
-
};
|
|
12759
|
-
}
|
|
12760
|
-
}
|
|
12761
|
-
};
|
|
12762
12759
|
var InboxMemoryCommand = class {
|
|
12763
12760
|
name = "memory inbox";
|
|
12764
12761
|
description = "Lists memory items extracted from past sessions that are pending review.";
|
|
@@ -13664,16 +13661,16 @@ function buildAvailableModes(isPlanEnabled) {
|
|
|
13664
13661
|
return modes;
|
|
13665
13662
|
}
|
|
13666
13663
|
function buildAvailableModels(config, settings) {
|
|
13667
|
-
const preferredModel = config.getModel() ||
|
|
13664
|
+
const preferredModel = config.getModel() || GEMINI_MODEL_ALIAS_AUTO;
|
|
13668
13665
|
const shouldShowPreviewModels = config.getHasAccessToPreviewModel();
|
|
13669
13666
|
const useGemini31 = config.getGemini31LaunchedSync?.() ?? false;
|
|
13670
|
-
const
|
|
13667
|
+
const useGemini3_5Flash = config.hasGemini35FlashGAAccess?.() ?? false;
|
|
13671
13668
|
const selectedAuthType = settings.merged.security.auth.selectedType;
|
|
13672
13669
|
const useCustomToolModel = useGemini31 && selectedAuthType === AuthType.USE_GEMINI;
|
|
13673
13670
|
if (config.getExperimentalDynamicModelConfiguration?.() === true && config.getModelConfigService) {
|
|
13674
13671
|
const options = config.getModelConfigService().getAvailableModelOptions({
|
|
13675
13672
|
useGemini3_1: useGemini31,
|
|
13676
|
-
|
|
13673
|
+
useGemini3_5Flash,
|
|
13677
13674
|
useCustomTools: useCustomToolModel,
|
|
13678
13675
|
hasAccessToPreview: shouldShowPreviewModels
|
|
13679
13676
|
});
|
|
@@ -13684,18 +13681,15 @@ function buildAvailableModels(config, settings) {
|
|
|
13684
13681
|
}
|
|
13685
13682
|
const mainOptions = [
|
|
13686
13683
|
{
|
|
13687
|
-
value:
|
|
13688
|
-
title: getDisplayString(
|
|
13689
|
-
description:
|
|
13684
|
+
value: GEMINI_MODEL_ALIAS_AUTO,
|
|
13685
|
+
title: getDisplayString(GEMINI_MODEL_ALIAS_AUTO),
|
|
13686
|
+
description: getAutoModelDescription(
|
|
13687
|
+
shouldShowPreviewModels,
|
|
13688
|
+
useGemini31,
|
|
13689
|
+
useGemini3_5Flash
|
|
13690
|
+
)
|
|
13690
13691
|
}
|
|
13691
13692
|
];
|
|
13692
|
-
if (shouldShowPreviewModels) {
|
|
13693
|
-
mainOptions.unshift({
|
|
13694
|
-
value: PREVIEW_GEMINI_MODEL_AUTO,
|
|
13695
|
-
title: getDisplayString(PREVIEW_GEMINI_MODEL_AUTO),
|
|
13696
|
-
description: useGemini31 ? "Let Gemini CLI decide the best model for the task: gemini-3.1-pro, gemini-3-flash" : "Let Gemini CLI decide the best model for the task: gemini-3-pro, gemini-3-flash"
|
|
13697
|
-
});
|
|
13698
|
-
}
|
|
13699
13693
|
const manualOptions = [
|
|
13700
13694
|
{
|
|
13701
13695
|
value: DEFAULT_GEMINI_MODEL,
|
|
@@ -13723,10 +13717,10 @@ function buildAvailableModels(config, settings) {
|
|
|
13723
13717
|
title: getDisplayString(PREVIEW_GEMINI_FLASH_MODEL)
|
|
13724
13718
|
}
|
|
13725
13719
|
];
|
|
13726
|
-
if (
|
|
13720
|
+
if (PREVIEW_GEMINI_FLASH_LITE_MODEL !== "none") {
|
|
13727
13721
|
previewOptions.push({
|
|
13728
|
-
value:
|
|
13729
|
-
title: getDisplayString(
|
|
13722
|
+
value: PREVIEW_GEMINI_FLASH_LITE_MODEL,
|
|
13723
|
+
title: getDisplayString(PREVIEW_GEMINI_FLASH_LITE_MODEL)
|
|
13730
13724
|
});
|
|
13731
13725
|
}
|
|
13732
13726
|
manualOptions.unshift(...previewOptions);
|
|
@@ -13761,13 +13755,88 @@ var Session = class {
|
|
|
13761
13755
|
CoreEvent.ApprovalModeChanged,
|
|
13762
13756
|
this.handleApprovalModeChanged
|
|
13763
13757
|
);
|
|
13758
|
+
this.context.config.getMessageBus()?.subscribe(
|
|
13759
|
+
MessageBusType.TOOL_CONFIRMATION_REQUEST,
|
|
13760
|
+
this.handleToolConfirmationRequest,
|
|
13761
|
+
{ signal: this.disposeController.signal }
|
|
13762
|
+
);
|
|
13764
13763
|
}
|
|
13765
13764
|
pendingPrompt = null;
|
|
13766
13765
|
commandHandler = new CommandHandler();
|
|
13767
13766
|
callIdCounter = 0;
|
|
13767
|
+
disposeController = new AbortController();
|
|
13768
13768
|
generateCallId(name) {
|
|
13769
13769
|
return `${name}-${Date.now()}-${++this.callIdCounter}`;
|
|
13770
13770
|
}
|
|
13771
|
+
handleToolConfirmationRequest = async (request) => {
|
|
13772
|
+
try {
|
|
13773
|
+
const policyEngine = this.context.config.getPolicyEngine?.();
|
|
13774
|
+
const messageBus = this.context.config.getMessageBus();
|
|
13775
|
+
if (!messageBus) {
|
|
13776
|
+
return;
|
|
13777
|
+
}
|
|
13778
|
+
if (!policyEngine) {
|
|
13779
|
+
debugLogger.warn(
|
|
13780
|
+
"Policy engine missing. Denying tool confirmation request."
|
|
13781
|
+
);
|
|
13782
|
+
await messageBus.publish({
|
|
13783
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13784
|
+
correlationId: request.correlationId,
|
|
13785
|
+
confirmed: false,
|
|
13786
|
+
requiresUserConfirmation: false
|
|
13787
|
+
});
|
|
13788
|
+
return;
|
|
13789
|
+
}
|
|
13790
|
+
const toolName = request.toolCall.name?.trim();
|
|
13791
|
+
if (!toolName) {
|
|
13792
|
+
debugLogger.warn(
|
|
13793
|
+
"Tool confirmation request missing tool name. Denying."
|
|
13794
|
+
);
|
|
13795
|
+
await messageBus.publish({
|
|
13796
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13797
|
+
correlationId: request.correlationId,
|
|
13798
|
+
confirmed: false,
|
|
13799
|
+
requiresUserConfirmation: false
|
|
13800
|
+
});
|
|
13801
|
+
return;
|
|
13802
|
+
}
|
|
13803
|
+
const tool = this.context.toolRegistry.getTool(toolName);
|
|
13804
|
+
if (!tool) {
|
|
13805
|
+
debugLogger.warn(
|
|
13806
|
+
`Tool confirmation request for unknown tool: ${toolName}. Denying.`
|
|
13807
|
+
);
|
|
13808
|
+
await messageBus.publish({
|
|
13809
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13810
|
+
correlationId: request.correlationId,
|
|
13811
|
+
confirmed: false,
|
|
13812
|
+
requiresUserConfirmation: false
|
|
13813
|
+
});
|
|
13814
|
+
return;
|
|
13815
|
+
}
|
|
13816
|
+
const serverName = tool instanceof DiscoveredMCPTool ? tool.serverName : void 0;
|
|
13817
|
+
const toolAnnotations = tool.toolAnnotations;
|
|
13818
|
+
const result = await policyEngine.check(
|
|
13819
|
+
request.toolCall,
|
|
13820
|
+
serverName,
|
|
13821
|
+
toolAnnotations,
|
|
13822
|
+
request.subagent
|
|
13823
|
+
);
|
|
13824
|
+
await messageBus.publish({
|
|
13825
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13826
|
+
correlationId: request.correlationId,
|
|
13827
|
+
confirmed: result.decision === PolicyDecision.ALLOW,
|
|
13828
|
+
requiresUserConfirmation: result.decision === PolicyDecision.ASK_USER
|
|
13829
|
+
});
|
|
13830
|
+
} catch (error) {
|
|
13831
|
+
debugLogger.error("Error handling tool confirmation request:", error);
|
|
13832
|
+
await this.context.config.getMessageBus()?.publish({
|
|
13833
|
+
type: MessageBusType.TOOL_CONFIRMATION_RESPONSE,
|
|
13834
|
+
correlationId: request.correlationId,
|
|
13835
|
+
confirmed: false,
|
|
13836
|
+
requiresUserConfirmation: false
|
|
13837
|
+
});
|
|
13838
|
+
}
|
|
13839
|
+
};
|
|
13771
13840
|
handleApprovalModeChanged = (payload) => {
|
|
13772
13841
|
if (payload.sessionId === this.id) {
|
|
13773
13842
|
void this.sendUpdate({
|
|
@@ -13784,6 +13853,7 @@ var Session = class {
|
|
|
13784
13853
|
CoreEvent.ApprovalModeChanged,
|
|
13785
13854
|
this.handleApprovalModeChanged
|
|
13786
13855
|
);
|
|
13856
|
+
this.disposeController.abort();
|
|
13787
13857
|
}
|
|
13788
13858
|
async cancelPendingPrompt() {
|
|
13789
13859
|
if (!this.pendingPrompt) {
|
|
@@ -14193,12 +14263,6 @@ ${event.value.description}`;
|
|
|
14193
14263
|
const invocation = tool.build(args);
|
|
14194
14264
|
const displayTitle = typeof invocation.getDisplayTitle === "function" ? invocation.getDisplayTitle() : invocation.getDescription();
|
|
14195
14265
|
const explanation = typeof invocation.getExplanation === "function" ? invocation.getExplanation() : "";
|
|
14196
|
-
if (explanation) {
|
|
14197
|
-
await this.sendUpdate({
|
|
14198
|
-
sessionUpdate: "agent_thought_chunk",
|
|
14199
|
-
content: { type: "text", text: explanation }
|
|
14200
|
-
});
|
|
14201
|
-
}
|
|
14202
14266
|
const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
14203
14267
|
if (confirmationDetails) {
|
|
14204
14268
|
const content2 = [];
|
|
@@ -14213,6 +14277,12 @@ ${event.value.description}`;
|
|
|
14213
14277
|
}
|
|
14214
14278
|
});
|
|
14215
14279
|
}
|
|
14280
|
+
if (content2.length === 0 && explanation) {
|
|
14281
|
+
content2.push({
|
|
14282
|
+
type: "content",
|
|
14283
|
+
content: { type: "text", text: explanation }
|
|
14284
|
+
});
|
|
14285
|
+
}
|
|
14216
14286
|
const params = {
|
|
14217
14287
|
sessionId: this.id,
|
|
14218
14288
|
options: toPermissionOptions(
|
|
@@ -14261,6 +14331,12 @@ ${event.value.description}`;
|
|
|
14261
14331
|
}
|
|
14262
14332
|
} else {
|
|
14263
14333
|
const content2 = [];
|
|
14334
|
+
if (explanation) {
|
|
14335
|
+
content2.push({
|
|
14336
|
+
type: "content",
|
|
14337
|
+
content: { type: "text", text: explanation }
|
|
14338
|
+
});
|
|
14339
|
+
}
|
|
14264
14340
|
await this.sendUpdate({
|
|
14265
14341
|
sessionUpdate: "tool_call",
|
|
14266
14342
|
toolCallId: callId,
|
|
@@ -14442,89 +14518,103 @@ ${event.value.description}`;
|
|
|
14442
14518
|
let currentPathSpec = pathName;
|
|
14443
14519
|
let resolvedSuccessfully = false;
|
|
14444
14520
|
let readDirectly = false;
|
|
14445
|
-
|
|
14446
|
-
|
|
14521
|
+
const result = await resolveAtCommandPath(
|
|
14522
|
+
pathName,
|
|
14523
|
+
this.context.config,
|
|
14524
|
+
(msg) => this.debug(msg)
|
|
14525
|
+
);
|
|
14526
|
+
let validationError = null;
|
|
14527
|
+
let absolutePath;
|
|
14528
|
+
let resolved;
|
|
14529
|
+
if (result.status === "resolved") {
|
|
14530
|
+
resolved = result.resolved;
|
|
14531
|
+
absolutePath = resolved.absolutePath;
|
|
14532
|
+
} else if (result.status === "unauthorized") {
|
|
14533
|
+
absolutePath = result.absolutePath;
|
|
14534
|
+
validationError = result.error;
|
|
14535
|
+
} else if (result.status === "invalid") {
|
|
14536
|
+
continue;
|
|
14537
|
+
} else {
|
|
14538
|
+
absolutePath = path12.resolve(
|
|
14447
14539
|
this.context.config.getTargetDir(),
|
|
14448
14540
|
pathName
|
|
14449
14541
|
);
|
|
14450
|
-
|
|
14451
|
-
|
|
14452
|
-
|
|
14453
|
-
|
|
14454
|
-
|
|
14455
|
-
|
|
14456
|
-
const
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14462
|
-
|
|
14463
|
-
|
|
14464
|
-
|
|
14465
|
-
|
|
14466
|
-
|
|
14542
|
+
}
|
|
14543
|
+
if (!resolved && validationError && !isWithinRoot(absolutePath, this.context.config.getTargetDir())) {
|
|
14544
|
+
try {
|
|
14545
|
+
const stats = await fs12.stat(absolutePath);
|
|
14546
|
+
if (stats.isFile()) {
|
|
14547
|
+
const syntheticCallId = `resolve-prompt-${pathName}-${randomUUID()}`;
|
|
14548
|
+
const params = {
|
|
14549
|
+
sessionId: this.id,
|
|
14550
|
+
options: [
|
|
14551
|
+
{
|
|
14552
|
+
optionId: ToolConfirmationOutcome.ProceedOnce,
|
|
14553
|
+
name: "Allow once",
|
|
14554
|
+
kind: "allow_once"
|
|
14555
|
+
},
|
|
14556
|
+
{
|
|
14557
|
+
optionId: ToolConfirmationOutcome.Cancel,
|
|
14558
|
+
name: "Deny",
|
|
14559
|
+
kind: "reject_once"
|
|
14560
|
+
}
|
|
14561
|
+
],
|
|
14562
|
+
toolCall: {
|
|
14563
|
+
toolCallId: syntheticCallId,
|
|
14564
|
+
status: "pending",
|
|
14565
|
+
title: `Allow access to absolute path: ${pathName}`,
|
|
14566
|
+
content: [
|
|
14467
14567
|
{
|
|
14468
|
-
|
|
14469
|
-
|
|
14470
|
-
|
|
14568
|
+
type: "content",
|
|
14569
|
+
content: {
|
|
14570
|
+
type: "text",
|
|
14571
|
+
text: `The Agent needs access to read an attached file outside your workspace: ${pathName}`
|
|
14572
|
+
}
|
|
14471
14573
|
}
|
|
14472
14574
|
],
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
status: "pending",
|
|
14476
|
-
title: `Allow access to absolute path: ${pathName}`,
|
|
14477
|
-
content: [
|
|
14478
|
-
{
|
|
14479
|
-
type: "content",
|
|
14480
|
-
content: {
|
|
14481
|
-
type: "text",
|
|
14482
|
-
text: `The Agent needs access to read an attached file outside your workspace: ${pathName}`
|
|
14483
|
-
}
|
|
14484
|
-
}
|
|
14485
|
-
],
|
|
14486
|
-
locations: [],
|
|
14487
|
-
kind: "read"
|
|
14488
|
-
}
|
|
14489
|
-
};
|
|
14490
|
-
const output = RequestPermissionResponseSchema.parse(
|
|
14491
|
-
await this.connection.requestPermission(params)
|
|
14492
|
-
);
|
|
14493
|
-
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14494
|
-
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14495
|
-
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14496
|
-
validationError = null;
|
|
14497
|
-
} else {
|
|
14498
|
-
this.debug(
|
|
14499
|
-
`Direct read authorization denied for absolute path ${pathName}`
|
|
14500
|
-
);
|
|
14501
|
-
directContents.push({
|
|
14502
|
-
spec: pathName,
|
|
14503
|
-
content: `[Warning: Access to absolute path \`${pathName}\` denied by user.]`
|
|
14504
|
-
});
|
|
14505
|
-
continue;
|
|
14575
|
+
locations: [],
|
|
14576
|
+
kind: "read"
|
|
14506
14577
|
}
|
|
14507
|
-
}
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
`Failed to request permission for absolute attachment ${pathName}: ${getErrorMessage(error)}`
|
|
14578
|
+
};
|
|
14579
|
+
const output = RequestPermissionResponseSchema.parse(
|
|
14580
|
+
await this.connection.requestPermission(params)
|
|
14511
14581
|
);
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14582
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
14583
|
+
if (outcome === ToolConfirmationOutcome.ProceedOnce) {
|
|
14584
|
+
this.context.config.getWorkspaceContext().addReadOnlyPath(absolutePath);
|
|
14585
|
+
validationError = null;
|
|
14586
|
+
} else {
|
|
14587
|
+
this.debug(
|
|
14588
|
+
`Direct read authorization denied for absolute path ${pathName}`
|
|
14589
|
+
);
|
|
14590
|
+
directContents.push({
|
|
14591
|
+
spec: pathName,
|
|
14592
|
+
content: `[Warning: Access to absolute path \`${pathName}\` denied by user.]`
|
|
14593
|
+
});
|
|
14594
|
+
continue;
|
|
14595
|
+
}
|
|
14519
14596
|
}
|
|
14597
|
+
} catch (error) {
|
|
14598
|
+
this.debug(
|
|
14599
|
+
`Failed to request permission for absolute attachment ${pathName}: ${getErrorMessage(error)}`
|
|
14600
|
+
);
|
|
14601
|
+
await this.sendUpdate({
|
|
14602
|
+
sessionUpdate: "agent_thought_chunk",
|
|
14603
|
+
content: {
|
|
14604
|
+
type: "text",
|
|
14605
|
+
text: `Warning: Failed to display permission dialog for \`${absolutePath}\`. Error: ${getErrorMessage(error)}`
|
|
14606
|
+
}
|
|
14607
|
+
});
|
|
14520
14608
|
}
|
|
14609
|
+
}
|
|
14610
|
+
try {
|
|
14521
14611
|
if (!validationError) {
|
|
14522
14612
|
if ((path12.isAbsolute(pathName) || !isWithinRoot(
|
|
14523
14613
|
absolutePath,
|
|
14524
14614
|
this.context.config.getTargetDir()
|
|
14525
14615
|
)) && !readDirectly) {
|
|
14526
14616
|
try {
|
|
14527
|
-
const stats = await fs12.stat(absolutePath);
|
|
14617
|
+
const stats = resolved ? resolved.stats : await fs12.stat(absolutePath);
|
|
14528
14618
|
if (stats.isFile()) {
|
|
14529
14619
|
const fileReadResult = await processSingleFileContent(
|
|
14530
14620
|
absolutePath,
|
|
@@ -14580,7 +14670,7 @@ ${contentToPush}`;
|
|
|
14580
14670
|
}
|
|
14581
14671
|
}
|
|
14582
14672
|
if (!readDirectly) {
|
|
14583
|
-
const stats = await fs12.stat(absolutePath);
|
|
14673
|
+
const stats = resolved ? resolved.stats : await fs12.stat(absolutePath);
|
|
14584
14674
|
if (stats.isDirectory()) {
|
|
14585
14675
|
currentPathSpec = pathName.endsWith("/") ? `${pathName}**` : `${pathName}/**`;
|
|
14586
14676
|
this.debug(
|
|
@@ -14872,7 +14962,11 @@ var AcpFileSystemService = class {
|
|
|
14872
14962
|
path: filePath,
|
|
14873
14963
|
sessionId: this.sessionId
|
|
14874
14964
|
});
|
|
14875
|
-
|
|
14965
|
+
const content = response.content;
|
|
14966
|
+
if (typeof content !== "string") {
|
|
14967
|
+
throw new Error("content must be a string");
|
|
14968
|
+
}
|
|
14969
|
+
return content;
|
|
14876
14970
|
} catch (err) {
|
|
14877
14971
|
this.normalizeFileSystemError(err);
|
|
14878
14972
|
}
|
|
@@ -14923,7 +15017,7 @@ var AcpSessionManager = class {
|
|
|
14923
15017
|
mcpServers,
|
|
14924
15018
|
loadedSettings
|
|
14925
15019
|
);
|
|
14926
|
-
const authType = loadedSettings.merged.security.auth.selectedType || AuthType.USE_GEMINI;
|
|
15020
|
+
const authType = loadedSettings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : AuthType.USE_GEMINI);
|
|
14927
15021
|
let isAuthenticated = false;
|
|
14928
15022
|
let authErrorMessage = "";
|
|
14929
15023
|
try {
|
|
@@ -15044,7 +15138,7 @@ var AcpSessionManager = class {
|
|
|
15044
15138
|
return response;
|
|
15045
15139
|
}
|
|
15046
15140
|
async initializeSessionConfig(sessionId, cwd, mcpServers, authDetails) {
|
|
15047
|
-
const selectedAuthType = this.settings.merged.security.auth.selectedType;
|
|
15141
|
+
const selectedAuthType = this.settings.merged.security.auth.selectedType || (authDetails.baseUrl || process.env["GOOGLE_GEMINI_BASE_URL"] ? AuthType.GATEWAY : void 0);
|
|
15048
15142
|
if (!selectedAuthType) {
|
|
15049
15143
|
throw RequestError.authRequired();
|
|
15050
15144
|
}
|
|
@@ -15331,7 +15425,7 @@ async function validateNonInteractiveAuth(configuredAuthType, useExternalAuth, n
|
|
|
15331
15425
|
}
|
|
15332
15426
|
const authType = effectiveAuthType;
|
|
15333
15427
|
if (!useExternalAuth) {
|
|
15334
|
-
const err = validateAuthMethod(String(authType));
|
|
15428
|
+
const err = await validateAuthMethod(String(authType));
|
|
15335
15429
|
if (err != null) {
|
|
15336
15430
|
throw new Error(err);
|
|
15337
15431
|
}
|
|
@@ -15357,7 +15451,7 @@ async function relaunchOnExitCode(runner) {
|
|
|
15357
15451
|
while (true) {
|
|
15358
15452
|
try {
|
|
15359
15453
|
const exitCode = await runner();
|
|
15360
|
-
if (exitCode !== RELAUNCH_EXIT_CODE) {
|
|
15454
|
+
if (process.platform === "android" || exitCode !== RELAUNCH_EXIT_CODE) {
|
|
15361
15455
|
process.exit(exitCode);
|
|
15362
15456
|
}
|
|
15363
15457
|
} catch (error) {
|
|
@@ -15430,8 +15524,7 @@ async function deleteSession(config, sessionIndex) {
|
|
|
15430
15524
|
return;
|
|
15431
15525
|
}
|
|
15432
15526
|
try {
|
|
15433
|
-
|
|
15434
|
-
await chatRecordingService.deleteSession(sessionToDelete.file);
|
|
15527
|
+
await deleteStoredSession(config, sessionToDelete.file);
|
|
15435
15528
|
const time = formatRelativeTime(sessionToDelete.lastUpdated);
|
|
15436
15529
|
writeToStdout(
|
|
15437
15530
|
`Deleted session ${sessionToDelete.index}: ${sessionToDelete.firstUserMessage} (${time})`
|
|
@@ -15720,13 +15813,69 @@ ${reason.stack}` : ""}`;
|
|
|
15720
15813
|
}
|
|
15721
15814
|
});
|
|
15722
15815
|
}
|
|
15723
|
-
async function resolveSessionId(resumeArg, sessionIdArg) {
|
|
15724
|
-
if (!resumeArg && !sessionIdArg) {
|
|
15816
|
+
async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
|
|
15817
|
+
if (!resumeArg && !sessionIdArg && !sessionFileArg) {
|
|
15725
15818
|
return { sessionId: createSessionId() };
|
|
15726
15819
|
}
|
|
15727
15820
|
const storage = new Storage(process.cwd());
|
|
15728
15821
|
await storage.initialize();
|
|
15729
15822
|
const sessionSelector = new SessionSelector(storage);
|
|
15823
|
+
if (sessionFileArg) {
|
|
15824
|
+
try {
|
|
15825
|
+
const sessionData = await loadConversationRecord(sessionFileArg);
|
|
15826
|
+
if (!sessionData) {
|
|
15827
|
+
throw new Error(`File not found or invalid format: ${sessionFileArg}`);
|
|
15828
|
+
}
|
|
15829
|
+
const now = Date.now();
|
|
15830
|
+
const isoNow = new Date(now).toISOString();
|
|
15831
|
+
sessionData.messages = (sessionData.messages || []).filter(
|
|
15832
|
+
(m) => typeof m === "object" && m !== null && (m.type === "user" || m.type === "gemini") && m.content !== void 0
|
|
15833
|
+
);
|
|
15834
|
+
sessionData.messages.unshift({
|
|
15835
|
+
id: `import-${now}`,
|
|
15836
|
+
type: "info",
|
|
15837
|
+
content: `Imported session from ${sessionFileArg}`,
|
|
15838
|
+
timestamp: isoNow
|
|
15839
|
+
});
|
|
15840
|
+
const newSessionId = createSessionId();
|
|
15841
|
+
sessionData.sessionId = newSessionId;
|
|
15842
|
+
sessionData.projectHash = getProjectHash(storage.getProjectRoot());
|
|
15843
|
+
sessionData.startTime = isoNow;
|
|
15844
|
+
sessionData.lastUpdated = isoNow;
|
|
15845
|
+
const chatsDir = path15.join(storage.getProjectTempDir(), "chats");
|
|
15846
|
+
const newSessionPath = path15.join(
|
|
15847
|
+
chatsDir,
|
|
15848
|
+
`session-${now}-${newSessionId.slice(0, 8)}.jsonl`
|
|
15849
|
+
);
|
|
15850
|
+
const { messages: _messages, ...initialMetadata } = sessionData;
|
|
15851
|
+
const lines = [JSON.stringify(initialMetadata)];
|
|
15852
|
+
if (sessionData.messages) {
|
|
15853
|
+
for (const msg of sessionData.messages) {
|
|
15854
|
+
lines.push(JSON.stringify(msg));
|
|
15855
|
+
}
|
|
15856
|
+
}
|
|
15857
|
+
await fsPromises.mkdir(chatsDir, { recursive: true });
|
|
15858
|
+
await fsPromises.writeFile(
|
|
15859
|
+
newSessionPath,
|
|
15860
|
+
lines.join("\n") + "\n",
|
|
15861
|
+
"utf-8"
|
|
15862
|
+
);
|
|
15863
|
+
return {
|
|
15864
|
+
sessionId: newSessionId,
|
|
15865
|
+
resumedSessionData: {
|
|
15866
|
+
conversation: sessionData,
|
|
15867
|
+
filePath: newSessionPath
|
|
15868
|
+
}
|
|
15869
|
+
};
|
|
15870
|
+
} catch (error) {
|
|
15871
|
+
coreEvents.emitFeedback(
|
|
15872
|
+
"error",
|
|
15873
|
+
`Error importing session from file: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
15874
|
+
);
|
|
15875
|
+
await runExitCleanup();
|
|
15876
|
+
process.exit(ExitCodes.FATAL_INPUT_ERROR);
|
|
15877
|
+
}
|
|
15878
|
+
}
|
|
15730
15879
|
if (sessionIdArg) {
|
|
15731
15880
|
if (await sessionSelector.sessionExists(sessionIdArg)) {
|
|
15732
15881
|
coreEvents.emitFeedback(
|
|
@@ -15748,8 +15897,10 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
|
|
|
15748
15897
|
};
|
|
15749
15898
|
} catch (error) {
|
|
15750
15899
|
if (error instanceof SessionError && error.code === "NO_SESSIONS_FOUND") {
|
|
15751
|
-
|
|
15752
|
-
|
|
15900
|
+
if (resumeArg === RESUME_LATEST) {
|
|
15901
|
+
coreEvents.emitFeedback("warning", error.message);
|
|
15902
|
+
return { sessionId: createSessionId() };
|
|
15903
|
+
}
|
|
15753
15904
|
}
|
|
15754
15905
|
coreEvents.emitFeedback(
|
|
15755
15906
|
"error",
|
|
@@ -15760,7 +15911,7 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
|
|
|
15760
15911
|
}
|
|
15761
15912
|
}
|
|
15762
15913
|
async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
|
|
15763
|
-
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-
|
|
15914
|
+
const { startInteractiveUI: doStartUI } = await import("./interactiveCli-MEEXSI2X.js");
|
|
15764
15915
|
await doStartUI(
|
|
15765
15916
|
config,
|
|
15766
15917
|
settings,
|
|
@@ -15823,7 +15974,8 @@ async function main() {
|
|
|
15823
15974
|
const argv = await argvPromise;
|
|
15824
15975
|
const { sessionId, resumedSessionData } = await resolveSessionId(
|
|
15825
15976
|
argv.resume,
|
|
15826
|
-
argv.sessionId
|
|
15977
|
+
argv.sessionId,
|
|
15978
|
+
argv.sessionFile
|
|
15827
15979
|
);
|
|
15828
15980
|
if (argv.allowedTools && argv.allowedTools.length > 0 || settings.merged.tools?.allowed && settings.merged.tools.allowed.length > 0) {
|
|
15829
15981
|
coreEvents.emitFeedback(
|
|
@@ -15874,14 +16026,14 @@ async function main() {
|
|
|
15874
16026
|
const partialConfig = await loadCliConfig(settings.merged, sessionId, argv, {
|
|
15875
16027
|
projectHooks: settings.workspace.settings.hooks,
|
|
15876
16028
|
skipExtensions: true,
|
|
15877
|
-
|
|
16029
|
+
loadedSettings: settings
|
|
15878
16030
|
});
|
|
15879
16031
|
adminControlsListner.setConfig(partialConfig);
|
|
15880
16032
|
let initialAuthFailed = false;
|
|
15881
16033
|
if (!settings.merged.security.auth.useExternal && !argv.isCommand) {
|
|
15882
16034
|
try {
|
|
15883
16035
|
if (partialConfig.isInteractive() && settings.merged.security.auth.selectedType) {
|
|
15884
|
-
const err = validateAuthMethod(
|
|
16036
|
+
const err = await validateAuthMethod(
|
|
15885
16037
|
settings.merged.security.auth.selectedType
|
|
15886
16038
|
);
|
|
15887
16039
|
if (err) {
|
|
@@ -15961,13 +16113,14 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
15961
16113
|
const loadConfigHandle = startupProfiler.start("load_cli_config");
|
|
15962
16114
|
config = await loadCliConfig(settings.merged, sessionId, argv, {
|
|
15963
16115
|
projectHooks: settings.workspace.settings.hooks,
|
|
15964
|
-
worktreeSettings: worktreeInfo
|
|
16116
|
+
worktreeSettings: worktreeInfo,
|
|
16117
|
+
loadedSettings: settings
|
|
15965
16118
|
});
|
|
15966
16119
|
loadConfigHandle?.end();
|
|
15967
16120
|
await config.storage.initialize();
|
|
15968
16121
|
adminControlsListner.setConfig(config);
|
|
15969
16122
|
if (config.isInteractive() && settings.merged.general.devtools) {
|
|
15970
|
-
const { setupInitialActivityLogger } = await import("./devtoolsService-
|
|
16123
|
+
const { setupInitialActivityLogger } = await import("./devtoolsService-EVM2JJLB.js");
|
|
15971
16124
|
setupInitialActivityLogger(config);
|
|
15972
16125
|
}
|
|
15973
16126
|
registerTelemetryConfig(config);
|
|
@@ -16026,7 +16179,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
16026
16179
|
const initAppHandle = startupProfiler.start("initialize_app");
|
|
16027
16180
|
const initializationResult = await initializeApp(config, settings);
|
|
16028
16181
|
initAppHandle?.end();
|
|
16029
|
-
import("./liteRtServerManager-
|
|
16182
|
+
import("./liteRtServerManager-3EZO3JZ5.js").then(({ LiteRtServerManager }) => {
|
|
16030
16183
|
const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
|
|
16031
16184
|
if (!mergedGemma) return;
|
|
16032
16185
|
const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;
|