parseIngestBody (protocol.ts)

diorama-builder ยท integration

Validates and parses ingestion request bodies via Zod against protocol schemas, supporting versioning and batch payloads.

// Source: https://github.com/hitesh153/diorama-builder | License: MIT | Copyright 2026 Hitesh Goyal
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from "zod";
import type { DioramaEvent } from "./eventBus";

/**
 * The public Diorama event protocol โ€” the "bring your own agents" contract.
 *
 * Any system can visualize its agents by POSTing events to the dev server's
 * ingest endpoint (or streaming them over its WebSocket):
 *
 *   POST /api/ingest
 *   { "v": 1, "type": "task.started", "agent": "my-agent",
 *     "room": "Lab", "label": "running tests", "ts": 1751780000000 }
 *
 * Only `v`, `type`, and `agent` are required. `room` targets a room by
 * (fuzzy-matched) label; `label` overrides the feed text; `ts` defaults to
 * arrival time. Everything else g

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key