Files
openprose__prose/packages/std/delivery/email-renderer.prose.md
dan f12dcda4d8 Release: the OpenProse Reactor harness (engine + CLI + devtools) — 0.3.0 ideal API surface (#106)
Ships @openprose/reactor 0.3.0, @openprose/reactor-cli 0.2.0, @openprose/reactor-devtools 0.2.0: the Reactor harness (compile-once-intelligent then dumb reconciler, content-addressed receipts, cost scales with surprise) with the distilled ideal public API — curated front door, full @openai/agents passthrough, one typed handle, one Substrate, unified observe, branded ids, and additive forward seams for the fixpoint.
2026-06-02 14:06:56 -07:00

2.3 KiB

name, kind
name kind
email-renderer function

Shape

  • self:
    • populate named slots in an email shell by generating json-render specs from structured report data
    • using only components from the provided catalog
  • delegates: none
  • prohibited:
    • writing raw HTML — all output is json-render specs; modifying the email shell — the shell is fixed infrastructure; using components not in the catalog — specs must reference only cataloged components; re-analyzing data or modifying report content — you decide slot content
    • you do not re-interpret the data

Parameters

  • report: structured report data to render (domain-specific, opaque to this contract)
  • slot_definitions: list of named slots the email shell exposes (e.g., summary, detail, footer_cta)
  • slot_catalog: reference to the component catalog — defines which json-render components are available and their accepted props

Returns

  • slots: dict of slot_name → json-render spec, one entry per slot defined in slot_definitions. The returned dict has exactly one entry per slot defined in slot_definitions; every spec is a valid json-render object ({ root, elements }) referencing only catalog components; and slots adapt to report content — empty or irrelevant sections get appropriate alternative content, not blank space.

Errors

  • empty-report: the report contains no data to render
  • unknown-slot: a slot_name is not present in slot_definitions
  • unknown-component: a spec references a component not in the catalog

Invariants

  • the email shell structure is never modified — only slot contents are produced
  • output is pure json-render specs — never raw HTML, never inline styles, never layout markup

Strategies

  • generate a json-render spec per slot — each spec is a { root, elements } object where elements reference components from the catalog; the rendering infrastructure handles converting specs to email-safe HTML
  • adapt slot content to the report — when a section has no relevant data, produce an appropriate alternative (e.g., a placeholder or positive-status message) rather than an empty spec
  • keep specs minimal — only include the data each component needs; do not duplicate report fields unnecessarily
  • when a report field is missing or null: use the catalog's default/empty-state component for that slot rather than omitting the slot entirely