server: reconcile ai_sessions persistence to Chunk 9 AISession shape

Reshape the ai_sessions table (migration 003) and mapping/routes to the
full AISession contract: title, kind, notes, created_at, last_message_at;
drop legacy role/model/settings. toAISession now maps the new columns and
routes create/patch/messages handlers use the new shape.
This commit is contained in:
Schwitzz
2026-10-29 15:03:32 -05:00
parent fc8eaa86c3
commit a1b5587fcb
15 changed files with 181 additions and 60 deletions
+3 -2
View File
@@ -24,7 +24,7 @@ import type {
} from "@pubscript/core";
/** A persisted session row. */
interface SessionRow {
export interface SessionRow {
id: string;
projectId: string;
title: string;
@@ -76,7 +76,8 @@ export function createIndexedDBPersistence(dbName = "pubscript"): AISessionPersi
return table.where("projectId").equals(projectId).sortBy("updatedAt").then((rows) => rows.reverse());
},
async get(id: string) {
return table.get(id) ?? null;
const row = await table.get(id);
return row ?? null;
},
async save(row: SessionRow) {
await table.put(row);