def stage
import bendvy-ecs-core@0.1.0.4/transaction.bend as Transactionimport Base
import bendvy-ecs-core@0.1.0.4/deferred_command.bend as Deferred
45# Trusted adapter staging a raw World-transforming callback as a command.
46# It is not executed here; callbacks must obey their own authority/ownership
47# contracts. Prefer declared commands for ordinary gameplay.
48def stage(~W: Type, ~E: Data, tx: Tx<W, E>, command: W -> W) -> Tx<W, E>:
49 match tx:
50 case Tx{world, undo, commands, events,trace}:
51 Tx{world, undo, Deferred.Raw{command} <> commands, events,trace}