🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(skills): streamline setup and usage filtering (#19209)
tobi_kl0ccde814052f
diff --git a/packages/shared/src/server/tableMappings/mapEventsTable.ts b/packages/shared/src/server/tableMappings/mapEventsTable.tsindex 100e788d74..5bafd85ba7 100644--- a/packages/shared/src/server/tableMappings/mapEventsTable.ts+++ b/packages/shared/src/server/tableMappings/mapEventsTable.ts@@ -391,6 +391,14 @@ export const eventsTableNativeUiColumnDefinitions: UiColumnMappings = [clickhouseTableName: "events_proto",clickhouseSelect: eventsTableLoadedSkillVersionsSql,},+ {+ uiTableName: "Loaded Skill Files",+ uiTableId: "skillFilesLoaded",+ clickhouseTableName: "events_proto",+ // Pair each path with its immutable skill-version ID to keep matches within one loaded resource.+ clickhouseSelect:+ "arrayMap(skill -> concat(skill.langfuseSkillId, '/', skill.filePath), e.skills_resource_loaded)",+ },{uiTableName: "Available Skill Names",uiTableId: "skillNamesAvailable",diff --git a/web/src/features/skills/components/CliSetupAccordion.tsx b/web/src/features/skills/components/CliSetupAccordion.tsxindex b1e501c785..40ec040e40 100644--- a/web/src/features/skills/components/CliSetupAccordion.tsx+++ b/web/src/features/skills/components/CliSetupAccordion.tsx@@ -1,4 +1,3 @@-import { type ReactNode } from "react";import { Accordion } from "@/src/components/design-system/Accordion/Accordion";import { Button } from "@/src/components/design-system/Button/Button";import { Codeblock } from "@/src/components/design-system/Codeblock/Codeblock";@@ -7,26 +6,26 @@ import { shellQuote } from "../utils/shellQuote";export function CliSetupAccordion({projectId,host,- children,}: {projectId: string;host: string;- children: ReactNode;}) {return (<Accordion type="single" collapsible><Accordion.Item value="setup"><Accordion.Trigger size="sm">First-time CLI setup</Accordion.Trigger><Accordion.Content>- <div className="flex flex-col items-start gap-3 py-3">+ <div className="flex min-w-0 flex-col items-start gap-3 py-3"><p className="text-muted-foreground">Requires Node.js 20+. Run in your project directory.</p>- <Codeblock- language="bash"- value="npm install -g @langfuse/cli@beta"- variant="read-only"- />+ <div className="w-full min-w-0">+ <Codeblock+ language="bash"+ value="npm install -g @langfuse/cli@beta"+ variant="read-only"+ />+ </div><p className="text-muted-foreground">Replace the placeholders with your project’s API keys. Thesesettings apply to your current terminal session.@@ -37,7 +36,7 @@ export function CliSetupAccordion({variant="secondary"size="sm"/>- <div className="ph-no-capture w-full">+ <div className="ph-no-capture w-full min-w-0"><Codeblocklanguage="bash"value={`export LANGFUSE_PUBLIC_KEY='pk-lf-...'\nexport LANGFUSE_SECRET_KEY='sk-lf-...'\nexport LANGFUSE_HOST=${shellQuote(host)}`}@@ -51,12 +50,6 @@ export function CliSetupAccordion({</div></Accordion.Content></Accordion.Item>- <Accordion.Item value="updates">- <Accordion.Trigger size="sm">Updating later</Accordion.Trigger>- <Accordion.Content>- <div className="flex flex-col gap-3 py-3">{children}</div>- </Accordion.Content>- </Accordion.Item></Accordion>);}diff --git a/web/src/features/skills/components/CliSkillImportInstructions.stories.tsx b/web/src/features/skills/components/CliSkillImportInstructions.stories.tsxindex 97373b3cb2..0fc078fd0b 100644--- a/web/src/features/skills/components/CliSkillImportInstructions.stories.tsx+++ b/web/src/features/skills/components/CliSkillImportInstructions.stories.tsx@@ -38,7 +38,10 @@ export const ImportScopes = meta.story({const singleCommand = `langfuse skills push 'team'"'"'s skills/review-code'`;await expect(canvas.getByText(singleCommand)).toBeVisible();await userEvent.click(- canvas.getByRole("button", { name: "Copy prompt" }),+ within(canvas.getByRole("group", { name: "Setup prompt" })).getByRole(+ "button",+ { name: "Copy code" },+ ),);await expect(writeText).toHaveBeenLastCalledWith(expect.stringContaining(singleCommand),@@ -72,7 +75,7 @@ export const EmptyPath = meta.story({"Enter a folder path",);await expect(- canvas.queryByRole("button", { name: "Copy prompt" }),+ canvas.queryByRole("group", { name: "Setup prompt" }),).not.toBeInTheDocument();await expect(canvas.queryByText(/langfuse skills push/),diff --git a/web/src/features/skills/components/CliSkillImportInstructions.tsx b/web/src/features/skills/components/CliSkillImportInstructions.tsxindex 761adba1da..9a6582dea0 100644--- a/web/src/features/skills/components/CliSkillImportInstructions.tsx+++ b/web/src/features/skills/components/CliSkillImportInstructions.tsx@@ -40,11 +40,12 @@ Check the selected folder contains the intended SKILL.md files before pushing. T};return (- <div className="ph-no-capture flex flex-col gap-4">+ <div className="ph-no-capture flex min-w-0 flex-col gap-4"><p className="text-muted-foreground">Choose what to import, then let your coding agent handle setup or runthe command yourself.</p>+ <CliSetupAccordion projectId={projectId} host={host} /><div className="flex flex-col gap-3"><Accordion type="single" collapsible><Accordion.Item value="configuration">@@ -89,13 +90,21 @@ Check the selected folder contains the intended SKILL.md files before pushing. T<CopyAgentPromptPanel prompt={prompt} command={command} />)}</div>- <CliSetupAccordion projectId={projectId} host={host}>- <p className="text-muted-foreground">- Run the same import command after editing your local skills. The name- in SKILL.md identifies each skill in Langfuse. Changed files publish a- new version; new names create new skills.- </p>- </CliSetupAccordion>++ <Accordion type="single" collapsible>+ <Accordion.Item value="updates">+ <Accordion.Trigger size="sm">Updating later</Accordion.Trigger>+ <Accordion.Content>+ <div className="flex min-w-0 flex-col gap-3 py-3">+ <p className="text-muted-foreground">+ Run the same import command after editing your local skills. The+ name in SKILL.md identifies each skill in Langfuse. Changed+ files publish a new version; new names create new skills.+ </p>+ </div>+ </Accordion.Content>+ </Accordion.Item>+ </Accordion></div>);}diff --git a/web/src/features/skills/components/CopyAgentPromptPanel.tsx b/web/src/features/skills/components/CopyAgentPromptPanel.tsxindex b4c5dc0925..0ac3b5e50d 100644--- a/web/src/features/skills/components/CopyAgentPromptPanel.tsx+++ b/web/src/features/skills/components/CopyAgentPromptPanel.tsx@@ -1,7 +1,4 @@-import { useState } from "react";-import { Button } from "@/src/components/design-system/Button/Button";import { Codeblock } from "@/src/components/design-system/Codeblock/Codeblock";-import { useCopyToClipboard } from "@/src/hooks/useCopyToClipboard";export function CopyAgentPromptPanel({prompt,@@ -10,37 +7,27 @@ export function CopyAgentPromptPanel({prompt: string;command: string;}) {- const { copy, isCopied } = useCopyToClipboard();- const [copyError, setCopyError] = useState(false);- const handleCopyPrompt = async () => {- setCopyError(false);- try {- await copy(prompt);- } catch {- setCopyError(true);- }- };-return (- <div className="ph-no-capture flex flex-col gap-3">- <div className="bg-muted/30 flex flex-wrap items-center justify-between gap-3 rounded-md border p-3">- <div className="flex flex-col gap-1">- <h3 className="font-bold">Set up with your coding agent</h3>- <p className="text-muted-foreground text-xs">- Paste this prompt into Claude, Cursor, Copilot, or another coding- agent.- </p>- </div>- <Button- text={isCopied && !copyError ? "Copied" : "Copy prompt"}- onClick={handleCopyPrompt}+ <div className="ph-no-capture flex min-w-0 flex-col gap-3">+ <div className="flex min-w-0 flex-col gap-1">+ <h3 className="font-bold">Set up with your coding agent</h3>+ <p className="text-muted-foreground text-xs">+ Copy this prompt into Claude, Cursor, Copilot, or another coding+ agent.+ </p>+ </div>+ <div+ role="group"+ aria-label="Setup prompt"+ className="min-w-0 [&_pre]:max-h-24 [&_pre]:break-words [&_pre]:whitespace-pre-wrap"+ >+ <Codeblock+ language="text"+ label="Setup prompt"+ value={prompt}+ variant="read-only"/></div>- {copyError && (- <p role="alert" className="text-destructive">- Could not copy the prompt. Please try again.- </p>- )}<div className="flex flex-col gap-2"><p className="text-muted-foreground text-xs">Or run in your project directory:diff --git a/web/src/features/skills/components/InstallSkillDialog.tsx b/web/src/features/skills/components/InstallSkillDialog.tsxindex 10a73799fc..43931d4198 100644--- a/web/src/features/skills/components/InstallSkillDialog.tsx+++ b/web/src/features/skills/components/InstallSkillDialog.tsx@@ -1,3 +1,4 @@+import { Accordion } from "@/src/components/design-system/Accordion/Accordion";import { Dialog } from "@/src/components/design-system/Dialog/Dialog";import { Codeblock } from "@/src/components/design-system/Codeblock/Codeblock";import { Button } from "@/src/components/design-system/Button/Button";@@ -37,6 +38,7 @@ export function InstallSkillDialog({Choose what to install, then let your coding agent handle setup or runthe command yourself.</p>+ <CliSetupAccordion projectId={projectId} host={host} />{skillOptions.isPending && (<p className="text-muted-foreground">Loading installation options…</p>)}@@ -65,17 +67,25 @@ export function InstallSkillDialog({}}/>)}- <CliSetupAccordion projectId={projectId} host={host}>- <p className="text-muted-foreground">- Commit <code>langfuse-skills-lock.json</code> to share your- selection. Updates follow labels; pinned versions stay fixed.- </p>- <Codeblock- language="bash"- value="langfuse skills update"- variant="read-only"- />- </CliSetupAccordion>++ <Accordion type="single" collapsible>+ <Accordion.Item value="updates">+ <Accordion.Trigger size="sm">Updating later</Accordion.Trigger>+ <Accordion.Content>+ <div className="flex min-w-0 flex-col gap-3 py-3">+ <p className="text-muted-foreground">+ Commit <code>langfuse-skills-lock.json</code> to share your+ selection. Updates follow labels; pinned versions stay fixed.+ </p>+ <Codeblock+ language="bash"+ value="langfuse skills update"+ variant="read-only"+ />+ </div>+ </Accordion.Content>+ </Accordion.Item>+ </Accordion></Dialog.Body></Dialog>);diff --git a/web/src/features/skills/components/SkillAnalytics.tsx b/web/src/features/skills/components/SkillAnalytics.tsxindex d1c8d23665..fc04626e3d 100644--- a/web/src/features/skills/components/SkillAnalytics.tsx+++ b/web/src/features/skills/components/SkillAnalytics.tsx@@ -1,4 +1,7 @@-import { RefreshCw } from "@langfuse/icons";+import { useState } from "react";+import { PaginationBar } from "@/src/components/design-system/PaginationBar/PaginationBar";+import { SkillLinkedTraces } from "./SkillLinkedTraces";+import { Filter, RefreshCw } from "@langfuse/icons";import {Table,type AsyncTableData,@@ -16,6 +19,8 @@ import { useSkillAnalytics } from "@/src/features/skills/hooks/useSkillAnalyticstype SkillAnalyticsProps = {projectId: string;skillId: string;+ name: string;+ version: number;paths: string[];};type FileUsage = {@@ -29,7 +34,7 @@ export function SkillAnalytics(props: SkillAnalyticsProps) {<div className="flex min-h-0 flex-1 flex-col overflow-auto"><TableHeaderControls timeRange={timeRange} setTimeRange={setTimeRange} /><SkillAnalyticsDashboard- key={rangeToString(timeRange)}+ key={`${props.skillId}:${rangeToString(timeRange)}`}{...props}timeRange={timeRange}/>@@ -40,9 +45,13 @@ export function SkillAnalytics(props: SkillAnalyticsProps) {function SkillAnalyticsDashboard({projectId,skillId,+ name,+ version,paths,timeRange,}: SkillAnalyticsProps & { timeRange: TimeRange }) {+ const [filePage, setFilePage] = useState(0);+ const [selectedFile, setSelectedFile] = useState<string | null>(null);const { available, loaded, files, handleRefresh } = useSkillAnalytics({projectId,skillId,@@ -61,10 +70,14 @@ function SkillAnalyticsDashboard({}).toSorted((a, b) => b.loads - a.loads || a.path.localeCompare(b.path));const error = available.error ?? loaded.error ?? files.error;+ const pageIndex = Math.min(+ filePage,+ Math.max(0, Math.ceil(fileRows.length / 10) - 1),+ );const fileTableData = prepareFileTableData(files.isPending,files.error,- fileRows,+ fileRows.slice(pageIndex * 10, (pageIndex + 1) * 10),);return (<>@@ -80,7 +93,7 @@ function SkillAnalyticsDashboard({}/></PageHeaderControlsPortal>- <div className="flex flex-col gap-5 p-4">+ <div className="flex flex-col gap-3 p-4">{error ? (<StatusMessagelevel="ERROR"@@ -108,11 +121,11 @@ function SkillAnalyticsDashboard({description="Observations loading one or more files"/></div>- <section className="flex flex-col gap-3 rounded-lg border pt-4">- <div className="flex flex-col gap-1 px-4">+ <section className="flex flex-col gap-2 rounded-lg border pt-2">+ <div className="px-3"><h3 className="text-sm font-bold">File usage</h3></div>- <div className="ph-no-capture max-h-80 min-h-32 overflow-auto">+ <div className="ph-no-capture overflow-auto [&_tbody>tr]:h-8 [&_tbody>tr>td:not([colspan])]:py-1 [&_tbody>tr>td:not([colspan])>div]:h-6"><Table<FileUsage>tableName="Skill file usage"columns={[@@ -120,6 +133,12 @@ function SkillAnalyticsDashboard({accessorKey: "path",header: "File",size: 320,+ trailingAction: {+ type: "custom",+ icon: Filter,+ label: "Filter observations by this file",+ onClick: ({ row }) => setSelectedFile(row.original.path),+ },}),createNumberTableColumn<FileUsage>({accessorKey: "loads",@@ -129,9 +148,35 @@ function SkillAnalyticsDashboard({}),]}data={fileTableData}+ onRowClick={(file) => setSelectedFile(file.path)}+ loadingRowCount={Math.min(paths.length, 10)}/></div>+ {fileRows.length > 10 ? (+ <PaginationBar+ mode="offset"+ totalCount={fileRows.length}+ state={{ pageIndex, pageSize: 10 }}+ pageSizeOptions={[10]}+ onChange={(state) => setFilePage(state.pageIndex)}+ />+ ) : null}</section>+ <SkillLinkedTraces+ projectId={projectId}+ name={name}+ version={version}+ timeRange={timeRange}+ fileFilter={+ selectedFile !== null+ ? {+ skillId,+ path: selectedFile,+ onClear: () => setSelectedFile(null),+ }+ : undefined+ }+ /></div></>);@@ -150,13 +195,15 @@ function Metric({}) {const displayValue = value === null ? "—" : formatCount(value);return (- <div className="flex flex-col gap-2 rounded-lg border p-4">- <p className="text-muted-foreground text-xs">{label}</p>- {loading ? (- <Skeleton className="h-8 w-24" />- ) : (- <p className="text-2xl font-bold tabular-nums">{displayValue}</p>- )}+ <div className="flex flex-col gap-1 rounded-lg border px-3 py-2">+ <div className="flex items-center justify-between gap-3">+ <p className="text-sm">{label}</p>+ {loading ? (+ <Skeleton className="h-6 w-12" />+ ) : (+ <p className="text-lg font-bold tabular-nums">{displayValue}</p>+ )}+ </div><p className="text-muted-foreground text-xs">{description}</p></div>);diff --git a/web/src/features/skills/components/SkillEditor.tsx b/web/src/features/skills/components/SkillEditor.tsxindex b93acc13eb..b0a5a4e1fb 100644--- a/web/src/features/skills/components/SkillEditor.tsx+++ b/web/src/features/skills/components/SkillEditor.tsx@@ -12,6 +12,8 @@ import { MAX_SKILL_FILES } from "@langfuse/shared";import { useStore } from "zustand";import {Download,+ ChevronDown,+ ExternalLink,Loader2,Pencil,TriangleAlert,@@ -23,6 +25,7 @@ import { Tooltip } from "@/src/components/design-system/Tooltip/Tooltip";import { IconButton } from "@/src/components/design-system/IconButton/IconButton";import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { SkillLinkedTraces } from "@/src/features/skills/components/SkillLinkedTraces";+import { DropdownMenu } from "@/src/components/design-system/DropdownMenu/DropdownMenu";import Page from "@/src/components/layouts/page";import { Button } from "@/src/components/ui/button";import { Dialog } from "@/src/components/design-system/Dialog/Dialog";@@ -194,10 +197,8 @@ export function SkillEditor({withDefault(StringParam, "files"),);const activeTab =- !isDraft &&- (selectedTab === "linked-traces" ||- (selectedTab === "metrics" && canReadMetrics))- ? selectedTab+ !isDraft && ["usage", "linked-traces", "metrics"].includes(selectedTab)+ ? "usage": "files";const canEditFiles = isDraft && canCreate && !isSaving;const isDesktop = useMediaQuery({ query: "(min-width: 768px)" });@@ -373,6 +374,32 @@ export function SkillEditor({}};+ const downloadTitle = isDownloading+ ? "Downloading…"+ : `Download v${baseVersion} as ZIP`;+ const downloadDisabled = isDownloading+ ? { reason: "Download in progress" }+ : undefined;+ const usageTab = view.kind === "version" && baseVersion !== null && (+ <Tabs.Content value="usage" layout="fill">+ {canReadMetrics ? (+ <SkillAnalytics+ projectId={projectId}+ skillId={view.skillId}+ name={name}+ version={baseVersion}+ paths={Object.keys(store.getState().files).toSorted()}+ />+ ) : (+ <SkillLinkedTraces+ projectId={projectId}+ name={name}+ version={baseVersion}+ />+ )}+ </Tabs.Content>+ );+const renderHeaderActions = (openDialog: (state:@@ -401,36 +428,47 @@ export function SkillEditor({<div className="bg-border hidden h-6 w-px sm:block" /></>) : null}- {baseVersion !== null ? (- <Button- type="button"- variant="outline"- onClick={download}- disabled={isDownloading}- aria-label={`Download version ${baseVersion}`}+ {baseVersion !== null && !isDraft ? (+ <DropdownMenu+ ariaLabel="Use skill"+ items={[+ {+ type: "item",+ id: "install",+ title: "Install with CLI",+ icon: Terminal,+ onClick: () => {+ closeMenu?.();+ openDialog({ kind: "install" });+ },+ },+ {+ type: "item",+ id: "download",+ title: downloadTitle,+ icon: Download,+ disabled: downloadDisabled,+ onClick: download,+ },+ {+ type: "item",+ id: "api",+ title: "API",+ icon: ExternalLink,+ href: "https://api.reference.langfuse.com/#tag/skills",+ linkTarget: "_blank",+ },+ ]}>- {isDownloading ? (- <Loader2- size="base"- color="default"- __rawClassName="mr-1.5 animate-spin"+ {({ getTriggerProps }) => (+ <DesignSystemButton+ text="Use skill"+ variant="secondary"+ icon={ChevronDown}+ {...getTriggerProps()}/>- ) : (- <Download size="base" color="default" __rawClassName="mr-1.5" />)}- Download- </Button>- ) : null}- {!isDraft && baseVersion !== null ? (- <DesignSystemButton- text="Install with CLI"- variant="secondary"- icon={Terminal}- onClick={() => {- closeMenu?.();- openDialog({ kind: "install" });- }}- />+ </DropdownMenu>) : null}{nameWarning ? (<Tooltip label={nameWarning}>@@ -685,36 +723,12 @@ export function SkillEditor({<Tabs.List variant="underline"><Tabs.Trigger value="files" label="Files" /><Tabs.Trigger- value="metrics"- label="Metrics"- disabled={isDraft || !canReadMetrics}- />- <Tabs.Trigger- value="linked-traces"- label="Observations"+ value="usage"+ label="Usage"disabled={isDraft}/></Tabs.List>- {canReadMetrics &&- view.kind === "version" &&- baseVersion !== null ? (- <Tabs.Content value="metrics" layout="fill">- <SkillAnalytics- projectId={projectId}- skillId={view.skillId}- paths={Object.keys(store.getState().files).toSorted()}- />- </Tabs.Content>- ) : null}- {!isDraft && baseVersion !== null ? (- <Tabs.Content value="linked-traces" layout="fill">- <SkillLinkedTraces- projectId={projectId}- name={name}- version={baseVersion}- />- </Tabs.Content>- ) : null}+ {usageTab}<Tabs.Content value="files" layout="fill"><ResizablePanelGroupkey={isDesktop ? "desktop" : "mobile"}diff --git a/web/src/features/skills/components/SkillEditorPage.tsx b/web/src/features/skills/components/SkillEditorPage.tsxindex f9728ddec4..e636f9dbb1 100644--- a/web/src/features/skills/components/SkillEditorPage.tsx+++ b/web/src/features/skills/components/SkillEditorPage.tsx@@ -291,7 +291,8 @@ function ExistingSkillSession({projectId,skillName,version: selectedVersion,- ...(router.query.tab === "linked-traces" ||+ ...(router.query.tab === "usage" ||+ router.query.tab === "linked-traces" ||router.query.tab === "metrics"? {tab: router.query.tab,diff --git a/web/src/features/skills/components/SkillInstallationOptions.tsx b/web/src/features/skills/components/SkillInstallationOptions.tsxindex 5061aced93..e9a69d9fe9 100644--- a/web/src/features/skills/components/SkillInstallationOptions.tsx+++ b/web/src/features/skills/components/SkillInstallationOptions.tsx@@ -109,7 +109,7 @@ Verify the skills are installed in ${JSON.stringify(directory)} and retain langfsetVersion(event.target.value);return (- <div className="ph-no-capture flex flex-col gap-4">+ <div className="ph-no-capture flex min-w-0 flex-col gap-4"><div className="flex flex-col gap-3"><Accordion type="single" collapsible><Accordion.Item value="configuration">diff --git a/web/src/features/skills/components/SkillLinkedTraces.tsx b/web/src/features/skills/components/SkillLinkedTraces.tsxindex 28b0a326e1..0e8bc96d9c 100644--- a/web/src/features/skills/components/SkillLinkedTraces.tsx+++ b/web/src/features/skills/components/SkillLinkedTraces.tsx@@ -1,29 +1,159 @@+import { useState } from "react";+import { type FilterState } from "@langfuse/shared";+import { X } from "@langfuse/icons";import EventsTable from "@/src/features/events/components/EventsTable";+import { Badge } from "@/src/components/design-system/Badge/Badge";+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";import { TableHeaderControls } from "@/src/components/table/TableHeaderControls";import { useTableDateRange } from "@/src/hooks/useTableDateRange";+import { rangeToString, type TimeRange } from "@/src/utils/date-range-utils";export function SkillLinkedTraces({projectId,name,version,+ timeRange: parentTimeRange,+ fileFilter,}: {projectId: string;name: string;version?: number;+ timeRange?: TimeRange;+ fileFilter?: {+ skillId: string;+ path: string;+ onClear: () => void;+ };}) {- const { timeRange, setTimeRange } = useTableDateRange(projectId);+ const [usage, setUsage] = useState<SkillUsage>("both");+ const selectedUsage = fileFilter ? "loaded" : usage;+ const { timeRange: localTimeRange, setTimeRange } =+ useTableDateRange(projectId);+ const timeRange = parentTimeRange ?? localTimeRange;+ const filters = buildSkillUsageFilters({+ name,+ version,+ usage: selectedUsage,+ fileFilter,+ });return (- <div className="-mt-px flex min-h-0 flex-1 flex-col overflow-hidden">- <TableHeaderControls timeRange={timeRange} setTimeRange={setTimeRange} />- <EventsTable- projectId={projectId}- skill={{ name, version }}- isolateTableState- showSearchBar={false}- showToolbar={false}- showFilterSidebar={false}- />- </div>+ <section className="flex min-w-0 flex-col gap-3 rounded-lg border pt-4">+ {!parentTimeRange ? (+ <TableHeaderControls+ timeRange={timeRange}+ setTimeRange={setTimeRange}+ />+ ) : null}+ <Tabs+ value={selectedUsage}+ onValueChange={(value) => {+ if (value === "both" || value === "available" || value === "loaded") {+ setUsage(value);+ if (value !== "loaded") fileFilter?.onClear();+ }+ }}+ >+ <div className="flex flex-col gap-3">+ <div className="flex flex-wrap items-center justify-between gap-2 px-4">+ <div className="flex min-w-0 flex-wrap items-center gap-2">+ <h3 className="text-sm font-bold">Observations</h3>+ {fileFilter ? (+ <span className="ph-no-capture max-w-64 min-w-0">+ <Badge+ label="File"+ text={fileFilter.path}+ trailingIcon={X}+ color="filled"+ aria-label={`Clear file filter: ${fileFilter.path}`}+ onDismiss={() => {+ setUsage("loaded");+ fileFilter.onClear();+ }}+ />+ </span>+ ) : null}+ </div>+ <Tabs.List+ variant="inset"+ size="sm"+ aria-label="Skill usage filter"+ >+ <Tabs.Trigger+ value="both"+ label="Any"+ tooltip="Observations where this skill was available or loaded"+ />+ <Tabs.Trigger+ value="available"+ label="Available"+ tooltip="Observations offering this skill"+ />+ <Tabs.Trigger+ value="loaded"+ label="Loaded"+ tooltip="Observations loading one or more skill files"+ />+ </Tabs.List>+ </div>+ <Tabs.Content value={selectedUsage}>+ <div className="h-[480px] min-w-0 overflow-hidden">+ <EventsTable+ key={`${name}:${version}:${rangeToString(timeRange)}:${selectedUsage}:${fileFilter?.path ?? ""}`}+ projectId={projectId}+ skill={{ name, version }}+ externalFilterState={filters}+ isolateTableState+ showSearchBar={false}+ showToolbar={false}+ showFilterSidebar={false}+ />+ </div>+ </Tabs.Content>+ </div>+ </Tabs>+ </section>);}++function buildSkillUsageFilters({+ name,+ version,+ usage,+ fileFilter,+}: {+ name: string;+ version: number | undefined;+ usage: SkillUsage;+ fileFilter: { skillId: string; path: string } | undefined;+}): FilterState {+ const column = {+ both: version === undefined ? "skillNames" : "skillVersions",+ available:+ version === undefined ? "skillNamesAvailable" : "skillVersionsAvailable",+ loaded:+ version === undefined ? "skillsNamesLoaded" : "skillsVersionsLoaded",+ }[usage];+ const skillFilters: FilterState = [+ {+ column,+ type: "arrayOptions",+ operator: "any of",+ value: [version === undefined ? name : `${name}@${version}`],+ },+ ];++ return fileFilter+ ? [+ ...skillFilters,+ {+ column: "skillFilesLoaded",+ type: "arrayOptions",+ operator: "any of",+ value: [`${fileFilter.skillId}/${fileFilter.path}`],+ },+ ]+ : skillFilters;+}++type SkillUsage = "both" | "available" | "loaded";diff --git a/web/src/features/skills/components/SkillsPage.tsx b/web/src/features/skills/components/SkillsPage.tsxindex aa591e6e14..6f779b7ebc 100644--- a/web/src/features/skills/components/SkillsPage.tsx+++ b/web/src/features/skills/components/SkillsPage.tsx@@ -2,6 +2,8 @@ import { useMemo } from "react";import Link from "next/link";import {BarChart4,+ ChevronDown,+ ExternalLink,Download,FileCode2,GitBranch,@@ -18,6 +20,7 @@ import {import Page from "@/src/components/layouts/page";import { Button } from "@/src/components/ui/button";import { Button as DesignSystemButton } from "@/src/components/design-system/Button/Button";+import { DropdownMenu } from "@/src/components/design-system/DropdownMenu/DropdownMenu";import { Dialog } from "@/src/components/design-system/Dialog/Dialog";import { DialogController } from "@/src/components/design-system/DialogController/DialogController";import { PaginationBar } from "@/src/components/design-system/PaginationBar/PaginationBar";@@ -149,34 +152,75 @@ function SkillsHeaderActions({return (<div className="flex max-w-full flex-wrap items-center gap-2">- <DesignSystemButton- text="API reference"- variant="ghost"- href="https://api.reference.langfuse.com/#tag/skills"- />- <DesignSystemButton- text="Install with CLI"- icon={Terminal}- variant="secondary"- disabled={installDisabled}- onClick={handleInstall}- />- <ImportSkillsDialog key={projectId} projectId={projectId}>- {(openDialog) => (+ <DropdownMenu+ ariaLabel="Use skill"+ items={[+ {+ type: "item",+ id: "install",+ title: "Install with CLI",+ icon: Terminal,+ disabled: installDisabled+ ? { reason: "Loading installation options" }+ : undefined,+ onClick: handleInstall,+ },+ {+ type: "item",+ id: "api",+ title: "API",+ icon: ExternalLink,+ href: "https://api.reference.langfuse.com/#tag/skills",+ linkTarget: "_blank",+ },+ ]}+ >+ {({ getTriggerProps }) => (<DesignSystemButton- text="Import"- icon={Download}+ text="Use skill"+ icon={ChevronDown}variant="secondary"- disabled={!canCreate}- onClick={openDialog}+ {...getTriggerProps()}/>)}+ </DropdownMenu>+ <ImportSkillsDialog key={projectId} projectId={projectId}>+ {(openDialog) => (+ <DropdownMenu+ ariaLabel="New skill"+ disabled={!canCreate}+ items={[+ {+ type: "item",+ id: "create",+ title: "Create from scratch",+ icon: Plus,+ href: `/project/${projectId}/skills/new`,+ onAfterNavigate: () => {+ closeMenu?.();+ capture("skills:new_form_open");+ },+ },+ {+ type: "item",+ id: "import",+ title: "Import skills",+ icon: Download,+ onClick: openDialog,+ },+ ]}+ >+ {({ getTriggerProps }) => (+ <DesignSystemButton+ text="New skill"+ icon={ChevronDown}+ disabled={!canCreate}+ {...getTriggerProps()}+ />+ )}+ </DropdownMenu>+ )}</ImportSkillsDialog>- <NewSkillButton- canCreate={canCreate}- href={`/project/${projectId}/skills/new`}- onOpen={() => capture("skills:new_form_open")}- /></div>);}