Protocol overview

The four JSON schemas that connect the SDK, the runtime and the dashboard, and where each is used.

Kletso is a protocol first: the SDK, the runtime and the dashboard agree on a handful of JSON documents. Everything else (widgets, Workers, React) is replaceable.

SchemaPurposeProduced byConsumed by
kletso.ui/v1A surface: the component tree the agent wants renderedThe model via render_ui, trigger fixtures, workflowsThe SDK, the dashboard’s schematic renderer
kletso.events/v1The event envelope carried by every server message: message.delta, ui.render, app.notify, …The runtimeThe SDK, the dashboard inspectors, webhooks
Realtime framesClient → server (auth, message, action, context, track, screen, switch, ping) and server → client (ready, event, pong, error) over WebSocket or SSEBothBoth
kletso.components/v1The component manifest written by kletso_flutter:syncYour Flutter appThe dashboard
kletso.workflow/v1A workflow definition: nodes, edges, input schemaThe dashboard builderThe runtime’s workflow runner

The JSON Schemas live in the kletso_ui_schema package (schemas/*.json) together with fixtures: valid surfaces for every block family, invalid surfaces with the expected rejection code, a 113-event scripted conversation, and example frames. The SDK’s fake backend, the runtime’s tests and the dashboard’s demo mode all run on the same fixtures.

Design rules

  • Ids are the map keys. Components live in a flat map keyed by id and reference children by id. Trees stay small and patchable.
  • Never throw on bad input. Parsers return a result with issues. Fatal issues (missing root, cycle, oversize) mean “do not render”; non-fatal ones (unknown type, dangling child) degrade gracefully.
  • Sequence numbers everywhere. Every event has a monotonic seq per conversation; clients replay from the last one they saw.
  • Versioned names. kletso.ui/v1 will coexist with a future v2; a client that does not know a schema renders fallbackText.

Last updated 2026-09-28 · Report an issue with this page