@vizij/runtime-react 0.0.14 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,6 +73,10 @@ function RuntimeHud() {
73
73
 
74
74
  The provider creates a renderer store, boots the orchestrator, registers the supplied bundle, then renders the face once bounds are available.
75
75
 
76
+ ### Sharing one orchestrator across multiple faces
77
+
78
+ Wrap your app in a single `<OrchestratorProvider>` and give each `VizijRuntimeProvider` a unique `namespace`. The runtime will automatically reuse a parent orchestrator provider (instead of spinning up one per face), prefix graph inputs/outputs with that namespace inside the wasm blackboard, and strip the prefix again before values reach the renderer store. Set `orchestratorScope="shared"` when you want to enforce reuse; leave it at the default `"auto"` to reuse when available and fall back to an isolated provider otherwise.
79
+
76
80
  ## Asset Bundle Anatomy
77
81
 
78
82
  `VizijRuntimeProvider` expects a `VizijAssetBundle`:
@@ -93,10 +97,14 @@ Namespace defaults to `assetBundle.namespace ?? "default"`. Face id falls back t
93
97
  - `namespace` / `faceId`: override bundle values to reuse the same assets under multiple namespaces or faces.
94
98
  - `autoCreate` + `createOptions`: forwarded to `OrchestratorProvider`. Leave `autoCreate` enabled unless you need manual control over WASM creation.
95
99
  - `autostart`: when true, the orchestrator starts ticking as soon as assets register.
100
+ - `driveOrchestrator`: defaults to `true`. In shared orchestrator setups, set this to `false` on non-driver runtimes so only one loop calls `stepRuntime` while others continue to stage inputs/animations.
96
101
  - `mergeStrategy`: orchestrator merge strategy, defaults to additive for outputs/intermediate values.
102
+ - `orchestratorScope`: control orchestrator reuse. `"auto"` (default) reuses a parent `OrchestratorProvider` when present, `"shared"` requires one, and `"isolated"` always spins up a dedicated instance.
97
103
  - `onRegisterControllers(ids)`: observe graph and animation controller ids that were registered.
98
104
  - `onStatusChange(status)`: gets every status update (loading events, errors, controller updates).
99
105
 
106
+ Inputs are staged in a per-frame buffer and flushed together before each `step()`, minimizing wasm boundary crossings even when multiple drivers write in the same tick.
107
+
100
108
  The provider exposes context via `useVizijRuntime()` once `loading` flips to `false`.
101
109
 
102
110
  ## Hooks and Helpers
@@ -104,7 +112,7 @@ The provider exposes context via `useVizijRuntime()` once `loading` flips to `fa
104
112
  - `useVizijRuntime()`: returns the full runtime context (status, setters, animation helpers, and the original asset bundle). Common properties:
105
113
  - `loading`, `ready`, `error`, `errors`: lifecycle state.
106
114
  - `namespace`, `faceId`, `rootId`: resolved IDs the renderer/orchestrator share.
107
- - `outputPaths`: list of output signal paths detected in the registered graphs.
115
+ - `outputPaths`: namespaced output signal paths detected in the registered graphs (matches orchestrator write keys).
108
116
  - `controllers`: `{ graphs, anims }` that were installed.
109
117
  - `setInput(path, value)`, `setValue(id, namespace, value)`: talk directly to the orchestrator or renderer store.
110
118
  - `stagePoseNeutral(force)`: restore the neutral pose captured at export.