Runtime declarations for environment specs: validation, bootstrap script rendering, and host allowlist queries.
A runtime entry is a map (or ReqManagedAgents.Provisioner.Runtime.t()
struct) with three keys:
:lang— atom identifying the language (e.g.:elixir,:erlang):version— binary version string (e.g."1.17.0"):via— installation mechanism; only:miseis currently supported
Shape and version-charset validation lives in Runtime.new/1, the single
gate every entry passes through before it can reach rendering.
The runtimes list lives inside the env spec and is therefore covered by the spec digest — different runtimes produce a different image name automatically.
Summary
Functions
Renders the mise bootstrap install script for the given runtime entries.
Returns the hosts required for the given runtimes, deduplicated and sorted.
Renders the system-prompt instruction block for the given runtime entries.
Validates a runtimes list. Non-list input is rejected with the same error shape as an invalid entry.
Functions
@spec bootstrap_script([map() | ReqManagedAgents.Provisioner.Runtime.t()]) :: binary()
Renders the mise bootstrap install script for the given runtime entries.
Ordering rules:
- Erlang is placed before elixir when both are present.
- Elixir version becomes
elixir@<version>-otp-<erlang_major>when an erlang entry exists; plainelixir@<version>otherwise. - Other languages render as
<lang>@<version>verbatim. - Languages beyond erlang/elixir retain their input order after the pair.
Output is deterministic: the same input always produces an identical binary.
@spec required_hosts([map() | ReqManagedAgents.Provisioner.Runtime.t()]) :: [binary()]
Returns the hosts required for the given runtimes, deduplicated and sorted.
Reads priv/runtime_bootstrap/allowed_hosts.json at runtime. Returns []
for an empty runtimes list.
@spec system_prompt_block([map() | ReqManagedAgents.Provisioner.Runtime.t()]) :: binary()
Renders the system-prompt instruction block for the given runtime entries.
The block states which runtimes the session declares, instructs the agent to
run the bootstrap script EXACTLY ONCE via bash before the first command that
needs the runtimes (the script is idempotent), and embeds the full
bootstrap_script/1 output in a fenced code block.
Output is deterministic: the same input always produces an identical binary.
Validates a runtimes list. Non-list input is rejected with the same error shape as an invalid entry.
Returns :ok or {:error, {:invalid_runtime, entry}}.