    :enabled?         true
    :action           action})
 
+(defn -is-action-event?
+  [x]
+  (and (map? x)
+       (= (set (keys x)) #{:id :source-signal-id :enabled? :action})))
+
 (defn -update-actions*
   "model must be immutable."
   [model pred f & args]

                       :background-color "#2A2F3A"
                       :padding-left     "5px"
                       :color            "white"}}
     [:header>h3 "devtools log"]
     [:div
      (doall
        (for [[signal-id signal] (reverse (:signals @dev-model))]
          ^{:key signal-id}
          [:div
           "➙ "
           (if (coll? signal)
             [:span [:strong (pr-str (first signal))] " " (clojure.string/join " " (rest signal))]
             [:span [:strong (pr-str signal)]])

           (for [{:keys [id enabled? action]} (filter #(= (:source-signal-id %) signal-id)
                                                      (:actions @dev-model))]
             ^{:key id}
             [:div {:style {:margin-left "10px"
                            :color       (if enabled? "inherit" "grey")}}
              "⇣"
              [:button {:style    {:cursor          "pointer"
                                   :text-decoration "underline"}
                        :on-click #(-toggle-action dev-model id)}
               (if enabled? "OFF" "ON")]

              (if (coll? action)
                [:div
                 [:strong (pr-str (first action))] " " (clojure.string/join " " (rest action))]
                [:div>strong (pr-str action)])])]))]
     [:strong "initial model:"]
     [:div (pr-str (:initial-model @dev-model))]]))


  [model id f & args]
  (apply -update-actions* model #(= (:id %) id) f args))

(defn -reset-model-to-initial-state
  "dev-model must be a ratom. Sends special devtools action understood by wrapped reconciler."
  [dev-model]
  ((:dispatch-action @dev-model) :-reset-model))

(defn -replay
  "dev-model must be a ratom. Replays all the enabled actions from the initial model."
  [dev-model]
  (-reset-model-to-initial-state dev-model)

  (let [actions (:actions @dev-model)]
    (swap! dev-model assoc :actions (list))
    (doseq [action actions]
      (if (:enabled? action)
        ((:dispatch-action @dev-model) action)
        (swap! dev-model update :actions concat [action])))))

(defn -toggle-action
  "dev-model is a ratom."
  [dev-model id]
  (swap! dev-model -update-action id update :enabled? not)
  (-replay dev-model))

(defn -devtools-view
  "dev-model must be a ratom."
