feat(scripting): RiveFile.artboard and globals view models from scripts (#15972)

* feat(scripting): RiveFile.artboard, a decoded file's artboard a script owns

A script that decodes a file with context.decodeFile could only bind its
artboards (bindableArtboard), and a bound artboard gets its own main view
model instance but none of its file's global view models. RiveFile.artboard
(name?) instead returns an Artboard the script owns, advances, draws and
forwards input to, set up the way a host sets up the artboard of a file it
loads:

- a top level instance from the file (artboardNamed / artboardDefault, so
  the file's watermark too), its default state machine, bound to the file's
  default instance of the artboard's view model (data() returns it) and,
  through StateMachineInstance::bind's completion, a default instance of
  each of the file's global view models. An artboard without a state
  machine binds the same on the artboard.
- its data context has no parent: the script's own data and globals never
  reach it, and no two roots share an instance.
- nothing advances it at creation, so a size the script sets first is the
  size it first lays out at.
- it advances through the host's per-frame entry point
  (advanceAndApply(float)), as a root does, so its own scripts' async work
  is polled.
- it pins its file, so the RiveFile can be released.
- instance() on it makes another root from the file, not a copy of its live
  state; a view model instance passed in binds only when it belongs to that
  file, else the root gets a default one.

The shared setup is decodedRoot / decodedRootLike in decoded_file.cpp. The
wasm lane adds rive_file_v1.artboard (bindings.py, regenerated
projections), minting a rive_artboard_v1 handle; AnimaScript's RiveFile
gains artboard(name?).

Not in this change: the Luau lane's RiveFile:artboard, script access to the
root's global instances, hosted assets for decoded files, and the fetch
size limit.

* fix(scripting): a decoded game plays embedded, without a splash of its own

A RiveFile.artboard root came from artboardNamed, so a watermarked guest
froze behind its pre-roll inside the script's frame. A script's artboard is
embedded content: decodedRoot and decodedRootLike (instance()) now instance
through File::embeddedArtboard, which skips the watermark as bindables do.
The same bytes played standalone, and the top level host, keep the splash.
A root without a state machine keeps ticking while its scripts' async work
is pending. Docs: instance() on a decoded artboard binds only its own file's
instances. Regenerates the site REPL bundle for the std change.

* test(scripting): a decoded game moves by frame two; DecodedRoot isn't assignable

The rive-cli test now asserts the game and its copy advance a keyed Ticker by
the frame after their first, which the pre-roll's time-zero hold blocks; the
draw-path checks alone passed on the watermarked roots too. Member-wise move
assignment would free the artboard before the old machine that touches it, and
nothing assigns one, so it's deleted and pinned by static_assert. Trims test
comments and corrects the decoded root's advance comment.

* fix(scripting): a global view model read in init retries once bound

A script's init runs when its artboard is instanced, before a host binds
a data context. context.viewModel() and rootViewModel() answer that by
asking for init to run again once a context arrives; globalViewModel()
answered nil for good, in both lanes. A decoded root (RiveFile.artboard)
always binds after it is instanced, so a guest script that cached a
global in init never got it.

globalViewModel now asks for the retry while nothing is bound, and only
then: under a bound context, a name the file has no global for stays nil
and init keeps its result. A host that never binds a data context leaves
such a script waiting, as viewModel() already does.

* feat(scripting): RiveFile:artboard in Luau

The Luau twin of AnimaScript's RiveFile.artboard: a decoded file's
artboard the script owns, advances, draws and forwards input to, set up
by decodedRoot as in the wasm lane. ScriptReffedArtboard gains a
constructor over a DecodedRoot that pins the file in every build. Its
advance takes the root's per-frame entry point, and instance() makes
another root from the file rather than a copy, binding a view model
instance only when it is one of that file's.

The typings return Artboard<ViewModel?>?, so data reads as optional. The
rive-cli test plays the decoded game in both lanes and expects the same
draws.

* fix(scripting): RiveFile.artboard leaks nothing, matches whole names, decodes less

Review fixes:

- Luau made a decoded root before its userdata, so a failed allocation,
  which longjmps past C++ destructors, leaked the artboard, machine, view
  model and file. file:artboard() and instance() now make the root inside
  the ScriptedArtboard constructor, after the allocation.
- Names reached the lookups as C strings, so "Game\0Other" found Game.
  decodedRoot, decodedBindable and hostBindableArtboard take the name's
  length, in both lanes, so artboard() and bindableArtboard() match the
  whole name.
- decodedRootLike compared File::artboard(i), which decodes each deferred
  body before the match. It compares headers with handsOut, as
  ArtboardComponentList does. Decoded files don't defer bodies today, so
  this only showed under RIVE_LAZY_DECODING.

* fix(scripting): a Luau animation keeps its artboard; a bare decoded root gets a context

Review fixes:

- A Luau Animation held only its LinearAnimationInstance, so a script that
  kept one after dropping its artboard played into a freed artboard, and
  for a decoded root into its freed file's definitions. ScriptedAnimation
  now keeps the ScriptReffedArtboard, as the wasm lane's HostAnimation
  keeps its HostArtboard, and is made inside its userdata.
- A decoded root with no machine, view model or globals was left without
  a data context, so a guest script asking for a global in init waited
  for one forever. bindRoot gives it an empty context, as binding a
  machine does.

---------

Co-authored-by: Guido Rosso <guido@rive.app>
Rive-Mono-Commit: c57f201d4833d49b09e8edb6de39ab7246155e9b
diff --git a/include/rive/file.hpp b/include/rive/file.hpp
index 6b5d639..fa46f19 100644
--- a/include/rive/file.hpp
+++ b/include/rive/file.hpp
@@ -302,6 +302,12 @@
   std::unique_ptr<ArtboardInstance> artboardDefault() const;
   std::unique_ptr<ArtboardInstance> artboardAt(size_t index) const;
   std::unique_ptr<ArtboardInstance> artboardNamed(std::string name) const;
+  /// An instance of source, one of this file's artboards, for content that
+  /// embeds it (a script's root of a file it decoded): no watermark.
+  std::unique_ptr<ArtboardInstance> embeddedArtboard(Artboard* source) const
+  {
+    return instanceArtboard(source);
+  }
   rcp<BindableArtboard> bindableArtboardNamed(std::string name) const;
   rcp<BindableArtboard> bindableArtboardDefault() const;
   rcp<BindableArtboard> internalBindableArtboardFromArtboard(Artboard*) const;
diff --git a/include/rive/lua/rive_lua_libs.hpp b/include/rive/lua/rive_lua_libs.hpp
index ffa1841..0e4f623 100644
--- a/include/rive/lua/rive_lua_libs.hpp
+++ b/include/rive/lua/rive_lua_libs.hpp
@@ -1344,6 +1344,9 @@
   Mat2D m_worldTransform;
 };
 
+struct DecodedRoot;
+class ScriptedViewModel;
+
 class ScriptReffedArtboard : public RefCnt<ScriptReffedArtboard>
 {
 public:
@@ -1358,6 +1361,9 @@
       rcp<File> filePin = nullptr
 #endif
   );
+  /// A RiveFile:artboard root, which decodedRoot has already bound to its
+  /// own file's data; it pins that file.
+  ScriptReffedArtboard(rcp<File> decodedFile, DecodedRoot&& root);
 
   ~ScriptReffedArtboard();
   rive::File* file();
@@ -1367,6 +1373,8 @@
 #ifdef WITH_RIVE_TOOLS
   rcp<File> filePin() { return m_filePin; }
 #endif
+  /// The file a RiveFile:artboard root pins; null for any other artboard.
+  const rcp<File>& decodedFile() const { return m_decodedFile; }
 
 private:
   File* m_file;
@@ -1375,6 +1383,8 @@
   // own file: that would cycle File -> VM -> userdata -> File and leak.
   rcp<File> m_filePin;
 #endif
+  // Before the artboard, so it outlives it.
+  rcp<File> m_decodedFile;
   std::unique_ptr<ArtboardInstance> m_artboard;
   std::unique_ptr<StateMachineInstance> m_stateMachine;
   rcp<ViewModelInstance> m_viewModelInstance;
@@ -1397,6 +1407,23 @@
       rcp<File> filePin = nullptr
 #endif
   );
+  // RiveFile:artboard roots, with no parent data context. Each is made inside
+  // the userdata, after the allocation that can longjmp past C++ destructors,
+  // so a failed one strands nothing; it is empty (artboard() is null) when
+  // the file has no such artboard.
+  /// The artboard named by name's length bytes, or the file's default one
+  /// when name is null.
+  ScriptedArtboard(
+      lua_State* L,
+      const rcp<File>& decodedFile,
+      const char* name,
+      size_t length);
+  /// Another root of like's artboard, bound to viewModel's instance when it
+  /// is one of the file's.
+  ScriptedArtboard(
+      lua_State* L,
+      ScriptReffedArtboard& like,
+      ScriptedViewModel* viewModel);
   ~ScriptedArtboard();
 
   static constexpr uint8_t luaTag = LUA_T_COUNT + 10;
@@ -1419,7 +1446,8 @@
   }
 
   int pushData(lua_State* L);
-  int instance(lua_State* L, rcp<ViewModelInstance> viewModelInstance);
+  /// viewModel, if any, is the userdata the script passed.
+  int instance(lua_State* L, ScriptedViewModel* viewModel);
   int animation(lua_State* L, const char* animationName);
 
   bool advance(float seconds);
@@ -1436,9 +1464,13 @@
 class ScriptedAnimation
 {
 public:
+  /// The named animation of owner's artboard, which the caller checked it
+  /// has. Made inside the userdata, after the allocation that can longjmp
+  /// past C++ destructors.
   ScriptedAnimation(
       lua_State* L,
-      std::unique_ptr<LinearAnimationInstance> animation);
+      const rcp<ScriptReffedArtboard>& owner,
+      const char* name);
 
   static constexpr uint8_t luaTag = LUA_T_COUNT + 32;
   static constexpr const char* luaName = "Animation";
@@ -1449,6 +1481,9 @@
 
 private:
   lua_State* m_state;
+  // The animation plays its artboard, and a decoded root's file holds its
+  // definition, so it keeps both: before the animation, so it outlives it.
+  rcp<ScriptReffedArtboard> m_owner;
   std::unique_ptr<LinearAnimationInstance> m_animation;
 };
 
@@ -2767,8 +2802,9 @@
 class BindableArtboard;
 class ViewModelInstanceArtboard;
 
