Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
Feat: refine sidebar and feature page headers (#1297)
Aman Agarwal5b63d354992f
diff --git a/src/client/package-lock.json b/src/client/package-lock.jsonindex 63920936..923ae403 100644--- a/src/client/package-lock.json+++ b/src/client/package-lock.json@@ -1,12 +1,12 @@{"name": "openlit",- "version": "1.22.0",+ "version": "1.23.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openlit",- "version": "1.22.0",+ "version": "1.23.0","dependencies": {"@ai-sdk/anthropic": "^3.0.6","@ai-sdk/cohere": "^3.0.3",diff --git a/src/client/package.json b/src/client/package.jsonindex 35f84908..0d7ac246 100644--- a/src/client/package.json+++ b/src/client/package.json@@ -1,6 +1,6 @@{"name": "openlit",- "version": "1.22.0",+ "version": "1.23.0","private": true,"scripts": {"dev": "next dev",diff --git a/src/client/src/__tests__/components/project-page-header.test.tsx b/src/client/src/__tests__/components/project-page-header.test.tsxnew file mode 100644index 00000000..41d244c1--- /dev/null+++ b/src/client/src/__tests__/components/project-page-header.test.tsx@@ -0,0 +1,30 @@+import { render, screen } from "@testing-library/react";+import ProjectPageHeader from "@/components/(playground)/organisation/project-page-header";++jest.mock("@/components/(playground)/feature-page-header", () => ({+ __esModule: true,+ default: ({ title, description, actions }: any) => (+ <div>+ <h1>{title}</h1>+ <p>{description}</p>+ {actions}+ </div>+ ),+}));++describe("ProjectPageHeader", () => {+ it("renders project identity, navigation, and status badges", () => {+ render(<ProjectPageHeader project={{ name: "Production", isCurrent: true, isDefault: true }} />);++ expect(screen.getByRole("heading", { name: "Production" })).toBeInTheDocument();+ expect(screen.getByRole("link", { name: "Back to Organisation" })).toHaveAttribute("href", "/organisation");+ expect(screen.getByText("Current")).toBeInTheDocument();+ expect(screen.getByText("Default Project")).toBeInTheDocument();+ });++ it("uses the loading title when no project is available", () => {+ render(<ProjectPageHeader />);++ expect(screen.getByRole("heading", { name: "Loading project" })).toBeInTheDocument();+ });+});diff --git a/src/client/src/__tests__/components/sidebar.test.tsx b/src/client/src/__tests__/components/sidebar.test.tsxnew file mode 100644index 00000000..39ea7427--- /dev/null+++ b/src/client/src/__tests__/components/sidebar.test.tsx@@ -0,0 +1,138 @@+import { fireEvent, render, screen } from "@testing-library/react";+import Sidebar from "@/components/(playground)/sidebar";+import { TooltipProvider } from "@/components/ui/tooltip";++const pushMock = jest.fn();+let pathname = "/home";+let searchParams = "";++jest.mock("next/navigation", () => ({+ usePathname: () => pathname,+ useRouter: () => ({ push: pushMock }),+ useSearchParams: () => new URLSearchParams(searchParams),+}));++jest.mock("@/constants/sidebar", () => {+ const React = require("react");+ const icon = (name: string) => React.createElement("span", { "data-testid": `${name}-icon` });++ return {+ ICON_CLASSES: "size-5",+ SIDEBAR_ITEMS: [+ {+ icon: icon("home"),+ text: "Home",+ link: "/home",+ type: "action",+ },+ {+ title: "Resources",+ type: "section",+ children: [+ {+ icon: icon("prompt"),+ text: "Prompt Hub",+ link: "/prompt-hub",+ type: "action",+ },+ ],+ },+ ],+ };+});++jest.mock("@/components/(playground)/sidebar/user-actions", () => ({+ __esModule: true,+ default: () => <button>User menu</button>,+}));++jest.mock("@/components/(playground)/sidebar/otter-sidebar", () => ({+ __esModule: true,+ default: () => <div>Otter sidebar</div>,+}));++jest.mock("@/components/(playground)/sidebar/theme-switch", () => ({+ __esModule: true,+ default: () => <button>Theme switch</button>,+}));++jest.mock("@/components/ui/tooltip", () => ({+ TooltipProvider: ({ children }: { children: React.ReactNode }) => <>{children}</>,+ Tooltip: ({ children }: { children: React.ReactNode }) => <>{children}</>,+ TooltipTrigger: ({ children }: { children: React.ReactNode }) => <>{children}</>,+ TooltipContent: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,+}));++jest.mock("@/components/ui/command", () => ({+ CommandDialog: ({ open, children }: { open: boolean; children: React.ReactNode }) => open ? <div role="dialog">{children}</div> : null,+ CommandInput: ({ placeholder }: { placeholder: string }) => <input placeholder={placeholder} />,+ CommandList: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,+ CommandEmpty: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,+ CommandGroup: ({ children, heading }: { children: React.ReactNode; heading?: string }) => <div aria-label={heading}>{children}</div>,+ CommandItem: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,+}));++function renderSidebar() {+ return render(+ <TooltipProvider>+ <Sidebar />+ </TooltipProvider>+ );+}++describe("Sidebar", () => {+ beforeEach(() => {+ pushMock.mockClear();+ pathname = "/home";+ searchParams = "";+ window.localStorage.clear();+ });++ it("keeps the brand logo rendered and hides brand copy without removing layout space when collapsed", () => {+ renderSidebar();++ expect(screen.getByAltText("OpenLIT logo")).toBeInTheDocument();+ expect(screen.getByText("OpenLIT").parentElement).not.toHaveClass("invisible");++ fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));++ expect(screen.getByAltText("OpenLIT logo")).toBeInTheDocument();+ expect(screen.getByText("OpenLIT").parentElement).toHaveClass(+ "invisible",+ "opacity-0",+ "pointer-events-none"+ );+ expect(screen.getByRole("link", { name: "Home" })).toBeInTheDocument();+ });++ it("expands the sidebar when clicking a collapsed action item", () => {+ renderSidebar();++ fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));+ fireEvent.click(screen.getByRole("link", { name: "Home" }));++ expect(screen.getByRole("button", { name: "Collapse sidebar" })).toBeInTheDocument();+ expect(screen.getByText("OpenLIT").parentElement).not.toHaveClass("invisible");+ });++ it("expands the sidebar and opens a secondary panel when clicking a collapsed section item", () => {+ renderSidebar();++ fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));+ fireEvent.click(screen.getByRole("button", { name: "R" }));++ expect(screen.getByRole("button", { name: "Collapse sidebar" })).toHaveClass("right-2");+ expect(screen.getAllByText("Resources")).toHaveLength(2);+ expect(screen.getByRole("link", { name: "Prompt Hub" })).toBeInTheDocument();+ });++ it("expands before opening command search from the collapsed search button", () => {+ renderSidebar();++ fireEvent.click(screen.getByRole("button", { name: "Collapse sidebar" }));+ fireEvent.click(screen.getByRole("button", { name: "Search navigation" }));++ expect(screen.getByRole("button", { name: "Collapse sidebar" })).toBeInTheDocument();+ expect(screen.getByPlaceholderText("Search OpenLIT navigation...")).toBeInTheDocument();+ });+});diff --git a/src/client/src/__tests__/features/features.test.ts b/src/client/src/__tests__/features/features.test.tsnew file mode 100644index 00000000..d95ce154--- /dev/null+++ b/src/client/src/__tests__/features/features.test.ts@@ -0,0 +1,85 @@+import {+ FEATURES,+ getFeatureDefinition,+ getPaidFeatures,+} from "@/features";+import {+ disabledFeature,+ upgradeRequiredBody,+ upgradeRequiredResponse,+} from "@/features/disabled-feature";+import { onOrganisationChanged } from "@/features/organisation";+import { canManageOrganisation } from "@/features/organisation-access";+import { FEATURES as REGISTRY_FEATURES } from "@/features/registry";+import { getEnterpriseSidebarItems } from "@/features/sidebar";++beforeAll(() => {+ Object.defineProperty(global, "Response", {+ value: {+ json: (body: unknown, init?: ResponseInit) => ({+ status: init?.status ?? 200,+ json: jest.fn().mockResolvedValue(body),+ }),+ },+ configurable: true,+ });+});++describe("CE feature fallbacks", () => {+ it("exposes an empty edition feature registry in CE", () => {+ expect(FEATURES).toEqual({});+ expect(REGISTRY_FEATURES).toBe(FEATURES);+ expect(getPaidFeatures()).toEqual([]);+ });++ it("creates a safe enterprise fallback for unknown feature definitions", () => {+ expect(getFeatureDefinition("audit-logs")).toEqual({+ id: "audit-logs",+ name: "audit-logs",+ tier: "enterprise",+ description: "Paid feature.",+ });+ });++ it("builds upgrade-required payloads and responses", async () => {+ const body = upgradeRequiredBody("audit-logs");++ expect(body).toEqual({+ code: "upgrade_required",+ featureId: "audit-logs",+ featureName: "audit-logs",+ message: "audit-logs requires an active Enterprise plan.",+ });++ const response = upgradeRequiredResponse("audit-logs");+ expect(response.status).toBe(403);+ await expect(response.json()).resolves.toEqual(body);+ });++ it("returns disabled feature handles with upgrade responses", async () => {+ const feature = disabledFeature("seats");++ expect(feature.featureId).toBe("seats");+ expect(feature.isEnabled).toBe(false);++ const response = feature.upgradeRequired();+ expect(response.status).toBe(403);+ await expect(response.json()).resolves.toMatchObject({+ code: "upgrade_required",+ featureId: "seats",+ });+ });++ it("keeps enterprise sidebar and organisation hooks as CE no-ops", async () => {+ expect(getEnterpriseSidebarItems("monitoring", "icon")).toEqual([]);+ expect(getEnterpriseSidebarItems("configuration", "icon")).toEqual([]);+ await expect(onOrganisationChanged("org-1")).resolves.toBeUndefined();+ await expect(+ canManageOrganisation({+ organisationId: "org-1",+ userId: "user-1",+ action: "organisation.update",+ })+ ).resolves.toBeUndefined();+ });+});diff --git a/src/client/src/__tests__/helpers/client/project.test.ts b/src/client/src/__tests__/helpers/client/project.test.tsnew file mode 100644index 00000000..e18ad983--- /dev/null+++ b/src/client/src/__tests__/helpers/client/project.test.ts@@ -0,0 +1,156 @@+const mockSetList = jest.fn();+const mockSetIsLoading = jest.fn();+const mockSetCurrent = jest.fn();+const mockGetData = jest.fn();+const mockPostData = jest.fn();+const mockFetchDatabaseConfigList = jest.fn();+const mockPingActiveDatabaseConfig = jest.fn();+const mockToastError = jest.fn();++const mockState = {+ organisation: {+ current: { id: "org-1" },+ },+ project: {+ list: [+ {+ id: "project-1",+ organisationId: "org-1",+ name: "Project 1",+ slug: "project-1",+ isDefault: true,+ isCurrent: true,+ createdAt: "2026-01-01T00:00:00.000Z",+ },+ {+ id: "project-2",+ organisationId: "org-1",+ name: "Project 2",+ slug: "project-2",+ isDefault: false,+ isCurrent: false,+ createdAt: "2026-01-01T00:00:00.000Z",+ },+ ],+ setList: mockSetList,+ setIsLoading: mockSetIsLoading,+ setCurrent: mockSetCurrent,+ },+};++jest.mock("@/store", () => ({+ useRootStore: {+ getState: jest.fn(() => mockState),+ },+}));++jest.mock("@/utils/api", () => ({+ getData: (...args: unknown[]) => mockGetData(...args),+ postData: (...args: unknown[]) => mockPostData(...args),+}));++jest.mock("sonner", () => ({+ toast: {+ error: (...args: unknown[]) => mockToastError(...args),+ },+}));++jest.mock("@/constants/messages", () => ({+ __esModule: true,+ default: () => ({+ PROJECT_SWITCH_FAILED: "Project switch failed",+ }),+}));++jest.mock("@/helpers/client/database-config", () => ({+ fetchDatabaseConfigList: (...args: unknown[]) =>+ mockFetchDatabaseConfigList(...args),+ pingActiveDatabaseConfig: (...args: unknown[]) =>+ mockPingActiveDatabaseConfig(...args),+}));++import { changeActiveProject, fetchProjectList } from "@/helpers/client/project";++describe("project client helpers", () => {+ beforeEach(() => {+ jest.clearAllMocks();+ mockState.organisation.current = { id: "org-1" };+ mockGetData.mockResolvedValue([]);+ mockPostData.mockResolvedValue({});+ mockFetchDatabaseConfigList.mockResolvedValue([]);+ mockPingActiveDatabaseConfig.mockResolvedValue(null);+ });++ it("sets an empty project list when no organisation is selected", async () => {+ mockState.organisation.current = undefined as any;++ await expect(fetchProjectList()).resolves.toEqual([]);++ expect(mockSetList).toHaveBeenCalledWith([]);+ expect(mockGetData).not.toHaveBeenCalled();+ });++ it("fetches project lists, updates loading, and dedupes in-flight requests", async () => {+ const projects = [mockState.project.list[0]];+ let resolveRequest: (value: unknown) => void = () => {};+ mockGetData.mockReturnValueOnce(+ new Promise((resolve) => {+ resolveRequest = resolve;+ })+ );++ const first = fetchProjectList("org-1");+ const second = fetchProjectList("org-1");+ resolveRequest(projects);++ await expect(first).resolves.toEqual(projects);+ await expect(second).resolves.toEqual(projects);++ expect(mockGetData).toHaveBeenCalledTimes(1);+ expect(mockSetIsLoading).toHaveBeenCalledWith(true);+ expect(mockSetList).toHaveBeenCalledWith(projects);+ });++ it("clears project list when project fetch fails", async () => {+ mockGetData.mockRejectedValueOnce(new Error("network"));++ await expect(fetchProjectList("org-1")).resolves.toEqual([]);++ expect(mockSetIsLoading).toHaveBeenCalledWith(false);+ expect(mockSetList).toHaveBeenCalledWith([]);+ });++ it("switches active project and refreshes database config state", async () => {+ const successCb = jest.fn();++ await changeActiveProject("project-2", successCb);++ expect(mockPostData).toHaveBeenCalledWith({+ url: "/api/organisation/org-1/projects/current/project-2",+ data: {},+ });+ expect(mockSetCurrent).toHaveBeenCalledWith(mockState.project.list[1]);+ expect(mockFetchDatabaseConfigList).toHaveBeenCalledWith(expect.any(Function));+ expect(mockPingActiveDatabaseConfig).toHaveBeenCalled();+ expect(successCb).toHaveBeenCalled();+ });++ it("does not switch project without an organisation", async () => {+ mockState.organisation.current = undefined as any;++ await changeActiveProject("project-2");++ expect(mockPostData).not.toHaveBeenCalled();+ });++ it("shows a toast when switching project fails", async () => {+ mockPostData.mockResolvedValueOnce({ err: "No access" });++ await changeActiveProject("project-2");++ expect(mockToastError).toHaveBeenCalledWith("No access", {+ id: "project-switch",+ });+ expect(mockSetCurrent).not.toHaveBeenCalled();+ });+});diff --git a/src/client/src/__tests__/lib/access/route-access.test.ts b/src/client/src/__tests__/lib/access/route-access.test.tsnew file mode 100644index 00000000..804c2a23--- /dev/null+++ b/src/client/src/__tests__/lib/access/route-access.test.ts@@ -0,0 +1,13 @@+import { requireRouteAccess, withRouteAccess } from "@/lib/access/route-access";++describe("CE route access fallback", () => {+ it("keeps handlers unchanged and has no enterprise access decision", async () => {+ const handler = jest.fn().mockResolvedValue({ status: 204 });+ const wrapped = withRouteAccess("prompt.create", handler);++ await wrapped({} as Request, {});++ expect(handler).toHaveBeenCalledTimes(1);+ await expect(requireRouteAccess("prompt.create")).resolves.toBeNull();+ });+});diff --git a/src/client/src/__tests__/lib/billing/usage-recorder.test.ts b/src/client/src/__tests__/lib/billing/usage-recorder.test.tsnew file mode 100644index 00000000..611c2b8b--- /dev/null+++ b/src/client/src/__tests__/lib/billing/usage-recorder.test.ts@@ -0,0 +1,16 @@+import { recordOrganisationUsageEvent } from "@/lib/billing/usage-recorder";++describe("CE usage recorder fallback", () => {+ it("does not record usage events in CE", async () => {+ await expect(+ recordOrganisationUsageEvent({+ organisationId: "org-1",+ projectId: "project-1",+ featureId: "otter",+ quantity: 2,+ periodStart: new Date("2026-01-01T00:00:00Z"),+ periodEnd: new Date("2026-02-01T00:00:00Z"),+ })+ ).resolves.toBeNull();+ });+});diff --git a/src/client/src/__tests__/lib/chat/access.test.ts b/src/client/src/__tests__/lib/chat/access.test.tsnew file mode 100644index 00000000..b4782473--- /dev/null+++ b/src/client/src/__tests__/lib/chat/access.test.ts@@ -0,0 +1,45 @@+import {+ withOtterChatAccess,+ withOtterConfigureAccess,+ withOtterDbChatAccess,+ withOtterDbReadAccess,+ withOtterReadAccess,+} from "@/lib/chat/access";++beforeAll(() => {+ Object.defineProperty(global, "Response", {+ value: {+ json: (body: unknown, init?: ResponseInit) => ({+ status: init?.status ?? 200,+ json: jest.fn().mockResolvedValue(body),+ }),+ },+ configurable: true,+ });+});++describe("Otter route access wrappers", () => {+ const wrappers = [+ withOtterReadAccess,+ withOtterChatAccess,+ withOtterConfigureAccess,+ withOtterDbReadAccess,+ withOtterDbChatAccess,+ ];++ it("preserves handlers as OSS-safe passthroughs", async () => {+ for (const wrapper of wrappers) {+ const response = Response.json({ ok: true });+ const handler = jest.fn(() => response);++ const wrapped = wrapper(handler);++ expect(wrapped).toBe(handler);+ expect(await wrapped({ method: "GET" }, { params: {} })).toBe(response);+ expect(handler).toHaveBeenCalledWith(+ { method: "GET" },+ { params: {} }+ );+ }+ });+});diff --git a/src/client/src/__tests__/lib/edition.test.ts b/src/client/src/__tests__/lib/edition.test.tsnew file mode 100644index 00000000..1507f3a0--- /dev/null+++ b/src/client/src/__tests__/lib/edition.test.ts@@ -0,0 +1,35 @@+import {+ getOpenLitEdition,+ isCloudEdition,+ isEnterpriseEdition,+} from "@/lib/edition";++describe("OpenLIT edition helpers", () => {+ const originalEdition = process.env.OPENLIT_EDITION;++ afterEach(() => {+ if (originalEdition === undefined) {+ delete process.env.OPENLIT_EDITION;+ } else {+ process.env.OPENLIT_EDITION = originalEdition;+ }+ });++ it.each([+ [undefined, "oss"],+ ["oss", "oss"],+ ["invalid", "oss"],+ ["enterprise", "enterprise"],+ ["cloud", "cloud"],+ ])("normalizes %s to %s", (input, expected) => {+ if (input === undefined) {+ delete process.env.OPENLIT_EDITION;+ } else {+ process.env.OPENLIT_EDITION = input;+ }++ expect(getOpenLitEdition()).toBe(expected);+ expect(isEnterpriseEdition()).toBe(expected === "enterprise");+ expect(isCloudEdition()).toBe(expected === "cloud");+ });+});diff --git a/src/client/src/__tests__/lib/enterprise-feature-access.test.ts b/src/client/src/__tests__/lib/enterprise-feature-access.test.tsnew file mode 100644index 00000000..63b9e6a6--- /dev/null+++ b/src/client/src/__tests__/lib/enterprise-feature-access.test.ts@@ -0,0 +1,11 @@+import { getEnterpriseFeatureAccessSnapshot } from "@/lib/enterprise-feature-access";++describe("CE enterprise feature access fallback", () => {+ it("returns an empty access snapshot", async () => {+ await expect(getEnterpriseFeatureAccessSnapshot()).resolves.toEqual({+ accounts: [],+ selectedAccountId: "",+ accessByAccountId: {},+ });+ });+});diff --git a/src/client/src/__tests__/lib/platform/agents/aggregate-graph.test.ts b/src/client/src/__tests__/lib/platform/agents/aggregate-graph.test.tsindex 1f11f8b5..fc4edddd 100644--- a/src/client/src/__tests__/lib/platform/agents/aggregate-graph.test.ts+++ b/src/client/src/__tests__/lib/platform/agents/aggregate-graph.test.ts@@ -16,9 +16,13 @@ jest.mock("@/lib/platform/common", () => ({import {assignDepths,+ getAggregateGraph,type AggregateEdge,type AggregateNode,} from "@/lib/platform/agents/aggregate-graph";+import { dataCollector } from "@/lib/platform/common";++const mockDataCollector = jest.mocked(dataCollector);function node(id: string): AggregateNode {return {@@ -103,3 +107,178 @@ describe("assignDepths", () => {expect(nodes.find((n) => n.id === "tool_c")!.depth).toBe(1);});});++describe("getAggregateGraph", () => {+ beforeEach(() => {+ jest.clearAllMocks();+ mockDataCollector.mockResolvedValue({ err: null, data: [] });+ });++ it("normalizes span, edge, tool, and trace-count rows", async () => {+ mockDataCollector.mockResolvedValueOnce({+ err: null,+ data: [+ {+ kind: "node",+ source: "agent.request",+ target: "",+ edge_count: "4",+ p50_ms: "12.5",+ error_rate: "0.25",+ },+ {+ kind: "node",+ source: "agent.child",+ target: "",+ edge_count: "2",+ p50_ms: "8",+ error_rate: "0",+ },+ {+ kind: "edge",+ source: "agent.request",+ target: "agent.child",+ edge_count: "2",+ p50_ms: "8",+ error_rate: "0",+ },+ {+ kind: "edge",+ source: "agent.child",+ target: "agent.child",+ edge_count: "1",+ p50_ms: "1",+ error_rate: "1",+ },+ {+ kind: "tool_edge",+ source: "agent.request",+ target: "lookup_docs",+ edge_count: "3",+ p50_ms: "6",+ error_rate: "0.1",+ },+ {+ kind: "tool_edge",+ source: "agent.child",+ target: "lookup_docs",+ edge_count: "1",+ p50_ms: "10",+ error_rate: "0.2",+ },+ {+ kind: "tool_edge",+ source: "agent.child",+ target: " ",+ edge_count: "99",+ p50_ms: "99",+ error_rate: "1",+ },+ {+ kind: "trace_count",+ source: "",+ target: "",+ edge_count: "7",+ p50_ms: 0,+ error_rate: 0,+ },+ ],+ });++ await expect(+ getAggregateGraph({+ serviceName: "api",+ environment: "production",+ maxTraces: 10,+ versionFilter: {+ versionHash: "v1",+ firstSeen: "2026-01-01T00:00:00Z",+ lastSeen: "2026-01-02T00:00:00Z",+ hasAttributeSpans: true,+ },+ dbConfigId: "db-1",+ })+ ).resolves.toEqual({+ traceCount: 7,+ spanCount: 6,+ nodes: expect.arrayContaining([+ expect.objectContaining({+ id: "agent.request",+ spanCount: 4,+ p50Ms: 12.5,+ errorRate: 0.25,+ depth: 0,+ kind: "span",+ }),+ expect.objectContaining({+ id: "agent.child",+ depth: 1,+ kind: "span",+ }),+ expect.objectContaining({+ id: "tool:lookup_docs",+ spanName: "lookup_docs",+ spanCount: 4,+ p50Ms: 7,+ errorRate: 0.125,+ depth: 2,+ kind: "tool",+ }),+ ]),+ edges: expect.arrayContaining([+ {+ from: "agent.request",+ to: "agent.child",+ count: 2,+ p50Ms: 8,+ errorRate: 0,+ },+ {+ from: "agent.request",+ to: "tool:lookup_docs",+ count: 3,+ p50Ms: 6,+ errorRate: 0.1,+ },+ ]),+ });++ const { query } = mockDataCollector.mock.calls[0][0] as { query: string };+ expect(query).toContain("ServiceName = 'api'");+ expect(query).toContain("ResourceAttributes['deployment.environment'] = 'production'");+ expect(query).toContain("LIMIT 50");+ expect(mockDataCollector).toHaveBeenCalledWith(+ { query: expect.any(String) },+ "query",+ "db-1"+ );+ });++ it("uses default environment and 24h fallback without a version filter", async () => {+ await getAggregateGraph({ serviceName: "api" });++ const { query } = mockDataCollector.mock.calls[0][0] as { query: string };+ expect(query).toContain(+ "ResourceAttributes['deployment.environment'] = 'default'"+ );+ expect(query).toContain("Timestamp >= now() - INTERVAL 24 HOUR");+ expect(query).toContain("LIMIT 500");+ });++ it("logs query failures and returns an empty graph", async () => {+ const errorSpy = jest.spyOn(console, "error").mockImplementation();+ mockDataCollector.mockResolvedValueOnce({ err: "boom", data: [] });++ await expect(getAggregateGraph({ serviceName: "api" })).resolves.toEqual({+ nodes: [],+ edges: [],+ traceCount: 0,+ spanCount: 0,+ });++ expect(errorSpy).toHaveBeenCalledWith(+ expect.stringContaining("aggregate_graph_query_failed")+ );+ errorSpy.mockRestore();+ });+});diff --git a/src/client/src/__tests__/lib/platform/agents/config.test.ts b/src/client/src/__tests__/lib/platform/agents/config.test.tsnew file mode 100644index 00000000..c0119871--- /dev/null+++ b/src/client/src/__tests__/lib/platform/agents/config.test.ts@@ -0,0 +1,66 @@+const mockUpdateCrontab = jest.fn();++jest.mock("@/helpers/server/cron", () =>+ jest.fn().mockImplementation(() => ({+ updateCrontab: mockUpdateCrontab,+ }))+);++import { restoreAgentsMaterializeCron } from "@/lib/platform/agents/config";++describe("restoreAgentsMaterializeCron", () => {+ const originalSchedule = process.env.AGENTS_MATERIALIZE_SCHEDULE;+ let cwdSpy: jest.SpyInstance<string, []>;++ beforeEach(() => {+ jest.clearAllMocks();+ cwdSpy = jest.spyOn(process, "cwd").mockReturnValue("/app");+ });++ afterEach(() => {+ cwdSpy.mockRestore();+ if (originalSchedule === undefined) {+ delete process.env.AGENTS_MATERIALIZE_SCHEDULE;+ } else {+ process.env.AGENTS_MATERIALIZE_SCHEDULE = originalSchedule;+ }+ });++ it("installs the agents materializer cron with defaults", async () => {+ const logSpy = jest.spyOn(console, "log").mockImplementation();++ await restoreAgentsMaterializeCron("https://api.openlit.local");++ expect(mockUpdateCrontab).toHaveBeenCalledWith({+ cronId: "openlit-agents-materialize",+ cronSchedule: "* * * * *",+ cronEnvVars: {+ API_URL: "https://api.openlit.local",+ CRON_ID: "openlit-agents-materialize",+ },+ cronScriptPath: "/app/scripts/agents/materialize.js",+ cronLogPath: "/app/logs/agents/materialize.log",+ });+ expect(logSpy).toHaveBeenCalledWith("Installed agents materialize cron");+ logSpy.mockRestore();+ });++ it("uses custom schedule and logs install failures", async () => {+ process.env.AGENTS_MATERIALIZE_SCHEDULE = "*/5 * * * *";+ mockUpdateCrontab.mockImplementationOnce(() => {+ throw new Error("cron unavailable");+ });+ const errorSpy = jest.spyOn(console, "error").mockImplementation();++ await restoreAgentsMaterializeCron("https://api.openlit.local");++ expect(mockUpdateCrontab).toHaveBeenCalledWith(+ expect.objectContaining({ cronSchedule: "*/5 * * * *" })+ );+ expect(errorSpy).toHaveBeenCalledWith(+ "Failed to install agents materialize cron:",+ expect.any(Error)+ );+ errorSpy.mockRestore();+ });+});diff --git a/src/client/src/__tests__/lib/platform/agents/logger.test.ts b/src/client/src/__tests__/lib/platform/agents/logger.test.tsnew file mode 100644index 00000000..78260fb4--- /dev/null+++ b/src/client/src/__tests__/lib/platform/agents/logger.test.ts@@ -0,0 +1,110 @@+import { agentsLogger } from "@/lib/platform/agents/logger";++describe("agentsLogger", () => {+ const originalLevel = process.env.AGENTS_LOG_LEVEL;+ const originalStack = process.env.AGENTS_LOG_STACK;++ beforeEach(() => {+ jest.clearAllMocks();+ delete process.env.AGENTS_LOG_LEVEL;+ delete process.env.AGENTS_LOG_STACK;+ jest.useFakeTimers().setSystemTime(new Date("2026-01-01T00:00:00Z"));+ });++ afterEach(() => {+ jest.useRealTimers();+ if (originalLevel === undefined) {+ delete process.env.AGENTS_LOG_LEVEL;+ } else {+ process.env.AGENTS_LOG_LEVEL = originalLevel;+ }+ if (originalStack === undefined) {+ delete process.env.AGENTS_LOG_STACK;+ } else {+ process.env.AGENTS_LOG_STACK = originalStack;+ }+ });++ it("emits structured error, warn, and info logs", () => {+ const errorSpy = jest.spyOn(console, "error").mockImplementation();+ const warnSpy = jest.spyOn(console, "warn").mockImplementation();+ const logSpy = jest.spyOn(console, "log").mockImplementation();++ const error = new Error("bad");+ agentsLogger.error("failed", { err: error });+ agentsLogger.warn("degraded", { count: 2 });+ agentsLogger.info("ready", { service: "api" });++ expect(JSON.parse(errorSpy.mock.calls[0][0] as string)).toMatchObject({+ level: "error",+ ts: "2026-01-01T00:00:00.000Z",+ scope: "agents",+ event: "failed",+ err: {+ message: "bad",+ name: "Error",+ },+ });+ expect(JSON.parse(warnSpy.mock.calls[0][0] as string)).toMatchObject({+ level: "warn",+ event: "degraded",+ count: 2,+ });+ expect(JSON.parse(logSpy.mock.calls[0][0] as string)).toMatchObject({+ level: "info",+ event: "ready",+ service: "api",+ });++ errorSpy.mockRestore();+ warnSpy.mockRestore();+ logSpy.mockRestore();+ });++ it("honors log levels and debug opt-in", () => {+ const logSpy = jest.spyOn(console, "log").mockImplementation();++ agentsLogger.debug("hidden");+ expect(logSpy).not.toHaveBeenCalled();++ process.env.AGENTS_LOG_LEVEL = "debug";+ agentsLogger.debug("visible");+ expect(JSON.parse(logSpy.mock.calls[0][0] as string)).toMatchObject({+ level: "debug",+ event: "visible",+ });++ process.env.AGENTS_LOG_LEVEL = "not-real";+ agentsLogger.debug("hidden-again");+ expect(logSpy).toHaveBeenCalledTimes(1);++ logSpy.mockRestore();+ });++ it("omits error stacks when disabled", () => {+ process.env.AGENTS_LOG_STACK = "false";+ const errorSpy = jest.spyOn(console, "error").mockImplementation();++ agentsLogger.error("failed", { error: new Error("bad") });++ const payload = JSON.parse(errorSpy.mock.calls[0][0] as string);+ expect(payload.error).toEqual({+ message: "bad",+ name: "Error",+ });+ expect(payload.error.stack).toBeUndefined();++ errorSpy.mockRestore();+ });++ it("falls back to unstructured output for circular fields", () => {+ const logSpy = jest.spyOn(console, "log").mockImplementation();+ const circular: Record<string, unknown> = {};+ circular.self = circular;++ agentsLogger.info("circular", circular);++ expect(logSpy).toHaveBeenCalledWith("[agents:info] circular");+ logSpy.mockRestore();+ });+});diff --git a/src/client/src/__tests__/lib/platform/agents/version-filter.test.ts b/src/client/src/__tests__/lib/platform/agents/version-filter.test.tsnew file mode 100644index 00000000..012bf572--- /dev/null+++ b/src/client/src/__tests__/lib/platform/agents/version-filter.test.ts@@ -0,0 +1,126 @@+const mockDataCollector = jest.fn();+const mockGetVersion = jest.fn();+const mockGetAgent = jest.fn();+const mockLoggerError = jest.fn();++jest.mock("@/lib/platform/common", () => ({+ dataCollector: (...args: unknown[]) => mockDataCollector(...args),+ OTEL_TRACES_TABLE_NAME: "otel_traces",+}));++jest.mock("@/lib/platform/agents/cache", () => ({+ POLICY_VERSIONS: { ttlMs: 1000, staleMs: 2000 },+ swr: jest.fn((_key, _policy, loader) => loader()),+}));++jest.mock("@/lib/platform/agents/snapshot", () => ({+ getVersion: (...args: unknown[]) => mockGetVersion(...args),+}));++jest.mock("@/lib/platform/agents/index", () => ({+ getAgent: (...args: unknown[]) => mockGetAgent(...args),+}));++jest.mock("@/lib/platform/agents/logger", () => ({+ agentsLogger: {+ error: (...args: unknown[]) => mockLoggerError(...args),+ },+}));++import {+ buildVersionWhereClause,+ getVersionWindow,+} from "@/lib/platform/agents/version-filter";++describe("getVersionWindow", () => {+ beforeEach(() => {+ jest.clearAllMocks();+ mockGetVersion.mockResolvedValue({+ version_hash: "v1",+ first_seen: "2026-01-01T00:00:00.000Z",+ last_seen: "2026-01-02T00:00:00.000Z",+ });+ mockGetAgent.mockResolvedValue({+ service_name: "api",+ environment: "production",+ });+ mockDataCollector.mockResolvedValue({ err: null, data: [{ stamped: 1 }] });+ });++ it("re-exports the pure version where builder", () => {+ expect(buildVersionWhereClause(null)).toBe("");+ });++ it("returns null when the version is missing", async () => {+ mockGetVersion.mockResolvedValueOnce(null);++ await expect(getVersionWindow("agent-1", "v1", "db-1")).resolves.toBeNull();+ expect(mockDataCollector).not.toHaveBeenCalled();+ });++ it("resolves stamped version windows", async () => {+ await expect(getVersionWindow("agent-1", "v1", "db-1")).resolves.toEqual({+ versionHash: "v1",+ firstSeen: "2026-01-01T00:00:00.000Z",+ lastSeen: "2026-01-02T00:00:00.000Z",+ hasAttributeSpans: true,+ });++ expect(mockGetVersion).toHaveBeenCalledWith("agent-1", "v1", "db-1");+ expect(mockGetAgent).toHaveBeenCalledWith({+ agentKey: "agent-1",+ dbConfigId: "db-1",+ });+ expect(mockDataCollector).toHaveBeenCalledWith(+ { query: expect.stringContaining("ServiceName = 'api'") },+ "query",+ "db-1"+ );+ });++ it("does not probe traces when agent metadata is missing", async () => {+ mockGetAgent.mockResolvedValueOnce(null);++ await expect(getVersionWindow("agent-1", "v1")).resolves.toMatchObject({+ hasAttributeSpans: false,+ });+ expect(mockDataCollector).not.toHaveBeenCalled();+ });++ it("falls back to unstamped windows when the probe errors", async () => {+ mockDataCollector.mockResolvedValueOnce({+ err: new Error("clickhouse unavailable"),+ data: [],+ });++ await expect(getVersionWindow("agent-1", "v1")).resolves.toMatchObject({+ hasAttributeSpans: false,+ });+ expect(mockLoggerError).toHaveBeenCalledWith(+ "probe_attribute_stamping_failed",+ expect.objectContaining({+ serviceName: "api",+ versionHash: "v1",+ })+ );+ });++ it("uses the default environment predicate for default agents", async () => {+ mockGetAgent.mockResolvedValueOnce({+ service_name: "api",+ environment: "default",+ });++ await getVersionWindow("agent-1", "v1");++ expect(mockDataCollector).toHaveBeenCalledWith(+ {+ query: expect.stringContaining(+ "ResourceAttributes['deployment.environment'] = 'default'"+ ),+ },+ "query",+ undefined+ );+ });+});diff --git a/src/client/src/__tests__/lib/platform/agents/version-where.test.ts b/src/client/src/__tests__/lib/platform/agents/version-where.test.tsnew file mode 100644index 00000000..513aed49--- /dev/null+++ b/src/client/src/__tests__/lib/platform/agents/version-where.test.ts@@ -0,0 +1,42 @@+import { buildVersionWhereClause } from "@/lib/platform/agents/version-where";++describe("buildVersionWhereClause", () => {+ it("returns an empty clause when no version filter is provided", () => {+ expect(buildVersionWhereClause(null)).toBe("");+ expect(buildVersionWhereClause(undefined)).toBe("");+ expect(+ buildVersionWhereClause({+ versionHash: "",+ firstSeen: "2026-01-01T00:00:00Z",+ lastSeen: "2026-01-02T00:00:00Z",+ hasAttributeSpans: false,+ })+ ).toBe("");+ });++ it("builds a time-window fallback for unstamped spans", () => {+ const clause = buildVersionWhereClause({+ versionHash: "v1",+ firstSeen: "2026-01-01T12:34:56.789Z",+ lastSeen: new Date("2026-01-02T01:02:03.000Z"),+ hasAttributeSpans: false,+ });++ expect(clause).toBe(+ "(Timestamp BETWEEN parseDateTimeBestEffort('2026-01-01 12:34:56') AND parseDateTimeBestEffort('2026-01-02 01:02:03'))"+ );+ });++ it("combines exact hash matches with fallback windows for stamped versions", () => {+ const clause = buildVersionWhereClause({+ versionHash: "v'1",+ firstSeen: "not-a-date",+ lastSeen: "2026-01-02 01:02:03",+ hasAttributeSpans: true,+ });++ expect(clause).toContain("SpanAttributes['openlit.agent.version_hash'] = 'v\\'1'");+ expect(clause).toContain("SpanAttributes['openlit.agent.version_hash'] = ''");+ expect(clause).toContain("Timestamp BETWEEN parseDateTimeBestEffort");+ });+});diff --git a/src/client/src/__tests__/lib/platform/coding-agents/auth.test.ts b/src/client/src/__tests__/lib/platform/coding-agents/auth.test.tsnew file mode 100644index 00000000..aaf96041--- /dev/null+++ b/src/client/src/__tests__/lib/platform/coding-agents/auth.test.ts@@ -0,0 +1,113 @@+import prisma from "@/lib/prisma";+import {+ CodingAgentUnauthorizedError,+ requireCodingAgentAuth,+} from "@/lib/platform/coding-agents/auth";+import { getCurrentOrganisation } from "@/lib/organisation";+import { getCurrentUser } from "@/lib/session";++jest.mock("@/constants/messages", () => ({+ __esModule: true,+ default: () => ({+ UNAUTHORIZED_USER: "Unauthorized user!",+ NO_ORGANISATION_SELECTED: "No active organisation.",+ }),+}));++jest.mock("@/lib/session", () => ({+ getCurrentUser: jest.fn(),+}));++jest.mock("@/lib/organisation", () => ({+ getCurrentOrganisation: jest.fn(),+}));++jest.mock("@/lib/prisma", () => ({+ __esModule: true,+ default: {+ organisationUser: {+ findUnique: jest.fn(),+ },+ organisation: {+ findUnique: jest.fn(),+ },+ },+}));++const mockGetCurrentUser = jest.mocked(getCurrentUser);+const mockGetCurrentOrganisation = jest.mocked(getCurrentOrganisation);+const mockFindMembership = jest.mocked(prisma.organisationUser.findUnique);+const mockFindOrganisation = jest.mocked(prisma.organisation.findUnique);++describe("requireCodingAgentAuth", () => {+ beforeEach(() => {+ jest.clearAllMocks();+ mockGetCurrentUser.mockResolvedValue({ id: "user-1" } as any);+ mockGetCurrentOrganisation.mockResolvedValue({ id: "org-1" } as any);+ mockFindMembership.mockResolvedValue({ role: "member" } as any);+ mockFindOrganisation.mockResolvedValue({ createdByUserId: "user-2" } as any);+ });++ it("rejects missing user", async () => {+ mockGetCurrentUser.mockResolvedValue(null as any);++ await expect(requireCodingAgentAuth()).rejects.toThrow(+ new CodingAgentUnauthorizedError("Unauthorized user!")+ );+ expect(mockFindMembership).not.toHaveBeenCalled();+ });++ it("rejects missing organisation", async () => {+ mockGetCurrentOrganisation.mockResolvedValue(null as any);++ await expect(requireCodingAgentAuth()).rejects.toThrow(+ new CodingAgentUnauthorizedError("No active organisation.")+ );+ expect(mockFindMembership).not.toHaveBeenCalled();+ });++ it("rejects users without organisation membership", async () => {+ mockFindMembership.mockResolvedValue(null);++ await expect(requireCodingAgentAuth()).rejects.toThrow(+ CodingAgentUnauthorizedError+ );+ });++ it("returns viewer auth for organisation members", async () => {+ await expect(requireCodingAgentAuth()).resolves.toEqual({+ userId: "user-1",+ organizationId: "org-1",+ role: "viewer",+ rawRole: "member",+ });++ expect(mockFindMembership).toHaveBeenCalledWith({+ where: {+ organisationId_userId: {+ organisationId: "org-1",+ userId: "user-1",+ },+ },+ select: { role: true },+ });+ });++ it.each(["admin", "owner"])("returns admin auth for %s members", async (role) => {+ mockFindMembership.mockResolvedValue({ role } as any);++ await expect(requireCodingAgentAuth()).resolves.toMatchObject({+ role: "admin",+ rawRole: role,+ });+ });++ it("promotes the organisation creator to owner/admin", async () => {+ mockFindOrganisation.mockResolvedValue({ createdByUserId: "user-1" } as any);++ await expect(requireCodingAgentAuth()).resolves.toMatchObject({+ role: "admin",+ rawRole: "owner",+ });+ });+});diff --git a/src/client/src/__tests__/lib/platform/coding-agents/classifier.test.ts b/src/client/src/__tests__/lib/platform/coding-agents/classifier.test.tsnew file mode 100644index 00000000..f50e083d--- /dev/null+++ b/src/client/src/__tests__/lib/platform/coding-agents/classifier.test.ts@@ -0,0 +1,87 @@+import {+ CODING_AGENT_CLASSIFICATION_DESCRIPTIONS,+ CODING_AGENT_CLASSIFICATION_LABELS,+ CODING_AGENT_CLASSIFICATION_REASON_LABELS,+ isCodingAgentClassification,+ validateClassificationDispute,+} from "@/lib/platform/coding-agents/classifier";++describe("coding agent classifier helpers", () => {+ it("exposes stable labels and descriptions", () => {+ expect(CODING_AGENT_CLASSIFICATION_LABELS.work).toBe("Work");+ expect(CODING_AGENT_CLASSIFICATION_DESCRIPTIONS.personal).toContain(+ "outside the org's API-key/repo allowlist"+ );+ expect(CODING_AGENT_CLASSIFICATION_REASON_LABELS.no_signal).toBe(+ "No classification signal available"+ );+ });++ it("narrows valid classification values", () => {+ for (const value of ["personal", "work", "disputed", "unknown"]) {+ expect(isCodingAgentClassification(value)).toBe(true);+ }++ expect(isCodingAgentClassification("invalid")).toBe(false);+ expect(isCodingAgentClassification(null)).toBe(false);+ });++ it.each([+ [{}, "sessionId is required."],+ [+ { sessionId: "s1", currentClassification: "bad" },+ "currentClassification is invalid.",+ ],+ [+ { sessionId: "s1", currentClassification: "work" },+ "requestedClassification is invalid.",+ ],+ [+ {+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "work",+ },+ "Requested classification must differ from the current one.",+ ],+ [+ {+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "disputed",+ },+ "Cannot dispute toward 'disputed' — choose work, personal, or unknown.",+ ],+ [+ {+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "personal",+ rationale: " no ",+ },+ "A short rationale (at least 4 characters) is required.",+ ],+ [+ {+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "personal",+ rationale: "x".repeat(1001),+ },+ "Rationale must be 1000 characters or fewer.",+ ],+ ])("rejects invalid dispute payload %#", (payload, error) => {+ expect(validateClassificationDispute(payload as any)).toBe(error);+ });++ it("accepts valid dispute payloads", () => {+ expect(+ validateClassificationDispute({+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "personal",+ rationale: "This was a personal project.",+ })+ ).toBeNull();+ });+});diff --git a/src/client/src/__tests__/lib/platform/coding-agents/query-service.test.ts b/src/client/src/__tests__/lib/platform/coding-agents/query-service.test.tsnew file mode 100644index 00000000..4154e44f--- /dev/null+++ b/src/client/src/__tests__/lib/platform/coding-agents/query-service.test.ts@@ -0,0 +1,282 @@+import { dataCollector } from "@/lib/platform/common";+import {+ DisputeError,+ getCodingSessionDigest,+ listCodingUsers,+ listSessions,+ submitClassificationDispute,+ writeAuditLog,+} from "@/lib/platform/coding-agents/queries";+import type { CodingAgentAuth } from "@/lib/platform/coding-agents/auth";++jest.mock("@/lib/platform/common", () => ({+ dataCollector: jest.fn(),+}));++jest.mock("@/clickhouse/migrations/create-coding-agents-audit-migration", () => ({+ CODING_AGENT_AUDIT_LOG_TABLE: "coding_agent_audit_log",+ CODING_AGENT_DISPUTES_TABLE: "coding_agent_disputes",+}));++const mockDataCollector = jest.mocked(dataCollector);++const auth: CodingAgentAuth = {+ userId: "user-1",+ organizationId: "org-1",+ role: "admin",+ rawRole: "admin",+};++describe("coding agent query service", () => {+ beforeEach(() => {+ jest.clearAllMocks();+ Object.defineProperty(global, "crypto", {+ value: { randomUUID: jest.fn(() => "dispute-1") },+ configurable: true,+ });+ });++ it("lists sessions with cursor pagination and total count", async () => {+ mockDataCollector+ .mockResolvedValueOnce({+ err: null,+ data: [+ { session_id: "s1", started_at: "2026-01-02T00:00:00Z", user: "u1" },+ { session_id: "s2", started_at: "2026-01-01T00:00:00Z", user: "u2" },+ ],+ })+ .mockResolvedValueOnce({ err: null, data: [{ total: "12" }] });++ await expect(+ listSessions(auth, {+ limit: 1,+ withTotal: true,+ vendor: "cursor",+ user: "u1",+ classification: "work",+ })+ ).resolves.toEqual({+ rows: [{ session_id: "s1", started_at: "2026-01-02T00:00:00Z", user: "u1" }],+ nextCursor: "2026-01-02T00:00:00Z",+ total: 12,+ });++ expect(mockDataCollector).toHaveBeenCalledTimes(2);+ expect(mockDataCollector.mock.calls[0][0]).toMatchObject({+ query: expect.stringContaining("LIMIT 2"),+ });+ });++ it("lists users and normalizes numeric fields", async () => {+ mockDataCollector+ .mockResolvedValueOnce({ err: null, data: [{ total: "1" }] })+ .mockResolvedValueOnce({+ err: null,+ data: [+ {+ user: "[email protected]",+ last_seen: "2026-01-01T00:00:00Z",+ session_count: "3",+ tool_call_count: "7",+ cost_usd: "1.25",+ total_tokens: "1000",+ top_vendor: "cursor",+ classification_work: "2",+ classification_personal: "1",+ lines_added: "10",+ lines_accepted: "8",+ lines_rejected: "2",+ acceptance_pct: "80",+ commit_count: "1",+ pr_count: "1",+ },+ ],+ });++ await expect(+ listCodingUsers(auth, {+ withTotal: true,+ vendor: "cursor",+ sortBy: "tokens",+ sortDir: "asc",+ })+ ).resolves.toEqual({+ rows: [+ expect.objectContaining({+ user: "[email protected]",+ session_count: 3,+ tool_call_count: 7,+ cost_usd: 1.25,+ total_tokens: 1000,+ classification_work: 2,+ classification_personal: 1,+ lines_added: 10,+ lines_accepted: 8,+ lines_rejected: 2,+ acceptance_pct: 80,+ commit_count: 1,+ pr_count: 1,+ }),+ ],+ total: 1,+ });+ });++ it("returns null for empty or missing session digests", async () => {+ await expect(getCodingSessionDigest(auth, "")).resolves.toBeNull();++ mockDataCollector.mockResolvedValueOnce({ err: null, data: [] });+ await expect(getCodingSessionDigest(auth, "s1")).resolves.toBeNull();+ });++ it("normalizes session digest rows", async () => {+ mockDataCollector.mockResolvedValueOnce({+ err: null,+ data: [+ {+ session_id: "s1",+ lines_added: "12",+ lines_removed: "2",+ lines_accepted: "8",+ lines_rejected: "2",+ edit_accept_count: "4",+ edit_reject_count: "1",+ commit_count: "2",+ pr_count: "1",+ total_tokens: "100",+ input_tokens: "40",+ output_tokens: "60",+ cost_usd: "0.5",+ duration_ms: "3000",+ model: "gpt-4.1",+ repo_url: "https://github.com/openlit/openlit",+ branch: "main",+ working_dir: "/repo/openlit",+ working_dir_label: "repo/openlit",+ },+ ],+ });++ await expect(getCodingSessionDigest(auth, "s1")).resolves.toEqual({+ session_id: "s1",+ lines_added: 12,+ lines_removed: 2,+ lines_accepted: 8,+ lines_rejected: 2,+ edit_accept_count: 4,+ edit_reject_count: 1,+ commit_count: 2,+ pr_count: 1,+ acceptance_pct: 80,+ total_tokens: 100,+ input_tokens: 40,+ output_tokens: 60,+ cost_usd: 0.5,+ duration_ms: 3000,+ model: "gpt-4.1",+ repo_url: "https://github.com/openlit/openlit",+ branch: "main",+ working_dir: "/repo/openlit",+ working_dir_label: "repo/openlit",+ });+ });++ it("submits classification disputes and audit logs", async () => {+ mockDataCollector+ .mockResolvedValueOnce({ err: null, data: [{ hit: 1 }] })+ .mockResolvedValueOnce({ err: null, data: [] })+ .mockResolvedValueOnce({ err: null, data: [{ n: 0 }] })+ .mockResolvedValueOnce({ err: null, data: [] })+ .mockResolvedValueOnce({ err: null, data: [] });++ await expect(+ submitClassificationDispute(auth, {+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "personal",+ rationale: "Personal experiment.",+ })+ ).resolves.toEqual({ id: "dispute-1" });++ expect(mockDataCollector).toHaveBeenLastCalledWith(+ expect.objectContaining({+ values: [+ expect.objectContaining({+ action: "coding_agent.classification.dispute",+ subject: "s1",+ }),+ ],+ }),+ "insert"+ );+ });++ it.each([+ [[{ err: null, data: [] }], "not_found", 404],+ [+ [+ { err: null, data: [{ hit: 1 }] },+ { err: null, data: [{ hit: 1 }] },+ ],+ "duplicate",+ 409,+ ],+ [+ [+ { err: null, data: [{ hit: 1 }] },+ { err: null, data: [] },+ { err: null, data: [{ n: 20 }] },+ ],+ "rate_limited",+ 429,+ ],+ ])(+ "throws %s dispute errors",+ async (responses, code, status) => {+ for (const response of responses) {+ mockDataCollector.mockResolvedValueOnce(response as any);+ }++ await expect(+ submitClassificationDispute(auth, {+ sessionId: "s1",+ currentClassification: "work",+ requestedClassification: "personal",+ rationale: "Personal experiment.",+ })+ ).rejects.toMatchObject({ code, status });+ }+ );++ it("swallows audit log insert failures", async () => {+ const errorSpy = jest.spyOn(console, "error").mockImplementation();+ mockDataCollector.mockResolvedValueOnce({+ err: new Error("insert failed"),+ data: [],+ });++ await expect(+ writeAuditLog(auth, {+ action: "coding_agent.test",+ subject: "s1",+ })+ ).resolves.toBeUndefined();++ expect(errorSpy).toHaveBeenCalledWith(+ "coding_agent.audit_log.insert_failed",+ expect.any(Error)+ );+ errorSpy.mockRestore();+ });+});++describe("DisputeError", () => {+ it("carries status and machine-readable codes", () => {+ const error = new DisputeError("duplicate", 409, "Duplicate");++ expect(error).toBeInstanceOf(Error);+ expect(error.code).toBe("duplicate");+ expect(error.status).toBe(409);+ expect(error.message).toBe("Duplicate");+ });+});diff --git a/src/client/src/__tests__/lib/platform/kubernetes.test.ts b/src/client/src/__tests__/lib/platform/kubernetes.test.tsnew file mode 100644index 00000000..f6252fcf--- /dev/null+++ b/src/client/src/__tests__/lib/platform/kubernetes.test.ts@@ -0,0 +1,153 @@+const mockCreateNamespacedCustomObject = jest.fn();+const mockGetNamespacedCustomObject = jest.fn();+const mockDeleteNamespacedCustomObject = jest.fn();+const mockLoadFromDefault = jest.fn();+const mockMakeApiClient = jest.fn(() => ({+ createNamespacedCustomObject: mockCreateNamespacedCustomObject,+ getNamespacedCustomObject: mockGetNamespacedCustomObject,+ deleteNamespacedCustomObject: mockDeleteNamespacedCustomObject,+}));++jest.mock("@/utils/log", () => ({+ consoleLog: jest.fn(),+}));++jest.mock("@kubernetes/client-node", () => ({+ KubeConfig: jest.fn().mockImplementation(() => ({+ loadFromDefault: mockLoadFromDefault,+ makeApiClient: mockMakeApiClient,+ })),+ CustomObjectsApi: jest.fn(),+}));++import { consoleLog } from "@/utils/log";+import {+ buildAutoInstrumentationCRD,+ createAgentInstrumentation,+ deleteAgentInstrumentation,+ getAgentInstrumentation,+} from "@/lib/platform/kubernetes";++describe("platform kubernetes helpers", () => {+ const originalEndpoint = process.env.OPENLIT_OTLP_ENDPOINT;++ beforeEach(() => {+ jest.clearAllMocks();+ delete process.env.OPENLIT_OTLP_ENDPOINT;+ });++ afterEach(() => {+ if (originalEndpoint === undefined) {+ delete process.env.OPENLIT_OTLP_ENDPOINT;+ } else {+ process.env.OPENLIT_OTLP_ENDPOINT = originalEndpoint;+ }+ });++ it("builds AutoInstrumentation CRDs with default and override endpoints", () => {+ expect(+ buildAutoInstrumentationCRD({+ namespace: "default",+ serviceName: "api",+ })+ ).toMatchObject({+ metadata: { name: "openlit-agent-api", namespace: "default" },+ spec: {+ selector: {+ matchLabels: { "app.kubernetes.io/name": "api" },+ },+ otlp: { endpoint: "http://otel-collector:4318" },+ },+ });++ process.env.OPENLIT_OTLP_ENDPOINT = "http://env-collector:4318";+ expect(+ buildAutoInstrumentationCRD({+ namespace: "default",+ serviceName: "api",+ otlpEndpoint: "http://override:4318",+ }).spec.otlp.endpoint+ ).toBe("http://override:4318");+ expect(+ buildAutoInstrumentationCRD({+ namespace: "default",+ serviceName: "api",+ }).spec.otlp.endpoint+ ).toBe("http://env-collector:4318");+ });++ it("creates AutoInstrumentation custom objects", async () => {+ mockCreateNamespacedCustomObject.mockResolvedValueOnce({ body: "created" });++ await expect(+ createAgentInstrumentation({+ namespace: "default",+ serviceName: "api",+ })+ ).resolves.toEqual({ data: { body: "created" } });++ expect(mockLoadFromDefault).toHaveBeenCalled();+ expect(mockCreateNamespacedCustomObject).toHaveBeenCalledWith(+ expect.objectContaining({+ group: "openlit.io",+ version: "v1alpha1",+ namespace: "default",+ plural: "autoinstrumentations",+ body: expect.objectContaining({+ metadata: { name: "openlit-agent-api", namespace: "default" },+ }),+ })+ );+ });++ it("returns Kubernetes error messages for create failures", async () => {+ mockCreateNamespacedCustomObject.mockRejectedValueOnce({+ body: { message: "already exists" },+ });++ await expect(+ createAgentInstrumentation({+ namespace: "default",+ serviceName: "api",+ })+ ).resolves.toEqual({ err: "already exists" });+ expect(consoleLog).toHaveBeenCalledWith({ body: { message: "already exists" } });+ });++ it("reads existing AutoInstrumentation custom objects", async () => {+ mockGetNamespacedCustomObject.mockResolvedValueOnce({ body: "found" });++ await expect(getAgentInstrumentation("default", "api")).resolves.toEqual({+ data: { body: "found" },+ exists: true,+ });++ expect(mockGetNamespacedCustomObject).toHaveBeenCalledWith({+ group: "openlit.io",+ version: "v1alpha1",+ namespace: "default",+ plural: "autoinstrumentations",+ name: "openlit-agent-api",+ });+ });++ it("maps Kubernetes 404s to exists=false", async () => {+ mockGetNamespacedCustomObject.mockRejectedValueOnce({ statusCode: 404 });++ await expect(getAgentInstrumentation("default", "api")).resolves.toEqual({+ exists: false,+ });+ });++ it("deletes AutoInstrumentation custom objects and reports errors", async () => {+ mockDeleteNamespacedCustomObject.mockResolvedValueOnce({ body: "deleted" });+ await expect(deleteAgentInstrumentation("default", "api")).resolves.toEqual({+ data: { body: "deleted" },+ });++ mockDeleteNamespacedCustomObject.mockRejectedValueOnce(new Error("no access"));+ await expect(deleteAgentInstrumentation("default", "api")).resolves.toEqual({+ err: "no access",+ });+ });+});diff --git a/src/client/src/__tests__/lib/platform/request/request.test.ts b/src/client/src/__tests__/lib/platform/request/request.test.tsindex 12801ff5..465f03e1 100644--- a/src/client/src/__tests__/lib/platform/request/request.test.ts+++ b/src/client/src/__tests__/lib/platform/request/request.test.ts@@ -43,6 +43,26 @@ describe('getRequestPerTime', () => {});});+describe('getGroupByExpression', () => {+ it('returns predefined group-by expressions', () => {+ expect(getGroupByExpression('model')).toBe("SpanAttributes['gen_ai.request.model']");+ expect(getGroupByExpression('provider')).toBe("SpanAttributes['gen_ai.system']");+ });++ it('builds safe span/resource/field group-by expressions', () => {+ expect(getGroupByExpression('custom.key')).toBe("SpanAttributes['custom.key']");+ expect(getGroupByExpression("SpanAttributes:o'malley")).toBe("SpanAttributes['o\\'malley']");+ expect(getGroupByExpression('ResourceAttributes:service.name')).toBe("ResourceAttributes['service.name']");+ expect(getGroupByExpression('Field:Duration')).toBe('Duration');+ });++ it('rejects empty and unsupported field group-by inputs', () => {+ expect(getGroupByExpression('')).toBeNull();+ expect(getGroupByExpression('SpanAttributes: ')).toBeNull();+ expect(getGroupByExpression('Field:Duration;DROP')).toBeNull();+ });+});+describe('getTotalRequests', () => {it('builds JOIN query for current/previous comparison', async () => {await getTotalRequests(baseParams);diff --git a/src/client/src/__tests__/selectors/agents-instrumentation.test.ts b/src/client/src/__tests__/selectors/agents-instrumentation.test.tsnew file mode 100644index 00000000..d78c4cdb--- /dev/null+++ b/src/client/src/__tests__/selectors/agents-instrumentation.test.ts@@ -0,0 +1,58 @@+import {+ getAgentIntents,+ getClearAgentIntent,+ getPruneExpiredAgentIntents,+ getSetAgentIntent,+ useAgentIntent,+} from "@/selectors/agents-instrumentation";+import { useRootStore } from "@/store";++jest.mock("@/store", () => ({+ useRootStore: jest.fn(),+}));++const mockUseRootStore = jest.mocked(useRootStore);++describe("agent instrumentation selectors", () => {+ const state = {+ agentsInstrumentation: {+ intents: {+ "agent-1": {+ llm: {+ feature: "llm",+ direction: "enabling",+ queuedAt: 1000,+ expiresAt: 2000,+ },+ },+ },+ setIntent: jest.fn(),+ clearIntent: jest.fn(),+ pruneExpired: jest.fn(),+ },+ } as any;++ beforeEach(() => {+ jest.clearAllMocks();+ mockUseRootStore.mockImplementation((selector: any) => selector(state));+ });++ it("returns selector values and action references", () => {+ expect(getAgentIntents(state)).toBe(state.agentsInstrumentation.intents);+ expect(getSetAgentIntent(state)).toBe(state.agentsInstrumentation.setIntent);+ expect(getClearAgentIntent(state)).toBe(+ state.agentsInstrumentation.clearIntent+ );+ expect(getPruneExpiredAgentIntents(state)).toBe(+ state.agentsInstrumentation.pruneExpired+ );+ });++ it("returns the matching optimistic intent from the hook selector", () => {+ expect(useAgentIntent("agent-1", "llm")).toBe(+ state.agentsInstrumentation.intents["agent-1"].llm+ );+ expect(useAgentIntent("agent-1", "agent")).toBeNull();+ expect(useAgentIntent("missing", "llm")).toBeNull();+ });+});diff --git a/src/client/src/__tests__/selectors/project.test.ts b/src/client/src/__tests__/selectors/project.test.tsnew file mode 100644index 00000000..e31b9064--- /dev/null+++ b/src/client/src/__tests__/selectors/project.test.ts@@ -0,0 +1,21 @@+import {+ getCurrentProject,+ getProjectIsLoading,+ getProjectList,+} from "@/selectors/project";++describe("project selectors", () => {+ it("returns project slice values", () => {+ const state = {+ project: {+ list: [{ id: "project-1" }],+ current: { id: "project-1" },+ isLoading: true,+ },+ } as any;++ expect(getProjectList(state)).toBe(state.project.list);+ expect(getCurrentProject(state)).toBe(state.project.current);+ expect(getProjectIsLoading(state)).toBe(true);+ });+});diff --git a/src/client/src/__tests__/store/agents-instrumentation.test.ts b/src/client/src/__tests__/store/agents-instrumentation.test.tsnew file mode 100644index 00000000..235487bd--- /dev/null+++ b/src/client/src/__tests__/store/agents-instrumentation.test.ts@@ -0,0 +1,110 @@+import { create } from "zustand";+import { withLenses } from "@dhmk/zustand-lens";+import {+ agentsInstrumentationStoreSlice,+ OPTIMISTIC_INTENT_TTL_MS,+} from "@/store/agents-instrumentation";++const createStore = () =>+ create<any>()(+ withLenses({ agentsInstrumentation: agentsInstrumentationStoreSlice })+ );++describe("agentsInstrumentationStoreSlice", () => {+ let store: ReturnType<typeof createStore>;+ let nowSpy: jest.SpyInstance<number, []>;++ beforeEach(() => {+ store = createStore();+ nowSpy = jest.spyOn(Date, "now").mockReturnValue(1000);+ });++ afterEach(() => {+ nowSpy.mockRestore();+ });++ it("sets optimistic intents with expiry metadata", () => {+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "llm", "enabling");++ expect(store.getState().agentsInstrumentation.intents).toEqual({+ "agent-1": {+ llm: {+ feature: "llm",+ direction: "enabling",+ queuedAt: 1000,+ expiresAt: 1000 + OPTIMISTIC_INTENT_TTL_MS,+ },+ },+ });+ });++ it("tracks independent feature intents per agent", () => {+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "llm", "enabling");+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "agent", "disabling");++ expect(+ Object.keys(store.getState().agentsInstrumentation.intents["agent-1"])+ ).toEqual(["llm", "agent"]);+ });++ it("clears individual intents and removes empty agent entries", () => {+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "llm", "enabling");+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "agent", "disabling");++ store.getState().agentsInstrumentation.clearIntent("agent-1", "llm");+ expect(store.getState().agentsInstrumentation.intents["agent-1"]).toEqual({+ agent: expect.objectContaining({ feature: "agent" }),+ });++ store.getState().agentsInstrumentation.clearIntent("agent-1", "agent");+ expect(store.getState().agentsInstrumentation.intents).toEqual({});+ });++ it("ignores clearing missing intents", () => {+ store.getState().agentsInstrumentation.clearIntent("missing", "llm");+ expect(store.getState().agentsInstrumentation.intents).toEqual({});+ });++ it("prunes expired intents and keeps fresh intents", () => {+ nowSpy.mockReturnValue(1000);+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "llm", "enabling");++ nowSpy.mockReturnValue(2000);+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-2", "agent", "disabling");++ nowSpy.mockReturnValue(1001 + OPTIMISTIC_INTENT_TTL_MS);+ store.getState().agentsInstrumentation.pruneExpired();++ expect(store.getState().agentsInstrumentation.intents).toEqual({+ "agent-2": {+ agent: expect.objectContaining({ feature: "agent" }),+ },+ });+ });++ it("keeps state unchanged when nothing is expired", () => {+ store+ .getState()+ .agentsInstrumentation.setIntent("agent-1", "llm", "enabling");+ const before = store.getState().agentsInstrumentation.intents;++ nowSpy.mockReturnValue(1000 + OPTIMISTIC_INTENT_TTL_MS - 1);+ store.getState().agentsInstrumentation.pruneExpired();++ expect(store.getState().agentsInstrumentation.intents).toBe(before);+ });+});diff --git a/src/client/src/__tests__/store/project.test.ts b/src/client/src/__tests__/store/project.test.tsnew file mode 100644index 00000000..5364f1b6--- /dev/null+++ b/src/client/src/__tests__/store/project.test.ts@@ -0,0 +1,90 @@+import { create } from "zustand";+import { withLenses } from "@dhmk/zustand-lens";+import { projectStoreSlice } from "@/store/project";+import type { ProjectWithMeta } from "@/types/store/project";++const createStore = () => create<any>()(withLenses({ project: projectStoreSlice }));++const project = (+ id: string,+ overrides: Partial<ProjectWithMeta> = {}+): ProjectWithMeta => ({+ id,+ organisationId: "org-1",+ name: `Project ${id}`,+ slug: id,+ isDefault: false,+ isCurrent: false,+ createdAt: "2026-01-01T00:00:00.000Z",+ ...overrides,+});++describe("projectStoreSlice", () => {+ let store: ReturnType<typeof createStore>;++ beforeEach(() => {+ store = createStore();+ });++ it("starts with the expected initial state", () => {+ expect(store.getState().project.list).toBeUndefined();+ expect(store.getState().project.current).toBeUndefined();+ expect(store.getState().project.isLoading).toBe(false);+ });++ it("selects current, default, then first project when setting the list", () => {+ const first = project("first");+ const fallback = project("fallback", { isDefault: true });+ const current = project("current", { isCurrent: true });++ store.getState().project.setList([first, fallback, current]);+ expect(store.getState().project.current).toEqual(current);++ store.getState().project.setList([first, fallback]);+ expect(store.getState().project.current).toEqual(fallback);++ store.getState().project.setList([first]);+ expect(store.getState().project.current).toEqual(first);+ expect(store.getState().project.isLoading).toBe(false);+ });++ it("sets the current project and updates list flags", () => {+ const first = project("first", { isCurrent: true });+ const second = project("second");++ store.getState().project.setList([first, second]);+ store.getState().project.setCurrent(second);++ expect(store.getState().project.current).toMatchObject({+ id: "second",+ isCurrent: true,+ });+ expect(store.getState().project.list).toEqual([+ expect.objectContaining({ id: "first", isCurrent: false }),+ expect.objectContaining({ id: "second", isCurrent: true }),+ ]);+ });++ it("clears current when setCurrent receives no matching project", () => {+ store.getState().project.setList([project("first")]);+ store.getState().project.setCurrent(undefined);++ expect(store.getState().project.current).toBeUndefined();+ expect(store.getState().project.list).toEqual([+ expect.objectContaining({ id: "first", isCurrent: false }),+ ]);+ });++ it("updates loading state and resets the slice", () => {+ store.getState().project.setList([project("first")]);+ store.getState().project.setIsLoading(true);+ expect(store.getState().project.isLoading).toBe(true);++ store.getState().project.reset();+ expect(store.getState().project).toMatchObject({+ list: undefined,+ current: undefined,+ isLoading: false,+ });+ });+});diff --git a/src/client/src/app/(playground)/evaluations/layout.tsx b/src/client/src/app/(playground)/evaluations/layout.tsxindex 039a83ed..3fa971b8 100644--- a/src/client/src/app/(playground)/evaluations/layout.tsx+++ b/src/client/src/app/(playground)/evaluations/layout.tsx@@ -1,68 +1,9 @@-"use client";-import { usePathname, useRouter } from "next/navigation";-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";import type React from "react";-import { PRIMARY_BACKGROUND } from "@/constants/common-classes";-import { Settings, Layers } from "lucide-react";export default function EvaluationsLayout({children,}: {children: React.ReactNode;}) {- const router = useRouter();- const pathname = usePathname();-- const tabs = [- {- value: "settings",- label: "Settings",- path: "/evaluations/settings",- icon: Settings,- },- {- value: "types",- label: "Evaluation Types",- path: "/evaluations/types",- icon: Layers,- },- ];-- const currentTab =- tabs.find((tab) => pathname.startsWith(tab.path))?.value || "settings";-- const handleTabChange = (value: string) => {- const tab = tabs.find((t) => t.value === value);- if (tab) {- router.push(tab.path);- }- };-- return (- <Tabs- value={currentTab}- onValueChange={handleTabChange}- className="w-full flex flex-col h-full"- >- <div className="flex items-center justify-between gap-4 mb-4">- <TabsList className="p-0 h-[30px] grid grid-cols-2 self-start border border-stone-200 dark:border-stone-800">- {tabs.map((tab) => (- <TabsTrigger- key={tab.value}- value={tab.value}- className="py-1.5 text-xs rounded-md flex items-center gap-1.5"- >- <tab.icon className="size-3.5" />- {tab.label}- </TabsTrigger>- ))}- </TabsList>- </div>- <div- className={`flex w-full border border-stone-200 dark:border-stone-800 ${PRIMARY_BACKGROUND} rounded-lg grow overflow-hidden`}- >- {children}- </div>- </Tabs>- );+ return children;}diff --git a/src/client/src/app/(playground)/evaluations/settings/page.tsx b/src/client/src/app/(playground)/evaluations/settings/page.tsxindex 305b1965..68b790c7 100644--- a/src/client/src/app/(playground)/evaluations/settings/page.tsx+++ b/src/client/src/app/(playground)/evaluations/settings/page.tsx@@ -22,9 +22,10 @@ import {} from "@/components/ui/select";import { Input } from "@/components/ui/input";import Link from "next/link";-import { Zap, Settings2, Clock, Play, Info, SettingsIcon } from "lucide-react";+import { Zap, Settings2, Clock, Play, Info, SettingsIcon, Layers } from "lucide-react";import { ProviderMetadata, ModelMetadata } from "@/types/openground";import { Badge } from "@/components/ui/badge";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";const EvaluationVaultCreate = ({successCallback,@@ -173,16 +174,22 @@ export default function EvaluationSettingsPage() {}return (- <div className="flex flex-col flex-1 h-full w-full p-6 overflow-auto gap-6">- {/* Page header */}- <div className="space-y-1">- <h1 className="text-lg font-semibold text-stone-900 dark:text-stone-100">- {getMessage().EVALUATION_ENGINE_TITLE}- </h1>- <p className="text-sm text-stone-500 dark:text-stone-400">- {getMessage().EVALUATION_ENGINE_DESCRIPTION}- </p>- </div>+ <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">+ <FeaturePageHeader+ eyebrow="Configuration"+ title={getMessage().EVALUATION_ENGINE_TITLE}+ description="Continuously grade AI outputs with automated and manual checks that turn quality signals into action."+ icon={<Settings2 className="h-4 w-4" />}+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"+ actions={+ <Button asChild variant="outline" size="sm" className="h-8">+ <Link href="/evaluations/types">+ <Layers className="mr-1.5 h-3.5 w-3.5" />+ Evaluation Types+ </Link>+ </Button>+ }+ /><Card className="border-blue-200 dark:border-blue-900/50 bg-blue-50/50 dark:bg-blue-950/20"><CardContent className="pt-6"><div className="flex gap-3">diff --git a/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx b/src/client/src/app/(playground)/evaluations/types/[id]/page.tsxindex b426fe11..bf074c2f 100644--- a/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx+++ b/src/client/src/app/(playground)/evaluations/types/[id]/page.tsx@@ -18,9 +18,10 @@ import { usePostHog } from "posthog-js/react";import { CLIENT_EVENTS } from "@/constants/events";import { Rule } from "@/types/rule-engine";import { toast } from "sonner";-import { Link2, Plus, Trash2, ExternalLink, ArrowLeft, Sparkles } from "lucide-react";+import { Link2, Plus, Trash2, ExternalLink, ArrowLeft, Sparkles, Layers } from "lucide-react";import { Button } from "@/components/ui/button";import Link from "next/link";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";interface RuleWithPriority {ruleId: string;@@ -202,33 +203,30 @@ export default function EvaluationTypeDetailPage() {}return (- <div className="flex flex-col flex-1 h-full w-full p-6 overflow-auto gap-6">-- <div className="flex items-center gap-4">- <Link href="/evaluations/types">- <Button- variant="outline"- size="icon"- className="shrink-0 text-stone-700 dark:text-stone-200 border-stone-300 dark:border-stone-600 hover:bg-stone-100 dark:hover:bg-stone-800"- >- <ArrowLeft className="size-4" />- </Button>- </Link>- <div>- <h2 className="text-lg font-semibold text-stone-800 dark:text-stone-200 flex items-center gap-2">- {displayLabel}+ <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">+ <FeaturePageHeader+ eyebrow="Configuration"+ title={displayLabel}+ description={displayDescription}+ icon={<Layers className="h-4 w-4" />}+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"+ actions={+ <div className="flex flex-wrap items-center gap-2">{isCustom && (- <Badge variant="outline" className="text-xs font-normal gap-1 border-primary/30 text-primary">+ <Badge variant="outline" className="h-8 gap-1 border-primary/30 text-primary"><Sparkles className="size-3" />Custom</Badge>)}- </h2>- <p className="text-sm text-stone-500 dark:text-stone-400">- {displayDescription}- </p>- </div>- </div>+ <Button asChild variant="outline" size="sm" className="h-8">+ <Link href="/evaluations/types">+ <ArrowLeft className="mr-1.5 h-3.5 w-3.5" />+ Evaluation Types+ </Link>+ </Button>+ </div>+ }+ /><div className="grid grid-cols-3 gap-4"><div className="grid col-span-2 gap-4">diff --git a/src/client/src/app/(playground)/evaluations/types/new/page.tsx b/src/client/src/app/(playground)/evaluations/types/new/page.tsxindex f06a3471..4555d206 100644--- a/src/client/src/app/(playground)/evaluations/types/new/page.tsx+++ b/src/client/src/app/(playground)/evaluations/types/new/page.tsx@@ -12,6 +12,7 @@ import { toast } from "sonner";import useFetchWrapper from "@/utils/hooks/useFetchWrapper";import { usePostHog } from "posthog-js/react";import { CLIENT_EVENTS } from "@/constants/events";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";export default function CreateCustomEvaluationTypePage() {const posthog = usePostHog();@@ -95,28 +96,22 @@ export default function CreateCustomEvaluationTypePage() {};return (- <div className="flex flex-col flex-1 h-full w-full p-6 overflow-auto gap-6">- {/* Header */}- <div className="flex items-center gap-4">- <Link href="/evaluations/types">- <Button- variant="outline"- size="icon"- className="shrink-0 text-stone-700 dark:text-stone-200 border-stone-300 dark:border-stone-600 hover:bg-stone-100 dark:hover:bg-stone-800"- >- <ArrowLeft className="size-4" />+ <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">+ <FeaturePageHeader+ eyebrow="Configuration"+ title="Create Custom Evaluation Type"+ description="Define a domain-specific judge that scores traces against the behavior, policy, and quality criteria your product needs."+ icon={<Sparkles className="h-4 w-4" />}+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"+ actions={+ <Button asChild variant="outline" size="sm" className="h-8">+ <Link href="/evaluations/types">+ <ArrowLeft className="mr-1.5 h-3.5 w-3.5" />+ Evaluation Types+ </Link></Button>- </Link>- <div>- <h2 className="text-lg font-semibold text-stone-900 dark:text-stone-100 flex items-center gap-2">- <Sparkles className="size-5 text-primary" />- Create Custom Evaluation Type- </h2>- <p className="text-sm text-stone-500 dark:text-stone-400">- Define a custom evaluation type with your own prompt. The LLM judge will use it to evaluate traces.- </p>- </div>- </div>+ }+ /><div className="grid grid-cols-3 gap-4"><div className="col-span-2 space-y-4">diff --git a/src/client/src/app/(playground)/evaluations/types/page.tsx b/src/client/src/app/(playground)/evaluations/types/page.tsxindex b922cc84..e894ef76 100644--- a/src/client/src/app/(playground)/evaluations/types/page.tsx+++ b/src/client/src/app/(playground)/evaluations/types/page.tsx@@ -8,9 +8,10 @@ import { EVALUATION_TYPES } from "@/constants/evaluation-types";import { usePostHog } from "posthog-js/react";import { CLIENT_EVENTS } from "@/constants/events";import { Rule } from "@/types/rule-engine";-import { Layers, CheckCircle2, ChevronRight, ArrowLeft, Plus, Sparkles } from "lucide-react";+import { Layers, CheckCircle2, ChevronRight, Settings2, Plus, Sparkles } from "lucide-react";import Link from "next/link";import { Button } from "@/components/ui/button";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";interface EvaluationTypeDisplay {id: string;@@ -153,35 +154,31 @@ export default function EvaluationTypesPage() {};return (- <div className="flex flex-1 h-full w-full p-6 overflow-auto">- <div className="w-full space-y-6">- <div className="flex items-start gap-4">- <Link href="/evaluations/settings">- <Button- variant="outline"- size="icon"- className="shrink-0 text-stone-700 dark:text-stone-200 border-stone-300 dark:border-stone-600 hover:bg-stone-100 dark:hover:bg-stone-800"- >- <ArrowLeft className="size-4" />- </Button>- </Link>- <div className="flex-1">- <h2 className="text-lg font-semibold text-stone-900 dark:text-stone-100 flex items-center gap-2">- <Layers className="size-5" />- Evaluation Types- </h2>- <p className="text-sm text-stone-500 dark:text-stone-400 mt-1">- Configure built-in evaluation types or create custom ones. Click a type to set rules,- priorities, and evaluation context.- </p>- </div>- <Link href="/evaluations/types/new">- <Button className="shrink-0">- <Plus className="size-4 mr-1.5" />- Create Custom Type- </Button>- </Link>- </div>+ <div className="flex flex-1 h-full w-full overflow-auto">+ <div className="w-full space-y-4">+ <FeaturePageHeader+ eyebrow="Configuration"+ title="Evaluation Types"+ description="Shape what quality means for your AI system with built-in checks, custom judges, and rule-driven context."+ icon={<Layers className="h-4 w-4" />}+ tone="border-orange-200 bg-orange-50 text-orange-700 dark:border-orange-900/70 dark:bg-orange-950/40 dark:text-orange-300"+ actions={+ <div className="flex flex-wrap items-center gap-2">+ <Button asChild variant="outline" size="sm" className="h-8">+ <Link href="/evaluations/settings">+ <Settings2 className="mr-1.5 h-3.5 w-3.5" />+ Settings+ </Link>+ </Button>+ <Button asChild size="sm" className="h-8">+ <Link href="/evaluations/types/new">+ <Plus className="mr-1.5 h-3.5 w-3.5" />+ Create Custom Type+ </Link>+ </Button>+ </div>+ }+ />{/* Built-in types */}<div className="grid grid-cols-1 md:grid-cols-2 gap-4">diff --git a/src/client/src/app/(playground)/fleet-hub/list.tsx b/src/client/src/app/(playground)/fleet-hub/list.tsxindex 74a874c5..33b58851 100644--- a/src/client/src/app/(playground)/fleet-hub/list.tsx+++ b/src/client/src/app/(playground)/fleet-hub/list.tsx@@ -13,6 +13,9 @@ import LinuxSvg from "@/components/svg/linux";import WindowsSvg from "@/components/svg/windows";import { formatDate } from "@/utils/date";import MacSvg from "@/components/svg/mac";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";+import OpenTelemetrySvg from "@/components/svg/opentelemetry";+import getMessage from "@/constants/messages";const osTypeMap = {linux: <LinuxSvg />,@@ -137,9 +140,7 @@ export default function List({ agents, isLoading, isFetched }: {return (<div className="flex flex-col w-full h-full gap-3">- <div className="flex items-end justify-end w-full">- <VisibilityColumns columns={columns} pageName={"fleethub"} />- </div>+ <FeaturePageHeader eyebrow="Monitoring" title={getMessage().FEATURE_FLEET_HUB} description="Operate every collector from one control plane—health, configuration, and ownership stay visible as your telemetry footprint grows." icon={<OpenTelemetrySvg className="h-4 w-4" />} tone="border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-900/70 dark:bg-sky-950/40 dark:text-sky-300" actions={<VisibilityColumns columns={columns} pageName={"fleethub"} />} /><DataTablecolumns={columns}data={agents}diff --git a/src/client/src/app/(playground)/fleet-hub/page.tsx b/src/client/src/app/(playground)/fleet-hub/page.tsxindex 2cc7c025..56939a5b 100644--- a/src/client/src/app/(playground)/fleet-hub/page.tsx+++ b/src/client/src/app/(playground)/fleet-hub/page.tsx@@ -3,7 +3,6 @@ import { useEffect } from "react";import useFetchWrapper from "@/utils/hooks/useFetchWrapper";import { Agent } from "@/types/fleet-hub";import List from "./list";-import OpenTelemetrySvg from "@/components/svg/opentelemetry";import { usePostHog } from "posthog-js/react";import { CLIENT_EVENTS } from "@/constants/events";@@ -27,29 +26,8 @@ export default function Opamp() {}, []);return (- <div className="flex flex-col w-full gap-3">- {/* Feature Description Section */}- <div className="border dark:border-stone-800 rounded-lg p-6">- <div className="flex items-start space-x-4">- <div className="flex-shrink-0">- <div className="w-10 h-10 bg-stone-200 dark:bg-stone-700 rounded-full p-1.5 flex items-center justify-center">- <OpenTelemetrySvg className="fill-stone-600 dark:fill-stone-300" />- </div>- </div>- <div className="flex-1">- <h2 className="text-xl font-semibold text-stone-600 dark:text-stone-300 mb-2">- Fleet Hub- </h2>- <p className="text-stone-600 dark:text-stone-300 mb-4">- Fleet hub is a feature that uses OpAMP (Open Agent Management Protocol) to provide centralized management and monitor OpenTelemetry collectors across your infrastructure.- Monitor collector health, view detailed configurations, and manage collector settings from a unified dashboard.- </p>- </div>- </div>- </div>-- {/* Collector List */}+ <div className="flex flex-col w-full h-full"><List agents={data || []} isLoading={!data || isLoading} isFetched={isFetched} /></div>);-}\ No newline at end of file+}diff --git a/src/client/src/app/(playground)/manage-models/page.tsx b/src/client/src/app/(playground)/manage-models/page.tsxindex 1d44088c..cfb7daeb 100644--- a/src/client/src/app/(playground)/manage-models/page.tsx+++ b/src/client/src/app/(playground)/manage-models/page.tsx@@ -37,6 +37,7 @@ import { getDatabaseConfigList } from "@/selectors/database-config";import { Input } from "@/components/ui/input";import copy from "copy-to-clipboard";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";interface CustomModel extends ModelMetadata {id: string;@@ -188,17 +189,8 @@ export default function ManageModelsPage() {return (<div className="flex flex-col h-full w-full overflow-hidden">- {/* Header */}- <div className="flex items-center justify-between p-4 border-b border-stone-200 dark:border-stone-800 shrink-0">- <div className="flex flex-col gap-2">- <h1 className="text-lg font-semibold text-stone-900 dark:text-stone-100">- {m.OPENGROUND_MANAGE_MODELS}- </h1>- <p className="text-sm text-stone-500 dark:text-stone-400 mt-0.5">- {m.OPENGROUND_MANAGE_MODELS_DESCRIPTION}- </p>- </div>- <div className="flex items-center gap-2">+ <div className="shrink-0">+ <FeaturePageHeader eyebrow="Configuration" title={m.OPENGROUND_MANAGE_MODELS} description="Curate provider models, pricing, and defaults so experiments and production runs use trusted options." icon={<SettingsIcon className="h-4 w-4" />} tone="border-violet-200 bg-violet-50 text-violet-700 dark:border-violet-900/70 dark:bg-violet-950/40 dark:text-violet-300" actions={<div className="flex items-center gap-2"><Tooltip><TooltipTrigger><Button@@ -263,7 +255,7 @@ export default function ManageModelsPage() {{m.MANAGE_MODELS_EXPORT_PRICING}</TooltipContent></Tooltip>- </div>+ </div>} /></div>{/* SDK Pricing URL bar */}diff --git a/src/client/src/app/(playground)/openground/page.tsx b/src/client/src/app/(playground)/openground/page.tsxindex d5495b43..75d5c38f 100644--- a/src/client/src/app/(playground)/openground/page.tsx+++ b/src/client/src/app/(playground)/openground/page.tsx@@ -18,7 +18,7 @@ import { Button } from "@/components/ui/button";import { useRootStore } from "@/store";import { useRouter } from "next/navigation";import getMessage from "@/constants/messages";-import FeatureHero from "@/components/(playground)/getting-started/feature-hero";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";const columns: Columns<string, OpengroundRecord> = {prompt: {@@ -179,8 +179,12 @@ export default function Openground() {if (!data?.length && !isLoading && isFetched) {return (- <div className="flex flex-col items-center mx-auto p-8 overflow-auto">- <OpengroundGettingStarted />+ <div className="flex flex-col w-full h-full gap-4 overflow-auto">+ <OpengroundHeader validateResponse={false} />+ <FeaturePageHeader eyebrow="Resources" title={getMessage().FEATURE_OPENGROUND} description="Compare prompts and models side by side so teams can choose the fastest, cheapest, and highest-quality path." icon={<MonitorPlay className="h-4 w-4" />} tone="border-indigo-200 bg-indigo-50 text-indigo-700 dark:border-indigo-900/70 dark:bg-indigo-950/40 dark:text-indigo-300" />+ <div className="flex flex-col items-center mx-auto">+ <OpengroundGettingStarted />+ </div></div>);}@@ -188,11 +192,7 @@ export default function Openground() {return (<div className="flex flex-col w-full h-full gap-4"><OpengroundHeader validateResponse={false} />- <FeatureHero- iconComponent={<MonitorPlay />}- title={getMessage().FEATURE_OPENGROUND}- description={getMessage().GET_STARTED_WITH_OPENGROUND_DESCRIPTION}- />+ <FeaturePageHeader eyebrow="Resources" title={getMessage().FEATURE_OPENGROUND} description="Compare prompts and models side by side so teams can choose the fastest, cheapest, and highest-quality path." icon={<MonitorPlay className="h-4 w-4" />} tone="border-indigo-200 bg-indigo-50 text-indigo-700 dark:border-indigo-900/70 dark:bg-indigo-950/40 dark:text-indigo-300" /><DataTablecolumns={columns}diff --git a/src/client/src/app/(playground)/pricing/page.tsx b/src/client/src/app/(playground)/pricing/page.tsxindex 5877712a..9757d3bc 100644--- a/src/client/src/app/(playground)/pricing/page.tsx+++ b/src/client/src/app/(playground)/pricing/page.tsx@@ -18,6 +18,7 @@ import {import Link from "next/link";import { useEffect, useState } from "react";import { toast } from "sonner";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";interface PricingConfig {id?: string;@@ -95,17 +96,8 @@ export default function PricingPage() {}return (- <div className="flex flex-col flex-1 h-full w-full p-6 overflow-auto gap-6">- {/* Page header */}- <div className="space-y-1">- <h1 className="text-lg font-semibold text-stone-900 dark:text-stone-100 flex items-center gap-2">- <CircleDollarSign className="size-5" />- {m.PRICING_TITLE}- </h1>- <p className="text-sm text-stone-500 dark:text-stone-400">- {m.PRICING_PAGE_DESCRIPTION}- </p>- </div>+ <div className="flex flex-col flex-1 h-full w-full overflow-auto gap-4">+ <FeaturePageHeader eyebrow="Configuration" title={m.PRICING_TITLE} description="Model provider cost and token economics so usage, evaluations, and experiments reflect real operating spend." icon={<CircleDollarSign className="size-4" />} tone="border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300" />{/* Single info bar (replaces the large left description card) */}<Card className="border-blue-200 dark:border-blue-900/50 bg-blue-50/50 dark:bg-blue-950/20">diff --git a/src/client/src/app/(playground)/settings/api-keys/page.tsx b/src/client/src/app/(playground)/settings/api-keys/page.tsxindex 6c06b2e3..0da29720 100644--- a/src/client/src/app/(playground)/settings/api-keys/page.tsx+++ b/src/client/src/app/(playground)/settings/api-keys/page.tsx@@ -5,6 +5,7 @@ import { CLIENT_EVENTS } from "@/constants/events";import ManageKeys from "@/components/(playground)/api-keys/manage";import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";import { Key, Shield, RotateCcw, Trash2 } from "lucide-react";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";export default function APIKeys() {const posthog = usePostHog();@@ -15,44 +16,32 @@ export default function APIKeys() {return (<div className="flex w-full flex-1 overflow-hidden">- <div className="flex flex-col grow w-full rounded overflow-hidden text-sm text-stone-900 dark:text-stone-300 gap-6 p-4">- {/* API Keys Information Callout */}- <Alert className="border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950/20 text-stone-700 dark:text-stone-300">- <Key className="h-5 w-5 stroke-stone-700 dark:stroke-stone-300" />- <AlertTitle className="text-base font-semibold">- API Key Management+ <div className="flex flex-col grow w-full rounded overflow-auto text-sm text-stone-900 dark:text-stone-300 gap-4">+ <FeaturePageHeader+ eyebrow="Settings"+ title="API Keys"+ description="Create scoped credentials for integrations while keeping secrets rotated, revocable, and under your control."+ icon={<Key className="h-4 w-4" />}+ tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15"+ />+ <Alert className="border-amber-200 bg-amber-50/70 py-3 text-stone-700 dark:border-amber-900/60 dark:bg-amber-950/20 dark:text-stone-300">+ <Shield className="h-4 w-4 stroke-amber-700 dark:stroke-amber-300" />+ <AlertTitle className="text-sm font-semibold text-stone-900 dark:text-stone-100">+ Important notice</AlertTitle>- <AlertDescription className="mt-2">- <p className="mb-4">- Welcome to the API Key Management page. Here, you can view, generate,- and manage API keys for seamless integration with our services. Please- note that we do not display your secret API keys again after you- generate them.- </p>-- <div className="space-y-3">- <div className="flex items-start gap-3">- <Shield className="h-4 w-4 mt-0.5 flex-shrink-0" />- <div>- <span className="font-semibold">Keep Your Keys Secure:</span>- <span className="ml-1">Treat your API keys like passwords. Do not share them publicly or expose them in places where unauthorized individuals may access them.</span>- </div>+ <AlertDescription className="mt-1">+ <div className="grid gap-2 text-xs leading-relaxed text-stone-600 dark:text-stone-400 md:grid-cols-3">+ <div className="flex items-start gap-2">+ <Key className="mt-0.5 h-3.5 w-3.5 shrink-0" />+ <span>Secret keys are shown only once after generation.</span></div>-- <div className="flex items-start gap-3">- <RotateCcw className="h-4 w-4 mt-0.5 flex-shrink-0" />- <div>- <span className="font-semibold">Rotate Keys Regularly:</span>- <span className="ml-1">For enhanced security, consider rotating your keys periodically.</span>- </div>+ <div className="flex items-start gap-2">+ <RotateCcw className="mt-0.5 h-3.5 w-3.5 shrink-0" />+ <span>Rotate keys periodically and after team changes.</span></div>-- <div className="flex items-start gap-3">- <Trash2 className="h-4 w-4 mt-0.5 flex-shrink-0" />- <div>- <span className="font-semibold">Revoke Unused Keys:</span>- <span className="ml-1">If a key is no longer needed or compromised, revoke it immediately.</span>- </div>+ <div className="flex items-start gap-2">+ <Trash2 className="mt-0.5 h-3.5 w-3.5 shrink-0" />+ <span>Revoke unused or exposed keys immediately.</span></div></div></AlertDescription>diff --git a/src/client/src/app/(playground)/settings/layout.tsx b/src/client/src/app/(playground)/settings/layout.tsxindex 87a90467..001c5139 100644--- a/src/client/src/app/(playground)/settings/layout.tsx+++ b/src/client/src/app/(playground)/settings/layout.tsx@@ -1,50 +1,14 @@"use client";-import { usePathname, useRouter } from "next/navigation";-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";import type React from "react";-import ThemeToggleSwitch from "@/components/(playground)/sidebar/theme-switch";-import { PRIMARY_BACKGROUND } from "@/constants/common-classes";-import { getSettingsTabs } from "@/constants/settings";export default function SettingsLayout({children,}: {children: React.ReactNode;}) {- const router = useRouter();- const pathname = usePathname();- const tabs = getSettingsTabs();-- const currentTab =- tabs.find((tab) => pathname.startsWith(tab.path))?.value || "profile";-- const handleTabChange = (value: string) => {- const tab = tabs.find((t) => t.value === value);- if (tab) {- router.push(tab.path);- }- };-return (-- <Tabs- value={currentTab}- onValueChange={handleTabChange}- className="w-full flex flex-col h-full"- >- <div className="flex items-center justify-between gap-4 mb-4">- <TabsList className="p-0 h-[30px] flex self-start border border-stone-200 dark:border-stone-800">- {tabs.map((tab) => (- <TabsTrigger key={tab.value} value={tab.value} className="py-1.5 text-xs rounded-md">- {tab.label}- </TabsTrigger>- ))}- </TabsList>- <ThemeToggleSwitch />- </div>- <div className={`flex w-full border border-stone-200 dark:border-stone-800 ${PRIMARY_BACKGROUND} rounded-lg grow overflow-hidden`}>- {children}- </div>- </Tabs>+ <div className={`flex h-full w-full grow overflow-hidden rounded-lg `}>+ {children}+ </div>);}diff --git a/src/client/src/app/(playground)/settings/profile/page.tsx b/src/client/src/app/(playground)/settings/profile/page.tsxindex 432749d8..2d84a331 100644--- a/src/client/src/app/(playground)/settings/profile/page.tsx+++ b/src/client/src/app/(playground)/settings/profile/page.tsx@@ -10,6 +10,8 @@ import { User } from "@prisma/client";import { usePostHog } from "posthog-js/react";import { toast } from "sonner";import { PRIMARY_BACKGROUND } from "@/constants/common-classes";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";+import { UserIcon } from "lucide-react";const PROFILE_TOAST_ID = "profile-details";@@ -156,8 +158,11 @@ export default function Profile() {};return (- <div className="flex flex-1 h-full w-full relative">- <ModifyProfileDetails user={userDetails as User} fetchUser={fetchUser} />+ <div className="flex flex-1 h-full w-full flex-col gap-4 overflow-auto">+ <FeaturePageHeader eyebrow="Settings" title="User Profile" description="Keep your identity, password, and workspace access details current across OpenLIT." icon={<UserIcon className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30 dark:bg-primary/15" />+ <div className={`flex w-full h-full ${PRIMARY_BACKGROUND}`}>+ <ModifyProfileDetails user={userDetails as User} fetchUser={fetchUser} />+ </div></div>);}diff --git a/src/client/src/components/(playground)/chat/chat-layout.tsx b/src/client/src/components/(playground)/chat/chat-layout.tsxindex f9eb4a6c..2f12ca86 100644--- a/src/client/src/components/(playground)/chat/chat-layout.tsx+++ b/src/client/src/components/(playground)/chat/chat-layout.tsx@@ -4,19 +4,15 @@ import { useEffect, useCallback } from "react";import { useRouter } from "next/navigation";import { usePostHog } from "posthog-js/react";import { Card } from "@/components/ui/card";-import { ResizeablePanel } from "@/components/ui/resizeable-panel";-import ConversationList from "./conversation-list";import ChatPanel from "./chat-panel";import OtterUsageView from "./otter-usage-view";import ChatSettingsForm from "./chat-settings-form";import TraceDetailRequestSheet from "@/components/(playground)/observability/trace-detail-request-sheet";import { useRootStore } from "@/store";import {- getChatConversations,getChatActiveId,getChatHasConfig,getChatConfigInfo,- getChatIsLoadingConversations,getChatIsLoadingConfig,getChatActions,} from "@/selectors/chat";@@ -34,21 +30,16 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"const router = useRouter();const posthog = usePostHog();- const conversations = useRootStore(getChatConversations);const activeId = useRootStore(getChatActiveId);const hasConfig = useRootStore(getChatHasConfig);const configInfo = useRootStore(getChatConfigInfo);- const loadingConversations = useRootStore(getChatIsLoadingConversations);const loadingConfig = useRootStore(getChatIsLoadingConfig);const {- setConversations,setActiveConversationId,setHasConfig,setConfigInfo,- setIsLoadingConversations,setIsLoadingConfig,addConversation,- removeConversation,} = useRootStore(getChatActions);// Sync activeId with URL param@@ -56,30 +47,6 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"setActiveConversationId(initialConversationId);}, [initialConversationId, setActiveConversationId]);- const fetchConversations = useCallback(async () => {- try {- const res = await fetch("/api/chat/conversation");- const result = await res.json();- if (result.data) {- setConversations(- result.data.map((c: any) => ({- id: c.id,- title: c.title || m.CHAT_NEW_CONVERSATION,- totalCost: Number(c.totalCost) || 0,- totalMessages: Number(c.totalMessages) || 0,- totalPromptTokens: Number(c.totalPromptTokens) || 0,- totalCompletionTokens: Number(c.totalCompletionTokens) || 0,- updatedAt: c.updatedAt,- }))- );- }- } catch {- // Silently fail- } finally {- setIsLoadingConversations(false);- }- }, [m, setConversations, setIsLoadingConversations]);-const fetchConfig = useCallback(async () => {try {const [configRes, providersRes] = await Promise.all([@@ -112,9 +79,8 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"}, [setHasConfig, setConfigInfo, setIsLoadingConfig]);useEffect(() => {- fetchConversations();fetchConfig();- }, [fetchConversations, fetchConfig]);+ }, [fetchConfig]);useEffect(() => {const event =@@ -137,14 +103,6 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"[router]);- const navigateToUsage = useCallback(() => {- router.push("/chat/usage");- }, [router]);-- const navigateToSettings = useCallback(() => {- router.push("/chat/settings");- }, [router]);-const handleNewConversation = useCallback(async (): Promise<string | null> => {try {const res = await fetch("/api/chat/conversation", {@@ -176,55 +134,8 @@ export default function ChatLayout({ initialConversationId, initialView = "chat"return null;}, [addConversation, navigateTo, m, configInfo]);- const handleDeleteConversation = useCallback(- async (id: string) => {- try {- await fetch(`/api/chat/conversation/${id}`, { method: "DELETE" });- removeConversation(id);- if (activeId === id) {- navigateTo(null);- }- } catch {- toast.error(m.CHAT_FAILED_TO_DELETE_CONVERSATION);- }- },- [activeId, removeConversation, navigateTo, m]- );-- const handleSelectConversation = useCallback(- (id: string) => {- navigateTo(id);- },- [navigateTo]- );-- const handleNewChat = useCallback(() => {- navigateTo(null);- }, [navigateTo]);-return (<Card className="flex h-full w-full overflow-hidden border border-stone-200 dark:border-stone-800">- <ResizeablePanel- defaultWidth={280}- minWidth={220}- maxWidth={400}- handlePosition="right"- className="border-r border-stone-200 dark:border-stone-800"- >- <ConversationList- conversations={conversations}- activeId={activeId}- isUsageActive={initialView === "usage"}- isSettingsActive={initialView === "settings"}- onSelect={handleSelectConversation}- onDelete={handleDeleteConversation}- onNew={handleNewChat}- onUsage={navigateToUsage}- onSettings={navigateToSettings}- isLoading={loadingConversations}- />- </ResizeablePanel>-<div className="flex-1 min-w-0 bg-white dark:bg-stone-950">{initialView === "usage" ? (<OtterUsageView />diff --git a/src/client/src/components/(playground)/chat/conversation-list.tsx b/src/client/src/components/(playground)/chat/conversation-list.tsxindex c3818c0c..8dfe7375 100644--- a/src/client/src/components/(playground)/chat/conversation-list.tsx+++ b/src/client/src/components/(playground)/chat/conversation-list.tsx@@ -1,7 +1,7 @@"use client";import { useState, useMemo } from "react";-import { BarChart3, Plus, Search, Settings } from "lucide-react";+import { Plus, Search } from "lucide-react";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import getMessage from "@/constants/messages";@@ -18,13 +18,9 @@ interface Conversation {interface ConversationListProps {conversations: Conversation[];activeId: string | null;- isUsageActive?: boolean;- isSettingsActive?: boolean;onSelect: (id: string) => void;onDelete: (id: string) => void;onNew: () => void;- onUsage: () => void;- onSettings: () => void;isLoading: boolean;}@@ -60,13 +56,9 @@ function groupByDate(conversations: Conversation[]) {export default function ConversationList({conversations,activeId,- isUsageActive,- isSettingsActive,onSelect,onDelete,onNew,- onUsage,- onSettings,isLoading,}: ConversationListProps) {const [search, setSearch] = useState("");@@ -81,57 +73,22 @@ export default function ConversationList({const groups = useMemo(() => groupByDate(filtered), [filtered]);return (- <div className="flex flex-col h-full bg-stone-50 dark:bg-stone-900">- {/* Header */}- <div className="p-3 space-y-3 border-b border-stone-200 dark:border-stone-800">- <div className="flex items-center gap-2">- <Button- onClick={onNew}- className="flex-1 justify-center gap-2"- size="sm"- >- <Plus className="h-4 w-4" />- {m.CHAT_NEW_CHAT}- </Button>- <Button- variant="outline"- size="icon"- className={`h-8 w-8 shrink-0 border-stone-200 dark:border-stone-700 ${- isSettingsActive- ? "bg-stone-200 text-stone-900 dark:bg-stone-800 dark:text-stone-100"- : ""- }`}- onClick={onSettings}- >- <Settings className="h-4 w-4" />- </Button>- </div>- <Button- variant="ghost"- size="sm"- onClick={onUsage}- className={`w-full justify-start gap-2 ${- isUsageActive- ? "bg-stone-200 text-stone-900 dark:bg-stone-800 dark:text-stone-100"- : "text-stone-600 hover:bg-stone-100 dark:text-stone-300 dark:hover:bg-stone-800"- }`}- >- <BarChart3 className="h-4 w-4" />- {m.CHAT_OTTER_USAGE}- </Button>+ <div className="flex h-full flex-col bg-stone-50 dark:bg-stone-950">+ <div className="space-y-3 px-4 py-4"><div className="relative"><Search className="absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-stone-400 dark:text-stone-500" /><Inputvalue={search}onChange={(e) => setSearch(e.target.value)}placeholder={m.CHAT_SEARCH_CONVERSATIONS}- className="pl-8 h-8 text-sm bg-white dark:bg-stone-800 border-stone-200 dark:border-stone-700"+ className="h-8 border-stone-200 bg-white pl-8 pr-10 text-sm dark:border-stone-700 dark:bg-stone-900"/>+ <Button variant="outline" size="icon" onClick={onNew} aria-label={m.CHAT_NEW_CHAT} className="absolute right-0 top-0 h-8 w-8 border-stone-200 bg-stone-50 text-primary hover:bg-stone-100 dark:border-stone-700 dark:bg-stone-900 dark:hover:bg-stone-800"><Plus className="size-4" /></Button></div></div>{/* Conversation list */}- <div className="flex-1 overflow-y-auto px-2 py-2">+ <div className="flex-1 overflow-y-auto px-3 py-2">{isLoading ? (<div className="space-y-2 px-1">{[1, 2, 3].map((i) => (diff --git a/src/client/src/components/(playground)/context/header.tsx b/src/client/src/components/(playground)/context/header.tsxindex d9df6b7f..f92b0a2e 100644--- a/src/client/src/components/(playground)/context/header.tsx+++ b/src/client/src/components/(playground)/context/header.tsx@@ -4,6 +4,8 @@ import { useRootStore } from "@/store";import { getPingStatus } from "@/selectors/database-config";import Link from "next/link";import getMessage from "@/constants/messages";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";+import { BookOpen } from "lucide-react";export default function ContextHeader({className = "flex w-full items-center justify-end gap-4",@@ -14,7 +16,7 @@ export default function ContextHeader({const pingStatus = useRootStore(getPingStatus);const m = getMessage();- return (+ const actions = (<div className={className}>{pingStatus === "success" && (<Button@@ -27,4 +29,6 @@ export default function ContextHeader({)}</div>);++ return <FeaturePageHeader eyebrow="Resources" title={m.CONTEXT_TITLE} description="Build reusable knowledge blocks that give prompts, rules, and agents the right business context at runtime." icon={<BookOpen className="h-4 w-4" />} tone="border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/70 dark:bg-blue-950/40 dark:text-blue-300" actions={actions} />;}diff --git a/src/client/src/components/(playground)/header-project-switch.tsx b/src/client/src/components/(playground)/header-project-switch.tsxindex 08a1072f..3c9420dd 100644--- a/src/client/src/components/(playground)/header-project-switch.tsx+++ b/src/client/src/components/(playground)/header-project-switch.tsx@@ -74,7 +74,7 @@ export default function HeaderProjectSwitch() {<DropdownMenuSeparator /><DropdownMenuItemonSelect={() => {- router.push("/organisation");+ router.push("/organisation?tab=projects");}}>{messages.MANAGE_PROJECTS}diff --git a/src/client/src/components/(playground)/organisation/organisation-page.tsx b/src/client/src/components/(playground)/organisation/organisation-page.tsxindex 8420ef62..67dfbeb0 100644--- a/src/client/src/components/(playground)/organisation/organisation-page.tsx+++ b/src/client/src/components/(playground)/organisation/organisation-page.tsx@@ -92,6 +92,7 @@ import {AlertDialogTrigger,} from "@/components/ui/alert-dialog";import CreateOrganisationDialog from "@/components/(playground)/sidebar/create-organisation-dialog";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";import getMessage from "@/constants/messages";import { escapeEmailForDisplay } from "@/utils/string";import { toast } from "sonner";@@ -147,6 +148,23 @@ export default function OrganisationSettingsPage() {const [projectName, setProjectName] = useState("");const [isProjectsLoading, setIsProjectsLoading] = useState(false);const [isCreatingProject, setIsCreatingProject] = useState(false);+ const requestedTab = searchParams.get("tab") || "details";+ const availableTabs = orgPendingInvites.length > 0+ ? ["details", "projects", "members", "pending", "all"]+ : ["details", "projects", "members", "all"];+ const selectedTab = availableTabs.includes(requestedTab)+ ? requestedTab+ : "details";+ const handleTabChange = (tab: string) => {+ const params = new URLSearchParams(searchParams.toString());+ if (tab === "details") {+ params.delete("tab");+ } else {+ params.set("tab", tab);+ }+ const query = params.toString();+ router.replace(query ? `/organisation?${query}` : "/organisation", { scroll: false });+ };const isCreator = currentOrg?.createdByUserId === currentUserId;@@ -324,19 +342,15 @@ export default function OrganisationSettingsPage() {};return (- <div className="p-4 space-y-4 overflow-auto w-full text-stone-700 dark:text-stone-300">- <div className="flex items-center justify-between">- <div>- <h1 className="text-xl font-bold">{messages.ORGANISATION_SETTINGS}</h1>- <p className="text-sm text-muted-foreground">- {messages.ORGANISATION_SETTINGS_DESCRIPTION}- </p>- </div>- <Button onClick={() => setCreateDialogOpen(true)} size="sm">- <Building2 className="h-3.5 w-3.5 mr-1.5" />- {messages.NEW_ORGANISATION}- </Button>- </div>+ <div className="space-y-4 overflow-auto w-full text-stone-700 dark:text-stone-300">+ <FeaturePageHeader+ eyebrow={messages.ORGANISATION}+ title={messages.ORGANISATION_SETTINGS}+ description="Manage organisations, projects, and team access from the top-level workspace control plane."+ icon={<Building2 className="h-4 w-4" />}+ tone="border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-300"+ actions={<Button onClick={() => setCreateDialogOpen(true)} size="sm"><Building2 className="mr-1.5 h-3.5 w-3.5" />{messages.NEW_ORGANISATION}</Button>}+ />{pendingInvitations.length > 0 && (<Card className="border-primary/20 bg-primary/5 dark:border-primary/30 dark:bg-primary/10">@@ -378,7 +392,7 @@ export default function OrganisationSettingsPage() {)}{currentOrg && (- <Tabs defaultValue={searchParams.get("tab") === "projects" ? "projects" : "details"} className="w-auto">+ <Tabs value={selectedTab} onValueChange={handleTabChange} className="w-auto"><TabsList className="w-auto justify-start p-0 h-auto"><TabsTrigger value="details" className="text-xs text-stone-700 dark:text-stone-300"><Settings className="h-3.5 w-3.5 mr-1.5" />diff --git a/src/client/src/components/(playground)/organisation/project-page-header.tsx b/src/client/src/components/(playground)/organisation/project-page-header.tsxindex b236f3d6..751df607 100644--- a/src/client/src/components/(playground)/organisation/project-page-header.tsx+++ b/src/client/src/components/(playground)/organisation/project-page-header.tsx@@ -9,5 +9,5 @@ import getMessage from "@/constants/messages";export default function ProjectPageHeader({ project }: { project?: { name?: string; isCurrent?: boolean; isDefault?: boolean } }) {const messages = getMessage();- return <FeaturePageHeader eyebrow={messages.ORGANISATION} title={project?.name || messages.LOADING_PROJECT} description={messages.PROJECT_DETAILS_DESCRIPTION} icon={<FolderKanban className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30" actions={<div className="flex flex-wrap items-center gap-2"><Button asChild variant="outline" size="sm" className="h-8"><Link href="/organisation"><ArrowLeft className="mr-1.5 h-3.5 w-3.5" />{messages.BACK_TO_ORGANISATION}</Link></Button>{project?.isCurrent ? <Badge className="h-6">{messages.CURRENT}</Badge> : null}{project?.isDefault ? <Badge variant="outline" className="h-6">{messages.DEFAULT_PROJECT}</Badge> : null}</div>} />;+ return <FeaturePageHeader eyebrow={messages.ORGANISATION} title={project?.name || messages.LOADING_PROJECT} description="Configure project identity and defaults so database connections and telemetry stay scoped correctly." icon={<FolderKanban className="h-4 w-4" />} tone="border-primary/20 bg-primary/10 text-primary dark:border-primary/30" actions={<div className="flex flex-wrap items-center gap-2"><Button asChild variant="outline" size="sm" className="h-8"><Link href="/organisation"><ArrowLeft className="mr-1.5 h-3.5 w-3.5" />{messages.BACK_TO_ORGANISATION}</Link></Button>{project?.isCurrent ? <Badge className="h-6">{messages.CURRENT}</Badge> : null}{project?.isDefault ? <Badge variant="outline" className="h-6">{messages.DEFAULT_PROJECT}</Badge> : null}</div>} />;}diff --git a/src/client/src/components/(playground)/prompt-hub/header.tsx b/src/client/src/components/(playground)/prompt-hub/header.tsxindex 0cbde900..982c2c3d 100644--- a/src/client/src/components/(playground)/prompt-hub/header.tsx+++ b/src/client/src/components/(playground)/prompt-hub/header.tsx@@ -5,6 +5,8 @@ import { useRootStore } from "@/store";import { getPingStatus } from "@/selectors/database-config";import PromptUsage from "./usage";import Link from "next/link";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";+import { Component } from "lucide-react";export default function PromptHubHeader({createNew,@@ -16,7 +18,7 @@ export default function PromptHubHeader({const m = getMessage();const pingStatus = useRootStore(getPingStatus);- return (+ const actions = (<div className={className}>{pingStatus === "success" && <PromptUsage />}{createNew && pingStatus === "success" && (@@ -30,4 +32,6 @@ export default function PromptHubHeader({)}</div>);++ return <FeaturePageHeader eyebrow="Resources" title={m.FEATURE_PROMPTS} description="Design, version, and reuse prompts so teams can ship consistent AI behavior across products." icon={<Component className="h-4 w-4" />} tone="border-pink-200 bg-pink-50 text-pink-700 dark:border-pink-900/70 dark:bg-pink-950/40 dark:text-pink-300" actions={actions} />;}diff --git a/src/client/src/components/(playground)/rule-engine/header.tsx b/src/client/src/components/(playground)/rule-engine/header.tsxindex e336cea9..e2df9136 100644--- a/src/client/src/components/(playground)/rule-engine/header.tsx+++ b/src/client/src/components/(playground)/rule-engine/header.tsx@@ -4,6 +4,8 @@ import RuleForm from "./form";import { useRootStore } from "@/store";import { getPingStatus } from "@/selectors/database-config";import getMessage from "@/constants/messages";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";+import { SlidersHorizontal } from "lucide-react";export default function RuleEngineHeader({className = "flex w-full items-center justify-end gap-4",@@ -15,7 +17,7 @@ export default function RuleEngineHeader({const pingStatus = useRootStore(getPingStatus);const messages = getMessage();- return (+ const actions = (<div className={className}>{pingStatus === "success" && (<RuleForm successCallback={successCallback}>@@ -29,4 +31,6 @@ export default function RuleEngineHeader({)}</div>);++ return <FeaturePageHeader eyebrow="Resources" title={messages.RULE_ENGINE_BREADCRUMB} description="Define policy-driven logic that turns context and telemetry into repeatable AI workflow decisions." icon={<SlidersHorizontal className="h-4 w-4" />} tone="border-purple-200 bg-purple-50 text-purple-700 dark:border-purple-900/70 dark:bg-purple-950/40 dark:text-purple-300" actions={actions} />;}diff --git a/src/client/src/components/(playground)/sidebar/index.tsx b/src/client/src/components/(playground)/sidebar/index.tsxindex 4c2a8b1b..cf56583d 100644--- a/src/client/src/components/(playground)/sidebar/index.tsx+++ b/src/client/src/components/(playground)/sidebar/index.tsx@@ -1,218 +1,280 @@"use client";+import Image from "next/image";-import { usePathname, useSearchParams } from "next/navigation";import Link from "next/link";+import { usePathname, useRouter, useSearchParams } from "next/navigation";+import { useEffect, useMemo, useState } from "react";+import {+ ChevronRight,+ ChevronsLeft,+ ChevronsRight,+ LayoutGrid,+ MessageSquareText,+ Search,+ X,+} from "lucide-react";+import { Button } from "@/components/ui/button";import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from "@/components/ui/tooltip";-import { Button, buttonVariants } from "@/components/ui/button";-import { SidebarActionItem, SidebarItemProps } from "@/types/sidebar";+ Command,+ CommandDialog,+ CommandEmpty,+ CommandGroup,+ CommandInput,+ CommandItem,+ CommandList,+} from "@/components/ui/command";+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";import { SIDEBAR_ITEMS } from "@/constants/sidebar";-import { PanelRightClose, PanelRightOpen } from "lucide-react";-import { useState } from "react";-import version from "../../../../package.json";+import { cn } from "@/lib/utils";+import { SidebarActionItem, SidebarItemProps, SidebarSection } from "@/types/sidebar";import UserActions from "./user-actions";-import { Accordion, AccordionTrigger, AccordionItem, AccordionContent } from "@/components/ui/accordion";-import { PRIMARY_BACKGROUND } from "@/constants/common-classes";-import getMessage from "@/constants/messages";--const getIfSidebarItemClasses = (- pathname: string,- item: SidebarItemProps,- currentUrl = pathname-) => {- const commonClasses = "flex gap-2 group-data-[state=open]:w-auto group-data-[state=open]:justify-start p-2.5 font-normal ";- const activeClasses = "text-white bg-primary dark:bg-primary dark:text-white [&]:hover:bg-primary [&]:dark:hover:bg-primary hover:text-white [&>.external-icon-svg]:fill-white [&>.external-icon-svg]:dark:fill-white ";- const inactiveClasses = "text-stone-500 dark:text-stone-300 hover:bg-stone-700 dark:hover:bg-stone-600 hover:text-white [&>.external-icon-svg]:fill-stone-500 [&>.external-icon-svg]:dark:fill-stone-300 [&>.external-icon-svg]:hover:fill-white ";-- if (item.type === "section")- return `${inactiveClasses}${commonClasses}`;-- if(item.link) {- if (item.link.includes("?")) {- return currentUrl.startsWith(item.link) ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- }-- if (["/home", "/dashboard", "/telemetry", "/requests", "/exceptions", "/prompt-hub", "/vault", "/openground", "/organisation", "/settings"].includes(item.link)) {- return pathname.startsWith(item.link) ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- }+import OtterSidebar from "./otter-sidebar";+import ThemeToggleSwitch from "./theme-switch";+import version from "../../../../package.json";+import logoImage from "../../../../public/images/logo.png";- if (["/dashboards"].includes(item.link)) {- return pathname.startsWith("/dashboards") || pathname.startsWith("/d/") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- }+const isActive = (pathname: string, item: SidebarActionItem, currentUrl: string) => {+ if (!item.link) return false;+ if (item.link.includes("?")) return currentUrl.startsWith(item.link);+ if (item.link === "/dashboards") return pathname.startsWith("/dashboards") || pathname.startsWith("/d/");+ if (item.link === "/dashboard") return pathname.startsWith("/dashboard") && !pathname.startsWith("/dashboards");+ return pathname.startsWith(item.link);+};- if (["/settings/api-keys"].includes(item.link)) {- return pathname.startsWith(item.link) ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- }+const flatItems = (items: SidebarItemProps[]) =>+ items.flatMap((item) => item.type === "section" ? item.children || [] : [item]);- return pathname.startsWith(item.link) ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- }+const RECENT_PAGES_STORAGE_KEY = "openlit:recent-pages";+const MAX_RECENT_PAGES = 5;+const SECONDARY_PANEL_WIDTH = "min(20rem, calc(100vw - 4rem))";- switch (item.link) {- case "/home":- return pathname.startsWith("/home") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/dashboards":- return pathname.startsWith("/dashboards") || pathname.startsWith("/d/") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/dashboard":- return pathname.startsWith("/dashboard") && !pathname.startsWith("/dashboards") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/requests":- return pathname.startsWith("/requests") || pathname.startsWith("/telemetry") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/exceptions":- return pathname.startsWith("/exceptions") || pathname.startsWith("/telemetry") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/telemetry":- return pathname.startsWith("/telemetry") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/prompt-hub":- return pathname.startsWith("/prompt-hub") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/vault":- return pathname.startsWith("/vault") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/openground":- return pathname.startsWith("/openground") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/organisation":- return pathname.startsWith("/organisation") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- case "/settings":- return pathname.startsWith("/settings") ? `${activeClasses}${commonClasses}` : `${inactiveClasses}${commonClasses}`;- default:- return `${inactiveClasses}${commonClasses}`;- }-};+function NavigationLink({+ item,+ active,+ onNavigate,+ compact = false,+}: {+ item: SidebarActionItem;+ active: boolean;+ onNavigate?: () => void;+ compact?: boolean;+}) {+ const content = <>+ {item.icon}+ <span className={cn("min-w-0 truncate", compact && "sr-only")}>{item.text}</span>+ </>;+ const className = cn(+ "flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-sm font-medium transition-colors",+ compact && "justify-center px-2",+ active+ ? "bg-stone-200 text-stone-950 dark:bg-stone-800 dark:text-white"+ : "text-stone-600 hover:bg-stone-200/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white",+ );-const SidebarActionItemComponent = ({ item, className }: { item: SidebarActionItem, className?: string }) => {if (item.component) return item.component;-+ if (item.link && !item.target) {+ return <Link href={item.link} onClick={onNavigate} className={className}>{content}</Link>;+ }return (- <Tooltip delayDuration={0}>- <TooltipTrigger asChild>- {!item.target && item.link ? (- <Link- className={`${buttonVariants({- variant: "ghost",- size: "icon",- })} ${className || ""}`}- href={item.link}- aria-label={item.text}- >- {item.icon}- <span className="group-data-[state=open]:block hidden">{item.text}</span>- </Link>- ) : (- <a- href={item.link}- className={`flex items-center p-2 ${buttonVariants({- variant: "ghost",- size: "icon",- })} ${className || ""- }`}- onClick={item.onClick}- target={item.target}- >- {item.icon}- <span className="group-data-[state=open]:block hidden">{item.text}</span>- </a>- )}- </TooltipTrigger>- <TooltipContent side="right" sideOffset={5} className="group-data-[state=open]:hidden">- {item.text}- </TooltipContent>- </Tooltip>+ <a href={item.link} target={item.target} onClick={() => { item.onClick?.(); onNavigate?.(); }} className={className}>+ {content}+ </a>);}-const SidebarItem = ({+function PrimaryItem({item,- className,pathname,currentUrl,+ compact,+ openSection,+ setOpenSection,+ onExpand,}: {item: SidebarItemProps;- className?: string;pathname: string;currentUrl: string;-}) => {- if (item.type === "section") {- return (- <Accordion- type="single"- className="w-full"- collapsible={item.collapsible}- defaultValue={item.title}- >- <AccordionItem value={item.title} className="border-0">- <AccordionTrigger className="py-1 hover:no-underline [&>svg]:text-stone-400 [&>svg]:dark:text-stone-500 [&[aria-disabled=true]>svg]:hidden group-data-[state=close]:[&[aria-disabled=true]_hr]:block [&[aria-disabled=true]_p:first-of-type]:hidden">- <div className="flex items-center h-5 grow">- <Tooltip delayDuration={0}>- <TooltipTrigger asChild className="hidden group-data-[state=close]:flex grow pl-2">- <p className="text-xs text-stone-400 dark:text-stone-500 uppercase">{item.title.substring(0, 1)}</p>- </TooltipTrigger>- <TooltipContent side="right" sideOffset={5} className="group-data-[state=open]:hidden">- {item.title}- </TooltipContent>- </Tooltip>- <hr className="hidden border-stone-200 dark:border-stone-800 border-t w-full" />- <p className="text-xs text-stone-400 dark:text-stone-500 text-center group-data-[state=open]:block hidden shrink-0 px-2">{item.title}</p>- </div>- </AccordionTrigger>- <AccordionContent className="flex flex-col pb-0">- {item.children?.map((child, index) => (- <SidebarActionItemComponent key={`sidebar-${item.title}-${index}`} item={child} className={getIfSidebarItemClasses(pathname, child, currentUrl)} />- ))}- </AccordionContent>- </AccordionItem>- </Accordion>- );+ compact: boolean;+ openSection: string | null;+ setOpenSection: (section: SidebarSection | null) => void;+ onExpand: () => void;+}) {+ if (item.type === "action") {+ const link = <NavigationLink item={item} active={isActive(pathname, item, currentUrl)} compact={compact} onNavigate={() => { if (compact) onExpand(); setOpenSection(null); }} />;+ return compact ? <Tooltip delayDuration={100}><TooltipTrigger asChild>{link}</TooltipTrigger><TooltipContent side="right" sideOffset={8}>{item.text}</TooltipContent></Tooltip> : link;}- return <SidebarActionItemComponent item={item} className={className} />-};+ const selected = openSection === item.title || item.children?.some((child) => isActive(pathname, child, currentUrl));+ return (+ <Tooltip delayDuration={100}>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ aria-expanded={openSection === item.title}+ onClick={() => { if (compact) onExpand(); setOpenSection(openSection === item.title ? null : item); }}+ className={cn(+ "h-9 w-full justify-start gap-2.5 rounded-lg px-2.5 text-sm font-medium",+ compact && "justify-center px-2",+ selected+ ? "bg-stone-200 text-stone-950 hover:bg-stone-200 dark:bg-stone-800 dark:text-white dark:hover:bg-stone-800"+ : "text-stone-600 hover:bg-stone-200/70 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white",+ )}+ >+ {compact ? <span className="text-xs font-bold">{item.title.slice(0, 1)}</span> : <><span>{item.title}</span><ChevronRight className="ml-auto size-4" /></>}+ </Button>+ </TooltipTrigger>+ {compact && <TooltipContent side="right" sideOffset={8}>{item.title}</TooltipContent>}+ </Tooltip>+ );+}++function SectionPanel({ section, pathname, currentUrl, onClose }: { section: SidebarSection; pathname: string; currentUrl: string; onClose: () => void }) {+ const children = section.children || [];++ return (+ <div+ className="absolute inset-y-0 left-full z-40 flex flex-col border-y border-r border-stone-200 bg-stone-50 shadow-xl dark:border-stone-800 dark:bg-stone-950"+ style={{ width: SECONDARY_PANEL_WIDTH }}+ >+ <div className="flex items-center justify-between border-b border-stone-200 px-3 py-2.5 dark:border-stone-800">+ <p className="text-sm font-semibold text-stone-900 dark:text-white">{section.title}</p>+ <Button variant="ghost" size="icon" onClick={onClose} aria-label="Close navigation panel" className="size-8 text-stone-700 hover:bg-stone-200 dark:text-stone-200 dark:hover:bg-stone-800"><X className="size-4" /></Button>+ </div>+ <div className="overflow-y-auto p-2">+ <div className="space-y-1">+ {children.map((item) => <NavigationLink key={item.text} item={item} active={isActive(pathname, item, currentUrl)} onNavigate={onClose} />)}+ </div>+ </div>+ {section.title === "Settings" ? <div className="flex items-center justify-between border-t border-stone-200 px-3 py-2.5 dark:border-stone-800"><span className="text-xs font-medium text-stone-600 dark:text-stone-300">Appearance</span><ThemeToggleSwitch /></div> : null}+ </div>+ );+}export default function Sidebar() {const pathname = usePathname();+ const router = useRouter();const searchParams = useSearchParams();- const messages = getMessage();- const [isExpanded, setIsExpanded] = useState<boolean>(true);- const queryString = searchParams.toString();- const currentUrl = queryString ? `${pathname}?${queryString}` : pathname;+ const [isExpanded, setIsExpanded] = useState(true);+ const [openSection, setOpenSection] = useState<SidebarSection | null>(null);+ const [commandOpen, setCommandOpen] = useState(false);+ const [recentLinks, setRecentLinks] = useState<string[]>([]);+ const currentUrl = searchParams.toString() ? `${pathname}?${searchParams.toString()}` : pathname;+ const allItems = useMemo(() => flatItems(SIDEBAR_ITEMS), []);+ const isOtterActive = pathname.startsWith("/chat");+ const toggleSidebar = () => {+ setIsExpanded((value) => !value);+ setOpenSection(null);+ };+ const expandSidebar = () => {+ setIsExpanded(true);+ };++ useEffect(() => {+ const onKeyDown = (event: KeyboardEvent) => {+ if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {+ event.preventDefault();+ setCommandOpen(true);+ }+ if (event.key === "Escape") setOpenSection(null);+ };+ window.addEventListener("keydown", onKeyDown);+ return () => window.removeEventListener("keydown", onKeyDown);+ }, []);++ useEffect(() => {+ try {+ const storedLinks = JSON.parse(window.localStorage.getItem(RECENT_PAGES_STORAGE_KEY) || "[]");+ if (Array.isArray(storedLinks)) setRecentLinks(storedLinks.filter((link): link is string => typeof link === "string"));+ } catch {+ window.localStorage.removeItem(RECENT_PAGES_STORAGE_KEY);+ }+ }, []);++ useEffect(() => {+ const visitedItem = [...allItems]+ .filter((item) => item.link && !item.target)+ .sort((a, b) => (b.link?.length || 0) - (a.link?.length || 0))+ .find((item) => isActive(pathname, item, currentUrl));+ if (!visitedItem?.link) return;+ setRecentLinks((previous) => {+ const next = [visitedItem.link!, ...previous.filter((link) => link !== visitedItem.link)].slice(0, MAX_RECENT_PAGES);+ window.localStorage.setItem(RECENT_PAGES_STORAGE_KEY, JSON.stringify(next));+ return next;+ });+ }, [allItems, currentUrl, pathname]);- const toggleExpansion = () => setIsExpanded(e => !e);+ const recentItems = recentLinks.map((link) => allItems.find((item) => item.link === link)).filter((item): item is SidebarActionItem => Boolean(item));return (- <aside- aria-label="Sidebar"- data-state={isExpanded ? "open" : "close"}- className={`inset-y flex h-full flex-col relative group shrink-0 gap-[1px] border border-stone-200 dark:border-stone-800 ${PRIMARY_BACKGROUND} rounded-md ${isExpanded ? "w-60" : "w-auto"}`}- >- <div className="flex border-b border-stone-200 dark:border-stone-800 p-2 relative items-center">- <Image- className="size-10 flex-shrink-0 transition duration-75 p-1"- src="/images/logo.png"- alt="openlit's Logo"- priority- width={24}- height={24}+ <aside aria-label="Main navigation" className="relative z-30 flex h-full shrink-0">+ {openSection && (+ <button+ aria-label="Close navigation panel"+ className="fixed inset-y-0 right-0 z-30 cursor-default bg-black/20 dark:bg-stone-900/40 left-0"+ onClick={() => setOpenSection(null)}/>- <p className="flex gap-1 items-center text-lg font-semibold capitalize text-primary group-data-[state=close]:hidden">- <span>OpenLIT</span>- <span className="text-xs font-normal text-primary/80 mt-1">({version.version})</span>- </p>- <Button variant="ghost" size="icon" aria-label={messages.EXPAND} onClick={toggleExpansion} className="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 rounded-md h-auto w-auto text-stone-500 dark:text-stone-300 p-0.5 cursor-pointer bg-stone-50 hover:bg-stone-50 dark:bg-stone-900 dark:hover:bg-stone-900">- {isExpanded ? <PanelRightOpen className="w-5 h-5" /> : <PanelRightClose className="w-5 h-5" />}- </Button>- </div>- <nav className="flex flex-col p-2 pt-4 overflow-auto grow scrollbar-hidden">- {SIDEBAR_ITEMS.map((item, index) => (- <SidebarItem- key={`sidebar-top-${index}`}- className={getIfSidebarItemClasses(pathname, item, currentUrl)}- item={item}- pathname={pathname}- currentUrl={currentUrl}- />- ))}- </nav>- <div className="flex flex-col shrink-0 p-2">- <UserActions />+ )}+ <div data-state={isExpanded ? "open" : "closed"} className={cn("relative z-40 flex h-full flex-col border border-stone-200 bg-stone-50 dark:border-stone-800 dark:bg-stone-950", isExpanded ? "w-64" : "w-16")}>+ <Tooltip delayDuration={100}>+ <TooltipTrigger asChild>+ <Button+ variant="outline"+ size="icon"+ onClick={toggleSidebar}+ aria-label={isExpanded ? "Collapse sidebar" : "Expand sidebar"}+ aria-expanded={isExpanded}+ className={cn(+ "absolute top-5 z-50 size-6 rounded-full border-stone-300 bg-white p-0 text-stone-600 shadow-sm hover:bg-stone-100 hover:text-stone-950 focus-visible:ring-2 focus-visible:ring-primary dark:border-stone-700 dark:bg-stone-900 dark:text-stone-300 dark:hover:bg-stone-800 dark:hover:text-white",+ openSection ? "right-2" : "-right-3"+ )}+ >+ {isExpanded ? <ChevronsLeft className="size-3.5" /> : <ChevronsRight className="size-3.5" />}+ </Button>+ </TooltipTrigger>+ <TooltipContent side="right" sideOffset={10}>+ {isExpanded ? "Collapse sidebar" : "Expand sidebar"}+ </TooltipContent>+ </Tooltip>+ <div className="flex items-center gap-2 px-3 pb-3 pt-4">+ <Image className="size-9 shrink-0 object-contain" src={logoImage} alt="OpenLIT logo" priority width={36} height={36} />+ <div className={cn("min-w-0 flex-1 transition-opacity", !isExpanded && "pointer-events-none invisible opacity-0")}>+ <p className="truncate text-lg font-semibold text-stone-900 dark:text-white">OpenLIT</p>+ <p className="text-[10px] text-stone-500">v{version.version}</p>+ </div>+ </div>++ <div className="px-2 pb-3">+ <Button variant="outline" onClick={() => { if (!isExpanded) expandSidebar(); setCommandOpen(true); }} className={cn("h-10 w-full justify-start gap-2 border-stone-300 bg-white px-3 text-stone-500 shadow-sm dark:border-stone-700 dark:bg-stone-900", !isExpanded && "justify-center px-2")} aria-label="Search navigation">+ <Search className="size-5 shrink-0" />+ <span className={cn("flex-1 text-left", !isExpanded && "hidden")}>Search data</span>+ <kbd className={cn("rounded border border-stone-200 px-1.5 py-0.5 text-[10px] dark:border-stone-700", !isExpanded && "hidden")}>⌘K</kbd>+ </Button>+ </div>++ <div className={cn("mx-2 grid rounded-xl bg-stone-100 p-1 dark:bg-stone-900", isExpanded ? "grid-cols-2" : "grid-cols-1")}>+ <Button variant="ghost" className={cn("h-9 rounded-lg text-sm", pathname.startsWith("/chat") ? "text-stone-500" : "bg-white text-stone-950 shadow-sm dark:bg-stone-800 dark:text-white")} onClick={() => { if (!isExpanded) expandSidebar(); setOpenSection(null); router.push("/home"); }} aria-label="Browse">+ {isExpanded ? <span>Browse</span> : <LayoutGrid className="size-4" />}+ </Button>+ {isExpanded && <Link href="/chat" className={cn("flex items-center justify-center gap-2 rounded-lg text-sm font-medium text-stone-600 hover:text-stone-950 dark:text-stone-300 dark:hover:text-white", isOtterActive && "bg-white text-stone-950 shadow-sm dark:bg-stone-800 dark:text-white")}><MessageSquareText className="size-4 text-primary" />Otter</Link>}+ </div>++ {isOtterActive && isExpanded ? <div className="min-h-0 grow"><OtterSidebar /></div> : <nav className="flex grow flex-col gap-1 overflow-y-auto px-2 py-4" aria-label="Product navigation">+ {SIDEBAR_ITEMS.map((item) => <PrimaryItem key={item.type === "section" ? item.title : item.text} item={item} pathname={pathname} currentUrl={currentUrl} compact={!isExpanded} openSection={openSection?.title || null} setOpenSection={setOpenSection} onExpand={expandSidebar} />)}+ {isExpanded && recentItems.length > 0 && <div className="mt-3 border-t border-stone-200 pt-3 dark:border-stone-800"><p className="px-2.5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-stone-500">Recent</p>{recentItems.map((item) => <NavigationLink key={`recent-${item.link}`} item={item} active={isActive(pathname, item, currentUrl)} onNavigate={() => setOpenSection(null)} />)}</div>}+ </nav>}+ <div className="border-t border-stone-200 p-2 dark:border-stone-800"><UserActions /></div></div>+ {openSection && <SectionPanel section={openSection} pathname={pathname} currentUrl={currentUrl} onClose={() => setOpenSection(null)} />}++ <CommandDialog open={commandOpen} onOpenChange={setCommandOpen}>+ <CommandInput placeholder="Search OpenLIT navigation..." />+ <CommandList>+ <CommandEmpty>No navigation items found.</CommandEmpty>+ <CommandGroup heading="Navigation">+ {allItems.filter((item) => item.link).map((item) => <CommandItem key={item.text} value={item.text} onSelect={() => setCommandOpen(false)} asChild><Link href={item.link || "#"} className="gap-3">{item.icon}<span>{item.text}</span></Link></CommandItem>)}+ </CommandGroup>+ </CommandList>+ </CommandDialog></aside>);}diff --git a/src/client/src/components/(playground)/sidebar/otter-sidebar.tsx b/src/client/src/components/(playground)/sidebar/otter-sidebar.tsxnew file mode 100644index 00000000..15b9324f--- /dev/null+++ b/src/client/src/components/(playground)/sidebar/otter-sidebar.tsx@@ -0,0 +1,66 @@+"use client";++import { useCallback, useEffect } from "react";+import { useRouter } from "next/navigation";+import { toast } from "sonner";+import Link from "next/link";+import { BarChart3, Settings } from "lucide-react";+import { Button } from "@/components/ui/button";+import ConversationList from "@/components/(playground)/chat/conversation-list";+import getMessage from "@/constants/messages";+import { getChatActions, getChatActiveId, getChatConversations, getChatIsLoadingConversations } from "@/selectors/chat";+import { useRootStore } from "@/store";++export default function OtterSidebar() {+ const router = useRouter();+ const messages = getMessage();+ const conversations = useRootStore(getChatConversations);+ const activeId = useRootStore(getChatActiveId);+ const isLoading = useRootStore(getChatIsLoadingConversations);+ const { setConversations, setIsLoadingConversations, removeConversation } = useRootStore(getChatActions);++ const fetchConversations = useCallback(async () => {+ setIsLoadingConversations(true);+ try {+ const response = await fetch("/api/chat/conversation");+ const result = await response.json();+ if (result.data) {+ setConversations(result.data.map((conversation: any) => ({+ id: conversation.id,+ title: conversation.title || messages.CHAT_NEW_CONVERSATION,+ totalCost: Number(conversation.totalCost) || 0,+ totalMessages: Number(conversation.totalMessages) || 0,+ updatedAt: conversation.updatedAt,+ })));+ }+ } finally {+ setIsLoadingConversations(false);+ }+ }, [messages, setConversations, setIsLoadingConversations]);++ useEffect(() => {+ fetchConversations();+ }, [fetchConversations]);++ const deleteConversation = async (id: string) => {+ try {+ await fetch(`/api/chat/conversation/${id}`, { method: "DELETE" });+ removeConversation(id);+ if (activeId === id) router.push("/chat");+ } catch {+ toast.error(messages.CHAT_FAILED_TO_DELETE_CONVERSATION);+ }+ };++ return (+ <div className="flex h-full min-h-0 flex-col">+ <div className="min-h-0 flex-1">+ <ConversationList conversations={conversations} activeId={activeId} onSelect={(id) => router.push(`/chat?id=${id}`)} onDelete={deleteConversation} onNew={() => router.push("/chat")} isLoading={isLoading} />+ </div>+ <div className="flex gap-1 border-t border-stone-200 p-2 dark:border-stone-800">+ <Button asChild variant="ghost" size="sm" className="h-8 flex-1 justify-start gap-2 text-xs text-stone-600 dark:text-stone-300"><Link href="/chat/usage"><BarChart3 className="size-3.5" />{messages.CHAT_OTTER_USAGE}</Link></Button>+ <Button asChild variant="ghost" size="icon" className="size-8 text-stone-600 dark:text-stone-300"><Link href="/chat/settings" aria-label="Otter settings"><Settings className="size-3.5" /></Link></Button>+ </div>+ </div>+ );+}diff --git a/src/client/src/components/(playground)/vault/header.tsx b/src/client/src/components/(playground)/vault/header.tsxindex efe8f370..999f92a9 100644--- a/src/client/src/components/(playground)/vault/header.tsx+++ b/src/client/src/components/(playground)/vault/header.tsx@@ -3,6 +3,9 @@ import SecretForm from "./form";import { useRootStore } from "@/store";import { getPingStatus } from "@/selectors/database-config";import VaultUsage from "./usage";+import FeaturePageHeader from "@/components/(playground)/feature-page-header";+import getMessage from "@/constants/messages";+import { BookKey } from "lucide-react";export default function VaultHeader({className = "flex w-full items-center justify-end gap-4",@@ -12,8 +15,9 @@ export default function VaultHeader({successCallback?: () => void;}) {const pingStatus = useRootStore(getPingStatus);+ const messages = getMessage();- return (+ const actions = (<div className={className}>{pingStatus === "success" && <VaultUsage />}{pingStatus === "success" && (@@ -28,4 +32,6 @@ export default function VaultHeader({)}</div>);++ return <FeaturePageHeader eyebrow="Resources" title={messages.FEATURE_VAULT} description="Centralize sensitive values and runtime secrets so AI workflows stay portable without exposing credentials." icon={<BookKey className="h-4 w-4" />} tone="border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/40 dark:text-amber-300" actions={actions} />;}diff --git a/src/client/src/components/svg/opentelemetry.tsx b/src/client/src/components/svg/opentelemetry.tsxindex d91480ac..4b363ca8 100644--- a/src/client/src/components/svg/opentelemetry.tsx+++ b/src/client/src/components/svg/opentelemetry.tsx@@ -1,8 +1,8 @@export default function OpenTelemetrySvg({ className = "" }: { className?: string }) {return (- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" className={`${className} external-icon-svg`}>+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" className={`${className} external-icon-svg fill-current`}><path d="M67.648 69.797c-5.246 5.25-5.246 13.758 0 19.008 5.25 5.246 13.758 5.246 19.004 0 5.25-5.25 5.25-13.758 0-19.008-5.246-5.246-13.754-5.246-19.004 0Zm14.207 14.219a6.649 6.649 0 0 1-9.41 0 6.65 6.65 0 0 1 0-9.407 6.649 6.649 0 0 1 9.41 0c2.598 2.586 2.598 6.809 0 9.407ZM86.43 3.672l-8.235 8.234a4.17 4.17 0 0 0 0 5.875l32.149 32.149a4.17 4.17 0 0 0 5.875 0l8.234-8.235c1.61-1.61 1.61-4.261 0-5.87L92.29 3.671a4.159 4.159 0 0 0-5.86 0ZM28.738 108.895a3.763 3.763 0 0 0 0-5.31l-4.183-4.187a3.768 3.768 0 0 0-5.313 0l-8.644 8.649-.016.012-2.371-2.375c-1.313-1.313-3.45-1.313-4.75 0-1.313 1.312-1.313 3.449 0 4.75l14.246 14.242a3.353 3.353 0 0 0 4.746 0c1.3-1.313 1.313-3.45 0-4.746l-2.375-2.375.016-.012Zm0 0" /><path d="M72.297 27.313 54.004 45.605c-1.625 1.625-1.625 4.301 0 5.926L65.3 62.824c7.984-5.746 19.18-5.035 26.363 2.153l9.148-9.149c1.622-1.625 1.622-4.297 0-5.922L78.22 27.313a4.185 4.185 0 0 0-5.922 0ZM60.55 67.585l-6.672-6.672c-1.563-1.562-4.125-1.562-5.684 0l-23.53 23.54a4.036 4.036 0 0 0 0 5.687l13.331 13.332a4.036 4.036 0 0 0 5.688 0l15.132-15.157c-3.199-6.609-2.625-14.593 1.735-20.73Zm0 0" /></svg>);-}\ No newline at end of file+}diff --git a/src/client/src/constants/settings.ts b/src/client/src/constants/settings.tsindex 7646202d..87e20091 100644--- a/src/client/src/constants/settings.ts+++ b/src/client/src/constants/settings.ts@@ -12,7 +12,5 @@ export function getSettingsTabs(): SettingsTab[] {return [{ value: "profile", label: messages.USER_PROFILE, path: "/settings/profile" },{ value: "api-keys", label: messages.API_KEYS, path: "/settings/api-keys" },- { value: "organisation", label: messages.ORGANISATION_SETTINGS, path: "/organisation" },- { value: "pricing", label: messages.PRICING_TITLE, path: "/pricing" },];}diff --git a/src/client/src/constants/sidebar.tsx b/src/client/src/constants/sidebar.tsxindex abdb1c8d..597c54f0 100644--- a/src/client/src/constants/sidebar.tsx+++ b/src/client/src/constants/sidebar.tsx@@ -1,5 +1,4 @@import OpenTelemetrySvg from "@/components/svg/opentelemetry";-import Otter from "@/components/svg/otter";import { getEnterpriseSidebarItems } from "@/features/sidebar";import { SidebarItemProps } from "@/types/sidebar";import {@@ -18,6 +17,7 @@ import {MonitorPlay,SettingsIcon,SlidersHorizontal,+ User,} from "lucide-react";export const ICON_CLASSES = "flex-shrink-0 size-5";@@ -29,12 +29,6 @@ export const SIDEBAR_ITEMS: SidebarItemProps[] = [link: "/home",type: "action",},- {- icon: <Otter className={ICON_CLASSES} />,- text: "Otter",- link: "/chat",- type: "action",- },{icon: <LayoutDashboard className={ICON_CLASSES} />,text: "Dashboards",@@ -138,6 +132,12 @@ export const SIDEBAR_ITEMS: SidebarItemProps[] = [type: "section",collapsible: true,children: [+ {+ icon: <User className={ICON_CLASSES} />,+ text: "User Profile",+ link: "/settings/profile",+ type: "action",+ },{icon: <Key className={ICON_CLASSES} />,text: "Api Keys",