Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(pulse): add the pulse scene with brief viewing and configs (#67977)

Vasco de Krijger9d2ff64d3c38
diff --git a/frontend/package.json b/frontend/package.json
index 566d735218ca..86a7645796d5 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -119,6 +119,7 @@
"@posthog/products-platform-features": "workspace:*",
"@posthog/products-posthog-ai": "workspace:*",
"@posthog/products-product-analytics": "workspace:*",
+ "@posthog/products-pulse": "workspace:*",
"@posthog/products-replay": "workspace:*",
"@posthog/products-replay-vision": "workspace:*",
"@posthog/products-revenue-analytics": "workspace:*",
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 3ddc4065fe7f..8eee88959c37 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -446,6 +446,7 @@ export const FEATURE_FLAGS = {
PROJECT_SECRET_API_KEYS: 'project-secret-api-keys', // owner: #team-platform-features
PROMOTED_EVENT_PROPERTIES_EDIT: 'promoted-event-properties-edit', // owner: @pauldambra #team-product-analytics, gates the primary-property picker on the event definition edit page (flag slug kept as `promoted-event-properties-edit` to avoid migrating teams that already toggled it on)
PROPERTY_ACCESS_CONTROL: 'property-access-control', // owner: @reecejones #team-platform-features
+ PULSE: 'pulse', // owner: #team-analytics-platform
QUICK_START_PULSE_INDICATOR: 'quick-start-pulse-indicator', // owner: @fercgomes #team-growth multivariate=control,test
QUILL_CHART_STYLE_REFRESH: 'quill-chart-style-refresh', // owner: #team-product-analytics, gates refreshed quill chart styling (monotone curves, axis lines + tick marks, faint dashed grid, crosshair)
QUILL_DATE_PICKER: 'quill-date-picker', // owner: @pauldambra, flips the lib/components/DatePicker seam from LemonUI to Quill
diff --git a/frontend/src/productScenes.tsx b/frontend/src/productScenes.tsx
index 7304783a01ba..3de4bda095e2 100644
--- a/frontend/src/productScenes.tsx
+++ b/frontend/src/productScenes.tsx
@@ -102,6 +102,7 @@ export const productScenes: Record<string, () => Promise<any>> = {
MCPAnalyticsToolDetail: () => import('../../products/mcp_analytics/frontend/MCPAnalyticsToolDetail'),
Metrics: () => import('../../products/metrics/frontend/MetricsScene'),
TaskTracker: () => import('../../products/posthog_ai/frontend/scenes/TaskTracker/TaskTracker'),
+ Pulse: () => import('../../products/pulse/frontend/PulseScene'),
ReplayVision: () => import('../../products/replay_vision/frontend/replay_scanners/ReplayScannersScene'),
ReplayVisionScanner: () => import('../../products/replay_vision/frontend/replay_scanners/ReplayScanner'),
ReplayVisionScannerEditor: () => import('../../products/replay_vision/frontend/replay_scanners/ScannerEditorScene'),
diff --git a/frontend/src/products.json b/frontend/src/products.json
index e3029d96ac7e..abbd3c675b59 100644
--- a/frontend/src/products.json
+++ b/frontend/src/products.json
@@ -206,6 +206,7 @@
"type": "product_tour",
"intents": ["product_tours"]
},
+ { "path": "Pulse", "category": "Unreleased", "iconType": "activity", "type": null, "intents": ["pulse"] },
{
"path": "Session replay",
"category": "Behavior",
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index c163788573f7..a311c46b6f91 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -174,6 +174,7 @@ export const productRoutes: Record<string, [string, string]> = {
'/metrics': ['Metrics', 'metrics'],
'/tasks': ['TaskTracker', 'taskTracker'],
'/tasks/:taskId': ['TaskTracker', 'taskDetail'],
+ '/pulse': ['Pulse', 'pulse'],
'/replay-vision': ['ReplayVision', 'replayVision'],
'/replay-vision/observations/:observationId': ['ReplayVisionObservation', 'replayVisionObservation'],
'/replay-vision/actions/:actionId/runs/:runId': ['ReplayVisionActionRun', 'replayVisionActionRun'],
@@ -704,6 +705,13 @@ export const productConfiguration: Record<string, any> = {
iconType: 'task',
layout: 'app-full-scene-height',
},
+ Pulse: {
+ name: 'Pulse',
+ projectBased: true,
+ description:
+ 'Your always-on product manager: spots growth opportunities and shows how to move the numbers that matter.',
+ iconType: 'activity',
+ },
ReplayVision: {
name: 'Replay vision',
projectBased: true,
@@ -1216,6 +1224,7 @@ export const productUrls = {
insightQuickStart: (): string => '/insights/quick-start',
productTours: (): string => '/product_tours',
productTour: (id: string): string => `/product_tours/${id}`,
+ pulse: (): string => '/pulse',
replay: (
tab?: ReplayTabs,
filters?: Partial<RecordingUniversalFilters>,
@@ -2090,6 +2099,18 @@ export const getTreeItemsProducts = (): FileSystemImport[] => [
'AIObservabilityCluster',
],
},
+ {
+ path: 'Pulse',
+ intents: [ProductKey.PULSE],
+ category: ProductItemCategory.UNRELEASED,
+ iconType: 'activity',
+ iconColor: ['var(--color-product-activity-light)', 'var(--color-product-activity-dark)'] as FileSystemIconColor,
+ href: urls.pulse(),
+ flag: FEATURE_FLAGS.PULSE,
+ tags: ['alpha'],
+ sceneKey: 'Pulse',
+ sceneKeys: ['Pulse'],
+ },
{
path: 'Replay vision',
category: ProductItemCategory.BEHAVIOR,
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index aea16b520e9d..dab9374b5581 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -33625,6 +33625,7 @@
"platform_and_support",
"product_analytics",
"product_tours",
+ "pulse",
"revenue_analytics",
"review_hog",
"session_replay",
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index e30d7ee94eef..f05f3babc9a4 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -8243,6 +8243,7 @@ export enum ProductKey {
PLATFORM_AND_SUPPORT = 'platform_and_support',
PRODUCT_ANALYTICS = 'product_analytics',
PRODUCT_TOURS = 'product_tours',
+ PULSE = 'pulse',
REVENUE_ANALYTICS = 'revenue_analytics',
REVIEW_HOG = 'review_hog',
SESSION_REPLAY = 'session_replay',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 45a7fe11a955..80f730455723 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -746,6 +746,9 @@ importers:
'@posthog/products-product-analytics':
specifier: workspace:*
version: link:../products/product_analytics
+ '@posthog/products-pulse':
+ specifier: workspace:*
+ version: link:../products/pulse
'@posthog/products-replay':
specifier: workspace:*
version: link:../products/replay
@@ -4036,7 +4039,33 @@ importers:
products/product_tours: {}
- products/pulse: {}
+ products/pulse:
+ dependencies:
+ '@posthog/icons':
+ specifier: 'catalog:'
+ '@types/react':
+ specifier: 18.3.27
+ version: 18.3.27
+ kea:
+ specifier: 'catalog:'
+ version: 4.0.0-pre.6([email protected])
+ kea-forms:
+ specifier: 'catalog:'
+ kea-loaders:
+ specifier: 'catalog:'
+ posthog-js:
+ specifier: 'catalog:'
+ version: 1.404.0
+ react:
+ specifier: 18.3.1
+ version: 18.3.1
+ devDependencies:
+ kea-test-utils:
+ specifier: 'catalog:'
products/reminders: {}
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index 50a1d748b0a8..2947986efe82 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -3024,6 +3024,7 @@ class ProductKey(StrEnum):
PLATFORM_AND_SUPPORT = "platform_and_support"
PRODUCT_ANALYTICS = "product_analytics"
PRODUCT_TOURS = "product_tours"
+ PULSE = "pulse"
REVENUE_ANALYTICS = "revenue_analytics"
REVIEW_HOG = "review_hog"
SESSION_REPLAY = "session_replay"
diff --git a/products/pulse/backend/api/brief.py b/products/pulse/backend/api/brief.py
index d5e693da60dd..504567c4a2bd 100644
--- a/products/pulse/backend/api/brief.py
+++ b/products/pulse/backend/api/brief.py
@@ -195,23 +195,32 @@ class PeriodSerializer(serializers.Serializer):
return attrs
-class BriefSectionSerializer(serializers.Serializer):
- # Mirrors generation.schemas.BriefSectionOut so the generated frontend/MCP types are typed
- # rather than an opaque dict; brief.sections stores a list of these shapes.
- kind = serializers.CharField(help_text="Section kind, e.g. 'what_happened' or 'what_to_build_next'.")
- title = serializers.CharField(help_text="Short, specific section heading.")
- markdown = serializers.CharField(help_text="Section body in markdown.")
- citations = serializers.ListField(
- child=serializers.CharField(), help_text="Citation ids (e.g. 'c1') backing the section, copied verbatim."
+class BriefSectionCitationSerializer(serializers.Serializer):
+ type = serializers.CharField(help_text="Cited resource type, e.g. insight or dashboard.")
+ ref = serializers.CharField(help_text="Stable id of the cited resource within its type.")
+ label = serializers.CharField( # type: ignore[assignment] # field name intentionally shadows Field.label
+ help_text="Human-readable name of the cited resource, for display."
+ )
+ url = serializers.CharField(
+ allow_blank=True, help_text="Deep link into the app, or empty when the resource has no navigable target."
)
- confidence = serializers.FloatField(help_text="Confidence in this section, 0.0-1.0.")
+
+
+class BriefSectionSerializer(serializers.Serializer):
+ kind = serializers.CharField(help_text="Section kind, e.g. what_happened or what_to_build_next.")
+ title = serializers.CharField(help_text="Short section heading.")
+ markdown = serializers.CharField(help_text="Section body rendered as markdown.")
+ citations = BriefSectionCitationSerializer(many=True, help_text="PostHog resources this section cites as evidence.")
+ confidence = serializers.FloatField(help_text="Model confidence in this section, 0.0-1.0.")
class ProductBriefSerializer(serializers.ModelSerializer):
created_by = UserBasicSerializer(read_only=True, allow_null=True, help_text="User who requested the brief.")
period = PeriodSerializer(read_only=True, help_text="The resolved-at-gather period spec the brief covers.")
sections = BriefSectionSerializer(
- many=True, read_only=True, help_text="Generated brief sections, most important first."
+ many=True,
+ read_only=True,
+ help_text="Generated brief sections, most important first.",
)
sources_used = serializers.ListField(
child=serializers.CharField(),
@@ -288,7 +297,7 @@ class BriefConfigViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):
return configs
def perform_create(self, serializer: serializers.BaseSerializer) -> None:
- instance = serializer.save(team=self.team, created_by=cast(User, self.request.user))
+ instance = cast(BriefConfig, serializer.save(team=self.team, created_by=cast(User, self.request.user)))
report_user_action(
cast(User, self.request.user),
"pulse config created",
@@ -352,7 +361,11 @@ class ProductBriefViewSet(TeamAndOrgViewSetMixin, viewsets.ReadOnlyModelViewSet)
@action(methods=["POST"], detail=False, url_path="generate")
def generate(self, request: Request, **kwargs) -> Response:
if not self.team.organization.is_ai_data_processing_approved:
- raise ValidationError("AI data processing must be approved for this organization to generate briefs.")
+ # `code` is a cross-boundary contract with pulseLogic's AI_CONSENT_ERROR_CODE.
+ raise ValidationError(
+ "AI data processing must be approved for this organization to generate briefs.",
+ code="ai_consent_required",
+ )
request_serializer = GenerateBriefRequestSerializer(data=request.data)
request_serializer.is_valid(raise_exception=True)
diff --git a/products/pulse/backend/generation/persist.py b/products/pulse/backend/generation/persist.py
index 0272feb973bc..adb3f704db50 100644
--- a/products/pulse/backend/generation/persist.py
+++ b/products/pulse/backend/generation/persist.py
@@ -52,6 +52,16 @@ def _resolve_citations(citation_ids: list[str], evidence_index: dict[str, Eviden
return resolved
+def _section_dict(section: BriefSectionOut, evidence_index: dict[str, EvidenceRef]) -> dict[str, object]:
+ return {
+ "kind": section.kind,
+ "title": section.title,
+ "markdown": section.markdown,
+ "citations": [ref.citation for ref in _resolve_citations(section.citations, evidence_index)],
+ "confidence": section.confidence,
+ }
+
+
def _validate_output_references(out: BriefOut, items: list[SourceItem]) -> BriefOut:
evidence_index = build_evidence_index(items)
allowed_citation_ids = set(evidence_index)
@@ -171,7 +181,7 @@ def persist_brief_output(*, brief: ProductBrief, out: BriefOut, items: list[Sour
# Same index the render side built, so the ids the model cited resolve back to the same refs.
evidence_index = build_evidence_index(items)
with transaction.atomic():
- brief.sections = [s.model_dump() for s in out.sections]
+ brief.sections = [_section_dict(s, evidence_index) for s in out.sections]
# A brief with only opportunities still has something to say — QUIET means nothing survived the gate.
has_content = bool(out.sections or out.opportunities)
brief.status = ProductBrief.Status.READY if has_content else ProductBrief.Status.QUIET
diff --git a/products/pulse/backend/sources/base.py b/products/pulse/backend/sources/base.py
index f3b803e199d7..e510f2f667e6 100644
--- a/products/pulse/backend/sources/base.py
+++ b/products/pulse/backend/sources/base.py
@@ -53,6 +53,11 @@ class EvidenceRef:
def is_insight(self) -> bool:
return self.type == EvidenceType.INSIGHT
+ @property
+ def citation(self) -> dict[str, str]:
+ """Structured citation the frontend renders directly — no client-side parsing of the ref."""
+ return {"type": self.type.value, "ref": self.ref, "label": self.label, "url": self.url}
+
@property
def metric_ref(self) -> dict[str, str] | None:
"""This ref's contribution to an opportunity's metric_ref, when it is the backing insight."""
diff --git a/products/pulse/backend/test/test_api.py b/products/pulse/backend/test/test_api.py
index 5a43d3b8d3c8..90558a0cf9f0 100644
--- a/products/pulse/backend/test/test_api.py
+++ b/products/pulse/backend/test/test_api.py
@@ -47,6 +47,8 @@ class TestPulseAPI(APIBaseTest):
self.organization.save()
response = self.client.post(f"/api/projects/{self.team.id}/pulse/briefs/generate/")
assert response.status_code == status.HTTP_400_BAD_REQUEST
+ # The frontend matches this code to show the consent banner — it is part of the API contract.
+ assert response.json()["code"] == "ai_consent_required"
mock_connect.assert_not_called()
def test_generate_creates_brief_and_starts_workflow(self, mock_connect: MagicMock, _mock_flag: MagicMock) -> None:
diff --git a/products/pulse/backend/test/test_persist.py b/products/pulse/backend/test/test_persist.py
index 6450160bd35e..2872308edaa8 100644
--- a/products/pulse/backend/test/test_persist.py
+++ b/products/pulse/backend/test/test_persist.py
@@ -77,6 +77,8 @@ class TestPersistBriefOutput(BaseTest):
brief = persist_brief_output(brief=self._brief(), out=_out(), items=[_item()])
assert brief.status == ProductBrief.Status.READY
assert len(brief.sections) == 1
+ # Section citations resolve to structured refs the client renders directly — no id parsing.
+ assert brief.sections[0]["citations"] == [_EVIDENCE.citation]
assert brief.sources_used == ["anchored_insights"]
opportunity = self._opportunities().get()
assert opportunity.baseline == {"pct_change": -30.0, "baseline_total": 700.0, "current_total": 490.0}
diff --git a/products/pulse/frontend/BriefConfigModal.tsx b/products/pulse/frontend/BriefConfigModal.tsx
new file mode 100644
index 000000000000..d42523057bbd
--- /dev/null
+++ b/products/pulse/frontend/BriefConfigModal.tsx
@@ -0,0 +1,71 @@
+import { useActions, useValues } from 'kea'
+import { Form } from 'kea-forms'
+
+import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { LemonField } from 'lib/lemon-ui/LemonField'
+import { LemonInput } from 'lib/lemon-ui/LemonInput'
+import { LemonInputSelect } from 'lib/lemon-ui/LemonInputSelect'
+import { LemonModal } from 'lib/lemon-ui/LemonModal'
+import { LemonTextArea } from 'lib/lemon-ui/LemonTextArea'
+
+import { dashboardsModel } from '~/models/dashboardsModel'
+
+import { pulseLogic } from './pulseLogic'
+
+export function BriefConfigModal(): JSX.Element {
+ const { configModalOpen, editingConfig, isConfigFormSubmitting } = useValues(pulseLogic)
+ const { closeConfigModal, submitConfigForm } = useActions(pulseLogic)
+ const { nameSortedDashboards } = useValues(dashboardsModel)
+
+ return (
+ <LemonModal
+ isOpen={configModalOpen}
+ onClose={closeConfigModal}
+ title={editingConfig ? `Edit "${editingConfig.name}"` : 'New brief config'}
+ footer={
+ <>
+ <LemonButton
+ onClick={closeConfigModal}
+ disabledReason={isConfigFormSubmitting ? 'Saving…' : undefined}
+ >
+ Cancel
+ </LemonButton>
+ <LemonButton type="primary" loading={isConfigFormSubmitting} onClick={submitConfigForm}>
+ {editingConfig ? 'Save' : 'Create'}
+ </LemonButton>
+ </>
+ }
+ >
+ <Form logic={pulseLogic} formKey="configForm" enableFormOnSubmit className="flex flex-col gap-2">
+ <LemonField name="name" label="Name">
+ <LemonInput placeholder="e.g. Feature flags team" />
+ </LemonField>
+ <LemonField
+ name="focus_prompt"
+ label="Focus prompt"
+ info="Free text steering what the brief pays attention to and its tone."
+ >
+ <LemonTextArea placeholder="e.g. Increase adoption of our new onboarding flow and cut week-one drop-off" />
+ </LemonField>
+ <LemonField
+ name="dashboards"
+ label="Anchor dashboards"
+ info="The brief scouts the insights on these dashboards. Leave empty to fall back to the team's most recently accessed dashboards."
+ >
+ {({ value, onChange }) => (
+ <LemonInputSelect
+ mode="multiple"
+ value={((value as number[]) ?? []).map(String)}
+ onChange={(ids) => onChange(ids.map(Number))}
+ options={nameSortedDashboards.map((dashboard) => ({
+ key: String(dashboard.id),
+ label: dashboard.name || 'Untitled',
+ }))}
+ placeholder="Select dashboards"
+ />
+ )}
+ </LemonField>
+ </Form>
+ </LemonModal>
+ )
+}
diff --git a/products/pulse/frontend/BriefDetail.tsx b/products/pulse/frontend/BriefDetail.tsx
new file mode 100644
index 000000000000..b6fb2f5f5c08
--- /dev/null
+++ b/products/pulse/frontend/BriefDetail.tsx
@@ -0,0 +1,88 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
+import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
+import { LemonTag } from 'lib/lemon-ui/LemonTag'
+import { Link } from 'lib/lemon-ui/Link'
+import { Spinner } from 'lib/lemon-ui/Spinner'
+
+import type { BriefSectionApi, BriefSectionCitationApi } from './generated/api.schemas'
+import { ProductBriefStatusEnumApi } from './generated/api.schemas'
+import { pulseLogic } from './pulseLogic'
+
+function assertNever(value: never): never {
+ throw new Error(`Unhandled brief status: ${String(value)}`)
+}
+
+export function BriefDetail(): JSX.Element | null {
+ const { briefDetail, briefDetailLoading, briefDetailLoadFailed, briefDetailSections, selectedBriefId } =
+ useValues(pulseLogic)
+ const { loadBriefDetail } = useActions(pulseLogic)
+
+ if (briefDetailLoadFailed && selectedBriefId) {
+ return (
+ <LemonBanner
+ type="error"
+ action={{ children: 'Retry', onClick: () => loadBriefDetail({ briefId: selectedBriefId }) }}
+ >
+ Couldn't load this brief. It may have been deleted, or the request failed.
+ </LemonBanner>
+ )
+ }
+
+ if (!briefDetail || briefDetail.id !== selectedBriefId) {
+ return briefDetailLoading ? <Spinner /> : null
+ }
+
+ // Exhaustive over the status enum — a new backend status fails compilation at assertNever.
+ switch (briefDetail.status) {
+ case ProductBriefStatusEnumApi.Generating:
+ return (
+ <div className="flex items-center gap-2 border rounded p-8 justify-center">
+ <Spinner />
+ <span>Generating your brief…</span>
+ </div>
+ )
+ case ProductBriefStatusEnumApi.Failed:
+ return <LemonBanner type="error">{briefDetail.error || 'Brief generation failed.'}</LemonBanner>
+ case ProductBriefStatusEnumApi.Quiet:
+ return (
+ <div className="border rounded p-8 text-center text-muted">
+ Quiet period — nothing confident to report
+ </div>
+ )
+ case ProductBriefStatusEnumApi.Ready:
+ return (
+ <div className="flex flex-col gap-6">
+ {briefDetailSections.map((section, index) => (
+ <BriefSectionCard key={`${section.kind}-${index}`} section={section} />
+ ))}
+ </div>
+ )
+ default:
+ return assertNever(briefDetail.status)
+ }
+}
+
+function BriefSectionCard({ section }: { section: BriefSectionApi }): JSX.Element {
+ return (
+ <div className="border rounded p-4 flex flex-col gap-2">
+ <h3 className="mb-0">{section.title}</h3>
+ {/* LLM-generated markdown must not auto-load arbitrary image URLs (tracking-pixel / IP-leak vector). */}
+ <LemonMarkdown disableImages>{section.markdown}</LemonMarkdown>
+ {section.citations.length > 0 && (
+ <div className="flex flex-wrap gap-1">
+ {section.citations.map((citation) => (
+ <CitationTag key={`${citation.type}:${citation.ref}`} citation={citation} />
+ ))}
+ </div>
+ )}
+ </div>
+ )
+}
+
+function CitationTag({ citation }: { citation: BriefSectionCitationApi }): JSX.Element {
+ // The backend resolves each ref to a display label and deep link, so we render those directly.
+ const tag = <LemonTag>{citation.label}</LemonTag>
+ return citation.url ? <Link to={citation.url}>{tag}</Link> : tag
+}
diff --git a/products/pulse/frontend/BriefHistoryList.tsx b/products/pulse/frontend/BriefHistoryList.tsx
new file mode 100644
index 000000000000..b4513ff415f8
--- /dev/null
+++ b/products/pulse/frontend/BriefHistoryList.tsx
@@ -0,0 +1,47 @@
+import { useActions, useValues } from 'kea'
+
+import { TZLabel } from 'lib/components/TZLabel'
+import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { LemonTag, LemonTagType } from 'lib/lemon-ui/LemonTag'
+
+import type { ProductBriefListApi } from './generated/api.schemas'
+import { ProductBriefStatusEnumApi } from './generated/api.schemas'
+import { pulseLogic } from './pulseLogic'
+
+// Exhaustive over the enum so a new backend status fails compilation here instead of rendering unstyled.
+export const STATUS_TAG_TYPES: Record<ProductBriefStatusEnumApi, LemonTagType> = {
+ [ProductBriefStatusEnumApi.Generating]: 'warning',
+ [ProductBriefStatusEnumApi.Ready]: 'success',
+ [ProductBriefStatusEnumApi.Quiet]: 'default',
+ [ProductBriefStatusEnumApi.Failed]: 'danger',
+}
+
+export function BriefHistoryList({ briefs }: { briefs: ProductBriefListApi[] }): JSX.Element {
+ const { selectedBriefId, briefsHasMore } = useValues(pulseLogic)
+ const { selectBrief } = useActions(pulseLogic)
+
+ return (
+ <div className="w-72 shrink-0 flex flex-col gap-1">
+ {briefs.map((brief) => (
+ <LemonButton
+ key={brief.id}
+ fullWidth
+ active={brief.id === selectedBriefId}
+ onClick={() => selectBrief(brief.id)}
+ >
+ <div className="flex items-center justify-between gap-2 w-full">
+ <TZLabel time={brief.created_at} />
+ <LemonTag type={STATUS_TAG_TYPES[brief.status]}>{brief.status}</LemonTag>
+ </div>
+ </LemonButton>
+ ))}
+ {briefsHasMore && (
+ // TODO: paginate the brief history. Surfaced here rather than hidden in code so we
+ // address it before rolling Pulse out more widely.
+ <div className="text-muted text-xs px-2 py-1">
+ Showing the most recent briefs only. Pagination is coming soon.
+ </div>
+ )}
+ </div>
+ )
+}
diff --git a/products/pulse/frontend/BriefsView.tsx b/products/pulse/frontend/BriefsView.tsx
new file mode 100644
index 000000000000..2123b5accdc2
--- /dev/null
+++ b/products/pulse/frontend/BriefsView.tsx
@@ -0,0 +1,54 @@
+import { useActions, useValues } from 'kea'
+
+import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
+import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
+import { Spinner } from 'lib/lemon-ui/Spinner'
+
+import { BriefDetail } from './BriefDetail'
+import { BriefHistoryList } from './BriefHistoryList'
+import { pulseLogic } from './pulseLogic'
+import { RunBriefButton } from './RunBriefButton'
+
+export function BriefsView(): JSX.Element {
+ const { visibleBriefs, briefsLoading, briefsLoadFailed } = useValues(pulseLogic)
+ const { loadBriefs } = useActions(pulseLogic)
+
+ if (briefsLoading && visibleBriefs.length === 0) {
+ return (
+ <div className="flex justify-center py-16">
+ <Spinner className="text-2xl" />
+ </div>
+ )
+ }
+
+ // A failed load must not masquerade as the "no briefs yet" onboarding — offer a retry instead.
+ if (briefsLoadFailed && visibleBriefs.length === 0) {
+ return (
+ <LemonBanner type="error" action={{ children: 'Retry', onClick: loadBriefs }}>
+ Couldn't load your briefs. Check your connection and try again.
+ </LemonBanner>
+ )
+ }
+
+ if (visibleBriefs.length === 0) {
+ return (
+ <ProductIntroduction
+ productName="Pulse"
+ thingName="brief"
+ titleOverride="No briefs yet"
+ description="Run your first brief to see what happened in your product, why it happened, and what to build next."
+ isEmpty
+ actionElementOverride={<RunBriefButton />}
+ />
+ )
+ }
+
+ return (
+ <div className="flex gap-4 items-start">
+ <BriefHistoryList briefs={visibleBriefs} />
+ <div className="flex-1 min-w-0">
+ <BriefDetail />
+ </div>
+ </div>
+ )
+}
diff --git a/products/pulse/frontend/PulseScene.tsx b/products/pulse/frontend/PulseScene.tsx
new file mode 100644
index 000000000000..224083cd1b6f
--- /dev/null
+++ b/products/pulse/frontend/PulseScene.tsx
@@ -0,0 +1,129 @@
+import { useActions, useValues } from 'kea'
+
+import { IconPencil, IconPlusSmall, IconPulse, IconTrash } from '@posthog/icons'
+
+import { NotFound } from 'lib/components/NotFound'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
+import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
+import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { LemonDialog } from 'lib/lemon-ui/LemonDialog'
+import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
+import { Link } from 'lib/lemon-ui/Link'
+import { SceneExport } from 'scenes/sceneTypes'
+import { urls } from 'scenes/urls'
+
+import { SceneContent } from '~/layout/scenes/components/SceneContent'
+import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
+
+import { BriefConfigModal } from './BriefConfigModal'
+import { BriefsView } from './BriefsView'
+import { pulseLogic } from './pulseLogic'
+import { RunBriefButton } from './RunBriefButton'
+
+export const scene: SceneExport = {
+ component: PulseScene,
+ logic: pulseLogic,
+}
+
+const PULSE_DESCRIPTION =
+ 'Your always-on product manager: it spots growth opportunities and shows you how to move the numbers that matter.'
+
+export function PulseScene(): JSX.Element {
+ const isEnabled = useFeatureFlag('PULSE')
+ const { briefConfigs, selectedConfigId, showAiConsentBanner } = useValues(pulseLogic)
+ const { selectConfig, openConfigModal } = useActions(pulseLogic)
+
+ if (!isEnabled) {
+ return <NotFound object="Pulse" caption="This feature is not enabled for your project." />
+ }
+
+ return (
+ <SceneContent>
+ <SceneTitleSection
+ name="Pulse"
+ description={PULSE_DESCRIPTION}
+ resourceType={{ type: 'default_icon_type', forceIcon: <IconPulse /> }}
+ actions={
+ <>
+ <LemonButton type="secondary" icon={<IconPlusSmall />} onClick={() => openConfigModal(null)}>
+ New config
+ </LemonButton>
+ <RunBriefButton />
+ </>
+ }
+ />
+
+ {showAiConsentBanner && (
+ <LemonBanner type="warning">
+ Pulse runs AI over your project data, and your organization has not approved AI data processing yet.
+ Approve it in{' '}
+ <Link to={urls.settings('organization-details', 'organization-ai-consent')}>
+ organization settings
+ </Link>{' '}
+ to generate briefs.
+ </LemonBanner>
+ )}
+
+ {briefConfigs.length > 0 && (
+ <div className="flex items-center gap-2">
+ <span className="text-muted">Focus</span>
+ <LemonSelect<string | null>
+ size="small"
+ value={selectedConfigId}
+ onChange={(value) => selectConfig(value)}
+ options={[
+ { value: null, label: 'Whole project' },
+ ...briefConfigs.map((config) => ({ value: config.id, label: config.name })),
+ ]}
+ />
+ {selectedConfigId !== null && <SelectedConfigActions selectedConfigId={selectedConfigId} />}
+ </div>
+ )}
+
+ <BriefsView />
+ <BriefConfigModal />
+ </SceneContent>
+ )
+}
+
+function SelectedConfigActions({ selectedConfigId }: { selectedConfigId: string }): JSX.Element | null {
+ const { briefConfigs, configIdBeingDeleted } = useValues(pulseLogic)
+ const { openConfigModal, deleteConfig } = useActions(pulseLogic)
+
+ const selectedConfig = briefConfigs.find((config) => config.id === selectedConfigId)
+ if (!selectedConfig) {
+ return null
+ }
+ const isDeleting = configIdBeingDeleted === selectedConfig.id
+
+ return (
+ <>
+ <LemonButton
+ size="small"
+ icon={<IconPencil />}
+ tooltip="Edit config"
+ onClick={() => openConfigModal(selectedConfig)}
+ />
+ <LemonButton
+ size="small"
+ status="danger"
+ icon={<IconTrash />}
+ tooltip="Delete config"
+ loading={isDeleting}
+ disabledReason={isDeleting ? 'Deleting…' : undefined}
+ onClick={() =>
+ LemonDialog.open({
+ title: `Delete "${selectedConfig.name}"?`,
+ description: 'Briefs already generated for this config are kept.',
+ primaryButton: {
+ children: 'Delete',
+ status: 'danger',
+ onClick: () => deleteConfig(selectedConfig.id),
+ },
+ secondaryButton: { children: 'Cancel' },
+ })
+ }
+ />
+ </>
+ )
+}
diff --git a/products/pulse/frontend/RunBriefButton.tsx b/products/pulse/frontend/RunBriefButton.tsx
new file mode 100644
index 000000000000..8b874e4d3672
--- /dev/null
+++ b/products/pulse/frontend/RunBriefButton.tsx
@@ -0,0 +1,28 @@
+import { useActions, useValues } from 'kea'
+
+import { LemonButton } from 'lib/lemon-ui/LemonButton'
+
+import { BRIEF_ALREADY_GENERATING_MESSAGE, pulseLogic } from './pulseLogic'
+
+export function RunBriefButton(): JSX.Element {
+ const { isGeneratingForSelectedConfig, generatedBriefLoading, selectedConfigId, dataProcessingAccepted } =
+ useValues(pulseLogic)
+ const { generateBrief } = useActions(pulseLogic)
+
+ const disabledReason = !dataProcessingAccepted
+ ? 'Approve AI data processing first'
+ : isGeneratingForSelectedConfig && !generatedBriefLoading
+ ? BRIEF_ALREADY_GENERATING_MESSAGE
+ : undefined
+
+ return (
+ <LemonButton
+ type="primary"
+ loading={generatedBriefLoading}
+ disabledReason={disabledReason}
+ onClick={() => generateBrief({ configId: selectedConfigId })}
+ >
+ Run brief now
+ </LemonButton>
+ )
+}
diff --git a/products/pulse/frontend/generated/api.schemas.ts b/products/pulse/frontend/generated/api.schemas.ts
index f24e054a2345..a2f11900eb81 100644
--- a/products/pulse/frontend/generated/api.schemas.ts
+++ b/products/pulse/frontend/generated/api.schemas.ts
@@ -272,16 +272,27 @@ export interface PaginatedProductBriefListListApi {
results: ProductBriefListApi[]
}
+export interface BriefSectionCitationApi {
+ /** Cited resource type, e.g. insight or dashboard. */
+ type: string
+ /** Stable id of the cited resource within its type. */
+ ref: string
+ /** Human-readable name of the cited resource, for display. */
+ label: string
+ /** Deep link into the app, or empty when the resource has no navigable target. */
+ url: string
+}
+
export interface BriefSectionApi {
- /** Section kind, e.g. 'what_happened' or 'what_to_build_next'. */
+ /** Section kind, e.g. what_happened or what_to_build_next. */
kind: string
- /** Short, specific section heading. */
+ /** Short section heading. */
title: string
- /** Section body in markdown. */
+ /** Section body rendered as markdown. */
markdown: string
- /** Citation ids (e.g. 'c1') backing the section, copied verbatim. */
- citations: string[]
- /** Confidence in this section, 0.0-1.0. */
+ /** PostHog resources this section cites as evidence. */
+ citations: BriefSectionCitationApi[]
+ /** Model confidence in this section, 0.0-1.0. */
confidence: number
}
diff --git a/products/pulse/frontend/pulseLogic.test.ts b/products/pulse/frontend/pulseLogic.test.ts
new file mode 100644
index 000000000000..c2cc70b34610
--- /dev/null
+++ b/products/pulse/frontend/pulseLogic.test.ts
@@ -0,0 +1,287 @@
+import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { lemonToast } from 'lib/lemon-ui/LemonToast'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+
+import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import type { BriefConfigApi, ProductBriefListApi } from './generated/api.schemas'
+import { BRIEF_ALREADY_GENERATING_MESSAGE, MAX_CONSECUTIVE_POLL_FAILURES, pulseLogic } from './pulseLogic'
+
+const generatingBrief = {
+ id: 'brief-1',
+ config: null,
+ status: 'generating',
+ trigger: 'on_demand',
+ period: { period_type: 'last_n_days', days: 7 },
+ sections: [],
+ sources_used: [],
+ error: null,
+ created_at: '2026-07-02T10:00:00Z',
+ created_by: null,
+ updated_at: null,
+}
+
+const readyBrief = {
+ ...generatingBrief,
+ status: 'ready',
+ sections: [
+ {
+ kind: 'what_happened',
+ title: 'Signups dipped',
+ markdown: 'Signup conversion dropped 12%.',
+ citations: [{ type: 'insight', ref: 'abc123', label: 'Signups', url: '/project/1/insights/abc123' }],
+ confidence: 0.9,
+ },
+ ],
+ sources_used: ['anchored_insights'],
+}
+
+const existingConfig: BriefConfigApi = {
+ id: 'cfg-1',
+ name: 'Flags team',
+ focus_prompt: 'flags',
+ anchors: { dashboards: [1], insights: ['abc123'] },
+ enabled: true,
+ created_at: '2026-07-01T00:00:00Z',
+ created_by: null,
+ updated_at: null,
+}
+
+describe('pulseLogic', () => {
+ let logic: ReturnType<typeof pulseLogic.build>
+
+ beforeEach(() => {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/pulse/brief_configs/': { count: 0, results: [] },
+ '/api/projects/:team_id/pulse/briefs/': { count: 0, results: [] },
+ '/api/projects/:team_id/pulse/briefs/:id/': readyBrief,
+ },
+ post: {
+ '/api/projects/:team_id/pulse/briefs/generate/': () => [201, generatingBrief],
+ },
+ })
+ initKeaTests()
+ featureFlagLogic.mount()
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.PULSE], { [FEATURE_FLAGS.PULSE]: true })
+ logic = pulseLogic()
+ logic.mount()
+ })
+
+ afterEach(() => {
+ logic.unmount()
+ })
+
+ it('generates a brief, polls it, and stops polling on terminal status', async () => {
+ await expectLogic(logic, () => {
+ logic.actions.generateBrief({ configId: null })
+ })
+ .toDispatchActions(['generateBriefSuccess', 'startPolling'])
+ .toMatchValues({
+ selectedBriefId: 'brief-1',
+ isGeneratingForSelectedConfig: true,
+ })
+
+ // A poll tick that finds the brief in a terminal state merges it in.
+ await expectLogic(logic, () => {
+ logic.actions.pollGeneratingBriefs()
+ })
+ .toDispatchActions(['briefsRefreshed'])
+ .toMatchValues({ isGeneratingForSelectedConfig: false })
+ expect(logic.values.briefs[0].status).toEqual('ready')
+ expect(logic.values.briefDetail?.sections).toHaveLength(1)
+
+ // The next tick finds nothing generating: it stops the interval without fetching.
+ await expectLogic(logic, () => {
+ logic.actions.pollGeneratingBriefs()
+ })
+ .toDispatchActions(['stopPolling'])
+ .toNotHaveDispatchedActions(['briefsRefreshed'])
+ })
+
+ it('marks a brief failed after consecutive poll failures, then stops polling', async () => {
+ const captureSpy = jest.spyOn(posthog, 'capture')
+ useMocks({
+ get: { '/api/projects/:team_id/pulse/briefs/:id/': () => [500, {}] },
+ })
+
+ await expectLogic(logic, () => {
+ logic.actions.generateBrief({ configId: null })
+ }).toDispatchActions(['startPolling'])
+
+ for (let round = 1; round < MAX_CONSECUTIVE_POLL_FAILURES; round++) {
+ await expectLogic(logic, () => {
+ logic.actions.pollGeneratingBriefs()
+ })
+ .toFinishAllListeners()
+ .toNotHaveDispatchedActions(['markBriefFailed'])
+ }
+
+ // The failure ceiling marks the stuck brief failed rather than spinning on "generating" forever.
+ await expectLogic(logic, () => {
+ logic.actions.pollGeneratingBriefs()
+ })
+ .toFinishAllListeners()
+ .toDispatchActions(['markBriefFailed'])
+ expect(logic.values.briefs[0].status).toEqual('failed')
+ expect(captureSpy).toHaveBeenCalledWith('pulse brief poll gave up', { brief_id: 'brief-1' })
+
+ // With nothing left generating, the next tick ends the interval.
+ await expectLogic(logic, () => {
+ logic.actions.pollGeneratingBriefs()
+ }).toDispatchActions(['stopPolling'])
+ })
+
+ it('fails only the unreachable brief while a sibling keeps updating', async () => {
+ const briefOk: ProductBriefListApi = { ...generatingBrief, id: 'brief-ok' } as unknown as ProductBriefListApi
+ const briefBad: ProductBriefListApi = { ...generatingBrief, id: 'brief-bad' } as unknown as ProductBriefListApi
+ useMocks({
+ get: {
+ '/api/projects/:team_id/pulse/briefs/:id/': (info) =>
+ info.request.url.includes('brief-bad') ? [500, {}] : [200, { ...briefOk, status: 'ready' }],
+ },
+ })
+ await expectLogic(logic).toFinishAllListeners() // let the mount-time loads settle before seeding
+ logic.actions.loadBriefsSuccess([briefOk, briefBad])
+ logic.actions.startPolling()
+
+ // A shared failure counter would reset every time the sibling succeeds, so the bad brief
+ // would never trip the ceiling — the per-brief counter must still fail it.
+ for (let round = 1; round <= MAX_CONSECUTIVE_POLL_FAILURES; round++) {
+ await expectLogic(logic, () => {
+ logic.actions.pollGeneratingBriefs()
+ }).toFinishAllListeners()
+ }
+
+ const byId = Object.fromEntries(logic.values.briefs.map((brief) => [brief.id, brief]))
+ expect(byId['brief-ok'].status).toEqual('ready')
+ expect(byId['brief-bad'].status).toEqual('failed')
+ })
+
+ it('surfaces the consent banner on an AI data processing 400 without starting polling', async () => {
+ useMocks({
+ post: {
+ '/api/projects/:team_id/pulse/briefs/generate/': () => [
+ 400,
+ {
+ type: 'validation_error',
+ code: 'ai_consent_required',
+ detail: 'AI data processing must be approved for this organization to generate briefs.',
+ attr: null,
+ },
+ ],
+ },
+ })
+
+ await expectLogic(logic, () => {
+ logic.actions.generateBrief({ configId: null })
+ })
+ .toFinishAllListeners()
+ .toMatchValues({
+ aiConsentRequired: true,
+ showAiConsentBanner: true,
+ generatedBrief: null,
+ briefs: [],
+ })
+ await expectLogic(logic).toNotHaveDispatchedActions(['startPolling'])
+ })
+
+ it('toasts on a 409 generation conflict without touching the brief list', async () => {
+ silenceKeaLoadersErrors()
+ const infoSpy = jest.spyOn(lemonToast, 'info')
+ useMocks({
+ post: {
+ '/api/projects/:team_id/pulse/briefs/generate/': () => [
+ 409,
+ { detail: 'Brief generation already in progress' },
+ ],
+ },
+ })
+
+ await expectLogic(logic, () => {
+ logic.actions.generateBrief({ configId: null })
+ })
+ .toDispatchActions(['generateBriefFailure'])
+ .toMatchValues({
+ aiConsentRequired: false,
+ briefs: [],
+ })
+ expect(infoSpy).toHaveBeenCalledWith(BRIEF_ALREADY_GENERATING_MESSAGE)
+ await expectLogic(logic).toNotHaveDispatchedActions(['startPolling'])
+ resumeKeaLoadersErrors()
+ })
+
+ it.each<[string, BriefConfigApi | null, 'post' | 'patch', Record<string, unknown>]>([
+ ['create', null, 'post', { dashboards: [2] }],
+ // Insight anchors set through the API must survive a save from this dashboards-only form.
+ ['edit', existingConfig, 'patch', { dashboards: [2], insights: ['abc123'] }],
+ ])(
+ 'saving a config in %s mode hits the %s endpoint with the form payload',
+ async (_mode, editing, endpoint, expectedAnchors) => {
+ const captured: Record<'post' | 'patch', Record<string, any> | null> = { post: null, patch: null }
+ useMocks({
+ post: {
+ '/api/projects/:team_id/pulse/brief_configs/': async (info) => {
+ captured.post = (await info.request.json()) as Record<string, any>
+ return [201, { ...existingConfig, ...captured.post, id: 'cfg-new' }]
+ },
+ },
+ patch: {
+ '/api/projects/:team_id/pulse/brief_configs/:id/': async (info) => {
+ captured.patch = (await info.request.json()) as Record<string, any>
+ return [200, { ...existingConfig, ...captured.patch }]
+ },
+ },
+ })
+
+ logic.actions.openConfigModal(editing)
+ logic.actions.setConfigFormValues({ name: 'Updated name', dashboards: [2] })
+ await expectLogic(logic, () => {
+ logic.actions.submitConfigForm()
+ }).toDispatchActions(['configSaved'])
+
+ expect(captured[endpoint === 'post' ? 'patch' : 'post']).toBeNull()
+ expect(captured[endpoint]!.name).toEqual('Updated name')
+ expect(captured[endpoint]!.anchors).toEqual(expectedAnchors)
+ // A newly created config is auto-selected; editing an existing one leaves selection untouched.
+ expect(logic.values.selectedConfigId).toEqual(endpoint === 'post' ? 'cfg-new' : null)
+ }
+ )
+
+ it('keeps the config and clears the deleting state when delete fails', async () => {
+ const errorSpy = jest.spyOn(lemonToast, 'error')
+ useMocks({
+ delete: { '/api/projects/:team_id/pulse/brief_configs/:id/': () => [500, {}] },
+ })
+ await expectLogic(logic).toFinishAllListeners() // let the mount-time loads settle before seeding
+ logic.actions.loadBriefConfigsSuccess([existingConfig])
+
+ await expectLogic(logic, () => {
+ logic.actions.deleteConfig('cfg-1')
+ })
+ .toFinishAllListeners()
+ .toMatchValues({ configIdBeingDeleted: null })
+ expect(logic.values.briefConfigs).toHaveLength(1)
+ expect(errorSpy).toHaveBeenCalled()
+ })
+
+ it('resets selection when the active config is deleted', async () => {
+ useMocks({
+ delete: { '/api/projects/:team_id/pulse/brief_configs/:id/': () => [204] },
+ })
+ await expectLogic(logic).toFinishAllListeners() // let the mount-time loads settle before seeding
+ logic.actions.loadBriefConfigsSuccess([existingConfig])
+ logic.actions.selectConfig('cfg-1')
+
+ await expectLogic(logic, () => {
+ logic.actions.deleteConfig('cfg-1')
+ })
+ .toDispatchActions(['configDeleted'])
+ .toMatchValues({ selectedConfigId: null, briefConfigs: [] })
+ })
+})
diff --git a/products/pulse/frontend/pulseLogic.ts b/products/pulse/frontend/pulseLogic.ts
new file mode 100644
index 000000000000..0e4a9fbfcc7e
--- /dev/null
+++ b/products/pulse/frontend/pulseLogic.ts
@@ -0,0 +1,636 @@
+import { MakeLogicType, actions, afterMount, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { forms } from 'kea-forms'
+import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
+import { loaders } from 'kea-loaders'
+import posthog from 'posthog-js'
+
+import { ApiError } from 'lib/api-error'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { lemonToast } from 'lib/lemon-ui/LemonToast'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { getCurrentTeamId } from 'lib/utils/getAppContext'
+import { organizationLogic } from 'scenes/organizationLogic'
+
+import type { FeatureFlagsSet } from '../../../frontend/src/lib/logic/featureFlagLogic'
+import type { OrganizationType } from '../../../frontend/src/types'
+import {
+ pulseBriefsGenerateCreate,
+ pulseBriefsList,
+ pulseBriefsRetrieve,
+ pulseBriefConfigsCreate,
+ pulseBriefConfigsDestroy,
+ pulseBriefConfigsList,
+ pulseBriefConfigsPartialUpdate,
+} from './generated/api'
+import type { BriefConfigApi, BriefSectionApi, ProductBriefApi, ProductBriefListApi } from './generated/api.schemas'
+import { ProductBriefStatusEnumApi } from './generated/api.schemas'
+
+export const BRIEF_POLL_INTERVAL_MS = 3000
+
+/** Mark a single brief as failed after this many consecutive rounds where its retrieve failed. */
+export const MAX_CONSECUTIVE_POLL_FAILURES = 5
+
+/** First page only — deliberate for alpha; load-more is a follow-up (surfaced in the UI, not hidden here). */
+const LIST_PAGE_SIZE = 100
+
+export const BRIEF_ALREADY_GENERATING_MESSAGE = 'A brief is already being generated'
+
+/** Shown against a brief we stopped being able to reach while it was generating. */
+export const BRIEF_UNREACHABLE_MESSAGE = 'We lost contact while generating this brief. Reload the page to check on it.'
+
+// `code` is a cross-boundary contract with the generate endpoint in products/pulse/backend/api/brief.py.
+const AI_CONSENT_ERROR_CODE = 'ai_consent_required'
+
+function currentProjectId(): string {
+ return String(getCurrentTeamId())
+}
+
+function isAiConsentError(error: unknown): boolean {
+ return error instanceof ApiError && error.code === AI_CONSENT_ERROR_CODE
+}
+
+function isGeneratingBrief(brief: ProductBriefListApi): boolean {
+ return brief.status === ProductBriefStatusEnumApi.Generating
+}
+
+export interface BriefConfigForm {
+ name: string
+ focus_prompt: string
+ dashboards: number[]
+}
+
+const EMPTY_CONFIG_FORM: BriefConfigForm = { name: '', focus_prompt: '', dashboards: [] }
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pulseLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
+ currentOrganization: OrganizationType | null // organizationLogic
+ aiConsentRequired: boolean
+ briefConfigs: BriefConfigApi[]
+ briefConfigsLoading: boolean
+ briefDetail: ProductBriefApi | null
+ briefDetailLoadFailed: boolean
+ briefDetailLoading: boolean
+ briefDetailSections: readonly BriefSectionApi[]
+ briefs: ProductBriefListApi[]
+ briefsHasMore: boolean
+ briefsLoadFailed: boolean
+ briefsLoading: boolean
+ configForm: BriefConfigForm
+ configFormAllErrors: Record<string, any>
+ configFormChanged: boolean
+ configFormErrors: DeepPartialMap<BriefConfigForm, ValidationErrorType>
+ configFormHasErrors: boolean
+ configFormManualErrors: Record<string, any>
+ configFormTouched: boolean
+ configFormTouches: Record<string, boolean>
+ configFormValidationErrors: DeepPartialMap<BriefConfigForm, ValidationErrorType>
+ configIdBeingDeleted: string | null
+ configModalOpen: boolean
+ dataProcessingAccepted: boolean
+ editingConfig: BriefConfigApi | null
+ generatedBrief: ProductBriefApi | null
+ generatedBriefLoading: boolean
+ isConfigFormSubmitting: boolean
+ isConfigFormValid: boolean
+ isGeneratingForSelectedConfig: boolean
+ selectedBriefId: string | null
+ selectedConfigId: string | null
+ showAiConsentBanner: boolean
+ showConfigFormErrors: boolean
+ visibleBriefs: ProductBriefListApi[]
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pulseLogicActions {
+ briefsRefreshed: (briefs: ProductBriefApi[]) => {
+ briefs: ProductBriefApi[]
+ }
+ closeConfigModal: () => {
+ value: true
+ }
+ configDeleteFailed: () => {
+ value: true
+ }
+ configDeleted: (configId: string) => {
+ configId: string
+ }
+ configSaved: (
+ config: BriefConfigApi,
+ created: boolean
+ ) => {
+ config: BriefConfigApi
+ created: boolean
+ }
+ deleteConfig: (configId: string) => {
+ configId: string
+ }
+ generateBrief: ({ configId }: { configId: string | null }) => {
+ configId: string | null
+ }
+ generateBriefFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ generateBriefSuccess: (
+ generatedBrief: ProductBriefApi | null,
+ payload?: {
+ configId: string | null
+ }
+ ) => {
+ generatedBrief: ProductBriefApi | null
+ payload?: {
+ configId: string | null
+ }
+ }
+ loadBriefConfigs: () => any
+ loadBriefConfigsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBriefConfigsSuccess: (
+ briefConfigs: BriefConfigApi[],
+ payload?: any
+ ) => {
+ briefConfigs: BriefConfigApi[]
+ payload?: any
+ }
+ loadBriefDetail: ({ briefId }: { briefId: string }) => {
+ briefId: string
+ }
+ loadBriefDetailFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBriefDetailSuccess: (
+ briefDetail: ProductBriefApi,
+ payload?: {
+ briefId: string
+ }
+ ) => {
+ briefDetail: ProductBriefApi
+ payload?: {
+ briefId: string
+ }
+ }
+ loadBriefs: () => any
+ loadBriefsFailure: (
+ error: string,
+ errorObject?: any
+ ) => {
+ error: string
+ errorObject?: any
+ }
+ loadBriefsSuccess: (
+ briefs: ProductBriefListApi[],
+ payload?: any
+ ) => {
+ briefs: ProductBriefListApi[]
+ payload?: any
+ }
+ markBriefFailed: (briefId: string) => {
+ briefId: string
+ }
+ openConfigModal: (config: BriefConfigApi | null) => {
+ config: BriefConfigApi | null
+ }
+ pollGeneratingBriefs: () => {
+ value: true
+ }
+ resetConfigForm: (values?: BriefConfigForm) => {
+ values?: BriefConfigForm
+ }
+ selectBrief: (briefId: string | null) => {
+ briefId: string | null
+ }
+ selectConfig: (configId: string | null) => {
+ configId: string | null
+ }
+ setAiConsentRequired: (aiConsentRequired: boolean) => {
+ aiConsentRequired: boolean
+ }
+ setBriefsHasMore: (hasMore: boolean) => {
+ hasMore: boolean
+ }
+ setConfigFormManualErrors: (errors: Record<string, any>) => {
+ errors: Record<string, any>
+ }
+ setConfigFormValue: (
+ key: FieldName,
+ value: any
+ ) => {
+ name: FieldName
+ value: any
+ }
+ setConfigFormValues: (values: DeepPartial<BriefConfigForm>) => {
+ values: DeepPartial<BriefConfigForm>
+ }
+ startPolling: () => {
+ value: true
+ }
+ stopPolling: () => {
+ value: true
+ }
+ submitConfigForm: () => {
+ value: boolean
+ }
+ submitConfigFormFailure: (
+ error: Error,
+ errors: Record<string, any>
+ ) => {
+ error: Error
+ errors: Record<string, any>
+ }
+ submitConfigFormRequest: (configForm: BriefConfigForm) => {
+ configForm: BriefConfigForm
+ }
+ submitConfigFormSuccess: (configForm: BriefConfigForm) => {
+ configForm: BriefConfigForm
+ }
+ touchConfigFormField: (key: string) => {
+ key: string
+ }
+}
+
+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
+export interface pulseLogicMeta {
+ __keaTypeGenInternalSelectorTypes: {
+ visibleBriefs: (briefs: ProductBriefListApi[], selectedConfigId: string | null) => ProductBriefListApi[]
+ isGeneratingForSelectedConfig: (visibleBriefs: ProductBriefListApi[], generatedBriefLoading: boolean) => boolean
+ dataProcessingAccepted: (currentOrganization: OrganizationType | null) => boolean
+ showAiConsentBanner: (dataProcessingAccepted: boolean, aiConsentRequired: boolean) => boolean
+ briefDetailSections: (briefDetail: ProductBriefApi | null) => readonly BriefSectionApi[]
+ }
+}
+
+export type pulseLogicType = MakeLogicType<pulseLogicValues, pulseLogicActions, Record<string, any>, pulseLogicMeta>
+
+export const pulseLogic = kea<pulseLogicType>([
+ path(['products', 'pulse', 'frontend', 'pulseLogic']),
+ connect(() => ({
+ values: [featureFlagLogic, ['featureFlags'], organizationLogic, ['currentOrganization']],
+ })),
+ actions({
+ selectConfig: (configId: string | null) => ({ configId }),
+ selectBrief: (briefId: string | null) => ({ briefId }),
+ setAiConsentRequired: (aiConsentRequired: boolean) => ({ aiConsentRequired }),
+ setBriefsHasMore: (hasMore: boolean) => ({ hasMore }),
+ startPolling: true,
+ stopPolling: true,
+ pollGeneratingBriefs: true,
+ briefsRefreshed: (briefs: ProductBriefApi[]) => ({ briefs }),
+ markBriefFailed: (briefId: string) => ({ briefId }),
+ openConfigModal: (config: BriefConfigApi | null) => ({ config }),
+ closeConfigModal: true,
+ configSaved: (config: BriefConfigApi, created: boolean) => ({ config, created }),
+ deleteConfig: (configId: string) => ({ configId }),
+ configDeleted: (configId: string) => ({ configId }),
+ configDeleteFailed: true,
+ }),
+ forms(({ actions, values }) => ({
+ configForm: {
+ defaults: EMPTY_CONFIG_FORM,
+ errors: ({ name }: BriefConfigForm) => ({
+ name: name.trim() ? undefined : 'Please enter a name',
+ }),
+ submit: async (formValues: BriefConfigForm) => {
+ const editing = values.editingConfig
+ // Only the dashboards anchor is editable here — spread the existing anchors so
+ // insight anchors set through the API survive a save from this form.
+ const anchors = { ...editing?.anchors, dashboards: formValues.dashboards }
+ const payload = { name: formValues.name.trim(), focus_prompt: formValues.focus_prompt, anchors }
+ const saved = editing
+ ? await pulseBriefConfigsPartialUpdate(currentProjectId(), editing.id, payload)
+ : await pulseBriefConfigsCreate(currentProjectId(), payload)
+ actions.configSaved(saved, !editing)
+ },
+ },
+ })),
+ loaders(({ actions }) => ({
+ briefConfigs: [
+ [] as BriefConfigApi[],
+ {
+ loadBriefConfigs: async (): Promise<BriefConfigApi[]> => {
+ const response = await pulseBriefConfigsList(currentProjectId(), { limit: LIST_PAGE_SIZE })
+ return response.results
+ },
+ },
+ ],
+ briefs: [
+ [] as ProductBriefListApi[],
+ {
+ loadBriefs: async (): Promise<ProductBriefListApi[]> => {
+ const response = await pulseBriefsList(currentProjectId(), { limit: LIST_PAGE_SIZE })
+ actions.setBriefsHasMore(response.next != null)
+ return response.results
+ },
+ },
+ ],
+ generatedBrief: [
+ null as ProductBriefApi | null,
+ {
+ generateBrief: async ({ configId }: { configId: string | null }): Promise<ProductBriefApi | null> => {
+ try {
+ return await pulseBriefsGenerateCreate(currentProjectId(), { config_id: configId })
+ } catch (error) {
+ if (isAiConsentError(error)) {
+ // Handled with an in-scene banner — swallow so the global error toast stays quiet.
+ actions.setAiConsentRequired(true)
+ return null
+ }
+ throw error
+ }
+ },
+ },
+ ],
+ briefDetail: [
+ null as ProductBriefApi | null,
+ {
+ loadBriefDetail: async ({ briefId }: { briefId: string }): Promise<ProductBriefApi> => {
+ return await pulseBriefsRetrieve(currentProjectId(), briefId)
+ },
+ },
+ ],
+ })),
+ reducers({
+ selectedConfigId: [
+ null as string | null,
+ {
+ selectConfig: (_, { configId }) => configId,
+ },
+ ],
+ selectedBriefId: [
+ null as string | null,
+ {
+ selectBrief: (_, { briefId }) => briefId,
+ },
+ ],
+ aiConsentRequired: [
+ false,
+ {
+ setAiConsentRequired: (_, { aiConsentRequired }) => aiConsentRequired,
+ generateBrief: () => false,
+ },
+ ],
+ briefsHasMore: [
+ false,
+ {
+ setBriefsHasMore: (_, { hasMore }) => hasMore,
+ },
+ ],
+ briefsLoadFailed: [
+ false,
+ {
+ loadBriefs: () => false,
+ loadBriefsSuccess: () => false,
+ loadBriefsFailure: () => true,
+ },
+ ],
+ briefDetailLoadFailed: [
+ false,
+ {
+ loadBriefDetail: () => false,
+ loadBriefDetailSuccess: () => false,
+ loadBriefDetailFailure: () => true,
+ },
+ ],
+ configModalOpen: [
+ false,
+ {
+ openConfigModal: () => true,
+ closeConfigModal: () => false,
+ configSaved: () => false,
+ },
+ ],
+ editingConfig: [
+ null as BriefConfigApi | null,
+ {
+ openConfigModal: (_, { config }) => config,
+ },
+ ],
+ configIdBeingDeleted: [
+ null as string | null,
+ {
+ deleteConfig: (_, { configId }) => configId,
+ configDeleted: () => null,
+ configDeleteFailed: () => null,
+ },
+ ],
+ briefConfigs: {
+ configSaved: (state, { config, created }) =>
+ created ? [config, ...state] : state.map((existing) => (existing.id === config.id ? config : existing)),
+ configDeleted: (state, { configId }) => state.filter((config) => config.id !== configId),
+ },
+ briefs: {
+ generateBriefSuccess: (state, { generatedBrief }) => (generatedBrief ? [generatedBrief, ...state] : state),
+ briefsRefreshed: (state, { briefs }) => {
+ // Only swap in briefs whose status actually changed, so identities stay
+ // stable across no-op poll ticks and derived selectors don't churn.
+ const byId = new Map(briefs.map((brief) => [brief.id, brief]))
+ let changed = false
+ const next = state.map((brief) => {
+ const updated = byId.get(brief.id)
+ if (updated && updated.status !== brief.status) {
+ changed = true
+ return updated
+ }
+ return brief
+ })
+ return changed ? next : state
+ },
+ markBriefFailed: (state, { briefId }) =>
+ state.map((brief) =>
+ brief.id === briefId && isGeneratingBrief(brief)
+ ? { ...brief, status: ProductBriefStatusEnumApi.Failed, error: BRIEF_UNREACHABLE_MESSAGE }
+ : brief
+ ),
+ },
+ briefDetail: {
+ generateBriefSuccess: (state, { generatedBrief }) => generatedBrief ?? state,
+ briefsRefreshed: (state, { briefs }) => {
+ const updated = briefs.find((brief) => brief.id === state?.id)
+ return updated && updated.status !== state?.status ? updated : state
+ },
+ markBriefFailed: (state, { briefId }) =>
+ state?.id === briefId && state.status === ProductBriefStatusEnumApi.Generating
+ ? { ...state, status: ProductBriefStatusEnumApi.Failed, error: BRIEF_UNREACHABLE_MESSAGE }
+ : state,
+ },
+ }),
+ selectors({
+ visibleBriefs: [
+ (s) => [s.briefs, s.selectedConfigId],
+ (briefs: ProductBriefListApi[], selectedConfigId: string | null): ProductBriefListApi[] =>
+ briefs.filter((brief) => brief.config === selectedConfigId),
+ ],
+ // Scoped to the selected focus: the backend locks generation per team+config, so a brief
+ // generating for another config must not disable "Run brief now" for this one.
+ isGeneratingForSelectedConfig: [
+ (s) => [s.visibleBriefs, s.generatedBriefLoading],
+ (visibleBriefs: ProductBriefListApi[], generatedBriefLoading: boolean): boolean =>
+ generatedBriefLoading || visibleBriefs.some(isGeneratingBrief),
+ ],
+ // Reuse the org-wide AI data-processing gate other AI features check, so the button is
+ // blocked up front instead of only reacting to the backend's ai_consent_required error.
+ dataProcessingAccepted: [
+ (s) => [s.currentOrganization],
+ (currentOrganization: OrganizationType | null): boolean =>
+ !!currentOrganization?.is_ai_data_processing_approved,
+ ],
+ showAiConsentBanner: [
+ (s) => [s.dataProcessingAccepted, s.aiConsentRequired],
+ (dataProcessingAccepted: boolean, aiConsentRequired: boolean): boolean =>
+ !dataProcessingAccepted || aiConsentRequired,
+ ],
+ briefDetailSections: [
+ (s) => [s.briefDetail],
+ (briefDetail: ProductBriefApi | null): readonly BriefSectionApi[] => briefDetail?.sections ?? [],
+ ],
+ }),
+ listeners(({ actions, values, cache }) => ({
+ loadBriefsSuccess: ({ briefs }) => {
+ // Auto-select only when nothing is selected yet — on mount, and after a config switch
+ // clears the selection. A brief chosen by the user is deliberately left in place.
+ if (values.selectedBriefId === null && values.visibleBriefs.length > 0) {
+ actions.selectBrief(values.visibleBriefs[0].id)
+ }
+ if (briefs.some(isGeneratingBrief)) {
+ actions.startPolling()
+ }
+ },
+ selectConfig: () => {
+ actions.selectBrief(values.visibleBriefs.length > 0 ? values.visibleBriefs[0].id : null)
+ },
+ selectBrief: ({ briefId }) => {
+ if (briefId === null) {
+ return
+ }
+ if (values.briefDetail?.id !== briefId) {
+ actions.loadBriefDetail({ briefId })
+ }
+ },
+ generateBriefSuccess: ({ generatedBrief }) => {
+ if (!generatedBrief) {
+ return
+ }
+ actions.selectBrief(generatedBrief.id)
+ actions.startPolling()
+ },
+ generateBriefFailure: ({ errorObject }) => {
+ if (errorObject instanceof ApiError && errorObject.status === 409) {
+ lemonToast.info(BRIEF_ALREADY_GENERATING_MESSAGE)
+ }
+ },
+ startPolling: () => {
+ // Preserve counts across restarts: a second generation (different config) re-fires
+ // startPolling while another brief is still polling — a fresh Map would wipe its
+ // accumulated failures and restart the give-up ceiling from zero.
+ cache.pollFailuresByBrief ??= new Map<string, number>()
+ cache.disposables.add(() => {
+ const intervalId = setInterval(() => actions.pollGeneratingBriefs(), BRIEF_POLL_INTERVAL_MS)
+ return () => clearInterval(intervalId)
+ }, 'briefPoll')
+ },
+ stopPolling: () => {
+ cache.disposables.dispose('briefPoll')
+ },
+ pollGeneratingBriefs: async () => {
+ // The single stop decision: a tick with nothing left to poll ends the interval.
+ const generating = values.briefs.filter(isGeneratingBrief)
+ if (generating.length === 0) {
+ actions.stopPolling()
+ return
+ }
+ if (cache.pollInFlight) {
+ return // A slow previous tick is still fetching — skip instead of stacking requests.
+ }
+ cache.pollInFlight = true
+ try {
+ const results = await Promise.allSettled(
+ generating.map((brief) => pulseBriefsRetrieve(currentProjectId(), brief.id))
+ )
+ // Per-brief failure counting: one brief we can't reach must fail on its own, even while
+ // its siblings keep succeeding — a shared counter would reset and never trip.
+ const failures: Map<string, number> = cache.pollFailuresByBrief
+ const refreshed: ProductBriefApi[] = []
+ results.forEach((result, index) => {
+ const briefId = generating[index].id
+ if (result.status === 'fulfilled') {
+ failures.delete(briefId)
+ refreshed.push(result.value)
+ return
+ }
+ const rounds = (failures.get(briefId) ?? 0) + 1
+ failures.set(briefId, rounds)
+ if (rounds >= MAX_CONSECUTIVE_POLL_FAILURES) {
+ failures.delete(briefId)
+ posthog.capture('pulse brief poll gave up', { brief_id: briefId })
+ actions.markBriefFailed(briefId)
+ }
+ })
+ if (refreshed.length > 0) {
+ actions.briefsRefreshed(refreshed)
+ }
+ } finally {
+ cache.pollInFlight = false
+ }
+ },
+ openConfigModal: ({ config }) => {
+ actions.resetConfigForm({
+ name: config?.name ?? '',
+ focus_prompt: config?.focus_prompt ?? '',
+ dashboards: config?.anchors?.dashboards ?? [],
+ })
+ },
+ configSaved: ({ config, created }) => {
+ posthog.capture(created ? 'pulse config created' : 'pulse config updated', {
+ config_id: config.id,
+ name: config.name,
+ })
+ lemonToast.success(created ? 'Brief config created' : 'Brief config updated')
+ if (created) {
+ actions.selectConfig(config.id)
+ }
+ },
+ submitConfigFormFailure: ({ error }) => {
+ // Field-level validation failures already render inline — only toast API errors.
+ if (error instanceof ApiError) {
+ posthog.captureException(error)
+ lemonToast.error(error.detail || 'Saving the brief config failed')
+ }
+ },
+ deleteConfig: async ({ configId }) => {
+ try {
+ await pulseBriefConfigsDestroy(currentProjectId(), configId)
+ } catch (error) {
+ posthog.captureException(error)
+ actions.configDeleteFailed()
+ lemonToast.error('Deleting the brief config failed')
+ return
+ }
+ if (values.selectedConfigId === configId) {
+ actions.selectConfig(null)
+ }
+ actions.configDeleted(configId)
+ posthog.capture('pulse config deleted', { config_id: configId })
+ lemonToast.success('Brief config deleted')
+ },
+ })),
+ afterMount(({ actions, values }) => {
+ // The scene renders NotFound without the flag — don't fire the pulse API calls either.
+ if (!values.featureFlags[FEATURE_FLAGS.PULSE]) {
+ return
+ }
+ actions.loadBriefConfigs()
+ actions.loadBriefs()
+ }),
+])
diff --git a/products/pulse/manifest.tsx b/products/pulse/manifest.tsx
new file mode 100644
index 000000000000..21edd820393c
--- /dev/null
+++ b/products/pulse/manifest.tsx
@@ -0,0 +1,44 @@
+import { FEATURE_FLAGS } from 'lib/constants'
+import { urls } from 'scenes/urls'
+
+import { ProductItemCategory, ProductKey } from '~/queries/schema/schema-general'
+import { FileSystemIconColor, ProductManifest } from '~/types'
+
+export const manifest: ProductManifest = {
+ name: 'Pulse',
+ scenes: {
+ Pulse: {
+ name: 'Pulse',
+ import: () => import('./frontend/PulseScene'),
+ projectBased: true,
+ description:
+ 'Your always-on product manager: spots growth opportunities and shows how to move the numbers that matter.',
+ iconType: 'activity',
+ },
+ },
+ routes: {
+ '/pulse': ['Pulse', 'pulse'],
+ },
+ redirects: {},
+ urls: {
+ pulse: (): string => '/pulse',
+ },
+ fileSystemTypes: {},
+ treeItemsNew: [],
+ treeItemsProducts: [
+ {
+ path: 'Pulse',
+ intents: [ProductKey.PULSE],
+ category: ProductItemCategory.UNRELEASED,
+ iconType: 'activity',
+ iconColor: [
+ 'var(--color-product-activity-light)',
+ 'var(--color-product-activity-dark)',
+ ] as FileSystemIconColor,
+ href: urls.pulse(),
+ flag: FEATURE_FLAGS.PULSE,
+ tags: ['alpha'],
+ sceneKey: 'Pulse',
+ },
+ ],
+}
diff --git a/products/pulse/package.json b/products/pulse/package.json
index 1f8624a2d8bb..d6c537663378 100644
--- a/products/pulse/package.json
+++ b/products/pulse/package.json
@@ -2,5 +2,19 @@
"name": "@posthog/products-pulse",
"scripts": {
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"
+ },
+ "dependencies": {
+ "kea": "catalog:",
+ "kea-forms": "catalog:",
+ "kea-loaders": "catalog:",
+ "posthog-js": "catalog:"
+ },
+ "devDependencies": {
+ "kea-test-utils": "catalog:"
+ },
+ "peerDependencies": {
+ "@posthog/icons": "catalog:",
+ "@types/react": "*",
+ "react": "*"
}
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 850e3580cd1f..3f5d27ad6044 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -12561,16 +12561,27 @@ export namespace Schemas {
readonly updated_at: string | null;
}
+ export interface BriefSectionCitation {
+ /** Cited resource type, e.g. insight or dashboard. */
+ type: string;
+ /** Stable id of the cited resource within its type. */
+ ref: string;
+ /** Human-readable name of the cited resource, for display. */
+ label: string;
+ /** Deep link into the app, or empty when the resource has no navigable target. */
+ url: string;
+ }
+
export interface BriefSection {
- /** Section kind, e.g. 'what_happened' or 'what_to_build_next'. */
+ /** Section kind, e.g. what_happened or what_to_build_next. */
kind: string;
- /** Short, specific section heading. */
+ /** Short section heading. */
title: string;
- /** Section body in markdown. */
+ /** Section body rendered as markdown. */
markdown: string;
- /** Citation ids (e.g. 'c1') backing the section, copied verbatim. */
- citations: string[];
- /** Confidence in this section, 0.0-1.0. */
+ /** PostHog resources this section cites as evidence. */
+ citations: BriefSectionCitation[];
+ /** Model confidence in this section, 0.0-1.0. */
confidence: number;
}