Skip to main content

Crate sema_workflow

Crate sema_workflow 

Source
Expand description

Sema dynamic-workflow runtime: an in-process runtime that journals a frozen JSONL run-directory and returns a discriminated-union {:status …} envelope.

The body runs sequentially; leaves fan out with bounded concurrency (parallel / pipeline). --resume short-circuits any agent/checkpoint leaf already recorded in the run’s memo/ sidecar dir. The run directory is the stable public contract (treat like the .semac bytecode format) — its layout and event vocabulary are FROZEN (append-only Option/skippable fields only).

This crate is a leaf: it depends only on sema-core + serde. The builtins that invoke Sema thunks (workflow/run, workflow/phase, checkpoint, workflow/agent) live in sema-stdlib, which depends on this crate.

Re-exports§

pub use context::cur_agent_for;
pub use context::current_for;
pub use context::resolve_run_id;
pub use context::set_cur_agent_for;
pub use context::set_workflow_scope;
pub use context::WorkflowCtx;
pub use context::WorkflowGuard;
pub use context::WorkflowTaskState;
pub use event::WorkflowEvent;

Modules§

approval
Durable, host-controlled approval request and decision sidecars.
context
Run-scoped dynamic context for a workflow run.
event
The FROZEN workflow event vocabulary.
writer
One bounded FIFO journal writer thread per run (A3 — bounded workflow I/O).

Structs§

Journal
One run’s journal. Owns the run dir path and the bounded writer HANDLE. Every write method enqueues onto the writer thread; no filesystem write runs here.

Constants§

INDEX_DB
Filename of the cross-run SQLite projection index, under the run-dir base (<run-dir>/index.db). One DB indexes every run for the dashboard’s cross-run views.
RUNS_ROOT
Project-local run-directory root (cwd-relative, git-ignorable). NOT sema_home() (~/.sema) — a run dir belongs to the project being worked on. The CLI overrides the base via the SEMA_WORKFLOW_RUN_DIR seam (see context::resolve_runs_root).