Runtime

Runtime profile 0.2 adds durable workflows to the record, event and action contracts apps already use. It defines admission, persistence, retries, recovery, and what happens when an effect’s result can’t be known.

Runtime model

An app can read a record type, publish an event or provide an action without becoming a workflow engine. Each layer has one job.

1. Contracts

Record, event and action contracts share one identity, SemVer, JSON Schema, digest, registry and conflict model.

2. Application interoperability

CloudEvents and action envelopes carry exact contract evidence. Source and provider declarations bind live implementations to contracts. Events go to every subscriber; an action resolves to one provider.

3. Workflow admission

A workflow names compatible contracts. Admission resolves and pins the exact event source, action provider, handler, versions and digests the run may use.

4. Execution and recovery

Runs, attempts, leases, checkpoints, timers, cursors and outcomes survive crashes. The host that embeds the runtime still authorizes every dispatch.

Workflow requirements and admitted plans

Authors name a behaviour and a compatible version. The admitted plan records exact, immutable bindings before any action runs.

type: runtime_workflow
id: canvas.zone.set-status
version: 1.0.0
name: Set status from canvas zone
enabled: true

triggers:
  - id: drop-on-status-zone
    event:
      id: canvas.drop
      version: ^1.0.0

steps:
  - id: patch-task-status
    action:
      id: mdbase.record.patch
      version: ^2.0.0
    provider:
      application: task-editor
    input:
      path:
        $expr: event.data.record.path
      patch:
        status:
          $expr: event.data.target.value
Compatibility and authorization

A matching schema or SemVer range never grants access. The runtime admits exact candidates, and the embedding host still authorizes each event delivery and action dispatch.

Standard runtime records

The mdbase.runtime.standard@0.2.0 pack supplies ordinary mdbase types, contracts and JSON Schemas. Runtime state is made of records, so you can inspect it with the same tools as any other record.

Records Purpose
runtime_workflow, runtime_policy Portable workflow intent, provider selection, and capability grants
runtime_run, runtime_action_attempt Run state, exact bindings, requests, attempts, and outcomes
runtime_checkpoint, runtime_timer Recovery position, leases, one-shot scheduling, and missed-run policy
runtime_diagnostic, runtime_dead_letter Portable failure evidence and work that needs operator attention

Open the workflow JSON Schema · Inspect the complete standard pack

Profiles and implementations

Profile Covers Does not imply
event_action_interop/0.1 CloudEvents, declarations, validation, multicast, action resolution, and exact evidence Persistence, retries, timers, or workflow recovery
runtime/0.2 Admission, deterministic execution, journals, attempts, leases, recovery, cancellation, and timers Authorization or unrelated collection profiles
watch Collection change delivery and ordering Portable event contracts or durable workflow behaviour

The TypeScript @callumalpass/mdbase-runtime package provides browser-safe record validation and admission. The Rust mdbase-runtime crate runs workflows durably, in memory, on SQLite or on PostgreSQL.