325
326
setTurnEventId(turnId: string, eventId: string): Promise<void> {
328
>
const db = await this._ensureDb();
329
>
await dbRun(db, 'INSERT OR IGNORE INTO turns (id) VALUES (?)', [turnId]);
330
>
// Only set the event ID if not already set — steering messages
331
>
// trigger additional user.message events within the same turn,
332
>
// and we must preserve the first (boundary) event ID.
333
>
await dbRun(db, 'UPDATE turns SET event_id = ? WHERE id = ? AND event_id IS NULL', [eventId, turnId]);
334
>
});
335
>
}
336
337
async getTurnEventId(turnId: string): Promise<string | undefined> {