Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(feature-flags): introduce internal view mode and related components (#17816)

marliessophie9104c9c02959
diff --git a/web/AGENTS.md b/web/AGENTS.md
index e671a44ddb..de2e52ce15 100644
--- a/web/AGENTS.md
+++ b/web/AGENTS.md
@@ -301,6 +301,8 @@ Sentry instrumentation skill first and decide whether it should capture at all
## Package-Specific Rules
+- Internal-only UI features use `useInternalFeaturesEnabled()` and the shared orange `InternalFeatureBadge`; do not add per-feature internal flags.
+
- Router style is Pages Router-centric; follow existing routing patterns.
- In `src/pages`, do not keep both `foo.ts(x)` and a `foo/` folder. If the
folder exists, put the route implementation in `foo/index.ts(x)` instead.
diff --git a/web/src/__tests__/server/userAccount.servertest.ts b/web/src/__tests__/server/userAccount.servertest.ts
index 8a15f96cfa..fd4e40148e 100644
--- a/web/src/__tests__/server/userAccount.servertest.ts
+++ b/web/src/__tests__/server/userAccount.servertest.ts
@@ -8,7 +8,10 @@ import { prisma } from "@langfuse/shared/src/db";
import { env } from "@/src/env.mjs";
import { appRouter } from "@/src/server/api/root";
import { createInnerTRPCContext } from "@/src/server/api/trpc";
-import { getFeaturePreviewOptOutFlag } from "@/src/features/feature-flags/server";
+import {
+ getFeaturePreviewOptOutFlag,
+ INTERNAL_FEATURE_FLAG,
+} from "@/src/features/feature-flags/server";
import { getSessionLoginAt } from "@/src/features/auth/lib/sessionExpiration";
import { getAuthOptions } from "@/src/server/auth";
@@ -105,6 +108,47 @@ describe("userAccountRouter.setFeaturePreviewEnabled", () => {
});
});
+describe("userAccountRouter.setViewMode", () => {
+ const testEnv = env as {
+ LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES: typeof env.LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES;
+ };
+ const originalExperimental = env.LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES;
+ beforeEach(() => {
+ testEnv.LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES = "false";
+ });
+ afterEach(() => {
+ testEnv.LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES = originalExperimental;
+ });
+
+ it("persists only the external override and preserves other preferences", async () => {
+ const { caller, userId } = await createCaller({
+ admin: true,
+ featureFlags: ["modernSession"],
+ });
+ await caller.userAccount.setViewMode({ mode: "EXTERNAL" });
+ await caller.userAccount.setViewMode({ mode: "EXTERNAL" });
+ expect(
+ (await prisma.user.findUniqueOrThrow({ where: { id: userId } }))
+ .featureFlags,
+ ).toEqual([
+ "modernSession",
+ getFeaturePreviewOptOutFlag(INTERNAL_FEATURE_FLAG),
+ ]);
+ await caller.userAccount.setViewMode({ mode: "INTERNAL" });
+ expect(
+ (await prisma.user.findUniqueOrThrow({ where: { id: userId } }))
+ .featureFlags,
+ ).toEqual(["modernSession"]);
+ });
+
+ it("does not allow ordinary users to select internal mode", async () => {
+ const { caller } = await createCaller();
+ await expect(
+ caller.userAccount.setViewMode({ mode: "INTERNAL" }),
+ ).rejects.toMatchObject({ code: "PRECONDITION_FAILED" });
+ });
+});
+
describe("userAccountRouter.signOutAllSessions", () => {
it("advances the user's session revocation timestamp", async () => {
const { caller, userId } = await createCaller();
@@ -156,6 +200,7 @@ async function createCaller({
featureFlags = ["templateFlag"],
includeProjectInSession = true,
emailDomain = "example.com",
+ admin = false,
}: {
plan?: Plan;
aiFeaturesEnabled?: boolean;
@@ -164,6 +209,7 @@ async function createCaller({
// Domain only — the local part is always unique so reruns against the same
// database do not trip the users.email unique constraint.
emailDomain?: string;
+ admin?: boolean;
} = {}) {
const id = randomUUID();
const orgId = `org-${id}`;
@@ -232,7 +278,7 @@ async function createCaller({
searchBar: featureFlags.includes("searchBar"),
templateFlag: featureFlags.includes("templateFlag"),
}),
- admin: false,
+ admin,
},
environment: {
enableExperimentalFeatures: false,
diff --git a/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx b/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx
index defef83ed1..5cc8fc135a 100644
--- a/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx
+++ b/web/src/components/layouts/app-layout/variants/AuthenticatedLayout.tsx
@@ -11,6 +11,10 @@ import {
type PropsWithChildren,
} from "react";
import Head from "next/head";
+import {
+ useInternalViewMode,
+ InternalViewModeDialog,
+} from "@/src/features/feature-flags/internal-view-mode";
import { useRouter, type NextRouter } from "next/router";
import {
SidebarProvider,
@@ -121,6 +125,8 @@ export function AuthenticatedLayout({
}: AuthenticatedLayoutProps) {
const { isLangfuseCloud, region: currentRegion } = useLangfuseCloudRegion();
const [featurePreviewOpen, setFeaturePreviewOpen] = useState(false);
+ const [internalViewModeOpen, setInternalViewModeOpen] = useState(false);
+ const internalViewMode = useInternalViewMode();
const router = useRouter();
useProjectCookie(router);
const uiCustomization = useUiCustomization();
@@ -173,6 +179,15 @@ export function AuthenticatedLayout({
avatar: user.image ?? "",
};
const userMenuItems = [
+ ...(internalViewMode.available
+ ? [
+ {
+ type: "action" as const,
+ name: "View mode",
+ onClick: () => setInternalViewModeOpen(true),
+ },
+ ]
+ : []),
{
type: "link" as const,
name: "Account Settings",
@@ -327,6 +342,12 @@ export function AuthenticatedLayout({
<InAppAgentWindowHost />
</SidebarInset>
</div>
+ {internalViewMode.available && (
+ <InternalViewModeDialog
+ open={internalViewModeOpen}
+ onOpenChange={setInternalViewModeOpen}
+ />
+ )}
{hasFeaturePreviews ? (
<ControlledFeaturePreviewModal
open={featurePreviewOpen}
diff --git a/web/src/features/feature-flags/available-flags.ts b/web/src/features/feature-flags/available-flags.ts
index 321d6b3c86..5c3c27db7e 100644
--- a/web/src/features/feature-flags/available-flags.ts
+++ b/web/src/features/feature-flags/available-flags.ts
@@ -15,16 +15,16 @@ export const isRestrictedFlag = (flag: string): flag is RestrictedFlag =>
restrictedFlags.some((restrictedFlag) => restrictedFlag === flag);
/**
- * Flags for Langfuse-internal surfaces. They are on for Langfuse admins and
- * for deployments with experimental features enabled, and for nobody else:
- * they are not feature previews, cannot be granted, and are never persisted.
+ * Internal surfaces share one user preference, separate from customer previews.
+ * The preference never grants access to users without internal eligibility.
*/
-const internalFlags = ["traceMessages"] as const;
+export const INTERNAL_FEATURE_FLAG = "internalFeatures" as const;
-type InternalFlag = (typeof internalFlags)[number];
+export type UserFeatureFlag = FeaturePreviewFlag | typeof INTERNAL_FEATURE_FLAG;
-export const isInternalFlag = (flag: string): flag is InternalFlag =>
- internalFlags.some((internalFlag) => internalFlag === flag);
+export const isInternalFlag = (
+ flag: string,
+): flag is typeof INTERNAL_FEATURE_FLAG => flag === INTERNAL_FEATURE_FLAG;
export const isFeaturePreviewFlag = (
flag: string,
@@ -58,7 +58,7 @@ export const isFeaturePreviewAvailable = (
export const availableFlags = [
...featurePreviewFlags,
...restrictedFlags,
- ...internalFlags,
+ INTERNAL_FEATURE_FLAG,
"searchBar",
"templateFlag",
"excludeClickhouseRead",
diff --git a/web/src/features/feature-flags/components/InternalFeatureBadge.tsx b/web/src/features/feature-flags/components/InternalFeatureBadge.tsx
new file mode 100644
index 0000000000..550d0f71c3
--- /dev/null
+++ b/web/src/features/feature-flags/components/InternalFeatureBadge.tsx
@@ -0,0 +1,12 @@
+import { Badge } from "@/src/components/ui/badge";
+
+export function InternalFeatureBadge() {
+ return (
+ <Badge
+ variant="outline"
+ className="shrink-0 border-orange-300 bg-orange-100 text-orange-800 dark:border-orange-500/50 dark:bg-orange-500/20 dark:text-orange-300"
+ >
+ Internal
+ </Badge>
+ );
+}
diff --git a/web/src/features/feature-flags/components/InternalViewModeDialog.tsx b/web/src/features/feature-flags/components/InternalViewModeDialog.tsx
new file mode 100644
index 0000000000..9e5b7befd9
--- /dev/null
+++ b/web/src/features/feature-flags/components/InternalViewModeDialog.tsx
@@ -0,0 +1,60 @@
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+ DialogDescription,
+ DialogBody,
+ DialogFooter,
+ DialogClose,
+} from "@/src/components/ui/dialog";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
+import { Button } from "@/src/components/ui/button";
+import { useInternalViewMode } from "../hooks/useInternalViewMode";
+
+export function InternalViewModeDialog({
+ open,
+ onOpenChange,
+}: {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+}) {
+ const viewMode = useInternalViewMode();
+ return (
+ <Dialog open={open} onOpenChange={onOpenChange}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>View mode</DialogTitle>
+ </DialogHeader>
+ <DialogBody>
+ <DialogDescription className="m-0 leading-relaxed">
+ Internal view includes unreleased features for the Langfuse team.
+ Switch it off for the external view. Permissions and feature preview
+ settings stay unchanged.
+ </DialogDescription>
+ <div className="flex items-center gap-4 py-2">
+ <label
+ htmlFor="internal-view-mode"
+ className="flex cursor-pointer items-center gap-2 text-sm"
+ >
+ Internal view
+ </label>
+ <Switch
+ id="internal-view-mode"
+ checked={viewMode.mode === "INTERNAL"}
+ disabled={viewMode.saving}
+ onCheckedChange={(enabled) =>
+ viewMode.setMode(enabled ? "INTERNAL" : "EXTERNAL")
+ }
+ />
+ </div>
+ </DialogBody>
+ <DialogFooter className="p-4">
+ <DialogClose asChild>
+ <Button variant="ghost">Close</Button>
+ </DialogClose>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+}
diff --git a/web/src/features/feature-flags/hooks/useInternalFeaturesEnabled.ts b/web/src/features/feature-flags/hooks/useInternalFeaturesEnabled.ts
new file mode 100644
index 0000000000..c0b948fee7
--- /dev/null
+++ b/web/src/features/feature-flags/hooks/useInternalFeaturesEnabled.ts
@@ -0,0 +1,6 @@
+import useIsFeatureEnabled from "./useIsFeatureEnabled";
+import { INTERNAL_FEATURE_FLAG } from "../available-flags";
+
+export function useInternalFeaturesEnabled() {
+ return useIsFeatureEnabled(INTERNAL_FEATURE_FLAG);
+}
diff --git a/web/src/features/feature-flags/hooks/useInternalViewMode.ts b/web/src/features/feature-flags/hooks/useInternalViewMode.ts
new file mode 100644
index 0000000000..09db351c27
--- /dev/null
+++ b/web/src/features/feature-flags/hooks/useInternalViewMode.ts
@@ -0,0 +1,33 @@
+import { useSession } from "next-auth/react";
+import { api } from "@/src/utils/api";
+import { showErrorToast } from "@/src/features/notifications";
+import { hasInternalAccess } from "../utils";
+import { useInternalFeaturesEnabled } from "./useInternalFeaturesEnabled";
+
+export function useInternalViewMode() {
+ const session = useSession();
+ const enabled = useInternalFeaturesEnabled();
+ const available = hasInternalAccess({
+ isAdmin: session.data?.user?.admin === true,
+ isExperimentalFeaturesEnabled:
+ session.data?.environment.enableExperimentalFeatures === true,
+ });
+ const mutation = api.userAccount.setViewMode.useMutation({
+ onSuccess: async () => {
+ await session.update();
+ },
+ onError: (error) =>
+ showErrorToast("Failed to update view mode", error.message),
+ });
+ const mode = enabled ? "INTERNAL" : "EXTERNAL";
+ return {
+ available,
+ mode,
+ saving: mutation.isPending,
+ setMode: (nextMode: "INTERNAL" | "EXTERNAL") => {
+ if (available && !mutation.isPending && nextMode !== mode) {
+ mutation.mutate({ mode: nextMode });
+ }
+ },
+ };
+}
diff --git a/web/src/features/feature-flags/hooks/useIsFeatureEnabled.clienttest.ts b/web/src/features/feature-flags/hooks/useIsFeatureEnabled.clienttest.ts
index 5c7bf640ae..3ee44d174a 100644
--- a/web/src/features/feature-flags/hooks/useIsFeatureEnabled.clienttest.ts
+++ b/web/src/features/feature-flags/hooks/useIsFeatureEnabled.clienttest.ts
@@ -3,6 +3,7 @@ import { renderHook } from "@testing-library/react";
import { useSession } from "next-auth/react";
import useIsFeatureEnabled from "./useIsFeatureEnabled";
+import { INTERNAL_FEATURE_FLAG } from "../available-flags";
vi.mock("next-auth/react", () => ({
useSession: vi.fn(),
@@ -12,17 +13,22 @@ const mockSession = ({
aiGateway,
admin = false,
enableExperimentalFeatures = false,
+ internalFeatures,
}: {
aiGateway: boolean;
admin?: boolean;
enableExperimentalFeatures?: boolean;
+ internalFeatures?: boolean;
}) => {
vi.mocked(useSession).mockReturnValue({
data: {
environment: { enableExperimentalFeatures },
user: {
admin,
- featureFlags: testFeatureFlags({ aiGateway: false }),
+ featureFlags: testFeatureFlags({
+ aiGateway: false,
+ [INTERNAL_FEATURE_FLAG]: internalFeatures,
+ }),
organizations: [
{
id: "org-1",
diff --git a/web/src/features/feature-flags/hooks/useIsFeatureEnabled.ts b/web/src/features/feature-flags/hooks/useIsFeatureEnabled.ts
index 9fdf06f811..5bed4ac197 100644
--- a/web/src/features/feature-flags/hooks/useIsFeatureEnabled.ts
+++ b/web/src/features/feature-flags/hooks/useIsFeatureEnabled.ts
@@ -1,5 +1,9 @@
import { useSession } from "next-auth/react";
-import { isInternalFlag, isRestrictedFlag } from "../available-flags";
+import {
+ INTERNAL_FEATURE_FLAG,
+ isInternalFlag,
+ isRestrictedFlag,
+} from "../available-flags";
import type { Flag } from "../types";
import { getContextualFeatureFlags, hasInternalAccess } from "../utils";
@@ -29,7 +33,10 @@ export default function useIsFeatureEnabled(
})?.[feature] ?? false;
if (isInternalFlag(feature)) {
- return hasInternalAccess({ isAdmin, isExperimentalFeaturesEnabled });
+ return (
+ hasInternalAccess({ isAdmin, isExperimentalFeaturesEnabled }) &&
+ session.data?.user?.featureFlags[INTERNAL_FEATURE_FLAG] !== false
+ );
}
if (isRestrictedFlag(feature)) {
diff --git a/web/src/features/feature-flags/index.ts b/web/src/features/feature-flags/index.ts
index e0e0b18ecd..028cfc7091 100644
--- a/web/src/features/feature-flags/index.ts
+++ b/web/src/features/feature-flags/index.ts
@@ -8,6 +8,8 @@
// preview. available-flags is also on the server door for server callers
// (rule 10). Pages stay off this door.
export { default as useIsFeatureEnabled } from "@/src/features/feature-flags/hooks/useIsFeatureEnabled";
+export { useInternalFeaturesEnabled } from "./hooks/useInternalFeaturesEnabled";
+export { InternalFeatureBadge } from "./components/InternalFeatureBadge";
export {
featurePreviewLabels,
type FeaturePreviewFlag,
diff --git a/web/src/features/feature-flags/internal-view-mode.ts b/web/src/features/feature-flags/internal-view-mode.ts
new file mode 100644
index 0000000000..46e12657b4
--- /dev/null
+++ b/web/src/features/feature-flags/internal-view-mode.ts
@@ -0,0 +1,2 @@
+export { useInternalViewMode } from "./hooks/useInternalViewMode";
+export { InternalViewModeDialog } from "./components/InternalViewModeDialog";
diff --git a/web/src/features/feature-flags/server/index.ts b/web/src/features/feature-flags/server/index.ts
index 9638d1aa30..415cae1528 100644
--- a/web/src/features/feature-flags/server/index.ts
+++ b/web/src/features/feature-flags/server/index.ts
@@ -1,6 +1,7 @@
// The feature-flags feature's public server surface (RFC rules 8 and 10).
export {
featurePreviewFlags,
+ INTERNAL_FEATURE_FLAG,
filterFeaturePreviewFlags,
} from "@/src/features/feature-flags/available-flags";
export {
diff --git a/web/src/features/feature-flags/server/organizationFeatureFlags.ts b/web/src/features/feature-flags/server/organizationFeatureFlags.ts
index afb39bd174..07e85d2f77 100644
--- a/web/src/features/feature-flags/server/organizationFeatureFlags.ts
+++ b/web/src/features/feature-flags/server/organizationFeatureFlags.ts
@@ -9,6 +9,8 @@ import {
filterFeaturePreviewFlags,
featurePreviewFlags,
type FeaturePreviewFlag,
+ type UserFeatureFlag,
+ INTERNAL_FEATURE_FLAG,
} from "@/src/features/feature-flags/available-flags";
import {
getFeaturePreviewOptOutFlag,
@@ -36,7 +38,7 @@ type FeaturePreviewOverrideChange = {
const getFeaturePreviewOverrideState = (
flags: string[],
- flag: FeaturePreviewFlag,
+ flag: UserFeatureFlag,
): FeaturePreviewOverrideState => {
if (flags.includes(getFeaturePreviewOptOutFlag(flag))) return "disabled";
if (flags.includes(flag)) return "enabled";
@@ -168,7 +170,7 @@ async function setUserFeaturePreviewInTransaction({
}: {
tx: Prisma.TransactionClient;
userId: string;
- flag: FeaturePreviewFlag;
+ flag: UserFeatureFlag;
enabled: boolean;
}): Promise<FeaturePreviewOverrideChange> {
const rows = await tx.$queryRaw<
@@ -185,7 +187,7 @@ async function setUserFeaturePreviewInTransaction({
const user = rows[0];
if (!user) throw new LangfuseNotFoundError("User not found");
- const affectedFlags: FeaturePreviewFlag[] = [flag];
+ const affectedFlags: UserFeatureFlag[] = [flag];
if (flag === "sessionTimeline" && enabled) {
affectedFlags.push("modernSession");
}
@@ -201,7 +203,10 @@ async function setUserFeaturePreviewInTransaction({
),
);
if (enabled) {
- nextFeatureFlags.push(...affectedFlags);
+ // Internal features default on; only their opt-out needs persistence.
+ nextFeatureFlags.push(
+ ...affectedFlags.filter((flag) => flag !== INTERNAL_FEATURE_FLAG),
+ );
} else {
nextFeatureFlags.push(...affectedFlags.map(getFeaturePreviewOptOutFlag));
}
@@ -232,7 +237,7 @@ export async function setUserFeaturePreview({
}: {
prisma: PrismaClient;
userId: string;
- flag: FeaturePreviewFlag;
+ flag: UserFeatureFlag;
enabled: boolean;
}): Promise<FeaturePreviewOverrideChange> {
return withSerializableRetry(prisma, (tx) =>
diff --git a/web/src/features/feature-flags/types.ts b/web/src/features/feature-flags/types.ts
index 0676770b8a..c39ce01726 100644
--- a/web/src/features/feature-flags/types.ts
+++ b/web/src/features/feature-flags/types.ts
@@ -1,15 +1,21 @@
-import { type availableFlags } from "./available-flags";
+import {
+ type INTERNAL_FEATURE_FLAG,
+ type availableFlags,
+} from "./available-flags";
export type Flag = (typeof availableFlags)[number];
export type Flags = {
[key in Exclude<
Flag,
- "modernSession" | "aiGateway" | "sessionTimeline" | "traceMessages"
+ | "modernSession"
+ | "aiGateway"
+ | "sessionTimeline"
+ | typeof INTERNAL_FEATURE_FLAG
>]: boolean;
} & {
// Optional while older sessions and test fixtures roll across new flags.
modernSession?: boolean;
aiGateway?: boolean;
sessionTimeline?: boolean;
- traceMessages?: boolean;
+ [INTERNAL_FEATURE_FLAG]?: boolean;
};
diff --git a/web/src/features/feature-flags/utils.ts b/web/src/features/feature-flags/utils.ts
index 1e13e30eeb..9efdfa1a82 100644
--- a/web/src/features/feature-flags/utils.ts
+++ b/web/src/features/feature-flags/utils.ts
@@ -7,11 +7,11 @@ import {
isFeaturePreviewFlag,
isFeaturePreviewAvailable,
type FeaturePreviewAvailabilityContext,
- type FeaturePreviewFlag,
+ type UserFeatureFlag,
} from "./available-flags";
import { type Flags } from "./types";
-export const getFeaturePreviewOptOutFlag = (flag: FeaturePreviewFlag) =>
+export const getFeaturePreviewOptOutFlag = (flag: UserFeatureFlag) =>
`feature-preview:${flag}:disabled`;
/**
@@ -52,10 +52,9 @@ export const parseFlags = (
return;
}
- // Internal flags are decided per session by `hasInternalAccess`, never
- // by stored flags.
+ // Stored preference does not grant internal access.
if (isInternalFlag(flag)) {
- parsedFlags[flag] = false;
+ parsedFlags[flag] = !dbFlags.includes(getFeaturePreviewOptOutFlag(flag));
return;
}
diff --git a/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx b/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx
index 8451a7c89a..d70969ebf1 100644
--- a/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx
+++ b/web/src/features/traces/components/ObservationDetailView/ConnectedObservationDetailView.tsx
@@ -45,6 +45,7 @@ import {
useCommentedPaths,
} from "@/src/features/comments";
import { useRouter } from "next/router";
+import { TraceDetailTabMenu } from "../TraceDetailTabMenu";
import { ScoresTable } from "@/src/features/scores";
import { getMostRecentCorrection } from "@/src/features/corrections";
import { useJsonExpansion } from "@/src/features/traces/contexts/JsonExpansionContext";
@@ -78,6 +79,11 @@ import {
import { useHasProjectAccess } from "@/src/features/rbac";
import { useSession } from "next-auth/react";
import { ObservationPreview } from "./ObservationPreview";
+import {
+ InternalFeatureBadge,
+ useInternalFeaturesEnabled,
+} from "@/src/features/feature-flags";
+import { TraceMessagesView } from "../TraceMessagesView/TraceMessagesView";
import { ObservationAttributesTab } from "./ObservationAttributesTab";
import { buildModelParameters } from "@/src/features/traces/fns/buildModelParameters";
import { buildObservationAttributes } from "@/src/features/traces/fns/buildObservationAttributes";
@@ -105,6 +111,8 @@ export function ConnectedObservationDetailView({
// V4 beta mode and observations for log tab
const { isV4: isV4Enabled } = useReadPath();
+ const internalFeaturesEnabled = useInternalFeaturesEnabled();
+ const showMessagesTab = internalFeaturesEnabled && isV4Enabled;
const {
observations,
roots,
@@ -177,11 +185,13 @@ export function ConnectedObservationDetailView({
// "log" is v4-only and needs observations; everything else falls back to preview.
const selectedTab = useMemo(() => {
+ if (globalSelectedTab === "messages" && showMessagesTab)
+ return "messages" as const;
if (globalSelectedTab === "scores") return "scores" as const;
if (globalSelectedTab === "attributes") return "attributes" as const;
if (globalSelectedTab === "log" && showLogViewTab) return "log" as const;
return "preview" as const;
- }, [globalSelectedTab, showLogViewTab]);
+ }, [globalSelectedTab, showLogViewTab, showMessagesTab]);
const refreshTraceScores = useCallback(() => {
utils.traces.byIdWithObservationsAndScores.invalidate({
@@ -374,36 +384,56 @@ export function ConnectedObservationDetailView({
<TabsBar
value={selectedTab}
- className="flex min-h-0 flex-1 flex-col overflow-hidden"
+ className="@container/detailtabs flex min-h-0 flex-1 flex-col overflow-hidden"
onValueChange={(value) => setSelectedTab(value as DetailTab)}
>
<TooltipProvider>
- <TabsBarList>
- <TabsBarTrigger value="preview">Preview</TabsBarTrigger>
- <TabsBarTrigger value="attributes">Attributes</TabsBarTrigger>
- {showScoresTab ? (
- <TabsBarTrigger value="scores">Scores</TabsBarTrigger>
- ) : null}
- {showLogViewTab ? (
- <TabsBarTrigger value="log">
- <Tooltip>
- <TooltipTrigger asChild>
- <span>Log View</span>
- </TooltipTrigger>
- <TooltipContent className="text-xs">
- {isLogViewVirtualized
- ? `Shows all ${observations.length} observations with virtualization enabled.`
- : "Shows all observations concatenated. Great for quickly scanning through them."}
- </TooltipContent>
- </Tooltip>
- </TabsBarTrigger>
- ) : null}
+ <TabsBarList className="shrink-0">
+ <div className="shrink-0 @min-[680px]/detailtabs:hidden">
+ <TraceDetailTabMenu
+ selectedTab={selectedTab}
+ onSelect={setSelectedTab}
+ tabs={[
+ "preview",
+ ...(showMessagesTab ? ["messages" as const] : []),
+ "attributes",
+ ...(showScoresTab ? ["scores" as const] : []),
+ ...(showLogViewTab ? ["log" as const] : []),
+ ]}
+ />
+ </div>
+ <div className="hidden h-full shrink-0 @min-[680px]/detailtabs:contents">
+ <TabsBarTrigger value="preview">Preview</TabsBarTrigger>
+ {showMessagesTab && (
+ <TabsBarTrigger value="messages" className="gap-1">
+ Messages <InternalFeatureBadge />
+ </TabsBarTrigger>
+ )}
+ <TabsBarTrigger value="attributes">Attributes</TabsBarTrigger>
+ {showScoresTab ? (
+ <TabsBarTrigger value="scores">Scores</TabsBarTrigger>
+ ) : null}
+ {showLogViewTab ? (
+ <TabsBarTrigger value="log">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>Log View</span>
+ </TooltipTrigger>
+ <TooltipContent className="text-xs">
+ {isLogViewVirtualized
+ ? `Shows all ${observations.length} observations with virtualization enabled.`
+ : "Shows all observations concatenated. Great for quickly scanning through them."}
+ </TooltipContent>
+ </Tooltip>
+ </TabsBarTrigger>
+ ) : null}
+ </div>
{(selectedTab === "log" ||
selectedTab === "attributes" ||
(selectedTab === "preview" && isPrettyViewAvailable)) && (
<>
- <div className="ml-auto h-fit px-2 py-0.5">
+ <div className="ml-auto h-fit shrink-0 px-2 py-0.5">
<Tabs
value={
selectedTab === "log" && isLogViewVirtualized
@@ -482,6 +512,14 @@ export function ConnectedObservationDetailView({
</TabsBarList>
</TooltipProvider>
+ {selectedTab === "messages" && (
+ <TabsBarContent
+ value="messages"
+ className="mt-0 min-h-0 flex-1 overflow-auto"
+ >
+ <TraceMessagesView />
+ </TabsBarContent>
+ )}
<TabsBarContent
value="preview"
className="mt-0 flex max-h-full min-h-0 w-full flex-1"
diff --git a/web/src/features/traces/components/TraceDetailTabMenu.tsx b/web/src/features/traces/components/TraceDetailTabMenu.tsx
new file mode 100644
index 0000000000..e31d287780
--- /dev/null
+++ b/web/src/features/traces/components/TraceDetailTabMenu.tsx
@@ -0,0 +1,66 @@
+import { ChevronDown } from "lucide-react";
+import { Button } from "@/src/components/ui/button";
+import {
+ DropdownMenuController,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+} from "@/src/components/ui/dropdown-menu";
+import { InternalFeatureBadge } from "@/src/features/feature-flags";
+import type { DetailTab } from "../contexts/SelectionContext";
+
+const labels: Record<DetailTab, string> = {
+ preview: "Preview",
+ messages: "Messages",
+ attributes: "Attributes",
+ scores: "Scores",
+ log: "Log View",
+};
+
+export function TraceDetailTabMenu({
+ tabs,
+ selectedTab,
+ onSelect,
+}: {
+ tabs: DetailTab[];
+ selectedTab: DetailTab;
+ onSelect: (tab: DetailTab) => void;
+}) {
+ return (
+ <DropdownMenuController
+ align="start"
+ renderMenu={() => (
+ <DropdownMenuRadioGroup
+ value={selectedTab}
+ onValueChange={(value) => {
+ const tab = tabs.find((tab) => tab === value);
+ if (tab) onSelect(tab);
+ }}
+ >
+ {tabs.map((tab) => (
+ <DropdownMenuRadioItem key={tab} value={tab}>
+ <span className="flex items-center gap-2">
+ {labels[tab]}
+ {tab === "messages" && <InternalFeatureBadge />}
+ </span>
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ )}
+ >
+ {({ Trigger }) => (
+ <Trigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ aria-label={`Detail view: ${labels[selectedTab]}`}
+ className="h-7 gap-1.5"
+ >
+ {labels[selectedTab]}
+ {selectedTab === "messages" && <InternalFeatureBadge />}
+ <ChevronDown className="h-3.5 w-3.5" />
+ </Button>
+ </Trigger>
+ )}
+ </DropdownMenuController>
+ );
+}
diff --git a/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx b/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx
index 73420c6203..68086338d9 100644
--- a/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx
+++ b/web/src/features/traces/components/TraceDetailView/TraceDetailView.tsx
@@ -63,6 +63,13 @@ import { TraceLogView } from "../TraceLogView/TraceLogView";
import { TRACE_VIEW_CONFIG } from "@/src/features/traces/constants/traceViewConfig";
import { ScoresTable } from "@/src/features/scores";
import { getMostRecentCorrection } from "@/src/features/corrections";
+import {
+ InternalFeatureBadge,
+ useInternalFeaturesEnabled,
+} from "@/src/features/feature-flags";
+import { useReadPath } from "@/src/features/events";
+import { TraceMessagesView } from "../TraceMessagesView/TraceMessagesView";
+import { TraceDetailTabMenu } from "../TraceDetailTabMenu";
export interface TraceDetailViewProps {
trace: Omit<WithStringifiedMetadata<TraceDomain>, "input" | "output"> & {
@@ -86,10 +93,15 @@ export function TraceDetailView({
const router = useRouter();
// Tab and view state from URL (via SelectionContext)
const { selectedTab: globalSelectedTab, setSelectedTab } = useSelection();
- // `attributes` is observation-only; Radix renders nothing for a value with
- // no Content, which blanks the panel.
+ const internalFeaturesEnabled = useInternalFeaturesEnabled();
+ const { isV4 } = useReadPath();
+ const showMessagesTab = internalFeaturesEnabled && isV4;
+ // Unsupported tabs fall back to Preview instead of rendering an empty panel.
const selectedTab =
- globalSelectedTab === "attributes" ? "preview" : globalSelectedTab;
+ globalSelectedTab === "attributes" ||
+ (globalSelectedTab === "messages" && !showMessagesTab)
+ ? "preview"
+ : globalSelectedTab;
const utils = api.useUtils();
const capture = usePostHogClientCapture();
const analyticsDimensions = useTraceAnalyticsDimensions();
@@ -218,7 +230,7 @@ export function TraceDetailView({
const showScoresTab = isAuthenticatedAndProjectMember && !isAnnotationMode;
// Hide entire tabs bar when only Preview tab remains (cleaner annotation mode UI)
- const showTabsBar = showLogViewTab || showScoresTab;
+ const showTabsBar = showLogViewTab || showScoresTab || showMessagesTab;
const refreshTraceScores = useCallback(() => {
utils.traces.byIdWithObservationsAndScores.invalidate({
@@ -275,38 +287,57 @@ export function TraceDetailView({
{/* Tabs section */}
<TabsBar
value={selectedTab}
- className="flex min-h-0 flex-1 flex-col overflow-hidden"
+ className="@container/detailtabs flex min-h-0 flex-1 flex-col overflow-hidden"
onValueChange={handleTabChange}
>
- {/* Hide entire tabs bar when only Preview tab remains (annotation mode) */}
+ {/* Hide the tabs bar when only Preview remains. */}
{showTabsBar && (
<TooltipProvider>
- <TabsBarList>
- <TabsBarTrigger value="preview">Preview</TabsBarTrigger>
- {showLogViewTab && (
- <TabsBarTrigger value="log">
- <Tooltip>
- <TooltipTrigger asChild>
- <span>Log View</span>
- </TooltipTrigger>
- <TooltipContent className="text-xs">
- {isLogViewVirtualized
- ? `Shows all ${observations.length} observations with virtualization enabled.`
- : "Shows all observations concatenated. Great for quickly scanning through them."}
- </TooltipContent>
- </Tooltip>
- </TabsBarTrigger>
- )}
- {showScoresTab && (
- <TabsBarTrigger value="scores">Scores</TabsBarTrigger>
- )}
+ <TabsBarList className="shrink-0">
+ <div className="shrink-0 @min-[680px]/detailtabs:hidden">
+ <TraceDetailTabMenu
+ selectedTab={selectedTab}
+ onSelect={handleTabChange}
+ tabs={[
+ "preview",
+ ...(showMessagesTab ? ["messages" as const] : []),
+ ...(showLogViewTab ? ["log" as const] : []),
+ ...(showScoresTab ? ["scores" as const] : []),
+ ]}
+ />
+ </div>
+ <div className="hidden h-full shrink-0 @min-[680px]/detailtabs:contents">
+ <TabsBarTrigger value="preview">Preview</TabsBarTrigger>
+ {showMessagesTab && (
+ <TabsBarTrigger value="messages" className="gap-1">
+ Messages <InternalFeatureBadge />
+ </TabsBarTrigger>
+ )}
+ {showLogViewTab && (
+ <TabsBarTrigger value="log">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>Log View</span>
+ </TooltipTrigger>
+ <TooltipContent className="text-xs">
+ {isLogViewVirtualized
+ ? `Shows all ${observations.length} observations with virtualization enabled.`
+ : "Shows all observations concatenated. Great for quickly scanning through them."}
+ </TooltipContent>
+ </Tooltip>
+ </TabsBarTrigger>
+ )}
+ {showScoresTab && (
+ <TabsBarTrigger value="scores">Scores</TabsBarTrigger>
+ )}
+ </div>
{/* View toggle (Formatted/JSON) - show for preview and log tabs when pretty view available */}
{/* JSON views are disabled for virtualized log view (large traces) */}
{(selectedTab === "log" ||
(selectedTab === "preview" && isPrettyViewAvailable)) && (
<>
- <div className="ml-auto h-fit px-2 py-0.5">
+ <div className="ml-auto h-fit shrink-0 px-2 py-0.5">
<Tabs
value={
selectedTab === "log" && isLogViewVirtualized
@@ -389,6 +420,15 @@ export function TraceDetailView({
</TooltipProvider>
)}
+ {selectedTab === "messages" && (
+ <TabsBarContent
+ value="messages"
+ className="mt-0 min-h-0 flex-1 overflow-auto"
+ >
+ <TraceMessagesView />
+ </TabsBarContent>
+ )}
+
{/* Preview tab content */}
<TabsBarContent
value="preview"
diff --git a/web/src/features/traces/components/TraceLayoutDesktop.tsx b/web/src/features/traces/components/TraceLayoutDesktop.tsx
index da252d8374..b135b6b0df 100644
--- a/web/src/features/traces/components/TraceLayoutDesktop.tsx
+++ b/web/src/features/traces/components/TraceLayoutDesktop.tsx
@@ -24,6 +24,8 @@ import { cn } from "@/src/utils/tailwind";
import { useViewPreferences } from "@/src/features/traces/contexts/ViewPreferencesContext";
import { useSelection } from "@/src/features/traces/contexts/SelectionContext";
import { TraceReviewLayout } from "./TraceReviewLayout";
+import { useInternalFeaturesEnabled } from "@/src/features/feature-flags";
+import { useReadPath } from "@/src/features/events";
import { resolveEffectiveWidthFraction } from "@/src/components/table/peek/store/peekPanelStore";
const RESIZABLE_PANEL_HANDLE_ID = "trace-layout-handle";
@@ -488,7 +490,15 @@ function TraceNavigationDetailLayout({
// cannot hide the trace overview on the next trace-level queue item. Re-
// selecting the same node is handled at the row click via expandDetailPanel,
// since the URL param — and thus this effect — doesn't change on re-click.
- const { selectedNodeId } = useSelection();
+ const { selectedNodeId, selectedTab } = useSelection();
+ const internalFeaturesEnabled = useInternalFeaturesEnabled();
+ const { isV4 } = useReadPath();
+ const showMessages =
+ selectedTab === "messages" && internalFeaturesEnabled && isV4;
+ useEffect(() => {
+ if (!showMessages || reviewOpen) return;
+ panelRef.current?.collapse();
+ }, [showMessages, reviewOpen, panelRef]);
useEffect(() => {
// Guard on selectedNodeId so a deliberately-collapsed panel isn't reopened
// on mount/refresh when there's no selection (effects always run once).
diff --git a/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx b/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx
index f3d78dd1fe..2a8018b824 100644
--- a/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx
+++ b/web/src/features/traces/components/TraceMessagesView/TraceMessagesView.tsx
@@ -1,7 +1,7 @@
/**
* TraceMessagesView - the trace as a conversation transcript
*
- * Internal preview behind the `traceMessages` flag. Renders the transcript
+ * Internal preview available in Internal view mode. Renders the transcript
* assembled server-side from the trace's generations and tools with the same
* message components as the formatted IO view: replayed conversation history
* first, then the current turn with links to the observations that emitted it.
diff --git a/web/src/features/traces/components/TracePanelNavigation.tsx b/web/src/features/traces/components/TracePanelNavigation.tsx
index 95825ca231..ead5d3143f 100644
--- a/web/src/features/traces/components/TracePanelNavigation.tsx
+++ b/web/src/features/traces/components/TracePanelNavigation.tsx
@@ -2,7 +2,7 @@
* TracePanelNavigation - Pure content component for navigation panel
*
* Responsibility:
- * - Decide which navigation view to show (Tree/Timeline/Graph/Messages/Search)
+ * - Decide which navigation view to show (Tree/Timeline/Graph/Search)
* - The Timeline is either the classic gantt or the Compact Timeline, depending
* on that feature preview
* - NO layout structure - just returns the content component
@@ -24,9 +24,6 @@ import { TraceTree } from "./TraceTree";
import { TraceSearchList } from "./TraceSearchList";
import { TraceTimelineCompact } from "./TraceTimelineDense/TraceTimelineCompact";
import { TraceGraphView } from "./TraceGraphView/TraceGraphView";
-import { TraceMessagesView } from "./TraceMessagesView/TraceMessagesView";
-import { useIsFeatureEnabled } from "@/src/features/feature-flags";
-import { useReadPath } from "@/src/features/events";
import { useMemo } from "react";
export function TracePanelNavigation() {
@@ -34,14 +31,9 @@ export function TracePanelNavigation() {
const { isGraphViewAvailable, isLoading: isGraphLoading } =
useTraceGraphData();
const [viewMode] = useQueryParam("view", StringParam);
- const { isV4 } = useReadPath();
- const messagesEnabled = useIsFeatureEnabled("traceMessages") && isV4;
const hasQuery = searchQuery.trim().length > 0;
const isTimelineView = viewMode === "timeline";
- // Internal preview of the events-backed trace view; a stale ?view=messages
- // falls back to tree for everyone else.
- const isMessagesView = viewMode === "messages" && messagesEnabled;
// Availability is false while the graph query loads, so hold the view until it
// resolves. Stale ?view=graph then falls back to tree.
const isGraphView =
@@ -57,9 +49,6 @@ export function TracePanelNavigation() {
//
// The Tree still hands a query to the flat list; highlighting it is its own
// change.
- if (isMessagesView) {
- return <TraceMessagesView />;
- }
if (isGraphView) {
return <TraceGraphView />;
}
@@ -70,7 +59,7 @@ export function TracePanelNavigation() {
return <TraceSearchList />;
}
return <TraceTree />;
- }, [hasQuery, isGraphView, isMessagesView, isTimelineView]);
+ }, [hasQuery, isGraphView, isTimelineView]);
return content;
}
diff --git a/web/src/features/traces/components/TracePanelNavigationHeader/TracePanelNavigationHeader.tsx b/web/src/features/traces/components/TracePanelNavigationHeader/TracePanelNavigationHeader.tsx
index 137077a0c5..6b79773f78 100644
--- a/web/src/features/traces/components/TracePanelNavigationHeader/TracePanelNavigationHeader.tsx
+++ b/web/src/features/traces/components/TracePanelNavigationHeader/TracePanelNavigationHeader.tsx
@@ -22,7 +22,6 @@ import {
TooltipTrigger,
} from "@/src/components/ui/tooltip";
import { useReadPath } from "@/src/features/events";
-import { useIsFeatureEnabled } from "@/src/features/feature-flags";
import { Command, CommandInput } from "@/src/components/ui/command";
import { Button } from "@/src/components/ui/button";
import {
@@ -110,9 +109,6 @@ function TracePanelNavigationHeaderExpanded({
isLoading: isGraphLoading,
} = useTraceGraphData();
const { isV4 } = useReadPath();
- // Internal preview of the events-backed trace view; legacy traces have no
- // transcript to offer.
- const messagesEnabled = useIsFeatureEnabled("traceMessages") && isV4;
const [viewMode, setViewMode] = useQueryParam("view", StringParam);
const capture = usePostHogClientCapture();
const analyticsDimensions = useTraceAnalyticsDimensions();
@@ -209,9 +205,7 @@ function TracePanelNavigationHeaderExpanded({
? "timeline"
: viewMode === "graph" && graphResolved
? "graph"
- : viewMode === "messages" && messagesEnabled
- ? "messages"
- : "tree";
+ : "tree";
const handleSelectView = (view: TraceViewMode) => {
// Clicking the already-active option is a no-op — don't count it.
@@ -222,9 +216,6 @@ function TracePanelNavigationHeaderExpanded({
});
}
setViewMode(view === "tree" ? null : view);
- // The transcript wants the width; the rail's "Show detail panel" button
- // and selecting an observation bring it back.
- if (view === "messages") layout?.detailPanelRef.current?.collapse();
};
const renderOverflowMenuItems = () => (
@@ -362,7 +353,6 @@ function TracePanelNavigationHeaderExpanded({
<ViewModeSwitch
activeView={activeView}
graphDisabledReason={graphDisabledReason}
- showMessages={messagesEnabled}
onSelect={handleSelectView}
/>
</div>
@@ -395,11 +385,6 @@ function TracePanelNavigationHeaderExpanded({
)}
</span>
</DropdownMenuRadioItem>
- {messagesEnabled && (
- <DropdownMenuRadioItem value="messages">
- Messages
- </DropdownMenuRadioItem>
- )}
</DropdownMenuRadioGroup>
)}
>
@@ -441,26 +426,22 @@ const GRAPH_UNAVAILABLE_COPY: Record<GraphUnavailableReason, string> = {
"no-structure": "Nothing to graph. This trace has only one node.",
};
-type TraceViewMode = "tree" | "timeline" | "graph" | "messages";
+type TraceViewMode = "tree" | "timeline" | "graph";
const TRACE_VIEW_LABELS: Record<TraceViewMode, string> = {
tree: "Tree",
timeline: "Timeline",
graph: "Graph",
- messages: "Messages",
};
function ViewModeSwitch({
activeView,
graphDisabledReason,
- showMessages,
onSelect,
}: {
activeView: TraceViewMode;
/** Present when the trace has no graph: the segment renders disabled. */
graphDisabledReason?: string;
- /** Internal preview: the Messages segment exists only for internal users. */
- showMessages: boolean;
onSelect: (view: TraceViewMode) => void;
}) {
return (
@@ -485,13 +466,6 @@ function ViewModeSwitch({
disabled={Boolean(graphDisabledReason)}
title={graphDisabledReason}
/>
- {showMessages && (
- <ViewModeSegment
- active={activeView === "messages"}
- onClick={() => onSelect("messages")}
- label="Messages"
- />
- )}
</div>
);
}
diff --git a/web/src/features/traces/contexts/SelectionContext.tsx b/web/src/features/traces/contexts/SelectionContext.tsx
index 0d4582c552..c7ed9b6ea4 100644
--- a/web/src/features/traces/contexts/SelectionContext.tsx
+++ b/web/src/features/traces/contexts/SelectionContext.tsx
@@ -35,8 +35,19 @@ import {
} from "@/src/components/ui/jsonViewPreference";
// Valid tab values for detail view
-export type DetailTab = "preview" | "attributes" | "log" | "scores";
-const VALID_TABS: DetailTab[] = ["preview", "attributes", "log", "scores"];
+export type DetailTab =
+ | "preview"
+ | "attributes"
+ | "log"
+ | "scores"
+ | "messages";
+const VALID_TABS: DetailTab[] = [
+ "preview",
+ "attributes",
+ "log",
+ "scores",
+ "messages",
+];
const DEFAULT_TAB: DetailTab = "preview";
// Valid view preference values
diff --git a/web/src/server/api/routers/userAccount.ts b/web/src/server/api/routers/userAccount.ts
index 77c6c3b1fe..283d1be94c 100644
--- a/web/src/server/api/routers/userAccount.ts
+++ b/web/src/server/api/routers/userAccount.ts
@@ -13,6 +13,8 @@ import { getSfdcService } from "@/src/ee/features/sfdc-sync/server";
import {
featurePreviewFlags,
setUserFeaturePreview,
+ hasInternalAccess,
+ INTERNAL_FEATURE_FLAG,
} from "@/src/features/feature-flags/server";
import { advanceSessionsExpiredAtForUser } from "@/src/features/auth/lib/sessionExpiration";
@@ -78,6 +80,34 @@ async function checkUserCanBeDeleted(
}
export const userAccountRouter = createTRPCRouter({
+ setViewMode: authenticatedProcedure
+ .input(z.object({ mode: z.enum(["INTERNAL", "EXTERNAL"]) }))
+ .mutation(async ({ input, ctx }) => {
+ const canEnableFeaturePreviews =
+ Boolean(env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION) ||
+ ctx.session.user.v4BetaEnabled === true;
+
+ if (
+ !hasInternalAccess({
+ isAdmin: ctx.session.user.admin === true,
+ isExperimentalFeaturesEnabled:
+ env.LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES === "true",
+ }) ||
+ !canEnableFeaturePreviews
+ ) {
+ throw new TRPCError({
+ code: "PRECONDITION_FAILED",
+ message: `Internal view mode requires ${V4_PREVIEW_LABEL} on self-hosted deployments.`,
+ });
+ }
+ await setUserFeaturePreview({
+ prisma: ctx.prisma,
+ userId: ctx.session.user.id,
+ flag: INTERNAL_FEATURE_FLAG,
+ enabled: input.mode === "INTERNAL",
+ });
+ return { success: true };
+ }),
checkCanDelete: authenticatedProcedure.query(async ({ ctx }) => {
const userId = ctx.session.user.id;
return checkUserCanBeDeleted(userId, ctx.prisma);