Skip to content

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

refactor(web): Enable knip unused export checking (#16683)

Ben Bachem30a2ad18b34d
diff --git a/knip.jsonc b/knip.jsonc
index f46ad980e5..2a0c0329f3 100644
--- a/knip.jsonc
+++ b/knip.jsonc
@@ -5,9 +5,9 @@
"catalog": "off",
},
"ignoreIssues": {
- "web/**": ["exports", "types"],
- "packages/shared/**": ["exports", "types"],
- "worker/**": ["exports", "types"],
+ "web/**": ["types"],
+ "packages/shared/**": ["types"],
+ "worker/**": ["types"],
},
"workspaces": {
"packages/shared": {
@@ -17,11 +17,13 @@
],
},
"worker": {
- "ignoreFiles": [
+ "entry": [
// Migration implementations are loaded dynamically from script names persisted in the database.
- "src/backgroundMigrations/!(backgroundMigrationManager|IBackgroundMigration).ts",
- // Shared only by background migration modules that Knip cannot discover through dynamic loading.
- "src/backgroundMigrations/utils/backfillBase.ts",
+ "src/backgroundMigrations/*.ts",
+ // Loaded through a dynamic require from the tokenisation worker thread.
+ "src/features/tokenisation/usage.ts",
+ ],
+ "ignoreFiles": [
// Standalone fixture downloader invoked manually as documented in the adjacent README.
"src/__tests__/chatml/framework-traces/download_traces.js",
// Updated by release-it even though worker runtime code does not import it.
@@ -33,8 +35,6 @@
// Operational and maintenance scripts are invoked directly or through package scripts, not imported.
"src/scripts/**/*.{ts,js}",
],
- // Tests intentionally load these from @langfuse/shared's dependency tree.
- "ignoreDependencies": ["@aws-sdk/client-bedrock-runtime"],
},
"web": {
"ignoreFiles": [
diff --git a/packages/shared/scripts/seeder/utils/clickhouse-seed-constants.ts b/packages/shared/scripts/seeder/utils/clickhouse-seed-constants.ts
index cfbfd248f1..495129b723 100644
--- a/packages/shared/scripts/seeder/utils/clickhouse-seed-constants.ts
+++ b/packages/shared/scripts/seeder/utils/clickhouse-seed-constants.ts
@@ -49,53 +49,6 @@ export const REALISTIC_MODELS = [
"claude-opus-5",
];
-export const REALISTIC_USER_INPUTS = [
- "What is the weather in San Francisco?",
- "Summarize this document for me",
- "Generate a Python function to sort a list",
- "Explain quantum computing in simple terms",
- "Analyze this data and provide insights",
- "Translate this text to Spanish",
- "Create a marketing email for our product",
- "Debug this code and fix the errors",
- "What are the latest trends in AI?",
- "Help me plan a trip to Europe",
-];
-
-export const REALISTIC_AI_RESPONSES = [
- "The current weather in San Francisco is 60 degrees and foggy.",
- "Here's a summary of the key points from the document...",
- "Here's a Python function that sorts a list efficiently...",
- "Quantum computing uses quantum mechanics principles...",
- "Based on the data analysis, I found the following insights...",
- "Here's the Spanish translation of your text...",
- "I've created a compelling marketing email for your product...",
- "I found several issues in your code and here are the fixes...",
- "The latest AI trends include large language models...",
- "Here's a detailed 10-day European itinerary for you...",
-];
-
-export const REALISTIC_METADATA_EXAMPLES = [
- { thread_id: 42, session_type: "interactive" },
- { user_id: "user_123", conversation_id: "conv_456" },
- { model_version: "v2.1", temperature: 0.7 },
- { request_id: "req_789", timestamp: "2024-05-23T15:42:11.996Z" },
- { environment: "production", region: "us-west-2" },
- {
- document_type: "state_of_union",
- file_size: "142KB",
- processing_time: "2.3s",
- },
- { data_source: "product_catalog", record_count: 30, format: "nested_json" },
- { analysis_type: "sentiment", language: "en", confidence: 0.92 },
- {
- extraction_task: "policy_analysis",
- domain: "politics",
- entities_found: 15,
- },
- { file_type: "JSON", validation: "passed", schema_version: "v1.2" },
-];
-
export const REALISTIC_AGENT_NAMES = [
"AI-Coordinator",
"TaskManager",
diff --git a/packages/shared/src/features/monitors/helpers.ts b/packages/shared/src/features/monitors/helpers.ts
index fa979ccc9a..12cb4ea4ac 100644
--- a/packages/shared/src/features/monitors/helpers.ts
+++ b/packages/shared/src/features/monitors/helpers.ts
@@ -4,7 +4,7 @@
/**
* SECOND is one second in milliseconds.
*/
-export const SECOND = 1000n;
+const SECOND = 1000n;
/**
* MINUTE is one minute in milliseconds.
diff --git a/packages/shared/src/features/rbac/projectAccessRights.ts b/packages/shared/src/features/rbac/projectAccessRights.ts
index 838f25633a..4fe8643b35 100644
--- a/packages/shared/src/features/rbac/projectAccessRights.ts
+++ b/packages/shared/src/features/rbac/projectAccessRights.ts
@@ -1,7 +1,5 @@
import { type Role } from "../../db";
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
export const projectScopes = [
"projectMembers:read",
"projectMembers:CUD",
diff --git a/packages/shared/src/features/scores/interfaces/api/shared.ts b/packages/shared/src/features/scores/interfaces/api/shared.ts
index 3f2b55968e..bee00fc7f9 100644
--- a/packages/shared/src/features/scores/interfaces/api/shared.ts
+++ b/packages/shared/src/features/scores/interfaces/api/shared.ts
@@ -20,7 +20,7 @@ import { InvalidRequestError } from "../../../../errors";
const operators = ["<", ">", "<=", ">=", "!=", "="] as const;
-export const SCORE_FIELD_GROUPS = ["score", "trace"] as const;
+const SCORE_FIELD_GROUPS = ["score", "trace"] as const;
/**
* Endpoints
diff --git a/packages/shared/src/server/llm/ai-sdk/telemetry.ts b/packages/shared/src/server/llm/ai-sdk/telemetry.ts
index bf2bfcba15..dbac53db05 100644
--- a/packages/shared/src/server/llm/ai-sdk/telemetry.ts
+++ b/packages/shared/src/server/llm/ai-sdk/telemetry.ts
@@ -296,7 +296,7 @@ export function createAiSdkTelemetryCapture(params: {
/**
* Minimal AI SDK telemetry integration for Langfuse-internal LLM completions.
*/
-export function createGenerationSpanTelemetry(params: {
+function createGenerationSpanTelemetry(params: {
tracer: Tracer;
/**
* Extra attributes for every generation span (Langfuse prompt link,
diff --git a/packages/shared/src/server/queries/clickhouse-sql/event-query-builder.ts b/packages/shared/src/server/queries/clickhouse-sql/event-query-builder.ts
index b9fedc4517..c8cca91e4d 100644
--- a/packages/shared/src/server/queries/clickhouse-sql/event-query-builder.ts
+++ b/packages/shared/src/server/queries/clickhouse-sql/event-query-builder.ts
@@ -589,7 +589,7 @@ const AGGREGATION_FIELD_SETS = {
* // Use when you need to query across all projects (use with caution!)
* const builder = new EventsQueryBuilder({ projectId: NoProjectId });
*/
-export const NoProjectId = Symbol("NoProjectId");
+const NoProjectId = Symbol("NoProjectId");
export type NoProjectIdType = typeof NoProjectId;
/**
diff --git a/packages/shared/src/server/queries/clickhouse-sql/factory.ts b/packages/shared/src/server/queries/clickhouse-sql/factory.ts
index 7f66df2dc3..9135ddc994 100644
--- a/packages/shared/src/server/queries/clickhouse-sql/factory.ts
+++ b/packages/shared/src/server/queries/clickhouse-sql/factory.ts
@@ -25,7 +25,7 @@ import {
} from "./clickhouse-filter";
import { assertValidFtsMatchFilter } from "./fts";
-export class QueryBuilderError extends Error {
+class QueryBuilderError extends Error {
constructor(message: string) {
super(message);
this.name = "QueryBuilderError";
diff --git a/packages/shared/src/server/queries/clickhouse-sql/fts.ts b/packages/shared/src/server/queries/clickhouse-sql/fts.ts
index a038a9ce6b..71691b268d 100644
--- a/packages/shared/src/server/queries/clickhouse-sql/fts.ts
+++ b/packages/shared/src/server/queries/clickhouse-sql/fts.ts
@@ -12,13 +12,12 @@ type StringOperator = (typeof filterOperators)["string"][number];
export type FtsStringOperator = StringOperator | FtsMatchOperator;
export type FtsAcceleratedStringOperator = "=" | FtsMatchOperator;
-export const FTS_MATCH_TOKEN_ERROR =
- "`matches` requires at least one search token.";
-export const FTS_MATCH_TARGET_ERROR =
+const FTS_MATCH_TOKEN_ERROR = "`matches` requires at least one search token.";
+const FTS_MATCH_TARGET_ERROR =
"`matches` is only supported for input, output, and metadata filters.";
-export const FTS_TEXT_NORMALIZER = "lower";
-export const FTS_HAS_ALL_TOKENS_MAX_SEARCH_TOKENS = 64;
+const FTS_TEXT_NORMALIZER = "lower";
+const FTS_HAS_ALL_TOKENS_MAX_SEARCH_TOKENS = 64;
export const FTS_EVENTS_TABLES: ReadonlySet<string> = new Set(
EVENTS_TABLE_NAMES,
@@ -95,10 +94,7 @@ const ftsTokenPrefilterPredicate = (
): string =>
`hasAllTokens(${fieldExpr}, ${ftsSearchTokenPrefilterExpr(valueParam, normalizeValue)})`;
-export const ftsTextTokenPredicate = (
- fieldExpr: string,
- valueParam: string,
-): string =>
+const ftsTextTokenPredicate = (fieldExpr: string, valueParam: string): string =>
ftsTokenPrefilterPredicate(normalizeFtsTextExpr(fieldExpr), valueParam, true);
export const ftsTextTokenConjunct = (
@@ -107,18 +103,16 @@ export const ftsTextTokenConjunct = (
): string =>
`(empty(${ftsSearchTokensExpr(valueParam, true)}) OR ${ftsTextTokenPredicate(fieldExpr, valueParam)})`;
-export const ftsTextIndexedSubstringCondition = (
+const ftsTextIndexedSubstringCondition = (
fieldExpr: string,
valueParam: string,
): string =>
`(position(${normalizeFtsTextExpr(fieldExpr)}, ${normalizeFtsTextExpr(valueParam)}) > 0 AND ${ftsTextTokenPredicate(fieldExpr, valueParam)})`;
-export const ftsMetadataArrayHas = (
- arrayExpr: string,
- valueParam: string,
-): string => `has(${arrayExpr}, ${valueParam})`;
+const ftsMetadataArrayHas = (arrayExpr: string, valueParam: string): string =>
+ `has(${arrayExpr}, ${valueParam})`;
-export const ftsMetadataArrayTokenConjunct = (
+const ftsMetadataArrayTokenConjunct = (
arrayExpr: string,
valueParam: string,
): string => ftsTokenPrefilterPredicate(arrayExpr, valueParam, false);
@@ -139,7 +133,7 @@ type FtsOperatorDescriptor = {
metadataArrayCondition: (ctx: FtsMetadataArrayConditionContext) => string;
};
-export const ftsMetadataArrayIndexedSubstringCondition = ({
+const ftsMetadataArrayIndexedSubstringCondition = ({
hasKey,
valuesColumn,
valueAccessor,
diff --git a/packages/shared/src/server/queries/clickhouse-sql/query-fragments.ts b/packages/shared/src/server/queries/clickhouse-sql/query-fragments.ts
index 35ee441da0..32233ea07e 100644
--- a/packages/shared/src/server/queries/clickhouse-sql/query-fragments.ts
+++ b/packages/shared/src/server/queries/clickhouse-sql/query-fragments.ts
@@ -179,7 +179,7 @@ const scoreTimestampLowerBound = (
* Observation level: Aggregates scores by (trace_id, observation_id), always uses nested structure
* Trace level: Aggregates scores by (project_id, trace_id), filters observation_id IS NULL
*/
-export const buildScoresAggregationCTE = (
+const buildScoresAggregationCTE = (
params: BaseScoresAggregationParams,
): { query: string; params: Record<string, any> } => {
const queryParams: Record<string, any> = {
diff --git a/packages/shared/src/server/query-ast/goldenHarness.ts b/packages/shared/src/server/query-ast/goldenHarness.ts
index 980f91ef0f..62af4d9e08 100644
--- a/packages/shared/src/server/query-ast/goldenHarness.ts
+++ b/packages/shared/src/server/query-ast/goldenHarness.ts
@@ -164,7 +164,7 @@ export function clickhouseFormatAvailable(): boolean {
* which `clickhouse-local` provides — no server, no state. Throws on a parse
* error so malformed SQL fails the test instead of comparing raw.
*/
-export function formatSql(sql: string): string {
+function formatSql(sql: string): string {
const res = spawnSync(clickhouseBin, ["format"], {
input: sql,
encoding: "utf8",
diff --git a/packages/shared/src/server/redis/redisErrorContext.ts b/packages/shared/src/server/redis/redisErrorContext.ts
index f075355a85..65eedf172f 100644
--- a/packages/shared/src/server/redis/redisErrorContext.ts
+++ b/packages/shared/src/server/redis/redisErrorContext.ts
@@ -86,7 +86,7 @@ const CODE_FAILURE_MODES: Record<string, RedisFailureMode> = {
ERR_TLS_CERT_ALTNAME_INVALID: "tls",
};
-export const classifyRedisFailure = (error: unknown): RedisFailureMode => {
+const classifyRedisFailure = (error: unknown): RedisFailureMode => {
const { code, message } = describeError(error);
if (code) {
diff --git a/packages/shared/src/utils/chatml/adapters/openai.ts b/packages/shared/src/utils/chatml/adapters/openai.ts
index ffa19d8540..edeb3021cf 100644
--- a/packages/shared/src/utils/chatml/adapters/openai.ts
+++ b/packages/shared/src/utils/chatml/adapters/openai.ts
@@ -107,7 +107,7 @@ const RESPONSES_REQUEST_SIBLINGS = [
* preprocessing consumes. Also used by extractAdditionalInput to hide `input`
* from additional input only when it holds the conversation.
*/
-export function isOpenAIResponsesRequest(
+function isOpenAIResponsesRequest(
data: unknown,
): data is Record<string, unknown> {
if (!data || typeof data !== "object" || Array.isArray(data)) return false;
diff --git a/web/.storybook/docs/ThemeTokens/Layout.tsx b/web/.storybook/docs/ThemeTokens/Layout.tsx
index 5ad89144f6..9daab0f008 100644
--- a/web/.storybook/docs/ThemeTokens/Layout.tsx
+++ b/web/.storybook/docs/ThemeTokens/Layout.tsx
@@ -74,7 +74,7 @@ function RadiusSample({
}
/** The radius scale: one base token, derived sm / md / lg steps. */
-export function RadiiSection({ ctx, lightCtx, darkCtx }: RowContexts) {
+function RadiiSection({ ctx, lightCtx, darkCtx }: RowContexts) {
const count = (radiusEntry ? 1 : 0) + inlineRadii.length;
return (
<TokenSection
@@ -142,7 +142,7 @@ function BannerSystemSample({ ctx }: { ctx: TokenContext }) {
}
/** The banner offset system used by fixed/sticky positioning. */
-export function LayoutOffsetsSection({ ctx, lightCtx, darkCtx }: RowContexts) {
+function LayoutOffsetsSection({ ctx, lightCtx, darkCtx }: RowContexts) {
const count = bannerEntries.length + spacingTokens.length;
return (
<TokenSection
@@ -216,7 +216,7 @@ function LayerStack({
);
}
-export function LayeringSection({
+function LayeringSection({
lightCtx,
darkCtx,
}: {
@@ -265,7 +265,7 @@ const LAYER_DESCRIPTIONS: Record<string, string> = {
* code constants mapped to DOM containers in _document.tsx, not CSS tokens:
* layers stack purely by DOM order.
*/
-export function LayerSystemSection({ ctx }: { ctx: TokenContext }) {
+function LayerSystemSection({ ctx }: { ctx: TokenContext }) {
return (
<PageSection
title="Overlay layers"
@@ -336,7 +336,7 @@ function animationSampleStyle(ctx: TokenContext, name: string): CSSProperties {
}
/** @theme inline animation tokens, collapsed (low traffic). */
-export function AnimationsSection({ ctx, lightCtx, darkCtx }: RowContexts) {
+function AnimationsSection({ ctx, lightCtx, darkCtx }: RowContexts) {
return (
<CollapsedSection
title="Animations"
@@ -372,7 +372,7 @@ export function AnimationsSection({ ctx, lightCtx, darkCtx }: RowContexts) {
}
/** Breakpoints are deliberately not tokenized; say so instead of inventing. */
-export function BreakpointsNote() {
+function BreakpointsNote() {
return (
<PageSection
title="Breakpoints"
diff --git a/web/.storybook/docs/ThemeTokens/shared.tsx b/web/.storybook/docs/ThemeTokens/shared.tsx
index e6506edc9d..698ade462f 100644
--- a/web/.storybook/docs/ThemeTokens/shared.tsx
+++ b/web/.storybook/docs/ThemeTokens/shared.tsx
@@ -68,7 +68,7 @@ export type TokenContext = {
color: (name: string) => string | undefined;
};
-export function buildContext(dark: boolean): TokenContext {
+function buildContext(dark: boolean): TokenContext {
const map = new Map<string, string>();
for (const declaration of [
...parsed.fontTokens,
@@ -99,7 +99,7 @@ const subscribeToThemeClass = (callback: () => void) => {
return () => observer.disconnect();
};
-export const useIsDarkTheme = () =>
+const useIsDarkTheme = () =>
useSyncExternalStore(
subscribeToThemeClass,
() => document.documentElement.classList.contains("dark"),
@@ -127,7 +127,7 @@ export type PageId = "color" | "typography" | "layout" | "charts";
const rootNames = new Set(rootEntries.map((entry) => entry.name));
-export const PAGE_TOKEN_MATCHERS: Array<{
+const PAGE_TOKEN_MATCHERS: Array<{
page: PageId;
test: (name: string) => boolean;
}> = [
@@ -147,7 +147,7 @@ export const PAGE_TOKEN_MATCHERS: Array<{
];
/** Every distinct token name the parser extracted from globals.css. */
-export const allTokenNames: string[] = [
+const allTokenNames: string[] = [
...new Set(
[
...parsed.fontTokens,
@@ -220,7 +220,7 @@ function TableHeader() {
);
}
-export function EmptyCell() {
+function EmptyCell() {
return <span className="text-muted-foreground font-mono text-[11px]">—</span>;
}
diff --git a/web/src/__tests__/fixtures/TestRouter.ts b/web/src/__tests__/fixtures/TestRouter.ts
index 832173adf3..f34a670de0 100644
--- a/web/src/__tests__/fixtures/TestRouter.ts
+++ b/web/src/__tests__/fixtures/TestRouter.ts
@@ -4,7 +4,7 @@ import { type LocationMock } from "@jedmao/location";
type PartialRouter = Partial<Router>;
-export const BASE_URL = "https://langfuse.com";
+const BASE_URL = "https://langfuse.com";
/**
* A Router to be used for testing which provides the bare minimum needed
diff --git a/web/src/__tests__/server/mcp-helpers.ts b/web/src/__tests__/server/mcp-helpers.ts
index 873ea10ebf..0bde322125 100644
--- a/web/src/__tests__/server/mcp-helpers.ts
+++ b/web/src/__tests__/server/mcp-helpers.ts
@@ -80,69 +80,6 @@ export const mcpEvalOutputDefinition = {
score: { description: "A score between 0 and 1" },
};
-/**
- * Verifies that a response follows the MCP content block format.
- * MCP tools return { content: [{ type: "text", text: "..." }] }
- */
-export function verifyMcpResponseFormat(
- response: unknown,
-): asserts response is {
- content: Array<{ type: "text"; text: string }>;
-} {
- if (!response || typeof response !== "object") {
- throw new Error("Response must be an object");
- }
-
- const resp = response as Record<string, unknown>;
-
- if (!Array.isArray(resp.content)) {
- throw new Error("Response must have 'content' array");
- }
-
- if (resp.content.length === 0) {
- throw new Error("Response content array must not be empty");
- }
-
- for (const block of resp.content) {
- if (typeof block !== "object" || block === null) {
- throw new Error("Each content block must be an object");
- }
-
- const blockTyped = block as Record<string, unknown>;
-
- if (blockTyped.type !== "text") {
- throw new Error(
- `Content block type must be 'text', got: ${blockTyped.type}`,
- );
- }
-
- if (typeof blockTyped.text !== "string") {
- throw new Error("Content block text must be a string");
- }
- }
-}
-
-/**
- * Extracts the text content from an MCP tool response.
- * Assumes the response has been validated with verifyMcpResponseFormat.
- */
-export function extractMcpResponseText(response: {
- content: Array<{ type: "text"; text: string }>;
-}): string {
- return response.content.map((block) => block.text).join("");
-}
-
-/**
- * Parses JSON from an MCP tool response text.
- * Handles the common case where tool responses are JSON strings.
- */
-export function parseMcpResponseJson<T = unknown>(response: {
- content: Array<{ type: "text"; text: string }>;
-}): T {
- const text = extractMcpResponseText(response);
- return JSON.parse(text) as T;
-}
-
/**
* Verifies that an audit log entry was created for an MCP operation.
* Returns the audit log entry for further assertions.
@@ -227,16 +164,6 @@ export async function createPromptInDb(params: {
});
}
-/**
- * Deletes all prompts for a specific project.
- * Useful for cleanup in tests.
- */
-export async function cleanupProjectPrompts(projectId: string): Promise<void> {
- await prisma.prompt.deleteMany({
- where: { projectId },
- });
-}
-
/**
* Helper to check if a tool has the correct MCP annotations.
*/
diff --git a/web/src/__tests__/server/redis-test-utils.ts b/web/src/__tests__/server/redis-test-utils.ts
index f73f1a6683..88f536177e 100644
--- a/web/src/__tests__/server/redis-test-utils.ts
+++ b/web/src/__tests__/server/redis-test-utils.ts
@@ -27,7 +27,7 @@ export const createRedisTestClient = (
return client;
};
-export const isRedisConnectionClosedError = (error: unknown): boolean =>
+const isRedisConnectionClosedError = (error: unknown): boolean =>
error instanceof Error && error.message.includes("Connection is closed");
export const ensureRedisReady = async (
@@ -64,7 +64,7 @@ export const getRedisKeysByPattern = async (
return await scanKeys(redisClient, pattern);
};
-export const clearRedisKeysByPattern = async (
+const clearRedisKeysByPattern = async (
redisClient: RedisTestClient,
pattern: string,
): Promise<void> => {
diff --git a/web/src/__tests__/test-utils.ts b/web/src/__tests__/test-utils.ts
index 5a1749e1ca..1c546096de 100644
--- a/web/src/__tests__/test-utils.ts
+++ b/web/src/__tests__/test-utils.ts
@@ -15,7 +15,7 @@ import {
} from "@langfuse/shared/src/server";
import { type z } from "zod";
-export const getQueues = () => {
+const getQueues = () => {
const queues: string[] = Object.values(QueueName);
queues.push(
...IngestionQueue.getShardNames(),
diff --git a/web/src/components/ChatMessages/MessageSearch.tsx b/web/src/components/ChatMessages/MessageSearch.tsx
index c494c6d01a..6c2cdbd497 100644
--- a/web/src/components/ChatMessages/MessageSearch.tsx
+++ b/web/src/components/ChatMessages/MessageSearch.tsx
@@ -1,7 +1,6 @@
export {
MessageSearchPageProvider,
MessageSearchProvider,
- useMessageSearch,
useMessageSearchActions,
useOptionalMessageSearchActions,
useOptionalMessageSearchPageId,
diff --git a/web/src/components/LocalIsoDate.tsx b/web/src/components/LocalIsoDate.tsx
index d6e07b5e10..a96ccf9ae0 100644
--- a/web/src/components/LocalIsoDate.tsx
+++ b/web/src/components/LocalIsoDate.tsx
@@ -33,7 +33,7 @@ export const formatLocalIsoDate = (
return formatted;
};
-export const prepareLocalIsoDate = ({
+const prepareLocalIsoDate = ({
date,
accuracy = "second",
}: {
diff --git a/web/src/components/editor/dark-theme.ts b/web/src/components/editor/dark-theme.ts
index 776d8c8d51..edd9dc89fb 100644
--- a/web/src/components/editor/dark-theme.ts
+++ b/web/src/components/editor/dark-theme.ts
@@ -5,11 +5,11 @@ import {
import { tags as t } from "@lezer/highlight";
import { createTheme, type CreateThemeOptions } from "@uiw/codemirror-themes";
-export const defaultSettingsDarkTheme: CreateThemeOptions["settings"] = {
+const defaultSettingsDarkTheme: CreateThemeOptions["settings"] = {
...defaultSettingsBothThemes,
};
-export const darkThemeStyle: CreateThemeOptions["styles"] = [
+const darkThemeStyle: CreateThemeOptions["styles"] = [
...bothThemeStyles,
{ tag: t.keyword, color: "#bb9af7" },
{
@@ -33,7 +33,7 @@ export const darkThemeStyle: CreateThemeOptions["styles"] = [
{ tag: t.strikethrough, textDecoration: "line-through" },
];
-export const darkThemeInit = (options?: Partial<CreateThemeOptions>) => {
+const darkThemeInit = (options?: Partial<CreateThemeOptions>) => {
const { theme = "dark", settings = {}, styles = [] } = options || {};
return createTheme({
theme: theme,
diff --git a/web/src/components/editor/light-theme.ts b/web/src/components/editor/light-theme.ts
index 66f84228da..9d4096bbcd 100644
--- a/web/src/components/editor/light-theme.ts
+++ b/web/src/components/editor/light-theme.ts
@@ -5,11 +5,11 @@ import {
import { tags as t } from "@lezer/highlight";
import { createTheme, type CreateThemeOptions } from "@uiw/codemirror-themes";
-export const defaultSettingsLightTheme: CreateThemeOptions["settings"] = {
+const defaultSettingsLightTheme: CreateThemeOptions["settings"] = {
...defaultSettingsBothThemes,
};
-export const lightThemeStyle: CreateThemeOptions["styles"] = [
+const lightThemeStyle: CreateThemeOptions["styles"] = [
...bothThemeStyles,
{
tag: [
@@ -62,7 +62,7 @@ export const lightThemeStyle: CreateThemeOptions["styles"] = [
{ tag: t.link, color: "#4078f2", textDecoration: "underline" },
];
-export function lightThemeInit(options?: Partial<CreateThemeOptions>) {
+function lightThemeInit(options?: Partial<CreateThemeOptions>) {
const { theme = "light", settings = {}, styles = [] } = options || {};
return createTheme({
theme: theme,
diff --git a/web/src/components/layouts/app-layout/utils/navigationFilters.ts b/web/src/components/layouts/app-layout/utils/navigationFilters.ts
index e40449cfcc..ded8951f52 100644
--- a/web/src/components/layouts/app-layout/utils/navigationFilters.ts
+++ b/web/src/components/layouts/app-layout/utils/navigationFilters.ts
@@ -19,7 +19,7 @@ type Organization =
* Individual filter functions - each handles one concern
* Exported for testing and composition
*/
-export const filters = {
+const filters = {
/**
* Filter routes that require a project ID when none is available
*/
diff --git a/web/src/components/layouts/overview-panel.tsx b/web/src/components/layouts/overview-panel.tsx
index dd358fd29f..e9a3a464c0 100644
--- a/web/src/components/layouts/overview-panel.tsx
+++ b/web/src/components/layouts/overview-panel.tsx
@@ -211,13 +211,4 @@ const OverviewPanelSection = React.forwardRef<
));
OverviewPanelSection.displayName = "OverviewPanelSection";
-export {
- OverviewPanelToggle,
- OverviewPanelLayout,
- OverviewPanel,
- OverviewPanelHeader,
- OverviewPanelContent,
- OverviewPanelFooter,
- OverviewPanelField,
- OverviewPanelSection,
-};
+export { OverviewPanelToggle, OverviewPanelLayout };
diff --git a/web/src/components/layouts/utilities/routes.ts b/web/src/components/layouts/utilities/routes.ts
index d4a9cd5339..c4721dce66 100644
--- a/web/src/components/layouts/utilities/routes.ts
+++ b/web/src/components/layouts/utilities/routes.ts
@@ -1,67 +1,7 @@
-import { RouteSection, RouteGroup, ROUTES, type Route } from "../routes";
+import { type Route } from "../routes";
export type NavigationItem = Omit<Route, "children" | "items"> & {
url: string;
isActive: boolean;
items?: NavigationItem[];
};
-
-// Helper to group processed navigation items
-const groupProcessedNavigation = (items: NavigationItem[]) => {
- const ungrouped = items.filter((item) => !item.group);
- const grouped: Partial<Record<RouteGroup, NavigationItem[]>> = {};
-
- // Only create groups that have actual items
- items.forEach((item) => {
- if (item.group) {
- if (!grouped[item.group]) {
- grouped[item.group] = [];
- }
- grouped[item.group]!.push(item);
- }
- });
-
- // Return null for grouped if no groups were created
- const groupedResult = Object.keys(grouped).length > 0 ? grouped : null;
-
- // Build flattened array preserving group order
- const groupedItems = groupedResult
- ? [
- ...(grouped[RouteGroup.Observability] || []),
- ...(grouped[RouteGroup.PromptManagement] || []),
- ...(grouped[RouteGroup.Evaluation] || []),
- ]
- : [];
-
- return {
- ungrouped,
- grouped: groupedResult,
- flattened: [...ungrouped, ...groupedItems],
- };
-};
-
-export function processNavigation(
- mapNavigation: (route: Route) => NavigationItem | null,
-) {
- // First process all routes (apply filtering, permissions, etc.)
- const allProcessedItems = ROUTES.map(mapNavigation).filter(
- (item): item is NavigationItem => Boolean(item),
- );
-
- // Then group the processed items by section
- const mainItems = allProcessedItems.filter(
- (item) => item.section === RouteSection.Main,
- );
- const secondaryItems = allProcessedItems.filter(
- (item) => item.section === RouteSection.Secondary,
- );
-
- const mainNavigation = groupProcessedNavigation(mainItems);
- const secondaryNavigation = groupProcessedNavigation(secondaryItems);
-
- return {
- mainNavigation,
- secondaryNavigation,
- navigation: [...mainNavigation.flattened, ...secondaryNavigation.flattened],
- };
-}
diff --git a/web/src/components/magicui/rainbow-button.tsx b/web/src/components/magicui/rainbow-button.tsx
index e5613d776d..f220af53c2 100644
--- a/web/src/components/magicui/rainbow-button.tsx
+++ b/web/src/components/magicui/rainbow-button.tsx
@@ -65,4 +65,4 @@ const RainbowButton = React.forwardRef<HTMLButtonElement, RainbowButtonProps>(
RainbowButton.displayName = "RainbowButton";
-export { RainbowButton, rainbowButtonVariants, type RainbowButtonProps };
+export { RainbowButton, type RainbowButtonProps };
diff --git a/web/src/components/session/actions/downloadSessionAsJson.ts b/web/src/components/session/actions/downloadSessionAsJson.ts
index c5af9fa7b7..08f32f7bfb 100644
--- a/web/src/components/session/actions/downloadSessionAsJson.ts
+++ b/web/src/components/session/actions/downloadSessionAsJson.ts
@@ -19,7 +19,7 @@ type CaptureSessionEvent = (
eventName: "session_detail:download_button_click",
) => void;
-export function buildSessionExportData({
+function buildSessionExportData({
session,
sessionComments,
traceCommentsByTraceId,
diff --git a/web/src/components/session/index.tsx b/web/src/components/session/index.tsx
index 447036e395..484eca7267 100644
--- a/web/src/components/session/index.tsx
+++ b/web/src/components/session/index.tsx
@@ -119,7 +119,7 @@ import {
// Keep this near TanStack's default to avoid waking too many lazy row loaders.
const SESSION_VIRTUALIZER_OVERSCAN = 5;
-export function SessionUsers({
+function SessionUsers({
projectId,
users,
}: {
diff --git a/web/src/components/session/session-detail-presets.ts b/web/src/components/session/session-detail-presets.ts
index 6e140bd586..7fb6cf3db8 100644
--- a/web/src/components/session/session-detail-presets.ts
+++ b/web/src/components/session/session-detail-presets.ts
@@ -91,19 +91,13 @@ export const SESSION_DETAIL_SYSTEM_PRESETS: SessionDetailSystemPreset[] = [
},
];
-export const SESSION_DETAIL_LLM_CALL_PRESETS =
- SESSION_DETAIL_SYSTEM_PRESETS.filter((preset) =>
- preset.filters.some((filter) => filter.type === "positionInTrace"),
- );
-
/**
* The default view: "All observations with I/O". Shows the real session out of
* the box (chat looks like chat, an agent run shows its tool calls) without the
* old "first generation" default that rendered empty cards for agentic sessions
* with no GENERATION (LFE-10520).
*/
-export const getSessionDetailDefaultPreset = () =>
- SESSION_DETAIL_SYSTEM_PRESETS[0];
+const getSessionDetailDefaultPreset = () => SESSION_DETAIL_SYSTEM_PRESETS[0];
/**
* Which system preset to auto-apply on load. A selected system preset (deep
diff --git a/web/src/components/session/sessionFilterOptions.ts b/web/src/components/session/sessionFilterOptions.ts
index 8e24aa8c4b..13c580dd36 100644
--- a/web/src/components/session/sessionFilterOptions.ts
+++ b/web/src/components/session/sessionFilterOptions.ts
@@ -1,6 +1,6 @@
import { type FilterState, type TimeFilter } from "@langfuse/shared";
-export const isSessionStartTimeFilter = (
+const isSessionStartTimeFilter = (
filter: FilterState[number],
): filter is TimeFilter =>
(filter.column === "Start Time" || filter.column === "startTime") &&
diff --git a/web/src/components/table/ValueCell.tsx b/web/src/components/table/ValueCell.tsx
index b2fb0eb64c..50e0dd4bb1 100644
--- a/web/src/components/table/ValueCell.tsx
+++ b/web/src/components/table/ValueCell.tsx
@@ -36,7 +36,7 @@ export type MetadataFilterActions = {
};
const MAX_STRING_LENGTH_FOR_LINK_DETECTION = 1500;
-export const MAX_CELL_DISPLAY_CHARS = 2000;
+const MAX_CELL_DISPLAY_CHARS = 2000;
const ARRAY_PREVIEW_ITEMS = 3;
const MONO_TEXT_CLASSES = "font-mono text-xs wrap-break-word";
const PREVIEW_TEXT_CLASSES = "italic text-gray-500 dark:text-gray-400";
diff --git a/web/src/components/table/data-table-controls.tsx b/web/src/components/table/data-table-controls.tsx
index 05f4be426d..52cbaad3db 100644
--- a/web/src/components/table/data-table-controls.tsx
+++ b/web/src/components/table/data-table-controls.tsx
@@ -1499,7 +1499,7 @@ interface FilterAccordionItemProps {
onReset?: () => void;
}
-export function FilterAccordionItem({
+function FilterAccordionItem({
label,
tooltip,
help,
@@ -2132,7 +2132,7 @@ function CategoricalSelectContent({
);
}
-export function NumericFacet({
+function NumericFacet({
label,
tooltip,
help,
@@ -2303,7 +2303,7 @@ export function NumericFacet({
);
}
-export function StringFacet({
+function StringFacet({
label,
tooltip,
help,
@@ -2384,7 +2384,7 @@ export function StringFacet({
);
}
-export function KeyValueFacet({
+function KeyValueFacet({
label,
tooltip,
help,
@@ -2434,7 +2434,7 @@ export function KeyValueFacet({
);
}
-export function NumericKeyValueFacet({
+function NumericKeyValueFacet({
label,
tooltip,
help,
@@ -2482,7 +2482,7 @@ export function NumericKeyValueFacet({
);
}
-export function BooleanKeyValueFacet({
+function BooleanKeyValueFacet({
label,
tooltip,
help,
@@ -2530,7 +2530,7 @@ export function BooleanKeyValueFacet({
);
}
-export function StringKeyValueFacet({
+function StringKeyValueFacet({
label,
tooltip,
help,
@@ -2727,7 +2727,7 @@ interface FilterValueCheckboxProps {
disabled?: boolean;
}
-export function FilterValueCheckbox({
+function FilterValueCheckbox({
id,
label,
icon,
@@ -2805,18 +2805,3 @@ export function FilterValueCheckbox({
</div>
);
}
-
-export function DataTableControlsSection({
- title,
- children,
-}: {
- title: string;
- children: React.ReactNode;
-}) {
- return (
- <div className="space-y-3">
- <h3 className="text-foreground text-sm font-bold">{title}</h3>
- <div>{children}</div>
- </div>
- );
-}
diff --git a/web/src/components/table/data-table-row-height-switch.tsx b/web/src/components/table/data-table-row-height-switch.tsx
index 92686a0c21..19d1ed2cc2 100644
--- a/web/src/components/table/data-table-row-height-switch.tsx
+++ b/web/src/components/table/data-table-row-height-switch.tsx
@@ -34,7 +34,7 @@ export type CustomHeights = Record<RowHeight, string>;
* and Large have room for far more text than that (LFE-14586). Sized to fill a
* Large row even at a generously widened column.
*/
-export const EXPANDED_ROW_IO_CHAR_LIMIT = 2_000;
+const EXPANDED_ROW_IO_CHAR_LIMIT = 2_000;
/** Undefined for Small, which keeps the default truncated read. */
export const getRowHeightIOCharLimit = (rowHeight: RowHeight) =>
diff --git a/web/src/components/table/peek/store/peekPanelStore.ts b/web/src/components/table/peek/store/peekPanelStore.ts
index 7a276a4f1a..1d7543d742 100644
--- a/web/src/components/table/peek/store/peekPanelStore.ts
+++ b/web/src/components/table/peek/store/peekPanelStore.ts
@@ -40,7 +40,7 @@ const KEYBOARD_RESIZE_STEP = 0.05;
// the default never lands narrower than the user could drag back to.
export const PEEK_MAX_DEFAULT_WIDTH_PX = 1400;
-export const clampWidthFraction = (fraction: number) =>
+const clampWidthFraction = (fraction: number) =>
Math.min(
PEEK_MAX_WIDGET_WIDTH_FRACTION,
Math.max(PEEK_MIN_WIDTH_FRACTION, fraction),
diff --git a/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx b/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx
index 990185c527..79acbaf105 100644
--- a/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx
+++ b/web/src/components/table/table-view-presets/components/data-table-view-presets-drawer.tsx
@@ -95,7 +95,7 @@ import { summarizeTableViewPreset } from "../lib/viewPreview";
* (not stored in DB). Using this prefix prevents DB lookups and allows special handling.
* Convention: `__langfuse_{preset_name}__`
*/
-export const SYSTEM_PRESET_ID_PREFIX = "__langfuse_";
+const SYSTEM_PRESET_ID_PREFIX = "__langfuse_";
/** Check if a view ID is a system preset (defined in code, not stored in DB) */
export const isSystemPresetId = (id: string | undefined | null): boolean =>
diff --git a/web/src/components/table/utils/jsonExpansionUtils.ts b/web/src/components/table/utils/jsonExpansionUtils.ts
index 5c0f27e4d2..a8d3a12500 100644
--- a/web/src/components/table/utils/jsonExpansionUtils.ts
+++ b/web/src/components/table/utils/jsonExpansionUtils.ts
@@ -16,7 +16,7 @@ export function convertRowIdToKeyPath(rowId: string): string {
}
// Utility function to get children from lazy-loaded rows
-export function getRowChildren(row: JsonTableRow): JsonTableRow[] {
+function getRowChildren(row: JsonTableRow): JsonTableRow[] {
if (row.subRows && row.subRows.length > 0) {
return row.subRows;
}
diff --git a/web/src/components/token-usage-badge.tsx b/web/src/components/token-usage-badge.tsx
index 53db5b37fd..f9c5dec19e 100644
--- a/web/src/components/token-usage-badge.tsx
+++ b/web/src/components/token-usage-badge.tsx
@@ -1,38 +1,7 @@
import { Badge } from "@/src/components/ui/badge";
-import { type ObservationReturnType } from "@/src/server/api/routers/traces";
import { numberFormatter } from "@/src/utils/numbers";
import { type Observation } from "@langfuse/shared";
-export const AggUsageBadge = (props: {
- observations: ObservationReturnType[];
- rightIcon?: React.ReactNode;
- variant?:
- | "default"
- | "secondary"
- | "destructive"
- | "outline-solid"
- | "tertiary";
-}) => {
- const usage = {
- inputUsage: props.observations
- .map((o) => o.inputUsage)
- .reduce((a, b) => a + b, 0),
- outputUsage: props.observations
- .map((o) => o.outputUsage)
- .reduce((a, b) => a + b, 0),
- totalUsage: props.observations
- .map((o) => o.totalUsage)
- .reduce((a, b) => a + b, 0),
- };
- return (
- <TokenUsageBadge
- {...usage}
- rightIcon={props.rightIcon}
- variant={props.variant}
- />
- );
-};
-
export const TokenUsageBadge = (
props: (
| {
diff --git a/web/src/components/ui/PromptReferences.tsx b/web/src/components/ui/PromptReferences.tsx
index 3ebeefac11..50f40aad45 100644
--- a/web/src/components/ui/PromptReferences.tsx
+++ b/web/src/components/ui/PromptReferences.tsx
@@ -72,7 +72,7 @@ export const parsePromptDependencyInnerContent = (
};
};
-export const getPromptReferenceUrl = (
+const getPromptReferenceUrl = (
projectId: string,
tag: ParsedPromptDependencyTag,
) => {
diff --git a/web/src/components/ui/alert-dialog.tsx b/web/src/components/ui/alert-dialog.tsx
index dd1ccadf20..5f972d47f6 100644
--- a/web/src/components/ui/alert-dialog.tsx
+++ b/web/src/components/ui/alert-dialog.tsx
@@ -141,8 +141,6 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
export {
AlertDialog,
- AlertDialogPortal,
- AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
diff --git a/web/src/components/ui/breadcrumb.tsx b/web/src/components/ui/breadcrumb.tsx
index e7f9adaeaa..c356c89c78 100644
--- a/web/src/components/ui/breadcrumb.tsx
+++ b/web/src/components/ui/breadcrumb.tsx
@@ -112,5 +112,4 @@ export {
BreadcrumbLink,
BreadcrumbPage,
BreadcrumbSeparator,
- BreadcrumbEllipsis,
};
diff --git a/web/src/components/ui/command.tsx b/web/src/components/ui/command.tsx
index a395a6e6ac..dfffd66be6 100644
--- a/web/src/components/ui/command.tsx
+++ b/web/src/components/ui/command.tsx
@@ -192,6 +192,5 @@ export {
CommandEmpty,
CommandGroup,
CommandItem,
- CommandShortcut,
CommandSeparator,
};
diff --git a/web/src/components/ui/dialog.tsx b/web/src/components/ui/dialog.tsx
index 75307b1be0..92121cfdca 100644
--- a/web/src/components/ui/dialog.tsx
+++ b/web/src/components/ui/dialog.tsx
@@ -326,8 +326,6 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
export {
Dialog,
DialogController,
- DialogPortal,
- DialogOverlay,
DialogClose,
DialogTrigger,
DialogContent,
diff --git a/web/src/components/ui/drawer.tsx b/web/src/components/ui/drawer.tsx
index c7dd142e6d..11abcbc3b8 100644
--- a/web/src/components/ui/drawer.tsx
+++ b/web/src/components/ui/drawer.tsx
@@ -231,13 +231,10 @@ DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
export {
Drawer,
- DrawerPortal,
- DrawerOverlay,
DrawerTrigger,
DrawerClose,
DrawerContent,
DrawerHeader,
- DrawerFooter,
DrawerTitle,
DrawerDescription,
};
diff --git a/web/src/components/ui/dropdown-menu.tsx b/web/src/components/ui/dropdown-menu.tsx
index b2bc876636..eb1e1f9b48 100644
--- a/web/src/components/ui/dropdown-menu.tsx
+++ b/web/src/components/ui/dropdown-menu.tsx
@@ -606,7 +606,6 @@ export {
DropdownMenuRadioItem,
DropdownMenuLabel,
DropdownMenuSeparator,
- DropdownMenuShortcut,
DropdownMenuGroup,
DropdownMenuPortal,
DropdownMenuSub,
diff --git a/web/src/components/ui/form.tsx b/web/src/components/ui/form.tsx
index 7fd9825ce2..b49436347e 100644
--- a/web/src/components/ui/form.tsx
+++ b/web/src/components/ui/form.tsx
@@ -209,7 +209,6 @@ const FormMessage = React.forwardRef<
FormMessage.displayName = "FormMessage";
export {
- useFormField,
Form,
FormItem,
FormLabel,
diff --git a/web/src/components/ui/hover-card.tsx b/web/src/components/ui/hover-card.tsx
index 50bfbea21f..f0131b60f2 100644
--- a/web/src/components/ui/hover-card.tsx
+++ b/web/src/components/ui/hover-card.tsx
@@ -80,10 +80,4 @@ const HoverCardTitle = React.forwardRef<
));
HoverCardTitle.displayName = "HoverCardTitle";
-export {
- HoverCard,
- HoverCardTrigger,
- HoverCardContent,
- HoverCardTitle,
- HoverCardPortal,
-};
+export { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardPortal };
diff --git a/web/src/components/ui/input-command.tsx b/web/src/components/ui/input-command.tsx
index 74e44f42f5..d3ed8b755c 100644
--- a/web/src/components/ui/input-command.tsx
+++ b/web/src/components/ui/input-command.tsx
@@ -5,11 +5,9 @@
// Find original shadcn/ui command component in /components/ui/command.tsx
import * as React from "react";
-import { type DialogProps } from "@radix-ui/react-dialog";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
-import { Dialog, DialogBody, DialogContent } from "@/src/components/ui/dialog";
import {
KeyboardShortcut,
type KeyboardShortcutProps,
@@ -31,25 +29,6 @@ const InputCommand = React.forwardRef<
));
InputCommand.displayName = CommandPrimitive.displayName;
-interface InputCommandDialogProps extends DialogProps {}
-
-const InputCommandDialog = ({
- children,
- ...props
-}: InputCommandDialogProps) => {
- return (
- <Dialog {...props}>
- <DialogContent className="overflow-hidden p-0 shadow-lg">
- <DialogBody>
- <InputCommand className="**:[[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-bold **:[[cmdk-group]]:px-2 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3">
- {children}
- </InputCommand>
- </DialogBody>
- </DialogContent>
- </Dialog>
- );
-};
-
const InputCommandInput = React.forwardRef<
React.ComponentRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> & {
@@ -166,7 +145,6 @@ InputCommandShortcut.displayName = "CommandShortcut";
export {
InputCommand,
- InputCommandDialog,
InputCommandInput,
InputCommandList,
InputCommandEmpty,
diff --git a/web/src/components/ui/scroll-area.tsx b/web/src/components/ui/scroll-area.tsx
index 2a07b91640..da2b86549a 100644
--- a/web/src/components/ui/scroll-area.tsx
+++ b/web/src/components/ui/scroll-area.tsx
@@ -48,4 +48,4 @@ const ScrollBar = React.forwardRef<
));
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
-export { ScrollArea, ScrollBar };
+export { ScrollArea };
diff --git a/web/src/components/ui/select.tsx b/web/src/components/ui/select.tsx
index 1f87128820..68aeb23808 100644
--- a/web/src/components/ui/select.tsx
+++ b/web/src/components/ui/select.tsx
@@ -187,6 +187,4 @@ export {
SelectLabel,
SelectItem,
SelectSeparator,
- SelectScrollUpButton,
- SelectScrollDownButton,
};
diff --git a/web/src/components/ui/sheet.tsx b/web/src/components/ui/sheet.tsx
index c184f2ce2f..64151b0f70 100644
--- a/web/src/components/ui/sheet.tsx
+++ b/web/src/components/ui/sheet.tsx
@@ -140,12 +140,10 @@ SheetDescription.displayName = SheetPrimitive.Description.displayName;
export {
Sheet,
SheetPortal,
- SheetOverlay,
SheetTrigger,
SheetClose,
SheetContent,
SheetHeader,
- SheetFooter,
SheetTitle,
SheetDescription,
};
diff --git a/web/src/components/ui/sidebar.tsx b/web/src/components/ui/sidebar.tsx
index 6dfb080c61..3d4265c7e7 100644
--- a/web/src/components/ui/sidebar.tsx
+++ b/web/src/components/ui/sidebar.tsx
@@ -793,24 +793,15 @@ export {
SidebarContent,
SidebarFooter,
SidebarGroup,
- SidebarGroupAction,
SidebarGroupContent,
SidebarGroupLabel,
SidebarHeader,
- SidebarInput,
SidebarInset,
SidebarMenu,
- SidebarMenuAction,
- SidebarMenuBadge,
SidebarMenuButton,
SidebarMenuItem,
- SidebarMenuSkeleton,
- SidebarMenuSub,
- SidebarMenuSubButton,
- SidebarMenuSubItem,
SidebarProvider,
SidebarRail,
- SidebarSeparator,
SidebarTrigger,
useSidebar,
};
diff --git a/web/src/components/ui/table.tsx b/web/src/components/ui/table.tsx
index fb146dd0fa..fd409d5629 100644
--- a/web/src/components/ui/table.tsx
+++ b/web/src/components/ui/table.tsx
@@ -174,10 +174,8 @@ export {
Table,
TableHeader,
TableBody,
- TableFooter,
TableHead,
TableRow,
TableCell,
TableCellWithCopyButton,
- TableCaption,
};
diff --git a/web/src/components/ui/time-picker-utils.tsx b/web/src/components/ui/time-picker-utils.tsx
index 64a39d5ba9..bc6eaac893 100644
--- a/web/src/components/ui/time-picker-utils.tsx
+++ b/web/src/components/ui/time-picker-utils.tsx
@@ -1,27 +1,27 @@
/**
* regular expression to check for valid hour format (01-23)
*/
-export function isValidHour(value: string) {
+function isValidHour(value: string) {
return /^(0[0-9]|1[0-9]|2[0-3])$/.test(value);
}
/**
* regular expression to check for valid 12 hour format (01-12)
*/
-export function isValid12Hour(value: string) {
+function isValid12Hour(value: string) {
return /^(0[1-9]|1[0-2])$/.test(value);
}
/**
* regular expression to check for valid minute format (00-59)
*/
-export function isValidMinuteOrSecond(value: string) {
+function isValidMinuteOrSecond(value: string) {
return /^[0-5][0-9]$/.test(value);
}
type GetValidNumberConfig = { max: number; min?: number; loop?: boolean };
-export function getValidNumber(
+function getValidNumber(
value: string,
{ max, min = 0, loop = false }: GetValidNumberConfig,
) {
@@ -41,17 +41,17 @@ export function getValidNumber(
return "00";
}
-export function getValidHour(value: string) {
+function getValidHour(value: string) {
if (isValidHour(value)) return value;
return getValidNumber(value, { max: 23 });
}
-export function getValid12Hour(value: string) {
+function getValid12Hour(value: string) {
if (isValid12Hour(value)) return value;
return getValidNumber(value, { min: 1, max: 12 });
}
-export function getValidMinuteOrSecond(value: string) {
+function getValidMinuteOrSecond(value: string) {
if (isValidMinuteOrSecond(value)) return value;
return getValidNumber(value, { max: 59 });
}
@@ -62,7 +62,7 @@ type GetValidArrowNumberConfig = {
step: number;
};
-export function getValidArrowNumber(
+function getValidArrowNumber(
value: string,
{ min, max, step }: GetValidArrowNumberConfig,
) {
@@ -74,40 +74,40 @@ export function getValidArrowNumber(
return "00";
}
-export function getValidArrowHour(value: string, step: number) {
+function getValidArrowHour(value: string, step: number) {
return getValidArrowNumber(value, { min: 0, max: 23, step });
}
-export function getValidArrow12Hour(value: string, step: number) {
+function getValidArrow12Hour(value: string, step: number) {
return getValidArrowNumber(value, { min: 1, max: 12, step });
}
-export function getValidArrowMinuteOrSecond(value: string, step: number) {
+function getValidArrowMinuteOrSecond(value: string, step: number) {
return getValidArrowNumber(value, { min: 0, max: 59, step });
}
-export function setMinutes(date: Date, value: string) {
+function setMinutes(date: Date, value: string) {
const newDate = new Date(date);
const minutes = getValidMinuteOrSecond(value);
newDate.setMinutes(parseInt(minutes, 10));
return newDate;
}
-export function setSeconds(date: Date, value: string) {
+function setSeconds(date: Date, value: string) {
const newDate = new Date(date);
const seconds = getValidMinuteOrSecond(value);
newDate.setSeconds(parseInt(seconds, 10));
return newDate;
}
-export function setHours(date: Date, value: string) {
+function setHours(date: Date, value: string) {
const newDate = new Date(date);
const hours = getValidHour(value);
newDate.setHours(parseInt(hours, 10));
return newDate;
}
-export function set12Hours(date: Date, value: string, period: Period) {
+function set12Hours(date: Date, value: string, period: Period) {
const newDate = new Date(date);
const hours = parseInt(getValid12Hour(value), 10);
const convertedHours = convert12HourTo24Hour(hours, period);
@@ -180,7 +180,7 @@ export function getArrowByType(
* 12:00 PM is 12:00
* 12:00 AM is 00:00
*/
-export function convert12HourTo24Hour(hour: number, period: Period) {
+function convert12HourTo24Hour(hour: number, period: Period) {
if (period === "PM") {
if (hour <= 11) {
return hour + 12;
diff --git a/web/src/ee/features/admin-api/server/organizations/organizationById.ts b/web/src/ee/features/admin-api/server/organizations/organizationById.ts
index 93c0f9856d..fc2c16f8e3 100644
--- a/web/src/ee/features/admin-api/server/organizations/organizationById.ts
+++ b/web/src/ee/features/admin-api/server/organizations/organizationById.ts
@@ -5,7 +5,7 @@ import { organizationNameSchema } from "@/src/features/organizations/utils/organ
import { auditLog } from "@/src/features/audit-logs/auditLog";
import { z } from "zod";
-export const validateQueryAndExtractId = (query: unknown): string | null => {
+const validateQueryAndExtractId = (query: unknown): string | null => {
const inputQuerySchema = z.object({
organizationId: z.string(),
});
diff --git a/web/src/ee/features/billing/server/chb/chbApiClient.ts b/web/src/ee/features/billing/server/chb/chbApiClient.ts
index bb64e03adc..8408e49f5f 100644
--- a/web/src/ee/features/billing/server/chb/chbApiClient.ts
+++ b/web/src/ee/features/billing/server/chb/chbApiClient.ts
@@ -39,7 +39,7 @@ export class ChbPaymentRequiredError extends ChbApiError {
}
}
-export const ChbScheduledChangeSchema = z.object({
+const ChbScheduledChangeSchema = z.object({
type: z.string(), // "upgrade" | "downgrade" | "cancel"
when: z.string(), // "immediate" | "billing_cycle_end" | ISO date
planCode: z.string().nullish(),
@@ -47,7 +47,7 @@ export const ChbScheduledChangeSchema = z.object({
});
export type ChbScheduledChange = z.infer<typeof ChbScheduledChangeSchema>;
-export const ChbBundleSchema = z.object({
+const ChbBundleSchema = z.object({
id: z.string(),
plan: z
.object({
@@ -75,7 +75,7 @@ export const ChbBundleSchema = z.object({
});
export type ChbBundle = z.infer<typeof ChbBundleSchema>;
-export const ChbCheckoutSessionSchema = z.object({
+const ChbCheckoutSessionSchema = z.object({
url: z.string(),
// ClickHouse Organization ID — persisted on the Langfuse org right away so a
// checkout retry recovers the same CH org instead of orphaning one.
@@ -83,7 +83,7 @@ export const ChbCheckoutSessionSchema = z.object({
});
export type ChbCheckoutSession = z.infer<typeof ChbCheckoutSessionSchema>;
-export const ChbInvoiceSchema = z.object({
+const ChbInvoiceSchema = z.object({
id: z.string().nullish(),
number: z.string().nullish(),
status: z.string().nullish(),
@@ -100,7 +100,7 @@ const ChbInvoiceListSchema = z.object({
invoices: z.array(ChbInvoiceSchema).default([]),
});
-export const ChbPortalSessionSchema = z.object({
+const ChbPortalSessionSchema = z.object({
url: z.string(),
});
diff --git a/web/src/ee/features/billing/server/stripe/stripeWebhookHandler.ts b/web/src/ee/features/billing/server/stripe/stripeWebhookHandler.ts
index 788dd6d26e..835c36f120 100644
--- a/web/src/ee/features/billing/server/stripe/stripeWebhookHandler.ts
+++ b/web/src/ee/features/billing/server/stripe/stripeWebhookHandler.ts
@@ -364,10 +364,7 @@ async function ensureMetadataIsSetOnStripeSubscription(
* When no anchor is provided, sets to start of current day in UTC.
* When an anchor is provided, stores it as-is (caller is responsible for UTC normalization).
*/
-export async function updateOrgBillingCycleAnchor(
- orgId: string,
- anchor?: Date,
-) {
+async function updateOrgBillingCycleAnchor(orgId: string, anchor?: Date) {
return await prisma.organization.update({
where: { id: orgId },
data: {
diff --git a/web/src/ee/features/billing/utils/stripeCatalogue.ts b/web/src/ee/features/billing/utils/stripeCatalogue.ts
index b67692a46e..f7f6be0033 100644
--- a/web/src/ee/features/billing/utils/stripeCatalogue.ts
+++ b/web/src/ee/features/billing/utils/stripeCatalogue.ts
@@ -116,7 +116,7 @@ export const stripeProducts: StripeProduct[] = [
},
];
-export const stripeUsageProduct = {
+const stripeUsageProduct = {
id: isTestEnvironment
? "prod_T2DaIcLiiR78rs" // sandbox
: "prod_T4nLLI2vn876J2",
@@ -139,7 +139,7 @@ export const isUpgrade = (
return (oldProduct?.orderKey ?? 0) < (newProduct?.orderKey ?? 0);
};
-export const isValidCheckoutProduct = (id: string) => {
+const isValidCheckoutProduct = (id: string) => {
return stripeProducts.some(
(p) => Boolean(p.checkout) && p.stripeProductId === id,
);
diff --git a/web/src/ee/features/billing/utils/stripeIdempotencyKey.ts b/web/src/ee/features/billing/utils/stripeIdempotencyKey.ts
index aa4980f567..6553a6bd87 100644
--- a/web/src/ee/features/billing/utils/stripeIdempotencyKey.ts
+++ b/web/src/ee/features/billing/utils/stripeIdempotencyKey.ts
@@ -1,4 +1,3 @@
-import crypto from "crypto";
import { z } from "zod";
/**
@@ -43,22 +42,6 @@ export const IdempotencyKind = z.enum([
export type IdempotencyKind = z.infer<typeof IdempotencyKind>;
-/**
- * Creates a stable hash of an object by sorting keys before stringification.
- * Used internally by makeIdempotencyKey to ensure consistent hashing.
- *
- * @param obj - Any JSON-serializable object to hash
- * @returns A 16-character hexadecimal hash string
- */
-export function stableHash(obj: unknown): string {
- try {
- const json = JSON.stringify(obj, Object.keys(obj as any).sort());
- return crypto.createHash("sha256").update(json).digest("hex").slice(0, 16);
- } catch {
- return crypto.randomBytes(8).toString("hex");
- }
-}
-
/**
* Generates an idempotency key for Stripe API operations.
* The key combines operation type, relevant fields, and an operation ID to ensure uniqueness.
diff --git a/web/src/ee/features/billing/utils/stripeSubscriptionMetadata.ts b/web/src/ee/features/billing/utils/stripeSubscriptionMetadata.ts
index 2f6ed16613..4d1d423f1d 100644
--- a/web/src/ee/features/billing/utils/stripeSubscriptionMetadata.ts
+++ b/web/src/ee/features/billing/utils/stripeSubscriptionMetadata.ts
@@ -17,7 +17,8 @@ import { z } from "zod";
* @property orgId - Links the subscription to a specific organization
* @property cloudRegion - Identifies which cloud region (e.g., EU, US) handles this subscription
*/
-export const StripeSubscriptionMetadataSchema = z.object({
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const StripeSubscriptionMetadataSchema = z.object({
orgId: z.string().optional(),
cloudRegion: z.string().optional(),
});
diff --git a/web/src/ee/features/multi-tenant-sso/types.ts b/web/src/ee/features/multi-tenant-sso/types.ts
index 370794f60b..35e03e7c84 100644
--- a/web/src/ee/features/multi-tenant-sso/types.ts
+++ b/web/src/ee/features/multi-tenant-sso/types.ts
@@ -46,7 +46,7 @@ const oidcIssuer = z
message: "OIDC issuer urls must start with https://",
});
-export const GoogleProviderSchema = base.extend({
+const GoogleProviderSchema = base.extend({
authProvider: z.literal("google"),
authConfig: z
.object({
@@ -59,7 +59,7 @@ export const GoogleProviderSchema = base.extend({
.nullish(),
});
-export const GithubProviderSchema = base.extend({
+const GithubProviderSchema = base.extend({
authProvider: z.literal("github"),
authConfig: z
.object({
@@ -71,7 +71,7 @@ export const GithubProviderSchema = base.extend({
.nullish(),
});
-export const GithubEnterpriseProviderSchema = base.extend({
+const GithubEnterpriseProviderSchema = base.extend({
authProvider: z.literal("github-enterprise"),
authConfig: z
.object({
@@ -90,7 +90,7 @@ export const GithubEnterpriseProviderSchema = base.extend({
.nullish(),
});
-export const GitlabProviderSchema = base.extend({
+const GitlabProviderSchema = base.extend({
authProvider: z.literal("gitlab"),
authConfig: z
.object({
@@ -104,7 +104,7 @@ export const GitlabProviderSchema = base.extend({
.nullish(),
});
-export const Auth0ProviderSchema = base.extend({
+const Auth0ProviderSchema = base.extend({
authProvider: z.literal("auth0"),
authConfig: z
.object({
@@ -118,7 +118,7 @@ export const Auth0ProviderSchema = base.extend({
.nullish(),
});
-export const OktaProviderSchema = base.extend({
+const OktaProviderSchema = base.extend({
authProvider: z.literal("okta"),
authConfig: z
.object({
@@ -132,7 +132,7 @@ export const OktaProviderSchema = base.extend({
.nullish(),
});
-export const AuthentikProviderSchema = base.extend({
+const AuthentikProviderSchema = base.extend({
authProvider: z.literal("authentik"),
authConfig: z
.object({
@@ -149,7 +149,7 @@ export const AuthentikProviderSchema = base.extend({
.nullish(),
});
-export const OneLoginProviderSchema = base.extend({
+const OneLoginProviderSchema = base.extend({
authProvider: z.literal("onelogin"),
authConfig: z
.object({
@@ -163,7 +163,7 @@ export const OneLoginProviderSchema = base.extend({
.nullish(),
});
-export const AzureAdProviderSchema = base.extend({
+const AzureAdProviderSchema = base.extend({
authProvider: z.literal("azure-ad"),
authConfig: z
.object({
@@ -183,7 +183,7 @@ export const AzureAdProviderSchema = base.extend({
.nullish(),
});
-export const CognitoProviderSchema = base.extend({
+const CognitoProviderSchema = base.extend({
authProvider: z.literal("cognito"),
authConfig: z
.object({
@@ -197,7 +197,7 @@ export const CognitoProviderSchema = base.extend({
.nullish(),
});
-export const KeycloakProviderSchema = base.extend({
+const KeycloakProviderSchema = base.extend({
authProvider: z.literal("keycloak"),
authConfig: z
.object({
@@ -212,7 +212,7 @@ export const KeycloakProviderSchema = base.extend({
.nullish(),
});
-export const CustomProviderSchema = base.extend({
+const CustomProviderSchema = base.extend({
authProvider: z.literal("custom"),
authConfig: z
.object({
@@ -237,7 +237,7 @@ export const CustomProviderSchema = base.extend({
.nullish(),
});
-export const JumpCloudProviderSchema = base.extend({
+const JumpCloudProviderSchema = base.extend({
authProvider: z.literal("jumpcloud"),
authConfig: z
.object({
@@ -252,21 +252,21 @@ export const JumpCloudProviderSchema = base.extend({
.nullish(),
});
-export type GoogleProviderSchema = z.infer<typeof GoogleProviderSchema>;
-export type GithubProviderSchema = z.infer<typeof GithubProviderSchema>;
-export type GithubEnterpriseProviderSchema = z.infer<
+type GoogleProviderSchema = z.infer<typeof GoogleProviderSchema>;
+type GithubProviderSchema = z.infer<typeof GithubProviderSchema>;
+type GithubEnterpriseProviderSchema = z.infer<
typeof GithubEnterpriseProviderSchema
>;
-export type GitlabProviderSchema = z.infer<typeof GitlabProviderSchema>;
-export type Auth0ProviderSchema = z.infer<typeof Auth0ProviderSchema>;
-export type OktaProviderSchema = z.infer<typeof OktaProviderSchema>;
-export type AuthentikProviderSchema = z.infer<typeof AuthentikProviderSchema>;
-export type OneLoginProviderSchema = z.infer<typeof OneLoginProviderSchema>;
-export type AzureAdProviderSchema = z.infer<typeof AzureAdProviderSchema>;
-export type CognitoProviderSchema = z.infer<typeof CognitoProviderSchema>;
-export type KeycloakProviderSchema = z.infer<typeof KeycloakProviderSchema>;
-export type CustomProviderSchema = z.infer<typeof CustomProviderSchema>;
-export type JumpCloudProviderSchema = z.infer<typeof JumpCloudProviderSchema>;
+type GitlabProviderSchema = z.infer<typeof GitlabProviderSchema>;
+type Auth0ProviderSchema = z.infer<typeof Auth0ProviderSchema>;
+type OktaProviderSchema = z.infer<typeof OktaProviderSchema>;
+type AuthentikProviderSchema = z.infer<typeof AuthentikProviderSchema>;
+type OneLoginProviderSchema = z.infer<typeof OneLoginProviderSchema>;
+type AzureAdProviderSchema = z.infer<typeof AzureAdProviderSchema>;
+type CognitoProviderSchema = z.infer<typeof CognitoProviderSchema>;
+type KeycloakProviderSchema = z.infer<typeof KeycloakProviderSchema>;
+type CustomProviderSchema = z.infer<typeof CustomProviderSchema>;
+type JumpCloudProviderSchema = z.infer<typeof JumpCloudProviderSchema>;
export const SsoProviderSchema = z.discriminatedUnion("authProvider", [
GoogleProviderSchema,
diff --git a/web/src/ee/features/ui-customization/productModuleSchema.ts b/web/src/ee/features/ui-customization/productModuleSchema.ts
index f363b7e803..ee88b2d149 100644
--- a/web/src/ee/features/ui-customization/productModuleSchema.ts
+++ b/web/src/ee/features/ui-customization/productModuleSchema.ts
@@ -3,7 +3,7 @@ import { z } from "zod";
/**
* All available product modules in Langfuse
*/
-export const PRODUCT_MODULES = [
+const PRODUCT_MODULES = [
"dashboards",
"tracing",
"evaluation",
diff --git a/web/src/features/annotation-queues/server/publicAnnotationQueueService.ts b/web/src/features/annotation-queues/server/publicAnnotationQueueService.ts
index e4e0d53ab1..d9d6a11144 100644
--- a/web/src/features/annotation-queues/server/publicAnnotationQueueService.ts
+++ b/web/src/features/annotation-queues/server/publicAnnotationQueueService.ts
@@ -97,7 +97,7 @@ const toAnnotationQueueItemApi = (item: {
updatedAt: item.updatedAt,
});
-export const getAnnotationQueueRecordOrThrow = async ({
+const getAnnotationQueueRecordOrThrow = async ({
projectId,
queueId,
}: {
@@ -347,7 +347,7 @@ export const listAnnotationQueueItemsForApi = async ({
};
};
-export const getAnnotationQueueItemRecordOrThrow = async ({
+const getAnnotationQueueItemRecordOrThrow = async ({
projectId,
queueId,
itemId,
diff --git a/web/src/features/auth-credentials/lib/credentialsServerUtils.ts b/web/src/features/auth-credentials/lib/credentialsServerUtils.ts
index 96b89e0f10..7209baefdc 100644
--- a/web/src/features/auth-credentials/lib/credentialsServerUtils.ts
+++ b/web/src/features/auth-credentials/lib/credentialsServerUtils.ts
@@ -80,6 +80,6 @@ export async function verifyPassword(password: string, hashedPassword: string) {
return isValid;
}
-export function isValidPassword(password: string) {
+function isValidPassword(password: string) {
return password.length >= 8;
}
diff --git a/web/src/features/auth/lib/expectedAuthErrors.ts b/web/src/features/auth/lib/expectedAuthErrors.ts
index 622c7f9589..7c6d7e12d6 100644
--- a/web/src/features/auth/lib/expectedAuthErrors.ts
+++ b/web/src/features/auth/lib/expectedAuthErrors.ts
@@ -24,7 +24,7 @@ import { MULTI_TENANT_SSO_DOMAIN_MISMATCH_MESSAGE } from "@/src/features/auth/co
// construction = provider misconfig), OAuthCreateAccount / EmailCreateAccount
// (DB failures), EmailSignin (verification email failed to send), Signin,
// Configuration, and any unknown/custom string.
-export const EXPECTED_SIGN_IN_ERROR_CODES: readonly string[] = [
+const EXPECTED_SIGN_IN_ERROR_CODES: readonly string[] = [
"OAuthCallback",
"Callback",
];
@@ -40,7 +40,7 @@ export const isExpectedSignInError = (code: string): boolean =>
// - SSO domain mismatch: deliberate rejection thrown by our signIn callback
// (logged server-side before the throw).
// Configuration / AccessDenied / unknown values still capture.
-export const EXPECTED_AUTH_ERROR_PAGE_MESSAGES: readonly string[] = [
+const EXPECTED_AUTH_ERROR_PAGE_MESSAGES: readonly string[] = [
"Verification",
MULTI_TENANT_SSO_DOMAIN_MISMATCH_MESSAGE,
];
diff --git a/web/src/features/auth/lib/signupSchema.ts b/web/src/features/auth/lib/signupSchema.ts
index e85dec43ac..a4266fa2fb 100644
--- a/web/src/features/auth/lib/signupSchema.ts
+++ b/web/src/features/auth/lib/signupSchema.ts
@@ -17,7 +17,7 @@ export const passwordSchema = z
"Please choose a secure password by combining letters, numbers, and special characters.",
});
-export const nameSchema = StringNoHTMLNonEmpty.max(
+const nameSchema = StringNoHTMLNonEmpty.max(
100,
"Name must be at most 100 characters",
)
diff --git a/web/src/features/automations/components/actions/GitHubDispatchActionForm.tsx b/web/src/features/automations/components/actions/GitHubDispatchActionForm.tsx
index 18f7507b2f..2f3791fbb2 100644
--- a/web/src/features/automations/components/actions/GitHubDispatchActionForm.tsx
+++ b/web/src/features/automations/components/actions/GitHubDispatchActionForm.tsx
@@ -135,10 +135,3 @@ export const GitHubDispatchActionForm: React.FC<
</div>
);
};
-
-// Schema exported for use in automationForm.tsx
-export const githubDispatchSchema = {
- url: "",
- eventType: "",
- githubToken: "",
-};
diff --git a/web/src/features/automations/components/actions/GitHubDispatchActionHandler.tsx b/web/src/features/automations/components/actions/GitHubDispatchActionHandler.tsx
index e9200a5942..a5587bee5a 100644
--- a/web/src/features/automations/components/actions/GitHubDispatchActionHandler.tsx
+++ b/web/src/features/automations/components/actions/GitHubDispatchActionHandler.tsx
@@ -11,7 +11,8 @@ import { z } from "zod";
import { areGitHubDispatchUrlsEquivalent } from "../../githubDispatchUrl";
// Define the form schema for GitHub dispatch actions
-export const GitHubDispatchActionFormSchema = z.object({
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const GitHubDispatchActionFormSchema = z.object({
githubDispatch: z.object({
url: z.url("Invalid URL"),
eventType: z.string().min(1, "Event type is required").max(100),
diff --git a/web/src/features/automations/components/actions/SlackActionHandler.ts b/web/src/features/automations/components/actions/SlackActionHandler.ts
index 51b6432d82..6c3c7fb001 100644
--- a/web/src/features/automations/components/actions/SlackActionHandler.ts
+++ b/web/src/features/automations/components/actions/SlackActionHandler.ts
@@ -11,9 +11,8 @@ import {
import { z } from "zod";
// Define the form schema for Slack actions
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via z.infer<typeof>, which is a legitimate pattern)
-export const SlackActionFormSchema = z.object({
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const SlackActionFormSchema = z.object({
slack: z.object({
channelId: z.string().min(1, "Channel is required"),
channelName: z.string().min(1, "Channel name is required"),
diff --git a/web/src/features/automations/components/actions/WebhookActionForm.tsx b/web/src/features/automations/components/actions/WebhookActionForm.tsx
index e58bd13010..435fccea88 100644
--- a/web/src/features/automations/components/actions/WebhookActionForm.tsx
+++ b/web/src/features/automations/components/actions/WebhookActionForm.tsx
@@ -308,7 +308,7 @@ export const WebhookActionForm: React.FC<WebhookActionFormProps> = ({
);
};
-export const RegenerateWebhookSecretButton = ({
+const RegenerateWebhookSecretButton = ({
projectId,
action,
}: {
diff --git a/web/src/features/automations/components/actions/WebhookActionHandler.tsx b/web/src/features/automations/components/actions/WebhookActionHandler.tsx
index b4db68bd93..3f44d9e4ab 100644
--- a/web/src/features/automations/components/actions/WebhookActionHandler.tsx
+++ b/web/src/features/automations/components/actions/WebhookActionHandler.tsx
@@ -13,9 +13,8 @@ import {
import { z } from "zod";
// Define the form schema for webhook actions
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via z.infer<typeof>, which is a legitimate pattern)
-export const WebhookActionFormSchema = z.object({
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const WebhookActionFormSchema = z.object({
webhook: z.object({
url: z.url("Invalid URL"),
headers: z
diff --git a/web/src/features/automations/components/actions/index.ts b/web/src/features/automations/components/actions/index.ts
index b914a8c886..ae742156f0 100644
--- a/web/src/features/automations/components/actions/index.ts
+++ b/web/src/features/automations/components/actions/index.ts
@@ -1,5 +1,2 @@
export { type BaseActionHandler } from "./BaseActionHandler";
-export { WebhookActionHandler } from "./WebhookActionHandler";
-export { SlackActionHandler } from "./SlackActionHandler";
-export { GitHubDispatchActionHandler } from "./GitHubDispatchActionHandler";
export { ActionHandlerRegistry } from "./ActionHandlerRegistry";
diff --git a/web/src/features/automations/server/router.ts b/web/src/features/automations/server/router.ts
index 3517b79f5d..5714aa5a18 100644
--- a/web/src/features/automations/server/router.ts
+++ b/web/src/features/automations/server/router.ts
@@ -29,7 +29,7 @@ import { updateTriggerEventActions } from "./automationService";
import { TRPCError } from "@trpc/server";
import { auditLog } from "@/src/features/audit-logs/auditLog";
-export const CreateAutomationInputSchema = z.object({
+const CreateAutomationInputSchema = z.object({
projectId: z.string(),
name: z.string().min(1, "Name is required"),
eventSource: z.string(),
@@ -41,7 +41,7 @@ export const CreateAutomationInputSchema = z.object({
actionConfig: ActionCreateSchema,
});
-export const UpdateAutomationInputSchema = CreateAutomationInputSchema.extend({
+const UpdateAutomationInputSchema = CreateAutomationInputSchema.extend({
automationId: z.string(),
});
diff --git a/web/src/features/automations/server/webhookHelpers.ts b/web/src/features/automations/server/webhookHelpers.ts
index 19cfa6bbc5..48d8896484 100644
--- a/web/src/features/automations/server/webhookHelpers.ts
+++ b/web/src/features/automations/server/webhookHelpers.ts
@@ -1,8 +1,4 @@
-import {
- decrypt,
- encrypt,
- generateWebhookSecret,
-} from "@langfuse/shared/encryption";
+import { encrypt, generateWebhookSecret } from "@langfuse/shared/encryption";
import {
type ActionCreate,
type ActionConfig,
@@ -169,21 +165,3 @@ function processWebhookHeaders(
lastFailingExecutionId: existingConfig?.lastFailingExecutionId,
};
}
-
-/**
- * Extracts webhook secret for one-time display after creation
- */
-export function extractWebhookSecret(
- actionConfig: ActionConfig,
-): string | undefined {
- if (actionConfig.type !== "WEBHOOK" || !actionConfig.secretKey) {
- return undefined;
- }
-
- try {
- return decrypt(actionConfig.secretKey);
- } catch (error) {
- console.error("Failed to decrypt webhook secret for display:", error);
- return undefined;
- }
-}
diff --git a/web/src/features/batch-actions/components/RunEvaluationDialog/utils.ts b/web/src/features/batch-actions/components/RunEvaluationDialog/utils.ts
index bfec40127f..752cb71829 100644
--- a/web/src/features/batch-actions/components/RunEvaluationDialog/utils.ts
+++ b/web/src/features/batch-actions/components/RunEvaluationDialog/utils.ts
@@ -22,7 +22,7 @@ export function getCreateEvaluatorHref(params: {
: `/project/${projectId}/evals?gallery=open`;
}
-export function stringifyPreviewValue(value: unknown): string {
+function stringifyPreviewValue(value: unknown): string {
if (value === null || value === undefined) return "";
if (typeof value === "string") return value;
if (
diff --git a/web/src/features/batch-actions/validation.ts b/web/src/features/batch-actions/validation.ts
index 4d0db3b07e..23d9d81ad3 100644
--- a/web/src/features/batch-actions/validation.ts
+++ b/web/src/features/batch-actions/validation.ts
@@ -1,6 +1,5 @@
import z from "zod";
import {
- AddToDatasetMappingSchema,
ObservationAddToDatasetConfigSchema,
BatchActionQuerySchema,
BatchEvalSourceTableSchema,
@@ -20,21 +19,7 @@ export const CreateObservationBatchEvaluationActionSchema = z.object({
evalVersion: z.literal("v2").optional(),
});
-export const ValidateBatchAddToDatasetMappingSchema = z.object({
- projectId: z.string(),
- observationId: z.string(),
- traceId: z.string(),
- datasetId: z.string(),
- mapping: AddToDatasetMappingSchema,
-});
-
export const GetBatchActionByIdSchema = z.object({
projectId: z.string(),
batchActionId: z.string(),
});
-
-export const ListBatchActionsSchema = z.object({
- projectId: z.string(),
- page: z.number(),
- limit: z.number(),
-});
diff --git a/web/src/features/blobstorage-integration/validation.ts b/web/src/features/blobstorage-integration/validation.ts
index 7e2ed6a68e..4705b3768c 100644
--- a/web/src/features/blobstorage-integration/validation.ts
+++ b/web/src/features/blobstorage-integration/validation.ts
@@ -3,7 +3,7 @@ import type { z } from "zod";
// 27h covers all real-world TZ offsets (UTC-12 to UTC+14 = 26h span + 1h margin).
// The HTML date picker sends YYYY-MM-DD parsed as UTC midnight; on a UTC server,
// an east-of-UTC user's local today can be up to 14h ahead of server UTC.
-export const MAX_EXPORT_START_DATE_FUTURE_MS = 27 * 60 * 60 * 1000;
+const MAX_EXPORT_START_DATE_FUTURE_MS = 27 * 60 * 60 * 1000;
export function exportStartDateNotInFuture(d: Date | null | undefined) {
return !d || d.getTime() <= Date.now() + MAX_EXPORT_START_DATE_FUTURE_MS;
@@ -37,7 +37,7 @@ export function validateExportFieldGroups(
export const AZURE_CONTAINER_NAME_REGEX =
/^[a-z0-9](?!.*--)[a-z0-9-]{1,61}[a-z0-9]$/;
-export const AZURE_CONTAINER_NAME_ERROR =
+const AZURE_CONTAINER_NAME_ERROR =
"Azure container names must be 3-63 characters, lowercase letters, numbers, and hyphens only. Must start and end with a letter or number, no consecutive hyphens.";
export function validateAzureContainerName(
diff --git a/web/src/features/chart-view-prototype/lib/fixtures.ts b/web/src/features/chart-view-prototype/lib/fixtures.ts
index bb8d63fe6c..39e5bbb6c7 100644
--- a/web/src/features/chart-view-prototype/lib/fixtures.ts
+++ b/web/src/features/chart-view-prototype/lib/fixtures.ts
@@ -114,9 +114,7 @@ export interface GenerateOptions {
errorSpike?: boolean;
}
-export function generateEvents(
- options: GenerateOptions = {},
-): PrototypeEvent[] {
+function generateEvents(options: GenerateOptions = {}): PrototypeEvent[] {
const {
seed = 42,
count = 640,
diff --git a/web/src/features/chart-view/lib/chartFilterCompatibility.ts b/web/src/features/chart-view/lib/chartFilterCompatibility.ts
index 44fe4d4e39..4b47bd92b2 100644
--- a/web/src/features/chart-view/lib/chartFilterCompatibility.ts
+++ b/web/src/features/chart-view/lib/chartFilterCompatibility.ts
@@ -26,7 +26,7 @@ import { resolveField } from "@/src/features/search-bar/lib/fields";
* `traceTags` is the one whose query dimension name differs (`tags`) — see
* {@link CHART_FILTER_COLUMN_RENAME}.
*/
-export const FORWARDABLE_CHART_FILTER_COLUMNS: ReadonlySet<string> = new Set([
+const FORWARDABLE_CHART_FILTER_COLUMNS: ReadonlySet<string> = new Set([
"environment",
"type",
"name",
diff --git a/web/src/features/chart-view/vocab.ts b/web/src/features/chart-view/vocab.ts
index 7d751ae7a2..e220a583a6 100644
--- a/web/src/features/chart-view/vocab.ts
+++ b/web/src/features/chart-view/vocab.ts
@@ -141,9 +141,7 @@ export const getMetric = (key: MetricKey): MetricDef =>
export const getDimension = (key: DimensionKey): DimensionDef =>
DIMENSIONS.find((d) => d.key === key) ?? DIMENSIONS[0];
-export const getChartType = (
- value: DashboardWidgetChartType,
-): ChartTypeOption =>
+const getChartType = (value: DashboardWidgetChartType): ChartTypeOption =>
CHART_TYPES.find((c) => c.value === value) ?? CHART_TYPES[0];
export const isTimeSeriesChartType = (
diff --git a/web/src/features/comments/contexts/InlineCommentSelectionContext.tsx b/web/src/features/comments/contexts/InlineCommentSelectionContext.tsx
index f8d3198e4c..97ee5948f0 100644
--- a/web/src/features/comments/contexts/InlineCommentSelectionContext.tsx
+++ b/web/src/features/comments/contexts/InlineCommentSelectionContext.tsx
@@ -52,16 +52,6 @@ export function InlineCommentSelectionProvider({
);
}
-export function useInlineCommentSelection() {
- const context = useContext(InlineCommentSelectionContext);
- if (!context) {
- throw new Error(
- "useInlineCommentSelection must be used within InlineCommentSelectionProvider",
- );
- }
- return context;
-}
-
/**
* Optional hook that doesn't throw if context is missing.
* Useful for components that may or may not be inside the provider.
diff --git a/web/src/features/comments/server/publicCommentService.ts b/web/src/features/comments/server/publicCommentService.ts
index 03ad73131d..0d6b39ddfa 100644
--- a/web/src/features/comments/server/publicCommentService.ts
+++ b/web/src/features/comments/server/publicCommentService.ts
@@ -51,7 +51,7 @@ const toPublicComment = (comment: {
authorUserId: comment.authorUserId,
});
-export const getCommentRecordOrThrow = async ({
+const getCommentRecordOrThrow = async ({
projectId,
commentId,
}: GetCommentInput) => {
diff --git a/web/src/features/dashboard/lib/dashboard-utils.ts b/web/src/features/dashboard/lib/dashboard-utils.ts
index 0dee693093..15d02b8f3d 100644
--- a/web/src/features/dashboard/lib/dashboard-utils.ts
+++ b/web/src/features/dashboard/lib/dashboard-utils.ts
@@ -20,7 +20,7 @@ export const createTracesTimeFilter = (
};
/** Filter to exclude events with empty trace_name (observations view only). */
-export const TRACE_NAME_NOT_NULL_FILTER: z.infer<typeof singleFilter> = {
+const TRACE_NAME_NOT_NULL_FILTER: z.infer<typeof singleFilter> = {
type: "null",
column: "traceName",
operator: "is not null",
diff --git a/web/src/features/dashboard/lib/dashboardUiTableToViewMapping.ts b/web/src/features/dashboard/lib/dashboardUiTableToViewMapping.ts
index 8d5b9e1de4..b239bee115 100644
--- a/web/src/features/dashboard/lib/dashboardUiTableToViewMapping.ts
+++ b/web/src/features/dashboard/lib/dashboardUiTableToViewMapping.ts
@@ -2,8 +2,6 @@ import { z } from "zod";
import { singleFilter } from "@langfuse/shared";
import { type views } from "@langfuse/shared/query";
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
export const FilterArray = z.array(singleFilter);
/**
diff --git a/web/src/features/dashboard/lib/score-analytics-utils.ts b/web/src/features/dashboard/lib/score-analytics-utils.ts
index 4acaad1657..43d701669a 100644
--- a/web/src/features/dashboard/lib/score-analytics-utils.ts
+++ b/web/src/features/dashboard/lib/score-analytics-utils.ts
@@ -3,7 +3,6 @@ import { type DatabaseRow } from "@/src/server/api/services/sqlInterface";
import {
type CategoryCounts,
type ChartBin,
- type HistogramBin,
} from "@/src/features/scores/types";
import { type RouterOutputs } from "@/src/utils/api";
@@ -83,19 +82,6 @@ export function createHistogramData(
};
}
-export function padChartData(chartData: HistogramBin[]) {
- const emptyBin = { binLabel: "", empty: 0 };
- if (chartData.length < 3) {
- return [emptyBin, emptyBin, ...chartData, emptyBin, emptyBin];
- }
-
- if (chartData.length < 5) {
- return [emptyBin, ...chartData, emptyBin];
- }
-
- return chartData;
-}
-
// categorical score analytics helpers
function convertDateToStringTimestamp(date: Date): string {
return date.toLocaleDateString("en-US", {
diff --git a/web/src/features/dashboard/utils/dashboard-import-export.ts b/web/src/features/dashboard/utils/dashboard-import-export.ts
index bb82cc822a..30084f31e5 100644
--- a/web/src/features/dashboard/utils/dashboard-import-export.ts
+++ b/web/src/features/dashboard/utils/dashboard-import-export.ts
@@ -21,7 +21,7 @@ import {
*/
export const DASHBOARD_FILE_FORMAT_VERSION = 1;
-export function isLangfuseDashboardPayload(parsed: unknown): boolean {
+function isLangfuseDashboardPayload(parsed: unknown): boolean {
return (
typeof parsed === "object" &&
parsed !== null &&
diff --git a/web/src/features/datasets/components/DatasetForm.tsx b/web/src/features/datasets/components/DatasetForm.tsx
index dbf17cbf8b..75368192f8 100644
--- a/web/src/features/datasets/components/DatasetForm.tsx
+++ b/web/src/features/datasets/components/DatasetForm.tsx
@@ -84,7 +84,7 @@ interface UpdateDatasetFormProps extends BaseDatasetFormProps {
type DatasetFormProps = CreateDatasetFormProps | UpdateDatasetFormProps;
// Validation schema for JSON Schema strings
-export const jsonSchemaStringValidator = z.string().refine(
+const jsonSchemaStringValidator = z.string().refine(
(value) => {
if (value === "") return true; // Empty is valid (means no schema)
diff --git a/web/src/features/datasets/components/DatasetItemMediaAttachments.tsx b/web/src/features/datasets/components/DatasetItemMediaAttachments.tsx
index 03ed06083b..3d5837c5c7 100644
--- a/web/src/features/datasets/components/DatasetItemMediaAttachments.tsx
+++ b/web/src/features/datasets/components/DatasetItemMediaAttachments.tsx
@@ -164,7 +164,7 @@ export function createMediaDropPasteExtension({
* Attach button for a dataset item field. Shows a spinner while its upload is
* in flight; failures surface via toast from the upload hook.
*/
-export function DatasetItemMediaUploadButton({
+function DatasetItemMediaUploadButton({
onSelectFile,
disabled,
}: {
diff --git a/web/src/features/datasets/contexts/DatasetCompareFieldsContext.tsx b/web/src/features/datasets/contexts/DatasetCompareFieldsContext.tsx
index 127be02d49..91de8bd7da 100644
--- a/web/src/features/datasets/contexts/DatasetCompareFieldsContext.tsx
+++ b/web/src/features/datasets/contexts/DatasetCompareFieldsContext.tsx
@@ -1,12 +1,7 @@
import { createContext, useContext, useState, type ReactNode } from "react";
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
-export const DATASET_RUN_FIELDS = [
- "output",
- "scores",
- "resourceMetrics",
-] as const;
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const DATASET_RUN_FIELDS = ["output", "scores", "resourceMetrics"] as const;
export type DatasetRunField = (typeof DATASET_RUN_FIELDS)[number];
interface DatasetCompareFieldsContextValue {
diff --git a/web/src/features/datasets/lib/costCalculations.ts b/web/src/features/datasets/lib/costCalculations.ts
index 60614ea67f..f1d071e254 100644
--- a/web/src/features/datasets/lib/costCalculations.ts
+++ b/web/src/features/datasets/lib/costCalculations.ts
@@ -15,7 +15,7 @@ export type ObservationCostData = {
/**
* Find all descendants of a root observation using BFS traversal
*/
-export const findObservationDescendants = <T extends ObservationCostData>(
+const findObservationDescendants = <T extends ObservationCostData>(
rootObsId: string,
allObservations: T[],
): T[] => {
@@ -63,7 +63,7 @@ export const findObservationDescendants = <T extends ObservationCostData>(
/**
* Sum costs for a list of observations
*/
-export const sumObservationCosts = (
+const sumObservationCosts = (
observations: ObservationCostData[],
): Decimal | undefined => {
return observations.reduce<Decimal | undefined>((prev, curr) => {
diff --git a/web/src/features/datasets/server/dataset-router.ts b/web/src/features/datasets/server/dataset-router.ts
index 26087aefe7..97791bb4b3 100644
--- a/web/src/features/datasets/server/dataset-router.ts
+++ b/web/src/features/datasets/server/dataset-router.ts
@@ -185,7 +185,7 @@ const buildPathPrefixFilter = (pathPrefix?: string): Prisma.Sql => {
* @param filters - Array of filter conditions to evaluate
* @returns true if any filter requires DRI metrics, false if using basic dataset run data is sufficient
*/
-export const requiresClickhouseLookups = (filters: FilterState): boolean => {
+const requiresClickhouseLookups = (filters: FilterState): boolean => {
if (filters.length === 0) {
return false;
}
diff --git a/web/src/features/datasets/server/publicDatasetService.ts b/web/src/features/datasets/server/publicDatasetService.ts
index 3f84b46c51..d947737707 100644
--- a/web/src/features/datasets/server/publicDatasetService.ts
+++ b/web/src/features/datasets/server/publicDatasetService.ts
@@ -17,7 +17,6 @@ import {
type GetDatasetRunV1Query,
type GetDatasetRunsV1Query,
type GetDatasetsV2Query,
- type GetDatasetV2Query,
type PostDatasetRunItemsV1Body,
type PostDatasetsV1Body,
type PostDatasetsV2Body,
@@ -74,10 +73,6 @@ type ListDatasetsV1Input = z.infer<typeof GetDatasetsV1Query> & {
projectId: string;
};
-type GetDatasetInput = z.infer<typeof GetDatasetV2Query> & {
- projectId: string;
-};
-
type GetDatasetV1Input = z.infer<typeof GetDatasetV1Query> & {
projectId: string;
};
@@ -372,14 +367,6 @@ export const listDatasetsForApi = async ({
};
};
-export const getDatasetForApi = async ({
- projectId,
- datasetName,
-}: GetDatasetInput) => {
- const dataset = await getDatasetByNameOrThrow({ projectId, datasetName });
- return transformDbDatasetToAPIDataset(dataset);
-};
-
export const getDatasetByIdForApi = async ({
projectId,
datasetId,
diff --git a/web/src/features/entitlements/constants/entitlements.ts b/web/src/features/entitlements/constants/entitlements.ts
index 39e880d326..58938a1b1f 100644
--- a/web/src/features/entitlements/constants/entitlements.ts
+++ b/web/src/features/entitlements/constants/entitlements.ts
@@ -1,9 +1,8 @@
import { type Plan } from "@langfuse/shared";
// Entitlements: Binary feature access
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
-export const entitlements = [
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const entitlements = [
// features
"rbac-project-roles",
"cloud-billing",
@@ -34,9 +33,8 @@ const selfHostedAllPlansEntitlements: Entitlement[] = [
];
// Entitlement Limits: Limits on the number of resources that can be created/used
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
-export const entitlementLimits = [
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const entitlementLimits = [
"annotation-queue-count",
"organization-member-count",
"data-access-days",
diff --git a/web/src/features/entitlements/hooks.ts b/web/src/features/entitlements/hooks.ts
index 5317f9a026..840b0e01a1 100644
--- a/web/src/features/entitlements/hooks.ts
+++ b/web/src/features/entitlements/hooks.ts
@@ -76,7 +76,7 @@ export const useHasEntitlement = (entitlement: Entitlement): boolean => {
* Hook to get the entitlement limits of the current organization or self-hosted instance.
* @returns the entitlement limits of the current organization or self-hosted instance, including values of limits and false if unlimited.
*/
-export const useEntitlementLimits = (): EntitlementLimits => {
+const useEntitlementLimits = (): EntitlementLimits => {
const plan = usePlan();
return entitlementAccess[plan ?? "oss"].entitlementLimits;
};
diff --git a/web/src/features/entitlements/server/hasEntitlementLimit.ts b/web/src/features/entitlements/server/hasEntitlementLimit.ts
index 6317fd2067..ca76f0d1ea 100644
--- a/web/src/features/entitlements/server/hasEntitlementLimit.ts
+++ b/web/src/features/entitlements/server/hasEntitlementLimit.ts
@@ -34,7 +34,7 @@ export const hasEntitlementLimit = (
});
};
-export const hasEntitlementLimitBasedOnPlan = ({
+const hasEntitlementLimitBasedOnPlan = ({
plan,
entitlementLimit,
}: {
@@ -48,7 +48,7 @@ export const hasEntitlementLimitBasedOnPlan = ({
* Check if a specific usage is within the entitlement limit
* @returns true if usage is allowed, false if it exceeds the limit
*/
-export const isWithinEntitlementLimit = (
+const isWithinEntitlementLimit = (
p: HasEntitlementLimitParams & { currentUsage: number },
): boolean => {
const limit = hasEntitlementLimit(p);
diff --git a/web/src/features/evals/v2/components/Rules/EvaluatorRuleRelationships/EvaluatorRuleRelationships.tsx b/web/src/features/evals/v2/components/Rules/EvaluatorRuleRelationships/EvaluatorRuleRelationships.tsx
index fd77dac4b1..58baedf223 100644
--- a/web/src/features/evals/v2/components/Rules/EvaluatorRuleRelationships/EvaluatorRuleRelationships.tsx
+++ b/web/src/features/evals/v2/components/Rules/EvaluatorRuleRelationships/EvaluatorRuleRelationships.tsx
@@ -82,7 +82,7 @@ export function EvaluatorRuleRelationships({
);
}
-export function EvaluatorRuleRelationshipsSheet({
+function EvaluatorRuleRelationshipsSheet({
projectId,
evaluatorId,
evaluatorName,
diff --git a/web/src/features/events/components/outlier-strip/lib/binning.ts b/web/src/features/events/components/outlier-strip/lib/binning.ts
index f1418a88c2..6c30350abb 100644
--- a/web/src/features/events/components/outlier-strip/lib/binning.ts
+++ b/web/src/features/events/components/outlier-strip/lib/binning.ts
@@ -54,7 +54,7 @@ export const OUTLIER_STRIP_STEP_LADDER_SECONDS = [
* excluded on purpose. Finer sub-minute steps need a backend addition —
* tracked as a follow-up to LFE-14451.
*/
-export const OUTLIER_STRIP_GRANULARITIES = [
+const OUTLIER_STRIP_GRANULARITIES = [
{ granularity: "minute", stepSeconds: 60 },
{ granularity: "5m", stepSeconds: 300 },
{ granularity: "10m", stepSeconds: 600 },
@@ -260,7 +260,7 @@ export const outlierStripQueryMetrics = (): {
);
/** Resolves an aggregation option, falling back to the metric's default. */
-export const resolveAggregation = (
+const resolveAggregation = (
metric: OutlierStripMetricKey,
aggregation: string | undefined,
): AggregationDef => {
diff --git a/web/src/features/events/components/outlier-strip/lib/fixtures.ts b/web/src/features/events/components/outlier-strip/lib/fixtures.ts
index 69bfbb433c..02dbf6bb66 100644
--- a/web/src/features/events/components/outlier-strip/lib/fixtures.ts
+++ b/web/src/features/events/components/outlier-strip/lib/fixtures.ts
@@ -30,9 +30,9 @@ export type FixtureProfile =
/** Events exist but carry no metric data (root-only cost shape). */
| "noMetricData";
-export const FIXTURE_BASE_MS = Date.UTC(2026, 6, 26, 0, 0, 0); // fixed: 2026-07-26
+const FIXTURE_BASE_MS = Date.UTC(2026, 6, 26, 0, 0, 0); // fixed: 2026-07-26
-export function makeFixtureBins(params: {
+function makeFixtureBins(params: {
rangeMs: number;
stepSeconds: number;
profile: FixtureProfile;
diff --git a/web/src/features/events/components/outlier-strip/lib/useOutlierStripSettings.ts b/web/src/features/events/components/outlier-strip/lib/useOutlierStripSettings.ts
index 79281d0784..f0326c8d67 100644
--- a/web/src/features/events/components/outlier-strip/lib/useOutlierStripSettings.ts
+++ b/web/src/features/events/components/outlier-strip/lib/useOutlierStripSettings.ts
@@ -21,7 +21,7 @@ export type OutlierStripSettings = z.infer<typeof outlierStripSettingsSchema>;
const OUTLIER_STRIP_SETTINGS_VERSION = 1;
-export const parseOutlierStripSettings = (raw: unknown) => {
+const parseOutlierStripSettings = (raw: unknown) => {
const settings = outlierStripSettingsSchema.parse(raw ?? {});
const isCurrentVersion = z
.object({ version: z.literal(OUTLIER_STRIP_SETTINGS_VERSION) })
diff --git a/web/src/features/events/config/filter-config.ts b/web/src/features/events/config/filter-config.ts
index b4342d1062..e84a8bb691 100644
--- a/web/src/features/events/config/filter-config.ts
+++ b/web/src/features/events/config/filter-config.ts
@@ -3,7 +3,6 @@ import {
omitFilterFacets,
type FilterConfig,
} from "@/src/features/filters/lib/filter-config";
-import type { ColumnToBackendKeyMap } from "@/src/features/filters/lib/filter-transform";
import { renderFilterIcon } from "@/src/components/ItemBadge";
import { renderLevelIcon } from "@/src/components/level-colors";
@@ -16,18 +15,10 @@ export const getEventsColumnName = (id: string): string => {
return column.name;
};
-/**
- * Maps frontend column IDs to backend-expected column IDs for events table
- * Events table uses different naming conventions than observations table
- */
-export const OBSERVATION_EVENTS_COLUMN_TO_BACKEND_KEY: ColumnToBackendKeyMap = {
- // No mapping needed currently - events table column names align with UI
-};
-
const isBooleanEqualityOperator = (operator: string): operator is "=" | "<>" =>
operator === "=" || operator === "<>";
-export const migrateLegacyRootObservationFilters = (
+const migrateLegacyRootObservationFilters = (
filters: FilterState,
): FilterState => {
const hasRootObservationFilter = filters.some(
diff --git a/web/src/features/events/lib/appRootDefaultFilterPolicy.ts b/web/src/features/events/lib/appRootDefaultFilterPolicy.ts
index 8bf3a769eb..9248283557 100644
--- a/web/src/features/events/lib/appRootDefaultFilterPolicy.ts
+++ b/web/src/features/events/lib/appRootDefaultFilterPolicy.ts
@@ -57,7 +57,7 @@ export const getAppRootDefaultPolicy = (params: {
};
};
-export const hasEnabledAppRootFilter = (filters: FilterState) =>
+const hasEnabledAppRootFilter = (filters: FilterState) =>
filters.some(
(filter) =>
filter.column === APP_ROOT_OBSERVATION_FILTER.column &&
diff --git a/web/src/features/events/server/eventsRouter.ts b/web/src/features/events/server/eventsRouter.ts
index 9c5a4b10ea..a64153ab3a 100644
--- a/web/src/features/events/server/eventsRouter.ts
+++ b/web/src/features/events/server/eventsRouter.ts
@@ -92,7 +92,7 @@ const GetEventMetadataValuesInput = zodSchema.object({
startTimeFilter: zodSchema.array(timeFilter).optional(),
});
-export const BatchIOInput = zodSchema.object({
+const BatchIOInput = zodSchema.object({
projectId: zodSchema.string(),
observations: zodSchema
.array(
@@ -116,7 +116,7 @@ export const BatchIOInput = zodSchema.object({
traceId: zodSchema.string().optional(),
});
-export type BatchIOInput = z.infer<typeof BatchIOInput>;
+type BatchIOInput = z.infer<typeof BatchIOInput>;
export const eventsRouter = createTRPCRouter({
all: protectedProjectProcedure
@@ -492,7 +492,7 @@ export const eventsRouter = createTRPCRouter({
}),
});
-export const addAttributesToSpan = ({
+const addAttributesToSpan = ({
span,
input,
orderBy,
@@ -534,6 +534,6 @@ export const addAttributesToSpan = ({
}
};
-export const dateDiff = (date1: Date, date2: Date) => {
+const dateDiff = (date1: Date, date2: Date) => {
return Math.abs(date2.getTime() - date1.getTime());
};
diff --git a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
index 19b5edeabe..f2d43d3989 100644
--- a/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
+++ b/web/src/features/experiments/components/table/ExperimentItemsTable.tsx
@@ -93,12 +93,12 @@ function toScoreColumnInput(scoreColumnDefs: ScoreColumnDef[]): Array<{
}));
}
-export const getDefaultExperimentFilterTarget = (props: {
+const getDefaultExperimentFilterTarget = (props: {
baselineId?: string;
comparisonIds: string[];
}) => props.baselineId ?? props.comparisonIds[0];
-export const shouldEnableExperimentPeek = (props: {
+const shouldEnableExperimentPeek = (props: {
hasBaseline: boolean;
hideControls: boolean;
}) => !props.hideControls && props.hasBaseline;
diff --git a/web/src/features/experiments/components/table/filter-config.ts b/web/src/features/experiments/components/table/filter-config.ts
index 55ecaff872..cebe618b11 100644
--- a/web/src/features/experiments/components/table/filter-config.ts
+++ b/web/src/features/experiments/components/table/filter-config.ts
@@ -2,7 +2,6 @@ import {
omitFilterFacets,
type FilterConfig,
} from "@/src/features/filters/lib/filter-config";
-import type { ColumnToBackendKeyMap } from "@/src/features/filters/lib/filter-transform";
import type { ColumnDefinition } from "@langfuse/shared";
// Temporary column definitions for experiments
@@ -137,14 +136,7 @@ export const getExperimentsColumnName = (id: string): string => {
return column.name;
};
-/**
- * Maps frontend column IDs to backend-expected column IDs for experiments table
- */
-export const EXPERIMENTS_COLUMN_TO_BACKEND_KEY: ColumnToBackendKeyMap = {
- // No mapping needed currently
-};
-
-export const experimentsFilterConfig: FilterConfig = {
+const experimentsFilterConfig: FilterConfig = {
tableName: "experiments",
columnDefinitions: experimentsTableCols,
diff --git a/web/src/features/experiments/components/table/index.ts b/web/src/features/experiments/components/table/index.ts
index a681632109..3f2be4293f 100644
--- a/web/src/features/experiments/components/table/index.ts
+++ b/web/src/features/experiments/components/table/index.ts
@@ -1,5 +1,4 @@
export { default as ExperimentsTable } from "./ExperimentsTable";
export { default as ExperimentItemsTable } from "./ExperimentItemsTable";
-export { ExperimentFilterPills } from "./ExperimentFilterPills";
export * from "./types";
export * from "./filter-config";
diff --git a/web/src/features/experiments/components/table/types.ts b/web/src/features/experiments/components/table/types.ts
index 08c1af295a..30a14e39a1 100644
--- a/web/src/features/experiments/components/table/types.ts
+++ b/web/src/features/experiments/components/table/types.ts
@@ -3,7 +3,7 @@ import { type VisibilityState } from "@tanstack/react-table";
import { type ReactNode } from "react";
// Shared font color palette for experiment rows/columns
-export const EXPERIMENT_COLOR_STYLES = [
+const EXPERIMENT_COLOR_STYLES = [
{
textClass: "text-foreground",
markerClass: "bg-foreground",
@@ -73,17 +73,6 @@ export const EXPERIMENT_COLOR_STYLES = [
export type ExperimentColorStyle = (typeof EXPERIMENT_COLOR_STYLES)[number];
-/**
- * Get the text color class for an experiment based on its index.
- */
-export const getExperimentColor = (
- experimentId: string,
- allExperimentIds: string[],
-): string => {
- const styles = getExperimentColorStyles(experimentId, allExperimentIds);
- return styles.textClass;
-};
-
export const getExperimentColorStyles = (
experimentId: string,
allExperimentIds: string[],
diff --git a/web/src/features/experiments/hooks/useEvaluatorDefaults.ts b/web/src/features/experiments/hooks/useEvaluatorDefaults.ts
index f102bc5dff..382e4e9500 100644
--- a/web/src/features/experiments/hooks/useEvaluatorDefaults.ts
+++ b/web/src/features/experiments/hooks/useEvaluatorDefaults.ts
@@ -7,7 +7,7 @@ import {
import { type PartialConfig } from "@/src/features/evals/types";
import { createDefaultVariableMappings } from "@/src/features/experiments/utils/evaluatorMappingUtils";
-export const CONFIG_BASE = {
+const CONFIG_BASE = {
sampling: new Decimal(1),
delay: 30000,
timeScope: ["NEW"],
diff --git a/web/src/features/experiments/utils/charts.ts b/web/src/features/experiments/utils/charts.ts
index f9ae4bbcc2..697629262a 100644
--- a/web/src/features/experiments/utils/charts.ts
+++ b/web/src/features/experiments/utils/charts.ts
@@ -17,7 +17,7 @@ import type {
} from "@/src/features/experiments/types/charts";
// Build chart ID from type and score name
-export const buildScoreChartId = (
+const buildScoreChartId = (
level: ScoreLevel,
dataType: "numeric" | "categorical",
scoreName: string,
@@ -52,7 +52,7 @@ function getScoreNamesFromFilterOption(
: Object.keys(value as Record<string, string[]>);
}
-export function createScoreWidgetConfig(params: {
+function createScoreWidgetConfig(params: {
level: ScoreLevel;
dataType: "numeric" | "categorical";
scoreName: string;
diff --git a/web/src/features/experiments/utils/evaluatorMappingUtils.ts b/web/src/features/experiments/utils/evaluatorMappingUtils.ts
index 6bc37ab292..28fbeb48ce 100644
--- a/web/src/features/experiments/utils/evaluatorMappingUtils.ts
+++ b/web/src/features/experiments/utils/evaluatorMappingUtils.ts
@@ -9,13 +9,6 @@ type VariableMapping = {
jsonSelector?: string;
};
-// Observation variable mapping (for event/experiment evaluators)
-type ObservationVariableMapping = {
- templateVariable: string;
- selectedColumnId: string;
- jsonSelector?: string;
-};
-
const defaultMappings = new Map<string, Partial<VariableMapping>>([
// Common input variables (trace doesn't need objectName)
[
@@ -112,29 +105,6 @@ const defaultMappings = new Map<string, Partial<VariableMapping>>([
],
]);
-// Default mappings for observation-based evaluators (event/experiment)
-const observationDefaultMappings = new Map<
- string,
- Partial<ObservationVariableMapping>
->([
- // Common input variables
- ["input", { selectedColumnId: "input" }],
- ["query", { selectedColumnId: "input" }],
- ["question", { selectedColumnId: "input" }],
- ["prompt", { selectedColumnId: "input" }],
-
- // Common output variables
- ["output", { selectedColumnId: "output" }],
- ["response", { selectedColumnId: "output" }],
- ["answer", { selectedColumnId: "output" }],
- ["completion", { selectedColumnId: "output" }],
-
- // Common ground truth variables (from experiment item)
- ["expected_output", { selectedColumnId: "experimentItemExpectedOutput" }],
- ["ground_truth", { selectedColumnId: "experimentItemExpectedOutput" }],
- ["reference", { selectedColumnId: "experimentItemExpectedOutput" }],
-]);
-
/**
* Creates default variable mappings for an evaluator template.
* Used for trace/dataset evaluators (legacy).
@@ -172,39 +142,3 @@ export function createDefaultVariableMappings(
};
});
}
-
-/**
- * Creates default variable mappings for observation-based evaluators (event/experiment).
- * Uses simplified schema without langfuseObject.
- *
- * @param template - The evaluation template containing variables
- * @returns Array of observation variable mappings
- */
-export function createDefaultObservationVariableMappings(
- template: EvalTemplate,
-): ObservationVariableMapping[] {
- if (!template.vars || template.vars.length === 0) {
- return [];
- }
-
- return template.vars.map((variable) => {
- // Check if we have a default mapping for this variable name
- const defaultMapping = observationDefaultMappings.get(
- variable.toLowerCase(),
- );
-
- if (defaultMapping) {
- return {
- templateVariable: variable,
- selectedColumnId:
- defaultMapping.selectedColumnId || "experimentItemExpectedOutput",
- jsonSelector: defaultMapping.jsonSelector,
- };
- }
-
- return {
- templateVariable: variable,
- selectedColumnId: "experimentItemExpectedOutput",
- };
- });
-}
diff --git a/web/src/features/experiments/utils/experimentUrlTranslation.ts b/web/src/features/experiments/utils/experimentUrlTranslation.ts
index 847f158991..566e081c7c 100644
--- a/web/src/features/experiments/utils/experimentUrlTranslation.ts
+++ b/web/src/features/experiments/utils/experimentUrlTranslation.ts
@@ -42,16 +42,3 @@ export function singleRunToExperimentsUrl(
): string {
return `/project/${projectId}/experiments/results?baseline=${encodeURIComponent(runId)}`;
}
-
-/**
- * Parse experiments results URL params.
- */
-export function parseExperimentsResultsParams(query: {
- baseline?: string;
- c?: string;
-}): { baseline: string | null; comparisons: string[] } {
- const baseline = query.baseline ?? null;
- const comparisons = query.c ? query.c.split(",").filter(Boolean) : [];
-
- return { baseline, comparisons };
-}
diff --git a/web/src/features/feature-flags/server/organizationFeatureFlags.ts b/web/src/features/feature-flags/server/organizationFeatureFlags.ts
index b6f7a8f749..f57c8769f5 100644
--- a/web/src/features/feature-flags/server/organizationFeatureFlags.ts
+++ b/web/src/features/feature-flags/server/organizationFeatureFlags.ts
@@ -160,7 +160,7 @@ export async function getUserFeaturePreviewManagementCapabilities({
);
}
-export async function setUserFeaturePreviewInTransaction({
+async function setUserFeaturePreviewInTransaction({
tx,
userId,
flag,
diff --git a/web/src/features/feature-flags/utils.ts b/web/src/features/feature-flags/utils.ts
index 08f1f97168..1ff3ddc6d5 100644
--- a/web/src/features/feature-flags/utils.ts
+++ b/web/src/features/feature-flags/utils.ts
@@ -11,9 +11,7 @@ import { type Flags } from "./types";
export const getFeaturePreviewOptOutFlag = (flag: FeaturePreviewFlag) =>
`feature-preview:${flag}:disabled`;
-export const receivesFeaturePreviewsByDefault = (
- email: string | null | undefined,
-) => {
+const receivesFeaturePreviewsByDefault = (email: string | null | undefined) => {
const normalizedEmail = email?.toLowerCase();
return (
normalizedEmail?.endsWith("@langfuse.com") === true ||
diff --git a/web/src/features/feedback/server/FeedbackService.ts b/web/src/features/feedback/server/FeedbackService.ts
index c9d3493ec5..863144af32 100644
--- a/web/src/features/feedback/server/FeedbackService.ts
+++ b/web/src/features/feedback/server/FeedbackService.ts
@@ -102,7 +102,7 @@ const appendPlainTextSection = (
const getDataRegion = (): string =>
env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION ?? "self-hosted";
-export const isHipaaCloudRegion = (): boolean =>
+const isHipaaCloudRegion = (): boolean =>
env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === "HIPAA";
// Product feedback is intentionally unavailable in HIPAA: Slack delivery is
diff --git a/web/src/features/filters/config/scores-config.ts b/web/src/features/filters/config/scores-config.ts
index 4846543995..daf775cbb6 100644
--- a/web/src/features/filters/config/scores-config.ts
+++ b/web/src/features/filters/config/scores-config.ts
@@ -23,7 +23,7 @@ const SCORES_HIDDEN_COLUMN_TO_FILTER_COLUMN: Partial<
traceTags: "tags",
};
-export const scoreFilterConfig: FilterConfig = {
+const scoreFilterConfig: FilterConfig = {
tableName: "scores",
columnDefinitions: scoresTableCols,
diff --git a/web/src/features/filters/lib/persistedSidebarFilterQuery.ts b/web/src/features/filters/lib/persistedSidebarFilterQuery.ts
index e1b1d99e5d..1987613127 100644
--- a/web/src/features/filters/lib/persistedSidebarFilterQuery.ts
+++ b/web/src/features/filters/lib/persistedSidebarFilterQuery.ts
@@ -35,7 +35,7 @@ export function createPersistedSidebarFilterQueryState(
return { contextId, query };
}
-export function parsePersistedSidebarFilterQueryState(
+function parsePersistedSidebarFilterQueryState(
rawState: string | null,
): PersistedSidebarFilterQueryState | null {
if (!rawState) return null;
diff --git a/web/src/features/global-time-range/globalDateRangeStore.ts b/web/src/features/global-time-range/globalDateRangeStore.ts
index 7d0a693fef..07e2e5fffe 100644
--- a/web/src/features/global-time-range/globalDateRangeStore.ts
+++ b/web/src/features/global-time-range/globalDateRangeStore.ts
@@ -26,7 +26,7 @@ import {
type StateStorage,
} from "zustand/middleware";
-export const GLOBAL_DATE_RANGE_STORAGE_KEY = "langfuse-global-date-range";
+const GLOBAL_DATE_RANGE_STORAGE_KEY = "langfuse-global-date-range";
// No-op storage on the server; the real localStorage is used on the client.
const noopStorage: StateStorage = {
diff --git a/web/src/features/in-app-agent/components/InAppAiAgentProvider.tsx b/web/src/features/in-app-agent/components/InAppAiAgentProvider.tsx
index f4d8637acb..a0415eb718 100644
--- a/web/src/features/in-app-agent/components/InAppAiAgentProvider.tsx
+++ b/web/src/features/in-app-agent/components/InAppAiAgentProvider.tsx
@@ -1596,7 +1596,7 @@ export function useInAppAiAgent() {
* Features. Use this for polling and other paths that must not hit the
* server when org AI Features is off. More restrictive than
* useIsInAppAgentLauncherVisible. */
-export function useCanUseInAppAgent() {
+function useCanUseInAppAgent() {
const hasInAppAgentEntitlement = useHasEntitlement("in-app-agent");
const { organization } = useQueryProjectOrOrganization();
const session = useSession();
diff --git a/web/src/features/in-app-agent/lib/backgroundExecutionSession.ts b/web/src/features/in-app-agent/lib/backgroundExecutionSession.ts
index b40f8cb13c..1bd46654c8 100644
--- a/web/src/features/in-app-agent/lib/backgroundExecutionSession.ts
+++ b/web/src/features/in-app-agent/lib/backgroundExecutionSession.ts
@@ -589,9 +589,7 @@ const BACKGROUND_RUN_FAILURE_MESSAGES: Readonly<Record<string, string>> = {
[InAppAgentRunErrorCode.CANCELLED]: "You stopped this run.",
};
-export function getBackgroundRunFailureMessage(
- errorCode: string | null,
-): string {
+function getBackgroundRunFailureMessage(errorCode: string | null): string {
return (
BACKGROUND_RUN_FAILURE_MESSAGES[errorCode ?? ""] ??
"The run failed. Try again."
diff --git a/web/src/features/in-app-agent/lib/display.ts b/web/src/features/in-app-agent/lib/display.ts
index 7975d55f40..5bf656ac71 100644
--- a/web/src/features/in-app-agent/lib/display.ts
+++ b/web/src/features/in-app-agent/lib/display.ts
@@ -74,7 +74,7 @@ const InAppAgentDisplayPlacementSchema = z.object({
* dominate and are never duplicated here, so that optimization is not worth
* its invariant today.
*/
-export const SerializedInAppAgentDisplayStateSchema = z.object({
+const SerializedInAppAgentDisplayStateSchema = z.object({
latestPlacement: InAppAgentDisplayPlacementSchema.nullable(),
nativeToolCallParentMessageId: z.string().nullable(),
latestNewMessageId: z.string().nullable(),
diff --git a/web/src/features/in-app-agent/lib/inAppAgentActivity.ts b/web/src/features/in-app-agent/lib/inAppAgentActivity.ts
index 41dd151f00..190d769d64 100644
--- a/web/src/features/in-app-agent/lib/inAppAgentActivity.ts
+++ b/web/src/features/in-app-agent/lib/inAppAgentActivity.ts
@@ -52,8 +52,8 @@ export type InAppAgentActivityByConversationId = Map<
InAppAgentActivityEntry
>;
-export const IN_APP_AGENT_ACTIVITY_RECEIPTS_VERSION = 1;
-export const IN_APP_AGENT_DELIVERED_RECEIPTS_VERSION = 1;
+const IN_APP_AGENT_ACTIVITY_RECEIPTS_VERSION = 1;
+const IN_APP_AGENT_DELIVERED_RECEIPTS_VERSION = 1;
/**
* Activity polls the newest N conversations only (same page as the drawer list
@@ -136,7 +136,7 @@ function getActivityEntry(params: {
}
/** Drop ledger keys for conversations no longer in the activity window. */
-export function pruneInAppAgentReceiptRecord(
+function pruneInAppAgentReceiptRecord(
record: Record<string, string>,
liveConversationIds: ReadonlySet<string>,
): { record: Record<string, string>; changed: boolean } {
diff --git a/web/src/features/in-app-agent/server/rateLimit.ts b/web/src/features/in-app-agent/server/rateLimit.ts
index 34da2f2c71..f422755c99 100644
--- a/web/src/features/in-app-agent/server/rateLimit.ts
+++ b/web/src/features/in-app-agent/server/rateLimit.ts
@@ -68,7 +68,7 @@ export function getInAppAgentApiAccessScope(
};
}
-export async function checkInAppAgentRateLimit(
+async function checkInAppAgentRateLimit(
scope: ApiAccessScope,
resource: Parameters<RateLimitService["rateLimitRequest"]>[1],
): Promise<RateLimitResult | undefined> {
diff --git a/web/src/features/in-app-agent/watchFrames.ts b/web/src/features/in-app-agent/watchFrames.ts
index 78ec93202d..2aac3c1c04 100644
--- a/web/src/features/in-app-agent/watchFrames.ts
+++ b/web/src/features/in-app-agent/watchFrames.ts
@@ -30,8 +30,10 @@ export const InAppAgentWatchFrameSchema = z.discriminatedUnion("type", [
export type InAppAgentWatchFrame = z.infer<typeof InAppAgentWatchFrameSchema>;
/** A parked approval occupies neither a worker nor the conversation slot. */
-export const IN_APP_AGENT_ACTIVE_RUN_STATUSES: readonly InAppAgentRunStatus[] =
- [InAppAgentRunStatus.QUEUED, InAppAgentRunStatus.RUNNING];
+const IN_APP_AGENT_ACTIVE_RUN_STATUSES: readonly InAppAgentRunStatus[] = [
+ InAppAgentRunStatus.QUEUED,
+ InAppAgentRunStatus.RUNNING,
+];
export function isActiveInAppAgentRunStatus(
status: InAppAgentRunStatus,
diff --git a/web/src/features/llm-api-key/server/router.ts b/web/src/features/llm-api-key/server/router.ts
index d0707fec57..54663adb49 100644
--- a/web/src/features/llm-api-key/server/router.ts
+++ b/web/src/features/llm-api-key/server/router.ts
@@ -59,7 +59,7 @@ export function getDisplaySecretKey(secretKey: string) {
: "..." + secretKey.slice(-4);
}
-export function validateBedrockSecretKey(secretKey: string) {
+function validateBedrockSecretKey(secretKey: string) {
if (secretKey === BEDROCK_USE_DEFAULT_CREDENTIALS) {
return;
}
diff --git a/web/src/features/llm-api-key/types.ts b/web/src/features/llm-api-key/types.ts
index 973f155fe2..7a0caca40e 100644
--- a/web/src/features/llm-api-key/types.ts
+++ b/web/src/features/llm-api-key/types.ts
@@ -7,7 +7,7 @@ import {
LLMApiKeySchema,
} from "@langfuse/shared";
-export const LlmApiKeySchema = z.object({
+const LlmApiKeySchema = z.object({
projectId: z.string(),
provider: z
.string()
diff --git a/web/src/features/llm-schemas/validation.ts b/web/src/features/llm-schemas/validation.ts
index daccc9f779..a5955940ef 100644
--- a/web/src/features/llm-schemas/validation.ts
+++ b/web/src/features/llm-schemas/validation.ts
@@ -9,7 +9,7 @@ export const LLMSchemaNameSchema = z
)
.min(1, "Name is required");
-export const LLMSchemaInput = z.object({
+const LLMSchemaInput = z.object({
name: LLMSchemaNameSchema,
description: z.string(),
schema: LLMJSONSchema,
diff --git a/web/src/features/llm-tools/validation.ts b/web/src/features/llm-tools/validation.ts
index c9605e6193..b8074afa51 100644
--- a/web/src/features/llm-tools/validation.ts
+++ b/web/src/features/llm-tools/validation.ts
@@ -3,7 +3,7 @@ import { LLMJSONSchema, LLMToolNameSchema } from "@langfuse/shared";
export { LLMToolNameSchema } from "@langfuse/shared";
-export const LLMToolInput = z.object({
+const LLMToolInput = z.object({
name: LLMToolNameSchema,
description: z.string(),
parameters: LLMJSONSchema,
diff --git a/web/src/features/mcp/core/validation.ts b/web/src/features/mcp/core/validation.ts
index 2775d9b073..6f8ca39642 100644
--- a/web/src/features/mcp/core/validation.ts
+++ b/web/src/features/mcp/core/validation.ts
@@ -14,12 +14,6 @@
import { z } from "zod";
-/**
- * Project ID parameter
- * No format enforcement - validated via API key authentication
- */
-export const ParamProjectId = z.string().describe("The project ID");
-
/**
* Pagination limit parameter
* Defaults to 50, max 100
@@ -42,10 +36,3 @@ export const ParamPage = z.coerce
.min(1)
.default(1)
.describe("Page number for pagination (default: 1)");
-
-/**
- * Helper to extract schema description for MCP tool definitions
- */
-export function getSchemaDescription(schema: z.ZodType): string | undefined {
- return schema.description;
-}
diff --git a/web/src/features/mcp/features/annotationQueues/schema.ts b/web/src/features/mcp/features/annotationQueues/schema.ts
index c4d159e9fc..2faa04a3b9 100644
--- a/web/src/features/mcp/features/annotationQueues/schema.ts
+++ b/web/src/features/mcp/features/annotationQueues/schema.ts
@@ -26,39 +26,3 @@ export const DeleteAnnotationQueueAssignmentToolSchema =
AnnotationQueueAssignmentQuery.extend(
DeleteAnnotationQueueAssignmentBody.shape,
);
-
-export const annotationQueueToApi = (queue: {
- id: string;
- name: string;
- description: string | null;
- scoreConfigIds: string[];
- createdAt: Date;
- updatedAt: Date;
-}) => ({
- id: queue.id,
- name: queue.name,
- description: queue.description,
- scoreConfigIds: queue.scoreConfigIds,
- createdAt: queue.createdAt,
- updatedAt: queue.updatedAt,
-});
-
-export const annotationQueueItemToApi = (item: {
- id: string;
- queueId: string;
- objectId: string;
- objectType: "TRACE" | "OBSERVATION" | "SESSION";
- status: "PENDING" | "COMPLETED";
- completedAt: Date | null;
- createdAt: Date;
- updatedAt: Date;
-}) => ({
- id: item.id,
- queueId: item.queueId,
- objectId: item.objectId,
- objectType: item.objectType,
- status: item.status,
- completedAt: item.completedAt,
- createdAt: item.createdAt,
- updatedAt: item.updatedAt,
-});
diff --git a/web/src/features/mcp/features/datasets/schema.ts b/web/src/features/mcp/features/datasets/schema.ts
index 844d80b2eb..44e9d09546 100644
--- a/web/src/features/mcp/features/datasets/schema.ts
+++ b/web/src/features/mcp/features/datasets/schema.ts
@@ -1,5 +1,4 @@
import { z } from "zod";
-import { type JSONValue } from "@langfuse/shared";
import { publicApiIdSchema } from "@/src/features/public-api/types/datasets";
const paginationSchema = {
@@ -7,18 +6,6 @@ const paginationSchema = {
limit: z.number().int().positive().max(100).default(50),
};
-export const resolveMetadata = (
- metadata: JSONValue,
-): Record<string, unknown> => {
- if (Array.isArray(metadata)) {
- return { metadata };
- }
- if (typeof metadata === "object" && metadata !== null) {
- return metadata as Record<string, unknown>;
- }
- return { metadata };
-};
-
export const GetDatasetsMcpInput = z.object({
name: z.string().optional(),
...paginationSchema,
diff --git a/web/src/features/mcp/features/prompts/tools/createChatPrompt.ts b/web/src/features/mcp/features/prompts/tools/createChatPrompt.ts
index fff26a5b77..0561ce0289 100644
--- a/web/src/features/mcp/features/prompts/tools/createChatPrompt.ts
+++ b/web/src/features/mcp/features/prompts/tools/createChatPrompt.ts
@@ -28,7 +28,7 @@ import { ParamCreatePromptLabels } from "../validation";
* defineTool). The runtime input schema below enforces the actual message
* shape ({role, content} or {type: 'placeholder', name}).
*/
-export const ChatMessageBaseSchema = z.object({
+const ChatMessageBaseSchema = z.object({
type: z
.enum(["message", "placeholder"])
.optional()
diff --git a/web/src/features/mcp/features/prompts/tools/promptReadToolFactory.ts b/web/src/features/mcp/features/prompts/tools/promptReadToolFactory.ts
index d7f53dcf69..1a55c5d07c 100644
--- a/web/src/features/mcp/features/prompts/tools/promptReadToolFactory.ts
+++ b/web/src/features/mcp/features/prompts/tools/promptReadToolFactory.ts
@@ -13,13 +13,13 @@ import {
ParamPromptVersion,
} from "../validation";
-export const PromptReadBaseSchema = z.object({
+const PromptReadBaseSchema = z.object({
name: ParamPromptName,
label: ParamPromptLabel,
version: ParamPromptVersion,
});
-export const PromptReadInputSchema = PromptReadBaseSchema.refine(
+const PromptReadInputSchema = PromptReadBaseSchema.refine(
(data) => !(data.label && data.version),
{
message:
diff --git a/web/src/features/mcp/features/prompts/validation.ts b/web/src/features/mcp/features/prompts/validation.ts
index 6679281fd8..125457b6a1 100644
--- a/web/src/features/mcp/features/prompts/validation.ts
+++ b/web/src/features/mcp/features/prompts/validation.ts
@@ -11,7 +11,6 @@ import {
PROMPT_LABEL_MAX_LENGTH,
PROMPT_LABEL_REGEX,
PROMPT_LABEL_REGEX_ERROR,
- COMMIT_MESSAGE_MAX_LENGTH,
LATEST_PROMPT_LABEL,
PRODUCTION_LABEL,
PromptLabelSchema,
@@ -61,16 +60,6 @@ export const ParamPromptTag = z
.optional()
.describe("Tag to filter prompts (e.g., 'v1', 'experimental')");
-/**
- * Commit message parameter (optional)
- * Used when creating new prompt versions
- */
-export const ParamCommitMessage = z
- .string()
- .max(COMMIT_MESSAGE_MAX_LENGTH)
- .optional()
- .describe("Optional commit message describing the changes");
-
/**
* Labels allowed while creating a new prompt version.
*/
diff --git a/web/src/features/mcp/features/scores/schema.ts b/web/src/features/mcp/features/scores/schema.ts
index 3978bbd64c..4c444a46fd 100644
--- a/web/src/features/mcp/features/scores/schema.ts
+++ b/web/src/features/mcp/features/scores/schema.ts
@@ -71,6 +71,5 @@ export {
McpScoreConfigNameSchema,
McpScoreConfigNumericMaxValueSchema,
McpScoreConfigNumericMinValueSchema,
- normalizeMcpScoreConfigInput,
preprocessMcpScoreConfigInput,
};
diff --git a/web/src/features/media/validation.ts b/web/src/features/media/validation.ts
index 2a6aa5fb3d..66e6851687 100644
--- a/web/src/features/media/validation.ts
+++ b/web/src/features/media/validation.ts
@@ -1,12 +1,8 @@
import { z } from "zod";
-import {
- datasetItemMediaFields,
- MediaContentType,
- MediaFileExtension,
-} from "@langfuse/shared";
+import { datasetItemMediaFields, MediaContentType } from "@langfuse/shared";
-export { MediaContentType, MediaFileExtension };
+export { MediaContentType };
export enum MediaEnabledFields {
Input = "input",
@@ -103,7 +99,8 @@ export const GetMediaResponseSchema = z.object({
export type GetMediaResponse = z.infer<typeof GetMediaResponseSchema>;
-export const MediaReturnSchema = z.object({
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const MediaReturnSchema = z.object({
mediaId: z.string(),
contentType: z.enum(MediaContentType),
contentLength: z.coerce.number(),
diff --git a/web/src/features/models/hooks/usePriceUnitMultiplier.ts b/web/src/features/models/hooks/usePriceUnitMultiplier.ts
index a05f26bd70..2a6c064457 100644
--- a/web/src/features/models/hooks/usePriceUnitMultiplier.ts
+++ b/web/src/features/models/hooks/usePriceUnitMultiplier.ts
@@ -3,7 +3,7 @@ import { useMemo } from "react";
import useLocalStorage from "@/src/components/useLocalStorage";
import { PriceUnit } from "@/src/features/models/validation";
-export const multiplierMap: Record<PriceUnit, number> = {
+const multiplierMap: Record<PriceUnit, number> = {
[PriceUnit.PerUnit]: 1,
[PriceUnit.Per1KUnits]: 1e3,
[PriceUnit.Per1MUnits]: 1e6,
diff --git a/web/src/features/models/validation.ts b/web/src/features/models/validation.ts
index ca5af9e0e1..fd4afc4ded 100644
--- a/web/src/features/models/validation.ts
+++ b/web/src/features/models/validation.ts
@@ -10,21 +10,21 @@ import {
} from "@langfuse/shared";
const USAGE_TYPE_PATTERN = /^[a-zA-Z0-9_-]+$/;
-export const UsageTypeSchema = z.string().regex(USAGE_TYPE_PATTERN);
-export const PriceSchema = z.number().nonnegative();
-export const TokenizerSchema = z.enum(["openai", "claude"]).nullish();
+const UsageTypeSchema = z.string().regex(USAGE_TYPE_PATTERN);
+const PriceSchema = z.number().nonnegative();
+const TokenizerSchema = z.enum(["openai", "claude"]).nullish();
// Input version: allows optional prices for form
const PriceMapInputSchema = z.record(UsageTypeSchema, PriceSchema.optional());
// Output version: filtered to only defined prices. A price of 0 is a real,
// deliberate price — dropping it deleted the usage type on the next save.
-export const PriceMapSchema = PriceMapInputSchema.transform((obj) => {
+const PriceMapSchema = PriceMapInputSchema.transform((obj) => {
return Object.fromEntries(
Object.entries(obj).filter(([_, value]) => value != null),
) as Record<string, number>;
}).pipe(z.record(UsageTypeSchema, PriceSchema));
-export const PricingTierSchema = z.object({
+const PricingTierSchema = z.object({
id: z.string(),
name: z.string(),
isDefault: z.boolean(),
@@ -58,7 +58,7 @@ export type FormUsageType = z.infer<typeof FormUsageTypeSchema>;
// Form-level tier schema. Prices are keyed by usage type row key and held as
// strings, so a half-typed "0." or "0.0000025" survives every keystroke.
-export const FormPricingTierSchema = z.object({
+const FormPricingTierSchema = z.object({
name: z.string().trim().min(1, "Tier name is required"),
isDefault: z.boolean(),
conditions: z.array(PricingTierConditionSchema),
diff --git a/web/src/features/onboarding/server/onboardingService.ts b/web/src/features/onboarding/server/onboardingService.ts
index 955a520b65..20f4434097 100644
--- a/web/src/features/onboarding/server/onboardingService.ts
+++ b/web/src/features/onboarding/server/onboardingService.ts
@@ -210,7 +210,7 @@ export const resolveOnboardingRedirectTarget = async ({
return null;
};
-export const resolveOnboardingRedirectTargetWithFallback = async ({
+const resolveOnboardingRedirectTargetWithFallback = async ({
prisma,
userId,
canCreateOrganizations,
diff --git a/web/src/features/organizations/hooks.ts b/web/src/features/organizations/hooks.ts
index 1cefb836d7..b69800fc95 100644
--- a/web/src/features/organizations/hooks.ts
+++ b/web/src/features/organizations/hooks.ts
@@ -14,7 +14,7 @@ export const useQueryOrganization = () => {
);
};
-export const useOrganization = (organizationId: string | null) => {
+const useOrganization = (organizationId: string | null) => {
const session = useSession();
const isAdmin = session.data?.user?.admin === true;
diff --git a/web/src/features/playground/page/components/SaveToPromptButton.tsx b/web/src/features/playground/page/components/SaveToPromptButton.tsx
index 4e59209cad..27beaf3870 100644
--- a/web/src/features/playground/page/components/SaveToPromptButton.tsx
+++ b/web/src/features/playground/page/components/SaveToPromptButton.tsx
@@ -184,7 +184,7 @@ export const SaveToPromptButton: React.FC<SaveToPromptButtonProps> = ({
);
};
-export function Divider() {
+function Divider() {
return (
<div className="my-3 flex flex-row justify-center align-middle">
<div className="flex flex-1 flex-col">
diff --git a/web/src/features/playground/page/hooks/useWindowCoordination.ts b/web/src/features/playground/page/hooks/useWindowCoordination.ts
index f91ffab369..3d928c87b0 100644
--- a/web/src/features/playground/page/hooks/useWindowCoordination.ts
+++ b/web/src/features/playground/page/hooks/useWindowCoordination.ts
@@ -262,19 +262,6 @@ export const useWindowCoordination = (): WindowCoordinationReturn => {
};
};
-/**
- * Utility function to get the current playground window registry
- * Useful for debugging and testing purposes
- *
- * @returns Map of windowId to PlaygroundHandle
- */
-export const getPlaygroundWindowRegistry = (): Map<
- string,
- PlaygroundHandle
-> => {
- return playgroundWindowRegistry;
-};
-
/**
* Utility function to get the playground event bus
* Useful for advanced coordination scenarios and testing
@@ -284,13 +271,3 @@ export const getPlaygroundWindowRegistry = (): Map<
export const getPlaygroundEventBus = (): EventTarget => {
return playgroundEventBus;
};
-
-/**
- * Utility function to get the current window count
- * Useful for UI components that need to display window statistics
- *
- * @returns Number of currently registered windows
- */
-export const getWindowCount = (): number => {
- return playgroundWindowRegistry.size;
-};
diff --git a/web/src/features/playground/page/storage/windowStorage.ts b/web/src/features/playground/page/storage/windowStorage.ts
index 661607fe32..ec8f106204 100644
--- a/web/src/features/playground/page/storage/windowStorage.ts
+++ b/web/src/features/playground/page/storage/windowStorage.ts
@@ -39,7 +39,7 @@ export const saveWindowIds = (ids: string[]): void => {
* @param windowId - The ID of the window.
* @returns The cached state or null if not found.
*/
-export const getWindowState = (windowId: string): PlaygroundCache | null => {
+const getWindowState = (windowId: string): PlaygroundCache | null => {
const key = getCacheKey(windowId);
const cachedState = sessionStorage.getItem(key);
if (!cachedState) return null;
diff --git a/web/src/features/playground/server/validateChatCompletionBody.ts b/web/src/features/playground/server/validateChatCompletionBody.ts
index 1e15467428..16e72e11da 100644
--- a/web/src/features/playground/server/validateChatCompletionBody.ts
+++ b/web/src/features/playground/server/validateChatCompletionBody.ts
@@ -18,7 +18,7 @@ const ModelParamsSchema = z.object({
providerOptions: JSONObjectSchema.optional(),
});
-export const ChatCompletionBodySchema = z.object({
+const ChatCompletionBodySchema = z.object({
projectId: z.string(),
messages: z.array(ChatMessageSchema),
modelParams: ModelParamsSchema,
diff --git a/web/src/features/posthog-analytics/usePostHogClientCapture.ts b/web/src/features/posthog-analytics/usePostHogClientCapture.ts
index 4d5bdc5d92..0f345412bd 100644
--- a/web/src/features/posthog-analytics/usePostHogClientCapture.ts
+++ b/web/src/features/posthog-analytics/usePostHogClientCapture.ts
@@ -5,9 +5,8 @@ import { useCallback } from "react";
export const V4_BETA_ENABLED_POSTHOG_PROPERTY = "v4BetaEnabled";
// resource:action, only use snake_case
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
-export const events = {
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const events = {
table: [
"filter_builder_open",
"filter_builder_close",
diff --git a/web/src/features/public-api/hooks/useLangfuseEnvCode.ts b/web/src/features/public-api/hooks/useLangfuseEnvCode.ts
index 27698c2e9d..edce86b69c 100644
--- a/web/src/features/public-api/hooks/useLangfuseEnvCode.ts
+++ b/web/src/features/public-api/hooks/useLangfuseEnvCode.ts
@@ -6,7 +6,7 @@ type LangfuseKeys = {
publicKey: string;
};
-export function getLangfuseBaseUrl(baseUrl: string): string {
+function getLangfuseBaseUrl(baseUrl: string): string {
return `${baseUrl}${env.NEXT_PUBLIC_BASE_PATH ?? ""}`;
}
diff --git a/web/src/features/public-api/server/RateLimitService.ts b/web/src/features/public-api/server/RateLimitService.ts
index a3b330f0c9..ad14555f3e 100644
--- a/web/src/features/public-api/server/RateLimitService.ts
+++ b/web/src/features/public-api/server/RateLimitService.ts
@@ -180,7 +180,7 @@ export class RateLimitService {
}
}
-export class RateLimitHelper {
+class RateLimitHelper {
res: RateLimitResult | undefined;
constructor(res: RateLimitResult | undefined) {
diff --git a/web/src/features/public-api/server/withMiddlewares.ts b/web/src/features/public-api/server/withMiddlewares.ts
index 4d769a410d..9804e63af0 100644
--- a/web/src/features/public-api/server/withMiddlewares.ts
+++ b/web/src/features/public-api/server/withMiddlewares.ts
@@ -24,9 +24,8 @@ import {
} from "@/src/features/public-api/server/unstable-public-api-error-contract";
import { clickHouseRouteForRequest } from "@/src/features/public-api/server/clickHouseRequestTags";
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
-export const httpMethods = ["GET", "POST", "PUT", "DELETE", "PATCH"] as const;
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const httpMethods = ["GET", "POST", "PUT", "DELETE", "PATCH"] as const;
export type HttpMethod = (typeof httpMethods)[number];
type Handlers = {
[Method in HttpMethod]?: (
diff --git a/web/src/features/public-api/shared/unstable-public-api-error-schema.ts b/web/src/features/public-api/shared/unstable-public-api-error-schema.ts
index 21e7f3542f..056aab0cf8 100644
--- a/web/src/features/public-api/shared/unstable-public-api-error-schema.ts
+++ b/web/src/features/public-api/shared/unstable-public-api-error-schema.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-export const unstablePublicApiErrorCodes = [
+const unstablePublicApiErrorCodes = [
"authentication_failed",
"access_denied",
"invalid_request",
@@ -22,7 +22,7 @@ export const unstablePublicApiErrorCodes = [
"internal_error",
] as const;
-export const UnstablePublicApiErrorCode = z.enum(unstablePublicApiErrorCodes);
+const UnstablePublicApiErrorCode = z.enum(unstablePublicApiErrorCodes);
const UnstablePublicApiValidationIssue = z
.object({
@@ -32,7 +32,7 @@ const UnstablePublicApiValidationIssue = z
})
.loose();
-export const UnstablePublicApiErrorDetails = z
+const UnstablePublicApiErrorDetails = z
.object({
issues: z.array(UnstablePublicApiValidationIssue).optional(),
field: z.string().optional(),
diff --git a/web/src/features/public-api/types/annotation-queues.ts b/web/src/features/public-api/types/annotation-queues.ts
index 0b64e5f96e..d7ff5b1761 100644
--- a/web/src/features/public-api/types/annotation-queues.ts
+++ b/web/src/features/public-api/types/annotation-queues.ts
@@ -10,7 +10,7 @@ import {
* Common Types
*/
-export const AnnotationQueueItemSchema = z
+const AnnotationQueueItemSchema = z
.object({
id: z.string(),
queueId: z.string(),
@@ -23,7 +23,7 @@ export const AnnotationQueueItemSchema = z
})
.strict();
-export const AnnotationQueueSchema = z
+const AnnotationQueueSchema = z
.object({
id: z.string(),
name: z.string(),
@@ -145,7 +145,7 @@ export const DeleteAnnotationQueueItemResponse = z
.strict();
// Assignment endpoints
-export const AnnotationQueueAssignmentSchema = z
+const AnnotationQueueAssignmentSchema = z
.object({
userId: z.string(),
projectId: z.string(),
diff --git a/web/src/features/public-api/types/blob-storage-integrations.ts b/web/src/features/public-api/types/blob-storage-integrations.ts
index 040505c459..3dccb10eff 100644
--- a/web/src/features/public-api/types/blob-storage-integrations.ts
+++ b/web/src/features/public-api/types/blob-storage-integrations.ts
@@ -14,13 +14,13 @@ import {
* Enums
*/
-export const BlobStorageIntegrationType = z.enum([
+const BlobStorageIntegrationType = z.enum([
"S3",
"S3_COMPATIBLE",
"AZURE_BLOB_STORAGE",
]);
-export const BlobStorageIntegrationFileType = z.enum([
+const BlobStorageIntegrationFileType = z.enum([
"JSON",
"CSV",
"JSONL",
@@ -29,14 +29,14 @@ export const BlobStorageIntegrationFileType = z.enum([
// Kept as a separate export for the response type. Now identical to the request
// enum since Parquet is generally available and settable via the API.
-export const BlobStorageIntegrationFileTypeResponse = z.enum([
+const BlobStorageIntegrationFileTypeResponse = z.enum([
"JSON",
"CSV",
"JSONL",
"PARQUET",
]);
-export const BlobStorageExportMode = z.enum([
+const BlobStorageExportMode = z.enum([
"FULL_HISTORY",
"FROM_TODAY",
"FROM_CUSTOM_DATE",
@@ -87,9 +87,7 @@ export const toPublicExportSource = (
): z.infer<typeof BlobStorageExportSource> =>
INTERNAL_TO_PUBLIC_EXPORT_SOURCE[internalValue];
-export const BlobStorageExportFieldGroup = z.enum(
- OBSERVATION_FIELD_GROUPS_FULL,
-);
+const BlobStorageExportFieldGroup = z.enum(OBSERVATION_FIELD_GROUPS_FULL);
/**
* Request/Response Types
@@ -160,7 +158,8 @@ export const CreateBlobStorageIntegrationRequest = z
}
});
-export const BlobStorageIntegrationResponse = z
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const BlobStorageIntegrationResponse = z
.object({
id: z.string(),
projectId: z.string(),
@@ -192,7 +191,7 @@ export type BlobStorageIntegrationResponseType = z.infer<
typeof BlobStorageIntegrationResponse
>;
-export const BlobStorageSyncStatus = z.enum([
+const BlobStorageSyncStatus = z.enum([
"idle",
"running",
"queued",
@@ -201,7 +200,8 @@ export const BlobStorageSyncStatus = z.enum([
"error",
]);
-export const BlobStorageIntegrationStatusResponse = z
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const BlobStorageIntegrationStatusResponse = z
.object({
id: z.string(),
projectId: z.string(),
diff --git a/web/src/features/public-api/types/feedback.ts b/web/src/features/public-api/types/feedback.ts
index 0e79ca9dba..decb812247 100644
--- a/web/src/features/public-api/types/feedback.ts
+++ b/web/src/features/public-api/types/feedback.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-export const FeedbackTargetType = z.enum([
+const FeedbackTargetType = z.enum([
"skill",
"mcp-tool",
"cli",
diff --git a/web/src/features/public-api/types/metrics.ts b/web/src/features/public-api/types/metrics.ts
index cf23d54088..f4e9c97fa2 100644
--- a/web/src/features/public-api/types/metrics.ts
+++ b/web/src/features/public-api/types/metrics.ts
@@ -28,7 +28,7 @@ export const publicGranularities = granularities.extract([
/**
* Query Object Structure
*/
-export const MetricsQueryObject = z
+const MetricsQueryObject = z
.object({
// Pagination parameters
// page: z.number().min(1).default(1),
diff --git a/web/src/features/public-api/types/observations.ts b/web/src/features/public-api/types/observations.ts
index 16778feefa..68f611f54b 100644
--- a/web/src/features/public-api/types/observations.ts
+++ b/web/src/features/public-api/types/observations.ts
@@ -23,10 +23,7 @@ import { z } from "zod";
import { useEventsTableSchema } from "@langfuse/shared/query";
// Re-export for convenience
-export {
- OBSERVATION_FIELD_GROUPS_PUBLIC_API,
- type ObservationFieldGroupPublicApi,
-};
+export { type ObservationFieldGroupPublicApi };
/**
* Objects
@@ -258,7 +255,7 @@ export const GetObservationV1Response = APIObservation.extend({
* Encodes the position in the result set using the table's ordering:
* (start_time, xxHash32(trace_id), span_id)
*/
-export const ObservationsCursorV2 = z.object({
+const ObservationsCursorV2 = z.object({
lastStartTimeTo: z.coerce.date(),
lastTraceId: z.string(),
lastId: z.string(),
diff --git a/web/src/features/public-api/types/scores.ts b/web/src/features/public-api/types/scores.ts
index 3540c2034b..d0bbcf3af2 100644
--- a/web/src/features/public-api/types/scores.ts
+++ b/web/src/features/public-api/types/scores.ts
@@ -1,5 +1,4 @@
export {
- ScoresCursorV3,
EncodedScoresCursorV3,
encodeCursorV3,
} from "@langfuse/shared/src/server";
diff --git a/web/src/features/public-api/types/unstable-dashboard-widgets.ts b/web/src/features/public-api/types/unstable-dashboard-widgets.ts
index 0726ce6222..ab42699d49 100644
--- a/web/src/features/public-api/types/unstable-dashboard-widgets.ts
+++ b/web/src/features/public-api/types/unstable-dashboard-widgets.ts
@@ -15,7 +15,7 @@ export const PostUnstableDashboardWidgetView = z.enum([
"scores-categorical",
]);
-export const DashboardWidgetViewOutput = z.enum([
+const DashboardWidgetViewOutput = z.enum([
"observations",
"scores-numeric",
"scores-boolean",
@@ -57,7 +57,7 @@ export const PostUnstableDashboardWidgetBody =
description: z.string().default(""),
});
-export const PublicDashboardWidget = z
+const PublicDashboardWidget = z
.object({
id: z.string(),
createdAt: z.coerce.date(),
diff --git a/web/src/features/public-api/types/unstable-dashboards.ts b/web/src/features/public-api/types/unstable-dashboards.ts
index 4530a4a349..954e646eb2 100644
--- a/web/src/features/public-api/types/unstable-dashboards.ts
+++ b/web/src/features/public-api/types/unstable-dashboards.ts
@@ -15,7 +15,7 @@ const placementPosition = {
width: z.number().int().positive(),
height: z.number().int().positive(),
};
-export const PublicWidgetPlacementSchema = z
+const PublicWidgetPlacementSchema = z
.object({
type: z.literal("widget"),
id: z.string(),
@@ -23,7 +23,7 @@ export const PublicWidgetPlacementSchema = z
...placementPosition,
})
.strict();
-export const PublicPresetPlacementSchema = z
+const PublicPresetPlacementSchema = z
.object({
type: z.literal("preset"),
id: z.string(),
@@ -35,7 +35,7 @@ export const DashboardPlacementSchema = z.discriminatedUnion("type", [
PublicWidgetPlacementSchema,
PublicPresetPlacementSchema,
]);
-export const PublicDashboardDefinitionSchema = z
+const PublicDashboardDefinitionSchema = z
.object({
widgets: z.array(DashboardPlacementSchema),
})
diff --git a/web/src/features/public-api/types/unstable-evaluation-rules.ts b/web/src/features/public-api/types/unstable-evaluation-rules.ts
index 298f6a500a..22bf83b6a8 100644
--- a/web/src/features/public-api/types/unstable-evaluation-rules.ts
+++ b/web/src/features/public-api/types/unstable-evaluation-rules.ts
@@ -33,7 +33,7 @@ const APIEvaluationRuleBase = {
updatedAt: z.coerce.date(),
};
-export const APIEvaluationRule = z
+const APIEvaluationRule = z
.object({
...APIEvaluationRuleBase,
evaluators: z.array(
@@ -48,7 +48,7 @@ export const APIEvaluationRule = z
})
.strict();
-export const APILegacyEvaluationRule = z
+const APILegacyEvaluationRule = z
.object({
...APIEvaluationRuleBase,
evaluators: z.array(
@@ -65,7 +65,7 @@ export const APILegacyEvaluationRule = z
})
.strict();
-export const APIReadableEvaluationRule = z.union([
+const APIReadableEvaluationRule = z.union([
APIEvaluationRule,
APILegacyEvaluationRule,
]);
@@ -86,7 +86,7 @@ export const GetUnstableEvaluationRuleQuery = z.object({
/** @alias */
export const GetUnstableEvaluationRuleResponse = APIReadableEvaluationRule;
-export const EvaluationRuleCreateBase = {
+const EvaluationRuleCreateBase = {
name: z.string().min(1),
evaluator: PublicEvaluationRuleEvaluatorReference.optional(),
enabled: z.boolean(),
@@ -168,7 +168,7 @@ export const PatchUnstableEvaluationRuleQuery = GetUnstableEvaluationRuleQuery;
// Exported for reuse (see EvaluationRuleCreateBase) — the create fields, all
// made optional for PATCH.
-export const EvaluationRulePatchBase = {
+const EvaluationRulePatchBase = {
name: z.string().min(1).optional(),
evaluator: PublicEvaluationRuleEvaluatorReferencePatch.optional(),
enabled: z.boolean().optional(),
diff --git a/web/src/features/public-api/types/unstable-evaluators.ts b/web/src/features/public-api/types/unstable-evaluators.ts
index 3c297bbf16..3ea2076a36 100644
--- a/web/src/features/public-api/types/unstable-evaluators.ts
+++ b/web/src/features/public-api/types/unstable-evaluators.ts
@@ -27,21 +27,21 @@ const APIEvaluatorBase = z
})
.strict();
-export const APILlmAsJudgeEvaluator = APIEvaluatorBase.extend({
+const APILlmAsJudgeEvaluator = APIEvaluatorBase.extend({
type: z.literal(PUBLIC_EVALUATOR_TYPE_LLM_AS_JUDGE),
prompt: z.string(),
outputDefinition: PublicEvaluatorOutputDefinition,
modelConfig: PublicEvaluatorModelConfig.nullable(),
}).strict();
-export const APICodeEvaluator = APIEvaluatorBase.extend({
+const APICodeEvaluator = APIEvaluatorBase.extend({
type: z.literal(PUBLIC_EVALUATOR_TYPE_CODE),
sourceCode: z.string().min(1),
sourceCodeLanguage:
PublicCodeEvaluatorDefinitionInput.shape.sourceCodeLanguage,
}).strict();
-export const APIEvaluator = z.discriminatedUnion("type", [
+const APIEvaluator = z.discriminatedUnion("type", [
APILlmAsJudgeEvaluator,
APICodeEvaluator,
]);
@@ -73,7 +73,7 @@ export const DeleteUnstableEvaluatorResponse = z
// Fields shared by every create body, regardless of evaluator type. Exported so
// non-route consumers (e.g. the MCP tool layer) reuse the same definition.
-export const EvaluatorCreateBase = {
+const EvaluatorCreateBase = {
name: z.string().min(1),
};
diff --git a/web/src/features/public-api/types/unstable-public-evals-contract.ts b/web/src/features/public-api/types/unstable-public-evals-contract.ts
index 74d191b968..ce26632e84 100644
--- a/web/src/features/public-api/types/unstable-public-evals-contract.ts
+++ b/web/src/features/public-api/types/unstable-public-evals-contract.ts
@@ -16,36 +16,29 @@ import {
} from "@langfuse/shared";
import { CODE_EVAL_SOURCE_MAX_BYTES } from "@langfuse/shared/src/server";
import { z } from "zod";
-export {
- UnstablePublicApiErrorCode,
- UnstablePublicApiErrorDetails,
- UnstablePublicApiErrorResponse,
-} from "@/src/features/public-api/shared/unstable-public-api-error-schema";
+export { UnstablePublicApiErrorResponse } from "@/src/features/public-api/shared/unstable-public-api-error-schema";
import type {
UnstablePublicApiErrorCodeType,
UnstablePublicApiErrorDetailsType,
} from "@/src/features/public-api/shared/unstable-public-api-error-schema";
-export const PUBLIC_EVALUATOR_TYPES = ["llm_as_judge", "code"] as const;
+const PUBLIC_EVALUATOR_TYPES = ["llm_as_judge", "code"] as const;
export const [PUBLIC_EVALUATOR_TYPE_LLM_AS_JUDGE, PUBLIC_EVALUATOR_TYPE_CODE] =
PUBLIC_EVALUATOR_TYPES;
export const PublicEvaluatorType = z.enum(PUBLIC_EVALUATOR_TYPES);
-export const PublicCodeEvaluatorSourceCodeLanguage = z.enum([
- "PYTHON",
- "TYPESCRIPT",
-]);
+const PublicCodeEvaluatorSourceCodeLanguage = z.enum(["PYTHON", "TYPESCRIPT"]);
export const PublicEvaluatorModelConfig = z.object({
provider: z.string().min(1),
model: z.string().min(1),
});
-export const PublicEvaluatorOutputFieldDefinition = z.object({
+const PublicEvaluatorOutputFieldDefinition = z.object({
description: z.string().trim().min(1),
});
-export const PublicNumericEvaluatorOutputScoreDefinition =
+const PublicNumericEvaluatorOutputScoreDefinition =
PublicEvaluatorOutputFieldDefinition.extend({
minValue: z.number().optional(),
maxValue: z.number().optional(),
@@ -57,25 +50,25 @@ export const PublicNumericEvaluatorOutputScoreDefinition =
},
);
-export const PublicNumericEvaluatorOutputDefinition = z.object({
+const PublicNumericEvaluatorOutputDefinition = z.object({
dataType: z.literal("NUMERIC"),
reasoning: PublicEvaluatorOutputFieldDefinition,
score: PublicNumericEvaluatorOutputScoreDefinition,
});
-export const PublicBooleanEvaluatorOutputDefinition = z.object({
+const PublicBooleanEvaluatorOutputDefinition = z.object({
dataType: z.literal("BOOLEAN"),
reasoning: PublicEvaluatorOutputFieldDefinition,
score: PublicEvaluatorOutputFieldDefinition,
});
-export const PublicCategoricalEvaluatorOutputScoreDefinition = z.object({
+const PublicCategoricalEvaluatorOutputScoreDefinition = z.object({
description: z.string().trim().min(1),
categories: z.array(z.string().trim().min(1)).min(2),
shouldAllowMultipleMatches: z.boolean(),
});
-export const PublicCategoricalEvaluatorOutputDefinition = z.object({
+const PublicCategoricalEvaluatorOutputDefinition = z.object({
dataType: z.literal("CATEGORICAL"),
reasoning: PublicEvaluatorOutputFieldDefinition,
score: PublicCategoricalEvaluatorOutputScoreDefinition,
@@ -92,7 +85,9 @@ export const PublicEvaluatorOutputDefinition = z.discriminatedUnion(
export const PublicEvaluationRuleTarget = z.enum(["observation", "experiment"]);
export const PublicEvaluationRuleLegacyTarget = z.enum(["trace", "dataset"]);
-export const PublicEvaluationRuleReadTarget = z.union([
+
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const PublicEvaluationRuleReadTarget = z.union([
PublicEvaluationRuleTarget,
PublicEvaluationRuleLegacyTarget,
]);
@@ -166,7 +161,8 @@ export const ExperimentEvaluationRuleMapping = createMappingSchema(
ExperimentEvaluationRuleMappingSource,
);
-export const PublicEvaluationRuleMapping = z.union([
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const PublicEvaluationRuleMapping = z.union([
ObservationEvaluationRuleMapping,
ExperimentEvaluationRuleMapping,
]);
diff --git a/web/src/features/rbac/constants/organizationAccessRights.ts b/web/src/features/rbac/constants/organizationAccessRights.ts
index 2b3f27b11c..8563263087 100644
--- a/web/src/features/rbac/constants/organizationAccessRights.ts
+++ b/web/src/features/rbac/constants/organizationAccessRights.ts
@@ -1,8 +1,7 @@
import { type Role } from "@langfuse/shared/src/db";
-// Exported to silence @typescript-eslint/no-unused-vars v8 warning
-// (used for type extraction via typeof, which is a legitimate pattern)
-export const organizationScopes = [
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const organizationScopes = [
"projects:create",
"projects:transfer_org",
"organization:CRUD_apiKeys",
diff --git a/web/src/features/score-analytics/components/ScoreAnalyticsProvider.tsx b/web/src/features/score-analytics/components/ScoreAnalyticsProvider.tsx
index b27034651d..ab54740995 100644
--- a/web/src/features/score-analytics/components/ScoreAnalyticsProvider.tsx
+++ b/web/src/features/score-analytics/components/ScoreAnalyticsProvider.tsx
@@ -249,25 +249,3 @@ export function useScoreAnalytics(): ScoreAnalyticsContextValue {
return context;
}
-
-// ============================================================================
-// Type Guards
-// ============================================================================
-
-/**
- * Type guard to check if colors are for two scores
- */
-export function isTwoScoreColors(
- colors: ScoreColors,
-): colors is TwoScoreColors {
- return "score1" in colors && "score2" in colors;
-}
-
-/**
- * Type guard to check if colors are for single score
- */
-export function isSingleScoreColors(
- colors: ScoreColors,
-): colors is SingleScoreColors {
- return "score" in colors && !("score1" in colors);
-}
diff --git a/web/src/features/score-analytics/lib/color-scales.ts b/web/src/features/score-analytics/lib/color-scales.ts
index c3bbe2cd65..9afc4d0c33 100644
--- a/web/src/features/score-analytics/lib/color-scales.ts
+++ b/web/src/features/score-analytics/lib/color-scales.ts
@@ -11,7 +11,8 @@ import chroma from "chroma-js";
* OKLCH base colors from global.css
* These are used for different charts when comparing multiple scores
*/
-export const HEATMAP_BASE_COLORS = {
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via typeof
+const HEATMAP_BASE_COLORS = {
chart1: { l: 66.2, c: 0.225, h: 25.9 }, // --color-1 (orange-ish)
chart2: { l: 60.4, c: 0.26, h: 302 }, // --color-2 (magenta-ish)
chart3: { l: 69.6, c: 0.165, h: 251 }, // --color-3 (blue-ish)
@@ -22,66 +23,6 @@ export const HEATMAP_BASE_COLORS = {
export type HeatmapColorVariant = keyof typeof HEATMAP_BASE_COLORS;
-/**
- * Generate a mono-color scale by varying lightness in OKLCH space
- * @param baseColor - The base color to vary
- * @param steps - Number of color steps to generate (default: 10)
- * @param minLightness - Minimum lightness value (0-100, default: 30)
- * @param maxLightness - Maximum lightness value (0-100, default: 95)
- * @returns Array of OKLCH color strings
- */
-export function generateMonoColorScale(
- baseColor: { l: number; c: number; h: number },
- steps = 10,
- minLightness = 30,
- maxLightness = 95,
-): string[] {
- const colors: string[] = [];
- const lightnessRange = maxLightness - minLightness;
-
- for (let i = 0; i < steps; i++) {
- // Linear interpolation of lightness (reversed: darker = higher values)
- const lightness = maxLightness - (lightnessRange * i) / (steps - 1);
- // Keep chroma and hue constant for mono-color
- colors.push(`oklch(${lightness}% ${baseColor.c} ${baseColor.h})`);
- }
-
- return colors;
-}
-
-/**
- * Get a color from a mono-color scale based on a value
- * @param value - The value to map to a color
- * @param min - The minimum value in the range
- * @param max - The maximum value in the range
- * @param variant - Which chart color variant to use (default: 'chart1')
- * @param steps - Number of color steps (default: 10)
- * @returns OKLCH color string
- */
-export function getColorFromMonoScale(
- value: number,
- min: number,
- max: number,
- variant: HeatmapColorVariant = "chart1",
- steps = 10,
-): string {
- const baseColor = HEATMAP_BASE_COLORS[variant];
- const scale = generateMonoColorScale(baseColor, steps);
-
- // Handle edge cases
- if (value <= min) return scale[0];
- if (value >= max) return scale[scale.length - 1];
- if (max === min) return scale[0];
-
- // Normalize value to [0, 1]
- const normalized = (value - min) / (max - min);
-
- // Map to color scale index
- const index = Math.floor(normalized * (scale.length - 1));
-
- return scale[index];
-}
-
/**
* Get contrasting text color (black or white) for an OKLCH background color
* Uses lightness threshold to determine contrast
@@ -97,78 +38,6 @@ export function getContrastColor(oklchColor: string): "black" | "white" {
return lightness > 60 ? "black" : "white";
}
-/**
- * Increase the chroma (saturation) of an OKLCH color for hover effects
- * @param oklchColor - OKLCH color string (e.g., "oklch(66.2% 0.08 240)")
- * @param chromaMultiplier - How much to multiply chroma by (default: 2.5)
- * @returns OKLCH color string with increased chroma
- */
-export function getHoverColor(
- oklchColor: string,
- chromaMultiplier = 2.5,
-): string {
- // Parse OKLCH color
- const match = oklchColor.match(
- /oklch\((\d+\.?\d*)%\s+(\d+\.?\d*)\s+(\d+\.?\d*)\)/,
- );
- if (!match) return oklchColor;
-
- const lightness = parseFloat(match[1]);
- const chroma = parseFloat(match[2]);
- const hue = parseFloat(match[3]);
-
- // Increase chroma for hover effect, but cap at reasonable max
- const newChroma = Math.min(chroma * chromaMultiplier, 0.37);
-
- return `oklch(${lightness}% ${newChroma} ${hue})`;
-}
-
-/**
- * Create a custom mono-color scale with specific lightness range
- * Useful for categorical data where you want to emphasize differences
- * @param variant - Which chart color variant to use
- * @param minLightness - Minimum lightness (0-100)
- * @param maxLightness - Maximum lightness (0-100)
- * @param steps - Number of steps
- */
-export function createCustomMonoScale(
- variant: HeatmapColorVariant,
- minLightness: number,
- maxLightness: number,
- steps: number,
-): string[] {
- const baseColor = HEATMAP_BASE_COLORS[variant];
- return generateMonoColorScale(baseColor, steps, minLightness, maxLightness);
-}
-
-/**
- * Get a color for diagonal cells in confusion matrix
- * Uses higher chroma for emphasis
- * @param value - The value to map to a color
- * @param min - The minimum value in the range
- * @param max - The maximum value in the range
- * @param variant - Which chart color variant to use
- */
-export function getDiagonalColor(
- value: number,
- min: number,
- max: number,
- variant: HeatmapColorVariant = "chart1",
-): string {
- const baseColor = HEATMAP_BASE_COLORS[variant];
-
- // Handle edge cases
- if (max === min) return `oklch(60% ${baseColor.c * 2} ${baseColor.h})`;
-
- // Normalize value to [0, 1]
- const normalized = (value - min) / (max - min);
-
- // Vary lightness from 80% to 40% (reversed: higher values = darker), with higher chroma for emphasis
- const lightness = 80 - normalized * 40;
-
- return `oklch(${lightness}% ${baseColor.c * 2} ${baseColor.h})`;
-}
-
/**
* =======================
* Chart Color Functions
@@ -200,73 +69,6 @@ export function getTwoScoreColors(): {
};
}
-/**
- * Get opacity values for bar chart hover states
- * @param isHovered - Whether the current bar is being hovered
- * @param hasActiveHover - Whether any bar is currently being hovered
- * @returns Opacity value (0-1)
- */
-export function getBarChartHoverOpacity(
- isHovered: boolean,
- hasActiveHover: boolean,
-): number {
- if (!hasActiveHover) {
- // No hover active - all bars at full opacity
- return 1;
- }
- if (isHovered) {
- // This bar is hovered - full opacity
- return 1;
- }
- // Another bar is hovered - dim this one
- return 0.3;
-}
-
-/**
- * Chart color configuration for Recharts ChartConfig
- * Single score variant
- */
-export function getSingleScoreChartConfig(metricKey: string, label?: string) {
- return {
- [metricKey]: {
- label: label,
- theme: {
- light: getSingleScoreColor(),
- dark: getSingleScoreColor(),
- },
- },
- };
-}
-
-/**
- * Chart color configuration for Recharts ChartConfig
- * Two score comparison variant
- */
-export function getTwoScoreChartConfig(
- score1Key: string,
- score2Key: string,
- score1Label?: string,
- score2Label?: string,
-) {
- const colors = getTwoScoreColors();
- return {
- [score1Key]: {
- label: score1Label,
- theme: {
- light: colors.score1,
- dark: colors.score1,
- },
- },
- [score2Key]: {
- label: score2Label,
- theme: {
- light: colors.score2,
- dark: colors.score2,
- },
- },
- };
-}
-
/**
* =======================
* Monochrome Color Scales for Score Analytics
@@ -281,7 +83,7 @@ export function getTwoScoreChartConfig(
* Score 2: Yellow (chart-2)
* These are the single source of truth for score colors
*/
-export const SCORE_BASE_COLORS = {
+const SCORE_BASE_COLORS = {
score1: "hsl(var(--chart-3))", // blue
score2: "hsl(var(--chart-2))", // yellow
} as const;
@@ -371,7 +173,7 @@ function mixColorsInOklab(
* @param maxPercentage - Maximum baseColor percentage (default: 1.0 = 100%)
* @returns Array of hex color strings
*/
-export function getMonochromeScale(
+function getMonochromeScale(
baseColor: string,
steps: number,
mixColor = "white",
@@ -527,7 +329,7 @@ export function getHeatmapCellColor(
* =======================
* Constants for special color mapping keys to avoid magic strings
*/
-export const COLOR_MAPPING_KEYS = {
+const COLOR_MAPPING_KEYS = {
SCORE1_NUMERIC: "__score1_numeric__",
SCORE2_NUMERIC: "__score2_numeric__",
SCORE2_TRUE: "__score2_True",
diff --git a/web/src/features/scores-chart-view/fns/scoreChartConfig.ts b/web/src/features/scores-chart-view/fns/scoreChartConfig.ts
index eda39f42a0..adbb4a8adc 100644
--- a/web/src/features/scores-chart-view/fns/scoreChartConfig.ts
+++ b/web/src/features/scores-chart-view/fns/scoreChartConfig.ts
@@ -55,7 +55,7 @@ export const getScoreMetric = (
* dimension list is per-view, see `getScoreDimensionsForDataset`), so
* `dataset` disambiguates which view's list to look in.
*/
-export const getScoreDimension = (
+const getScoreDimension = (
key: ScoreDimensionKey,
dataset: ScoreChartDataset,
isTimeSeries: boolean,
diff --git a/web/src/features/scores/lib/aggregateScores.ts b/web/src/features/scores/lib/aggregateScores.ts
index f37dbe4ed3..d2b7460ca7 100644
--- a/web/src/features/scores/lib/aggregateScores.ts
+++ b/web/src/features/scores/lib/aggregateScores.ts
@@ -65,7 +65,7 @@ export type ScoreToAggregate =
* Boolean scores are treated as categorical since they share the same
* aggregation logic (value counting vs numeric averaging).
*/
-export const resolveAggregateType = (
+const resolveAggregateType = (
dataType: ListableScoreDataType,
): "NUMERIC" | "CATEGORICAL" => {
return dataType === "NUMERIC" ? "NUMERIC" : "CATEGORICAL";
diff --git a/web/src/features/scores/lib/keyboardShortcuts.ts b/web/src/features/scores/lib/keyboardShortcuts.ts
index 4945c7292f..214c338045 100644
--- a/web/src/features/scores/lib/keyboardShortcuts.ts
+++ b/web/src/features/scores/lib/keyboardShortcuts.ts
@@ -117,16 +117,6 @@ export function isCompleteShortcut(event: KeyboardEvent): boolean {
return event.key === "Enter" && (event.metaKey || event.ctrlKey);
}
-/**
- * Best-effort "is this an Apple device" check, used only to render `⌘` vs `Ctrl`
- * in shortcut hints. Call from an effect (not during render) to avoid an SSR
- * hydration mismatch.
- */
-export function isAppleDevice(): boolean {
- if (typeof navigator === "undefined") return false;
- return navigator.userAgent.includes("Mac");
-}
-
/**
* True when a "hot" platform modifier key is held — reserve those for browser /
* app shortcuts (Cmd+K, Ctrl+S, …) and bail out of our printable-key shortcuts.
diff --git a/web/src/features/sdk-version/lib/sdkVersionCapabilities.ts b/web/src/features/sdk-version/lib/sdkVersionCapabilities.ts
index ee91908b35..544893e12d 100644
--- a/web/src/features/sdk-version/lib/sdkVersionCapabilities.ts
+++ b/web/src/features/sdk-version/lib/sdkVersionCapabilities.ts
@@ -93,16 +93,6 @@ export const getSdkVersionCapabilityStatus = (
return "supported";
};
-export const getSdkVersionCapabilityMinimum = (
- sdkName: SdkVersionInfo["language"],
- capability: SdkVersionCapability,
-): string | null => {
- const normalizedSdkName = normalizeIngestionSdkName(sdkName);
- return normalizedSdkName
- ? SDK_VERSION_CAPABILITIES[capability][normalizedSdkName].join(".")
- : null;
-};
-
export const getSdkVersionCapability = (
sdk: SdkVersionInfo | undefined,
capability: SdkVersionCapability,
diff --git a/web/src/features/search-bar/components/ComposerTokens.tsx b/web/src/features/search-bar/components/ComposerTokens.tsx
index 1131e79edc..1cf295842b 100644
--- a/web/src/features/search-bar/components/ComposerTokens.tsx
+++ b/web/src/features/search-bar/components/ComposerTokens.tsx
@@ -38,7 +38,7 @@ export const WORD_JOINER = "⁠";
// text caret to the inline box of the pill it sits in/next to, so taller pills
// produce a caret that towers over the text. py-0.5 keeps the chip readable
// while holding the Safari caret close to the text height.
-export const composerTokenVariants = cva("max-w-full", {
+const composerTokenVariants = cva("max-w-full", {
variants: {
kind: {
filter: "",
diff --git a/web/src/features/search-bar/lib/commit.ts b/web/src/features/search-bar/lib/commit.ts
index e7fdc636ee..d65d16a86f 100644
--- a/web/src/features/search-bar/lib/commit.ts
+++ b/web/src/features/search-bar/lib/commit.ts
@@ -104,7 +104,7 @@ export type SearchErrorReason =
* between-conditions OR, so we recurse through those; a `filter`'s within-field
* OR lives in `valueOp`, so we never descend into it.
*/
-export function queryUsesTopLevelOr(ast: ASTNode | null): boolean {
+function queryUsesTopLevelOr(ast: ASTNode | null): boolean {
if (ast === null) return false;
switch (ast.kind) {
case "or":
diff --git a/web/src/features/search-bar/lib/completions.ts b/web/src/features/search-bar/lib/completions.ts
index 2063e3e5d6..2cc41de194 100644
--- a/web/src/features/search-bar/lib/completions.ts
+++ b/web/src/features/search-bar/lib/completions.ts
@@ -121,18 +121,18 @@ export type CompletionPlan = {
autoHighlight?: boolean;
};
-export const SECTION_SUGGESTIONS = "Suggestions";
+const SECTION_SUGGESTIONS = "Suggestions";
export const SECTION_FIELDS = "Fields";
export const SECTION_MATCHING_FILTERS = "Matching filters";
export const SECTION_VALUES = "Observed values";
-export const SECTION_OPERATORS = "Operators";
-export const SECTION_PATTERNS = "Patterns";
+const SECTION_OPERATORS = "Operators";
+const SECTION_PATTERNS = "Patterns";
export const SECTION_RECENT = "Recent searches";
export const SECTION_MATCH_OPS = "Match operators";
export const SECTION_COMPARE_OPS = "Comparisons";
-export const SECTION_KEYS = "Observed keys";
-export const SECTION_SCORE_NAMES = "Score names";
-export const SECTION_SEARCH_IN = "Full-text search";
+const SECTION_KEYS = "Observed keys";
+const SECTION_SCORE_NAMES = "Score names";
+const SECTION_SEARCH_IN = "Full-text search";
const MAX_RECENTS_SHOWN = 5;
const MAX_PRESETS_SHOWN = 10;
diff --git a/web/src/features/search-bar/lib/fields.ts b/web/src/features/search-bar/lib/fields.ts
index d217d52361..46afd30552 100644
--- a/web/src/features/search-bar/lib/fields.ts
+++ b/web/src/features/search-bar/lib/fields.ts
@@ -191,7 +191,7 @@ export const FIELDS: FieldDef[] = [
{ id: "output", aliases: [], kind: "text", syncMode: "textSearch", label: "Output", description: "Observation output", nullable: true },
];
-export const METADATA_PREFIX = "metadata.";
+const METADATA_PREFIX = "metadata.";
// Score dot-paths. Lowercased prefixes accepted by the grammar; the
// canonical spellings are `scores.<name>` and `traceScores.<name>`.
@@ -201,7 +201,7 @@ const TRACE_SCORE_PREFIXES = ["tracescores.", "trace_scores.", "tracescore."];
// Pseudo-fields: not columns — `has:<field>` lowers to a null filter. (The
// former `content:` pseudo-field has been removed: a bare query now searches
// input + output by default, and `input:`/`output:` narrow to one column.)
-export const HAS_KEY = "has";
+const HAS_KEY = "has";
/** Langfuse score filter columns (filter by score NAME via key-value ops). */
export const SCORE_COLUMNS = {
@@ -382,13 +382,6 @@ export function isDanglingDotPrefix(
return registry.isDanglingDotPrefix(value);
}
-/** Fields that can be unset — the value domain of `has:` / `-has:`. */
-export function nullableFields(
- registry: FieldRegistry = EVENTS_FIELD_REGISTRY,
-): readonly FieldDef[] {
- return registry.nullableFields();
-}
-
// ---- operator validity ----
//
// One table consulted by the parser (span diagnostics), the validator (commit
@@ -535,7 +528,7 @@ export function negationIssue(
return null;
}
-export function refName(ref: FieldRef): string {
+function refName(ref: FieldRef): string {
switch (ref.type) {
case "field":
return ref.field.id;
diff --git a/web/src/features/search-bar/lib/langQ.ts b/web/src/features/search-bar/lib/langQ.ts
index 77fe8cb318..b920240b1c 100644
--- a/web/src/features/search-bar/lib/langQ.ts
+++ b/web/src/features/search-bar/lib/langQ.ts
@@ -28,8 +28,6 @@ import { NEEDS_QUOTES, quote, unquote } from "./quoting";
// Re-exported for back-compat: quoting primitives now live in the shared
// dependency-free `quoting.ts` (so `fields.ts` can use them too).
-export { NEEDS_QUOTES };
-
export type Diagnostic = {
from: number;
to: number;
@@ -880,7 +878,7 @@ const OP_SYMBOL: Partial<Record<CompareOp, string>> = {
"<=": "<=",
};
-export function serializeFilter(node: FilterNode): string {
+function serializeFilter(node: FilterNode): string {
// Prefer the user's typed key (alias/casing) — surgery fallbacks shouldn't
// canonicalize untouched filters.
const key = node.rawKey ?? node.key;
diff --git a/web/src/features/search-bar/lib/validate.ts b/web/src/features/search-bar/lib/validate.ts
index 5305309917..96b614153b 100644
--- a/web/src/features/search-bar/lib/validate.ts
+++ b/web/src/features/search-bar/lib/validate.ts
@@ -15,7 +15,7 @@ import { astToFilterState, type ScoreTypeContext } from "./adapter";
import { EVENTS_FIELD_REGISTRY, type FieldRegistry } from "./fields";
import { parse, type Diagnostic, type ParseResult } from "./langQ";
-export const MAX_QUERY_LENGTH = 2048;
+const MAX_QUERY_LENGTH = 2048;
function nodeSpan(node: ASTNode, textLength: number): Span {
if (node.kind === "and" || node.kind === "or") {
diff --git a/web/src/features/support-chat/formConstants.ts b/web/src/features/support-chat/formConstants.ts
index a431f60a2b..68789573ae 100644
--- a/web/src/features/support-chat/formConstants.ts
+++ b/web/src/features/support-chat/formConstants.ts
@@ -6,7 +6,8 @@ export const MessageTypeSchema = z.enum(["Question", "Feedback", "Bug"]);
export type MessageType = z.infer<typeof MessageTypeSchema>;
/** ── Form Sections (for your stepper/wizard) ─────────────────────────────── */
-export const FormSectionSchema = z.enum(["intro", "form", "success"]);
+// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Used via z.infer
+const FormSectionSchema = z.enum(["intro", "form", "success"]);
export type FormSection = z.infer<typeof FormSectionSchema>;
/** ── Topics (grouped + flattened) ────────────────────────────────────────── */
@@ -31,7 +32,7 @@ export const TopicGroups = {
export type TopicGroup = keyof typeof TopicGroups;
-export const ALL_TOPICS = [
+const ALL_TOPICS = [
...TopicGroups.Operations,
...TopicGroups["Product Features"],
] as const;
@@ -60,7 +61,7 @@ export const SEVERITY_3 = SeveritySchema.options[2];
* requests — Enterprise only. All other plans (and free/unknown plans) are
* limited to Severity 3. Mirrors the check in `mapToPylonCaseSeverity`.
*/
-export const ENTERPRISE_SUPPORT_PLANS = [
+const ENTERPRISE_SUPPORT_PLANS = [
"cloud:enterprise",
"self-hosted:enterprise",
] as const;
@@ -74,10 +75,7 @@ export const isEnterpriseSupportPlan = (plan?: string): boolean =>
* field is omitted from the issue instead of defaulting to Sev-3. See
* `mapToPylonCaseSeverity`.
*/
-export const NO_CASE_SEVERITY_SUPPORT_PLANS = [
- "cloud:hobby",
- "cloud:core",
-] as const;
+const NO_CASE_SEVERITY_SUPPORT_PLANS = ["cloud:hobby", "cloud:core"] as const;
/** Whether support requests from the given plan carry no case severity. */
export const isPlanWithoutCaseSeverity = (plan?: string): boolean =>
@@ -98,7 +96,7 @@ export const isSeverityAllowedForPlan = (
return true; // Severity 3 is always available
};
-export const IntegrationTypeSchema = z.enum([
+const IntegrationTypeSchema = z.enum([
"Python SDK",
"TypeScript SDK",
"Other SDK",
@@ -130,6 +128,5 @@ export const SupportFormSchema = z.object({
export type SupportFormValues = z.infer<typeof SupportFormSchema>;
export const MESSAGE_TYPES = MessageTypeSchema.options;
-export const FORM_SECTIONS = FormSectionSchema.options;
export const SEVERITIES = SeveritySchema.options;
export const INTEGRATION_TYPES = IntegrationTypeSchema.options;
diff --git a/web/src/features/trace-graph-view/layout/elkLayout.ts b/web/src/features/trace-graph-view/layout/elkLayout.ts
index 624207a657..a20e1b7785 100644
--- a/web/src/features/trace-graph-view/layout/elkLayout.ts
+++ b/web/src/features/trace-graph-view/layout/elkLayout.ts
@@ -127,7 +127,7 @@ export const MAX_GRAPH_LAYOUT_NODES = 2_500;
* exemption included. Without this, the raised ceiling above would let a dense
* graph freeze the tab for minutes on the fallback path.
*/
-export const MAX_MAIN_THREAD_LAYOUT_EDGES = 250;
+const MAX_MAIN_THREAD_LAYOUT_EDGES = 250;
export const MAX_MAIN_THREAD_LAYOUT_NODES = 500;
/** True when a request is too big to lay out on the calling thread. */
diff --git a/web/src/features/trace-graph-view/types.ts b/web/src/features/trace-graph-view/types.ts
index b170b90371..c049cf03a2 100644
--- a/web/src/features/trace-graph-view/types.ts
+++ b/web/src/features/trace-graph-view/types.ts
@@ -23,18 +23,11 @@ export type GraphCanvasData = {
edges: { from: string; to: string }[];
};
-export const LANGGRAPH_NODE_TAG = "langgraph_node";
-export const LANGGRAPH_STEP_TAG = "langgraph_step";
export const LANGGRAPH_START_NODE_NAME = "__start__";
export const LANGGRAPH_END_NODE_NAME = "__end__";
export const LANGFUSE_START_NODE_NAME = "__start__";
export const LANGFUSE_END_NODE_NAME = "__end__";
-export const LanggraphMetadataSchema = z.object({
- [LANGGRAPH_NODE_TAG]: z.string(),
- [LANGGRAPH_STEP_TAG]: z.number(),
-});
-
export const AgentGraphDataSchema = z.object({
id: z.string(),
parent_observation_id: z.string().nullish(),
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/contexts/SectionContext.tsx b/web/src/features/traces/components/AdvancedJsonViewer/contexts/SectionContext.tsx
index dca48093c2..03bd93f55d 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/contexts/SectionContext.tsx
+++ b/web/src/features/traces/components/AdvancedJsonViewer/contexts/SectionContext.tsx
@@ -1,4 +1,4 @@
-import { createContext, useContext, useMemo } from "react";
+import { createContext, useMemo } from "react";
import type { SectionContext } from "../types";
import type { TreeState } from "../utils/treeStructure";
import { getSectionContext, getSectionKeys } from "../utils/multiSectionTree";
@@ -54,31 +54,3 @@ export function SectionContextProvider({
</SectionContextMapContext.Provider>
);
}
-
-/**
- * Hook for header/footer components to access section context
- *
- * Usage in header component:
- * const context = useSectionContext('input');
- * <div onClick={() => context.setExpanded(!context.isExpanded)}>
- * {context.isExpanded ? '▼' : '▶'} Input ({context.rowCount} rows)
- * </div>
- */
-export function useSectionContext(sectionKey: string): SectionContext {
- const map = useContext(SectionContextMapContext);
-
- const context = map[sectionKey];
-
- if (!context) {
- // Default context if not found
- console.warn(`Section context not found for key: ${sectionKey}`);
- return {
- sectionKey,
- rowCount: 0,
- isExpanded: false,
- setExpanded: () => {},
- };
- }
-
- return context;
-}
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/lazy/asyncJsonSource.ts b/web/src/features/traces/components/AdvancedJsonViewer/lazy/asyncJsonSource.ts
index ad7b95e732..4e2ac0252b 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/lazy/asyncJsonSource.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/lazy/asyncJsonSource.ts
@@ -40,7 +40,7 @@ export interface AsyncJsonSource {
* thread; every call resolves immediately. The same class is what a Worker host
* would drive, exposing the identical interface across `postMessage`.
*/
-export function createInProcessSource(bytes: Uint8Array): AsyncJsonSource {
+function createInProcessSource(bytes: Uint8Array): AsyncJsonSource {
const engine = new ByteJsonIndexEngine();
const root = engine.load(bytes);
return {
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/lazy/byteJsonIndex.ts b/web/src/features/traces/components/AdvancedJsonViewer/lazy/byteJsonIndex.ts
index fb27d20b05..7d7f2c7933 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/lazy/byteJsonIndex.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/lazy/byteJsonIndex.ts
@@ -245,7 +245,7 @@ class U8Builder {
/**
* Pure-TS UTF-8 byte scanner. This is the piece a WASM module would replace.
*/
-export class JsByteScanner implements ByteScanner {
+class JsByteScanner implements ByteScanner {
readonly bytes: Uint8Array;
private readonly decoder = new TextDecoder();
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/lazy/react/rowModelStore.ts b/web/src/features/traces/components/AdvancedJsonViewer/lazy/react/rowModelStore.ts
index 090420138d..47c9255a9a 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/lazy/react/rowModelStore.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/lazy/react/rowModelStore.ts
@@ -31,7 +31,7 @@ import type { JsonRow, RowModel, ValueResult } from "../rowModel";
import { reportError } from "@/src/utils/reportError";
/** Rows fetched for the first paint before the virtualizer reports a range. */
-export const INITIAL_ROW_COUNT = 200;
+const INITIAL_ROW_COUNT = 200;
export type LoadStatus = "loading" | "ready" | "error";
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/calculateWidth.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/calculateWidth.ts
index 21c9aa8ba0..9a9bae8a99 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/calculateWidth.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/calculateWidth.ts
@@ -5,15 +5,8 @@
* Uses approximate character widths for monospace fonts.
*/
-import type { FlatJSONRow, JSONTheme } from "../types";
import type { TreeNode } from "./treeStructure";
-/**
- * Approximate character width in pixels for monospace font
- * Based on common monospace fonts at typical sizes
- */
-const CHAR_WIDTH_PX = 7.2; // Approximate width for 0.7rem monospace
-
/**
* Calculate the full display length of a value (for width estimation)
* Always returns the FULL untruncated length - this is data layer, not presentation.
@@ -40,65 +33,6 @@ function getValueDisplayLength(value: unknown): number {
return 0;
}
-/**
- * Calculate minimum width needed for a single row (scrollable column only)
- *
- * Note: Line numbers and expand buttons are now in a separate fixed column,
- * so we only calculate width for: indentation + key + colon + value + badges + copy button
- */
-function calculateRowWidth(row: FlatJSONRow, theme: JSONTheme): number {
- // Components in scrollable column:
- // 1. Indentation (depth * indentSize)
- const indentWidth = row.depth * theme.indentSize;
-
- // 2. Key name (string or number)
- const keyLength = String(row.key).length;
-
- // 3. Colon + space (": ")
- const colonWidth = 2 * CHAR_WIDTH_PX;
-
- // 4. Value (full untruncated length)
- const valueLength = getValueDisplayLength(row.value);
-
- // 5. Padding (right side only, left is indent)
- const paddingWidth = 4;
-
- // Total character-based width
- const charCount = keyLength + valueLength;
- const charWidth = charCount * CHAR_WIDTH_PX;
-
- // Total width
- return (
- indentWidth + colonWidth + charWidth + paddingWidth + 50 // Extra buffer for buttons, badges, etc.
- );
-}
-
-/**
- * Calculate minimum container width for scrollable column
- *
- * Returns the width needed to display the longest row without wrapping.
- * This is only for the scrollable column (excludes fixed column with line numbers/buttons).
- * Always calculates FULL untruncated width (data layer).
- */
-export function calculateMinimumWidth(
- rows: FlatJSONRow[],
- theme: JSONTheme,
-): number {
- if (rows.length === 0) return 0;
-
- let maxWidth = 0;
-
- for (const row of rows) {
- const rowWidth = calculateRowWidth(row, theme);
- if (rowWidth > maxWidth) {
- maxWidth = rowWidth;
- }
- }
-
- // Add some buffer for safety
- return Math.ceil(maxWidth * 1.1); // 10% buffer
-}
-
/**
* Configuration for width estimation
*/
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/debug.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/debug.ts
index af0e7925b1..a0178ddbfc 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/debug.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/debug.ts
@@ -27,17 +27,3 @@ export const debugTime = (label: string) => {
export const debugTimeEnd = (label: string) => {
if (DEBUG) console.timeEnd(label);
};
-
-/**
- * Log warning in development only
- */
-export const debugWarn = (...args: unknown[]) => {
- if (DEBUG) console.warn(...args);
-};
-
-/**
- * Log error (always logs, even in production)
- */
-export const debugError = (...args: unknown[]) => {
- console.error(...args);
-};
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/jsonTypes.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/jsonTypes.ts
index 7400ac01fa..3253c73656 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/jsonTypes.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/jsonTypes.ts
@@ -38,23 +38,6 @@ export function isExpandable(value: unknown): boolean {
return type === "object" || type === "array";
}
-/**
- * Get the number of children for expandable values
- */
-export function getChildCount(value: unknown): number {
- const type = getJSONType(value);
-
- if (type === "array") {
- return (value as unknown[]).length;
- }
-
- if (type === "object") {
- return Object.keys(value as Record<string, unknown>).length;
- }
-
- return 0;
-}
-
/**
* Format a value as a preview string (for collapsed rows)
*/
@@ -103,44 +86,6 @@ export function formatValuePreview(value: unknown, maxLength = 50): string {
}
}
-/**
- * Get a short type label for display
- */
-export function getTypeLabel(type: JSONType): string {
- switch (type) {
- case "array":
- return "[]";
- case "object":
- return "{}";
- case "string":
- return "str";
- case "number":
- return "num";
- case "boolean":
- return "bool";
- case "null":
- return "null";
- case "undefined":
- return "undef";
- default:
- return type;
- }
-}
-
-/**
- * Check if a value is a primitive (not object or array)
- */
-export function isPrimitive(value: unknown): boolean {
- const type = getJSONType(value);
- return (
- type === "string" ||
- type === "number" ||
- type === "boolean" ||
- type === "null" ||
- type === "undefined"
- );
-}
-
/**
* Get children of an expandable value as [key, value] pairs
*/
@@ -171,21 +116,6 @@ export function isArrayIndex(key: string | number): boolean {
);
}
-/**
- * Format a string value for display (handle escaping, newlines, etc.)
- */
-export function formatStringValue(value: string, truncate?: number): string {
- let formatted = value;
-
- // Truncate if needed
- if (truncate && formatted.length > truncate) {
- formatted = formatted.slice(0, truncate) + "...";
- }
-
- // Don't escape - let the browser handle display
- return formatted;
-}
-
/**
* Safely stringify a value (handles circular references)
*/
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/pathUtils.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/pathUtils.ts
index 955e51714c..e74863d433 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/pathUtils.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/pathUtils.ts
@@ -35,15 +35,6 @@ export function getParentPath(path: string): string | null {
return joinPath(parts.slice(0, -1));
}
-/**
- * Get the key (last part) of a path
- * @example getPathKey("root.users.0.name") => "name"
- */
-export function getPathKey(path: string): string | number {
- const parts = splitPath(path);
- return parts[parts.length - 1]!;
-}
-
/**
* Check if one path is an ancestor of another
* @example isAncestorPath("root.users", "root.users.0.name") => true
@@ -59,24 +50,6 @@ export function isAncestorPath(
);
}
-/**
- * Check if one path is a direct child of another
- * @example isDirectChild("root.users", "root.users.0") => true
- * @example isDirectChild("root.users", "root.users.0.name") => false
- */
-export function isDirectChild(parentPath: string, childPath: string): boolean {
- const parentParts = splitPath(parentPath);
- const childParts = splitPath(childPath);
-
- if (childParts.length !== parentParts.length + 1) return false;
-
- for (let i = 0; i < parentParts.length; i++) {
- if (parentParts[i] !== childParts[i]) return false;
- }
-
- return true;
-}
-
/**
* Get all ancestor paths of a given path (excluding the path itself)
* @example getAncestorPaths("root.users.0.name") => ["root", "root.users", "root.users.0"]
@@ -92,116 +65,6 @@ export function getAncestorPaths(path: string): string[] {
return ancestors;
}
-/**
- * Get the depth of a path (0 = root)
- * @example getPathDepth("root") => 0
- * @example getPathDepth("root.users.0.name") => 3
- */
-export function getPathDepth(path: string): number {
- return splitPath(path).length - 1;
-}
-
-/**
- * Check if a path is the root
- */
-export function isRootPath(path: string): boolean {
- return splitPath(path).length === 1;
-}
-
-/**
- * Normalize a path (ensure consistent format)
- * Handles trailing dots, double dots, etc.
- */
-export function normalizePath(path: string): string {
- const parts = path
- .split(".")
- .filter((part) => part.length > 0)
- .map((part) => {
- const num = Number(part);
- return isNaN(num) ? part : num;
- });
-
- return joinPath(parts);
-}
-
-/**
- * Compare two paths for sorting
- * Returns: -1 if a < b, 0 if a === b, 1 if a > b
- */
-export function comparePaths(a: string, b: string): number {
- const partsA = splitPath(a);
- const partsB = splitPath(b);
-
- const minLength = Math.min(partsA.length, partsB.length);
-
- for (let i = 0; i < minLength; i++) {
- const partA = partsA[i]!;
- const partB = partsB[i]!;
-
- // Compare numbers numerically
- if (typeof partA === "number" && typeof partB === "number") {
- if (partA !== partB) return partA - partB;
- continue;
- }
-
- // Compare strings lexicographically
- if (String(partA) < String(partB)) return -1;
- if (String(partA) > String(partB)) return 1;
- }
-
- // If all parts are equal, shorter path comes first
- return partsA.length - partsB.length;
-}
-
-/**
- * Get child paths of a parent path from a list of paths
- * Only returns direct children, not descendants
- */
-export function getChildPaths(
- parentPath: string,
- allPaths: string[],
-): string[] {
- return allPaths.filter((path) => isDirectChild(parentPath, path));
-}
-
-/**
- * Get descendant paths of an ancestor path from a list of paths
- * Returns all descendants, not just direct children
- */
-export function getDescendantPaths(
- ancestorPath: string,
- allPaths: string[],
-): string[] {
- return allPaths.filter((path) => isAncestorPath(ancestorPath, path));
-}
-
-/**
- * Build a path from a parent path and a key
- * @example buildPath("root.users", 0) => "root.users.0"
- */
-export function buildPath(parentPath: string, key: string | number): string {
- return `${parentPath}.${key}`;
-}
-
-/**
- * Check if any ancestor of a path is collapsed
- * Used to determine if a row should be visible
- */
-export function hasCollapsedAncestor(
- path: string,
- collapsedPaths: Set<string>,
-): boolean {
- const ancestors = getAncestorPaths(path);
-
- for (const ancestor of ancestors) {
- if (collapsedPaths.has(ancestor)) {
- return true;
- }
- }
-
- return false;
-}
-
/**
* Convert a path array to JSON Path format
* The first element (rootKey) is ignored as JSON Path starts with $
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/searchJson.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/searchJson.ts
index 035211298a..b2d8aeaf57 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/searchJson.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/searchJson.ts
@@ -5,94 +5,8 @@
* Zero dependencies - simple string matching with optional regex support.
*/
-import type {
- FlatJSONRow,
- SearchMatch,
- SearchOptions,
- ExpansionState,
-} from "../types";
+import type { SearchMatch, SearchOptions } from "../types";
import type { TreeState } from "./treeStructure";
-import { expandToNode } from "./treeExpansion";
-
-/**
- * Search through JSON rows and find matches
- *
- * @param rows - Flattened JSON rows to search through
- * @param query - Search query string
- * @param options - Search options (case sensitivity, regex, etc.)
- * @returns Array of search matches with positions
- */
-export function searchInRows(
- rows: FlatJSONRow[],
- query: string,
- options: SearchOptions = {},
-): SearchMatch[] {
- if (!query || query.trim() === "") return [];
-
- const { caseSensitive = false, useRegex = false } = options;
-
- const matches: SearchMatch[] = [];
-
- // Prepare query for searching
- const searchQuery = caseSensitive ? query : query.toLowerCase();
- let regex: RegExp | null = null;
-
- if (useRegex) {
- try {
- regex = new RegExp(searchQuery, caseSensitive ? "g" : "gi");
- } catch (error) {
- // Invalid regex, fall back to string search
- console.warn("Invalid regex pattern:", query, error);
- }
- }
-
- // Search through each row
- rows.forEach((row, index) => {
- // Search in key
- const keyStr = String(row.key);
- const keyMatches = findMatchesInString(
- keyStr,
- searchQuery,
- regex,
- caseSensitive,
- );
-
- keyMatches.forEach((match) => {
- matches.push({
- rowIndex: index,
- rowId: row.id,
- matchType: "key",
- highlightStart: match.start,
- highlightEnd: match.end,
- matchedText: match.text,
- });
- });
-
- // Search in value (only for primitive values)
- if (!row.isExpandable) {
- const valueStr = String(row.value);
- const valueMatches = findMatchesInString(
- valueStr,
- searchQuery,
- regex,
- caseSensitive,
- );
-
- valueMatches.forEach((match) => {
- matches.push({
- rowIndex: index,
- rowId: row.id,
- matchType: "value",
- highlightStart: match.start,
- highlightEnd: match.end,
- matchedText: match.text,
- });
- });
- }
- });
-
- return matches;
-}
/**
* Find all matches of a search query in a string
@@ -138,130 +52,6 @@ function findMatchesInString(
return matches;
}
-/**
- * Get the paths that need to be expanded to show a match
- *
- * @param match - The search match
- * @param rows - All flattened rows
- * @returns Array of path strings to expand
- */
-export function getPathsToExpand(
- match: SearchMatch,
- rows: FlatJSONRow[],
-): string[] {
- const row = rows[match.rowIndex];
- if (!row) return [];
-
- const paths: string[] = [];
- const parts = row.pathArray;
-
- // Get all ancestor paths
- for (let i = 1; i < parts.length; i++) {
- paths.push(parts.slice(0, i).join("."));
- }
-
- return paths;
-}
-
-/**
- * Expand all ancestors of a path
- * Useful for showing search results
- *
- * @param path - The path to expand ancestors for (e.g., "root.users.0.name")
- * @param currentState - Current expansion state
- * @returns New expansion state with ancestors expanded
- */
-function expandAncestors(
- path: string,
- currentState: ExpansionState,
-): ExpansionState {
- // Can't modify boolean state
- if (typeof currentState === "boolean") {
- return currentState;
- }
-
- const newState = { ...currentState };
- const parts = path.split(".");
-
- // Expand all ancestors
- for (let i = 1; i < parts.length; i++) {
- const ancestorPath = parts.slice(0, i).join(".");
- newState[ancestorPath] = true;
- }
-
- return newState;
-}
-
-/**
- * Expand all paths needed to show a search match
- *
- * @param match - The search match
- * @param rows - All flattened rows
- * @param currentState - Current expansion state
- * @returns New expansion state with ancestors expanded
- */
-export function expandToMatch(
- match: SearchMatch,
- rows: FlatJSONRow[],
- currentState: ExpansionState,
-): ExpansionState {
- const row = rows[match.rowIndex];
- if (!row) return currentState;
-
- return expandAncestors(row.id, currentState);
-}
-
-/**
- * Get the next match index (circular)
- */
-export function getNextMatchIndex(
- currentIndex: number,
- totalMatches: number,
-): number {
- if (totalMatches === 0) return 0;
- return (currentIndex + 1) % totalMatches;
-}
-
-/**
- * Get the previous match index (circular)
- */
-export function getPreviousMatchIndex(
- currentIndex: number,
- totalMatches: number,
-): number {
- if (totalMatches === 0) return 0;
- return (currentIndex - 1 + totalMatches) % totalMatches;
-}
-
-/**
- * Filter matches to only those in visible rows
- * Useful when some rows are collapsed
- */
-export function filterVisibleMatches(
- matches: SearchMatch[],
- visibleRowIndices: Set<number>,
-): SearchMatch[] {
- return matches.filter((match) => visibleRowIndices.has(match.rowIndex));
-}
-
-/**
- * Group matches by row
- * Useful for showing "3 matches in this row" indicators
- */
-export function groupMatchesByRow(
- matches: SearchMatch[],
-): Map<string, SearchMatch[]> {
- const grouped = new Map<string, SearchMatch[]>();
-
- matches.forEach((match) => {
- const existing = grouped.get(match.rowId) || [];
- existing.push(match);
- grouped.set(match.rowId, existing);
- });
-
- return grouped;
-}
-
/**
* Get the index of the current match within its row
* Returns 1-based index (1, 2, 3...) or undefined if not found
@@ -301,55 +91,6 @@ export interface SearchStats {
valueMatches: number;
}
-export function getSearchStats(matches: SearchMatch[]): SearchStats {
- const matchedRowIds = new Set(matches.map((m) => m.rowId));
- const keyMatches = matches.filter((m) => m.matchType === "key").length;
- const valueMatches = matches.filter((m) => m.matchType === "value").length;
-
- return {
- totalMatches: matches.length,
- matchedRows: matchedRowIds.size,
- keyMatches,
- valueMatches,
- };
-}
-
-/**
- * Count matches for each row, including matches in descendants
- * Useful for showing "this collapsed row contains X matches"
- *
- * @param rows - All flattened rows
- * @param matches - All search matches
- * @returns Map of rowId -> count of matches in this row and its descendants
- */
-export function getMatchCountsPerRow(
- rows: FlatJSONRow[],
- matches: SearchMatch[],
-): Map<string, number> {
- const counts = new Map<string, number>();
-
- // Initialize all rows with 0
- rows.forEach((row) => counts.set(row.id, 0));
-
- // For each match, increment count for the matched row and all ancestors
- matches.forEach((match) => {
- const row = rows[match.rowIndex];
- if (!row) return;
-
- // Increment count for this row
- counts.set(row.id, (counts.get(row.id) || 0) + 1);
-
- // Increment count for all ancestors
- const pathArray = row.pathArray;
- for (let i = 1; i < pathArray.length; i++) {
- const ancestorPath = pathArray.slice(0, i).join(".");
- counts.set(ancestorPath, (counts.get(ancestorPath) || 0) + 1);
- }
- });
-
- return counts;
-}
-
/**
* Highlight text with search match positions
* Returns array of segments with highlight info
@@ -491,27 +232,6 @@ export function searchInTree(
return matches;
}
-/**
- * Expand tree to show a search match
- *
- * Expands all ancestors of the matched node so it becomes visible.
- *
- * @param tree - Tree state
- * @param match - Search match to reveal
- * @returns Updated tree state
- */
-export function expandToMatch_Tree(
- tree: TreeState,
- match: SearchMatch,
-): TreeState {
- // Get node from match
- const node = tree.nodeMap.get(match.rowId);
- if (!node) return tree;
-
- // Expand all ancestors
- return expandToNode(tree, node.id);
-}
-
/**
* Get count of matches per node (including descendants)
*
@@ -549,19 +269,3 @@ export function getMatchCountsPerNode(
return counts;
}
-
-/**
- * Find visible index of a node in the tree
- *
- * Used for scrolling to search results.
- * Returns the index in the visible tree (0-based), or -1 if not visible.
- *
- * @param tree - Tree state
- * @param nodeId - ID of node to find
- * @returns Visible index, or -1 if not visible/not found
- */
-export function findNodeVisibleIndex(tree: TreeState, nodeId: string): number {
- // Lazy import to avoid circular dependencies
- const { findNodeIndex } = require("./treeNavigation");
- return findNodeIndex(tree.rootNode, nodeId);
-}
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/treeExpansion.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/treeExpansion.ts
index 14e8edb707..d2f99ceeaa 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/treeExpansion.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/treeExpansion.ts
@@ -371,55 +371,6 @@ export function applyExpansionState(
return tree;
}
-/**
- * Expand to a specific depth
- *
- * @param tree - Current tree state
- * @param depth - Maximum depth to expand to
- * @returns Updated tree state
- */
-export function expandToDepth(tree: TreeState, depth: number): TreeState {
- debugTime("[expandToDepth]");
-
- // Iterate through all nodes (bottom-up for offset computation)
- const postOrder: TreeNode[] = [];
- const stack: { node: TreeNode; visited: boolean }[] = [
- { node: tree.rootNode, visited: false },
- ];
-
- while (stack.length > 0) {
- const current = stack.pop()!;
-
- if (current.visited) {
- postOrder.push(current.node);
- } else {
- stack.push({ node: current.node, visited: true });
-
- for (let i = current.node.children.length - 1; i >= 0; i--) {
- stack.push({ node: current.node.children[i]!, visited: false });
- }
- }
- }
-
- // Apply expansion based on depth
- postOrder.forEach((node) => {
- // Expansion decision only applies to expandable nodes.
- if (node.isExpandable) {
- const shouldExpand = node.depth < depth;
- node.isExpanded = shouldExpand;
- node.userExpand = shouldExpand;
- }
-
- // Recompute offsets for EVERY node (see applyExpansionState): post-order +
- // no-op-on-collapsed makes this safe, and it keeps the non-expandable
- // meta-root's visibleDescendantCount in sync with the virtualizer row count.
- recomputeNodeOffsets(node);
- });
-
- debugTimeEnd("[expandToDepth]");
- return tree;
-}
-
/**
* Get statistics about current expansion state
*
@@ -433,43 +384,3 @@ export interface ExpansionStats {
visibleNodes: number;
maxVisibleDepth: number;
}
-
-export function getExpansionStats(tree: TreeState): ExpansionStats {
- let totalExpandable = 0;
- let totalExpanded = 0;
- let maxVisibleDepth = 0;
-
- // Iterate through all nodes to count expandable/expanded
- tree.allNodes.forEach((node) => {
- if (node.isExpandable) {
- totalExpandable++;
- if (node.isExpanded) {
- totalExpanded++;
- }
- }
- });
-
- // Count visible nodes (root + visible descendants)
- const visibleNodes = 1 + tree.rootNode.visibleDescendantCount;
-
- // Find max visible depth
- const stack: TreeNode[] = [tree.rootNode];
- while (stack.length > 0) {
- const node = stack.pop()!;
- if (node.depth > maxVisibleDepth) {
- maxVisibleDepth = node.depth;
- }
-
- if (node.isExpanded) {
- node.children.forEach((child) => stack.push(child));
- }
- }
-
- return {
- totalExpandable,
- totalExpanded,
- totalCollapsed: totalExpandable - totalExpanded,
- visibleNodes,
- maxVisibleDepth,
- };
-}
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/treeNavigation.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/treeNavigation.ts
index d76f935a55..94fa51fa93 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/treeNavigation.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/treeNavigation.ts
@@ -257,69 +257,6 @@ export function getAllVisibleNodes(rootNode: TreeNode): TreeNode[] {
return nodes;
}
-/**
- * Validate tree structure and offsets (for debugging)
- *
- * Checks that childOffsets are computed correctly.
- *
- * @param rootNode - Root of the tree
- * @returns True if valid, throws error if invalid
- */
-export function validateTreeOffsets(rootNode: TreeNode): boolean {
- const stack: TreeNode[] = [rootNode];
-
- while (stack.length > 0) {
- const node = stack.pop()!;
-
- if (node.isExpanded && node.children.length > 0) {
- // Validate childOffsets
- const { children, childOffsets } = node;
-
- if (childOffsets.length !== children.length) {
- throw new Error(
- `[validateTreeOffsets] Node ${node.id}: childOffsets.length (${childOffsets.length}) !== children.length (${children.length})`,
- );
- }
-
- // Check cumulative offsets
- let expectedCumulative = 0;
- for (let i = 0; i < children.length; i++) {
- const child = children[i]!;
- expectedCumulative += 1 + child.visibleDescendantCount;
-
- if (childOffsets[i] !== expectedCumulative) {
- throw new Error(
- `[validateTreeOffsets] Node ${node.id}: childOffsets[${i}] is ${childOffsets[i]}, expected ${expectedCumulative}`,
- );
- }
- }
-
- // Push children for validation
- children.forEach((child) => stack.push(child));
- }
- }
-
- return true;
-}
-
-/**
- * Get path from root to node
- *
- * @param node - Target node
- * @returns Array of nodes from root to target (inclusive)
- */
-export function getPathToNode(node: TreeNode): TreeNode[] {
- const path: TreeNode[] = [];
- let current: TreeNode | null = node;
-
- while (current !== null) {
- path.unshift(current);
- current = current.parentNode;
- }
-
- return path;
-}
-
/**
* Check if node is visible (all ancestors are expanded)
*
@@ -360,69 +297,3 @@ export function getVisibleDepthRange(rootNode: TreeNode): [number, number] {
return [minDepth, maxDepth];
}
-
-/**
- * Validate getNodeByIndex for all visible indices
- *
- * Compares getNodeByIndex results with getAllVisibleNodes to ensure consistency.
- * Throws detailed error if any mismatch is found.
- *
- * @param rootNode - Root of the tree
- * @returns True if validation passes
- * @throws Error with detailed context if validation fails
- */
-export function validateGetNodeByIndex(rootNode: TreeNode): boolean {
- const expectedNodes = getAllVisibleNodes(rootNode);
- const totalVisibleRows = expectedNodes.length;
-
- for (let i = 0; i < totalVisibleRows; i++) {
- const expectedNode = expectedNodes[i]!;
- const actualNode = getNodeByIndex(rootNode, i);
-
- if (!actualNode) {
- const error = {
- message: "getNodeByIndex returned null",
- index: i,
- expectedNode: {
- id: expectedNode.id,
- key: expectedNode.key,
- depth: expectedNode.depth,
- isExpanded: expectedNode.isExpanded,
- },
- totalVisibleRows,
- };
- console.error("[validateGetNodeByIndex] VALIDATION FAILED:", error);
- throw new Error(
- `getNodeByIndex(${i}) returned null, expected node ${expectedNode.id}`,
- );
- }
-
- if (actualNode.id !== expectedNode.id) {
- const error = {
- message: "Node ID mismatch",
- index: i,
- expectedNode: {
- id: expectedNode.id,
- key: expectedNode.key,
- depth: expectedNode.depth,
- isExpanded: expectedNode.isExpanded,
- pathArray: expectedNode.pathArray,
- },
- actualNode: {
- id: actualNode.id,
- key: actualNode.key,
- depth: actualNode.depth,
- isExpanded: actualNode.isExpanded,
- pathArray: actualNode.pathArray,
- },
- totalVisibleRows,
- };
- console.error("[validateGetNodeByIndex] VALIDATION FAILED:", error);
- throw new Error(
- `Node mismatch at index ${i}: expected ${expectedNode.id}, got ${actualNode.id}`,
- );
- }
- }
-
- return true;
-}
diff --git a/web/src/features/traces/components/AdvancedJsonViewer/utils/treeStructure.ts b/web/src/features/traces/components/AdvancedJsonViewer/utils/treeStructure.ts
index 4d9cc06756..540c96ec39 100644
--- a/web/src/features/traces/components/AdvancedJsonViewer/utils/treeStructure.ts
+++ b/web/src/features/traces/components/AdvancedJsonViewer/utils/treeStructure.ts
@@ -20,12 +20,6 @@ import {
type WidthEstimatorConfig,
} from "./calculateWidth";
-/**
- * Size threshold for sync vs Web Worker
- * Tree building with >10K nodes can block main thread for 50ms+
- */
-export const TREE_BUILD_THRESHOLD = 10_000;
-
/**
* TreeNode represents a single node in the hierarchical JSON tree
*/
@@ -586,42 +580,3 @@ export function buildTreeFromJSON(
maxContentWidth,
};
}
-
-/**
- * Estimate total node count without building tree
- * Used to determine if we should use Web Worker
- *
- * @param data - The JSON data
- * @returns Estimated node count
- */
-export function estimateNodeCount(data: unknown): number {
- let count = 0;
-
- // Iterative traversal (stack-based)
- const stack: unknown[] = [data];
-
- while (stack.length > 0) {
- const current = stack.pop()!;
- count++;
-
- if (isExpandable(current)) {
- const children = getChildren(current);
- children.forEach(([_, childValue]) => {
- stack.push(childValue);
- });
- }
- }
-
- return count;
-}
-
-/**
- * Check if tree building should use Web Worker
- *
- * @param data - The JSON data
- * @returns True if Web Worker should be used
- */
-export function shouldUseWorkerForTreeBuild(data: unknown): boolean {
- const estimatedCount = estimateNodeCount(data);
- return estimatedCount > TREE_BUILD_THRESHOLD;
-}
diff --git a/web/src/features/traces/components/JSONTableView/index.ts b/web/src/features/traces/components/JSONTableView/index.ts
index f63e0196db..7e9e7eff70 100644
--- a/web/src/features/traces/components/JSONTableView/index.ts
+++ b/web/src/features/traces/components/JSONTableView/index.ts
@@ -18,8 +18,6 @@
*/
export { JSONTableView } from "./JSONTableView";
-export { JSONTableViewHeader } from "./JSONTableViewHeader";
-export { JSONTableViewRow } from "./JSONTableViewRow";
export type {
JSONTableViewProps,
JSONTableViewColumn,
diff --git a/web/src/features/traces/components/PlaybackControls.tsx b/web/src/features/traces/components/PlaybackControls.tsx
index 98151eb525..9d8d16632d 100644
--- a/web/src/features/traces/components/PlaybackControls.tsx
+++ b/web/src/features/traces/components/PlaybackControls.tsx
@@ -54,7 +54,7 @@ const RING_C = 2 * Math.PI * RING_R;
* transport pop-in after first load. An actively-placed playhead keeps its
* controls regardless.
*/
-export function useHasPlayback(): boolean {
+function useHasPlayback(): boolean {
const { traceDuration } = useTraceData();
const { isGraphViewAvailable, isLoading: isGraphDataLoading } =
useTraceGraphData();
diff --git a/web/src/features/traces/components/TraceLogView/TraceLogView.tsx b/web/src/features/traces/components/TraceLogView/TraceLogView.tsx
index 87922467df..759682005e 100644
--- a/web/src/features/traces/components/TraceLogView/TraceLogView.tsx
+++ b/web/src/features/traces/components/TraceLogView/TraceLogView.tsx
@@ -66,8 +66,6 @@ const {
} = TRACE_VIEW_CONFIG.logView;
// Re-export thresholds for use in parent components
-export { LOG_VIEW_VIRTUALIZATION_THRESHOLD };
-
export const TraceLogView = ({
traceId,
projectId,
diff --git a/web/src/features/traces/components/TraceLogView/log-view-formatters.ts b/web/src/features/traces/components/TraceLogView/log-view-formatters.ts
index b5c5fd7269..a0ea2ce0f1 100644
--- a/web/src/features/traces/components/TraceLogView/log-view-formatters.ts
+++ b/web/src/features/traces/components/TraceLogView/log-view-formatters.ts
@@ -59,19 +59,6 @@ export function formatRelativeTime(ms: number, showMs = false): string {
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
}
-/**
- * Formats depth as a visual indicator.
- *
- * @param depth - Tree depth (0 for root observations)
- * @returns Formatted depth string or empty for depth 0
- */
-export function formatDepthIndicator(depth: number): string {
- if (depth <= 0) {
- return "";
- }
- return `L${depth}`;
-}
-
/**
* Formats duration in milliseconds to a human-readable string.
*
diff --git a/web/src/features/traces/components/TraceLogView/useLogViewAllObservationsIO.ts b/web/src/features/traces/components/TraceLogView/useLogViewAllObservationsIO.ts
index eb80a28456..11a7e5d4ee 100644
--- a/web/src/features/traces/components/TraceLogView/useLogViewAllObservationsIO.ts
+++ b/web/src/features/traces/components/TraceLogView/useLogViewAllObservationsIO.ts
@@ -40,7 +40,7 @@ export interface ObservationIOData {
* Build the tRPC query key for an observation.
* Must match the format used by api.observations.byId.useQuery
*/
-export function getObservationQueryKey(
+function getObservationQueryKey(
observationId: string,
traceId: string,
projectId: string,
diff --git a/web/src/features/traces/contexts/JsonExpansionContext.tsx b/web/src/features/traces/contexts/JsonExpansionContext.tsx
index 82bb4e2d4e..d39abcbe4a 100644
--- a/web/src/features/traces/contexts/JsonExpansionContext.tsx
+++ b/web/src/features/traces/contexts/JsonExpansionContext.tsx
@@ -71,45 +71,6 @@ export const useJsonExpansion = () => {
return useContext(JsonExpansionContext);
};
-/**
- * Read formatted expansion state directly from sessionStorage
- */
-export function readFormattedExpansion(field: string): Record<string, boolean> {
- if (typeof window === "undefined") return {};
-
- try {
- const stored = sessionStorage.getItem(STORAGE_KEYS.formatted);
- if (!stored) return {};
-
- const parsed = JSON.parse(stored) as FormattedExpansionState;
- return parsed[field] ?? {};
- } catch {
- return {};
- }
-}
-
-/**
- * Write formatted expansion state directly to sessionStorage
- */
-export function writeFormattedExpansion(
- field: string,
- state: Record<string, boolean>,
-): void {
- if (typeof window === "undefined") return;
-
- try {
- const stored = sessionStorage.getItem(STORAGE_KEYS.formatted);
- const parsed: FormattedExpansionState = stored
- ? (JSON.parse(stored) as FormattedExpansionState)
- : { input: {}, output: {}, metadata: {} };
-
- parsed[field] = state;
- sessionStorage.setItem(STORAGE_KEYS.formatted, JSON.stringify(parsed));
- } catch {
- // Silently fail
- }
-}
-
export function JsonExpansionProvider({ children }: { children: ReactNode }) {
// Formatted view state (per-field, path-based)
const [formattedExpansion, setFormattedExpansion] =
diff --git a/web/src/features/traces/contexts/PlayheadContext.tsx b/web/src/features/traces/contexts/PlayheadContext.tsx
index 70afad9e02..9df14b2605 100644
--- a/web/src/features/traces/contexts/PlayheadContext.tsx
+++ b/web/src/features/traces/contexts/PlayheadContext.tsx
@@ -78,7 +78,7 @@ export function PlayheadProvider({ children }: { children: ReactNode }) {
);
}
-export function usePlayheadStore(): PlayheadStore {
+function usePlayheadStore(): PlayheadStore {
const store = useContext(PlayheadStoreContext);
if (!store) {
throw new Error("usePlayheadStore must be used within a PlayheadProvider");
diff --git a/web/src/features/traces/fns/downloadTrace.ts b/web/src/features/traces/fns/downloadTrace.ts
index a0eb5c2bb5..3570058509 100644
--- a/web/src/features/traces/fns/downloadTrace.ts
+++ b/web/src/features/traces/fns/downloadTrace.ts
@@ -5,7 +5,7 @@ export interface ServerTraceDownloadParams {
projectId: string;
}
-export function buildTraceDownloadUrl({
+function buildTraceDownloadUrl({
traceId,
projectId,
}: ServerTraceDownloadParams): string {
diff --git a/web/src/features/traces/fns/timeline/barContrast.ts b/web/src/features/traces/fns/timeline/barContrast.ts
index 8eae839198..7e2bdc0ce7 100644
--- a/web/src/features/traces/fns/timeline/barContrast.ts
+++ b/web/src/features/traces/fns/timeline/barContrast.ts
@@ -29,7 +29,7 @@ export type BarTextTone = "light" | "dark";
const TONE_THRESHOLD = 0.179;
/** Relative luminance of an sRGB byte triple, per WCAG 2. */
-export const luminanceOf = (r: number, g: number, b: number): number => {
+const luminanceOf = (r: number, g: number, b: number): number => {
const channel = (value: number) => {
const c = value / 255;
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
@@ -98,6 +98,3 @@ export function resolveBarTones(
cache.set(key, tones);
return tones;
}
-
-/** Test seam: the cache is keyed on the theme, which a test changes by hand. */
-export const clearBarToneCache = () => cache.clear();
diff --git a/web/src/features/traces/fns/timeline/density.ts b/web/src/features/traces/fns/timeline/density.ts
index 2b60d2b623..11cf95ed4a 100644
--- a/web/src/features/traces/fns/timeline/density.ts
+++ b/web/src/features/traces/fns/timeline/density.ts
@@ -20,10 +20,10 @@
export type PointerModality = "fine" | "coarse";
-export const FINE_ROW_HEIGHT = 26;
-export const COARSE_ROW_HEIGHT = 44;
+const FINE_ROW_HEIGHT = 26;
+const COARSE_ROW_HEIGHT = 44;
/** A row that stacks a name over its bar needs two text lines' worth. */
-export const TWO_LINE_MIN_HEIGHT = 38;
+const TWO_LINE_MIN_HEIGHT = 38;
export type Density = {
pointer: PointerModality;
diff --git a/web/src/features/traces/fns/timeline/layout.ts b/web/src/features/traces/fns/timeline/layout.ts
index c655a5ece4..f2565090bf 100644
--- a/web/src/features/traces/fns/timeline/layout.ts
+++ b/web/src/features/traces/fns/timeline/layout.ts
@@ -173,7 +173,7 @@ const MAX_TICKS = 64;
const MIN_TICK_GAP_PX = 56;
const TICK_LABEL_PADDING_PX = 16;
/** The tick line itself — a `border-l`, which the label is positioned inside of. */
-export const TICK_LINE_PX = 1;
+const TICK_LINE_PX = 1;
/** The gap between that line and its label. */
export const TICK_LABEL_GAP_PX = 4;
/**
diff --git a/web/src/features/traces/fns/timeline/timeCompression.ts b/web/src/features/traces/fns/timeline/timeCompression.ts
index a39bd00fc9..e27bb3f9c9 100644
--- a/web/src/features/traces/fns/timeline/timeCompression.ts
+++ b/web/src/features/traces/fns/timeline/timeCompression.ts
@@ -19,7 +19,7 @@
*/
const COLLAPSE_THRESHOLD_RATIO = 0.05;
-export const COLLAPSED_GAP_WIDTH_PX = 28;
+const COLLAPSED_GAP_WIDTH_PX = 28;
/** Reserve room next to a bar for its duration label, so labels never land in a gap. */
const DURATION_LABEL_BUFFER_PX = 48;
const MARKER_PADDING_RATIO = 0.01;
diff --git a/web/src/features/traces/hooks/useChatMLParser.ts b/web/src/features/traces/hooks/useChatMLParser.ts
index b312a77e11..8c30679da9 100644
--- a/web/src/features/traces/hooks/useChatMLParser.ts
+++ b/web/src/features/traces/hooks/useChatMLParser.ts
@@ -236,4 +236,3 @@ export function useChatMLParser(
}
// Re-export for use in ChatMessage
-export { parseToolCallsFromMessage };
diff --git a/web/src/features/traces/server/legacyIoSearch.ts b/web/src/features/traces/server/legacyIoSearch.ts
index 63c46afd95..e1e20ed320 100644
--- a/web/src/features/traces/server/legacyIoSearch.ts
+++ b/web/src/features/traces/server/legacyIoSearch.ts
@@ -11,13 +11,12 @@ const LEGACY_TRACING_TABLE_NAMES = new Set<BatchTableNames>([
BatchTableNames.Observations,
]);
-export const isLegacyTracingIoSearchDisabled = () =>
+const isLegacyTracingIoSearchDisabled = () =>
env.LANGFUSE_DISABLE_LEGACY_TRACING_IO_SEARCH === "true";
-export const hasSearchQuery = (searchQuery?: string | null) =>
- Boolean(searchQuery);
+const hasSearchQuery = (searchQuery?: string | null) => Boolean(searchQuery);
-export const isLegacyTracingTableName = (tableName: BatchTableNames) =>
+const isLegacyTracingTableName = (tableName: BatchTableNames) =>
LEGACY_TRACING_TABLE_NAMES.has(tableName);
type LegacyTracingSearch = {
diff --git a/web/src/features/traces/stores/playheadStore.ts b/web/src/features/traces/stores/playheadStore.ts
index 25df4683c2..d6415b7da9 100644
--- a/web/src/features/traces/stores/playheadStore.ts
+++ b/web/src/features/traces/stores/playheadStore.ts
@@ -25,7 +25,7 @@ import { type TreeNode } from "../types/treeNode";
/** Activation window of one observation, in seconds from the timeline origin. */
export type NodeWindow = { id: string; startSec: number; endSec: number };
-export const EMPTY_ACTIVE_IDS: ReadonlySet<string> = new Set();
+const EMPTY_ACTIVE_IDS: ReadonlySet<string> = new Set();
// Playback compresses to at most this many wall-clock seconds: traces shorter
// than this play in real time; anything longer scales so the whole trace always
diff --git a/web/src/features/v4-migration/sdkVersionStatus.ts b/web/src/features/v4-migration/sdkVersionStatus.ts
index abf2036bfa..922127974b 100644
--- a/web/src/features/v4-migration/sdkVersionStatus.ts
+++ b/web/src/features/v4-migration/sdkVersionStatus.ts
@@ -30,7 +30,7 @@ const requiresOtelIngestionHeader = (
series.actionLevel === "required";
// SQL owns remediation classification; the client only groups rows for display.
-export const isCustomInstrumentationSeries = (
+const isCustomInstrumentationSeries = (
series: V4MigrationSdkUsageSeries,
): boolean => series.remediationType === "upgrade_instrumentation";
@@ -110,9 +110,8 @@ export const getV4MigrationSdkState = (params: {
// Recognized Langfuse SDK traffic stays in the SDK bucket even when it uses
// OTLP; raw/third-party OTel is classified separately by SQL.
-export const isOtelExporterSeries = (
- series: V4MigrationSdkUsageSeries,
-): boolean => series.remediationType === "update_otel_instrumentation";
+const isOtelExporterSeries = (series: V4MigrationSdkUsageSeries): boolean =>
+ series.remediationType === "update_otel_instrumentation";
// Action sections contain only SQL-classified required rows. Successful rows
// are shown separately in the detected-instrumentation section.
diff --git a/web/src/features/v4/server/v4TransitionCache.ts b/web/src/features/v4/server/v4TransitionCache.ts
index 24fc51ab2a..c44b051e3b 100644
--- a/web/src/features/v4/server/v4TransitionCache.ts
+++ b/web/src/features/v4/server/v4TransitionCache.ts
@@ -39,7 +39,7 @@ export const MIGRATION_INGRESS_EVENT_SOURCES = [
] as const;
/** Historical blob TTL: 60 minutes (1 hour). */
-export const SDK_USAGE_CACHE_TTL_SECONDS = 60 * 60;
+const SDK_USAGE_CACHE_TTL_SECONDS = 60 * 60;
const sdkUsageSeriesSchema = z.object({
source: z.enum(MIGRATION_INGRESS_EVENT_SOURCES),
ingestionPath: z.enum(["otel", "ingestion_api"]),
diff --git a/web/src/features/version-update/index.ts b/web/src/features/version-update/index.ts
index 74b596a562..a4a716fc66 100644
--- a/web/src/features/version-update/index.ts
+++ b/web/src/features/version-update/index.ts
@@ -1,8 +1,2 @@
export { VersionUpdateBanner } from "./VersionUpdateBanner";
-export { useVersionUpdateAvailable } from "./useVersionUpdateAvailable";
-export {
- versionUpdateStore,
- createVersionUpdateStore,
- isVersionMismatch,
- type VersionUpdateStore,
-} from "./versionUpdateStore";
+export { type VersionUpdateStore } from "./versionUpdateStore";
diff --git a/web/src/features/web-callouts/server/service.ts b/web/src/features/web-callouts/server/service.ts
index 94c4d4e83c..361d0d8f7c 100644
--- a/web/src/features/web-callouts/server/service.ts
+++ b/web/src/features/web-callouts/server/service.ts
@@ -28,7 +28,7 @@ import {
type WebCalloutEndpoint,
} from "@langfuse/shared/src/db";
-export const WEB_CALLOUT_TIMEOUT_MS = 5_000;
+const WEB_CALLOUT_TIMEOUT_MS = 5_000;
const WEB_CALLOUT_MAX_REDIRECTS = 10;
type StoredEndpoint = WebCalloutEndpoint;
diff --git a/web/src/features/web-callouts/types.ts b/web/src/features/web-callouts/types.ts
index 862f5fd145..b597f54d08 100644
--- a/web/src/features/web-callouts/types.ts
+++ b/web/src/features/web-callouts/types.ts
@@ -1,10 +1,10 @@
import { z } from "zod";
-export const WebCalloutHeadersSchema = z.record(z.string(), z.string());
+const WebCalloutHeadersSchema = z.record(z.string(), z.string());
export type WebCalloutHeaders = z.infer<typeof WebCalloutHeadersSchema>;
-export const WebCalloutEndpointInputSchema = z.object({
+const WebCalloutEndpointInputSchema = z.object({
id: z.string().optional(),
name: z.string().trim().min(1).max(100).default("Default"),
url: z.url(),
diff --git a/web/src/features/widgets/chart-library/utils.ts b/web/src/features/widgets/chart-library/utils.ts
index 5f4089a3c7..a550909803 100644
--- a/web/src/features/widgets/chart-library/utils.ts
+++ b/web/src/features/widgets/chart-library/utils.ts
@@ -120,10 +120,6 @@ export const isTimeSeriesChart = (
}
};
-// Used for a combination of YAxis styling workarounds as discussed in https://github.com/recharts/recharts/issues/2027#issuecomment-769674096.
-export const formatAxisLabel = (label: string): string =>
- label.length > 13 ? label.slice(0, 13).concat("…") : label;
-
/**
* Picks a recharts numeric x-axis `interval` (= ticks skipped between two shown
* ticks) that yields UNIFORM gaps targeting ~`maxTicks` labels. We use this
diff --git a/web/src/features/widgets/components/InlineWidget.tsx b/web/src/features/widgets/components/InlineWidget.tsx
index 8fbd8335f4..a98a40ec60 100644
--- a/web/src/features/widgets/components/InlineWidget.tsx
+++ b/web/src/features/widgets/components/InlineWidget.tsx
@@ -103,51 +103,6 @@ export interface WidgetWrapperProps {
// Components
// ============================================================================
-/**
- * Simple wrapper providing consistent widget styling (border, padding, background).
- */
-export function WidgetWrapper({ children, className }: WidgetWrapperProps) {
- return (
- <div
- className={cn(
- "bg-background group flex h-full w-full flex-col overflow-hidden rounded-lg border p-4",
- className,
- )}
- >
- {children}
- </div>
- );
-}
-
-/**
- * Widget header with title, description, and optional action buttons.
- */
-export function WidgetHeader({
- title,
- description,
- actions,
- className,
-}: WidgetHeaderProps) {
- return (
- <div className={cn("mb-4", className)}>
- <div className="flex items-center justify-between">
- <span className="truncate font-bold" title={title}>
- {title}
- </span>
- {actions && <div className="flex space-x-2">{actions}</div>}
- </div>
- {description && (
- <div
- className="text-muted-foreground truncate text-sm"
- title={description}
- >
- {description}
- </div>
- )}
- </div>
- );
-}
-
const getXAxisValue = (
item: Record<string, unknown>,
entityDimensionLabelMap?: Record<string, string>,
diff --git a/web/src/features/widgets/hooks/useWidgetQuery.ts b/web/src/features/widgets/hooks/useWidgetQuery.ts
index 30a296dfd4..f1c55abff3 100644
--- a/web/src/features/widgets/hooks/useWidgetQuery.ts
+++ b/web/src/features/widgets/hooks/useWidgetQuery.ts
@@ -1,4 +1,3 @@
-import { useMemo } from "react";
import { type z } from "zod";
import { type FilterState } from "@langfuse/shared";
import { type DashboardWidgetChartType } from "@langfuse/shared/src/db";
@@ -6,17 +5,8 @@ import {
type QueryType,
type ViewVersion,
type views,
- type metricAggregations,
- resolveWidgetRenderVersion,
- validateQuery,
- toQueryChartConfig,
- isV2BreakdownChart,
- buildWidgetOrderBy,
type QueryValidationResult,
} from "@langfuse/shared/query";
-import { mapLegacyUiTableFilterToView } from "@/src/features/dashboard/lib/dashboardUiTableToViewMapping";
-import { isTimeSeriesChart } from "@/src/features/widgets/chart-library/utils";
-import { useV4Beta } from "@/src/features/events/hooks/useV4Beta";
// ============================================================================
// Types
@@ -77,124 +67,3 @@ export interface UseWidgetQueryResult {
version: ViewVersion;
validation: QueryValidationResult;
}
-
-// ============================================================================
-// Hook
-// ============================================================================
-
-/**
- * Hook that builds a QueryType from widget configuration.
- *
- * Handles:
- * - Version computation (v1 vs v2) based on widget config and beta toggle
- * - Query building with proper time dimension, order by, and chart config
- * - Filter merging and mapping from UI labels to view field names
- * - Query validation for high cardinality dimensions
- *
- * @example
- * ```tsx
- * const { query, version, validation } = useWidgetQuery({
- * widgetConfig: widget.data,
- * dateRange,
- * filterState: dashboardFilters,
- * sortState,
- * });
- *
- * if (!validation.valid) {
- * return <Error message={validation.reason} />;
- * }
- *
- * return <WidgetContent query={query} version={version} ... />;
- * ```
- */
-export function useWidgetQuery({
- widgetConfig,
- dateRange,
- filterState = [],
- sortState = null,
-}: UseWidgetQueryParams): UseWidgetQueryResult {
- const { isBetaEnabled } = useV4Beta();
-
- // Compute version based on widget requirements and beta toggle
- const version: ViewVersion = useMemo(() => {
- return resolveWidgetRenderVersion({
- shape: {
- view: widgetConfig.view,
- dimensions: widgetConfig.dimensions,
- measures: widgetConfig.metrics.map((m) => ({ measure: m.measure })),
- filters: widgetConfig.filters,
- },
- persistedMinVersion: widgetConfig.minVersion,
- newestReadableVersion: isBetaEnabled ? "v2" : "v1",
- });
- }, [widgetConfig, isBetaEnabled]);
-
- // Build the query
- const query: QueryType = useMemo(() => {
- const fromTimestamp = dateRange
- ? dateRange.from
- : new Date(Date.now() - 1000);
- const toTimestamp = dateRange ? dateRange.to : new Date();
-
- const isTimeSeries = isTimeSeriesChart(widgetConfig.chartType);
- const hasDimension = widgetConfig.dimensions.length > 0;
- const chartType = widgetConfig.chartConfig.type;
-
- // Check if this is a v2 breakdown chart that needs top-N enforcement
- const needsTopN = isV2BreakdownChart({
- version,
- hasDimension,
- isTimeSeries,
- chartType,
- });
-
- // Build order by clause
- const firstMetric = widgetConfig.metrics[0];
- const orderBy = buildWidgetOrderBy({
- chartType,
- sortState,
- needsTopN,
- firstMetric: firstMetric
- ? { aggregation: firstMetric.agg, measure: firstMetric.measure }
- : undefined,
- });
-
- // Build chart config (strip rendering-only fields, add defaults)
- const queryChartConfig = toQueryChartConfig(widgetConfig.chartConfig, {
- defaultRowLimit: needsTopN ? 100 : undefined,
- });
-
- // Merge and map filters
- const mappedWidgetFilters = mapLegacyUiTableFilterToView(
- widgetConfig.view,
- widgetConfig.filters,
- );
- const mappedDashboardFilters = mapLegacyUiTableFilterToView(
- widgetConfig.view,
- filterState,
- );
-
- return {
- view: widgetConfig.view,
- dimensions: widgetConfig.dimensions,
- metrics: widgetConfig.metrics.map((metric) => ({
- measure: metric.measure,
- aggregation: metric.agg as z.infer<typeof metricAggregations>,
- })),
- filters: [...mappedWidgetFilters, ...mappedDashboardFilters],
- timeDimension: isTimeSeries ? { granularity: "auto" as const } : null,
- fromTimestamp: fromTimestamp.toISOString(),
- toTimestamp: toTimestamp.toISOString(),
- orderBy,
- chartConfig: queryChartConfig,
- };
- }, [widgetConfig, dateRange, filterState, sortState, version]);
-
- // Validate the query
- const validation = useMemo(
- () => validateQuery(query, version),
- [query, version],
- );
-
- return { query, version, validation };
-}
diff --git a/web/src/features/widgets/index.ts b/web/src/features/widgets/index.ts
index 76d4f5d036..acc7cb4c22 100644
--- a/web/src/features/widgets/index.ts
+++ b/web/src/features/widgets/index.ts
@@ -1,7 +1,5 @@
// Export the DataPoint type
export { type DataPoint } from "./chart-library/chart-props";
-export { Chart } from "./chart-library/Chart";
-
// Export components
export { WidgetForm } from "./components/WidgetForm";
export { DashboardWidgetTable } from "./components/WidgetTable";
diff --git a/web/src/features/widgets/server/public-dashboard-widget-service.ts b/web/src/features/widgets/server/public-dashboard-widget-service.ts
index adf4fdced9..7ea9587baf 100644
--- a/web/src/features/widgets/server/public-dashboard-widget-service.ts
+++ b/web/src/features/widgets/server/public-dashboard-widget-service.ts
@@ -255,7 +255,7 @@ export function validatePublicDashboardWidgetInput(
}
}
-export function toApiDashboardWidget(widget: WidgetDomain) {
+function toApiDashboardWidget(widget: WidgetDomain) {
return PostUnstableDashboardWidgetResponse.parse({
id: widget.id,
createdAt: widget.createdAt,
diff --git a/web/src/features/widgets/utils.ts b/web/src/features/widgets/utils.ts
index 70ed6729c1..684d3aceb9 100644
--- a/web/src/features/widgets/utils.ts
+++ b/web/src/features/widgets/utils.ts
@@ -118,7 +118,7 @@ export function formatMetricName(metricName: string): string {
/**
* Formats multiple metric names for display, showing first 3 and "+ X more" if needed
*/
-export function formatMultipleMetricNames(metricNames: string[]): string {
+function formatMultipleMetricNames(metricNames: string[]): string {
if (metricNames.length === 0) return "No Metrics";
if (metricNames.length === 1) return formatMetricName(metricNames[0]);
diff --git a/web/src/features/widgets/utils/import-export-utils.ts b/web/src/features/widgets/utils/import-export-utils.ts
index 11c8537d22..5fa9a69119 100644
--- a/web/src/features/widgets/utils/import-export-utils.ts
+++ b/web/src/features/widgets/utils/import-export-utils.ts
@@ -39,7 +39,7 @@ const widgetMetricSchema = MetricSchema.extend({
*/
export const WIDGET_FILE_FORMAT_VERSION = 1;
-export const widgetImportBaseSchema = z
+const widgetImportBaseSchema = z
.object({
$langfuseWidget: z.literal(true).optional(),
version: z.number().int().positive().optional(),
@@ -55,27 +55,25 @@ export const widgetImportBaseSchema = z
})
.loose();
-export const widgetImportSchema = widgetImportBaseSchema.superRefine(
- (widget, ctx) => {
- if (widget.chartConfig.type !== widget.chartType) {
- ctx.addIssue({
- code: "custom",
- path: ["chartConfig", "type"],
- message: "chartConfig.type must match chartType",
- });
- }
- if (
- widget.$langfuseWidget === true &&
- (widget.version ?? 1) > WIDGET_FILE_FORMAT_VERSION
- ) {
- ctx.addIssue({
- code: "custom",
- path: ["version"],
- message: `Unsupported widget format version ${widget.version}`,
- });
- }
- },
-);
+const widgetImportSchema = widgetImportBaseSchema.superRefine((widget, ctx) => {
+ if (widget.chartConfig.type !== widget.chartType) {
+ ctx.addIssue({
+ code: "custom",
+ path: ["chartConfig", "type"],
+ message: "chartConfig.type must match chartType",
+ });
+ }
+ if (
+ widget.$langfuseWidget === true &&
+ (widget.version ?? 1) > WIDGET_FILE_FORMAT_VERSION
+ ) {
+ ctx.addIssue({
+ code: "custom",
+ path: ["version"],
+ message: `Unsupported widget format version ${widget.version}`,
+ });
+ }
+});
export type WidgetImport = z.infer<typeof widgetImportSchema>;
@@ -85,7 +83,7 @@ export type WidgetImport = z.infer<typeof widgetImportSchema>;
* (silently ignore) from "claims to be a widget but is malformed" (surface an
* error).
*/
-export function isLangfuseWidgetPayload(parsed: unknown): boolean {
+function isLangfuseWidgetPayload(parsed: unknown): boolean {
return (
typeof parsed === "object" &&
parsed !== null &&
@@ -233,7 +231,7 @@ export function downloadWidgetJson(widget: WidgetExportSource) {
document.body.removeChild(link);
URL.revokeObjectURL(url);
}
-export function buildWidgetJsonFileName(widgetName: string) {
+function buildWidgetJsonFileName(widgetName: string) {
const fileSafeName = widgetName
.trim()
.toLowerCase()
@@ -243,7 +241,7 @@ export function buildWidgetJsonFileName(widgetName: string) {
return `${fileSafeName || "widget"}.json`;
}
-export function normalizeImportedFilters(params: {
+function normalizeImportedFilters(params: {
filters: FilterState;
view: z.infer<typeof views>;
allowedValuesByColumn: Map<string, Set<string>>;
@@ -307,7 +305,7 @@ export function normalizeImportedFilters(params: {
return { filters, removedValues, removedFilters };
}
-export function normalizeImportedWidget(params: {
+function normalizeImportedWidget(params: {
widget: WidgetImport;
allowedValuesByColumn: Map<string, Set<string>>;
}): {
@@ -348,7 +346,7 @@ export function parseAndNormalizeImportedWidget(params: {
return normalized;
}
-export function validateImportedWidget(params: {
+function validateImportedWidget(params: {
widget: WidgetImport;
importedViewVersion: ViewVersion;
}): void {
@@ -391,7 +389,7 @@ export function validateImportedWidget(params: {
}
}
-export function toImportedWidgetFormSnapshot(
+function toImportedWidgetFormSnapshot(
widget: WidgetImport,
): ImportedWidgetFormSnapshot {
const importedMetrics =
diff --git a/web/src/server/api/definitions/evalConfigsTable.ts b/web/src/server/api/definitions/evalConfigsTable.ts
index faf5756ba1..60d717eac9 100644
--- a/web/src/server/api/definitions/evalConfigsTable.ts
+++ b/web/src/server/api/definitions/evalConfigsTable.ts
@@ -5,7 +5,7 @@ import {
JobTimeScopeZod,
} from "@langfuse/shared";
-export const evalConfigTargetOptions = Object.values(EvalTargetObject).map(
+const evalConfigTargetOptions = Object.values(EvalTargetObject).map(
(value) => ({
value,
}),
diff --git a/web/src/server/api/definitions/scoresTable.ts b/web/src/server/api/definitions/scoresTable.ts
index 1549d13870..276e75f331 100644
--- a/web/src/server/api/definitions/scoresTable.ts
+++ b/web/src/server/api/definitions/scoresTable.ts
@@ -1,9 +1,4 @@
-import {
- type ColumnDefinition,
- formatColumnOptions,
- type SingleValueOption,
- scoresTableCols,
-} from "@langfuse/shared";
+import { type SingleValueOption, scoresTableCols } from "@langfuse/shared";
export { scoresTableCols };
@@ -15,29 +10,3 @@ export type ScoreOptions = {
stringValue: Array<SingleValueOption>;
booleanValue: Array<SingleValueOption>;
};
-
-export function scoresTableColsWithOptions(
- options?: ScoreOptions,
-): ColumnDefinition[] {
- return scoresTableCols.map((col) => {
- if (col.id === "name") {
- return formatColumnOptions(col, options?.name ?? []);
- }
- if (col.id === "tags") {
- return formatColumnOptions(col, options?.tags ?? []);
- }
- if (col.id === "traceName") {
- return formatColumnOptions(col, options?.traceName ?? []);
- }
- if (col.id === "userId") {
- return formatColumnOptions(col, options?.userId ?? []);
- }
- if (col.id === "stringValue") {
- return formatColumnOptions(col, options?.stringValue ?? []);
- }
- if (col.id === "booleanValue") {
- return formatColumnOptions(col, options?.booleanValue ?? []);
- }
- return col;
- });
-}
diff --git a/web/src/server/api/services/sqlInterface.ts b/web/src/server/api/services/sqlInterface.ts
index 813be1f686..752793d76a 100644
--- a/web/src/server/api/services/sqlInterface.ts
+++ b/web/src/server/api/services/sqlInterface.ts
@@ -5,9 +5,9 @@ export type DatabaseRow = {
[key: string]: string | number | Date | Record<string, unknown> | null;
};
-export const temporalUnit = z.enum(["month", "week", "day", "hour", "minute"]);
+const temporalUnit = z.enum(["month", "week", "day", "hour", "minute"]);
-export const aggregations = z
+const aggregations = z
.enum([
"SUM",
"AVG",
@@ -22,7 +22,7 @@ export const aggregations = z
])
.optional();
-export const groupByInterface = z.array(
+const groupByInterface = z.array(
z.discriminatedUnion("type", [
z.object({
type: z.literal("datetime"),
diff --git a/web/src/server/api/trpc.ts b/web/src/server/api/trpc.ts
index 030e93d877..526c3164e7 100644
--- a/web/src/server/api/trpc.ts
+++ b/web/src/server/api/trpc.ts
@@ -94,7 +94,6 @@ import {
import { AdminApiAuthService } from "@/src/ee/features/admin-api/server/adminApiAuth";
import { env } from "@/src/env.mjs";
import { isBaseError, parseIO } from "@langfuse/shared";
-import { type Flag } from "@/src/features/feature-flags/types";
import { recordBackendActivity } from "@/src/features/posthog-analytics/server/backendActivity";
setUpSuperjson();
@@ -400,31 +399,6 @@ export const protectedProjectProcedure = withOtelTracingProcedure
.use(withErrorHandling)
.use(enforceUserIsAuthedAndProjectMember);
-/** requireFeatureFlag gates a procedure behind a server-side feature flag. */
-export const requireFeatureFlag = (flag: Flag) =>
- t.middleware(({ ctx, next }) => {
- const session = ctx.session;
- const enabled =
- (session?.user?.featureFlags?.[flag] ?? false) ||
- (session?.user?.admin ?? false) ||
- (session?.environment?.enableExperimentalFeatures ?? false);
- if (!enabled) {
- throw new TRPCError({
- code: "FORBIDDEN",
- message: `Feature "${flag}" is not enabled for this user`,
- });
- }
- return next();
- });
-
-/** requireLangfuseCloud rejects calls from non-Langfuse-Cloud deployments. */
-export const requireLangfuseCloud = t.middleware(({ next }) => {
- if (!isLangfuseCloud) {
- throw new TRPCError({ code: "NOT_FOUND", message: "Not found" });
- }
- return next();
-});
-
/** requireV4Writes rejects calls from deployments without v4 event tables */
export const requireV4Writes = t.middleware(({ next }) => {
if (env.LANGFUSE_MIGRATION_V4_WRITE_MODE === "legacy") {
diff --git a/web/src/stores/observedMetadataStore.ts b/web/src/stores/observedMetadataStore.ts
index 8fc6a9009c..3bf18da4d0 100644
--- a/web/src/stores/observedMetadataStore.ts
+++ b/web/src/stores/observedMetadataStore.ts
@@ -29,7 +29,7 @@ import {
type StoredKeyInfo,
} from "@/src/fns/observedMetadata/metadataPaths";
-export const OBSERVED_METADATA_STORAGE_KEY = "langfuse-observed-metadata";
+const OBSERVED_METADATA_STORAGE_KEY = "langfuse-observed-metadata";
const MAX_PROJECTS = 20;
// A merge that changes nothing still refreshes the LRU stamp when it is older
diff --git a/web/src/utils/api.ts b/web/src/utils/api.ts
index 3ed4aef588..eceb31fc51 100644
--- a/web/src/utils/api.ts
+++ b/web/src/utils/api.ts
@@ -7,7 +7,6 @@
import { addBreadcrumb } from "@sentry/nextjs";
import {
- createTRPCProxyClient,
httpBatchLink,
httpLink,
loggerLink,
@@ -705,31 +704,6 @@ export const api = createTRPCNext<AppRouter>({
transformer: superjson, // since tRPC v11 has to be here for some reason
});
-/**
- * Type-safe tRPC client for usage in the browser.
- * To be used whenever you need to call the API without react hooks.
- */
-export const directApi = createTRPCProxyClient<AppRouter>({
- links: [
- loggerLink({
- // Only enable in development - production logs would be captured by Sentry
- // in an unreadable format. We handle 5xx errors via reportError in
- // handleTrpcError and use DataDog for additional server-side logging.
- enabled: () => process.env.NODE_ENV === "development",
- }),
- splitLink({
- condition: shouldSendQueryAsPost,
- true: postOverrideHttpLink(),
- false: httpBatchLink({
- url: trpcApiUrl(),
- transformer: superjson,
- maxURLLength: 2083, // avoid too large batches
- fetch: fetchWithParseErrorStatus,
- }),
- }),
- ],
-});
-
/**
* Inference helper for inputs.
*
diff --git a/web/src/utils/chatml/adapters/index.ts b/web/src/utils/chatml/adapters/index.ts
index 9e1e35851e..88046cc73f 100644
--- a/web/src/utils/chatml/adapters/index.ts
+++ b/web/src/utils/chatml/adapters/index.ts
@@ -1,14 +1,2 @@
// Re-export everything from shared
-export {
- selectAdapter,
- langgraphAdapter,
- aisdkAdapter,
- openAIAdapter,
- geminiAdapter,
- microsoftAgentAdapter,
- pydanticAIAdapter,
- semanticKernelAdapter,
- genericAdapter,
- normalizeInput,
- normalizeOutput,
-} from "@langfuse/shared";
+export { normalizeInput, normalizeOutput } from "@langfuse/shared";
diff --git a/web/src/utils/chatml/index.ts b/web/src/utils/chatml/index.ts
index 2b4f743e88..914cc7a684 100644
--- a/web/src/utils/chatml/index.ts
+++ b/web/src/utils/chatml/index.ts
@@ -1,13 +1,10 @@
// Re-export from shared (core functions moved to enable worker testing)
export {
- mapToChatMl,
- mapOutputToChatMl,
cleanLegacyOutput,
extractAdditionalInput,
combineInputOutputMessages,
normalizeInput,
normalizeOutput,
- selectAdapter,
type NormalizerContext,
type ProviderAdapter,
type ToolEvent,
diff --git a/web/src/utils/date-range-utils.ts b/web/src/utils/date-range-utils.ts
index b6f552347b..69fed64379 100644
--- a/web/src/utils/date-range-utils.ts
+++ b/web/src/utils/date-range-utils.ts
@@ -30,7 +30,6 @@ const ABBREVIATION_TO_KEY = new Map(
export const DEFAULT_DASHBOARD_AGGREGATION_SELECTION = "last1Day" as const;
export const DASHBOARD_AGGREGATION_PLACEHOLDER = "custom" as const;
-export const TABLE_AGGREGATION_PLACEHOLDER = "custom" as const;
export const DASHBOARD_AGGREGATION_OPTIONS = [
"last5Minutes",
@@ -65,20 +64,13 @@ export type DashboardDateRangeOptions =
| DashboardDateRangeAggregationOption
| typeof DASHBOARD_AGGREGATION_PLACEHOLDER;
-export type TableDateRangeOptions =
- | TableDateRangeAggregationOption
- | typeof TABLE_AGGREGATION_PLACEHOLDER;
+export type TableDateRangeOptions = TableDateRangeAggregationOption | "custom";
export type DashboardDateRangeAggregationSettings = Record<
DashboardDateRangeAggregationOption,
TimeRangeDefinition
>;
-export const dateTimeAggregationOptions = [
- ...TABLE_AGGREGATION_OPTIONS,
- ...DASHBOARD_AGGREGATION_OPTIONS,
-] as const;
-
export const dashboardDateRangeAggregationSettings: DashboardDateRangeAggregationSettings =
Object.fromEntries(
DASHBOARD_AGGREGATION_OPTIONS.map((option) => [
@@ -126,21 +118,6 @@ const TABLE_DATE_RANGE_AGGREGATION_SETTINGS = new Map<
]),
);
-export const isTableDataRangeOptionAvailable = ({
- option,
- limitDays,
-}: {
- option: TableDateRangeAggregationOption;
- limitDays: number | false;
-}) => {
- if (limitDays === false) return true;
-
- const durationMinutes = TABLE_DATE_RANGE_AGGREGATION_SETTINGS.get(option);
- if (!durationMinutes) return false;
-
- return limitDays >= durationMinutes / (24 * 60);
-};
-
export const getDateFromOption = (
selectedTimeOption: SelectedTimeOption,
): Date | undefined => {
@@ -164,21 +141,7 @@ export const getDateFromOption = (
return undefined;
};
-export function isValidDashboardDateRangeAggregationOption(
- value?: string,
-): value is DashboardDateRangeAggregationOption {
- if (!value) return false;
- return (DASHBOARD_AGGREGATION_OPTIONS as readonly string[]).includes(value);
-}
-
-export function isValidTableDateRangeAggregationOption(
- value?: string,
-): value is TableDateRangeAggregationOption {
- if (!value) return false;
- return (TABLE_AGGREGATION_OPTIONS as readonly string[]).includes(value);
-}
-
-export function getFullTimeRangeFromAbbreviated(
+function getFullTimeRangeFromAbbreviated(
abbreviated: string,
): DateRangeAggregationOption | null {
return (
@@ -210,14 +173,14 @@ export const findClosestDashboardInterval = (
};
// Helper function to check if time represents full day
-export const isFullDay = (date: Date) => {
+const isFullDay = (date: Date) => {
return (
date.getHours() === 0 && date.getMinutes() === 0 && date.getSeconds() === 0
);
};
// Helper function to check if date range represents full days
-export const isFullDayRange = (from: Date, to: Date) => {
+const isFullDayRange = (from: Date, to: Date) => {
return (
isFullDay(from) &&
to.getHours() === 23 &&
@@ -277,7 +240,7 @@ export type IntervalConfig = {
* Allowed intervals - only "clean" values to avoid crooked numbers
* These are the only intervals that can be selected by the algorithm
*/
-export const ALLOWED_INTERVALS: readonly IntervalConfig[] = [
+const ALLOWED_INTERVALS: readonly IntervalConfig[] = [
// Seconds
{ count: 1, unit: "second" },
{ count: 5, unit: "second" },
@@ -420,69 +383,6 @@ export function getOptimalInterval(
return bestInterval;
}
-/**
- * Determines the optimal interval for score analytics based on time range.
- * Maps time ranges to appropriate intervals for ClickHouse aggregation.
- *
- * Target: 20-50 data points for optimal visualization
- *
- * @param timeRange - The time range (relative or absolute)
- * @returns Interval suitable for score analytics API ("hour" | "day" | "week" | "month")
- */
-export function getScoreAnalyticsInterval(
- timeRange: TimeRange,
-): "hour" | "day" | "week" | "month" {
- // Handle preset ranges
- if ("range" in timeRange) {
- const preset = TIME_RANGES[timeRange.range as keyof typeof TIME_RANGES];
-
- if (!preset) {
- return "day"; // Fallback
- }
-
- // Map dateTrunc to interval (note: API doesn't support "minute")
- switch (preset.dateTrunc) {
- case "minute":
- case "hour":
- return "hour";
- case "day":
- return "day";
- case "week":
- return "week";
- case "month":
- return "month";
- default:
- return "day"; // Fallback
- }
- }
-
- // Handle custom ranges
- const absoluteRange = toAbsoluteTimeRange(timeRange);
- if (!absoluteRange) {
- return "day"; // Fallback
- }
-
- const durationMs = absoluteRange.to.getTime() - absoluteRange.from.getTime();
- const durationMinutes = durationMs / (1000 * 60);
-
- // Calculate based on duration to get ~20-50 data points
- // < 7 days → hour (yields 1-168 points)
- if (durationMinutes < 7 * 24 * 60) {
- return "hour";
- }
- // 7-90 days → day (yields 7-90 points)
- else if (durationMinutes < 90 * 24 * 60) {
- return "day";
- }
- // 90 days - 1 year → week (yields 13-52 points)
- else if (durationMinutes < 365 * 24 * 60) {
- return "week";
- }
- // > 1 year → month (yields 12+ points)
-
- return "month";
-}
-
/**
* Parses a string back to a range object with validation
* - Handles both abbreviated ("7d") and full ("last7Days") named ranges
@@ -673,4 +573,3 @@ export function getChartTooltipFormat(
}
// Re-export fillTimeSeriesGaps from its own module
-export { fillTimeSeriesGaps } from "./fill-time-series-gaps";
diff --git a/web/src/utils/dates.ts b/web/src/utils/dates.ts
index 337982798b..0b43f86b54 100644
--- a/web/src/utils/dates.ts
+++ b/web/src/utils/dates.ts
@@ -1,25 +1,3 @@
-export const utcDateOffsetByDays = (days: number) => {
- const date = new Date();
- date.setUTCHours(0, 0, 0, 0);
- date.setUTCDate(date.getUTCDate() + days);
- return date;
-};
-
-export const localtimeDateOffsetByDays = (days: number) => {
- const date = new Date();
- date.setHours(0, 0, 0, 0);
- date.setDate(date.getDate() + days);
- return date;
-};
-export const utcDate = (localDateTime: Date) =>
- new Date(
- Date.UTC(
- localDateTime.getFullYear(),
- localDateTime.getMonth(),
- localDateTime.getDate(),
- ),
- );
-
export const setBeginningOfDay = (date: Date) => {
const newDate = new Date(date);
newDate.setHours(0, 0, 0, 0);
@@ -32,9 +10,6 @@ export const setEndOfDay = (date: Date) => {
return newDate;
};
-export const intervalInSeconds = (start: Date, end: Date | null) =>
- end ? (end.getTime() - start.getTime()) / 1000 : 0;
-
export const formatIntervalSeconds = (seconds: number, scale = 2) => {
const hrs = Math.floor(seconds / 3600);
const mins = Math.floor((seconds % 3600) / 60);
diff --git a/web/src/utils/numbers.ts b/web/src/utils/numbers.ts
index 5b7e2f3bc2..1dde00ee10 100644
--- a/web/src/utils/numbers.ts
+++ b/web/src/utils/numbers.ts
@@ -92,7 +92,3 @@ export const formatTokenCounts = (
? `${numberFormatter(inputUsage ?? 0, 0)} prompt → ${numberFormatter(outputUsage ?? 0, 0)} completion (∑ ${numberFormatter(totalUsage ?? 0, 0)})`
: `${numberFormatter(inputUsage ?? 0, 0)} → ${numberFormatter(outputUsage ?? 0, 0)} (∑ ${numberFormatter(totalUsage ?? 0, 0)})`;
};
-
-export function randomIntFromInterval(min: number, max: number) {
- return Math.floor(Math.random() * (max - min + 1) + min);
-}
diff --git a/web/src/utils/outside-interaction.ts b/web/src/utils/outside-interaction.ts
index 185ac58489..7fe3517297 100644
--- a/web/src/utils/outside-interaction.ts
+++ b/web/src/utils/outside-interaction.ts
@@ -1,7 +1,6 @@
-export const IGNORE_OUTSIDE_INTERACTION_ATTRIBUTE =
- "data-ignore-outside-interaction";
+const IGNORE_OUTSIDE_INTERACTION_ATTRIBUTE = "data-ignore-outside-interaction";
-export const IGNORE_OUTSIDE_INTERACTION_SELECTOR = `[${IGNORE_OUTSIDE_INTERACTION_ATTRIBUTE}]`;
+const IGNORE_OUTSIDE_INTERACTION_SELECTOR = `[${IGNORE_OUTSIDE_INTERACTION_ATTRIBUTE}]`;
export function shouldIgnoreOutsideInteraction(target: EventTarget | null) {
return (
diff --git a/web/src/utils/reportError.ts b/web/src/utils/reportError.ts
index 7750904233..e679d7d38b 100644
--- a/web/src/utils/reportError.ts
+++ b/web/src/utils/reportError.ts
@@ -42,7 +42,7 @@ function describeUnknown(value: unknown): string {
* `[area] <readable value>` (never `[object Object]`), so the synthesized event
* both groups by `area` and stays diagnosable.
*/
-export function coerceToError(area: string, value: unknown): Error {
+function coerceToError(area: string, value: unknown): Error {
return value instanceof Error
? value
: new Error(
diff --git a/web/src/utils/sentryFilters.ts b/web/src/utils/sentryFilters.ts
index d034a9800d..a38328e75a 100644
--- a/web/src/utils/sentryFilters.ts
+++ b/web/src/utils/sentryFilters.ts
@@ -15,7 +15,7 @@ import { type ErrorEvent } from "@sentry/nextjs";
* Matched by URL path SUFFIX so an optional `NEXT_PUBLIC_BASE_PATH` prefix
* (e.g. `/self-hosted/api/auth/session`) still matches.
*/
-export const HTTP_CLIENT_NOISE_PATHS = [
+const HTTP_CLIENT_NOISE_PATHS = [
"/api/auth/session", // NextAuth session poll (5-min interval + on window focus)
// The two probes below are defensive/inert: they are only fetched by infra
// liveness/readiness checks, never by the browser, so they cannot actually
diff --git a/web/src/utils/shutdown.ts b/web/src/utils/shutdown.ts
index d01e2c5ca5..356b51df81 100644
--- a/web/src/utils/shutdown.ts
+++ b/web/src/utils/shutdown.ts
@@ -20,7 +20,7 @@ declare global {
globalThis.sigtermReceived = globalThis.sigtermReceived ?? false;
-export const setSigtermReceived = () => {
+const setSigtermReceived = () => {
console.log("Set sigterm received to true");
globalThis.sigtermReceived = true;
};
diff --git a/web/src/utils/string.ts b/web/src/utils/string.ts
index e7d0fe6ab0..072a2e4e1e 100644
--- a/web/src/utils/string.ts
+++ b/web/src/utils/string.ts
@@ -1,5 +1 @@
export { truncate } from "@langfuse/shared";
-
-export function lastCharacters(str: string, n: number) {
- return str.substring(str.length - n);
-}
diff --git a/web/src/utils/trpcValidationError.ts b/web/src/utils/trpcValidationError.ts
index 19d6046cd9..c7203337bf 100644
--- a/web/src/utils/trpcValidationError.ts
+++ b/web/src/utils/trpcValidationError.ts
@@ -30,7 +30,7 @@ const formatPath = (path: unknown): string => {
* Zod 4's `ZodError.message` is a JSON array of issues. tRPC puts that string
* on `TRPCClientError.message`, which is what the global error toast shows.
*/
-export const parseZodIssueList = (
+const parseZodIssueList = (
message: string,
): Array<{ path: unknown; message: string }> | null => {
const trimmed = message.trim();
diff --git a/web/src/utils/types.ts b/web/src/utils/types.ts
index b96d888aaa..01ccf33648 100644
--- a/web/src/utils/types.ts
+++ b/web/src/utils/types.ts
@@ -69,7 +69,7 @@ export type Guardrail = Observation & {
export type RouterInput = inferRouterInputs<AppRouter>;
export type RouterOutput = inferRouterOutputs<AppRouter>;
-export const isUndefinedOrNull = <T>(val?: T | null): val is undefined | null =>
+const isUndefinedOrNull = <T>(val?: T | null): val is undefined | null =>
val === undefined || val === null;
export const isNotNullOrUndefined = <T>(
diff --git a/worker/src/backgroundMigrations/utils/backfillBase.ts b/worker/src/backgroundMigrations/utils/backfillBase.ts
index 8862a7c802..45f4003628 100644
--- a/worker/src/backgroundMigrations/utils/backfillBase.ts
+++ b/worker/src/backgroundMigrations/utils/backfillBase.ts
@@ -61,7 +61,7 @@ export interface ChunkedBackfillState<T extends BaseChunkTodo> {
// Helpers
// ============================================================================
-export function generateQueryId(chunkId: string): string {
+function generateQueryId(chunkId: string): string {
return `backfill-${chunkId}-${randomUUID().slice(0, 8)}`;
}
@@ -244,7 +244,7 @@ export interface FireQueryOptions {
* system.processes, then aborts the HTTP connection so the query continues
* server-side and we poll for completion via pollQueryStatus.
*/
-export async function fireQuery({
+async function fireQuery({
query,
queryId,
params,
@@ -357,7 +357,7 @@ export async function fireQuery({
* Returns the subset that ClickHouse still reports as running so the caller
* can keep tracking them.
*/
-export async function recoverInProgressTodos<T extends BaseChunkTodo>(
+async function recoverInProgressTodos<T extends BaseChunkTodo>(
todos: T[],
logPrefix = "[Backfill]",
): Promise<T[]> {
diff --git a/worker/src/backgroundMigrations/utils/v4BackfillDdl.ts b/worker/src/backgroundMigrations/utils/v4BackfillDdl.ts
index c3a9c81907..cbc5d1d5c3 100644
--- a/worker/src/backgroundMigrations/utils/v4BackfillDdl.ts
+++ b/worker/src/backgroundMigrations/utils/v4BackfillDdl.ts
@@ -22,7 +22,7 @@ export interface ClickhouseDdlTarget {
clusterName: string;
}
-export function clickhouseDdlTarget(): ClickhouseDdlTarget {
+function clickhouseDdlTarget(): ClickhouseDdlTarget {
return {
database: env.CLICKHOUSE_DB,
clusterEnabled: env.CLICKHOUSE_CLUSTER_ENABLED === "true",
diff --git a/worker/src/ee/usageThresholds/constants.ts b/worker/src/ee/usageThresholds/constants.ts
index 4fdcca7d63..de37a0d5dd 100644
--- a/worker/src/ee/usageThresholds/constants.ts
+++ b/worker/src/ee/usageThresholds/constants.ts
@@ -25,14 +25,6 @@ export const NOTIFICATION_THRESHOLDS = [
*/
export const BLOCKING_THRESHOLD = MAX_EVENTS_FREE_PLAN * 5; // 250,000
-/**
- * All thresholds combined for validation
- */
-export const ALL_THRESHOLDS = [
- ...NOTIFICATION_THRESHOLDS,
- BLOCKING_THRESHOLD,
-] as const;
-
export type NotificationThreshold = (typeof NOTIFICATION_THRESHOLDS)[number];
export type BlockingThreshold = typeof BLOCKING_THRESHOLD;
-export type Threshold = (typeof ALL_THRESHOLDS)[number];
+export type Threshold = NotificationThreshold | BlockingThreshold;
diff --git a/worker/src/ee/usageThresholds/usageAggregation.ts b/worker/src/ee/usageThresholds/usageAggregation.ts
index 815e4caccc..7d96f08678 100644
--- a/worker/src/ee/usageThresholds/usageAggregation.ts
+++ b/worker/src/ee/usageThresholds/usageAggregation.ts
@@ -390,4 +390,4 @@ export async function processUsageAggregationForAllOrgs(
}
// Export helper functions for testing
-export { buildProjectToOrgMap, fetchAllOrgsWithBillingInfo, aggregateByOrg };
+export { buildProjectToOrgMap, aggregateByOrg };
diff --git a/worker/src/env.ts b/worker/src/env.ts
index c7d45822e3..efec00b92e 100644
--- a/worker/src/env.ts
+++ b/worker/src/env.ts
@@ -686,7 +686,7 @@ export const v4WritesToLegacyTables = (envValue: ParsedEnv): boolean =>
export const v4ForceDirectOtelWrite = (envValue: ParsedEnv): boolean =>
envValue.LANGFUSE_MIGRATION_V4_NATIVE_OTEL_BEHAVIOUR === "direct";
-export const v4AllowPreviewOptIn = (envValue: ParsedEnv): boolean =>
+const v4AllowPreviewOptIn = (envValue: ParsedEnv): boolean =>
envValue.LANGFUSE_MIGRATION_V4_ALLOW_PREVIEW_OPT_IN === "true";
const validateV4Flags = (parsed: ParsedEnv): void => {
diff --git a/worker/src/features/batch-data-retention-cleaner/index.ts b/worker/src/features/batch-data-retention-cleaner/index.ts
index 820ee00f69..89c15222db 100644
--- a/worker/src/features/batch-data-retention-cleaner/index.ts
+++ b/worker/src/features/batch-data-retention-cleaner/index.ts
@@ -34,7 +34,7 @@ export type BatchDataRetentionTable =
const METRIC_PREFIX = "langfuse.batch_data_retention_cleaner";
-export const BATCH_DATA_RETENTION_CLEANER_LOCK_PREFIX =
+const BATCH_DATA_RETENTION_CLEANER_LOCK_PREFIX =
"langfuse:batch-data-retention-cleaner";
export const TIMESTAMP_COLUMN_MAP: Record<BatchDataRetentionTable, string> = {
diff --git a/worker/src/features/batch-trace-deletion-cleaner/index.ts b/worker/src/features/batch-trace-deletion-cleaner/index.ts
index 66312037e3..8b628d3f4f 100644
--- a/worker/src/features/batch-trace-deletion-cleaner/index.ts
+++ b/worker/src/features/batch-trace-deletion-cleaner/index.ts
@@ -7,7 +7,7 @@ import { processPostgresTraceDelete } from "../traces/processPostgresTraceDelete
const METRIC_PREFIX = "langfuse.batch_trace_deletion_cleaner";
-export const BATCH_TRACE_DELETION_CLEANER_LOCK_KEY =
+const BATCH_TRACE_DELETION_CLEANER_LOCK_KEY =
"langfuse:batch-trace-deletion-cleaner";
interface ProjectWorkload {
diff --git a/worker/src/features/batchAction/processTraceDeleteBatchAction.ts b/worker/src/features/batchAction/processTraceDeleteBatchAction.ts
index 256384d166..2a0c94f7fa 100644
--- a/worker/src/features/batchAction/processTraceDeleteBatchAction.ts
+++ b/worker/src/features/batchAction/processTraceDeleteBatchAction.ts
@@ -32,8 +32,8 @@ type TraceDeleteBatchActionState = {
config: TraceDeleteBatchActionConfig;
};
-export const TRACE_DELETE_BATCH_ACTION_MAX_BATCHES_PER_RUN = 5;
-export const TRACE_DELETE_BATCH_ACTION_MAX_FAILURES = 10;
+const TRACE_DELETE_BATCH_ACTION_MAX_BATCHES_PER_RUN = 5;
+const TRACE_DELETE_BATCH_ACTION_MAX_FAILURES = 10;
export type ProcessTraceDeleteBatchActionResult =
| {
diff --git a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
index bab1b99f39..ae4d8eab25 100644
--- a/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
+++ b/worker/src/features/blobstorage/handleBlobStorageIntegrationProjectJob.ts
@@ -86,7 +86,7 @@ import {
buildBlobExportDeprecationNoticeKey,
} from "./deprecationNotice";
-export const BlobExportFormat = {
+const BlobExportFormat = {
JSON_RAW: "json-raw",
JSON_GZIP: "json-gzip",
CSV_RAW: "csv-raw",
@@ -97,7 +97,7 @@ export const BlobExportFormat = {
// Parquet, so there is no separate raw/gzip split.
PARQUET: "parquet",
} as const;
-export type BlobExportFormat =
+type BlobExportFormat =
(typeof BlobExportFormat)[keyof typeof BlobExportFormat];
// Text formats only; PARQUET is absent because callers branch on parquetEligible first.
diff --git a/worker/src/features/deleted-mask-cleaner/helpers.ts b/worker/src/features/deleted-mask-cleaner/helpers.ts
index e8195cab60..af4ef43c53 100644
--- a/worker/src/features/deleted-mask-cleaner/helpers.ts
+++ b/worker/src/features/deleted-mask-cleaner/helpers.ts
@@ -62,7 +62,7 @@ export const DELETED_MASK_CLEANER_WORK_QUERY = `
LIMIT 1 BY table
`;
-export function isDeletedMaskCleanerTable(table: string): boolean {
+function isDeletedMaskCleanerTable(table: string): boolean {
return DELETED_MASK_CLEANER_TABLE_SET.has(table);
}
diff --git a/worker/src/features/evaluation/observationEval/types.ts b/worker/src/features/evaluation/observationEval/types.ts
index 126d597541..06bcf4b35e 100644
--- a/worker/src/features/evaluation/observationEval/types.ts
+++ b/worker/src/features/evaluation/observationEval/types.ts
@@ -16,12 +16,7 @@ import type { EvalTargetObject, FilterState } from "@langfuse/shared";
*
* @see packages/shared/src/features/evals/observationForEval.ts for schema definition
*/
-export {
- type ObservationForEval,
- observationForEvalSchema,
- observationEvalFilterColumns,
- observationEvalVariableColumns,
-} from "@langfuse/shared";
+export { type ObservationForEval } from "@langfuse/shared";
/**
* Observation eval job configuration.
diff --git a/worker/src/features/eventPropagation/handleEventPropagationJob.ts b/worker/src/features/eventPropagation/handleEventPropagationJob.ts
index 2eea9bc5f1..d52fa67fd8 100644
--- a/worker/src/features/eventPropagation/handleEventPropagationJob.ts
+++ b/worker/src/features/eventPropagation/handleEventPropagationJob.ts
@@ -69,7 +69,7 @@ export const getLastProcessedPartition = async (): Promise<string | null> => {
* Update the last processed partition timestamp in Redis.
* This is called after successfully processing a partition.
*/
-export const updateLastProcessedPartition = async (
+const updateLastProcessedPartition = async (
partition: string,
): Promise<void> => {
try {
diff --git a/worker/src/features/eventPropagation/handleExperimentBackfill.ts b/worker/src/features/eventPropagation/handleExperimentBackfill.ts
index 6d54cc5b70..c197d70377 100644
--- a/worker/src/features/eventPropagation/handleExperimentBackfill.ts
+++ b/worker/src/features/eventPropagation/handleExperimentBackfill.ts
@@ -118,7 +118,7 @@ export interface TraceProperties {
* Fetch dataset run items created within a time window.
* Deduplicates by (project_id, trace_id, observation_id) taking the most recent.
*/
-export async function getDatasetRunItemsSinceLastRun(
+async function getDatasetRunItemsSinceLastRun(
lastRun: Date,
upperBound: Date,
): Promise<DatasetRunItem[]> {
@@ -178,7 +178,7 @@ export async function getDatasetRunItemsSinceLastRun(
/**
* Fetch observations that belong to traces referenced by dataset run items.
*/
-export async function getRelevantObservations(
+async function getRelevantObservations(
projectIds: string[],
traceIds: string[],
minTime: Date,
@@ -260,7 +260,7 @@ export async function getRelevantObservations(
/**
* Fetch traces that are referenced by dataset run items.
*/
-export async function getRelevantTraces(
+async function getRelevantTraces(
projectIds: string[],
traceIds: string[],
minTime: Date,
@@ -661,7 +661,7 @@ export function convertEnrichedSpansToEventRecords(
* Write enriched spans to the events_full table via the ClickhouseWriter
* queue (buffered; flushed by the writer's interval).
*/
-export function writeEnrichedSpans(spans: EnrichedSpan[]): void {
+function writeEnrichedSpans(spans: EnrichedSpan[]): void {
if (spans.length === 0) {
return;
}
@@ -682,7 +682,7 @@ export function writeEnrichedSpans(spans: EnrichedSpan[]): void {
*
* @returns The cutoff timestamp to use for backfill queries
*/
-export async function initializeBackfillCutoff(): Promise<Date> {
+async function initializeBackfillCutoff(): Promise<Date> {
if (!redis) {
logger.error(
"[EXPERIMENT BACKFILL] Redis not available, using current time as cutoff",
@@ -741,7 +741,7 @@ export async function initializeBackfillCutoff(): Promise<Date> {
*
* @returns true if backfill should run (time threshold passed AND lock acquired), false otherwise
*/
-export async function shouldRunBackfill(lastRun: Date): Promise<boolean> {
+async function shouldRunBackfill(lastRun: Date): Promise<boolean> {
// First check time-based throttle
const now = new Date();
const timeSinceLastRun = now.getTime() - lastRun.getTime();
@@ -798,7 +798,7 @@ export async function shouldRunBackfill(lastRun: Date): Promise<boolean> {
* Update the experiment backfill timestamp after successful execution.
* @param timestamp The timestamp to set (should be the upper bound used for the backfill)
*/
-export async function updateBackfillTimestamp(timestamp: Date): Promise<void> {
+async function updateBackfillTimestamp(timestamp: Date): Promise<void> {
if (!redis) {
logger.warn(
"[EXPERIMENT BACKFILL] Redis not available, cannot update timestamp",
diff --git a/worker/src/features/experiments/utils.ts b/worker/src/features/experiments/utils.ts
index 887a3da9f6..8def41d4d3 100644
--- a/worker/src/features/experiments/utils.ts
+++ b/worker/src/features/experiments/utils.ts
@@ -51,10 +51,7 @@ export const parseDatasetItemInput = (
}
};
-export const fetchDatasetRun = async (
- datasetRunId: string,
- projectId: string,
-) => {
+const fetchDatasetRun = async (datasetRunId: string, projectId: string) => {
return await prisma.datasetRuns.findFirst({
where: {
id: datasetRunId,
@@ -63,7 +60,7 @@ export const fetchDatasetRun = async (
});
};
-export const fetchPrompt = async (promptId: string, projectId: string) => {
+const fetchPrompt = async (promptId: string, projectId: string) => {
const promptService = new PromptService(prisma, redis);
const rawPrompt = await prisma.prompt.findUnique({
diff --git a/worker/src/features/health/queueConsumption.ts b/worker/src/features/health/queueConsumption.ts
index e18d338b37..3e85c5ed17 100644
--- a/worker/src/features/health/queueConsumption.ts
+++ b/worker/src/features/health/queueConsumption.ts
@@ -56,7 +56,7 @@ export const resetQueueConsumptionStateForTest = (): void => {
* a fresh boot gets a full threshold of grace before the probe may fail, and a
* container without any registered consumers (API-only) is never stuck.
*/
-export const evaluateQueueConsumptionStuck = (input: {
+const evaluateQueueConsumptionStuck = (input: {
nowMs: number;
registeredWorkerCount: number;
trackingSinceMs: number | null;
diff --git a/worker/src/features/in-app-agent-dlq-retry-runner/index.ts b/worker/src/features/in-app-agent-dlq-retry-runner/index.ts
index e0337c49af..6abbf3c71e 100644
--- a/worker/src/features/in-app-agent-dlq-retry-runner/index.ts
+++ b/worker/src/features/in-app-agent-dlq-retry-runner/index.ts
@@ -5,8 +5,7 @@ import { getQueue, logger, QueueName } from "@langfuse/shared/src/server";
import { env } from "../../env";
import { PeriodicExclusiveRunner } from "../../utils/PeriodicExclusiveRunner";
-export const IN_APP_AGENT_DLQ_RETRY_LOCK_KEY =
- "langfuse:in-app-agent-dlq-retry";
+const IN_APP_AGENT_DLQ_RETRY_LOCK_KEY = "langfuse:in-app-agent-dlq-retry";
const LOCK_TTL_SECONDS = 120;
@@ -80,7 +79,7 @@ export class InAppAgentDlqRetryRunner extends PeriodicExclusiveRunner {
}
}
-export function isFailedInAppAgentJobReadyToRetry(
+function isFailedInAppAgentJobReadyToRetry(
job: Pick<Job, "finishedOn">,
nowMs: number,
): boolean {
diff --git a/worker/src/features/in-app-agent-integrity-runner/index.ts b/worker/src/features/in-app-agent-integrity-runner/index.ts
index 064b204b98..b7366a0849 100644
--- a/worker/src/features/in-app-agent-integrity-runner/index.ts
+++ b/worker/src/features/in-app-agent-integrity-runner/index.ts
@@ -23,7 +23,7 @@ import { PeriodicExclusiveRunner } from "../../utils/PeriodicExclusiveRunner";
const METRIC_PREFIX = "langfuse.in_app_agent";
-export const IN_APP_AGENT_INTEGRITY_RUNNER_LOCK_KEY =
+const IN_APP_AGENT_INTEGRITY_RUNNER_LOCK_KEY =
"langfuse:in-app-agent-integrity-runner";
const LOCK_TTL_SECONDS = 120;
diff --git a/worker/src/features/in-app-agent/runtime/human-in-the-loop.ts b/worker/src/features/in-app-agent/runtime/human-in-the-loop.ts
index 1a4a5f4da5..d15b0bd7d6 100644
--- a/worker/src/features/in-app-agent/runtime/human-in-the-loop.ts
+++ b/worker/src/features/in-app-agent/runtime/human-in-the-loop.ts
@@ -178,7 +178,7 @@ function getResumeForwardedProps(
return forwardedProps;
}
-export function createManualToolCallAssistantMessage(
+function createManualToolCallAssistantMessage(
approvalRequest: InAppAgentToolApprovalRequest,
): AgUiMessage {
return {
@@ -218,7 +218,7 @@ function createToolExecutionErrorGuidanceMessage(
};
}
-export function createManualToolApprovalEvents(params: {
+function createManualToolApprovalEvents(params: {
approvalRequest: InAppAgentToolApprovalRequest;
toolResultContent: string;
toolError?: string;
diff --git a/worker/src/features/in-app-agent/runtime/mcpRateLimitWait.ts b/worker/src/features/in-app-agent/runtime/mcpRateLimitWait.ts
index af7576fe58..89bd623b8f 100644
--- a/worker/src/features/in-app-agent/runtime/mcpRateLimitWait.ts
+++ b/worker/src/features/in-app-agent/runtime/mcpRateLimitWait.ts
@@ -2,7 +2,7 @@ import { InAppAgentRateLimitErrorResponseSchema } from "@langfuse/shared/in-app-
import { logger, recordIncrement } from "@langfuse/shared/src/server";
/** Total time a single MCP operation may spend waiting out rate limits. */
-export const IN_APP_AGENT_MCP_RATE_LIMIT_WAIT_BUDGET_MS = 60_000;
+const IN_APP_AGENT_MCP_RATE_LIMIT_WAIT_BUDGET_MS = 60_000;
const MCP_RATE_LIMIT_WAIT_METRIC = "langfuse.in_app_agent.mcp_rate_limit_wait";
diff --git a/worker/src/features/in-app-agent/runtime/sandbox/index.ts b/worker/src/features/in-app-agent/runtime/sandbox/index.ts
index b709c76427..e235b6055a 100644
--- a/worker/src/features/in-app-agent/runtime/sandbox/index.ts
+++ b/worker/src/features/in-app-agent/runtime/sandbox/index.ts
@@ -1,5 +1,3 @@
-export { createLambdaMicrovmSandboxProvider } from "./providers/lambdaMicrovm";
-export { getDefaultInAppAgentSandboxProviderType } from "./config";
export { createInAppAgentSandbox } from "./service";
export type {
InAppAgentSandbox,
diff --git a/worker/src/features/media-retention-cleaner/index.ts b/worker/src/features/media-retention-cleaner/index.ts
index 437172b50b..1cb60f732b 100644
--- a/worker/src/features/media-retention-cleaner/index.ts
+++ b/worker/src/features/media-retention-cleaner/index.ts
@@ -14,8 +14,7 @@ import { PeriodicExclusiveRunner } from "../../utils/PeriodicExclusiveRunner";
const METRIC_PREFIX = "langfuse.media_retention_cleaner";
-export const MEDIA_RETENTION_CLEANER_LOCK_KEY =
- "langfuse:media-retention-cleaner";
+const MEDIA_RETENTION_CLEANER_LOCK_KEY = "langfuse:media-retention-cleaner";
/**
* MediaRetentionCleaner handles periodic deletion of media files and blob storage
diff --git a/worker/src/features/trace-delete-batch-action-runner/index.ts b/worker/src/features/trace-delete-batch-action-runner/index.ts
index 8f7588112d..af00ab945c 100644
--- a/worker/src/features/trace-delete-batch-action-runner/index.ts
+++ b/worker/src/features/trace-delete-batch-action-runner/index.ts
@@ -16,7 +16,7 @@ import { processTraceDeleteBatchAction } from "../batchAction/processTraceDelete
const METRIC_PREFIX = "langfuse.trace_delete_batch_action_runner";
-export const TRACE_DELETE_BATCH_ACTION_RUNNER_LOCK_KEY =
+const TRACE_DELETE_BATCH_ACTION_RUNNER_LOCK_KEY =
"langfuse:trace-delete-batch-action-runner";
const ACTIVE_BATCH_ACTION_STATUSES = [
diff --git a/worker/src/features/v4/handleV4LegacyApiUsageJob.ts b/worker/src/features/v4/handleV4LegacyApiUsageJob.ts
index f11cc09817..ab7d823658 100644
--- a/worker/src/features/v4/handleV4LegacyApiUsageJob.ts
+++ b/worker/src/features/v4/handleV4LegacyApiUsageJob.ts
@@ -55,7 +55,7 @@ const HOUR_MS = 60 * 60 * 1000;
* ClickHouse client request timeout (and derived max_execution_time) above
* the shared 30s default.
*/
-export const V4_LEGACY_API_USAGE_QUERY_TIMEOUT_MS = 10 * 60 * 1000;
+const V4_LEGACY_API_USAGE_QUERY_TIMEOUT_MS = 10 * 60 * 1000;
const EXPERIMENT_POST_ROUTE = "POST /api/public/dataset-run-items";
diff --git a/worker/src/queues/otelIngestionQueue.ts b/worker/src/queues/otelIngestionQueue.ts
index b6aa3e0a52..b4da0b5c16 100644
--- a/worker/src/queues/otelIngestionQueue.ts
+++ b/worker/src/queues/otelIngestionQueue.ts
@@ -247,7 +247,7 @@ function isOtelDirectWriteOrgCutoffConfigured(): boolean {
* enqueued before that field existed resolve too. Returns false when the
* project cannot be found, which keeps the batch on its existing path.
*/
-export async function isProjectOrgPastOtelDirectWriteCutoff(
+async function isProjectOrgPastOtelDirectWriteCutoff(
projectId: string,
): Promise<boolean> {
if (!isOtelDirectWriteOrgCutoffConfigured()) {
diff --git a/worker/src/scripts/upsertDefaultModelPrices.ts b/worker/src/scripts/upsertDefaultModelPrices.ts
index 5e44cd8bd1..109e3a06f1 100644
--- a/worker/src/scripts/upsertDefaultModelPrices.ts
+++ b/worker/src/scripts/upsertDefaultModelPrices.ts
@@ -7,7 +7,7 @@ import {
validatePricingTiers,
} from "@langfuse/shared";
-export const PricingTierSchema = z.object({
+const PricingTierSchema = z.object({
id: z.string(),
name: z.string(),
isDefault: z.boolean(),
@@ -16,7 +16,7 @@ export const PricingTierSchema = z.object({
prices: z.record(z.string(), z.number()),
});
-export const DefaultModelPriceSchema = z
+const DefaultModelPriceSchema = z
.object({
id: z.string(),
modelName: z.string(),