diff --git a/chat/state/manual_edit.py b/chat/state/manual_edit.py index 3bfff79..049b4ca 100644 --- a/chat/state/manual_edit.py +++ b/chat/state/manual_edit.py @@ -30,6 +30,20 @@ T72.3 adds a per-flag witness toggle: ``{"flag": "you"|"host"|"guest", "value": 0|1}`` and ``prior_value`` mirrors the same shape so an inverse edit can restore the flag. +T98.3 adds a hide-from-view toggle: +- ``turn_hidden`` — flip ``event_log.hidden`` on a single turn row. + Hidden turns are filtered by ``read_recent_dialogue`` (see + :mod:`chat.services.turn_common`) so they vanish from the prompt + without being deleted from the log. ``target_id`` is the integer + ``event_log.id`` of the turn; ``new_value`` is ``{"hidden": 0|1}`` + and ``prior_value`` mirrors the shape so an inverse edit restores it. + +T98.5 finishes the v1 drawer surface with two chat-scope text edits: +- ``chat_narrative_anchor`` and ``chat_weather`` — string overwrites of + the matching ``chat_state`` columns. ``target_id`` is the chat id + (``chats.id``); ``new_value`` is the new string and ``prior_value`` + carries the previous content for §6.4 reversibility. + Pin toggles intentionally use the existing ``memory_pin_changed`` event (registered in :mod:`chat.state.memory`) rather than ``manual_edit`` so the projection writes both ``pinned`` and ``auto_pinned`` atomically. @@ -138,5 +152,29 @@ def _apply_manual_edit(conn: Connection, e: Event) -> None: f"UPDATE memories SET witness_{flag} = ? WHERE id = ?", (1 if int(new_value["value"]) else 0, int(target_id)), ) + elif kind == "turn_hidden": + # T98.3: hide-from-view toggle on a turn (event_log row). Sets + # ``event_log.hidden`` so :func:`read_recent_dialogue` (which + # filters ``hidden = 0``) drops the row from the prompt window + # without deleting it from the log. ``new_value`` is + # ``{"hidden": 0|1}``. + hidden_int = 1 if int(new_value.get("hidden", 0)) else 0 + conn.execute( + "UPDATE event_log SET hidden = ? WHERE id = ?", + (hidden_int, int(target_id)), + ) + elif kind == "chat_narrative_anchor": + # T98.5: string overwrite of ``chat_state.narrative_anchor`` for + # the chat keyed by ``target_id``. + conn.execute( + "UPDATE chat_state SET narrative_anchor = ? WHERE chat_id = ?", + (str(new_value), str(target_id)), + ) + elif kind == "chat_weather": + # T98.5: string overwrite of ``chat_state.weather``. + conn.execute( + "UPDATE chat_state SET weather = ? WHERE chat_id = ?", + (str(new_value), str(target_id)), + ) # Unknown target_kind: silently no-op for v1. Future kinds (activity # fields, etc.) extend the dispatch above. diff --git a/chat/templates/_drawer.html b/chat/templates/_drawer.html index 43a659a..8cfdd5f 100644 --- a/chat/templates/_drawer.html +++ b/chat/templates/_drawer.html @@ -16,6 +16,26 @@
No active container.
{% endif %}Time: {{ chat.time }}
+ + {% if scene %}