-/// A Rive file a script decoded from bytes. Its artboards reach the host only
-/// as BindableArtboards assigned to view model artboard properties.
+/// A Rive file a script decoded from bytes. Its artboards reach the host as
+/// BindableArtboards assigned to view model artboard properties, or the
+/// script owns them as Artboards (file:artboard).
 class ScriptedRiveFile
 {
 public:
diff --git a/include/rive/scripted/decoded_file.hpp b/include/rive/scripted/decoded_file.hpp
index 0436f71..98eb023 100644
--- a/include/rive/scripted/decoded_file.hpp
+++ b/include/rive/scripted/decoded_file.hpp
@@ -1,10 +1,14 @@
 #ifndef _RIVE_DECODED_FILE_HPP_
 #define _RIVE_DECODED_FILE_HPP_
 
+#include "rive/animation/state_machine_instance.hpp"
 #include "rive/file.hpp"
 #include "rive/refcnt.hpp"
 #include "rive/span.hpp"
 
+#include <cstring>
+#include <memory>
+
 namespace rive
 {
 class BindableArtboard;
@@ -27,9 +31,16 @@
   rcp<ViewModelInstance> viewModel;
 };
 
+// The lookups below take a name as its first length bytes, which may hold any
+// character, NUL included, so a name a script passes is matched whole; a null
+// name asks for the file's default artboard.
+
 /// The named artboard, or the file's default one when name is null; an
 /// empty artboard when there is no such artboard.
-DecodedBindable decodedBindable(const File& file, const char* name);
+DecodedBindable decodedBindable(
+    const File& file,
+    const char* name,
+    size_t length);
 
 /// One of the script's own file's artboards as a bindable, by name or the
 /// file's default artboard when name is null; null when there is no such
@@ -38,7 +49,48 @@
 /// treats it as one of its own, and carries no view model, so the host binds
 /// it as it binds an authored artboard id: to its stateful child or its data
 /// context.
-rcp<BindableArtboard> hostBindableArtboard(const File& file, const char* name);
+rcp<BindableArtboard> hostBindableArtboard(
+    const File& file,
+    const char* name,
+    size_t length);
+
+/// A decoded file's artboard as a root a script owns, set up as a host sets
+/// up one it loads: its default state machine bound to its own view model
+/// instance and file's globals, under no parent data context.
+struct DecodedRoot
+{
+  DecodedRoot() = default;
+  DecodedRoot(DecodedRoot&&) = default;
+  // Member-wise, it frees artboard before the old stateMachine that touches it.
+  DecodedRoot& operator=(DecodedRoot&&) = delete;
+
+  std::unique_ptr<ArtboardInstance> artboard;
+  /// Null when the artboard has no default state machine; the artboard is
+  /// then bound directly.
+  std::unique_ptr<StateMachineInstance> stateMachine;
+  /// The main view model instance, null when the artboard has no view
+  /// model.
+  rcp<ViewModelInstance> viewModel;
+};
+
+/// The named artboard of file, or its default one when name is null, as a
+/// root bound to the file's default instance of its view model; empty when
+/// there is no such artboard.
+DecodedRoot decodedRoot(const File& file, const char* name, size_t length);
+
+/// The same for a NUL-terminated name, as C++ callers have.
+inline DecodedRoot decodedRoot(const File& file, const char* name)
+{
+  return decodedRoot(file, name, name != nullptr ? std::strlen(name) : 0);
+}
+
+/// Another root of like's artboard, bound to main when main is an instance
+/// of one of file's view models, else as decodedRoot; empty when like is not
+/// from file.
+DecodedRoot decodedRootLike(
+    const File& file,
+    const ArtboardInstance& like,
+    rcp<ViewModelInstance> main);
 
 } // namespace rive
 
diff --git a/include/rive/wasm/rive_bindings_v1.h b/include/rive/wasm/rive_bindings_v1.h
index e9d8919..015633d 100644
--- a/include/rive/wasm/rive_bindings_v1.h
+++ b/include/rive/wasm/rive_bindings_v1.h
@@ -16,7 +16,7 @@
 // one contract and run against another links its imports to
 // nothing, so a build that carries this can be told apart from one
 // that predates a change to it.
-#define RIVE_BINDINGS_V1_CONTRACT "3b6a00704fafc1bf"
+#define RIVE_BINDINGS_V1_CONTRACT "a081fd4bbcf2f628"
 
 // The bits rive_rt_features answers.
 #define RIVE_HOST_FEATURE_PARALLEL_CALLS (1u << 0)
@@ -936,6 +936,8 @@
 uint32_t rive_file_bindable_equal(uint32_t a, uint32_t b);
 RIVE_BINDING_IMPORT("rive_file_v1", "bindable_identity")
 uint32_t rive_file_bindable_identity(uint32_t bindable);
+RIVE_BINDING_IMPORT("rive_file_v1", "artboard")
+uint32_t rive_file_artboard(uint32_t file, const char* name, uint32_t nameLength, uint32_t useDefault);
 
 // rive_lanes_v1
 RIVE_BINDING_IMPORT("rive_lanes_v1", "start")
diff --git a/src/lua/lua_artboards.cpp b/src/lua/lua_artboards.cpp
index e6c2bc3..86492e4 100644
--- a/src/lua/lua_artboards.cpp
+++ b/src/lua/lua_artboards.cpp
@@ -18,6 +18,7 @@
 #include "rive/constraints/constraint.hpp"
 #include "rive/math/transform_components.hpp"
 #include "rive/shapes/path.hpp"
+#include "rive/scripted/decoded_file.hpp"
 #include "rive/scripted/scripted_read_tracker.hpp"
 
 #include <math.h>
@@ -118,6 +119,16 @@
 #endif
 }
 
