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.

1.5 KB
Raw Blame
// Agent Artifact Types - these will be auto-generated to Python via pnpm schema:build
import { AnyAssistantGeneratedQuery } from './schema-assistant-messages'
import {
    FunnelsQuery,
    HogQLQuery,
    LifecycleQuery,
    PathsQuery,
    RetentionQuery,
    StickinessQuery,
    TrendsQuery,
} from './schema-general'

export interface MarkdownBlock {
    type: 'markdown'
    content: string
}

export interface VisualizationBlock {
    type: 'visualization'
    /** The query to render (same as VisualizationArtifactContent.query) */
    query:
        | AnyAssistantGeneratedQuery
        | TrendsQuery
        | FunnelsQuery
        | RetentionQuery
        | StickinessQuery
        | PathsQuery
        | LifecycleQuery
        | HogQLQuery
    /** Optional title for the visualization */
    title?: string | null
}

export interface SessionReplayBlock {
    type: 'session_replay'
    session_id: string
    timestamp_ms: number
    title?: string | null
}

export interface LoadingBlock {
    type: 'loading'
    /** The artifact ID that is being loaded */
    artifact_id: string
}

export interface ErrorBlock {
    type: 'error'
    /** Error message to display */
    message: string
    /** Optional artifact ID if the error is related to a specific artifact */
    artifact_id?: string | null
}

export type DocumentBlock = MarkdownBlock | VisualizationBlock | SessionReplayBlock | LoadingBlock | ErrorBlock

export interface DocumentArtifactContent {
    blocks: DocumentBlock[]
}