feat: add /persona_chat endpoints for open chat with persona

- PersonaChatSession dispatches turns through the shared agent loop,
  persisting transcripts keyed on (user_id, persona_id) in the new
  persona_chat table (migration included).
- GET /persona_chat/history returns a rendered transcript (tool
  invocations folded, is_initial flag) matching the file-chat shape.
- POST /persona_chat/turn returns 202 with a turn_id; SSE replay and
  cancel reuse turn_replay_impl/cancel_turn_impl, extracted from the
  actix-attributed handlers so both route families share the logic.
- POST /persona_chat/reset clears the persona transcript.
- Concurrent dispatches for the same (user, persona) are rejected with
  409 via an in-flight gate (InFlightPersonaTurns) whose RAII guard
  drops with the spawned turn task, freeing the slot on completion,
  error, or abort.
This commit is contained in:
Cameron Cordes committed 2026-08-24 21:25:48 -04:00
1 parent 649863a700
commit 3b9d985025
11 files changed
+1716 -179

No files matched your search

+11
View File
@@ -171,6 +171,16 @@ diesel::table! {
}
}
diesel::table! {
persona_chat_conversations (user_id, persona_id) {
user_id -> Integer,
persona_id -> Text,
messages_json -> Text,
turn_count -> Integer,
updated_at -> BigInt,
}
}
diesel::table! {
personas (id) {
id -> Integer,
@@ -345,6 +355,7 @@ diesel::allow_tables_to_appear_in_same_query!(
insight_generation_jobs,
libraries,
location_history,
persona_chat_conversations,
personas,
persons,
photo_insights,