mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
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.
148 lines
6.3 KiB
TypeScript
148 lines
6.3 KiB
TypeScript
import { useValues } from 'kea'
|
|
import { router, combineUrl } from 'kea-router'
|
|
|
|
import { IconSparkles } from '@hanzo/icons'
|
|
import { Button, Tab, Tabs, Tag } from '@hanzo/elements'
|
|
|
|
import { urls } from 'scenes/urls'
|
|
|
|
import { FeaturePreviewSceneGate } from '~/layout/scenes/components/FeaturePreviewSceneGate'
|
|
import { SceneContent } from '~/layout/scenes/components/SceneContent'
|
|
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
|
|
import { ProductKey } from '~/queries/schema/schema-general'
|
|
import { SceneExport } from '~/scenes/sceneTypes'
|
|
|
|
import { askInsightsAI } from './askInsightsAI'
|
|
import { MCPAnalyticsClustering } from './clustering/MCPAnalyticsClustering'
|
|
import { MCPAnalyticsActivityDashboard } from './earlyData/MCPAnalyticsEarlyData'
|
|
import { mcpAnalyticsEmptyState } from './emptyState/mcpAnalyticsEmptyState'
|
|
import { mcpAnalyticsFeaturePreviewGate } from './featurePreviewGate'
|
|
import { MCPAnalyticsDashboard } from './MCPAnalyticsDashboard'
|
|
import { mcpAnalyticsOnboardingLogic } from './mcpAnalyticsOnboardingLogic'
|
|
import { MCPAnalyticsTab, TAB_AI_PROMPTS, TAB_DESCRIPTIONS, mcpAnalyticsSceneLogic } from './mcpAnalyticsSceneLogic'
|
|
import { MCPAnalyticsSceneMenuBar } from './MCPAnalyticsSceneMenuBar'
|
|
import { MCPAnalyticsToolQuality } from './MCPAnalyticsToolQuality'
|
|
import { MCPAnalyticsNotifications } from './notifications/MCPAnalyticsNotifications'
|
|
import { mcpAnalyticsNotificationsLogic } from './notifications/mcpAnalyticsNotificationsLogic'
|
|
import { MCPSessionsPlaylist } from './sessions/MCPSessionsPlaylist'
|
|
|
|
export const scene: SceneExport = {
|
|
component: MCPAnalyticsScene,
|
|
logic: mcpAnalyticsSceneLogic,
|
|
productKey: ProductKey.MCP_ANALYTICS,
|
|
emptyState: mcpAnalyticsEmptyState,
|
|
}
|
|
|
|
const MCP_DOCS_URL = 'https://hanzo.ai/docs/mcp-analytics/installation'
|
|
|
|
export function MCPAnalyticsScene(): JSX.Element {
|
|
return (
|
|
<FeaturePreviewSceneGate config={mcpAnalyticsFeaturePreviewGate}>
|
|
<MCPAnalyticsSceneContent />
|
|
</FeaturePreviewSceneGate>
|
|
)
|
|
}
|
|
|
|
function MCPAnalyticsSceneContent(): JSX.Element {
|
|
const { searchParams } = useValues(router)
|
|
const { activeTab } = useValues(mcpAnalyticsSceneLogic)
|
|
const { onboardingState, dashboardStage } = useValues(mcpAnalyticsOnboardingLogic)
|
|
const { notificationCount } = useValues(mcpAnalyticsNotificationsLogic)
|
|
|
|
// search is Sessions-only — drop it when leaving the tab; the date range stays shared.
|
|
const { search: _search, ...sharedParams } = searchParams
|
|
|
|
const activityTab: Tab<MCPAnalyticsTab> = {
|
|
key: 'activity',
|
|
label: 'Activity',
|
|
content: <MCPAnalyticsActivityDashboard />,
|
|
link: combineUrl(urls.mcpAnalyticsActivity(), sharedParams).url,
|
|
'data-attr': 'mcp-analytics-activity-tab',
|
|
}
|
|
const dashboardTab: Tab<MCPAnalyticsTab> = {
|
|
key: 'dashboard',
|
|
label: 'Dashboard',
|
|
content: <MCPAnalyticsDashboard />,
|
|
link: combineUrl(urls.mcpAnalyticsDashboard(), sharedParams).url,
|
|
'data-attr': 'mcp-analytics-dashboard-tab',
|
|
}
|
|
|
|
const tabs: Tab<MCPAnalyticsTab>[] = [
|
|
// The default landing tab leads: Activity while the project is low-volume,
|
|
// Dashboard once it graduates — matching the landing redirect so the first
|
|
// tab is always the one you arrive on.
|
|
...(dashboardStage === 'activity' ? [activityTab, dashboardTab] : [dashboardTab, activityTab]),
|
|
{
|
|
key: 'sessions',
|
|
label: 'Sessions',
|
|
content: <MCPSessionsPlaylist />,
|
|
link: combineUrl(urls.mcpAnalyticsSessions(), searchParams).url,
|
|
'data-attr': 'mcp-analytics-sessions-tab',
|
|
},
|
|
{
|
|
key: 'tool-quality',
|
|
label: 'Tool quality',
|
|
content: <MCPAnalyticsToolQuality />,
|
|
link: combineUrl(urls.mcpAnalyticsToolQuality(), sharedParams).url,
|
|
'data-attr': 'mcp-analytics-tool-quality-tab',
|
|
},
|
|
{
|
|
key: 'intent-clustering',
|
|
label: 'Intent clustering',
|
|
content: <MCPAnalyticsClustering />,
|
|
link: combineUrl(urls.mcpAnalyticsIntentClustering(), sharedParams).url,
|
|
'data-attr': 'mcp-analytics-intent-clustering-tab',
|
|
},
|
|
{
|
|
key: 'notifications',
|
|
label: (
|
|
<span className="flex items-center gap-1.5">
|
|
Notifications
|
|
{notificationCount > 0 && (
|
|
<Tag type="completion" size="small">
|
|
{notificationCount}
|
|
</Tag>
|
|
)}
|
|
</span>
|
|
),
|
|
content: <MCPAnalyticsNotifications />,
|
|
link: combineUrl(urls.mcpAnalyticsNotifications(), sharedParams).url,
|
|
'data-attr': 'mcp-analytics-notifications-tab',
|
|
},
|
|
]
|
|
|
|
return (
|
|
<SceneContent>
|
|
<MCPAnalyticsSceneMenuBar />
|
|
<SceneTitleSection
|
|
name="MCP analytics"
|
|
description={onboardingState === 'onboarded' ? TAB_DESCRIPTIONS[activeTab] : null}
|
|
resourceType={{ type: 'mcp_analytics' }}
|
|
actions={
|
|
<>
|
|
{onboardingState === 'onboarded' && (
|
|
<Button
|
|
type="secondary"
|
|
size="small"
|
|
icon={<IconSparkles />}
|
|
onClick={() => askInsightsAI(TAB_AI_PROMPTS[activeTab])}
|
|
data-attr="mcp-analytics-ask-ai"
|
|
>
|
|
Ask Insights AI
|
|
</Button>
|
|
)}
|
|
<Button to={MCP_DOCS_URL} type="secondary" targetBlank size="small">
|
|
Documentation
|
|
</Button>
|
|
</>
|
|
}
|
|
/>
|
|
|
|
{/* Loading and pre-data states are handled by the app-shell empty-state gate
|
|
(see `emptyState` on the SceneExport) — by the time this renders, either
|
|
tool calls exist or the user explicitly skipped setup. */}
|
|
<Tabs activeKey={activeTab} data-attr="mcp-analytics-tabs" tabs={tabs} sceneInset />
|
|
</SceneContent>
|
|
)
|
|
}
|