"""Service layer for the novel app. Pure functions — no Flask imports. LLM access, book deconstruction (拆书), and chapter writing with context assembly. All DB access goes through explicit sqlite3 connections (row_factory=sqlite3.Row) and repository functions. SSE framing helpers live here for use by routes/. """