feat: more clear definition and first base implementation for lua
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
24
lib/bds/scripting/runtime.ex
Normal file
24
lib/bds/scripting/runtime.ex
Normal file
@@ -0,0 +1,24 @@
|
||||
defmodule BDS.Scripting.Runtime do
|
||||
@moduledoc """
|
||||
Behaviour for user-script runtimes hosted by bDS.
|
||||
|
||||
The runtime boundary is intentionally narrow: syntax validation and
|
||||
bounded entrypoint execution.
|
||||
"""
|
||||
|
||||
@type source :: String.t()
|
||||
@type entrypoint :: String.t()
|
||||
@type args :: [term()]
|
||||
@type progress_event :: map()
|
||||
@type progress_callback :: (progress_event() -> any())
|
||||
@type execution_option ::
|
||||
{:timeout, non_neg_integer() | :infinity}
|
||||
| {:max_reductions, pos_integer() | :none}
|
||||
| {:spawn_opts, [term()]}
|
||||
| {:on_progress, progress_callback()}
|
||||
| {:capabilities, map()}
|
||||
|
||||
@callback validate(source()) :: :ok | {:error, term()}
|
||||
@callback execute(source(), entrypoint(), args(), [execution_option()]) ::
|
||||
{:ok, term()} | {:error, term()}
|
||||
end
|
||||
Reference in New Issue
Block a user