+ScriptReffedArtboard::ScriptReffedArtboard(
+    rcp<File> decodedFile,
+    DecodedRoot&& root)
+    : m_file(decodedFile.get())
+    , m_decodedFile(std::move(decodedFile))
+    , m_artboard(std::move(root.artboard))
+    , m_stateMachine(std::move(root.stateMachine))
+    , m_viewModelInstance(std::move(root.viewModel))
+{}
+
 ScriptReffedArtboard::~ScriptReffedArtboard()
 {
   // Make sure state machine is deleted before artboard since
@@ -400,6 +411,14 @@
 bool ScriptedArtboard::advance(float seconds)
 {
   auto machine = stateMachine();
+  if (m_scriptReffedArtboard->decodedFile() != nullptr)
+  {
+    // A root, which no host frame advances: the per-frame entry point for a
+    // machine; without one, keep ticking while async work is pending.
+    return machine != nullptr ? machine->advanceAndApply(seconds)
+                              : artboard()->advance(seconds) ||
+                                    artboard()->hasPendingAsyncWork();
+  }
   if (machine)
   {
     // A scripted artboard's view models are advanced/reset by the host
@@ -571,9 +590,7 @@
         {
 
           auto scriptedViewModel = lua_torive<ScriptedViewModel>(L, 2);
-          return scriptedArtboard->instance(
-              L,
-              scriptedViewModel->viewModelInstance());
+          return scriptedArtboard->instance(L, scriptedViewModel);
         }
         return scriptedArtboard->instance(L, nullptr);
       }
@@ -684,10 +701,27 @@
   return 1;
 }
 
-int ScriptedArtboard::instance(
-    lua_State* L,
-    rcp<ViewModelInstance> viewModelInstance)
+int ScriptedArtboard::instance(lua_State* L, ScriptedViewModel* viewModel)
 {
+  if (m_scriptReffedArtboard->decodedFile() != nullptr)
+  {
+    // Another root from the file, not a copy of this one's live state, made
+    // inside its userdata; nothing else is left to destroy if this errors.
+    auto* copy = lua_newrive<ScriptedArtboard>(
+        L,
+        L,
+        *m_scriptReffedArtboard,
+        viewModel);
+    if (copy->artboard() == nullptr)
+    {
+      luaL_error(L, "Could not instantiate artboard");
+    }
+    return 1;
+  }
+  rcp<ViewModelInstance> viewModelInstance = viewModel != nullptr
+                                                 ? viewModel
+                                                       ->viewModelInstance()
+                                                 : nullptr;
 #ifdef WITH_RIVE_EDITOR
   auto* context = ScriptingContext::from(L);
   auto artboardInstance = context ? context->instantiateArtboard(artboard())
@@ -716,16 +750,12 @@
 
 int ScriptedArtboard::animation(lua_State* L, const char* animationName)
 {
-  if (artboard()->isInstance())
+  // Checked against the definitions; the instance is made inside the
+  // userdata, and keeps the artboard it plays.
+  if (artboard()->isInstance() && artboard()->animation(animationName))
   {
-
-    auto animation = static_cast<ArtboardInstance*>(artboard())
-                         ->animationNamed(animationName);
-    if (animation)
-    {
-      lua_newrive<ScriptedAnimation>(L, L, std::move(animation));
-      return 1;
-    }
+    lua_newrive<ScriptedAnimation>(L, L, m_scriptReffedArtboard, animationName);
+    return 1;
   }
   return 0;
 }
@@ -964,6 +994,42 @@
     , m_dataContext(dataContext)
 {}
 
+ScriptedArtboard::ScriptedArtboard(
+    lua_State* L,
+    const rcp<File>& decodedFile,
+    const char* name,
+    size_t length)
+    : m_state(L)
+    , m_scriptReffedArtboard(make_rcp<ScriptReffedArtboard>(
+          decodedFile,
+          decodedRoot(*decodedFile, name, length)))
+{}
+
+static DecodedRoot decodedCopy(
+    ScriptReffedArtboard& like,
+    ScriptedViewModel* viewModel)
+{
+  auto* artboard = like.artboard();
+  if (artboard == nullptr)
+  {
+    return DecodedRoot();
+  }
+  return decodedRootLike(
+      *like.decodedFile(),
+      *static_cast<ArtboardInstance*>(artboard),
+      viewModel != nullptr ? viewModel->viewModelInstance() : nullptr);
+}
+
+ScriptedArtboard::ScriptedArtboard(
+    lua_State* L,
+    ScriptReffedArtboard& like,
+    ScriptedViewModel* viewModel)
+    : m_state(L)
+    , m_scriptReffedArtboard(make_rcp<ScriptReffedArtboard>(
+          like.decodedFile(),
+          decodedCopy(like, viewModel)))
+{}
+
 ScriptedArtboard::~ScriptedArtboard()
 {
   lua_unref(m_state, m_dataRef);
@@ -972,9 +1038,12 @@
 
 ScriptedAnimation::ScriptedAnimation(
     lua_State* L,
-    std::unique_ptr<LinearAnimationInstance> animation)
+    const rcp<ScriptReffedArtboard>& owner,
+    const char* name)
     : m_state(L)
-    , m_animation(std::move(animation))
+    , m_owner(owner)
+    , m_animation(static_cast<ArtboardInstance*>(owner->artboard())
+                      ->animationNamed(name))
 {}
 
 float ScriptedAnimation::duration()
diff --git a/src/lua/lua_rive_file.cpp b/src/lua/lua_rive_file.cpp
index bd04e6c..0ebd657 100644
--- a/src/lua/lua_rive_file.cpp
+++ b/src/lua/lua_rive_file.cpp
@@ -86,10 +86,16 @@
   auto* self = lua_torive<ScriptedRiveFile>(L, 1);
   if (name != nullptr && atom == (int)LuaAtoms::bindableArtboard)
   {
-    const char* artboardName = lua_isnoneornil(L, 2) ? nullptr
-                                                     : luaL_checkstring(L, 2);
+    // Names are whole Luau strings, NUL included.
+    size_t length = 0;
+    const char* artboardName = lua_isnoneornil(L, 2)
+                                   ? nullptr
+                                   : luaL_checklstring(L, 2, &length);
     auto* bindable = lua_newrive<ScriptedBindableArtboard>(L);
-    DecodedBindable decoded = decodedBindable(*self->file, artboardName);
+    DecodedBindable decoded = decodedBindable(
+        *self->file,
+        artboardName,
+        length);
     if (decoded.artboard == nullptr)
     {
       lua_pop(L, 1);
@@ -100,6 +106,27 @@
     bindable->viewModel = std::move(decoded.viewModel);
     return 1;
   }
+  if (name != nullptr && atom == (int)LuaAtoms::artboard)
+  {
+    size_t length = 0;
+    const char* artboardName = lua_isnoneornil(L, 2)
+                                   ? nullptr
+                                   : luaL_checklstring(L, 2, &length);
+    // The root is made inside the userdata, after the allocation that can
+    // longjmp past C++ destructors, so a failed one strands nothing.
+    auto* artboard = lua_newrive<ScriptedArtboard>(
+        L,
+        L,
+        self->file,
+        artboardName,
+        length);
+    if (artboard->artboard() == nullptr)
+    {
+      lua_pop(L, 1);
+      lua_pushnil(L);
+    }
+    return 1;
+  }
   luaL_error(
       L,
       "%s is not a valid method of %s",
@@ -158,8 +185,10 @@
 // it as it binds an authored artboard id.
 int context_bindableArtboard_impl(lua_State* L)
 {
-  const char* artboardName = lua_isnoneornil(L, 2) ? nullptr
-                                                   : luaL_checkstring(L, 2);
+  size_t length = 0;
+  const char* artboardName = lua_isnoneornil(L, 2)
+                                 ? nullptr
+                                 : luaL_checklstring(L, 2, &length);
   auto* context = lua_torive<ScriptedContext>(L, 1);
   auto* object = context != nullptr ? context->scriptedObject() : nullptr;
   auto* scriptAsset = object != nullptr ? object->scriptAsset() : nullptr;
@@ -170,7 +199,7 @@
     return 1;
   }
   auto* bindable = lua_newrive<ScriptedBindableArtboard>(L);
-  bindable->artboard = hostBindableArtboard(*file, artboardName);
+  bindable->artboard = hostBindableArtboard(*file, artboardName, length);
   if (bindable->artboard == nullptr)
   {
     lua_pop(L, 1);
diff --git a/src/lua/lua_scripted_context.cpp b/src/lua/lua_scripted_context.cpp
index 6576969..105357e 100644
--- a/src/lua/lua_scripted_context.cpp
+++ b/src/lua/lua_scripted_context.cpp
@@ -300,7 +300,14 @@
   {
     auto scriptAsset = m_scriptedObject->scriptAsset();
     auto dataContext = m_scriptedObject->dataContext();
-    if (scriptAsset != nullptr && dataContext != nullptr)
+    if (dataContext == nullptr)
+    {
+      // Not bound yet, as when init runs on a new instance: init runs again
+      // once a data context arrives, as it does for context:viewModel().
+      m_missingRequestedData = true;
+      return 0;
+    }
+    if (scriptAsset != nullptr)
     {
       File* file = scriptAsset->file();
       if (file != nullptr)
diff --git a/src/scripted/decoded_file.cpp b/src/scripted/decoded_file.cpp
index f1d3ab8..40669e6 100644
--- a/src/scripted/decoded_file.cpp
+++ b/src/scripted/decoded_file.cpp
@@ -1,5 +1,7 @@
 #include "rive/scripted/decoded_file.hpp"
 #include "rive/bindable_artboard.hpp"
+#include "rive/data_bind/data_context.hpp"
+#include "rive/viewmodel/viewmodel.hpp"
 #include "rive/viewmodel/viewmodel_instance.hpp"
 
 using namespace rive;
@@ -27,10 +29,14 @@
   return file;
 }
 
-DecodedBindable rive::decodedBindable(const File& file, const char* name)
+DecodedBindable rive::decodedBindable(
+    const File& file,
+    const char* name,
+    size_t length)
 {
   DecodedBindable bindable;
-  bindable.artboard = name != nullptr ? file.bindableArtboardNamed(name)
+  bindable.artboard = name != nullptr ? file.bindableArtboardNamed(
+                                            std::string(name, length))
                                       : file.bindableArtboardDefault();
   if (bindable.artboard != nullptr)
   {
@@ -42,9 +48,111 @@
 
 rcp<BindableArtboard> rive::hostBindableArtboard(
     const File& file,
-    const char* name)
+    const char* name,
+    size_t length)
 {
-  Artboard* artboard = name != nullptr ? file.artboard(std::string(name))
-                                       : file.artboard();
+  Artboard* artboard = name != nullptr
+                           ? file.artboard(std::string(name, length))
+                           : file.artboard();
   return artboard != nullptr ? make_rcp<BindableArtboard>(artboard) : nullptr;
 }
+
+static bool ownsViewModel(const File& file, const ViewModel* viewModel)
+{
+  for (size_t i = 0; i < file.viewModelCount(); i++)
+  {
+    if (file.viewModel(i) == viewModel)
+    {
+      return true;
+    }
+  }
+  return false;
+}
+
+// Binds as a host binds the artboard it plays, where binding the machine
+// completes the main and global instances (completeViewModelInstances), but
+// embedded, so without a top level instance's watermark.
+static DecodedRoot bindRoot(
+    const File& file,
+    Artboard* source,
+    rcp<ViewModelInstance> main)
+{
+  DecodedRoot root;
+  auto artboard = file.embeddedArtboard(source);
+  if (artboard == nullptr)
+  {
+    return root;
+  }
+  // Drawn at the script's origin, as an Artboard input is.
+  artboard->frameOrigin(false);
+  if (main != nullptr && !ownsViewModel(file, main->viewModel()))
+  {
+    // Another file's instance would bind by this file's property ids.
+    main = nullptr;
+  }
+  root.viewModel = main != nullptr
+                       ? std::move(main)
+                       : file.createDefaultViewModelInstance(artboard.get());
+  root.stateMachine = artboard->defaultStateMachine();
+  if (root.stateMachine != nullptr)
+  {
+    if (root.viewModel != nullptr)
+    {
+      root.stateMachine->setViewModelInstance(root.viewModel);
+    }
+    root.stateMachine->bind();
+  }
+  else
+  {
+    if (root.viewModel != nullptr)
+    {
+      artboard->setViewModelInstance(root.viewModel);
+    }
+    for (auto* viewModel : file.globalViewModels())
+    {
+      artboard->setGlobalViewModelInstance(
+          viewModel->name(),
+          file.createDefaultViewModelInstance(viewModel));
+    }
+    if (artboard->dataContext() == nullptr)
+    {
+      // Nothing to bind, but a context all the same, as binding a machine
+      // makes one: a script asking for data in init waits until one exists.
+      auto empty = make_rcp<DataContext>(rcp<ViewModelInstance>(nullptr));
+      empty->addDependentContainer(artboard.get());
+      artboard->internalDataContext(empty);
+    }
+    else
+    {
+      artboard->bind();
+    }
+  }
+  root.artboard = std::move(artboard);
+  return root;
+}
+
+DecodedRoot rive::decodedRoot(const File& file, const char* name, size_t length)
+{
+  return bindRoot(
+      file,
+      name != nullptr ? file.artboard(std::string(name, length))
+                      : file.artboard(),
+      nullptr);
+}
+
+DecodedRoot rive::decodedRootLike(
+    const File& file,
+    const ArtboardInstance& like,
+    rcp<ViewModelInstance> main)
+{
+  const Artboard* source = like.artboardSource();
+  for (size_t i = 0; i < file.artboardCount(); i++)
+  {
+    // Without decoding the artboards before it.
+    if (file.artboardHeader(i)->handsOut(source))
+    {
+      return bindRoot(file, file.artboard(i), std::move(main));
+    }
+  }
+  return DecodedRoot();
+}
diff --git a/src/wasm/idl/bindings.py b/src/wasm/idl/bindings.py
index 75c8c3d..3b664dd 100644
--- a/src/wasm/idl/bindings.py
+++ b/src/wasm/idl/bindings.py
@@ -1326,6 +1326,12 @@
         # The bindable artboard's stable id, to hash it by; 0 for a stale
         # handle.
         op('bindable_identity', [handle('bindable')], ret='u32'),
+        # A new instance of the named artboard, or of the file's default one
+        # when useDefault is set, as a rive_artboard_v1 handle the module
+        # owns: a root bound to its own view model instance and its file's
+        # global view model instances; 0 when absent.
+        op('artboard', [handle('file'), string('name', 'nameLength'),
+                        u32('useDefault')], ret='u32'),
     ]),
     # Jobs, workers and audio processors, each an instance of its lane module;
     # kinds and states are lane_layout.py's.
diff --git a/src/wasm/idl/contract_v1.txt b/src/wasm/idl/contract_v1.txt
index 89d0800..c61557a 100644
--- a/src/wasm/idl/contract_v1.txt
+++ b/src/wasm/idl/contract_v1.txt
@@ -1 +1 @@
-3b6a00704fafc1bf
+a081fd4bbcf2f628
diff --git a/src/wasm/wasm_natives_gen.hpp b/src/wasm/wasm_natives_gen.hpp
index fc00f86..f13cb12 100644
--- a/src/wasm/wasm_natives_gen.hpp
+++ b/src/wasm/wasm_natives_gen.hpp
@@ -569,6 +569,7 @@
 uint32_t fileHostBindableImpl(WasmScriptingVM* vm, uint32_t object, const char* name, uint32_t nameLength, uint32_t useDefault);
 uint32_t fileBindableEqualImpl(WasmScriptingVM* vm, uint32_t a, uint32_t b);
 uint32_t fileBindableIdentityImpl(WasmScriptingVM* vm, uint32_t bindable);
+uint32_t fileArtboardImpl(WasmScriptingVM* vm, uint32_t file, const char* name, uint32_t nameLength, uint32_t useDefault);
 uint32_t lanesStartImpl(WasmScriptingVM* vm, uint32_t kind, uint32_t entry, const uint8_t* input, uint32_t inputByteCount, const uint32_t* holds, uint32_t holdCount);
 uint32_t lanesStateImpl(WasmScriptingVM* vm, uint32_t lane);
 uint32_t lanesFailedImpl(WasmScriptingVM* vm, uint32_t lane, char* buffer, uint32_t capacity);
@@ -2564,6 +2565,12 @@
     WasmScriptingVM* vm = vmFromEnv(env);
     return fileBindableIdentityImpl(vm, bindable);
 }
+uint32_t fileArtboard(wasm_exec_env_t env, uint32_t file, const char* name, uint32_t nameLength, uint32_t useDefault)
+{
+    WasmScriptingVM* vm = vmFromEnv(env);
+    WasmStringArg nameUtf8(vm, name, nameLength);
+    return fileArtboardImpl(vm, file, nameUtf8.data(), nameUtf8.size(), useDefault);
+}
 uint32_t lanesStart(wasm_exec_env_t env, uint32_t kind, uint32_t entry, const uint8_t* input, uint32_t inputByteCount, const uint32_t* holds, uint32_t holdCount)
 {
     WasmScriptingVM* vm = bootVmFromEnv(env);
@@ -3254,6 +3261,7 @@
     {"host_bindable", (void*)fileHostBindable, "(i*~i)i", nullptr},
     {"bindable_equal", (void*)fileBindableEqual, "(ii)i", nullptr},
     {"bindable_identity", (void*)fileBindableIdentity, "(i)i", nullptr},
+    {"artboard", (void*)fileArtboard, "(i*~i)i", nullptr},
 };
 
 NativeSymbol kLanesNatives[] = {
diff --git a/src/wasm/wasm_natives_web_gen.hpp b/src/wasm/wasm_natives_web_gen.hpp
index a892ba0..bf06435 100644
--- a/src/wasm/wasm_natives_web_gen.hpp
+++ b/src/wasm/wasm_natives_web_gen.hpp
@@ -1771,6 +1771,12 @@
     WasmScriptingVM* vm = vmFromHandle(vmHandle);
     return fileBindableIdentityImpl(vm, bindable);
 }
+uint32_t rive_web_file_artboard(uint32_t vmHandle, uint32_t file, const char* name, uint32_t nameLength, uint32_t useDefault)
+{
+    WasmScriptingVM* vm = vmFromHandle(vmHandle);
+    WasmStringArg nameUtf8(vm, name, nameLength);
+    return fileArtboardImpl(vm, file, nameUtf8.data(), nameUtf8.size(), useDefault);
+}
 uint32_t rive_web_lanes_start(uint32_t vmHandle, uint32_t kind, uint32_t entry, const uint8_t* input, uint32_t inputByteCount, const uint32_t* holds, uint32_t holdCount)
 {
     WasmScriptingVM* vm = bootVmFromHandle(vmHandle);
@@ -2411,6 +2417,7 @@
     (void*)rive_web_file_host_bindable,
     (void*)rive_web_file_bindable_equal,
     (void*)rive_web_file_bindable_identity,
+    (void*)rive_web_file_artboard,
     (void*)rive_web_lanes_start,
     (void*)rive_web_lanes_state,
     (void*)rive_web_lanes_failed,
diff --git a/src/wasm/wasm_scripting_vm.cpp b/src/wasm/wasm_scripting_vm.cpp
index 6113d29..ee07c15 100644
--- a/src/wasm/wasm_scripting_vm.cpp
+++ b/src/wasm/wasm_scripting_vm.cpp
@@ -7455,9 +7455,15 @@
   auto object = static_cast<ScriptedObject*>(vm->handles().resolve(
       objectHandle,
       WasmScriptingVM::HandleTable::Tag::object));
+  if (object != nullptr && object->dataContext() == nullptr)
+  {
+    // Not bound yet, as when init runs on a new instance: init runs again
+    // once a data context arrives, as it does for context.viewModel().
+    vm->noteMissingRequestedData();
+    return 0;
+  }
   if (object == nullptr || object->scriptAsset() == nullptr ||
-      object->scriptAsset()->file() == nullptr ||
-      object->dataContext() == nullptr)
+      object->scriptAsset()->file() == nullptr)
   {
     return 0;
   }
@@ -7607,6 +7613,8 @@
   std::unique_ptr<StateMachineInstance> stateMachine;
   rcp<ViewModelInstance> viewModelInstance;
   rcp<DataContext> parentDataContext;
+  // Set on a RiveFile.artboard root, which pins its file.
+  rcp<File> decodedFile;
 
   HostArtboard(
       File* fileValue,
@@ -7640,6 +7648,14 @@
     }
   }
 
+  HostArtboard(rcp<File> decoded, DecodedRoot&& root)
+      : file(decoded.get())
+      , artboard(std::move(root.artboard))
+      , stateMachine(std::move(root.stateMachine))
+      , viewModelInstance(std::move(root.viewModel))
+      , decodedFile(std::move(decoded))
+  {}
+
   ~HostArtboard()
   {
     // State machine before artboard; its destructor touches the artboard.
@@ -7649,6 +7665,14 @@
 
   bool advance(float seconds)
   {
+    if (decodedFile != nullptr)
+    {
+      // A root, which no host frame advances: the per-frame entry point for a
+      // machine; without one, keep ticking while async work is pending.
+      return stateMachine != nullptr ? stateMachine->advanceAndApply(seconds)
+                                     : artboard->advance(seconds) ||
+                                           artboard->hasPendingAsyncWork();
+    }
     if (stateMachine != nullptr)
     {
       // Bound view models advance with the host frame, not here.
@@ -7926,9 +7950,25 @@
   {
     return 0;
   }
+  auto vmi = vmiHandle != 0 ? resolveVmiArg(vm, vmiHandle) : nullptr;
+  if (host->decodedFile != nullptr)
+  {
+    // A fresh root from the file, not a copy of this one's live state, with
+    // view model instances of its own.
+    DecodedRoot root = decodedRootLike(
+        *host->decodedFile,
+        *host->artboard,
+        std::move(vmi));
+    if (root.artboard == nullptr)
+    {
+      return 0;
+    }
+    return vm->handles().mint(
+        WasmScriptingVM::HandleTable::Tag::artboard,
+        new HostArtboard(host->decodedFile, std::move(root)));
+  }
   auto clone = host->artboard->instance();
   clone->frameOrigin(false);
-  auto vmi = vmiHandle != 0 ? resolveVmiArg(vm, vmiHandle) : nullptr;
   return vm->handles().mint(
       WasmScriptingVM::HandleTable::Tag::artboard,
       new HostArtboard(
@@ -9985,6 +10025,13 @@
       capacity);
 }
 
+// A rive_file_v1 artboard name for the decoded_file lookups: null for the
+// file's default artboard, else all nameLength bytes, NUL included.
+const char* artboardLookupName(const char* name, uint32_t useDefault)
+{
+  return useDefault != 0 ? nullptr : (name != nullptr ? name : "");
+}
+
 uint32_t fileBindableImpl(
     WasmScriptingVM* vm,
     uint32_t file,
@@ -9997,10 +10044,10 @@
   {
     return 0;
   }
-  std::string named(name, nameLength);
   DecodedBindable decoded = decodedBindable(
       *host->file,
-      useDefault != 0 ? nullptr : named.c_str());
+      artboardLookupName(name, useDefault),
+      nameLength);
   if (decoded.artboard == nullptr)
   {
     return 0;
@@ -10064,6 +10111,33 @@
   return host != nullptr ? host->artboard->stableId() : 0;
 }
 
+// RiveFile.artboard: a root the module owns, as rive_artboard_v1 handles an
+// Artboard input's instance, bound to its own file's data.
+uint32_t fileArtboardImpl(
+    WasmScriptingVM* vm,
+    uint32_t file,
+    const char* name,
+    uint32_t nameLength,
+    uint32_t useDefault)
+{
+  auto host = resolveRiveFile(vm, file);
+  if (host == nullptr)
+  {
+    return 0;
+  }
+  DecodedRoot root = decodedRoot(
+      *host->file,
+      artboardLookupName(name, useDefault),
+      nameLength);
+  if (root.artboard == nullptr)
+  {
+    return 0;
+  }
+  return vm->handles().mint(
+      WasmScriptingVM::HandleTable::Tag::artboard,
+      new HostArtboard(host->file, std::move(root)));
+}
+
 // context.bindableArtboard: one of the script's own file's artboards, with no
 // view model of its own, so the host binds it as an authored artboard id.
 uint32_t fileHostBindableImpl(
@@ -10085,10 +10159,10 @@
   {
     return 0;
   }
-  std::string named(name, nameLength);
   auto bindable = hostBindableArtboard(
       *object->scriptAsset()->file(),
-      useDefault != 0 ? nullptr : named.c_str());
+      artboardLookupName(name, useDefault),
+      nameLength);
   if (bindable == nullptr)
   {
     return 0;
diff --git a/src/wasm/web/rive_module_imports.mjs b/src/wasm/web/rive_module_imports.mjs
index 400c162..37f9c3a 100644
--- a/src/wasm/web/rive_module_imports.mjs
+++ b/src/wasm/web/rive_module_imports.mjs
@@ -1842,6 +1842,17 @@
             },
             'bindable_equal': calls.rive_file_bindable_equal,
             'bindable_identity': calls.rive_file_bindable_identity,
+            'artboard': (file, name, nameLength, useDefault) => {
+                const mark = stackSave();
+                let name_p = 0;
+                try {
+                    name_p = stageIn(name, nameLength);
+                    return calls.rive_file_artboard(file, name_p, nameLength, useDefault);
+                } finally {
+                    unstage(name_p, nameLength);
+                    stackRestore(mark);
+                }
+            },
         },
         'rive_lanes_v1': want('rive_lanes_v1') && {
             'start': (kind, entry, input, inputByteCount, holds, holdCount) => {
@@ -4802,6 +4813,15 @@
             if (ctx.raised !== null) raise();
             return ret;
         })(hostCall(334)),
+        rive_file_artboard: want('rive_file_v1') && ((fn) => (a0, a1, a2, a3) => {
+            if (ctx.vm === 0) released();
+            if (counters.on) counters.hostCalls++;
+            let ret;
+            try { ret = fn(ctx.vm, a0, a1, a2, a3); } catch (error) { fault(error); }
+            if (ctx.hostFault) nestedFault();
+            if (ctx.raised !== null) raise();
+            return ret;
+        })(hostCall(335)),
         rive_lanes_start: want('rive_lanes_v1') && ((fn) => (a0, a1, a2, a3, a4, a5) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4810,7 +4830,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(335)),
+        })(hostCall(336)),
         rive_lanes_state: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4819,7 +4839,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(336)),
+        })(hostCall(337)),
         rive_lanes_failed: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4828,21 +4848,21 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(337)),
