Syntropy.TaskScheduler.Support
(syntropy v0.2.0)
Copy Markdown
Shared helpers for the task scheduler pipeline.
Holds the small contracts used across the scheduler submodules: agent reference maps, attempt duration arithmetic, agent failure normalization, and the process-dictionary LLM usage context that ties provider calls back to the originating task and stage.
Summary
Functions
Builds the minimal cross-node agent reference carried by runs and events.
Reads the LLM usage context for the calling process.
Millisecond duration between two datetimes, floored at zero.
Normalizes an agent execution failure into a stable error map with a
machine-readable code and operator-facing message.
Runs fun with the LLM usage process context set to task_id/stage,
restoring any previous context afterwards.
Types
@type agent_ref() :: Syntropy.TaskScheduler.agent_ref()
Functions
Builds the minimal cross-node agent reference carried by runs and events.
Reads the LLM usage context for the calling process.
@spec duration_ms(DateTime.t() | nil, DateTime.t() | nil) :: non_neg_integer() | nil
Millisecond duration between two datetimes, floored at zero.
Returns nil when either endpoint is missing.
Normalizes an agent execution failure into a stable error map with a
machine-readable code and operator-facing message.
Runs fun with the LLM usage process context set to task_id/stage,
restoring any previous context afterwards.
The context is read back by current_llm_usage_context/1 when provider
calls are dispatched, so token usage lands on the right task and stage.