Skip to content

Lesson Plan Children

LessonPlan is the only current parent modality. It implements the HasChildren trait, managing child whiteboard sessions via the Slot container.

impl HasChildren for LessonPlan {
type ChildModality = Whiteboard;
type ChildSessionIntent = SessionIntent<WhiteboardIntent>;
fn children(&self) -> &HashMap<String, Slot<
Session<Whiteboard, SessionIntent<WhiteboardIntent>>,
Vec<WhiteboardElement>,
>> { &self.children }
fn children_mut(&mut self) -> &mut HashMap<...> { &mut self.children }
fn selected_child_id(&self) -> Option<&str> {
// returns the currently focused slide ID
}
fn reconcile_children(&mut self) {
// create Cold slots for new placements, remove stale ones
}
}

reconcile_children() is called inside the ReduceIntent impl after modality reduce, before the lifecycle runs.

All children start Cold when the session opens. The Slot enum manages the transition:

pub enum Slot<C, O> {
Cold(O), // cached compiled output, no recompilation
Hot(C), // full component (Session), can recompile
}
  1. Open — all children start Cold (cached output from parent’s synced state or empty).
  2. Navigate — Dart dispatches ParentSessionIntent::WarmChild { id }.
  3. LoadWarmChild spawns fx.spawn(backend.load) which returns ParentSessionFeedback::ChildWarmed { id, bytes }.
  4. Hot — a full Session<Whiteboard, SessionIntent<WhiteboardIntent>> is created from the loaded bytes and inserted into the slot.
  5. Dispatch — child intents arrive via ParentSessionIntent::Child { id, intent }, which calls child_session.dispatch().
  6. Close — session persists children internally (Hot sessions export their docs).

Dispatching to a Cold slot is an error — the child must be warmed first.

Each Hot child session has its own SessionEphemeral (its own AI state). During AI generation:

  1. Parent warms child: WarmChild { id } —> backend load —> ChildWarmed
  2. Parent dispatches to child: Child { id, intent: SessionIntent::Ai(SendMessage) }
  3. Child runs its own reduce cycle independently
  4. Parent recompiles after child completes
  • Overview — struct, types, compilation, parent dispatch
  • Whiteboard — the child modality embedded in each slide
  • Slot — the hot/cold container
  • Children — session-level children reference