Agents can report errors

Also made SqlJobs return full state of job including most recent
contract, which seems to be what we'll always want to see.

Split sql implementations into sub packages to keep things clean.