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.

5.0 KB
Raw Blame
// THIS FILE IS AUTOGENERATED by posthog/object_tags/projection.py. DO NOT EDIT.
// Source of truth: posthog/object_tags/kinds.py — after editing it,
// run `hogli build:projections` and commit the result.

export interface ObjectKindData {
  /** Human name of the kind, e.g. "Insight". */
  kindLabel: string;
  /** Product the object comes from, e.g. "Product analytics". */
  source: string;
  /**
   * Project-relative page template where "{id}" is the URL-encoded object id,
   * or null when the kind has no canonical page.
   */
  pathTemplate: string | null;
  /**
   * When set, the raw id must match for the kind to have a page at all
   * (e.g. flag pages resolve by numeric id only).
   */
  idPattern: string | null;
  /** display="block" renders as a full card on surfaces that support it. */
  block: boolean;
  /** The tag body is the object id itself rather than a label (hogql: the SQL). */
  idIsBody: boolean;
  urlAliases: readonly string[];
}

export const OBJECT_KIND_DATA = {
  insight: {
    kindLabel: "Insight",
    source: "Product analytics",
    pathTemplate: "/insights/{id}",
    idPattern: null,
    block: true,
    idIsBody: false,
    urlAliases: ["/i/{id}"],
  },
  hogql: {
    kindLabel: "SQL query",
    source: "SQL editor",
    pathTemplate: "/sql?open_query={id}",
    idPattern: null,
    block: true,
    idIsBody: true,
    urlAliases: ["/insights/new#q={query}"],
  },
  dashboard: {
    kindLabel: "Dashboard",
    source: "Product analytics",
    pathTemplate: "/dashboard/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  error: {
    kindLabel: "Error issue",
    source: "Error tracking",
    pathTemplate: "/error_tracking/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: ["/error-tracking/{id}"],
  },
  replay: {
    kindLabel: "Session replay",
    source: "Session replay",
    pathTemplate: "/replay/{id}",
    idPattern: null,
    block: true,
    idIsBody: false,
    urlAliases: ["/replay/home?sessionRecordingId={id}"],
  },
  flag: {
    kindLabel: "Feature flag",
    source: "Feature flags",
    pathTemplate: "/feature-flags/{id}",
    idPattern: "^\\d+$",
    block: false,
    idIsBody: false,
    urlAliases: ["/feature_flags/{id}"],
  },
  experiment: {
    kindLabel: "Experiment",
    source: "Experiments",
    pathTemplate: "/experiments/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  survey: {
    kindLabel: "Survey",
    source: "Surveys",
    pathTemplate: "/surveys/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  ticket: {
    kindLabel: "Support tickets",
    source: "Conversations",
    pathTemplate: "/support/tickets/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  report: {
    kindLabel: "Inbox report",
    source: "Inbox",
    pathTemplate: "/inbox/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  trace: {
    kindLabel: "LLM trace",
    source: "AI observability",
    pathTemplate: "/ai-observability/traces/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  eval: {
    kindLabel: "Evaluation",
    source: "AI evals",
    pathTemplate: "/ai-evals/evaluations/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  event: {
    kindLabel: "Events",
    source: "Product analytics",
    pathTemplate: "/data-management/events/{id}",
    idPattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F-]{27,}$",
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  cohort: {
    kindLabel: "Cohort",
    source: "Product analytics",
    pathTemplate: "/cohorts/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  action: {
    kindLabel: "Action",
    source: "Product analytics",
    pathTemplate: "/data-management/actions/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
  person: {
    kindLabel: "Person",
    source: "Product analytics",
    pathTemplate: "/persons/{id}",
    idPattern: null,
    block: false,
    idIsBody: false,
    urlAliases: [],
  },
} satisfies Record<string, ObjectKindData>;

export type ObjectKindName = keyof typeof OBJECT_KIND_DATA;

/** Alternate tag names agents plausibly write, mapped to registry kinds. */
export const OBJECT_KIND_ALIASES: Record<string, string> = {
  "session-replay": "replay",
  "session_replay": "replay",
  "recording": "replay",
  "feature-flag": "flag",
  "feature_flag": "flag",
  "sql": "hogql",
};

/** Rendering fallback for a tag whose kind nobody registered. */
export const FALLBACK_OBJECT_KIND_DATA: ObjectKindData = {
  kindLabel: "Evidence",
  source: "PostHog",
  pathTemplate: null,
  idPattern: null,
  block: false,
  idIsBody: false,
  urlAliases: [],
};

export const RESERVED_URL_IDS: readonly string[] = ["new", "home", "playlists", "settings", "configuration", "options"];

export const APP_HOST_ALIASES: Record<string, string> = {"app.posthog.com": "us.posthog.com"};