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.

13.4 KB
Raw Blame
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
        "id": {
            "description": "ID of the canvas the project is for.",
            "type": "string"
        },
        "project": {
            "description": "The candidate source project to validate.",
            "properties": {
                "assets": {
                    "additionalProperties": {
                        "properties": {
                            "content": {
                                "maxLength": 2796204,
                                "pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
                                "type": "string"
                            },
                            "contentType": {
                                "description": "* `image/png` - image/png\n* `image/jpeg` - image/jpeg\n* `image/gif` - image/gif\n* `image/webp` - image/webp\n* `image/svg+xml` - image/svg+xml\n* `font/woff` - font/woff\n* `font/woff2` - font/woff2\n* `application/wasm` - application/wasm\n* `application/octet-stream` - application/octet-stream",
                                "enum": [
                                    "image/png",
                                    "image/jpeg",
                                    "image/gif",
                                    "image/webp",
                                    "image/svg+xml",
                                    "font/woff",
                                    "font/woff2",
                                    "application/wasm",
                                    "application/octet-stream"
                                ],
                                "type": "string"
                            },
                            "encoding": {
                                "description": "* `base64` - base64",
                                "enum": ["base64"],
                                "type": "string"
                            }
                        },
                        "required": ["encoding", "contentType", "content"],
                        "type": "object"
                    },
                    "description": "Optional base64-encoded binary assets keyed by safe project-relative paths.",
                    "propertyNames": {
                        "type": "string"
                    },
                    "type": "object"
                },
                "canvasSdkVersion": {
                    "description": "Version of the host-injected `ph` canvas SDK the project targets.",
                    "type": "string"
                },
                "capabilities": {
                    "description": "Bounded capabilities frozen into the built artifact. Declare every insight short id the canvas loads, every event it captures, and inlineQueries when it runs ad-hoc HogQL — the host enforces these at runtime and validation rejects undeclared `ph` calls. Network origins must be exact HTTPS origins. Data fetched by canvas code can be sent to those origins.",
                    "properties": {
                        "connectors": {
                            "description": "Third-party providers the canvas reads through ph.connectors, each with the tools it may call. Every call runs with the viewer's own connection; declaring one shows it in the promote review.",
                            "items": {
                                "description": "One provider a canvas may call through ph.connectors, with the tools it may use.",
                                "properties": {
                                    "provider": {
                                        "description": "Connector provider id: a native provider such as 'github', or 'mcp:<server host>' (e.g. 'mcp:mcp.calendly.com') for a server the viewer connected in the MCP store.",
                                        "maxLength": 300,
                                        "type": "string"
                                    },
                                    "tools": {
                                        "description": "Tool names the canvas may call on this provider. Read-only tools only.",
                                        "items": {
                                            "maxLength": 200,
                                            "type": "string"
                                        },
                                        "maxItems": 64,
                                        "minItems": 1,
                                        "type": "array"
                                    }
                                },
                                "required": ["provider", "tools"],
                                "type": "object"
                            },
                            "maxItems": 20,
                            "type": "array"
                        },
                        "network": {
                            "properties": {
                                "origins": {
                                    "items": {
                                        "format": "uri",
                                        "maxLength": 2048,
                                        "type": "string"
                                    },
                                    "maxItems": 20,
                                    "type": "array"
                                }
                            },
                            "required": ["origins"],
                            "type": "object"
                        },
                        "posthog": {
                            "properties": {
                                "actions": {
                                    "description": "Registered action verbs the canvas may invoke via ph.actions (e.g. 'annotations.create', 'tasks.create'). Each executes as the viewer; declaring one shows it in the promote review.",
                                    "items": {
                                        "maxLength": 64,
                                        "type": "string"
                                    },
                                    "maxItems": 32,
                                    "type": "array"
                                },
                                "agentRequests": {
                                    "default": false,
                                    "type": "boolean"
                                },
                                "captureEvents": {
                                    "items": {
                                        "maxLength": 200,
                                        "type": "string"
                                    },
                                    "maxItems": 100,
                                    "type": "array"
                                },
                                "inlineQueries": {
                                    "type": "boolean"
                                },
                                "insights": {
                                    "items": {
                                        "maxLength": 128,
                                        "type": "string"
                                    },
                                    "maxItems": 100,
                                    "type": "array"
                                },
                                "state": {
                                    "description": "State scopes the canvas may use via ph.state: 'user' (private to each viewer) and/or 'shared' (one value per canvas, team-visible).",
                                    "items": {
                                        "description": "* `user` - user\n* `shared` - shared",
                                        "enum": ["user", "shared"],
                                        "type": "string"
                                    },
                                    "maxItems": 2,
                                    "type": "array"
                                },
                                "tools": {
                                    "description": "PostHog MCP tools the canvas may run via ph.tools (e.g. 'feature-flag-get-definition', 'feature-flag-set-release-condition-rollout'). Each runs as the viewer; declaring one shows it in the promote review.",
                                    "items": {
                                        "maxLength": 200,
                                        "type": "string"
                                    },
                                    "maxItems": 32,
                                    "type": "array"
                                }
                            },
                            "required": ["insights", "inlineQueries", "captureEvents"],
                            "type": "object"
                        }
                    },
                    "required": ["posthog", "network"],
                    "type": "object"
                },
                "component": {
                    "description": "Placement contract, required for (and only allowed on) component-kind canvases: the grid size the component takes and the JSON Schema of its per-placement config.",
                    "properties": {
                        "configSchema": {
                            "additionalProperties": {},
                            "description": "JSON Schema (\"type\": \"object\") for a placement's config. The host validates each placement's config against it and passes the validated object to the widget at mount.",
                            "propertyNames": {
                                "type": "string"
                            },
                            "type": "object"
                        },
                        "size": {
                            "description": "Grid-size contract for placements of this component.",
                            "properties": {
                                "defaultH": {
                                    "description": "Height a new placement starts at, in grid rows.",
                                    "maximum": 40,
                                    "minimum": 1,
                                    "type": "number"
                                },
                                "defaultW": {
                                    "description": "Width a new placement starts at, in grid columns.",
                                    "maximum": 12,
                                    "minimum": 1,
                                    "type": "number"
                                },
                                "maxH": {
                                    "description": "Tallest allowed height; omit for no cap.",
                                    "maximum": 40,
                                    "minimum": 1,
                                    "type": "number"
                                },
                                "maxW": {
                                    "description": "Widest allowed width; omit for no cap below the grid's width.",
                                    "maximum": 12,
                                    "minimum": 1,
                                    "type": "number"
                                },
                                "minH": {
                                    "description": "Shortest height the component renders usefully at.",
                                    "maximum": 40,
                                    "minimum": 1,
                                    "type": "number"
                                },
                                "minW": {
                                    "description": "Narrowest width the component renders usefully at.",
                                    "maximum": 12,
                                    "minimum": 1,
                                    "type": "number"
                                }
                            },
                            "required": ["defaultW", "defaultH", "minW", "minH"],
                            "type": "object"
                        }
                    },
                    "required": ["size"],
                    "type": "object"
                },
                "dependencies": {
                    "additionalProperties": {
                        "type": "string"
                    },
                    "description": "Exact-version dependencies, restricted to the platform-supported set at its pinned versions.",
                    "propertyNames": {
                        "type": "string"
                    },
                    "type": "object"
                },
                "entryHtml": {
                    "description": "The project's entry HTML file. Currently always \"index.html\".",
                    "type": "string"
                },
                "files": {
                    "additionalProperties": {
                        "type": "string"
                    },
                    "description": "Project files keyed by relative path (forward slashes, no '..').",
                    "propertyNames": {
                        "type": "string"
                    },
                    "type": "object"
                },
                "schemaVersion": {
                    "description": "Source-project schema version. Currently always 1.",
                    "type": "number"
                }
            },
            "required": ["schemaVersion", "files", "entryHtml"],
            "type": "object"
        }
    },
    "required": ["id", "project"],
    "type": "object"
}