I'm looking at the Drupal Commerce module in Drupal 7, and it has a Rule to send an email notification that the order was completed after checkout. Perusing the code in commerce_checkout.rules.inc, the hook_rules_event_info() has a variable of type commerce_order().
How does Rules retrieve the tokens and the $order object? Or how does the Commerce Order module define a variable type to use with Rules?