Fix activity record persistence, created_at type, and segment accumulation
Three bugs silently broke the activity agent pipeline after the segment-sense
rewrite (Apr 3):
1. Persistence gap: completed activity records were never written to disk
because dream.py never called append_activity_record(). Added persistence
in both the main path (before run_activity_prompts) and idle path. Only
records with a matching ended change in the current update are persisted,
avoiding orphaned writes from the cumulative completed list.
2. created_at type: _make_completed_record() emitted created_at as an ISO
string, but routes.py and all consumers expect integer milliseconds.
Changed to int(time.time() * 1000).
3. Segment accumulation: completed records only included the first segment.
Added _segments tracking throughout the activity lifecycle so completed
records include every segment the activity spanned.