+        })(hostCall(338)),
         rive_lanes_stop: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(338)),
+        })(hostCall(339)),
         rive_lanes_release: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(339)),
+        })(hostCall(340)),
         rive_lanes_result: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4851,7 +4871,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(340)),
+        })(hostCall(341)),
         rive_lanes_watch: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4860,7 +4880,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(341)),
+        })(hostCall(342)),
         rive_lanes_wait: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4869,14 +4889,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(342)),
+        })(hostCall(343)),
         rive_lanes_cancel_wait: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(343)),
+        })(hostCall(344)),
         rive_lanes_wait_within: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4885,7 +4905,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(344)),
+        })(hostCall(345)),
         rive_jobs_threads: want('rive_jobs_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4894,7 +4914,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(345)),
+        })(hostCall(346)),
         rive_jobs_join: want('rive_jobs_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4903,7 +4923,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(346)),
+        })(hostCall(347)),
         rive_jobs_join_any: want('rive_jobs_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4912,7 +4932,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(347)),
+        })(hostCall(348)),
         rive_parallel_size: want('rive_parallel_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4921,7 +4941,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(348)),
+        })(hostCall(349)),
         rive_parallel_run: want('rive_parallel_v1') && ((fn) => fn === undefined ? unlinkedImport('rive_parallel_v1', 'run') : (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4930,7 +4950,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(349)),
+        })(hostCall(350)),
         rive_shared_region_create: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4939,7 +4959,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(350)),
