Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
428 changes: 428 additions & 0 deletions .agents/plans/A51-deflua-suspend-resume.md

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,27 @@ is in the [`1.0.0-rc.0`](#100-rc0---2026-05-26) entry below.

## [Unreleased]

### Added
- Host-driven suspension and resumption of a Lua evaluation. A `deflua`
or Elixir callback (set via `Lua.set!/3`, `Lua.encode!/2`, or
`Lua.load_api/2`) can return `{:suspend, values}` — or `{:suspend,
values, lua}` to thread state — to park the running machine instead of
returning. `Lua.eval!/2` and `Lua.call_function/3` then return
`{:suspended, values, lua}` (values decoded and display-wrapped under
the `:decode` option, exactly like normal results), with a continuation
stored on the `%Lua{}`. The new `Lua.resume/2` / `Lua.resume!/2`
re-enter the parked machine; the resume values become the suspended
call's results inside Lua, and a resumed evaluation may suspend again.
Heap effects made before a suspend are kept, as are effects made
before a post-resume error (matching `pcall` semantics), and a
`:max_instructions` budget spans the whole suspend/resume cycle. A
suspend that cannot be resumed — across a `pcall`/`xpcall` boundary, a
metamethod, a `table.sort` comparator, a `string.gsub` replacement
function, a generic-for iterator, a `load` reader, or a re-entrant
native call — is reported as the catchable Lua error `"attempt to
suspend across a native call boundary"`. Full `coroutine`
yield/resume remains a separate non-goal.

## [1.0.2] - 2026-07-28

### Changed
Expand Down
Loading