pub fn assemble_ops(intent: Intent, spec: &SurfaceSpec) -> Vec<AgentMessage>Expand description
Assembles the full operation stream for a surface.
Order is createSurface (create intent only) → updateComponents →
updateDataModel, so the renderer has a surface to attach to, then a tree to
draw, then data to fill it with. Empty components or an absent data model
simply omit that operation.
use ag_ui_a2ui::toolkit::ops::{assemble_ops, Intent, SurfaceSpec};
use ag_ui_a2ui::message::Component;
use serde_json::json;
let spec = SurfaceSpec::new("cart")
.with_components(vec![Component::new("root", "Text").with("text", json!("hi"))]);
assert_eq!(assemble_ops(Intent::Create, &spec).len(), 2);
// Updating an existing surface must not re-create it.
assert_eq!(assemble_ops(Intent::Update, &spec).len(), 1);