🪢 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
chore: move prompt types into shared package (#7555)
Max Deichmannf5a0c7cfed57
diff --git a/web/src/features/prompts/constants.ts b/packages/shared/src/features/prompts/constants.tssimilarity index 100%rename from web/src/features/prompts/constants.tsrename to packages/shared/src/features/prompts/constants.tsdiff --git a/web/src/features/prompts/server/utils/validation.ts b/packages/shared/src/features/prompts/types.tssimilarity index 91%rename from web/src/features/prompts/server/utils/validation.tsrename to packages/shared/src/features/prompts/types.tsindex 95c670437b..5d154e42e5 100644--- a/web/src/features/prompts/server/utils/validation.ts+++ b/packages/shared/src/features/prompts/types.ts@@ -1,15 +1,18 @@import { z } from "zod/v4";-import { jsonSchema, PromptNameSchema } from "@langfuse/shared";-import type { Prompt } from "@langfuse/shared";-import { COMMIT_MESSAGE_MAX_LENGTH } from "@/src/features/prompts/constants";+import { Prompt } from "../../../prisma/generated/types";+import { jsonSchema } from "../../utils/zod";+import { COMMIT_MESSAGE_MAX_LENGTH } from "./constants";+import { PromptNameSchema } from "./validation";-export const ChatMessageSchema = z.object({+export const SingleChatMessageSchema = z.object({role: z.string(),content: z.string(),});export enum PromptType {+ // eslint-disable-next-line no-unused-varsChat = "chat",+ // eslint-disable-next-line no-unused-varsText = "text",}@@ -41,7 +44,7 @@ const BaseCreateChatPromptSchema = z.object({name: PromptNameSchema,labels: z.array(PromptLabelSchema).default([]),type: z.literal(PromptType.Chat),- prompt: z.array(ChatMessageSchema),+ prompt: z.array(SingleChatMessageSchema),config: jsonSchema.nullable().default({}),tags: z.array(z.string()).nullish(),});@@ -134,7 +137,7 @@ export const BaseChatPromptSchema = z.object({tags: z.array(z.string()),labels: z.array(PromptLabelSchema),type: z.literal(PromptType.Chat),- prompt: z.array(ChatMessageSchema),+ prompt: z.array(SingleChatMessageSchema),config: jsonSchema,});diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.tsindex 0096fcd10b..99081fd8f0 100644--- a/packages/shared/src/index.ts+++ b/packages/shared/src/index.ts@@ -43,6 +43,8 @@ export * from "./features/experiments/utils";// promptsexport * from "./features/prompts/parsePromptDependencyTags";export * from "./features/prompts/validation";+export * from "./features/prompts/types";+export * from "./features/prompts/constants";// export db types onlyexport * from "@prisma/client";diff --git a/packages/shared/src/server/llm/types.ts b/packages/shared/src/server/llm/types.tsindex f5491e45d6..5608434003 100644--- a/packages/shared/src/server/llm/types.ts+++ b/packages/shared/src/server/llm/types.ts@@ -218,11 +218,11 @@ export const SYSTEM_ROLES: string[] = [ChatMessageRole.Developer,];-export const TextPromptSchema = z.string().min(1, "Enter a prompt");+export const TextPromptContentSchema = z.string().min(1, "Enter a prompt");export const PromptContentSchema = z.union([PromptChatMessageListSchema,- TextPromptSchema,+ TextPromptContentSchema,]);export type PromptContent = z.infer<typeof PromptContentSchema>;diff --git a/packages/shared/src/server/services/PromptService/index.ts b/packages/shared/src/server/services/PromptService/index.tsindex c9940bbe70..92dce4a825 100644--- a/packages/shared/src/server/services/PromptService/index.ts+++ b/packages/shared/src/server/services/PromptService/index.ts@@ -21,9 +21,12 @@ export class PromptService {private ttlSeconds: number;constructor(+ // eslint-disable-next-line no-unused-varsprivate prisma: PrismaClient,private redis: Redis | Cluster | null,+ // eslint-disable-next-line no-unused-varsprivate metricIncrementer?: // used for otel metrics+ // eslint-disable-next-line no-unused-vars(name: string, value?: number) => void,cacheEnabled?: boolean, // used for testing) {diff --git a/web/src/__tests__/prompts.v1.servertest.ts b/web/src/__tests__/prompts.v1.servertest.tsindex c53a9f8cdc..046dc8304c 100644--- a/web/src/__tests__/prompts.v1.servertest.ts+++ b/web/src/__tests__/prompts.v1.servertest.ts@@ -8,7 +8,7 @@ import {LegacyPromptSchema,PromptType,type LegacyValidatedPrompt,-} from "@/src/features/prompts/server/utils/validation";+} from "@langfuse/shared";import { getObservationById } from "@langfuse/shared/src/server";describe("/api/public/prompts API Endpoint", () => {diff --git a/web/src/__tests__/prompts.v2.servertest.ts b/web/src/__tests__/prompts.v2.servertest.tsindex a98e7820ea..525f40f00c 100644--- a/web/src/__tests__/prompts.v2.servertest.ts+++ b/web/src/__tests__/prompts.v2.servertest.ts@@ -3,12 +3,12 @@import { prisma } from "@langfuse/shared/src/db";import { makeAPICall, pruneDatabase } from "@/src/__tests__/test-utils";import { v4 as uuidv4, v4 } from "uuid";-import { type Prompt } from "@langfuse/shared";import {PromptSchema,PromptType,type ValidatedPrompt,-} from "@/src/features/prompts/server/utils/validation";+ type Prompt,+} from "@langfuse/shared";import { parsePromptDependencyTags } from "@langfuse/shared";import { nanoid } from "ai";@@ -705,7 +705,9 @@ describe("/api/public/v2/prompts API Endpoint", () => {});expect(response.status).toBe(400);expect(response.body.message).toBe("Invalid request data");- const hasExpectedMessage = JSON.stringify(response.body.error).includes(`"message":"${expectedError}"`);+ const hasExpectedMessage = JSON.stringify(response.body.error).includes(+ `"message":"${expectedError}"`,+ );expect(hasExpectedMessage).toBe(true);};@@ -723,10 +725,19 @@ describe("/api/public/v2/prompts API Endpoint", () => {it("should reject invalid prompt names", async () => {// Test invalid patterns- await testInvalidName("/invalid-name", "Name cannot start with a slash");+ await testInvalidName(+ "/invalid-name",+ "Name cannot start with a slash",+ );await testInvalidName("invalid-name/", "Name cannot end with a slash");- await testInvalidName("invalid//name", "Name cannot contain consecutive slashes");- await testInvalidName("invalid|name", "Prompt name cannot contain '|' character");+ await testInvalidName(+ "invalid//name",+ "Name cannot contain consecutive slashes",+ );+ await testInvalidName(+ "invalid|name",+ "Prompt name cannot contain '|' character",+ );await testInvalidName("new", "Prompt name cannot be 'new'");await testInvalidName("", "Enter a name");});@@ -848,7 +859,9 @@ describe("/api/public/v2/prompts API Endpoint", () => {// Verify the name with slashes is preservedexpect(validatedPrompt.name).toBe(promptName);expect(validatedPrompt.name).toContain("/");- expect(validatedPrompt.prompt).toBe("This is a prompt in a folder structure");+ expect(validatedPrompt.prompt).toBe(+ "This is a prompt in a folder structure",+ );});});diff --git a/web/src/features/experiments/hooks/useExperimentPromptData.ts b/web/src/features/experiments/hooks/useExperimentPromptData.tsindex 90e1e20998..3ac5dec1d2 100644--- a/web/src/features/experiments/hooks/useExperimentPromptData.ts+++ b/web/src/features/experiments/hooks/useExperimentPromptData.ts@@ -1,8 +1,7 @@import { useMemo } from "react";import { api } from "@/src/utils/api";import { type UseFormReturn } from "react-hook-form";-import { extractVariables } from "@langfuse/shared";-import { PromptType } from "@/src/features/prompts/server/utils/validation";+import { extractVariables, PromptType } from "@langfuse/shared";type ExperimentPromptDataProps = {projectId: string;diff --git a/web/src/features/experiments/server/router.ts b/web/src/features/experiments/server/router.tsindex 7deb486ecc..926b71956d 100644--- a/web/src/features/experiments/server/router.ts+++ b/web/src/features/experiments/server/router.ts@@ -12,13 +12,13 @@ import {createTRPCRouter,protectedProjectProcedure,} from "@/src/server/api/trpc";-import { PromptType } from "@/src/features/prompts/server/utils/validation";import {type DatasetItem,DatasetStatus,extractVariables,datasetItemMatchesVariable,UnauthorizedError,+ PromptType,} from "@langfuse/shared";import { throwIfNoProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";diff --git a/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx b/web/src/features/playground/page/components/JumpToPlaygroundButton.tsxindex ede194aafe..9b69fbbcc7 100644--- a/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx+++ b/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx@@ -12,7 +12,6 @@ import {type PlaygroundSchema,} from "@/src/features/playground/page/types";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";-import { PromptType } from "@/src/features/prompts/server/utils/validation";import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";import {ChatMessageRole,@@ -28,6 +27,7 @@ import {type ChatMessage,OpenAIResponseFormatSchema,type Prisma,+ PromptType,} from "@langfuse/shared";import { api } from "@/src/utils/api";import { cn } from "@/src/utils/tailwind";diff --git a/web/src/features/playground/page/components/SaveToPromptButton.tsx b/web/src/features/playground/page/components/SaveToPromptButton.tsxindex c13cf6e930..38ce3ba549 100644--- a/web/src/features/playground/page/components/SaveToPromptButton.tsx+++ b/web/src/features/playground/page/components/SaveToPromptButton.tsx@@ -20,11 +20,11 @@ import {import { usePlaygroundContext } from "@/src/features/playground/page/context";import usePlaygroundCache from "@/src/features/playground/page/hooks/usePlaygroundCache";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";-import { PromptType } from "@/src/features/prompts/server/utils/validation";import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";import { api } from "@/src/utils/api";import { cn } from "@/src/utils/tailwind";import DocPopup from "@/src/components/layouts/doc-popup";+import { PromptType } from "@langfuse/shared";export const SaveToPromptButton: React.FC = () => {const [selectedPromptId, setSelectedPromptId] = useState("");diff --git a/web/src/features/prompts/components/NewPromptForm/index.tsx b/web/src/features/prompts/components/NewPromptForm/index.tsxindex 7a0d3accc5..5f39b2bbbf 100644--- a/web/src/features/prompts/components/NewPromptForm/index.tsx+++ b/web/src/features/prompts/components/NewPromptForm/index.tsx@@ -20,15 +20,14 @@ import {TabsTrigger,} from "@/src/components/ui/tabs";import { Textarea } from "@/src/components/ui/textarea";-import {- type CreatePromptTRPCType,- PromptType,-} from "@/src/features/prompts/server/utils/validation";import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";import { api } from "@/src/utils/api";import { zodResolver } from "@hookform/resolvers/zod";import {+ type CreatePromptTRPCType,+ PRODUCTION_LABEL,type Prompt,+ PromptType,extractVariables,getIsCharOrUnderscore,} from "@langfuse/shared";@@ -46,7 +45,6 @@ import { ArrowTopRightIcon } from "@radix-ui/react-icons";import { PromptVariableListPreview } from "@/src/features/prompts/components/PromptVariableListPreview";import { CodeMirrorEditor } from "@/src/components/editor/CodeMirrorEditor";import { PromptLinkingEditor } from "@/src/components/editor/PromptLinkingEditor";-import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import usePlaygroundCache from "@/src/features/playground/page/hooks/usePlaygroundCache";import { useQueryParam } from "use-query-params";@@ -215,7 +213,16 @@ export const NewPromptForm: React.FC<NewPromptFormProps> = (props) => {<FormItem><FormLabel>Name</FormLabel><FormDescription>- Use slashes '/' in prompt names to organize them into <a target="_blank" rel="noopener noreferrer" href="https://langfuse.com/docs/prompts/get-started#prompt-folders-for-organization"><i>folders</i></a>.+ Use slashes '/' in prompt names to organize them+ into{" "}+ <a+ target="_blank"+ rel="noopener noreferrer"+ href="https://langfuse.com/docs/prompts/get-started#prompt-folders-for-organization"+ >+ <i>folders</i>+ </a>+ .</FormDescription><FormControl><Input placeholder="Name your prompt" {...field} />diff --git a/web/src/features/prompts/components/NewPromptForm/validation.ts b/web/src/features/prompts/components/NewPromptForm/validation.tsindex 74cb94f4b7..3da7360260 100644--- a/web/src/features/prompts/components/NewPromptForm/validation.ts+++ b/web/src/features/prompts/components/NewPromptForm/validation.ts@@ -1,11 +1,11 @@import { z } from "zod/v4";-import { PromptType } from "@/src/features/prompts/server/utils/validation";import {PromptChatMessageListSchema,- TextPromptSchema,+ TextPromptContentSchema,PromptNameSchema,+ COMMIT_MESSAGE_MAX_LENGTH,+ PromptType,} from "@langfuse/shared";-import { COMMIT_MESSAGE_MAX_LENGTH } from "@/src/features/prompts/constants";const NewPromptBaseSchema = z.object({name: PromptNameSchema,@@ -33,7 +33,7 @@ const NewChatPromptSchema = NewPromptBaseSchema.extend({const NewTextPromptSchema = NewPromptBaseSchema.extend({type: z.literal(PromptType.Text),chatPrompt: z.array(z.any()),- textPrompt: TextPromptSchema,+ textPrompt: TextPromptContentSchema,});export const NewPromptFormSchema = z.discriminatedUnion("type", [diff --git a/web/src/features/prompts/components/ProtectedLabelsSettings.tsx b/web/src/features/prompts/components/ProtectedLabelsSettings.tsxindex e6872a927b..1a093f6a83 100644--- a/web/src/features/prompts/components/ProtectedLabelsSettings.tsx+++ b/web/src/features/prompts/components/ProtectedLabelsSettings.tsx@@ -13,7 +13,6 @@ import {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/v4";import { XIcon, Check, ChevronsUpDown } from "lucide-react";@@ -31,11 +30,13 @@ import {PopoverContent,PopoverTrigger,} from "@/src/components/ui/popover";++import { StatusBadge } from "@/src/components/layouts/status-badge";import {LATEST_PROMPT_LABEL,PRODUCTION_LABEL,-} from "@/src/features/prompts/constants";-import { StatusBadge } from "@/src/components/layouts/status-badge";+ PromptLabelSchema,+} from "@langfuse/shared";const AddLabelFormSchema = z.object({label: PromptLabelSchema,diff --git a/web/src/features/prompts/components/SetPromptVersionLabels/AddLabelForm.tsx b/web/src/features/prompts/components/SetPromptVersionLabels/AddLabelForm.tsxindex ee855025ef..3439150456 100644--- a/web/src/features/prompts/components/SetPromptVersionLabels/AddLabelForm.tsx+++ b/web/src/features/prompts/components/SetPromptVersionLabels/AddLabelForm.tsx@@ -12,9 +12,9 @@ import {import { Button } from "@/src/components/ui/button";import { Input } from "@/src/components/ui/input";import { zodResolver } from "@hookform/resolvers/zod";-import { PromptLabelSchema } from "@/src/features/prompts/server/utils/validation";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { isReservedPromptLabel } from "@/src/features/prompts/utils";+import { PromptLabelSchema } from "@langfuse/shared";const AddLabelFormSchema = z.object({newLabel: PromptLabelSchema.refine(diff --git a/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx b/web/src/features/prompts/components/SetPromptVersionLabels/index.tsxindex 62a9c14bc1..05227c8301 100644--- a/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx+++ b/web/src/features/prompts/components/SetPromptVersionLabels/index.tsx@@ -15,10 +15,9 @@ import {import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";import { api } from "@/src/utils/api";-import { type Prompt } from "@langfuse/shared";+import { PRODUCTION_LABEL, type Prompt } from "@langfuse/shared";import { AddLabelForm } from "./AddLabelForm";import { LabelCommandItem } from "./LabelCommandItem";-import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { isReservedPromptLabel } from "@/src/features/prompts/utils";import { StatusBadge } from "@/src/components/layouts/status-badge";@@ -47,7 +46,9 @@ export function SetPromptVersionLabels({const [selectedLabels, setSelectedLabels] = useState<string[]>([]);const [labels, setLabels] = useState<string[]>([]);const [isAddingLabel, setIsAddingLabel] = useState(false);- const labelsChanged = JSON.stringify([...selectedLabels].sort()) !== JSON.stringify([...prompt.labels].sort());+ const labelsChanged =+ JSON.stringify([...selectedLabels].sort()) !==+ JSON.stringify([...prompt.labels].sort());const customLabelScrollRef = useRef<HTMLDivElement | null>(null);const usedLabelsInProject = api.prompts.allLabels.useQuery(diff --git a/web/src/features/prompts/components/prompt-detail.tsx b/web/src/features/prompts/components/prompt-detail.tsxindex bd52ad1660..455feace62 100644--- a/web/src/features/prompts/components/prompt-detail.tsx+++ b/web/src/features/prompts/components/prompt-detail.tsx@@ -18,10 +18,13 @@ import { Tabs, TabsList, TabsTrigger } from "@/src/components/ui/tabs";import { Badge } from "@/src/components/ui/badge";import { CodeView, JSONView } from "@/src/components/ui/CodeJsonViewer";import { DetailPageNav } from "@/src/features/navigate-detail-pages/DetailPageNav";-import { PromptType } from "@/src/features/prompts/server/utils/validation";import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";import { api } from "@/src/utils/api";-import { extractVariables } from "@langfuse/shared";+import {+ extractVariables,+ PRODUCTION_LABEL,+ PromptType,+} from "@langfuse/shared";import { PromptHistoryNode } from "./prompt-history";import { JumpToPlaygroundButton } from "@/src/features/playground/page/components/JumpToPlaygroundButton";import { ChatMlArraySchema } from "@/src/components/schemas/ChatMlSchema";@@ -51,7 +54,6 @@ import { TagPromptDetailsPopover } from "@/src/features/tag/components/TagPromptimport { SetPromptVersionLabels } from "@/src/features/prompts/components/SetPromptVersionLabels";import { CommentDrawerButton } from "@/src/features/comments/CommentDrawerButton";import { Command, CommandInput } from "@/src/components/ui/command";-import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";import { renderContentWithPromptButtons } from "@/src/features/prompts/components/renderContentWithPromptButtons";import { PromptVariableListPreview } from "@/src/features/prompts/components/PromptVariableListPreview";@@ -95,16 +97,18 @@ ${labels.length > 0 ? labels.map((label) => `const prompt = await langfuse.getPrlangfuse.getPrompt("${name}", ${version})`;-export const PromptDetail = ({ promptName: promptNameProp }: { promptName?: string } = {}) => {+export const PromptDetail = ({+ promptName: promptNameProp,+}: { promptName?: string } = {}) => {const projectId = useProjectIdFromURL();const capture = usePostHogClientCapture();const router = useRouter();- const promptName = promptNameProp || (- router.query.promptName+ const promptName =+ promptNameProp ||+ (router.query.promptName? decodeURIComponent(router.query.promptName as string)- : ''- );+ : "");const [currentPromptVersion, setCurrentPromptVersion] = useQueryParam("version",NumberParam,diff --git a/web/src/features/prompts/server/actions/createPrompt.ts b/web/src/features/prompts/server/actions/createPrompt.tsindex b3f8999a8c..75e2642400 100644--- a/web/src/features/prompts/server/actions/createPrompt.ts+++ b/web/src/features/prompts/server/actions/createPrompt.ts@@ -1,17 +1,15 @@import { v4 as uuidv4 } from "uuid";-import {- type CreatePromptTRPCType,- PromptType,-} from "@/src/features/prompts/server/utils/validation";import {InvalidRequestError,parsePromptDependencyTags,jsonSchema,type PromptDependency,type Prompt,+ type CreatePromptTRPCType,+ LATEST_PROMPT_LABEL,+ PromptType,} from "@langfuse/shared";import { type PrismaClient } from "@langfuse/shared/src/db";-import { LATEST_PROMPT_LABEL } from "@/src/features/prompts/constants";import { removeLabelsFromPreviousPromptVersions } from "@/src/features/prompts/server/utils/updatePromptLabels";import { updatePromptTagsOnAllVersions } from "@/src/features/prompts/server/utils/updatePromptTags";import {diff --git a/web/src/features/prompts/server/actions/getPromptByName.ts b/web/src/features/prompts/server/actions/getPromptByName.tsindex 14bf49aa57..31a7e4f8e3 100644--- a/web/src/features/prompts/server/actions/getPromptByName.ts+++ b/web/src/features/prompts/server/actions/getPromptByName.ts@@ -1,5 +1,8 @@-import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";-import { InvalidRequestError, type Prompt } from "@langfuse/shared";+import {+ InvalidRequestError,+ PRODUCTION_LABEL,+ type Prompt,+} from "@langfuse/shared";import {PromptService,redis,diff --git a/web/src/features/prompts/server/actions/getPromptsMeta.ts b/web/src/features/prompts/server/actions/getPromptsMeta.tsindex 100b96c1d9..f6ffb5f0e4 100644--- a/web/src/features/prompts/server/actions/getPromptsMeta.ts+++ b/web/src/features/prompts/server/actions/getPromptsMeta.ts@@ -1,6 +1,5 @@-import { type GetPromptsMetaType } from "@/src/features/prompts/server/utils/validation";import { promptsTableCols } from "@/src/server/api/definitions/promptsTable";-import { type FilterState } from "@langfuse/shared";+import { type GetPromptsMetaType, type FilterState } from "@langfuse/shared";import { prisma } from "@langfuse/shared/src/db";import { tableColumnsToSqlFilterAndPrefix } from "@langfuse/shared/src/server";diff --git a/web/src/features/prompts/server/handlers/promptNameHandler.ts b/web/src/features/prompts/server/handlers/promptNameHandler.tsindex 5f11da6bce..732aaba107 100644--- a/web/src/features/prompts/server/handlers/promptNameHandler.ts+++ b/web/src/features/prompts/server/handlers/promptNameHandler.ts@@ -1,11 +1,13 @@import type { NextApiRequest, NextApiResponse } from "next";import { getPromptByName } from "@/src/features/prompts/server/actions/getPromptByName";-import { GetPromptByNameSchema } from "@/src/features/prompts/server/utils/validation";import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";import { authorizePromptRequestOrThrow } from "../utils/authorizePromptRequest";-import { LangfuseNotFoundError } from "@langfuse/shared";-import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";+import {+ GetPromptByNameSchema,+ LangfuseNotFoundError,+ PRODUCTION_LABEL,+} from "@langfuse/shared";import { RateLimitService } from "@/src/features/public-api/server/RateLimitService";const getPromptNameHandler = async (diff --git a/web/src/features/prompts/server/handlers/promptsHandler.ts b/web/src/features/prompts/server/handlers/promptsHandler.tsindex eac3200863..a4786994ed 100644--- a/web/src/features/prompts/server/handlers/promptsHandler.ts+++ b/web/src/features/prompts/server/handlers/promptsHandler.ts@@ -2,15 +2,15 @@ import { type NextApiRequest, type NextApiResponse } from "next";import { createPrompt } from "@/src/features/prompts/server/actions/createPrompt";import { getPromptsMeta } from "@/src/features/prompts/server/actions/getPromptsMeta";-import {- CreatePromptSchema,- GetPromptsMetaSchema,-} from "@/src/features/prompts/server/utils/validation";import { withMiddlewares } from "@/src/features/public-api/server/withMiddlewares";import { prisma } from "@langfuse/shared/src/db";import { authorizePromptRequestOrThrow } from "../utils/authorizePromptRequest";import { RateLimitService } from "@/src/features/public-api/server/RateLimitService";-import { InvalidRequestError } from "@langfuse/shared";+import {+ CreatePromptSchema,+ GetPromptsMetaSchema,+ InvalidRequestError,+} from "@langfuse/shared";import { auditLog } from "@/src/features/audit-logs/auditLog";const getPromptsHandler = async (req: NextApiRequest, res: NextApiResponse) => {diff --git a/web/src/features/prompts/server/routers/promptRouter.ts b/web/src/features/prompts/server/routers/promptRouter.tsindex dc7c297631..73bc046a0c 100644--- a/web/src/features/prompts/server/routers/promptRouter.ts+++ b/web/src/features/prompts/server/routers/promptRouter.ts@@ -1,11 +1,6 @@import { z } from "zod/v4";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 {@@ -17,12 +12,15 @@ import { createPrompt, duplicatePrompt } from "../actions/createPrompt";import { checkHasProtectedLabels } from "../utils/checkHasProtectedLabels";import { promptsTableCols } from "@/src/server/api/definitions/promptsTable";import {+ CreatePromptTRPCSchema,InvalidRequestError,+ LATEST_PROMPT_LABEL,optionalPaginationZod,paginationZod,+ PromptLabelSchema,+ PromptType,} from "@langfuse/shared";import { orderBy, singleFilter } from "@langfuse/shared";-import { LATEST_PROMPT_LABEL } from "@/src/features/prompts/constants";import {orderByToPrismaSql,PromptService,@@ -89,7 +87,7 @@ export const promptRouter = createTRPCRouter({);const pathFilter = input.pathPrefix- ? Prisma.sql` AND (p.name LIKE ${input.pathPrefix + '/%'} OR p.name = ${input.pathPrefix})`+ ? Prisma.sql` AND (p.name LIKE ${input.pathPrefix + "/%"} OR p.name = ${input.pathPrefix})`: Prisma.empty;const [prompts, promptCount] = await Promise.all([diff --git a/web/src/features/prompts/utils.ts b/web/src/features/prompts/utils.tsindex f448a7a041..e9e6020950 100644--- a/web/src/features/prompts/utils.ts+++ b/web/src/features/prompts/utils.ts@@ -1,7 +1,4 @@-import {- LATEST_PROMPT_LABEL,- PRODUCTION_LABEL,-} from "@/src/features/prompts/constants";+import { LATEST_PROMPT_LABEL, PRODUCTION_LABEL } from "@langfuse/shared";export const isReservedPromptLabel = (label: string) => {return [PRODUCTION_LABEL, LATEST_PROMPT_LABEL].includes(label);diff --git a/web/src/pages/api/public/prompts.ts b/web/src/pages/api/public/prompts.tsindex c11b528fae..0053992c2d 100644--- a/web/src/pages/api/public/prompts.ts+++ b/web/src/pages/api/public/prompts.ts@@ -5,10 +5,6 @@ import { prisma } from "@langfuse/shared/src/db";import { isPrismaException } from "@/src/utils/exceptions";import { type NextApiRequest, type NextApiResponse } from "next";import { z } from "zod/v4";-import {- LegacyCreatePromptSchema,- GetPromptSchema,-} from "@/src/features/prompts/server/utils/validation";import {UnauthorizedError,LangfuseNotFoundError,@@ -16,6 +12,9 @@ import {MethodNotAllowedError,ForbiddenError,type Prompt,+ GetPromptSchema,+ LegacyCreatePromptSchema,+ PRODUCTION_LABEL,} from "@langfuse/shared";import {PromptService,@@ -24,7 +23,6 @@ import {traceException,logger,} from "@langfuse/shared/src/server";-import { PRODUCTION_LABEL } from "@/src/features/prompts/constants";import { RateLimitService } from "@/src/features/public-api/server/RateLimitService";import { telemetry } from "@/src/features/telemetry";diff --git a/web/src/server/api/definitions/promptsTable.ts b/web/src/server/api/definitions/promptsTable.tsindex 685673925a..c52f96a435 100644--- a/web/src/server/api/definitions/promptsTable.ts+++ b/web/src/server/api/definitions/promptsTable.ts@@ -1,6 +1,6 @@-import { PromptType } from "@/src/features/prompts/server/utils/validation";import {type ColumnDefinition,+ PromptType,type SingleValueOption,formatColumnOptions,} from "@langfuse/shared";