Capture the input context snapshot on the monitor io record

This commit is contained in:
Dennis Kobert
2026-08-06 09:37:24 +00:00
parent daf3f25d21
commit 612afb7ebb
5 changed files with 40 additions and 19 deletions

View File

@@ -145,14 +145,15 @@ impl DynamicExecutor {
}
/// Calls the `Node::serialize` for that specific node, returning for example the cached value for a monitor node. The node path must match the document node path.
/// A record capture materializes its element here against the arena,
/// inside the introspection window, so consumers downcast the element
/// type directly.
/// A monitor's record capture materializes its element here against the
/// arena, inside the introspection window, so consumers downcast the
/// element type directly. The captured input context stays on the
/// serialized io record for consumers that need it.
pub fn introspect(&self, node_path: &[NodeId]) -> Result<Arc<dyn std::any::Any + Send + Sync + 'static>, IntrospectError> {
let result = self.tree.introspect(node_path)?;
if let Some(capture) = result.downcast_ref::<core_types::record::RecordCapture>() {
if let Some(io) = result.downcast_ref::<core_types::memo::IORecord<core_types::context::CtxSnapshot, core_types::record::RecordCapture>>() {
let arena = self.arena.lock().unwrap_or_else(PoisonError::into_inner);
return capture.materialize_element(&arena).map(Arc::from).ok_or(IntrospectError::NoData);
return io.output.materialize_element(&arena).map(Arc::from).ok_or(IntrospectError::NoData);
}
Ok(result)
}