Skip to content

Whiteboard Intents

WhiteboardIntent derives CommandTool, making each variant both a reduce command and an AI tool. Variants marked #[tool(hidden)] are dispatchable but excluded from AI tool definitions.

Dispatch path from Dart or AI:

session.dispatch(Command::Intent(SessionIntent::Modality(WhiteboardIntent::...)));

These intents manage the template’s property schema — the set of configurable properties that component bindings reference.

IntentParametersPurpose
ListPropertiesList all properties with types and defaults
AddPropertyname, property_type, description?, icon?, default_value?, options?, multiple?, min?, max?, max_length?, expression?Add a new property to the schema
UpdatePropertykey, name?, description?, icon?, default_value?Update an existing property
RemovePropertykeyRemove a property from the schema

Supported property_type values: text, number, boolean, color, date, url, json, select, cloze, formula.

For select type, pass options as comma-separated names and multiple: true for multi-select. For number, pass min/max bounds. For formula, pass a expression (CEL).

These intents manage component instances on the canvas.

IntentParametersPurpose
ListComponentsList available component types (built-in widgets)
ListPlacementsList all placements on the current template
AddPlacementcomponent_id, x?, y?, width?, height?, rotation?, z_index?, bindings?Add a component to the canvas
UpdatePlacementid, x?, y?, width?, height?, rotation?, z_index?, bindings?Update placement position/bindings
RemovePlacementidRemove a placement from the canvas

Default position: (0, 0) at 400x300 with no rotation. Bindings map property keys to PropertyBinding specs.

IntentParametersPurpose
UpdateBindingplacement_id, key, valueUpdate a single binding value on a placement

Typed intents for creating canvas elements from UI gestures.

IntentParametersPurpose
AddPathElementpoints, color, thickness, x, y, width, height, z_index?, is_eraser?Freehand drawing path
AddShapeElementshape_type, color, x, y, width, height, z_index?Geometric shape (rect, circle, triangle, line)
AddTextElementx, y, width?, height?, z_index?Text box at position
IntentParametersPurpose
MoveElementsids, dx, dyMove elements by delta offset
RemoveElementsidsRemove multiple elements
ResizeElementid, x, y, width, heightResize element, rescaling path points
ReorderElementid, actionChange z-ordering (ZAction)

Typed updates for element-specific visual properties.

IntentParametersHiddenPurpose
UpdatePathPropertiesid, color?, thickness?, is_eraser?NoPath stroke properties
UpdateShapePropertiesid, shape_type?, fill?, color?, stroke_color?, stroke_width?, start_arrow?, end_arrow?, rotation?NoShape visual properties
UpdateTextContentid, prose_bytesYesLoro prose document bytes
UpdateTextPropertiesid, font_family?, text_align?NoText formatting
UpdateFilePropertiesid, url?, file_type?, thumbnail_url?, file_name?, rotation?YesFile element metadata
UpdateUrlPropertiesid, url_type?, url?, title?, description?, thumbnail_url?YesURL element metadata
UpdateGeogebraPropertiesid, geogebra_type?, material_id?, commands?YesGeoGebra applet config
UpdateMaskPropertiesid, image_url?, mask_path?YesMask element properties

These intents manage UI-only state and are hidden from AI tools.

IntentParametersPurpose
SelectTooltool: ToolTypeSet active drawing tool
SetToolColorcolor: ColorSet pen/shape stroke color
SetToolThicknessthickness: f64Set pen stroke thickness
SetToolShapeTypeshape_type: ShapeTypeSet default shape type
SetToolFontFamilyfont_family: TextFontFamilySet default font family
SelectElementsids: Vec<String>Select elements by placement ID
DeselectAllClear selection
SetCanvaszoom?, pan_x?, pan_y?, width?, height?Update viewport

These intents support inline text editing via embedded Prose reducers (the Embedded Prose RFC).

IntentParametersPurpose
FocusTextEditorid: Option<String>Focus a text element for inline editing, or None to unfocus
TextEditid, intent: ProseIntentDispatch a prose intent to an embedded text element’s editor
IntentPurpose
RecompileForce recompilation of all placements
IntentParametersPurpose
ClearAllRemove all placements from the whiteboard
UpdateNamenameUpdate whiteboard name
UpdateDescriptiondescription?Update or clear description

Intent handlers emit structured output via fx.services().agent.tool_output() for the AI bridge:

pub struct PropertyListOutput {
pub properties: Vec<PropertyInfo>,
}
pub struct MutationOutput {
pub ok: bool,
pub id: Option<String>,
pub message: Option<String>,
}
  • Overview — struct, types, compilation flow
  • Components — the WhiteboardComponent subtrait
  • Command — the universal envelope wrapping intents
  • Bridge — how intents become AI tools