feat: add agent API and operational analytics

This commit is contained in:
jjbrunton committed 2026-08-08 22:08:14 +01:00
1 parent 720ea0652a
commit e8b730b592
65 files changed
+2650 -1214

No files matched your search

+16
View File
@@ -201,6 +201,22 @@ export function runMigrations(db: Database.Database): void {
`);
},
() => migrateAccountOwnership(db),
() => {
addColumnIfNotExists(db, 'sent_messages', 'experiment_id', 'TEXT');
addColumnIfNotExists(db, 'sent_messages', 'prompt_version', 'TEXT');
addColumnIfNotExists(db, 'sent_messages', 'model_id', 'TEXT');
addColumnIfNotExists(db, 'sent_messages', 'selection_reason', 'TEXT');
addColumnIfNotExists(db, 'sent_messages', 'source_type', 'TEXT');
db.exec(`
CREATE INDEX IF NOT EXISTS idx_sent_messages_experiment
ON sent_messages(account_id, experiment_id, strategy_id, sent_at);
CREATE TABLE IF NOT EXISTS recipient_suppressions (
recipient TEXT PRIMARY KEY COLLATE NOCASE,
reason TEXT NOT NULL,
created_at INTEGER NOT NULL
);
`);
},
];
let currentVersion = db.pragma('user_version', { simple: true }) as number;