Every composer's live draft (text, tags, uploaded files) and its Save-as-draft shelf now live on the hub (backend drafts/, /api/drafts, per user — guests too), synced over SSE: a prompt started on the phone is waiting at the desk. The home composer keeps one draft per profile (spawn:<profileId>), each reply box its own (resume:<sid>). A change made on another device is taken in only while the composer isn't being typed in (@gabvdl/ui 0.47 draftStore). /drafts (Files → Drafts with the profile switch; a guest's Me → Drafts) lists the unsent prompts and saved drafts — Open puts one back in its composer, Copy, Delete with undo. The old localStorage drafts are imported once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
596 B
Python
25 lines
596 B
Python
"""Composer drafts kept on the server (``backend/drafts/``)."""
|
|
from __future__ import annotations
|
|
|
|
from .base import Schema
|
|
|
|
__all__ = [
|
|
"DraftRecord",
|
|
"DraftsResponse",
|
|
]
|
|
|
|
|
|
class DraftRecord(Schema):
|
|
"""One stored draft: ``key`` = ``draft:<draftKey>`` (the live draft) or
|
|
``drafts:<draftKey>`` (the saved-drafts shelf); ``value`` = the composer's
|
|
JSON string; ``updatedAt`` = epoch ms (server clock); ``device`` = the tab
|
|
that wrote it."""
|
|
key: str
|
|
value: str
|
|
updatedAt: int
|
|
device: str = ""
|
|
|
|
|
|
class DraftsResponse(Schema):
|
|
drafts: list[DraftRecord]
|