pub fn write_session_state(
filestore: &FileStore,
definition_id: &str,
content: &[u8],
) -> Result<(), String>Expand description
Write content to output.state.json in agent:<defId>:current.
Idempotent — creates the file if missing, overwrites otherwise.
The per-channel write is primary (preserving all existing same-channel
behaviour); the snapshot overlay is additionally mirrored into the GLOBAL
transcript store (when installed) so a cross-channel open — and the
migrated-agent backfill — find a coherent zone (overlay + output
together). Mirroring is best-effort: a global-store failure is logged, never
propagated. See docs/analysis/ANALYSIS_CROSS_CHANNEL_CONVERSATION_HISTORY_2026_06_14.md.