also looking at this
feat: let a text switch one thread between Claude and Codex
#52
16 files
+316
-27
| @@ -37,7 +37,7 @@ export interface RunRow extends RunRecord { | ||
| 37 | 37 | * old it is, and so the day a change needs more than a new column - a backfill, |
| 38 | 38 | * a rename - has a version to key off. |
| 39 | 39 | */ |
| 40 | const SCHEMA_VERSION = 1 | |
| 40 | const SCHEMA_VERSION = 2 | |
| 41 | 41 | |
| 42 | 42 | export interface TableSpec { |
| 43 | 43 | name: string |
| @@ -78,6 +78,7 @@ export const TABLES: TableSpec[] = [ | ||
| 78 | 78 | cwd: 'TEXT', |
| 79 | 79 | last_active_at: 'INTEGER', |
| 80 | 80 | more_text: 'TEXT', |
| 81 | engine: 'TEXT', | |
| 81 | 82 | }, |
| 82 | 83 | }, |
| 83 | 84 | { |
| @@ -97,6 +98,7 @@ export const TABLES: TableSpec[] = [ | ||
| 97 | 98 | last_activity: 'TEXT', |
| 98 | 99 | started_at: 'INTEGER', |
| 99 | 100 | finished_at: 'INTEGER', |
| 101 | engine: 'TEXT', | |
| 100 | 102 | }, |
| 101 | 103 | }, |
| 102 | 104 | ] |
| @@ -115,6 +117,7 @@ export const RUN_COLUMNS: Record<keyof RunRecord, string> = { | ||
| 115 | 117 | lastActivity: 'last_activity', |
| 116 | 118 | startedAt: 'started_at', |
| 117 | 119 | finishedAt: 'finished_at', |
| 120 | engine: 'engine', | |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | /** |
| @@ -236,17 +239,19 @@ export class SqliteStore implements Store { | ||
| 236 | 239 | cwd: row.cwd, |
| 237 | 240 | lastActiveAt: row.last_active_at, |
| 238 | 241 | moreText: row.more_text, |
| 242 | engine: row.engine, | |
| 239 | 243 | } |
| 240 | 244 | } |
| 241 | 245 | |
| 242 | 246 | async saveConversation(c: ConversationRecord): Promise<void> { |
| 243 | 247 | this.db.query(` |
| 244 | INSERT INTO conversations (chat_guid, handle, service, session_id, cwd, last_active_at, more_text) | |
| 245 | VALUES (?, ?, ?, ?, ?, ?, ?) | |
| 248 | INSERT INTO conversations (chat_guid, handle, service, session_id, cwd, last_active_at, more_text, engine) | |
| 249 | VALUES (?, ?, ?, ?, ?, ?, ?, ?) | |
| 246 | 250 | ON CONFLICT(chat_guid) DO UPDATE SET |
| 247 | 251 | handle = excluded.handle, service = excluded.service, session_id = excluded.session_id, |
| 248 | cwd = excluded.cwd, last_active_at = excluded.last_active_at, more_text = excluded.more_text | |
| 249 | `).run(c.chatGuid, c.handle, c.service, c.sessionId, c.cwd, c.lastActiveAt, c.moreText) | |
| 252 | cwd = excluded.cwd, last_active_at = excluded.last_active_at, more_text = excluded.more_text, | |
| 253 | engine = excluded.engine | |
| 254 | `).run(c.chatGuid, c.handle, c.service, c.sessionId, c.cwd, c.lastActiveAt, c.moreText, c.engine) | |
| 250 | 255 | } |
| 251 | 256 | |
| 252 | 257 | async createRun(run: RunRecord): Promise<number> { |
| @@ -283,6 +288,7 @@ export class SqliteStore implements Store { | ||
| 283 | 288 | lastActivity: row.last_activity, |
| 284 | 289 | startedAt: row.started_at, |
| 285 | 290 | finishedAt: row.finished_at, |
| 291 | engine: row.engine, | |
| 286 | 292 | })) |
| 287 | 293 | } |
| 288 | 294 | } |