Public runtime helpers for evaluating scripts against a scoped AshLua surface.
This module is the adapter-free layer underneath AshLua.EvalActions. Use it
when a custom transport, MCP server, or in-process LLM loop wants the same
scoped Lua runtime without going through a synthesized Ash action.
Each run/2 call builds a fresh Lua VM. Reuse should happen at the manifest
level: resolve or preload a manifest once, then pass it as manifest: manifest
for subsequent invocations.
Summary
Functions
Returns markdown documentation for a scoped AshLua surface.
Resolves a scoped AshLua manifest.
Resolves a scoped AshLua manifest or raises.
Evaluates script against a scoped AshLua runtime.
Types
@type run_opts() :: [ actor: term(), tenant: term(), context: map(), forbidden_fields: :hide | :display, lua: Lua.t(), lua_options: keyword(), source: String.t(), manifest: Ash.Info.Manifest.t(), eval_resource: module(), otp_app: atom(), labels: [atom()], action_entrypoints: [{module(), atom()}], cache?: boolean() ]
Functions
@spec docs(Ash.Info.Manifest.t() | manifest_opts(), keyword() | map()) :: {:ok, String.t()} | {:error, term()}
Returns markdown documentation for a scoped AshLua surface.
Pass neither :name nor :search for the compact index. Pass
name: "full" for the full page, a callable/type/topic id for a focused
page, or search: term for ranked search results.
@spec manifest(Ash.Info.Manifest.t() | manifest_opts()) :: {:ok, Ash.Info.Manifest.t()} | {:error, term()}
Resolves a scoped AshLua manifest.
Accepted inputs:
manifest: manifestor a%Ash.Info.Manifest{}value — reuse an already resolved manifest.eval_resource: MyApp.AgentSurface— use anAshLua.EvalActionsresource's scope.otp_app: :my_appplus optionallabels:/action_entrypoints:— build a scoped surface directly from domain DSL metadata.cache?: truewitheval_resource:— cache and reuse the scoped manifest in:persistent_term.
@spec manifest!(Ash.Info.Manifest.t() | manifest_opts()) :: Ash.Info.Manifest.t()
Resolves a scoped AshLua manifest or raises.
@spec run(String.t(), run_opts()) :: {:ok, run_result()} | {:error, term()}
Evaluates script against a scoped AshLua runtime.
Returns the same stable shape as the synthesized :eval action:
%{result: term, error: map | nil, print_output: [String.t()]}.
The surface is resolved with manifest/1. Runtime options include
:actor, :tenant, :context, :forbidden_fields, :source, :lua, and
:lua_options. :lua_options is forwarded to Lua.new/1 when a prebuilt
:lua VM is not supplied.