🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(prompts): add protected labels (#6306)
Hassieb Pakzad975ef81bb5e9
diff --git a/packages/shared/prisma/generated/types.ts b/packages/shared/prisma/generated/types.tsindex b9444b806d..f551a7954d 100644--- a/packages/shared/prisma/generated/types.ts+++ b/packages/shared/prisma/generated/types.ts@@ -543,6 +543,13 @@ export type PromptDependency = {child_label: string | null;child_version: number | null;};+export type PromptProtectedLabels = {+ id: string;+ created_at: Generated<Timestamp>;+ updated_at: Generated<Timestamp>;+ project_id: string;+ label: string;+};export type ScoreConfig = {id: string;created_at: Generated<Timestamp>;@@ -638,6 +645,7 @@ export type DB = {project_memberships: ProjectMembership;projects: Project;prompt_dependencies: PromptDependency;+ prompt_protected_labels: PromptProtectedLabels;prompts: Prompt;score_configs: ScoreConfig;scores: LegacyPrismaScore;diff --git a/packages/shared/prisma/migrations/20250401122159_add_prompt_protected_labels_table/migration.sql b/packages/shared/prisma/migrations/20250401122159_add_prompt_protected_labels_table/migration.sqlnew file mode 100644index 0000000000..60287bf843--- /dev/null+++ b/packages/shared/prisma/migrations/20250401122159_add_prompt_protected_labels_table/migration.sql@@ -0,0 +1,16 @@+-- CreateTable+CREATE TABLE "prompt_protected_labels" (+ "id" TEXT NOT NULL,+ "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,+ "project_id" TEXT NOT NULL,+ "label" TEXT NOT NULL,++ CONSTRAINT "prompt_protected_labels_pkey" PRIMARY KEY ("id")+);++-- CreateIndex+CREATE UNIQUE INDEX "prompt_protected_labels_project_id_label_key" ON "prompt_protected_labels"("project_id", "label");++-- AddForeignKey+ALTER TABLE "prompt_protected_labels" ADD CONSTRAINT "prompt_protected_labels_project_id_fkey" FOREIGN KEY ("project_id") REFERENCES "projects"("id") ON DELETE CASCADE ON UPDATE CASCADE;diff --git a/packages/shared/prisma/schema.prisma b/packages/shared/prisma/schema.prismaindex b9d2f9df94..b02390aaaa 100644--- a/packages/shared/prisma/schema.prisma+++ b/packages/shared/prisma/schema.prisma@@ -144,6 +144,7 @@ model Project {PromptDependency PromptDependency[]LlmSchema LlmSchema[]LlmTool LlmTool[]+ PromptProtectedLabels PromptProtectedLabels[]@@index([orgId])@@map("projects")@@ -683,6 +684,19 @@ model PromptDependency {@@map("prompt_dependencies")}+model PromptProtectedLabels {+ id String @id @default(cuid())+ createdAt DateTime @default(now()) @map("created_at")+ updatedAt DateTime @default(now()) @updatedAt @map("updated_at")+ projectId String @map("project_id")+ project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)+ label String++ @@unique([projectId, label])++ @@map("prompt_protected_labels")+}+// Update ObservationView below when making changes to this model!model Model {id String @id @default(cuid())diff --git a/web/src/components/layouts/status-badge.tsx b/web/src/components/layouts/status-badge.tsxindex 7bb5dbfacb..f045f17be0 100644--- a/web/src/components/layouts/status-badge.tsx+++ b/web/src/components/layouts/status-badge.tsx@@ -1,4 +1,5 @@import { cn } from "@/src/utils/tailwind";+import { type ReactNode } from "react";const statusCategories = {active: ["production", "live", "active", "public"],@@ -16,11 +17,13 @@ export const StatusBadge = ({isLive = true,className,showText = true,+ children,}: {type: Status | (string & {});isLive?: boolean;className?: string;showText?: boolean;+ children?: ReactNode;}) => {let badgeColor = "bg-muted-gray text-primary";let dotColor = "bg-muted-foreground";@@ -68,6 +71,7 @@ export const StatusBadge = ({</span>)}{showText && <span>{type}</span>}+ {children}</div>);};diff --git a/web/src/features/audit-logs/auditLog.ts b/web/src/features/audit-logs/auditLog.tsindex 77fcd1b083..aa1e8e7763 100644--- a/web/src/features/audit-logs/auditLog.ts+++ b/web/src/features/audit-logs/auditLog.ts@@ -22,6 +22,7 @@ export type AuditableResource =| "scoreConfig"| "model"| "prompt"+ | "promptProtectedLabel"| "session"| "apiKey"| "evalTemplate"diff --git a/web/src/features/entitlements/constants/entitlements.ts b/web/src/features/entitlements/constants/entitlements.tsindex 3ccc957fa2..e25babb8dd 100644--- a/web/src/features/entitlements/constants/entitlements.ts+++ b/web/src/features/entitlements/constants/entitlements.ts@@ -17,6 +17,7 @@ const entitlements = ["trace-deletion", // Not in use anymore, but necessary to use the TableAction type."audit-logs","data-retention",+ "prompt-protected-labels",] as const;export type Entitlement = (typeof entitlements)[number];@@ -93,6 +94,7 @@ export const entitlementAccess: Record<"data-retention","cloud-multi-tenant-sso","integration-blobstorage",+ "prompt-protected-labels",],entitlementLimits: {"annotation-queue-count": false,@@ -110,6 +112,7 @@ export const entitlementAccess: Record<"data-retention","cloud-multi-tenant-sso","integration-blobstorage",+ "prompt-protected-labels",],entitlementLimits: {"annotation-queue-count": false,@@ -161,6 +164,7 @@ export const entitlementAccess: Record<"integration-blobstorage","audit-logs","data-retention",+ "prompt-protected-labels",],entitlementLimits: {"annotation-queue-count": false,diff --git a/web/src/features/prompts/components/ProtectedLabelsSettings.tsx b/web/src/features/prompts/components/ProtectedLabelsSettings.tsxnew file mode 100644index 0000000000..95fe24c693--- /dev/null+++ b/web/src/features/prompts/components/ProtectedLabelsSettings.tsx@@ -0,0 +1,226 @@+import React from "react";+import { Card } from "@/src/components/ui/card";+import { Button } from "@/src/components/ui/button";+import { api } from "@/src/utils/api";+import { useForm } from "react-hook-form";+import {+ Form,+ FormControl,+ FormField,+ FormItem,+ FormMessage,+} from "@/src/components/ui/form";+import Header from "@/src/components/layouts/header";+import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";+import { useHasEntitlement } from "@/src/features/entitlements/hooks";+import { PromptLabelSchema } from "@/src/features/prompts/server/utils/validation";+import { zodResolver } from "@hookform/resolvers/zod";+import { z } from "zod";+import { XIcon, Check, ChevronsUpDown } from "lucide-react";+import { ActionButton } from "@/src/components/ActionButton";+import { cn } from "@/src/utils/tailwind";+import {+ Command,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+} from "@/src/components/ui/command";+import {+ Popover,+ PopoverContent,+ PopoverTrigger,+} from "@/src/components/ui/popover";+import {+ LATEST_PROMPT_LABEL,+ PRODUCTION_LABEL,+} from "@/src/features/prompts/constants";+import { StatusBadge } from "@/src/components/layouts/status-badge";++const AddLabelFormSchema = z.object({+ label: PromptLabelSchema,+});++type AddLabelFormSchemaType = z.infer<typeof AddLabelFormSchema>;++export default function ProtectedLabelsSettings({+ projectId,+}: {+ projectId: string;+}) {+ const hasAccess = useHasProjectAccess({+ projectId,+ scope: "promptProtectedLabels:CUD",+ });+ const hasEntitlement = useHasEntitlement("prompt-protected-labels");++ const form = useForm<AddLabelFormSchemaType>({+ resolver: zodResolver(AddLabelFormSchema),+ defaultValues: {+ label: "",+ },+ });++ const utils = api.useUtils();+ const { data: protectedLabels = [] } =+ api.prompts.getProtectedLabels.useQuery(+ { projectId },+ {+ enabled: Boolean(projectId),+ },+ );++ const { data: allLabels = [] } = api.prompts.allLabels.useQuery(+ { projectId },+ {+ enabled: Boolean(projectId),+ },+ );++ // Filter out labels that are already protected+ const availableLabels = allLabels.filter(+ (label) =>+ !protectedLabels.includes(label) && label !== LATEST_PROMPT_LABEL,+ );++ const addProtectedLabel = api.prompts.addProtectedLabel.useMutation({+ onSuccess: () => {+ utils.prompts.getProtectedLabels.invalidate();+ form.reset();+ },+ });++ const removeProtectedLabel = api.prompts.removeProtectedLabel.useMutation({+ onSuccess: () => {+ utils.prompts.getProtectedLabels.invalidate();+ },+ });++ function onSubmit(values: AddLabelFormSchemaType) {+ addProtectedLabel.mutate({+ projectId,+ label: values.label,+ });+ }++ const [open, setOpen] = React.useState(false);++ return (+ <div>+ <Header title="Protected Prompt Labels" />+ <Card className="mb-4 p-3">+ <p className="mb-4 text-sm text-primary">+ Protected labels can only be modified by users with admin or owner+ access. This prevents other users from changing or removing these+ labels from prompts.+ </p>+ <div className="mb-4 flex flex-wrap gap-2">+ {protectedLabels.map((label) => (+ <StatusBadge+ type={label}+ key={label}+ className="break-all sm:break-normal"+ isLive={label === PRODUCTION_LABEL}+ >+ {hasAccess && hasEntitlement && (+ <Button+ variant="ghost"+ size="icon"+ className="h-4 w-4 p-0 hover:bg-transparent"+ onClick={() => {+ if (+ confirm(+ `Are you sure you want to remove the protected label "${label}"?`,+ )+ ) {+ removeProtectedLabel.mutate({ projectId, label });+ }+ }}+ >+ <XIcon className="h-3 w-3" />+ </Button>+ )}+ </StatusBadge>+ ))}+ </div>+ <Form {...form}>+ <form+ onSubmit={form.handleSubmit(onSubmit)}+ className="flex items-start gap-2"+ >+ <FormField+ control={form.control}+ name="label"+ render={({ field }) => (+ <FormItem className="flex-1">+ <Popover open={open} onOpenChange={setOpen}>+ <PopoverTrigger asChild>+ <FormControl>+ <Button+ variant="outline"+ role="combobox"+ aria-expanded={open}+ className={cn(+ "w-full justify-between",+ !field.value && "text-muted-foreground",+ )}+ disabled={!hasAccess || !hasEntitlement}+ >+ {field.value || "Select or enter a label"}+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />+ </Button>+ </FormControl>+ </PopoverTrigger>+ <PopoverContent className="w-full p-0">+ <Command>+ <CommandInput+ placeholder="Search or enter a new label..."+ onValueChange={(value) => {+ field.onChange(value);+ }}+ />+ <CommandEmpty>No label found</CommandEmpty>+ <CommandGroup>+ {availableLabels.map((label) => (+ <CommandItem+ value={label}+ key={label}+ onSelect={() => {+ field.onChange(label);+ setOpen(false);+ }}+ >+ <Check+ className={cn(+ "mr-2 h-4 w-4",+ field.value === label+ ? "opacity-100"+ : "opacity-0",+ )}+ />+ {label}+ </CommandItem>+ ))}+ </CommandGroup>+ </Command>+ </PopoverContent>+ </Popover>+ <FormMessage />+ </FormItem>+ )}+ />+ <ActionButton+ type="submit"+ variant="secondary"+ loading={addProtectedLabel.isLoading}+ hasAccess={hasAccess}+ hasEntitlement={hasEntitlement}+ >+ Add+ </ActionButton>+ </form>+ </Form>+ </Card>+ </div>+ );+}diff --git a/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx b/web/src/features/prompts/components/SetPromptVersionLabels/index.tsxindex d3d2201915..0feef8826e 100644--- a/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx+++ b/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx@@ -87,19 +87,23 @@ export function SetPromptVersionLabels({});const handleSubmitLabels = async () => {- if (!projectId) {- alert("Project ID is missing");- return;- }+ try {+ if (!projectId) {+ alert("Project ID is missing");+ return;+ }- await mutatePromptVersionLabels.mutateAsync({- projectId: projectId as string,- promptId: prompt.id,- labels: selectedLabels,- });+ await mutatePromptVersionLabels.mutateAsync({+ projectId: projectId as string,+ promptId: prompt.id,+ labels: selectedLabels,+ });- capture("prompt_detail:apply_labels", { labels: selectedLabels });- setIsOpen(false);+ capture("prompt_detail:apply_labels", { labels: selectedLabels });+ setIsOpen(false);+ } catch (err) {+ console.error(err);+ }};const handleOnOpenChange = (open: boolean) => {diff --git a/web/src/features/prompts/server/routers/promptRouter.ts b/web/src/features/prompts/server/routers/promptRouter.tsindex 1786372cb9..35803c8ea6 100644--- a/web/src/features/prompts/server/routers/promptRouter.ts+++ b/web/src/features/prompts/server/routers/promptRouter.ts@@ -3,15 +3,18 @@ import { z } from "zod";import { auditLog } from "@/src/features/audit-logs/auditLog";import {CreatePromptTRPCSchema,+ PromptLabelSchema,PromptType,} from "@/src/features/prompts/server/utils/validation";import { throwIfNoProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";+import { throwIfNoEntitlement } from "@/src/features/entitlements/server/hasEntitlement";import {createTRPCRouter,protectedProjectProcedure,} from "@/src/server/api/trpc";import { type Prompt, Prisma } from "@langfuse/shared/src/db";import { createPrompt, duplicatePrompt } from "../actions/createPrompt";+import { checkHasProtectedLabels } from "../utils/checkHasProtectedLabels";import { promptsTableCols } from "@/src/server/api/definitions/promptsTable";import { optionalPaginationZod, paginationZod } from "@langfuse/shared";import { orderBy, singleFilter } from "@langfuse/shared";@@ -193,6 +196,22 @@ export const promptRouter = createTRPCRouter({scope: "prompts:CUD",});+ const { hasProtectedLabels, protectedLabels } =+ await checkHasProtectedLabels({+ prisma: ctx.prisma,+ projectId: input.projectId,+ labelsToCheck: input.labels,+ });++ if (hasProtectedLabels) {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: input.projectId,+ scope: "promptProtectedLabels:CUD",+ forbiddenErrorMessage: `You don't have permission to create a prompt with a protected label. Please contact your project admin for assistance.\n\n Protected labels are: ${protectedLabels.join(", ")}`,+ });+ }+const prompt = await createPrompt({...input,prisma: ctx.prisma,@@ -367,6 +386,23 @@ export const promptRouter = createTRPCRouter({});}+ // Check if any prompt has a protected label+ const { hasProtectedLabels, protectedLabels } =+ await checkHasProtectedLabels({+ prisma: ctx.prisma,+ projectId: input.projectId,+ labelsToCheck: prompts.flatMap((prompt) => prompt.labels),+ });++ if (hasProtectedLabels) {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: input.projectId,+ scope: "promptProtectedLabels:CUD",+ forbiddenErrorMessage: `You don't have permission to delete a prompt with a protected label. Please contact your project admin for assistance.\n\n Protected labels are: ${protectedLabels.join(", ")}`,+ });+ }+for (const prompt of prompts) {await auditLog({@@ -427,6 +463,23 @@ export const promptRouter = createTRPCRouter({});const { name: promptName, version, labels } = promptVersion;+ // Check if prompt has a protected label+ const { hasProtectedLabels, protectedLabels } =+ await checkHasProtectedLabels({+ prisma: ctx.prisma,+ projectId: input.projectId,+ labelsToCheck: promptVersion.labels,+ });++ if (hasProtectedLabels) {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: input.projectId,+ scope: "promptProtectedLabels:CUD",+ forbiddenErrorMessage: `You don't have permission to delete a prompt with a protected label. Please contact your project admin for assistance.\n\n Protected labels are: ${protectedLabels.join(", ")}`,+ });+ }+if (labels.length > 0) {const dependents = await ctx.prisma.$queryRaw<{@@ -561,14 +614,38 @@ export const promptRouter = createTRPCRouter({const { name: promptName } = toBeLabeledPrompt;const newLabelSet = new Set(input.labels);const newLabels = [...newLabelSet];- const removedLabels = [];+ const removedLabels = [];for (const oldLabel of toBeLabeledPrompt.labels) {if (!newLabelSet.has(oldLabel)) {removedLabels.push(oldLabel);}}+ const addedLabels = [];+ for (const newLabel of newLabels) {+ if (!toBeLabeledPrompt.labels.includes(newLabel)) {+ addedLabels.push(newLabel);+ }+ }++ // Check if any label is protected (both new and to be removed)+ const { hasProtectedLabels, protectedLabels } =+ await checkHasProtectedLabels({+ prisma: ctx.prisma,+ projectId: input.projectId,+ labelsToCheck: [...addedLabels, ...removedLabels],+ });++ if (hasProtectedLabels) {+ throwIfNoProjectAccess({+ session: ctx.session,+ projectId: input.projectId,+ scope: "promptProtectedLabels:CUD",+ forbiddenErrorMessage: `You don't have permission to add/remove a protected label to/from a prompt. Please contact your project admin for assistance.\n\n Protected labels are: ${protectedLabels.join(", ")}`,+ });+ }+if (removedLabels.length > 0) {const dependents = await ctx.prisma.$queryRaw<{@@ -981,6 +1058,129 @@ export const promptRouter = createTRPCRouter({throw e;}}),++ getProtectedLabels: protectedProjectProcedure+ .input(z.object({ projectId: z.string() }))+ .query(async ({ input, ctx }) => {+ const { projectId } = input;++ throwIfNoProjectAccess({+ session: ctx.session,+ projectId,+ scope: "prompts:read",+ });++ throwIfNoEntitlement({+ projectId,+ entitlement: "prompt-protected-labels",+ sessionUser: ctx.session.user,+ });++ const protectedLabels = await ctx.prisma.promptProtectedLabels.findMany({+ where: {+ projectId,+ },+ });++ return protectedLabels.map((l) => l.label);+ }),++ addProtectedLabel: protectedProjectProcedure+ .input(z.object({ projectId: z.string(), label: PromptLabelSchema }))+ .mutation(async ({ input, ctx }) => {+ const { projectId, label } = input;++ throwIfNoProjectAccess({+ session: ctx.session,+ projectId,+ scope: "promptProtectedLabels:CUD",+ forbiddenErrorMessage:+ "You don't have permission to mark a label as protected. Please contact your project admin for assistance.",+ });++ throwIfNoEntitlement({+ projectId,+ entitlement: "prompt-protected-labels",+ sessionUser: ctx.session.user,+ });++ if (label === LATEST_PROMPT_LABEL) {+ throw new TRPCError({+ code: "BAD_REQUEST",+ message: `You cannot protect the label '${LATEST_PROMPT_LABEL}' as this would effectively block prompt creation.`,+ });+ }++ const protectedLabel = await ctx.prisma.promptProtectedLabels.upsert({+ where: {+ projectId_label: {+ projectId,+ label,+ },+ },+ create: {+ projectId,+ label,+ },+ update: {},+ });++ await auditLog(+ {+ session: ctx.session,+ resourceType: "promptProtectedLabel",+ resourceId: protectedLabel.id,+ action: "create",+ after: protectedLabel.label,+ },+ ctx.prisma,+ );++ return protectedLabel;+ }),++ removeProtectedLabel: protectedProjectProcedure+ .input(z.object({ projectId: z.string(), label: PromptLabelSchema }))+ .mutation(async ({ input, ctx }) => {+ const { projectId, label } = input;++ throwIfNoProjectAccess({+ session: ctx.session,+ projectId,+ scope: "promptProtectedLabels:CUD",+ forbiddenErrorMessage:+ "You don't have permission to mark a label as unprotected. Please contact your project admin for assistance.",+ });++ throwIfNoEntitlement({+ projectId,+ entitlement: "prompt-protected-labels",+ sessionUser: ctx.session.user,+ });++ const protectedLabel = await ctx.prisma.promptProtectedLabels.delete({+ where: {+ projectId_label: {+ projectId,+ label,+ },+ },+ });++ await auditLog(+ {+ session: ctx.session,+ resourceType: "promptProtectedLabel",+ resourceId: protectedLabel.id,+ action: "delete",+ before: protectedLabel.label,+ after: null,+ },+ ctx.prisma,+ );++ return { success: true };+ }),});const getScoresForPromptIds = async (diff --git a/web/src/features/prompts/server/utils/checkHasProtectedLabels.ts b/web/src/features/prompts/server/utils/checkHasProtectedLabels.tsnew file mode 100644index 0000000000..3e2f955f46--- /dev/null+++ b/web/src/features/prompts/server/utils/checkHasProtectedLabels.ts@@ -0,0 +1,25 @@+import { type PrismaClient } from "@langfuse/shared";++type CheckHasProtectedLabelsParams = {+ labelsToCheck: string[];+ projectId: string;+ prisma: PrismaClient;+};++export async function checkHasProtectedLabels(+ params: CheckHasProtectedLabelsParams,+): Promise<{ hasProtectedLabels: boolean; protectedLabels: string[] }> {+ const { labelsToCheck, projectId, prisma } = params;++ const protectedLabels = (+ await prisma.promptProtectedLabels.findMany({+ where: { projectId },+ })+ ).map((l) => l.label);++ const hasProtectedLabels = labelsToCheck.some((label) =>+ protectedLabels.includes(label),+ );++ return { hasProtectedLabels, protectedLabels };+}diff --git a/web/src/features/rbac/constants/projectAccessRights.ts b/web/src/features/rbac/constants/projectAccessRights.tsindex 751ca30b3c..3cbfc2f6f1 100644--- a/web/src/features/rbac/constants/projectAccessRights.ts+++ b/web/src/features/rbac/constants/projectAccessRights.ts@@ -31,6 +31,7 @@ const projectScopes = ["prompts:CUD","prompts:read",+ "promptProtectedLabels:CUD","models:CUD",@@ -85,6 +86,7 @@ export const projectRoleAccessRights: Record<Role, ProjectScope[]> = {"datasets:CUD","prompts:CUD","prompts:read",+ "promptProtectedLabels:CUD","models:CUD","evalTemplate:CUD","evalTemplate:read",@@ -126,6 +128,7 @@ export const projectRoleAccessRights: Record<Role, ProjectScope[]> = {"datasets:CUD","prompts:CUD","prompts:read",+ "promptProtectedLabels:CUD","models:CUD","evalTemplate:CUD","evalTemplate:read",diff --git a/web/src/features/rbac/utils/checkProjectAccess.ts b/web/src/features/rbac/utils/checkProjectAccess.tsindex 62844f6b68..71444d8b61 100644--- a/web/src/features/rbac/utils/checkProjectAccess.ts+++ b/web/src/features/rbac/utils/checkProjectAccess.ts@@ -7,7 +7,7 @@ import { TRPCError } from "@trpc/server";import { type Session } from "next-auth";import { useSession } from "next-auth/react";-type HasProjectAccessParams =+type HasProjectAccessParams = (| {role: Role;scope: ProjectScope;@@ -17,7 +17,8 @@ type HasProjectAccessParams =session: null | Session;projectId: string;scope: ProjectScope;- };+ }+) & { forbiddenErrorMessage?: string };/*** Check if user has access to the given scope, for use in TRPC resolvers@@ -27,7 +28,9 @@ export const throwIfNoProjectAccess = (p: HasProjectAccessParams) => {if (!hasProjectAccess(p))throw new TRPCError({code: "FORBIDDEN",- message: "User does not have access to this resource or action",+ message:+ p.forbiddenErrorMessage ??+ "User does not have access to this resource or action",});};diff --git a/web/src/pages/project/[projectId]/settings/index.tsx b/web/src/pages/project/[projectId]/settings/index.tsxindex ed43804a1b..de295cd1a2 100644--- a/web/src/pages/project/[projectId]/settings/index.tsx+++ b/web/src/pages/project/[projectId]/settings/index.tsx@@ -28,6 +28,7 @@ import { AuditLogsSettingsPage } from "@/src/ee/features/audit-log-viewer/AuditLimport { ModelsSettings } from "@/src/features/models/components/ModelSettings";import ConfigureRetention from "@/src/features/projects/components/ConfigureRetention";import ContainerPage from "@/src/components/layouts/container-page";+import ProtectedLabelsSettings from "@/src/features/prompts/components/ProtectedLabelsSettings";type ProjectSettingsPage = {title: string;@@ -41,6 +42,9 @@ export function useProjectSettingsPages(): ProjectSettingsPage[] {const { project, organization } = useQueryProject();const showBillingSettings = useHasEntitlement("cloud-billing");const showRetentionSettings = useHasEntitlement("data-retention");+ const showProtectedLabelsSettings = useHasEntitlement(+ "prompt-protected-labels",+ );const entitlements = useEntitlements();const showLLMConnectionsSettings =@@ -57,6 +61,7 @@ export function useProjectSettingsPages(): ProjectSettingsPage[] {showBillingSettings,showRetentionSettings,showLLMConnectionsSettings,+ showProtectedLabelsSettings,});}@@ -66,12 +71,14 @@ export const getProjectSettingsPages = ({showBillingSettings,showRetentionSettings,showLLMConnectionsSettings,+ showProtectedLabelsSettings,}: {project: { id: string; name: string };organization: { id: string; name: string };showBillingSettings: boolean;showRetentionSettings: boolean;showLLMConnectionsSettings: boolean;+ showProtectedLabelsSettings: boolean;}): ProjectSettingsPage[] => [{title: "General",@@ -148,6 +155,13 @@ export const getProjectSettingsPages = ({cmdKKeywords: ["cost", "token"],content: <ModelsSettings projectId={project.id} />,},+ {+ title: "Protected Prompt Labels",+ slug: "protected-prompt-labels",+ cmdKKeywords: ["prompt", "label", "protect", "lock"],+ content: <ProtectedLabelsSettings projectId={project.id} />,+ show: showProtectedLabelsSettings,+ },{title: "Scores / Evaluation",slug: "scores",