Tracks the async section of the typed-wasm convergence ABI, surfaced by AffineScript issue #225 / ADR-013 and needing Ephapax co-stakeholder review (typed-wasm ADR-004: typed-wasm is the shared aggregate/convergence layer for AffineScript and Ephapax).
What is being fixed as a shared convention
The async-over-wasm boundary protocol both languages must agree on:
- An async host import returns a
Thenable handle (i32) synchronously; the host registers the Promise in the handle table.
- The guest registers a continuation closure via
thenableThen(handle, closurePtr) using the closure ABI ([fnId@0, envPtr@4] dispatched through __indirect_function_table).
- The host re-enters the guest after settlement;
thenableResultJson(handle) (or a typed reader) yields the settled value.
- An async guest function itself returns a
Thenable handle, so the protocol composes up the call chain — this is what lets a backend present a transparent value-returning surface (AffineScript ADR-013's CPS transform) without JSPI.
Why it is convergence-layer, not AffineScript-internal
AffineScript ADR-013 (transparent CPS transform of Async functions on WasmGC) is the consumer; the protocol/handle conventions above are the shared contract. Ephapax compiles to the same typed WasmGC and must interoperate on identical conventions. This issue does not couple AffineScript to typed-wasm nor constrain Ephapax — it fixes the shared async convention where both already converge.
Asks
Refs: affinescript#225, affinescript#160, affinescript ADR-013 (docs/specs/async-on-wasm-cps.adoc), affinescript #199 (closure ABI), affinescript #205 (Thenable resolution), typed-wasm ADR-004.
Tracks the async section of the typed-wasm convergence ABI, surfaced by AffineScript issue #225 / ADR-013 and needing Ephapax co-stakeholder review (typed-wasm ADR-004: typed-wasm is the shared aggregate/convergence layer for AffineScript and Ephapax).
What is being fixed as a shared convention
The async-over-wasm boundary protocol both languages must agree on:
Thenablehandle (i32) synchronously; the host registers thePromisein the handle table.thenableThen(handle, closurePtr)using the closure ABI ([fnId@0, envPtr@4]dispatched through__indirect_function_table).thenableResultJson(handle)(or a typed reader) yields the settled value.Thenablehandle, so the protocol composes up the call chain — this is what lets a backend present a transparentvalue-returning surface (AffineScript ADR-013's CPS transform) without JSPI.Why it is convergence-layer, not AffineScript-internal
AffineScript ADR-013 (transparent CPS transform of
Asyncfunctions on WasmGC) is the consumer; the protocol/handle conventions above are the shared contract. Ephapax compiles to the same typed WasmGC and must interoperate on identical conventions. This issue does not couple AffineScript to typed-wasm nor constrain Ephapax — it fixes the shared async convention where both already converge.Asks
{ __error })Refs: affinescript#225, affinescript#160, affinescript ADR-013 (
docs/specs/async-on-wasm-cps.adoc), affinescript #199 (closure ABI), affinescript #205 (Thenable resolution), typed-wasm ADR-004.