Save Service

app.services.save_service contains save orchestration helpers used by the save router.

Save/export orchestration helpers for the character-description page.

This module contains the filesystem-writing logic that was previously embedded in the POST /api/save route handler. The route layer now owns HTTP concerns, while this module owns deterministic save-folder creation and file generation.

app.services.save_service.save_run(req, data_dir)[source]

Persist all session state to individual files inside a new subfolder of data_dir and return the resulting SaveResponse.

The implementation intentionally mirrors the previous app.main.save_run behavior so the save format, provenance hashes, and conditional files stay byte-for-byte compatible with the pre-refactor endpoint.