Wip running instances

Adds `"tasksStaged"` and `"tasksRunning"` members to the JSON representation of `AppDefinition`.

Minor housekeeping elsewhere.