diff mrjunejune/conversation_store.h @ 260:1f9877b637e9

Add Copilot-powered cyberpunk JRPG chat Integrate the production JRPG chat with Seobeo streaming, Deita persistence, and a Bazel-managed Copilot SDK and LiteLLM inference stack. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Wed, 05 Aug 2026 09:19:41 -0700
parents
children 04fee26ecce0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mrjunejune/conversation_store.h	Wed Aug 05 09:19:41 2026 -0700
@@ -0,0 +1,84 @@
+#ifndef MRJUNEJUNE_CONVERSATION_STORE_H
+#define MRJUNEJUNE_CONVERSATION_STORE_H
+
+#include "dowa/dowa.h"
+
+typedef struct Conversation_Store Conversation_Store;
+
+typedef enum {
+  CONVERSATION_STORE_ERROR = -1,
+  CONVERSATION_STORE_OK = 0,
+  CONVERSATION_STORE_NOT_FOUND = 1,
+  CONVERSATION_STORE_CONFLICT = 2,
+} Conversation_Store_Result;
+
+typedef struct {
+  int64 id;
+  int64 sequence;
+  char *role;
+  char *content;
+  char *status;
+  char *request_id;
+  char *error_message;
+  int64 input_tokens;
+  int64 output_tokens;
+  int64 created_at;
+  int64 completed_at;
+} Conversation_Turn;
+
+typedef struct {
+  char *id;
+  char *copilot_session_id;
+  char *title;
+  char *status;
+  int64 created_at;
+  int64 updated_at;
+  Conversation_Turn *turns;
+} Conversation_Record;
+
+Conversation_Store *Conversation_Store_Create(const char *database_path);
+void Conversation_Store_Destroy(Conversation_Store *p_store);
+boolean Conversation_Store_Generate_UUID(char output[37]);
+
+Conversation_Store_Result Conversation_Store_Create_Conversation(
+    Conversation_Store *p_store,
+    const char *title,
+    char output_id[37]);
+
+Conversation_Store_Result Conversation_Store_Get(
+    Conversation_Store *p_store,
+    const char *conversation_id,
+    Conversation_Record *p_record,
+    Dowa_Arena *p_arena);
+
+Conversation_Store_Result Conversation_Store_Update_Title(
+    Conversation_Store *p_store,
+    const char *conversation_id,
+    const char *title);
+
+Conversation_Store_Result Conversation_Store_Delete(
+    Conversation_Store *p_store,
+    const char *conversation_id);
+
+Conversation_Store_Result Conversation_Store_Begin_Turn(
+    Conversation_Store *p_store,
+    const char *conversation_id,
+    const char *request_id,
+    const char *prompt);
+
+Conversation_Store_Result Conversation_Store_Complete_Turn(
+    Conversation_Store *p_store,
+    const char *conversation_id,
+    const char *request_id,
+    const char *content,
+    int64 input_tokens,
+    int64 output_tokens);
+
+Conversation_Store_Result Conversation_Store_Fail_Turn(
+    Conversation_Store *p_store,
+    const char *conversation_id,
+    const char *request_id,
+    const char *error_message,
+    boolean aborted);
+
+#endif