Comet, Comet on the Wall: Fix comets sent down via AJAX from within a comet

This fixes a few issues:
 - We centralize comet command generation into `S.jsToAppend`.
 - We fix when we look up `S.jsToAppend` during AJAX processing in comet contexts so we don't miss anything that might be added during the actual AJAX function execution.
 - We make sure not to trigger a second comet request when setting up new comets client-side from within a comet response.

Fixes issue #1645 .
Maybe as part of some future cleanup pass. Though tbh `nodeSeqFunc` isn't quite right (this is specifically `NodeSeq` to `NodeSeq`) and the difference is small enough, especially when tucked into an implicit which will never be explicitly invoked, that it's not really a big deal IMO.