+        })(hostCall(351)),
         rive_shared_region_size: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4948,7 +4968,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(351)),
+        })(hostCall(352)),
         rive_shared_region_lock: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4957,14 +4977,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(352)),
+        })(hostCall(353)),
         rive_shared_region_unlock: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(353)),
+        })(hostCall(354)),
         rive_shared_region_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4973,7 +4993,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(354)),
+        })(hostCall(355)),
         rive_shared_region_write: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4982,7 +5002,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(355)),
+        })(hostCall(356)),
         rive_shared_region_poisoned: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4991,7 +5011,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(356)),
+        })(hostCall(357)),
         rive_shared_atomic_load: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5000,7 +5020,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(357)),
+        })(hostCall(358)),
         rive_shared_atomic_store: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5009,7 +5029,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(358)),
+        })(hostCall(359)),
         rive_shared_atomic_add: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5018,7 +5038,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(359)),
+        })(hostCall(360)),
         rive_shared_atomic_cas: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5027,7 +5047,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(360)),
+        })(hostCall(361)),
         rive_shared_ring_create: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5036,7 +5056,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(361)),
+        })(hostCall(362)),
         rive_shared_ring_write: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3, a4) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5045,7 +5065,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(362)),
+        })(hostCall(363)),
         rive_shared_ring_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5054,7 +5074,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(363)),
+        })(hostCall(364)),
         rive_shared_ring_drop: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5063,7 +5083,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(364)),
+        })(hostCall(365)),
         rive_shared_ring_used: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5072,7 +5092,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(365)),
+        })(hostCall(366)),
         rive_shared_ring_signal: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5081,7 +5101,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(366)),
+        })(hostCall(367)),
         rive_shared_snapshot_create: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5090,7 +5110,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(367)),
+        })(hostCall(368)),
         rive_shared_snapshot_publish: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3, a4) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5099,7 +5119,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(368)),
+        })(hostCall(369)),
         rive_shared_snapshot_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5108,7 +5128,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(369)),
+        })(hostCall(370)),
         rive_shared_snapshot_seq: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5117,14 +5137,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(370)),
+        })(hostCall(371)),
         rive_shared_read_done: want('rive_shared_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(371)),
+        })(hostCall(372)),
         rive_shared_signal_create: want('rive_shared_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5133,14 +5153,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(372)),
+        })(hostCall(373)),
         rive_shared_signal_notify: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(373)),
+        })(hostCall(374)),
         rive_shared_signal_seq: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5149,7 +5169,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(374)),
+        })(hostCall(375)),
         rive_shared_blob_create: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5158,7 +5178,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(375)),
+        })(hostCall(376)),
         rive_shared_blob_size: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5167,7 +5187,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(376)),
+        })(hostCall(377)),
         rive_shared_blob_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5176,7 +5196,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(377)),
+        })(hostCall(378)),
         rive_shared_retain: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5185,28 +5205,28 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(378)),
+        })(hostCall(379)),
         rive_shared_release: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(379)),
+        })(hostCall(380)),
         rive_console: want('env') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0, a1, a2); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(380)),
+        })(hostCall(381)),
         rive_trace: want('env') && ((fn) => (a0, a1, a2, a3, a4, a5, a6, a7) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0, a1, a2, a3, a4, a5, a6, a7); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(381)),
+        })(hostCall(382)),
     };
 }
 
diff --git a/src/wasm/web/rive_scripting_pre.js b/src/wasm/web/rive_scripting_pre.js
index 3ebd75e..a8df356 100644
--- a/src/wasm/web/rive_scripting_pre.js
+++ b/src/wasm/web/rive_scripting_pre.js
@@ -1848,6 +1848,17 @@
             },
             'bindable_equal': calls.rive_file_bindable_equal,
             'bindable_identity': calls.rive_file_bindable_identity,
+            'artboard': (file, name, nameLength, useDefault) => {
+                const mark = stackSave();
+                let name_p = 0;
+                try {
+                    name_p = stageIn(name, nameLength);
+                    return calls.rive_file_artboard(file, name_p, nameLength, useDefault);
+                } finally {
+                    unstage(name_p, nameLength);
+                    stackRestore(mark);
+                }
+            },
         },
         'rive_lanes_v1': want('rive_lanes_v1') && {
             'start': (kind, entry, input, inputByteCount, holds, holdCount) => {
@@ -4808,6 +4819,15 @@
             if (ctx.raised !== null) raise();
             return ret;
         })(hostCall(334)),
+        rive_file_artboard: want('rive_file_v1') && ((fn) => (a0, a1, a2, a3) => {
+            if (ctx.vm === 0) released();
+            if (counters.on) counters.hostCalls++;
+            let ret;
+            try { ret = fn(ctx.vm, a0, a1, a2, a3); } catch (error) { fault(error); }
+            if (ctx.hostFault) nestedFault();
+            if (ctx.raised !== null) raise();
+            return ret;
+        })(hostCall(335)),
         rive_lanes_start: want('rive_lanes_v1') && ((fn) => (a0, a1, a2, a3, a4, a5) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4816,7 +4836,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(335)),
+        })(hostCall(336)),
         rive_lanes_state: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4825,7 +4845,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(336)),
+        })(hostCall(337)),
         rive_lanes_failed: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4834,21 +4854,21 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(337)),
+        })(hostCall(338)),
         rive_lanes_stop: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(338)),
+        })(hostCall(339)),
         rive_lanes_release: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(339)),
+        })(hostCall(340)),
         rive_lanes_result: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4857,7 +4877,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(340)),
+        })(hostCall(341)),
         rive_lanes_watch: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4866,7 +4886,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(341)),
+        })(hostCall(342)),
         rive_lanes_wait: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4875,14 +4895,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(342)),
+        })(hostCall(343)),
         rive_lanes_cancel_wait: want('rive_lanes_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(343)),
+        })(hostCall(344)),
         rive_lanes_wait_within: want('rive_lanes_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4891,7 +4911,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(344)),
+        })(hostCall(345)),
         rive_jobs_threads: want('rive_jobs_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4900,7 +4920,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(345)),
+        })(hostCall(346)),
         rive_jobs_join: want('rive_jobs_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4909,7 +4929,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(346)),
+        })(hostCall(347)),
         rive_jobs_join_any: want('rive_jobs_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4918,7 +4938,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(347)),
+        })(hostCall(348)),
         rive_parallel_size: want('rive_parallel_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4927,7 +4947,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(348)),
+        })(hostCall(349)),
         rive_parallel_run: want('rive_parallel_v1') && ((fn) => fn === undefined ? unlinkedImport('rive_parallel_v1', 'run') : (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4936,7 +4956,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(349)),
+        })(hostCall(350)),
         rive_shared_region_create: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4945,7 +4965,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(350)),
+        })(hostCall(351)),
         rive_shared_region_size: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4954,7 +4974,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(351)),
+        })(hostCall(352)),
         rive_shared_region_lock: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4963,14 +4983,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(352)),
+        })(hostCall(353)),
         rive_shared_region_unlock: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(353)),
+        })(hostCall(354)),
         rive_shared_region_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4979,7 +4999,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(354)),
+        })(hostCall(355)),
         rive_shared_region_write: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4988,7 +5008,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(355)),
+        })(hostCall(356)),
         rive_shared_region_poisoned: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -4997,7 +5017,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(356)),
+        })(hostCall(357)),
         rive_shared_atomic_load: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5006,7 +5026,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(357)),
+        })(hostCall(358)),
         rive_shared_atomic_store: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5015,7 +5035,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(358)),
+        })(hostCall(359)),
         rive_shared_atomic_add: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5024,7 +5044,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(359)),
+        })(hostCall(360)),
         rive_shared_atomic_cas: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5033,7 +5053,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(360)),
+        })(hostCall(361)),
         rive_shared_ring_create: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5042,7 +5062,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(361)),
+        })(hostCall(362)),
         rive_shared_ring_write: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3, a4) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5051,7 +5071,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(362)),
+        })(hostCall(363)),
         rive_shared_ring_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5060,7 +5080,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(363)),
+        })(hostCall(364)),
         rive_shared_ring_drop: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5069,7 +5089,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(364)),
+        })(hostCall(365)),
         rive_shared_ring_used: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5078,7 +5098,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(365)),
+        })(hostCall(366)),
         rive_shared_ring_signal: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5087,7 +5107,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(366)),
+        })(hostCall(367)),
         rive_shared_snapshot_create: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5096,7 +5116,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(367)),
+        })(hostCall(368)),
         rive_shared_snapshot_publish: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3, a4) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5105,7 +5125,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(368)),
+        })(hostCall(369)),
         rive_shared_snapshot_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5114,7 +5134,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(369)),
+        })(hostCall(370)),
         rive_shared_snapshot_seq: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5123,14 +5143,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(370)),
+        })(hostCall(371)),
         rive_shared_read_done: want('rive_shared_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(371)),
+        })(hostCall(372)),
         rive_shared_signal_create: want('rive_shared_v1') && ((fn) => () => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5139,14 +5159,14 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(372)),
+        })(hostCall(373)),
         rive_shared_signal_notify: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(373)),
+        })(hostCall(374)),
         rive_shared_signal_seq: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5155,7 +5175,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(374)),
+        })(hostCall(375)),
         rive_shared_blob_create: want('rive_shared_v1') && ((fn) => (a0, a1) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5164,7 +5184,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(375)),
+        })(hostCall(376)),
         rive_shared_blob_size: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5173,7 +5193,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(376)),
+        })(hostCall(377)),
         rive_shared_blob_read: want('rive_shared_v1') && ((fn) => (a0, a1, a2, a3) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5182,7 +5202,7 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(377)),
+        })(hostCall(378)),
         rive_shared_retain: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
@@ -5191,28 +5211,28 @@
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
             return ret;
-        })(hostCall(378)),
+        })(hostCall(379)),
         rive_shared_release: want('rive_shared_v1') && ((fn) => (a0) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(379)),
