feat: persistent chat history with clear button

- Add dashboard/store.py: MessageLog dataclass singleton tracking
  user/agent/error messages for the lifetime of the server process
- agents.py: write each chat turn to MessageLog; add GET and DELETE
  /agents/timmy/history routes returning the history.html partial
- partials/history.html: render stored messages by role (YOU / TIMMY /
  SYSTEM); falls back to the Mission Control init message when empty
- index.html: chat-log loads history via hx-get on page start; new
  CLEAR button in panel header sends hx-delete to reset the log
- style.css: add .mc-btn-clear (muted, red-on-hover for the header)
- tests: autouse reset_message_log fixture in conftest; 5 new history
  tests covering empty state, recording, offline errors, clear, and
  post-clear state → 32 tests total, all passing

https://claude.ai/code/session_01KZMfwBpLuiv6x9GbzTqbys
This commit is contained in:
Claude
2026-02-20 14:00:16 +00:00
parent c9ac2d9d17
commit 0d14be291a
7 changed files with 173 additions and 7 deletions

View File

@@ -46,15 +46,20 @@
<!-- Chat Panel -->
<div class="col-12 col-md-9 d-flex flex-column mc-chat-panel">
<div class="card mc-panel flex-grow-1 d-flex flex-column min-h-0">
<div class="card-header mc-panel-header">// TIMMY INTERFACE</div>
<div class="chat-log flex-grow-1 overflow-auto p-3" id="chat-log">
<div class="chat-message agent">
<div class="msg-meta">TIMMY // SYSTEM</div>
<div class="msg-body">Mission Control initialized. Timmy ready — awaiting input.</div>
</div>
<div class="card-header mc-panel-header d-flex justify-content-between align-items-center">
<span>// TIMMY INTERFACE</span>
<button class="mc-btn-clear"
hx-delete="/agents/timmy/history"
hx-target="#chat-log"
hx-swap="innerHTML"
hx-confirm="Clear conversation history?">CLEAR</button>
</div>
<div class="chat-log flex-grow-1 overflow-auto p-3" id="chat-log"
hx-get="/agents/timmy/history"
hx-trigger="load"
hx-swap="innerHTML"></div>
<div class="card-footer mc-chat-footer">
<form hx-post="/agents/timmy/chat"
hx-target="#chat-log"