Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

117 lines
4.4 KiB
TypeScript

import { useActions, useValues } from 'kea'
import { IconX } from '@hanzo/icons'
import { Button } from '@hanzo/quill-primitives'
import { useChartTheme } from 'lib/charts/hooks'
import { TagsCombobox } from 'lib/components/Scenes/TagsCombobox'
import { LinkPrimitive } from 'lib/elements/Link/Link'
import { Tooltip } from 'lib/elements/Tooltip'
import { teamLogic } from 'scenes/teamLogic'
import { McpDateFilter } from './components/McpDateFilter'
import { mcpAnalyticsToolQualityLogic, mcpToolReportUrl } from './mcpAnalyticsToolQualityLogic'
import { ToolQualityCharts } from './tool-quality/ToolQualityCharts'
import { ToolQualityTable } from './tool-quality/ToolQualityTable'
function FilterBar(): JSX.Element {
const { availableCategories, selectedCategories, scopeShare, dateFilter, dateRangeLabel } =
useValues(mcpAnalyticsToolQualityLogic)
const { setSelectedCategories, setDateFilter } = useActions(mcpAnalyticsToolQualityLogic)
const hasScope = selectedCategories.length > 0
const sharePct = scopeShare.pct === null ? null : Math.round(scopeShare.pct * 10) / 10
return (
<div className="flex flex-wrap items-center gap-3">
<div className="min-w-[220px] max-w-[420px] flex-1">
<TagsCombobox
options={availableCategories}
value={selectedCategories}
onChange={setSelectedCategories}
placeholder="All categories"
allowCustomValues={false}
dataAttr="mcp-tool-quality-category-scope"
/>
</div>
<McpDateFilter
dateFrom={dateFilter.dateFrom}
dateTo={dateFilter.dateTo}
onChange={(dateFrom, dateTo) => setDateFilter(dateFrom, dateTo)}
dataAttr="mcp-tool-quality-date-filter"
/>
{hasScope && sharePct !== null ? (
<Tooltip
title={`${scopeShare.inScope.toLocaleString()} of ${scopeShare.total.toLocaleString()} MCP tool calls were in the selected categories (${dateRangeLabel})`}
>
<div className="text-sm text-muted">
<span className="font-semibold text-default">{sharePct}%</span> of MCP usage ({dateRangeLabel})
</div>
</Tooltip>
) : null}
</div>
)
}
function ChartsScopeHeader(): JSX.Element {
const { selectedTool, dateFilter } = useValues(mcpAnalyticsToolQualityLogic)
const { setSelectedTool } = useActions(mcpAnalyticsToolQualityLogic)
if (!selectedTool) {
return (
<div className="text-sm text-secondary">
Trends across all tools in scope — select a row above to drill down.
</div>
)
}
return (
<div className="flex items-center gap-2">
<span className="shrink-0 text-sm text-secondary">Trends for</span>
<span className="max-w-[28rem] truncate font-mono text-sm font-semibold" title={selectedTool}>
{selectedTool}
</span>
<Button
variant="outline"
size="sm"
render={<LinkPrimitive to={mcpToolReportUrl(selectedTool, dateFilter)} />}
data-attr="mcp-tool-quality-full-report"
>
Full tool report
</Button>
<Button
variant="link-muted"
size="icon-sm"
onClick={() => setSelectedTool(null)}
title="Show all tools"
data-attr="mcp-tool-quality-clear-tool"
>
<IconX />
</Button>
</div>
)
}
export function MCPAnalyticsToolQuality(): JSX.Element {
const { dailyChartData, dailyStatsLoading, interval, incompleteTail } = useValues(mcpAnalyticsToolQualityLogic)
const { timezone } = useValues(teamLogic)
const theme = useChartTheme()
return (
<div className="flex flex-col gap-4" data-quill>
<FilterBar />
<ChartsScopeHeader />
<ToolQualityCharts
data={dailyChartData}
loading={dailyStatsLoading}
theme={theme}
timezone={timezone}
interval={interval}
incompleteTail={incompleteTail}
/>
<ToolQualityTable />
</div>
)
}