+        })(hostCall(380)),
         rive_console: want('env') && ((fn) => (a0, a1, a2) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0, a1, a2); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(380)),
+        })(hostCall(381)),
         rive_trace: want('env') && ((fn) => (a0, a1, a2, a3, a4, a5, a6, a7) => {
             if (ctx.vm === 0) released();
             if (counters.on) counters.hostCalls++;
             try { fn(ctx.vm, a0, a1, a2, a3, a4, a5, a6, a7); } catch (error) { fault(error); }
             if (ctx.hostFault) nestedFault();
             if (ctx.raised !== null) raise();
-        })(hostCall(381)),
+        })(hostCall(382)),
     };
 }
 
diff --git a/tests/unit_tests/assets/decoded_game_guest.riv b/tests/unit_tests/assets/decoded_game_guest.riv
new file mode 100644
index 0000000..2bf4374
--- /dev/null
+++ b/tests/unit_tests/assets/decoded_game_guest.riv
Binary files differ
diff --git a/tests/unit_tests/assets/rml/decoded_game_guest.rml b/tests/unit_tests/assets/rml/decoded_game_guest.rml
new file mode 100644
index 0000000..3c3d73a
--- /dev/null
+++ b/tests/unit_tests/assets/rml/decoded_game_guest.rml
@@ -0,0 +1,78 @@
+<Rive version="1" kind="fragment">
+    <!--
+      Source of assets/decoded_game_guest.riv. Rebuild from a directory holding
+      this as scene.rml and a rive.yaml (main: "Game"), then copy
+      build/decoded_game_guest.riv into assets/:
+
+          rive . --unsigned-riv
+
+      Game centres Target, whose fill reads the global Theme.accent; a click
+      on it fires Game's finished. Play moves Ticker right from time zero.
+      Other has no state machine; its Swatch reads the same global.
+    -->
+    <Artboard defaultStateMachineId="0:80" viewModelId="0:60" viewModelInstanceId="0:65"
+              clip="true" width="600" height="600" styleId="0:3" name="Game" id="0:2">
+        <LayoutComponentStyle layoutAlignmentType="center" name="Game Style" id="0:3"/>
+        <LayoutComponent width="200" height="200" styleId="0:11" name="Target" exportName="true" id="0:10">
+            <LayoutComponentStyle name="Target Style" id="0:11"/>
+            <Fill name="Fill" id="0:12">
+                <SolidColor colorValue="FF444444" name="C" id="0:13">
+                    <DataBindContext sourcePathIds="0:70-0:71" propertyKey="37" id="0:14"/>
+                </SolidColor>
+            </Fill>
+        </LayoutComponent>
+        <Node name="Ticker" exportName="true" id="0:20"/>
+        <LinearAnimation duration="60" name="Play" id="0:90">
+            <KeyedObject objectId="0:20">
+                <KeyedProperty propertyKey="13">
+                    <KeyFrameDouble value="0" interpolationType="1"/>
+                    <KeyFrameDouble value="600" interpolationType="1" frame="60"/>
+                </KeyedProperty>
+            </KeyedObject>
+        </LinearAnimation>
+        <StateMachine name="Game Machine" id="0:80">
+            <StateMachineListenerSingle targetId="0:10" listenerTypeValue="click" name="Target Click" id="0:81">
+                <ListenerViewModelChange id="0:82">
+                    <BindablePropertyTrigger propertyValue="1" id="0:83">
+                        <DataBindContext sourcePathIds="0:60-0:62" propertyKey="686" direction="true" id="0:84"/>
+                    </BindablePropertyTrigger>
+                </ListenerViewModelChange>
+            </StateMachineListenerSingle>
+            <StateMachineLayer name="Game Layer" id="0:85">
+                <AnyState x="200" y="-120" id="0:86"/>
+                <ExitState x="400" y="-120" id="0:87"/>
+                <EntryState x="0" y="0" id="0:88">
+                    <StateTransition stateToId="0:89"/>
+                </EntryState>
+                <AnimationState x="160" y="0" animationId="0:90" stateName="Play" id="0:89"/>
+            </StateMachineLayer>
+        </StateMachine>
+    </Artboard>
+
+    <Artboard clip="true" width="300" height="200" name="Other" id="0:30">
+        <Shape x="50" y="50" name="Swatch" exportName="true" id="0:31">
+            <Rectangle width="40" height="40" name="Path" id="0:32"/>
+            <Fill name="Fill" id="0:33">
+                <SolidColor colorValue="FF444444" name="C" id="0:34">
+                    <DataBindContext sourcePathIds="0:70-0:71" propertyKey="37" id="0:35"/>
+                </SolidColor>
+            </Fill>
+        </Shape>
+    </Artboard>
+
+    <ViewModel defaultInstanceId="0:65" name="Game" id="0:60">
+        <ViewModelPropertyNumber name="score" id="0:61"/>
+        <ViewModelPropertyTrigger name="finished" id="0:62"/>
+        <ViewModelInstance exports="true" name="Default" id="0:65">
+            <ViewModelInstanceNumber propertyValue="7" viewModelPropertyId="0:61"/>
+            <ViewModelInstanceTrigger viewModelPropertyId="0:62"/>
+        </ViewModelInstance>
+    </ViewModel>
+
+    <ViewModel viewModelType="global" defaultInstanceId="0:75" name="Theme" id="0:70">
+        <ViewModelPropertyColor name="accent" id="0:71"/>
+        <ViewModelInstance exports="true" name="Default" id="0:75">
+            <ViewModelInstanceColor propertyValue="FF00FF00" viewModelPropertyId="0:71"/>
+        </ViewModelInstance>
+    </ViewModel>
+</Rive>
diff --git a/tests/unit_tests/runtime/decoded_root_test.cpp b/tests/unit_tests/runtime/decoded_root_test.cpp
new file mode 100644
index 0000000..240f946
--- /dev/null
+++ b/tests/unit_tests/runtime/decoded_root_test.cpp
@@ -0,0 +1,374 @@
+#include "catch.hpp"
+#include "rive/animation/state_machine_instance.hpp"
+#include "rive/data_bind/data_context.hpp"
+#include "rive/layout_component.hpp"
+#include "rive/scripted/decoded_file.hpp"
+#include "rive/shapes/paint/solid_color.hpp"
+#include "rive/shapes/shape.hpp"
+#include "rive/viewmodel/viewmodel.hpp"
+#include "rive/viewmodel/viewmodel_instance_color.hpp"
+#include "rive/viewmodel/viewmodel_instance_number.hpp"
+#include "rive/viewmodel/viewmodel_instance_trigger.hpp"
+#include "rive_file_reader.hpp"
+#include "utils/no_op_renderer.hpp"
+
+#include <algorithm>
+#include <type_traits>
+#include <vector>
+
+using namespace rive;
+
+static_assert(std::is_move_constructible<DecodedRoot>::value, "");
+static_assert(!std::is_move_assignable<DecodedRoot>::value, "");
+static_assert(!std::is_copy_constructible<DecodedRoot>::value, "");
+
+namespace
+{
+// Built from assets/rml/decoded_game_guest.rml.
+constexpr const char* kGuest = "assets/decoded_game_guest.riv";
+constexpr uint32_t kGreen = 0xFF00FF00;
+constexpr uint32_t kRed = 0xFFFF0000;
+
+uint32_t fillOf(ArtboardInstance* artboard, const char* name)
+{
+  for (auto* object : artboard->objects())
+  {
+    if (object == nullptr || !object->is<SolidColor>())
+    {
+      continue;
+    }
+    auto* color = object->as<SolidColor>();
+    for (auto* parent = color->parent(); parent != nullptr;
+         parent = parent->parent())
+    {
+      if (parent->name() == name)
+      {
+        return color->colorValue();
+      }
+    }
+  }
+  return 0;
+}
+
+// Paths are per instance, so they tell a watermark's draw from its artboard's.
+class PathRecordingRenderer : public NoOpRenderer
+{
+public:
+  std::vector<RenderPath*> paths;
+  void drawPath(RenderPath* path, RenderPaint*) override
+  {
+    paths.push_back(path);
+  }
+};
+
+std::vector<RenderPath*> drawnBy(Artboard* artboard, bool internal)
+{
+  PathRecordingRenderer renderer;
+  if (internal)
+  {
+    artboard->drawInternal(&renderer);
+  }
+  else
+  {
+    artboard->draw(&renderer);
+  }
+  return renderer.paths;
+}
+
+ViewModelInstanceColor* accentOf(const rcp<ViewModelInstance>& theme)
+{
+  return theme->propertyValue("accent")->as<ViewModelInstanceColor>();
+}
+} // namespace
+
+TEST_CASE(
+    "a decoded root binds its main and its file's globals",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto root = decodedRoot(*file, nullptr);
+  REQUIRE(root.artboard != nullptr);
+  CHECK(root.artboard->name() == "Game");
+  REQUIRE(root.stateMachine != nullptr);
+  REQUIRE(root.viewModel != nullptr);
+  CHECK(root.viewModel->viewModel() == file->viewModel("Game"));
+  CHECK(
+      root.viewModel->propertyValue("score")
+          ->as<ViewModelInstanceNumber>()
+          ->propertyValue() == 7.0f);
+
+  auto theme = root.stateMachine->globalViewModelInstance("Theme");
+  REQUIRE(theme != nullptr);
+  CHECK(theme->viewModel() == file->viewModel("Theme"));
+  CHECK(accentOf(theme)->propertyValue() == kGreen);
+
+  REQUIRE(root.artboard->dataContext() != nullptr);
+  CHECK(root.artboard->dataContext()->parent() == nullptr);
+
+  root.stateMachine->advanceAndApply(0.0f);
+  CHECK(fillOf(root.artboard.get(), "Target") == kGreen);
+}
+
+TEST_CASE(
+    "a decoded root without a state machine still binds its globals",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto root = decodedRoot(*file, "Other");
+  REQUIRE(root.artboard != nullptr);
+  CHECK(root.artboard->name() == "Other");
+  CHECK(root.artboard->width() == 300.0f);
+  CHECK(root.stateMachine == nullptr);
+  CHECK(root.viewModel == nullptr);
+  REQUIRE(root.artboard->globalViewModelInstance("Theme") != nullptr);
+  root.artboard->advance(0.0f);
+  CHECK(fillOf(root.artboard.get(), "Swatch") == kGreen);
+}
+
+TEST_CASE(
+    "decodedRoot answers empty for an artboard the file lacks",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto root = decodedRoot(*file, "Nope");
+  CHECK(root.artboard == nullptr);
+  CHECK(root.stateMachine == nullptr);
+  CHECK(root.viewModel == nullptr);
+}
+
+TEST_CASE(
+    "a decoded root lays out first at the size set before its first "
+    "advance",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto root = decodedRoot(*file, nullptr);
+  REQUIRE(root.artboard != nullptr);
+  auto* target = root.artboard->find<LayoutComponent>("Target");
+  REQUIRE(target != nullptr);
+  // No layout yet at the file's 600x600, which would put Target at 200.
+  CHECK(target->worldTransform().tx() != 200.0f);
+  root.artboard->width(1000.0f);
+  root.artboard->height(620.0f);
+  root.stateMachine->advanceAndApply(0.0f);
+  CHECK(target->worldTransform().tx() == 400.0f);
+  CHECK(target->worldTransform().ty() == 210.0f);
+}
+
+TEST_CASE("decoded roots are independent of each other", "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto a = decodedRoot(*file, nullptr);
+  auto b = decodedRoot(*file, nullptr);
+  REQUIRE(a.artboard != nullptr);
+  REQUIRE(b.artboard != nullptr);
+  CHECK(a.viewModel != b.viewModel);
+  auto themeA = a.stateMachine->globalViewModelInstance("Theme");
+  auto themeB = b.stateMachine->globalViewModelInstance("Theme");
+  REQUIRE(themeA != nullptr);
+  REQUIRE(themeB != nullptr);
+  CHECK(themeA != themeB);
+
+  accentOf(themeA)->propertyValue(kRed);
+  a.viewModel->propertyValue("score")
+      ->as<ViewModelInstanceNumber>()
+      ->propertyValue(1.0f);
+  a.stateMachine->advanceAndApply(0.0f);
+  b.stateMachine->advanceAndApply(0.0f);
+  CHECK(fillOf(a.artboard.get(), "Target") == kRed);
+  CHECK(fillOf(b.artboard.get(), "Target") == kGreen);
+  CHECK(
+      b.viewModel->propertyValue("score")
+          ->as<ViewModelInstanceNumber>()
+          ->propertyValue() == 7.0f);
+}
+
+TEST_CASE("a decoded root's globals are its own file's", "[decoded_root]")
+{
+  // Two loads of one file stand in for a host and the file it decodes.
+  auto host = ReadRiveFile(kGuest);
+  auto guest = ReadRiveFile(kGuest);
+  auto hostRoot = decodedRoot(*host, nullptr);
+  auto guestRoot = decodedRoot(*guest, nullptr);
+  auto hostTheme = hostRoot.stateMachine->globalViewModelInstance("Theme");
+  auto guestTheme = guestRoot.stateMachine->globalViewModelInstance("Theme");
+  REQUIRE(hostTheme != nullptr);
+  REQUIRE(guestTheme != nullptr);
+  CHECK(guestTheme->viewModel() == guest->viewModel("Theme"));
+  CHECK(guestTheme->viewModel() != host->viewModel("Theme"));
+  accentOf(hostTheme)->propertyValue(kRed);
+  hostRoot.stateMachine->advanceAndApply(0.0f);
+  guestRoot.stateMachine->advanceAndApply(0.0f);
+  CHECK(fillOf(guestRoot.artboard.get(), "Target") == kGreen);
+}
+
+TEST_CASE(
+    "decodedRootLike binds only its own file's view model instances",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto other = ReadRiveFile(kGuest);
+  auto first = decodedRoot(*file, "Game");
+  REQUIRE(first.artboard != nullptr);
+
+  // One of the file's own: shared on purpose, globals still separate.
+  auto shared = decodedRootLike(*file, *first.artboard, first.viewModel);
+  REQUIRE(shared.artboard != nullptr);
+  CHECK(shared.artboard->name() == "Game");
+  CHECK(shared.viewModel == first.viewModel);
+  CHECK(
+      shared.stateMachine->globalViewModelInstance("Theme") !=
+      first.stateMachine->globalViewModelInstance("Theme"));
+
+  // Another file's instance gives way to this file's default.
+  auto foreign = other->createDefaultViewModelInstance(
+      other->viewModel("Game"));
+  REQUIRE(foreign != nullptr);
+  auto refused = decodedRootLike(*file, *first.artboard, foreign);
+  REQUIRE(refused.artboard != nullptr);
+  CHECK(refused.viewModel != foreign);
+  CHECK(refused.viewModel->viewModel() == file->viewModel("Game"));
+
+  // An instance of another file's artboard has no source in this one.
+  auto stranger = decodedRoot(*other, "Game");
+  CHECK(
+      decodedRootLike(*file, *stranger.artboard, nullptr).artboard == nullptr);
+}
+
+TEST_CASE("a decoded root keeps its file alive", "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto root = decodedRoot(*file, nullptr);
+  REQUIRE(root.artboard != nullptr);
+  file = nullptr;
+  REQUIRE(root.artboard->file() != nullptr);
+  NoOpRenderer renderer;
+  for (int frame = 0; frame < 3; frame++)
+  {
+    root.stateMachine->advanceAndApply(1.0f / 60.0f);
+    root.artboard->draw(&renderer);
+  }
+  CHECK(fillOf(root.artboard.get(), "Target") == kGreen);
+}
+
+TEST_CASE(
+    "a decoded root fires its finished trigger on its main instance",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  auto root = decodedRoot(*file, nullptr);
+  REQUIRE(root.artboard != nullptr);
+  auto* finished = root.viewModel->propertyValue("finished")
+                       ->as<ViewModelInstanceTrigger>();
+  root.stateMachine->advanceAndApply(0.0f);
+  uint32_t before = finished->propertyValue();
+  root.stateMachine->pointerDown(Vec2D(20.0f, 20.0f));
+  root.stateMachine->pointerUp(Vec2D(20.0f, 20.0f));
+  root.stateMachine->advanceAndApply(0.016f);
+  CHECK(finished->propertyValue() == before);
+  root.stateMachine->pointerDown(Vec2D(300.0f, 300.0f));
+  root.stateMachine->pointerUp(Vec2D(300.0f, 300.0f));
+  root.stateMachine->advanceAndApply(0.016f);
+  CHECK(finished->propertyValue() == before + 1);
+}
+
+TEST_CASE(
+    "a decoded root runs no machine its file does not name as default",
+    "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  // As the CLI player and Artboard inputs: no fallback to the first machine.
+  file->artboard("Game")->defaultStateMachineId(kEmptyId);
+  auto root = decodedRoot(*file, "Game");
+  REQUIRE(root.artboard != nullptr);
+  CHECK(root.artboard->stateMachineCount() == 1);
+  CHECK(root.stateMachine == nullptr);
+  REQUIRE(root.viewModel != nullptr);
+  REQUIRE(root.artboard->globalViewModelInstance("Theme") != nullptr);
+  root.artboard->advance(0.0f);
+  CHECK(fillOf(root.artboard.get(), "Target") == kGreen);
+}
+
+TEST_CASE(
+    "a decoded root of a watermarked file plays from its first frame",
+    "[decoded_root]")
+{
+  struct Deterministic
+  {
+    bool was = File::deterministicMode;
+    Deterministic() { File::deterministicMode = true; }
+    ~Deterministic() { File::deterministicMode = was; }
+  } deterministic;
+  auto file = ReadRiveFile("assets/watermark_playback_test.riv");
+  REQUIRE(file->manifest() != nullptr);
+  REQUIRE(file->manifest()->hasWatermark());
+
+  auto standalone = file->artboardDefault();
+  REQUIRE(standalone->watermark() != nullptr);
+  auto machine = standalone->stateMachineAt(0);
+  REQUIRE(machine != nullptr);
+  machine->advanceAndApply(0.016f);
+  REQUIRE(standalone->watermark()->isPlaying());
+  CHECK(drawnBy(standalone.get(), false) != drawnBy(standalone.get(), true));
+
+  auto first = decodedRoot(*file, nullptr);
+  REQUIRE(first.artboard != nullptr);
+  auto copy = decodedRootLike(*file, *first.artboard, nullptr);
+  REQUIRE(copy.artboard != nullptr);
+  for (auto* root : {&first, &copy})
+  {
+    CHECK(root->artboard->watermark() == nullptr);
+    if (root->stateMachine != nullptr)
+    {
+      root->stateMachine->advanceAndApply(0.016f);
+    }
+    else
+    {
+      root->artboard->advance(0.016f);
+    }
+    auto own = drawnBy(root->artboard.get(), true);
+    REQUIRE(!own.empty());
+    CHECK(drawnBy(root->artboard.get(), false) == own);
+  }
+}
+
+TEST_CASE("decodedRoot matches an artboard's whole name", "[decoded_root]")
+{
+  auto file = ReadRiveFile(kGuest);
+  // A script's string may hold a NUL; the name is all of its bytes.
+  const char name[] = "Game\0Other";
+  CHECK(decodedRoot(*file, name, sizeof(name) - 1).artboard == nullptr);
+  auto game = decodedRoot(*file, name, 4);
+  REQUIRE(game.artboard != nullptr);
+  CHECK(game.artboard->name() == "Game");
+}
+
+TEST_CASE(
+    "decodedRootLike decodes none of the artboards before its own",
+    "[decoded_root]")
+{
+  // Deferred bodies decode from these bytes later, so they outlive import.
+  auto bytes = ReadFile(kGuest);
+  FileImportOptions options;
+  options.deferDecoding = true;
+  // Game, the default artboard, otherwise decodes at import.
+  options.testing_deferDefaultArtboard = true;
+  auto file = File::import(
+      bytes,
+      &gNoOpFactory,
+      nullptr,
+      (FileAssetLoader*)nullptr,
+      nullptr,
+      false,
+      options);
+  REQUIRE(file != nullptr);
+  REQUIRE(file->artboardHeader(0)->name() == "Game");
+  REQUIRE(file->artboardHeader(0)->hasDeferredBody());
+
+  auto other = decodedRoot(*file, "Other");
+  REQUIRE(other.artboard != nullptr);
+  auto copy = decodedRootLike(*file, *other.artboard, nullptr);
+  REQUIRE(copy.artboard != nullptr);
+  CHECK(copy.artboard->name() == "Other");
+  CHECK(file->artboardHeader(0)->hasDeferredBody());
+}
diff --git a/tests/unit_tests/runtime/scripting/scripting_context_test.cpp b/tests/unit_tests/runtime/scripting/scripting_context_test.cpp
index 26b959a..450b857 100644
--- a/tests/unit_tests/runtime/scripting/scripting_context_test.cpp
+++ b/tests/unit_tests/runtime/scripting/scripting_context_test.cpp
@@ -784,9 +784,11 @@
 
   {
     lua_getglobal(L, "testGlobalViewModel");
-    lua_newrive<ScriptedContext>(L, &scriptedObjectTest);
+    auto* context = lua_newrive<ScriptedContext>(L, &scriptedObjectTest);
     CHECK(lua_pcall(L, 1, 0, 0) == LUA_OK);
     CHECK(top == lua_gettop(L));
+    // An init asking before any binding runs again once one arrives.
+    CHECK(context->missingRequestedData());
   }
 
   {
@@ -943,6 +945,54 @@
 }
 
 TEST_CASE(
+    "context:globalViewModel retries init only while nothing is bound",
+    "[scripting]")
+{
+  rive::SerializingFactory silver;
+  auto file = ReadRiveFile("assets/global_variables_test.riv", &silver);
+  REQUIRE(file != nullptr);
+  auto artboard = file->artboardDefault();
+  REQUIRE(artboard != nullptr);
+
+  // Bound, but the file has no global by that name: nil, and init keeps its
+  // result rather than waiting for one that never comes.
+  ScriptedObjectWithFile scriptedObjectWithFile;
+  scriptedObjectWithFile.setFileForScriptAsset(file.get());
+  scriptedObjectWithFile.dataContext(make_rcp<DataContext>(
+      file->createDefaultViewModelInstance(artboard.get())));
+
+  ScriptingTest vm(
+      R"(
+local found = true
+
+function testGlobal(context: Context)
+  found = context:globalViewModel("NoSuchGlobal") ~= nil
+end
+
+function getFound(): boolean
+  return found
+end
+)");
+
+  lua_State* L = vm.state();
+  auto top = lua_gettop(L);
+  {
+    lua_getglobal(L, "testGlobal");
+    auto* context = lua_newrive<ScriptedContext>(L, &scriptedObjectWithFile);
+    CHECK(lua_pcall(L, 1, 0, 0) == LUA_OK);
+    CHECK(top == lua_gettop(L));
+    CHECK_FALSE(context->missingRequestedData());
+  }
+  {
+    lua_getglobal(L, "getFound");
+    CHECK(lua_pcall(L, 0, 1, 0) == LUA_OK);
+    CHECK(lua_toboolean(L, -1) == 0);
+    lua_pop(L, 1);
+    CHECK(top == lua_gettop(L));
+  }
+}
+
+TEST_CASE(
     "context:globalViewModel finds a global in a fully unslotted chain",
     "[scripting]")
 {
diff --git a/tests/unit_tests/runtime/scripting/scripting_decode_file_test.cpp b/tests/unit_tests/runtime/scripting/scripting_decode_file_test.cpp
index 8aa57d1..80699ad 100644
--- a/tests/unit_tests/runtime/scripting/scripting_decode_file_test.cpp
+++ b/tests/unit_tests/runtime/scripting/scripting_decode_file_test.cpp
@@ -12,6 +12,7 @@
 #include "rive/scriptnet/net.hpp"
 #include "rive/viewmodel/viewmodel.hpp"
 #include "rive/viewmodel/viewmodel_instance_artboard.hpp"
+#include "rive/viewmodel/viewmodel_instance_number.hpp"
 #include "utils/serializing_factory.hpp"
 
 #include <cstring>
@@ -768,4 +769,267 @@
   scriptnet::setProvider(nullptr);
 }
 
