Clone the VM at the top of the async-builtin child VM stack, returning a
fresh Vm instance that callers own and can use without coordinating
with other concurrent users of the stack. This replaces the legacy
take/restore pattern: that pattern serialized access because only one
consumer could hold the single stack entry at a time, which prevented
any form of concurrent tool-handler execution within a single
agent_loop iteration. Cloning is cheap — the VM struct shares its
heavy state (env, builtins, bridge, module_cache) via Arc/Rc — so
multiple concurrent handlers can each have their own execution context.
Lex, parse, type-check, and compile source to bytecode in one call.
Bails on the first type error. For callers that need diagnostics
rather than early exit, use harn_parser::check_source directly
and then call Compiler::new().compile(&program).
Legacy API — now a no-op because take_async_builtin_child_vm returns
a clone rather than popping the stack, so there is nothing to restore.
Kept for backward compatibility.
Legacy API preserved for backward compatibility with any out-of-tree
callers. New code should use clone_async_builtin_child_vm() instead
— take serializes concurrent callers because only one can hold the
popped value at a time. Internally this now delegates to a clone so
even legacy callers don’t deadlock each other, but the name is kept
until external callers migrate.