ReviewOS

also looking at this

stacks/uplink

feat: let a text switch one thread between Claude and Codex

#52
Merged glennmichael123 wants to merge feat/per-thread-engine into main
16 files +316 -27
app/Uplink/sqlite-store.tsmodified+11-5
Changes to app/Uplink/sqlite-store.ts
@@ -37,7 +37,7 @@ export interface RunRow extends RunRecord {
3737 * old it is, and so the day a change needs more than a new column - a backfill,
3838 * a rename - has a version to key off.
3939 */
40const SCHEMA_VERSION = 1
40const SCHEMA_VERSION = 2
4141
4242export interface TableSpec {
4343 name: string
@@ -78,6 +78,7 @@ export const TABLES: TableSpec[] = [
7878 cwd: 'TEXT',
7979 last_active_at: 'INTEGER',
8080 more_text: 'TEXT',
81 engine: 'TEXT',
8182 },
8283 },
8384 {
@@ -97,6 +98,7 @@ export const TABLES: TableSpec[] = [
9798 last_activity: 'TEXT',
9899 started_at: 'INTEGER',
99100 finished_at: 'INTEGER',
101 engine: 'TEXT',
100102 },
101103 },
102104]
@@ -115,6 +117,7 @@ export const RUN_COLUMNS: Record<keyof RunRecord, string> = {
115117 lastActivity: 'last_activity',
116118 startedAt: 'started_at',
117119 finishedAt: 'finished_at',
120 engine: 'engine',
118121}
119122
120123/**
@@ -236,17 +239,19 @@ export class SqliteStore implements Store {
236239 cwd: row.cwd,
237240 lastActiveAt: row.last_active_at,
238241 moreText: row.more_text,
242 engine: row.engine,
239243 }
240244 }
241245
242246 async saveConversation(c: ConversationRecord): Promise<void> {
243247 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 (?, ?, ?, ?, ?, ?, ?, ?)
246250 ON CONFLICT(chat_guid) DO UPDATE SET
247251 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)
250255 }
251256
252257 async createRun(run: RunRecord): Promise<number> {
@@ -283,6 +288,7 @@ export class SqliteStore implements Store {
283288 lastActivity: row.last_activity,
284289 startedAt: row.started_at,
285290 finishedAt: row.finished_at,
291 engine: row.engine,
286292 }))
287293 }
288294}