+namespace
+{
+// Built from assets/rml/decoded_game_guest.rml: Game (default, 600x600) with
+// a machine and the Game view model (score 7), Other (300x200) with neither.
+constexpr const char* kGuestAsset = "assets/decoded_game_guest.riv";
+
+// file:artboard, an artboard of a decoded file the script owns.
+constexpr const char* kOwnScript = R"(
+file = nil
+game = nil
+copy = nil
+anim = nil
+
+function decode(context: Context, bytes: buffer)
+    local status = "unsettled"
+    context:decodeFile(bytes):andThen(function(decoded)
+        file = decoded
+        status = "ok"
+    end, function(reason)
+        status = reason
+    end)
+    return status
+end
+
+local function score(artboard): string
+    local data = artboard.data
+    if data == nil then
+        return "none"
+    end
+    local value = data:getNumber("score")
+    return if value then tostring(value.value) else "noscore"
+end
+
+function own(name)
+    game = if name == "" then file:artboard() else file:artboard(name)
+    if game == nil then
+        return "nil"
+    end
+    return `{game.width} {score(game)}`
+end
+
+function bump()
+    game.data:getNumber("score").value = 1
+    return score(game)
+end
+
+function copyOf(vm)
+    copy = if vm == nil then game:instance() else game:instance(vm)
+    return score(copy)
+end
+
+function copyShared()
+    copy = game:instance(game.data)
+    return score(copy)
+end
+
+function forget()
+    file = nil
+    return nil
+end
+
+function keepAnimation(name)
+    anim = game:animation(name)
+    return if anim == nil then "nil" else "kept"
+end
+
+function stepAnimation()
+    return tostring(anim:advance(0.5))
+end
+
+function nulNames()
+    local name = "Game\0Other"
+    return `{file:artboard("Game") ~= nil} {file:artboard(name) ~= nil} {file:bindableArtboard(name) ~= nil}`
+end
+
+function dropGame()
+    game = nil
+    return nil
+end
+
+function frame(renderer: Renderer, seconds: number)
+    if game then
+        game:advance(seconds)
+        game:draw(renderer)
+    end
+    if copy then
+        copy:advance(seconds)
+        copy:draw(renderer)
+    end
+end
+)";
+
+struct OwnHost
+{
+  ScriptingTest test;
+  ScriptedObjectTest object;
+
+  explicit OwnHost(Factory* factory)
+      : test(kOwnScript, 1, false, {}, true, factory)
+  {}
+
+  lua_State* state() { return test.state(); }
+
+  std::string decode(const std::vector<uint8_t>& bytes)
+  {
+    lua_State* L = state();
+    pushBytes(L, bytes);
+    REQUIRE(callWithContext(L, &object, "decode", 1) == LUA_OK);
+    return popString(L);
+  }
+
+  std::string call(
+      const char* name,
+      const char* arg = nullptr,
+      ViewModelInstance* viewModel = nullptr)
+  {
+    lua_State* L = state();
+    lua_getglobal(L, name);
+    int args = 0;
+    if (arg != nullptr)
+    {
+      lua_pushstring(L, arg);
+      args++;
+    }
+    if (viewModel != nullptr)
+    {
+      lua_newrive<ScriptedViewModel>(
+          L,
+          L,
+          ref_rcp(viewModel->viewModel()),
+          ref_rcp(viewModel));
+      args++;
+    }
+    if (lua_pcall(L, args, 1, 0) != LUA_OK)
+    {
+      std::string error = popString(L);
+      FAIL(error);
+    }
+    return popString(L);
+  }
+
+  void frame(Renderer* renderer, float seconds)
+  {
+    lua_State* L = state();
+    lua_getglobal(L, "frame");
+    auto scripted = lua_newrive<ScriptedRenderer>(L, renderer);
+    lua_pushnumber(L, seconds);
+    if (lua_pcall(L, 2, 0, 0) != LUA_OK)
+    {
+      std::string error = popString(L);
+      FAIL(error);
+    }
+    CHECK(scripted->end());
+  }
+
+  void collect() { lua_gc(state(), LUA_GCCOLLECT, 0); }
+};
+} // namespace
+
+TEST_CASE(
+    "file:artboard gives a script a decoded artboard to own",
+    "[scripting][decode_file]")
+{
+  SerializingFactory factory;
+  OwnHost script(&factory);
+  REQUIRE(script.decode(ReadFile(kGuestAsset)) == "ok");
+  CHECK(script.call("own", "Nope") == "nil");
+  CHECK(script.call("own", "Other") == "300 none");
+  // The default artboard, on the file's default instance of its view model.
+  CHECK(script.call("own", "") == "600 7");
+  CHECK(script.call("bump") == "1");
+  // instance() is another root with an instance of its own.
+  CHECK(script.call("copyOf") == "7");
+}
+
+TEST_CASE(
+    "an owned artboard's instance() binds only its own file's view models",
+    "[scripting][decode_file]")
+{
+  SerializingFactory factory;
+  OwnHost script(&factory);
+  REQUIRE(script.decode(ReadFile(kGuestAsset)) == "ok");
+  REQUIRE(script.call("own", "") == "600 7");
+  REQUIRE(script.call("bump") == "1");
+  // One of the file's own is shared, as passed.
+  CHECK(script.call("copyShared") == "1");
+  // Another file's instance, even of a same-named view model, gives way to
+  // the file's default: it would bind by this file's property ids.
+  auto other = ReadRiveFile(kGuestAsset, &factory);
+  auto foreign = other->createDefaultViewModelInstance(
+      other->viewModel("Game"));
+  REQUIRE(foreign != nullptr);
+  foreign->propertyValue("score")->as<ViewModelInstanceNumber>()->propertyValue(
+      3.0f);
+  CHECK(script.call("copyOf", nullptr, foreign.get()) == "7");
+}
+
+// Run under ASan: the animation plays its artboard, whose file holds its
+// definition, after the script has dropped both.
+TEST_CASE(
+    "an owned artboard's animation keeps the artboard it plays",
+    "[scripting][decode_file]")
+{
+  // The guest's timeline ships without its name, as the editor exports
+  // timelines unless asked; coin.riv predates that and names its animation.
+  constexpr const char* kCoin = "assets/coin.riv";
+  SerializingFactory factory;
+  auto coin = ReadRiveFile(kCoin, &factory);
+  REQUIRE(coin->artboard()->animationCount() > 0);
+  std::string name = coin->artboard()->animation(0)->name();
+  REQUIRE(!name.empty());
+  coin = nullptr;
+
+  OwnHost script(&factory);
+  REQUIRE(script.decode(ReadFile(kCoin)) == "ok");
+  REQUIRE(script.call("own", "") != "nil");
+  REQUIRE(script.call("keepAnimation", name.c_str()) == "kept");
+  script.call("forget");
+  script.call("dropGame");
+  script.collect();
+  for (int i = 0; i < 3; i++)
+  {
+    script.call("stepAnimation");
+  }
+}
+
+TEST_CASE(
+    "a decoded file matches an artboard's whole name, NUL included",
+    "[scripting][decode_file]")
+{
+  SerializingFactory factory;
+  OwnHost script(&factory);
+  REQUIRE(script.decode(ReadFile(kGuestAsset)) == "ok");
+  CHECK(script.call("nulNames") == "true false false");
+}
+
+// Run under ASan: once the script drops the file, the owned artboard and its
+// copy are all that keep it, and the copy outlives the artboard it came from.
+TEST_CASE(
+    "an owned artboard keeps its decoded file alive",
+    "[scripting][decode_file]")
+{
+  SerializingFactory factory;
+  OwnHost script(&factory);
+  REQUIRE(script.decode(ReadFile(kGuestAsset)) == "ok");
+  REQUIRE(script.call("own", "") == "600 7");
+  REQUIRE(script.call("copyOf") == "7");
+  script.call("forget");
+  script.collect();
+  factory.frameSize(600, 600);
+  auto renderer = factory.makeRenderer();
+  for (int i = 0; i < 3; i++)
+  {
+    script.frame(renderer.get(), 0.016f);
+  }
+  script.call("dropGame");
+  script.collect();
+  for (int i = 0; i < 3; i++)
+  {
+    script.frame(renderer.get(), 0.016f);
+  }
+}
+
 #endif