Syntropy.TaskScheduler.RunEnvelope
(syntropy v0.3.0)
Copy Markdown
Run envelope builders and envelope collection helpers.
Every run state — active, completed, failed, cancelled — is projected into the same envelope shape consumed by the runs API, API clients, and the persistence write-through. Builders are pure over their inputs apart from reading usage summaries and history snapshots for the run.
Summary
Functions
Envelope for a run that is still executing.
Envelope for an operator-cancelled run.
Envelope for a completed task result.
Removes duplicate envelopes by id, keeping first occurrence order.
Execution quality summary derived from agent attempts.
Envelope for a run that failed with reason.
Public projection of an internal agent attempt.
Sort key for run recency ordering.
Inserts or replaces run at the head of runs, bounded to limit.
Types
@type run_envelope() :: Syntropy.TaskScheduler.run_envelope()
Functions
@spec active(map()) :: run_envelope()
Envelope for a run that is still executing.
@spec cancelled(map()) :: run_envelope()
Envelope for an operator-cancelled run.
@spec completed(map()) :: run_envelope()
Envelope for a completed task result.
@spec dedupe([run_envelope()]) :: [run_envelope()]
Removes duplicate envelopes by id, keeping first occurrence order.
@spec execution_quality([map()]) :: Syntropy.TaskScheduler.execution_quality()
Execution quality summary derived from agent attempts.
@spec failed(map(), term()) :: run_envelope()
Envelope for a run that failed with reason.
@spec public_agent_attempt(map()) :: Syntropy.TaskScheduler.agent_attempt()
Public projection of an internal agent attempt.
@spec sort_key(run_envelope()) :: integer()
Sort key for run recency ordering.
@spec upsert([run_envelope()], run_envelope(), pos_integer()) :: [run_envelope()]
Inserts or replaces run at the head of runs, bounded to limit.