feat: gate memfs on self-hosted behind LETTA_MEMFS_LOCAL env var (#1036)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Kevin Lin
2026-02-19 11:49:02 -08:00
committed by GitHub
parent 3655429549
commit 9920b3a42d

View File

@@ -167,10 +167,13 @@ export async function applyMemfsFlags(
const { getServerUrl } = await import("./client");
const { settingsManager } = await import("../settings-manager");
// 1. Validate explicit enable on supported backend.
// Validate explicit enable on supported backend.
if (memfsFlag) {
const serverUrl = getServerUrl();
if (!serverUrl.includes("api.letta.com")) {
if (
!serverUrl.includes("api.letta.com") &&
process.env.LETTA_MEMFS_LOCAL !== "1"
) {
throw new Error(
"--memfs is only available on Letta Cloud (api.letta.com).",
);
@@ -236,7 +239,11 @@ export async function applyMemfsFlags(
export async function enableMemfsIfCloud(agentId: string): Promise<void> {
const { getServerUrl } = await import("./client");
const serverUrl = getServerUrl();
if (!serverUrl.includes("api.letta.com")) return;
if (
!serverUrl.includes("api.letta.com") &&
process.env.LETTA_MEMFS_LOCAL !== "1"
)
return;
try {
await applyMemfsFlags(agentId, true, undefined);