@signetai/connector-base 0.221.8 → 0.221.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/agent-dir.js +405 -304
  2. package/dist/index.js +405 -304
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11348,6 +11348,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
11348
11348
  "checkpoint",
11349
11349
  "dreaming"
11350
11350
  ];
11351
+ function up(db) {
11352
+ const hasColumn = (table, column) => {
11353
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
11354
+ try {
11355
+ return statement.get(column) != null;
11356
+ } finally {
11357
+ statement.finalize?.();
11358
+ }
11359
+ };
11360
+ for (const [column, definition] of [
11361
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
11362
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
11363
+ ["upload_size", "INTEGER"],
11364
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
11365
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
11366
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
11367
+ ["original_path", "TEXT"],
11368
+ [
11369
+ "storage_state",
11370
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
11371
+ ]
11372
+ ]) {
11373
+ if (!hasColumn("source_import_files", column))
11374
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
11375
+ }
11376
+ if (!hasColumn("source_import_jobs", "retry_count"))
11377
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
11378
+ if (!hasColumn("source_import_jobs", "cleanup_state"))
11379
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
11380
+ if (!hasColumn("source_import_jobs", "retry_cursor"))
11381
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
11382
+ if (!hasColumn("source_import_jobs", "retry_requested"))
11383
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
11384
+ db.exec(`
11385
+ CREATE TABLE IF NOT EXISTS source_import_migrations (agent_id TEXT PRIMARY KEY, state TEXT NOT NULL DEFAULT 'pending', cursor TEXT NOT NULL DEFAULT '', error TEXT);
11386
+ CREATE TABLE IF NOT EXISTS source_import_migration_counts (agent_id TEXT NOT NULL, job_id TEXT NOT NULL, total INTEGER NOT NULL DEFAULT 0, imported INTEGER NOT NULL DEFAULT 0, duplicate INTEGER NOT NULL DEFAULT 0, rejected INTEGER NOT NULL DEFAULT 0, pending INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(agent_id,job_id)) WITHOUT ROWID;
11387
+ CREATE TABLE IF NOT EXISTS source_import_migration_streams (agent_id TEXT NOT NULL, stem TEXT NOT NULL, PRIMARY KEY(agent_id,stem)) WITHOUT ROWID;
11388
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
11389
+ CREATE TABLE IF NOT EXISTS source_import_capacity (id INTEGER PRIMARY KEY CHECK (id = 1), reserved_bytes INTEGER NOT NULL DEFAULT 0 CHECK (reserved_bytes >= 0));
11390
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
11391
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
11392
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
11393
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
11394
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
11395
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
11396
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
11397
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
11398
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
11399
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
11400
+ ) WITHOUT ROWID;
11401
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
11402
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
11403
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
11404
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
11405
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
11406
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
11407
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
11408
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
11409
+ `);
11410
+ }
11351
11411
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11352
11412
  var FTS_STATE_TABLE = "memories_fts_state";
11353
11413
  function normalizeSql(sql) {
@@ -11463,7 +11523,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11463
11523
  return true;
11464
11524
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
11465
11525
  }
11466
- function up(db) {
11526
+ function up2(db) {
11467
11527
  db.exec(`
11468
11528
  CREATE TABLE IF NOT EXISTS schema_migrations (
11469
11529
  version INTEGER PRIMARY KEY,
@@ -11561,7 +11621,7 @@ function addColumnIfMissing(db, table, column, definition) {
11561
11621
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11562
11622
  }
11563
11623
  }
11564
- function up2(db) {
11624
+ function up3(db) {
11565
11625
  addColumnIfMissing(db, "memories", "content_hash", "TEXT");
11566
11626
  addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
11567
11627
  addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -11679,7 +11739,7 @@ function addColumnIfMissing2(db, table, column, definition) {
11679
11739
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11680
11740
  return true;
11681
11741
  }
11682
- function up3(db) {
11742
+ function up4(db) {
11683
11743
  addColumnIfMissing2(db, "memories", "why", "TEXT");
11684
11744
  addColumnIfMissing2(db, "memories", "project", "TEXT");
11685
11745
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -11716,7 +11776,7 @@ function addColumnIfMissing3(db, table, column, definition) {
11716
11776
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11717
11777
  }
11718
11778
  }
11719
- function up4(db) {
11779
+ function up5(db) {
11720
11780
  addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
11721
11781
  addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
11722
11782
  addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
@@ -11749,7 +11809,7 @@ function addColumnIfMissing4(db, table, column, definition) {
11749
11809
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11750
11810
  }
11751
11811
  }
11752
- function up5(db) {
11812
+ function up6(db) {
11753
11813
  addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
11754
11814
  addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
11755
11815
  addColumnIfMissing4(db, "entities", "embedding", "BLOB");
@@ -11766,7 +11826,7 @@ function hasColumn4(db, table, column) {
11766
11826
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11767
11827
  return rows.some((r2) => r2.name === column);
11768
11828
  }
11769
- function up6(db) {
11829
+ function up7(db) {
11770
11830
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11771
11831
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11772
11832
  }
@@ -11781,7 +11841,7 @@ function hasColumn5(db, table, column) {
11781
11841
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11782
11842
  return rows.some((r2) => r2.name === column);
11783
11843
  }
11784
- function up7(db) {
11844
+ function up8(db) {
11785
11845
  db.exec(`
11786
11846
  CREATE TABLE IF NOT EXISTS documents (
11787
11847
  id TEXT PRIMARY KEY,
@@ -11838,7 +11898,7 @@ function up7(db) {
11838
11898
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11839
11899
  }
11840
11900
  }
11841
- function up8(db) {
11901
+ function up9(db) {
11842
11902
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11843
11903
  if (tables.length === 0)
11844
11904
  return;
@@ -11855,7 +11915,7 @@ function up8(db) {
11855
11915
  ON embeddings(content_hash)
11856
11916
  `);
11857
11917
  }
11858
- function up9(db) {
11918
+ function up10(db) {
11859
11919
  db.exec(`
11860
11920
  CREATE TABLE IF NOT EXISTS summary_jobs (
11861
11921
  id TEXT PRIMARY KEY,
@@ -11875,7 +11935,7 @@ function up9(db) {
11875
11935
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11876
11936
  ON summary_jobs(status)`);
11877
11937
  }
11878
- function up10(db) {
11938
+ function up11(db) {
11879
11939
  db.exec(`
11880
11940
  CREATE TABLE IF NOT EXISTS umap_cache (
11881
11941
  id INTEGER PRIMARY KEY,
@@ -11886,7 +11946,7 @@ function up10(db) {
11886
11946
  )
11887
11947
  `);
11888
11948
  }
11889
- function up11(db) {
11949
+ function up12(db) {
11890
11950
  db.exec(`
11891
11951
  CREATE TABLE IF NOT EXISTS session_scores (
11892
11952
  id TEXT PRIMARY KEY,
@@ -11906,7 +11966,7 @@ function up11(db) {
11906
11966
  ON session_scores(session_key);
11907
11967
  `);
11908
11968
  }
11909
- function up12(db) {
11969
+ function up13(db) {
11910
11970
  db.exec(`
11911
11971
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11912
11972
  id TEXT PRIMARY KEY,
@@ -11947,7 +12007,7 @@ function addColumnIfMissing5(db, table, column, definition) {
11947
12007
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11948
12008
  }
11949
12009
  }
11950
- function up13(db) {
12010
+ function up14(db) {
11951
12011
  db.exec(`
11952
12012
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11953
12013
  id TEXT PRIMARY KEY,
@@ -11973,7 +12033,7 @@ function up13(db) {
11973
12033
  addColumnIfMissing5(db, "memories", "source_path", "TEXT");
11974
12034
  addColumnIfMissing5(db, "memories", "source_section", "TEXT");
11975
12035
  }
11976
- function up14(db) {
12036
+ function up15(db) {
11977
12037
  db.exec(`
11978
12038
  CREATE TABLE IF NOT EXISTS telemetry_events (
11979
12039
  id TEXT PRIMARY KEY,
@@ -11998,7 +12058,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11998
12058
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11999
12059
  }
12000
12060
  }
12001
- function up15(db) {
12061
+ function up16(db) {
12002
12062
  db.exec(`
12003
12063
  CREATE TABLE IF NOT EXISTS session_memories (
12004
12064
  id TEXT PRIMARY KEY,
@@ -12025,7 +12085,7 @@ function up15(db) {
12025
12085
  addColumnIfMissing6(db, "session_scores", "confidence", "REAL");
12026
12086
  addColumnIfMissing6(db, "session_scores", "continuity_reasoning", "TEXT");
12027
12087
  }
12028
- function up16(db) {
12088
+ function up17(db) {
12029
12089
  db.exec(`
12030
12090
  CREATE TABLE IF NOT EXISTS session_checkpoints (
12031
12091
  id TEXT PRIMARY KEY,
@@ -12047,7 +12107,7 @@ function up16(db) {
12047
12107
  ON session_checkpoints(project_normalized, created_at DESC);
12048
12108
  `);
12049
12109
  }
12050
- function up17(db) {
12110
+ function up18(db) {
12051
12111
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12052
12112
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12053
12113
  if (!colNames.has("skill_name")) {
@@ -12058,7 +12118,7 @@ function up17(db) {
12058
12118
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
12059
12119
  }
12060
12120
  }
12061
- function up18(db) {
12121
+ function up19(db) {
12062
12122
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12063
12123
  if (existing)
12064
12124
  return;
@@ -12090,7 +12150,7 @@ function up18(db) {
12090
12150
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
12091
12151
  `);
12092
12152
  }
12093
- function up19(db) {
12153
+ function up20(db) {
12094
12154
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12095
12155
  const entityColNames = new Set(entityCols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12096
12156
  if (!entityColNames.has("agent_id")) {
@@ -12175,13 +12235,13 @@ function addColumnIfMissing7(db, table, column, definition) {
12175
12235
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12176
12236
  }
12177
12237
  }
12178
- function up20(db) {
12238
+ function up21(db) {
12179
12239
  addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12180
12240
  addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12181
12241
  addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12182
12242
  addColumnIfMissing7(db, "session_memories", "structural_density", "INTEGER");
12183
12243
  }
12184
- function up21(db) {
12244
+ function up22(db) {
12185
12245
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12186
12246
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12187
12247
  if (!columnNames.has("focal_entity_ids")) {
@@ -12206,25 +12266,25 @@ function addColumnIfMissing8(db, table, column, definition) {
12206
12266
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12207
12267
  }
12208
12268
  }
12209
- function up22(db) {
12269
+ function up23(db) {
12210
12270
  addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12211
12271
  addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12212
12272
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12213
12273
  }
12214
- function up23(_db) {}
12215
12274
  function up24(_db) {}
12275
+ function up25(_db) {}
12216
12276
  function addColumnIfMissing9(db, table, column, definition) {
12217
12277
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12218
12278
  if (!cols.some((c2) => c2.name === column)) {
12219
12279
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12220
12280
  }
12221
12281
  }
12222
- function up25(db) {
12282
+ function up26(db) {
12223
12283
  addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12224
12284
  addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12225
12285
  }
12226
- function up26(_db) {}
12227
- function up27(db) {
12286
+ function up27(_db) {}
12287
+ function up28(db) {
12228
12288
  db.exec(`
12229
12289
  UPDATE entities
12230
12290
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12233,7 +12293,7 @@ function up27(db) {
12233
12293
  WHERE canonical_name IS NULL
12234
12294
  `);
12235
12295
  }
12236
- function up28(db) {
12296
+ function up29(db) {
12237
12297
  db.exec(`
12238
12298
  CREATE TABLE IF NOT EXISTS memories_cold (
12239
12299
  archive_id TEXT PRIMARY KEY,
@@ -12270,7 +12330,7 @@ function up28(db) {
12270
12330
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
12271
12331
  `);
12272
12332
  }
12273
- function up29(db) {
12333
+ function up30(db) {
12274
12334
  db.exec(`
12275
12335
  CREATE TABLE IF NOT EXISTS session_summaries (
12276
12336
  id TEXT PRIMARY KEY,
@@ -12315,7 +12375,7 @@ function up29(db) {
12315
12375
  WHERE session_key IS NOT NULL;
12316
12376
  `);
12317
12377
  }
12318
- function up30(db) {
12378
+ function up31(db) {
12319
12379
  db.exec(`
12320
12380
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12321
12381
  id TEXT PRIMARY KEY,
@@ -12360,7 +12420,7 @@ function up30(db) {
12360
12420
  ON memory_jobs(failed_at);
12361
12421
  `);
12362
12422
  }
12363
- function up31(db) {
12423
+ function up32(db) {
12364
12424
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12365
12425
  if (!depCols.some((c2) => c2.name === "reason")) {
12366
12426
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12370,7 +12430,7 @@ function up31(db) {
12370
12430
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
12371
12431
  }
12372
12432
  }
12373
- function up32(db) {
12433
+ function up33(db) {
12374
12434
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12375
12435
  if (cols.length === 0)
12376
12436
  return;
@@ -12378,14 +12438,14 @@ function up32(db) {
12378
12438
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
12379
12439
  }
12380
12440
  }
12381
- function up33(db) {
12441
+ function up34(db) {
12382
12442
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12383
12443
  if (!cols.some((c2) => c2.name === "scope")) {
12384
12444
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
12385
12445
  }
12386
12446
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
12387
12447
  }
12388
- function up34(db) {
12448
+ function up35(db) {
12389
12449
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12390
12450
  db.exec(`
12391
12451
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12393,7 +12453,7 @@ function up34(db) {
12393
12453
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12394
12454
  `);
12395
12455
  }
12396
- function up35(db) {
12456
+ function up36(db) {
12397
12457
  db.exec(`
12398
12458
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12399
12459
  name, canonical_name,
@@ -12425,13 +12485,13 @@ function up35(db) {
12425
12485
  END
12426
12486
  `);
12427
12487
  }
12428
- function up36(db) {
12488
+ function up37(db) {
12429
12489
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12430
12490
  if (!cols.some((c2) => c2.name === "confidence")) {
12431
12491
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
12432
12492
  }
12433
12493
  }
12434
- function up37(db) {
12494
+ function up38(db) {
12435
12495
  db.exec(`
12436
12496
  CREATE TABLE IF NOT EXISTS entity_communities (
12437
12497
  id TEXT PRIMARY KEY,
@@ -12449,7 +12509,7 @@ function up37(db) {
12449
12509
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
12450
12510
  }
12451
12511
  }
12452
- function up38(db) {
12512
+ function up39(db) {
12453
12513
  db.exec(`
12454
12514
  CREATE TABLE IF NOT EXISTS memory_hints (
12455
12515
  id TEXT PRIMARY KEY,
@@ -12489,7 +12549,7 @@ function up38(db) {
12489
12549
  END
12490
12550
  `);
12491
12551
  }
12492
- function up39(db) {
12552
+ function up40(db) {
12493
12553
  db.exec(`
12494
12554
  DELETE FROM entity_dependencies
12495
12555
  WHERE id NOT IN (
@@ -12507,7 +12567,7 @@ function up39(db) {
12507
12567
  )
12508
12568
  `);
12509
12569
  }
12510
- function up40(db) {
12570
+ function up41(db) {
12511
12571
  db.exec(`
12512
12572
  CREATE TABLE IF NOT EXISTS session_transcripts (
12513
12573
  session_key TEXT PRIMARY KEY,
@@ -12530,7 +12590,7 @@ function addColumnIfMissing10(db, table, column, definition) {
12530
12590
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12531
12591
  }
12532
12592
  }
12533
- function up41(db) {
12593
+ function up42(db) {
12534
12594
  addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
12535
12595
  db.exec(`
12536
12596
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -12605,7 +12665,7 @@ function addColumnIfMissing11(db, table, column, definition) {
12605
12665
  return;
12606
12666
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12607
12667
  }
12608
- function up42(db) {
12668
+ function up43(db) {
12609
12669
  addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
12610
12670
  addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
12611
12671
  addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12693,7 +12753,7 @@ function addColumnIfMissing12(db, table, column, definition) {
12693
12753
  return;
12694
12754
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12695
12755
  }
12696
- function up43(db) {
12756
+ function up44(db) {
12697
12757
  db.exec(`
12698
12758
  CREATE TABLE IF NOT EXISTS agents (
12699
12759
  id TEXT PRIMARY KEY,
@@ -12722,7 +12782,7 @@ function addColumnIfMissing13(db, table, column, definition) {
12722
12782
  return;
12723
12783
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12724
12784
  }
12725
- function up44(db) {
12785
+ function up45(db) {
12726
12786
  addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
12727
12787
  addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
12728
12788
  addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
@@ -12748,7 +12808,7 @@ function addColumnIfMissing14(db, table, column, definition) {
12748
12808
  return;
12749
12809
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12750
12810
  }
12751
- function up45(db) {
12811
+ function up46(db) {
12752
12812
  addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
12753
12813
  addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12754
12814
  addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -12819,7 +12879,7 @@ function up45(db) {
12819
12879
  ON memory_md_heads(lease_expires_at);
12820
12880
  `);
12821
12881
  }
12822
- function up46(db) {
12882
+ function up47(db) {
12823
12883
  db.exec(`
12824
12884
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12825
12885
 
@@ -12880,7 +12940,7 @@ function up46(db) {
12880
12940
  AND COALESCE(source_type, 'summary') = 'summary';
12881
12941
  `);
12882
12942
  }
12883
- function up47(db) {
12943
+ function up48(db) {
12884
12944
  db.exec(`
12885
12945
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12886
12946
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -12978,7 +13038,7 @@ function up47(db) {
12978
13038
  AND COALESCE(source_type, 'summary') = 'summary';
12979
13039
  `);
12980
13040
  }
12981
- function up48(db) {
13041
+ function up49(db) {
12982
13042
  db.exec(`
12983
13043
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
12984
13044
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13096,7 +13156,7 @@ function up48(db) {
13096
13156
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
13097
13157
  `);
13098
13158
  }
13099
- function up49(db) {
13159
+ function up50(db) {
13100
13160
  db.exec(`
13101
13161
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13102
13162
  session_key TEXT NOT NULL,
@@ -13113,7 +13173,7 @@ function hasTable(db, name) {
13113
13173
  WHERE type = 'table' AND name = ?
13114
13174
  LIMIT 1`).get(name) !== undefined;
13115
13175
  }
13116
- function up50(db) {
13176
+ function up51(db) {
13117
13177
  db.exec(`
13118
13178
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13119
13179
  id TEXT PRIMARY KEY,
@@ -13283,7 +13343,7 @@ function addColumnIfMissing15(db, table, column, definition) {
13283
13343
  return;
13284
13344
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13285
13345
  }
13286
- function up51(db) {
13346
+ function up52(db) {
13287
13347
  addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13288
13348
  addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13289
13349
  addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
@@ -13375,7 +13435,7 @@ function up51(db) {
13375
13435
  VALUES ('rebuild');
13376
13436
  `);
13377
13437
  }
13378
- function up52(db) {
13438
+ function up53(db) {
13379
13439
  db.exec(`
13380
13440
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13381
13441
  id TEXT PRIMARY KEY,
@@ -13392,7 +13452,7 @@ function up52(db) {
13392
13452
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13393
13453
  `);
13394
13454
  }
13395
- function up53(db) {
13455
+ function up54(db) {
13396
13456
  db.exec(`
13397
13457
  CREATE TABLE IF NOT EXISTS skill_invocations (
13398
13458
  id TEXT PRIMARY KEY,
@@ -13408,7 +13468,7 @@ function up53(db) {
13408
13468
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
13409
13469
  `);
13410
13470
  }
13411
- function up54(db) {
13471
+ function up55(db) {
13412
13472
  db.exec(`
13413
13473
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13414
13474
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13439,7 +13499,7 @@ function up54(db) {
13439
13499
  ON task_scope_hints(agent_id, updated_at);
13440
13500
  `);
13441
13501
  }
13442
- function up55(db) {
13502
+ function up56(db) {
13443
13503
  db.exec(`
13444
13504
  CREATE TABLE IF NOT EXISTS dreaming_state (
13445
13505
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13482,7 +13542,7 @@ function ensureMemoriesScopeColumns(db) {
13482
13542
  if (!names.has("scope"))
13483
13543
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13484
13544
  }
13485
- function up56(db) {
13545
+ function up57(db) {
13486
13546
  ensureMemoriesScopeColumns(db);
13487
13547
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13488
13548
  db.exec(`
@@ -13495,20 +13555,20 @@ function up56(db) {
13495
13555
  WHERE content_hash IS NOT NULL AND is_deleted = 0
13496
13556
  `);
13497
13557
  }
13498
- function up57(db) {
13558
+ function up58(db) {
13499
13559
  const sql = readMemoriesFtsSql(db);
13500
13560
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13501
13561
  return;
13502
13562
  recreateMemoriesFts(db);
13503
13563
  }
13504
- function up58(db) {
13564
+ function up59(db) {
13505
13565
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13506
13566
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13507
13567
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
13508
13568
  ON entities(entity_type, mentions)
13509
13569
  WHERE entity_type = 'extracted'`);
13510
13570
  }
13511
- function up59(db) {
13571
+ function up60(db) {
13512
13572
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13513
13573
  if (!cols.some((col) => col.name === "claim_key")) {
13514
13574
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13517,7 +13577,7 @@ function up59(db) {
13517
13577
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
13518
13578
  WHERE claim_key IS NOT NULL`);
13519
13579
  }
13520
- function up60(db) {
13580
+ function up61(db) {
13521
13581
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13522
13582
  if (!cols.some((col) => col.name === "group_key")) {
13523
13583
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13529,13 +13589,13 @@ function up60(db) {
13529
13589
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
13530
13590
  WHERE claim_key IS NOT NULL`);
13531
13591
  }
13532
- function up61(db) {
13592
+ function up62(db) {
13533
13593
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13534
13594
  if (cols.some((col) => col.name === "source_mtime_ms"))
13535
13595
  return;
13536
13596
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
13537
13597
  }
13538
- function up62(db) {
13598
+ function up63(db) {
13539
13599
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13540
13600
  const names = new Set(cols.map((col) => col.name));
13541
13601
  if (!names.has("is_deleted")) {
@@ -13549,7 +13609,7 @@ function up62(db) {
13549
13609
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
13550
13610
  `);
13551
13611
  }
13552
- function up63(db) {
13612
+ function up64(db) {
13553
13613
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13554
13614
  db.exec(`
13555
13615
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13567,7 +13627,7 @@ function addColumnIfMissing16(db, table, column, definition) {
13567
13627
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13568
13628
  }
13569
13629
  }
13570
- function up64(db) {
13630
+ function up65(db) {
13571
13631
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13572
13632
  addColumnIfMissing16(db, table, "source_id", "TEXT");
13573
13633
  addColumnIfMissing16(db, table, "source_kind", "TEXT");
@@ -13587,7 +13647,7 @@ function hasColumn7(db, table, column) {
13587
13647
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13588
13648
  return rows.some((row) => row.name === column);
13589
13649
  }
13590
- function up65(db) {
13650
+ function up66(db) {
13591
13651
  if (!hasTable2(db, "embeddings"))
13592
13652
  return;
13593
13653
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13595,7 +13655,7 @@ function up65(db) {
13595
13655
  }
13596
13656
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
13597
13657
  }
13598
- function up66(db) {
13658
+ function up67(db) {
13599
13659
  db.exec(`
13600
13660
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13601
13661
  id TEXT PRIMARY KEY,
@@ -13636,7 +13696,7 @@ function addColumnIfMissing17(db, table, column, definition) {
13636
13696
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13637
13697
  }
13638
13698
  }
13639
- function up67(db) {
13699
+ function up68(db) {
13640
13700
  db.exec(`
13641
13701
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13642
13702
  id TEXT PRIMARY KEY,
@@ -13679,7 +13739,7 @@ function up67(db) {
13679
13739
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
13680
13740
  }
13681
13741
  }
13682
- function up68(db) {
13742
+ function up69(db) {
13683
13743
  db.exec(`
13684
13744
  CREATE TABLE IF NOT EXISTS daily_reflections (
13685
13745
  id TEXT PRIMARY KEY,
@@ -13706,7 +13766,7 @@ function up68(db) {
13706
13766
  WHERE content_key IS NOT NULL;
13707
13767
  `);
13708
13768
  }
13709
- function up69(db) {
13769
+ function up70(db) {
13710
13770
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13711
13771
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
13712
13772
  if (!colNames.has("content_key")) {
@@ -13743,7 +13803,7 @@ function backfillVersionRoots(db) {
13743
13803
  WHERE version_root_id IS NULL
13744
13804
  `);
13745
13805
  }
13746
- function up70(db) {
13806
+ function up71(db) {
13747
13807
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13748
13808
  addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13749
13809
  addColumnIfMissing18(db, table, "archived_at", "TEXT");
@@ -13778,7 +13838,7 @@ function up70(db) {
13778
13838
  ON entity_aspects(agent_id, proposal_id);
13779
13839
  `);
13780
13840
  }
13781
- function up71(db) {
13841
+ function up72(db) {
13782
13842
  db.exec(`
13783
13843
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13784
13844
  id TEXT PRIMARY KEY,
@@ -13834,7 +13894,7 @@ function ensureMemoriesScopeColumns2(db) {
13834
13894
  if (!names.has("runtime_path"))
13835
13895
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13836
13896
  }
13837
- function up72(db) {
13897
+ function up73(db) {
13838
13898
  ensureMemoriesScopeColumns2(db);
13839
13899
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13840
13900
  db.exec(`
@@ -13848,7 +13908,7 @@ function up72(db) {
13848
13908
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
13849
13909
  `);
13850
13910
  }
13851
- function up73(db) {
13911
+ function up74(db) {
13852
13912
  db.exec(`
13853
13913
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13854
13914
  session_key TEXT NOT NULL,
@@ -13883,7 +13943,7 @@ function up73(db) {
13883
13943
  ON session_recall_events(item_kind, item_id, created_at DESC);
13884
13944
  `);
13885
13945
  }
13886
- function up74(db) {
13946
+ function up75(db) {
13887
13947
  db.exec(`
13888
13948
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13889
13949
  aggregate_memory_id TEXT NOT NULL,
@@ -13902,7 +13962,7 @@ function addColumnIfMissing19(db, table, column, definition) {
13902
13962
  return;
13903
13963
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13904
13964
  }
13905
- function up75(db) {
13965
+ function up76(db) {
13906
13966
  addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
13907
13967
  addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
13908
13968
  addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -13915,7 +13975,7 @@ function up75(db) {
13915
13975
  ON memory_artifacts(agent_id, source_id, source_root);
13916
13976
  `);
13917
13977
  }
13918
- function up76(db) {
13978
+ function up77(db) {
13919
13979
  db.exec(`
13920
13980
  CREATE TABLE IF NOT EXISTS temporal_edges (
13921
13981
  id TEXT PRIMARY KEY,
@@ -13938,7 +13998,7 @@ function up76(db) {
13938
13998
  ON temporal_edges(agent_id, subject_type, subject_id);
13939
13999
  `);
13940
14000
  }
13941
- function up77(db) {
14001
+ function up78(db) {
13942
14002
  db.exec(`
13943
14003
  CREATE TABLE IF NOT EXISTS entity_aliases (
13944
14004
  id TEXT PRIMARY KEY,
@@ -13962,7 +14022,7 @@ function up77(db) {
13962
14022
  ON entity_aliases(agent_id, canonical_alias, status);
13963
14023
  `);
13964
14024
  }
13965
- function up78(db) {
14025
+ function up79(db) {
13966
14026
  db.exec(`
13967
14027
  CREATE TABLE IF NOT EXISTS api_keys (
13968
14028
  id TEXT PRIMARY KEY,
@@ -13990,7 +14050,7 @@ function up78(db) {
13990
14050
  ON api_keys(connector, harness);
13991
14051
  `);
13992
14052
  }
13993
- function up79(db) {
14053
+ function up80(db) {
13994
14054
  db.exec(`
13995
14055
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
13996
14056
  id TEXT PRIMARY KEY,
@@ -14025,7 +14085,7 @@ function hasColumn10(db, table, column) {
14025
14085
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14026
14086
  return rows.some((row) => row.name === column);
14027
14087
  }
14028
- function up80(db) {
14088
+ function up81(db) {
14029
14089
  if (!hasColumn10(db, "documents", "agent_id")) {
14030
14090
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
14031
14091
  }
@@ -14111,7 +14171,7 @@ function up80(db) {
14111
14171
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
14112
14172
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
14113
14173
  }
14114
- function up81(db) {
14174
+ function up82(db) {
14115
14175
  db.exec(`
14116
14176
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14117
14177
  aggregate_memory_id TEXT NOT NULL,
@@ -14133,7 +14193,7 @@ function hasColumn11(db, table, column) {
14133
14193
  return rows.some((row) => row.name === column);
14134
14194
  }
14135
14195
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14136
- function up82(db) {
14196
+ function up83(db) {
14137
14197
  for (const column of COLUMNS) {
14138
14198
  if (!hasColumn11(db, "skill_invocations", column)) {
14139
14199
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14214,7 +14274,7 @@ function documentScopeColumnsPreservingExisting(db) {
14214
14274
  `);
14215
14275
  }
14216
14276
  try {
14217
- up80(db);
14277
+ up81(db);
14218
14278
  if (preserveAgentId) {
14219
14279
  db.exec(`
14220
14280
  UPDATE documents
@@ -14234,12 +14294,12 @@ function documentScopeColumnsPreservingExisting(db) {
14234
14294
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14235
14295
  }
14236
14296
  }
14237
- function up83(db) {
14238
- up79(db);
14297
+ function up84(db) {
14298
+ up80(db);
14239
14299
  if (hasTable3(db, "documents")) {
14240
14300
  documentScopeColumnsPreservingExisting(db);
14241
14301
  }
14242
- up81(db);
14302
+ up82(db);
14243
14303
  addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14244
14304
  addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14245
14305
  addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
@@ -14296,7 +14356,7 @@ function up83(db) {
14296
14356
  AND ${sourceAgentId} = ${targetAgentId}
14297
14357
  `);
14298
14358
  }
14299
- function up84(db) {
14359
+ function up85(db) {
14300
14360
  db.exec(`
14301
14361
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14302
14362
  path TEXT PRIMARY KEY,
@@ -14326,7 +14386,7 @@ function up84(db) {
14326
14386
  ON legacy_markdown_chunks(memory_id);
14327
14387
  `);
14328
14388
  }
14329
- function up85(db) {
14389
+ function up86(db) {
14330
14390
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14331
14391
  const tableNames = new Set(tables.map((r2) => String(r2.name)));
14332
14392
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14385,7 +14445,7 @@ function addColumnIfMissing21(db, table, column, definition) {
14385
14445
  return;
14386
14446
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14387
14447
  }
14388
- function up86(db) {
14448
+ function up87(db) {
14389
14449
  addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
14390
14450
  db.exec(`
14391
14451
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -14398,14 +14458,14 @@ function addColumnIfMissing22(db, table, column, definition) {
14398
14458
  return;
14399
14459
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14400
14460
  }
14401
- function up87(db) {
14461
+ function up88(db) {
14402
14462
  addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
14403
14463
  db.exec(`
14404
14464
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
14405
14465
  ON summary_jobs(agent_id, session_key, boundary_reason)
14406
14466
  `);
14407
14467
  }
14408
- function up88(db) {
14468
+ function up89(db) {
14409
14469
  db.exec(`
14410
14470
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14411
14471
  agent_id TEXT NOT NULL,
@@ -14423,7 +14483,7 @@ function up88(db) {
14423
14483
  ON transcript_capture_jobs(agent_id, session_id, status);
14424
14484
  `);
14425
14485
  }
14426
- function up89(db) {
14486
+ function up90(db) {
14427
14487
  db.exec(`
14428
14488
  CREATE TABLE IF NOT EXISTS job_cancellations (
14429
14489
  id TEXT PRIMARY KEY,
@@ -14451,7 +14511,7 @@ function indexExists(db, table, indexName) {
14451
14511
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14452
14512
  return rows.some((row) => row.name === indexName);
14453
14513
  }
14454
- function up90(db) {
14514
+ function up91(db) {
14455
14515
  db.exec(`
14456
14516
  CREATE TABLE IF NOT EXISTS job_archive (
14457
14517
  id TEXT PRIMARY KEY,
@@ -14478,7 +14538,7 @@ function indexExists2(db, table, indexName) {
14478
14538
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14479
14539
  return rows.some((row) => row.name === indexName);
14480
14540
  }
14481
- function up91(db) {
14541
+ function up92(db) {
14482
14542
  db.exec(`
14483
14543
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14484
14544
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14491,7 +14551,7 @@ function up91(db) {
14491
14551
  )
14492
14552
  `);
14493
14553
  }
14494
- function up92(db) {
14554
+ function up93(db) {
14495
14555
  db.exec(`
14496
14556
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14497
14557
  id TEXT PRIMARY KEY,
@@ -14510,7 +14570,7 @@ function up92(db) {
14510
14570
  ON embeddings_staging(agent_id, source_type, source_id);
14511
14571
  `);
14512
14572
  }
14513
- function up93(db) {
14573
+ function up94(db) {
14514
14574
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14515
14575
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14516
14576
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14521,7 +14581,7 @@ function hasColumn13(db, table, column) {
14521
14581
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14522
14582
  return rows.some((r2) => r2.name === column);
14523
14583
  }
14524
- function up94(db) {
14584
+ function up95(db) {
14525
14585
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14526
14586
  if (tables.length === 0)
14527
14587
  return;
@@ -14546,23 +14606,23 @@ function up94(db) {
14546
14606
  function hasColumn14(db, table, column) {
14547
14607
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14548
14608
  }
14549
- function up95(db) {
14609
+ function up96(db) {
14550
14610
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14551
14611
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14552
14612
  return;
14553
14613
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
14554
14614
  }
14555
- function up96(db) {
14615
+ function up97(db) {
14556
14616
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14557
14617
  }
14558
- function up97(db) {
14618
+ function up98(db) {
14559
14619
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14560
14620
  if (!columns.some((column) => column.name === "last_failure_at")) {
14561
14621
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
14562
14622
  }
14563
14623
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
14564
14624
  }
14565
- function up98(db) {
14625
+ function up99(db) {
14566
14626
  db.exec(`
14567
14627
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14568
14628
  agent_id TEXT NOT NULL,
@@ -14579,7 +14639,7 @@ function up98(db) {
14579
14639
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
14580
14640
  `);
14581
14641
  }
14582
- function up99(db) {
14642
+ function up100(db) {
14583
14643
  db.exec(`
14584
14644
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14585
14645
  id TEXT PRIMARY KEY,
@@ -14599,7 +14659,7 @@ function up99(db) {
14599
14659
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
14600
14660
  `);
14601
14661
  }
14602
- function up100(db) {
14662
+ function up101(db) {
14603
14663
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14604
14664
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14605
14665
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14608,7 +14668,7 @@ function up100(db) {
14608
14668
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
14609
14669
  }
14610
14670
  }
14611
- function up101(db) {
14671
+ function up102(db) {
14612
14672
  db.exec(`
14613
14673
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14614
14674
  id TEXT PRIMARY KEY,
@@ -14630,7 +14690,7 @@ function up101(db) {
14630
14690
  function hasColumn15(db, table, column) {
14631
14691
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14632
14692
  }
14633
- function up102(db) {
14693
+ function up103(db) {
14634
14694
  const requiredMemoryColumns = [
14635
14695
  "content_hash",
14636
14696
  "normalized_content",
@@ -14681,7 +14741,7 @@ function up102(db) {
14681
14741
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
14682
14742
  `);
14683
14743
  }
14684
- function up103(db) {
14744
+ function up104(db) {
14685
14745
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14686
14746
  if (tables.length !== 2)
14687
14747
  return;
@@ -14704,7 +14764,7 @@ function tableExists(db, table) {
14704
14764
  function hasColumn16(db, table, column) {
14705
14765
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14706
14766
  }
14707
- function up104(db) {
14767
+ function up105(db) {
14708
14768
  db.exec(`
14709
14769
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14710
14770
  derived_memory_id TEXT NOT NULL,
@@ -14747,7 +14807,7 @@ function up104(db) {
14747
14807
  `);
14748
14808
  }
14749
14809
  }
14750
- function up105(db) {
14810
+ function up106(db) {
14751
14811
  db.exec(`
14752
14812
  DROP TRIGGER IF EXISTS entities_fts_ai;
14753
14813
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -14836,7 +14896,7 @@ function up105(db) {
14836
14896
  function hasColumn17(db, table, column) {
14837
14897
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14838
14898
  }
14839
- function up106(db) {
14899
+ function up107(db) {
14840
14900
  if (!hasColumn17(db, "memories", "review_after")) {
14841
14901
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
14842
14902
  }
@@ -14852,14 +14912,14 @@ var TOKEN_COLUMNS = [
14852
14912
  ["tokens_cache_write", "INTEGER"],
14853
14913
  ["tokens_cost", "REAL"]
14854
14914
  ];
14855
- function up107(db) {
14915
+ function up108(db) {
14856
14916
  for (const [column, type] of TOKEN_COLUMNS) {
14857
14917
  if (!hasColumn18(db, "dreaming_passes", column)) {
14858
14918
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14859
14919
  }
14860
14920
  }
14861
14921
  }
14862
- function up108(db) {
14922
+ function up109(db) {
14863
14923
  db.exec(`
14864
14924
  CREATE TABLE IF NOT EXISTS embedding_usage (
14865
14925
  day TEXT NOT NULL,
@@ -14872,7 +14932,7 @@ function up108(db) {
14872
14932
  );
14873
14933
  `);
14874
14934
  }
14875
- function up109(db) {
14935
+ function up110(db) {
14876
14936
  db.exec(`
14877
14937
  CREATE TABLE IF NOT EXISTS telemetry_install (
14878
14938
  id TEXT PRIMARY KEY,
@@ -14880,7 +14940,7 @@ function up109(db) {
14880
14940
  );
14881
14941
  `);
14882
14942
  }
14883
- function up110(db) {
14943
+ function up111(db) {
14884
14944
  db.exec(`
14885
14945
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14886
14946
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14891,7 +14951,7 @@ function hasColumn19(db, table, column) {
14891
14951
  return rows.some((row) => row.name === column);
14892
14952
  }
14893
14953
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14894
- function up111(db) {
14954
+ function up112(db) {
14895
14955
  for (const column of COLUMNS2) {
14896
14956
  if (!hasColumn19(db, "telemetry_install", column)) {
14897
14957
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14907,7 +14967,7 @@ function addColumnIfMissing23(db, column, definition) {
14907
14967
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14908
14968
  }
14909
14969
  }
14910
- function up112(db) {
14970
+ function up113(db) {
14911
14971
  addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14912
14972
  addColumnIfMissing23(db, "claim_token", "TEXT");
14913
14973
  addColumnIfMissing23(db, "claimed_at", "TEXT");
@@ -14916,7 +14976,7 @@ function up112(db) {
14916
14976
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14917
14977
  `);
14918
14978
  }
14919
- function up113(db) {
14979
+ function up114(db) {
14920
14980
  db.exec(`
14921
14981
  CREATE TABLE IF NOT EXISTS session_claims (
14922
14982
  session_key TEXT NOT NULL,
@@ -14937,7 +14997,7 @@ function up113(db) {
14937
14997
  ON session_claims(agent_id, state, expires_at);
14938
14998
  `);
14939
14999
  }
14940
- function up114(db) {
15000
+ function up115(db) {
14941
15001
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
14942
15002
  if (table == null)
14943
15003
  return;
@@ -14946,7 +15006,7 @@ function up114(db) {
14946
15006
  ON entity_attributes(memory_id, agent_id, status, importance);
14947
15007
  `);
14948
15008
  }
14949
- function up115(db) {
15009
+ function up116(db) {
14950
15010
  db.exec(`
14951
15011
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
14952
15012
  id TEXT PRIMARY KEY,
@@ -15003,7 +15063,7 @@ function addColumnIfMissing24(db, column, definition) {
15003
15063
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
15004
15064
  }
15005
15065
  }
15006
- function up116(db) {
15066
+ function up117(db) {
15007
15067
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
15008
15068
  if (table == null)
15009
15069
  return;
@@ -15204,7 +15264,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15204
15264
  insert.run(...values);
15205
15265
  }
15206
15266
  }
15207
- function up117(db) {
15267
+ function up118(db) {
15208
15268
  if (!hasTable4(db, "session_transcripts"))
15209
15269
  return;
15210
15270
  addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
@@ -15257,7 +15317,7 @@ function up117(db) {
15257
15317
  ON session_transcripts(agent_id, content_hash);
15258
15318
  `);
15259
15319
  }
15260
- function up118(db) {
15320
+ function up119(db) {
15261
15321
  db.exec(`
15262
15322
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15263
15323
  ON memory_jobs(status)
@@ -15276,12 +15336,12 @@ function up118(db) {
15276
15336
  function hasColumn22(db, table, column) {
15277
15337
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15278
15338
  }
15279
- function up119(db) {
15339
+ function up120(db) {
15280
15340
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15281
15341
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15282
15342
  }
15283
15343
  }
15284
- function up120(db) {
15344
+ function up121(db) {
15285
15345
  db.exec(`
15286
15346
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15287
15347
  agent_id TEXT NOT NULL,
@@ -15310,7 +15370,7 @@ function addColumnIfMissing26(db, column, definition) {
15310
15370
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15311
15371
  }
15312
15372
  }
15313
- function up121(db) {
15373
+ function up122(db) {
15314
15374
  addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15315
15375
  addColumnIfMissing26(db, "last_attempt_at", "TEXT");
15316
15376
  addColumnIfMissing26(db, "sent_at", "TEXT");
@@ -15331,7 +15391,7 @@ function up121(db) {
15331
15391
  VALUES (1, CURRENT_TIMESTAMP);
15332
15392
  `);
15333
15393
  }
15334
- function up122(db) {
15394
+ function up123(db) {
15335
15395
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15336
15396
  const names = new Set(columns.map((column) => column.name));
15337
15397
  if (!names.has("failure_class")) {
@@ -15348,7 +15408,7 @@ function up122(db) {
15348
15408
  }
15349
15409
  db.exec("CREATE INDEX IF NOT EXISTS idx_dreaming_evidence_exclusions_retry ON dreaming_evidence_exclusions (resolved_at, requeue_requested_at, failure_class, retry_count, last_requeued_at)");
15350
15410
  }
15351
- function up123(db) {
15411
+ function up124(db) {
15352
15412
  db.exec(`
15353
15413
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15354
15414
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15372,7 +15432,7 @@ function up123(db) {
15372
15432
  ON embedding_index_failures(source_type, source_id);
15373
15433
  `);
15374
15434
  }
15375
- function up124(db) {
15435
+ function up125(db) {
15376
15436
  db.exec(`
15377
15437
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15378
15438
  id TEXT PRIMARY KEY,
@@ -15422,7 +15482,7 @@ function backfillTable(db, params) {
15422
15482
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15423
15483
  backfill(db, rows, params.sourceKind, params.scannedAt);
15424
15484
  }
15425
- function up125(db) {
15485
+ function up126(db) {
15426
15486
  db.exec(`
15427
15487
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15428
15488
  agent_id TEXT NOT NULL,
@@ -15479,7 +15539,7 @@ function up125(db) {
15479
15539
  scannedAt
15480
15540
  });
15481
15541
  }
15482
- function up126(db) {
15542
+ function up127(db) {
15483
15543
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15484
15544
  if (!table)
15485
15545
  return;
@@ -15513,7 +15573,7 @@ function up126(db) {
15513
15573
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
15514
15574
  `);
15515
15575
  }
15516
- function up127(db) {
15576
+ function up128(db) {
15517
15577
  db.exec(`
15518
15578
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15519
15579
  id TEXT PRIMARY KEY,
@@ -15569,7 +15629,7 @@ function up127(db) {
15569
15629
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
15570
15630
  `);
15571
15631
  }
15572
- function up128(db) {
15632
+ function up129(db) {
15573
15633
  db.exec(`
15574
15634
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15575
15635
  ON memory_jobs(status, created_at)
@@ -15584,7 +15644,7 @@ function up128(db) {
15584
15644
  function tableExists3(db, table) {
15585
15645
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15586
15646
  }
15587
- function up129(db) {
15647
+ function up130(db) {
15588
15648
  if (!tableExists3(db, "memory_jobs"))
15589
15649
  return;
15590
15650
  if (!tableExists3(db, "job_cancellations")) {
@@ -15633,7 +15693,7 @@ function up129(db) {
15633
15693
  AND status IN ('pending', 'leased');
15634
15694
  `);
15635
15695
  }
15636
- function up130(db) {
15696
+ function up131(db) {
15637
15697
  db.exec(`
15638
15698
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15639
15699
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15673,7 +15733,7 @@ function up130(db) {
15673
15733
  END;
15674
15734
  `);
15675
15735
  }
15676
- function up131(db) {
15736
+ function up132(db) {
15677
15737
  db.exec(`
15678
15738
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15679
15739
  agent_id TEXT NOT NULL,
@@ -15696,13 +15756,13 @@ function up131(db) {
15696
15756
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
15697
15757
  `);
15698
15758
  }
15699
- function up132(db) {
15759
+ function up133(db) {
15700
15760
  db.exec(`
15701
15761
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15702
15762
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
15703
15763
  `);
15704
15764
  }
15705
- function up133(db) {
15765
+ function up134(db) {
15706
15766
  db.exec(`
15707
15767
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15708
15768
  id TEXT PRIMARY KEY,
@@ -15754,7 +15814,7 @@ function up133(db) {
15754
15814
  if (!names.has("format_version"))
15755
15815
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
15756
15816
  }
15757
- function up134(db) {
15817
+ function up135(db) {
15758
15818
  db.exec(`
15759
15819
  CREATE TABLE memory_head_entries_v134 (
15760
15820
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15772,7 +15832,7 @@ function up134(db) {
15772
15832
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
15773
15833
  `);
15774
15834
  }
15775
- function up135(db) {
15835
+ function up136(db) {
15776
15836
  db.exec(`
15777
15837
  CREATE TABLE IF NOT EXISTS memory_head_publications (
15778
15838
  agent_id TEXT NOT NULL,
@@ -15788,7 +15848,7 @@ function up135(db) {
15788
15848
  ON memory_head_publications(agent_id, status, revision DESC);
15789
15849
  `);
15790
15850
  }
15791
- function up136(db) {
15851
+ function up137(db) {
15792
15852
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r2) => r2.name));
15793
15853
  for (const [name, type] of [
15794
15854
  ["entry_id", "TEXT"],
@@ -15802,7 +15862,7 @@ function up136(db) {
15802
15862
  }
15803
15863
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
15804
15864
  }
15805
- function up137(db) {
15865
+ function up138(db) {
15806
15866
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r2) => r2.name));
15807
15867
  for (const [name, type] of [
15808
15868
  ["head_revision", "INTEGER"],
@@ -15824,7 +15884,7 @@ function addColumnIfMissing27(db, table, column, definition) {
15824
15884
  if (!hasColumn25(db, table, column))
15825
15885
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15826
15886
  }
15827
- function up138(db) {
15887
+ function up139(db) {
15828
15888
  addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
15829
15889
  db.exec(`
15830
15890
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16129,7 +16189,7 @@ function up138(db) {
16129
16189
  GROUP BY j.agent_id;
16130
16190
  `);
16131
16191
  }
16132
- function up139(db) {
16192
+ function up140(db) {
16133
16193
  db.exec(`
16134
16194
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16135
16195
  agent_id TEXT NOT NULL,
@@ -16145,7 +16205,7 @@ function up139(db) {
16145
16205
  ON native_source_sync_state(agent_id, status);
16146
16206
  `);
16147
16207
  }
16148
- function up140(db) {
16208
+ function up141(db) {
16149
16209
  db.exec(`
16150
16210
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16151
16211
  agent_id TEXT NOT NULL,
@@ -16157,7 +16217,7 @@ function up140(db) {
16157
16217
  );
16158
16218
  `);
16159
16219
  }
16160
- function up141(db) {
16220
+ function up142(db) {
16161
16221
  db.exec(`
16162
16222
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16163
16223
  agent_id TEXT NOT NULL,
@@ -16171,13 +16231,13 @@ function up141(db) {
16171
16231
  );
16172
16232
  `);
16173
16233
  }
16174
- function up142(db) {
16234
+ function up143(db) {
16175
16235
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16176
16236
  if (!columns.some((column) => column.name === "frontier")) {
16177
16237
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
16178
16238
  }
16179
16239
  }
16180
- function up143(db) {
16240
+ function up144(db) {
16181
16241
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16182
16242
  const additions = [
16183
16243
  ["migration_phase", "TEXT"],
@@ -16212,13 +16272,13 @@ function up143(db) {
16212
16272
  `);
16213
16273
  }
16214
16274
  }
16215
- function up144(db) {
16275
+ function up145(db) {
16216
16276
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16217
16277
  if (!columns.has("lease_token")) {
16218
16278
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
16219
16279
  }
16220
16280
  }
16221
- function up145(db) {
16281
+ function up146(db) {
16222
16282
  db.exec(`
16223
16283
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16224
16284
  agent_id TEXT NOT NULL,
@@ -16236,7 +16296,7 @@ function up145(db) {
16236
16296
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
16237
16297
  `);
16238
16298
  }
16239
- function up146(db) {
16299
+ function up147(db) {
16240
16300
  db.exec(`
16241
16301
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16242
16302
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16291,24 +16351,36 @@ function up146(db) {
16291
16351
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
16292
16352
  `);
16293
16353
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
16294
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
16354
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
16355
+ let exists;
16356
+ try {
16357
+ exists = statement.get(column);
16358
+ } finally {
16359
+ statement.finalize?.();
16360
+ }
16295
16361
  if (exists == null)
16296
16362
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
16297
16363
  }
16298
16364
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
16299
16365
  }
16300
- function up147(db) {
16366
+ function up148(db) {
16301
16367
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16302
16368
  }
16303
- function up148(db) {
16369
+ function up149(db) {
16304
16370
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16305
16371
  if (!columns.some((column) => column.name === "source_id")) {
16306
16372
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
16307
16373
  }
16308
16374
  }
16309
- function up149(db) {
16375
+ function up150(db) {
16310
16376
  const addColumn = (table, column, definition) => {
16311
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
16377
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16378
+ let exists;
16379
+ try {
16380
+ exists = statement.get(table, column);
16381
+ } finally {
16382
+ statement.finalize?.();
16383
+ }
16312
16384
  if (exists == null)
16313
16385
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16314
16386
  };
@@ -16321,7 +16393,7 @@ function addColumnIfMissing28(db, table, column, definition) {
16321
16393
  if (!columns.some((row) => row.name === column))
16322
16394
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16323
16395
  }
16324
- function up150(db) {
16396
+ function up151(db) {
16325
16397
  addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16326
16398
  addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
16327
16399
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -16475,13 +16547,13 @@ var MIGRATIONS = [
16475
16547
  {
16476
16548
  version: 1,
16477
16549
  name: "baseline",
16478
- up,
16550
+ up: up2,
16479
16551
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16480
16552
  },
16481
16553
  {
16482
16554
  version: 2,
16483
16555
  name: "pipeline-v2",
16484
- up: up2,
16556
+ up: up3,
16485
16557
  artifacts: {
16486
16558
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16487
16559
  }
@@ -16489,12 +16561,12 @@ var MIGRATIONS = [
16489
16561
  {
16490
16562
  version: 3,
16491
16563
  name: "unique-content-hash",
16492
- up: up3
16564
+ up: up4
16493
16565
  },
16494
16566
  {
16495
16567
  version: 4,
16496
16568
  name: "history-actor-and-retention",
16497
- up: up4,
16569
+ up: up5,
16498
16570
  artifacts: {
16499
16571
  columns: [{ table: "memory_history", column: "actor_type" }]
16500
16572
  }
@@ -16502,7 +16574,7 @@ var MIGRATIONS = [
16502
16574
  {
16503
16575
  version: 5,
16504
16576
  name: "graph-extended",
16505
- up: up5,
16577
+ up: up6,
16506
16578
  artifacts: {
16507
16579
  columns: [{ table: "entities", column: "canonical_name" }]
16508
16580
  }
@@ -16510,7 +16582,7 @@ var MIGRATIONS = [
16510
16582
  {
16511
16583
  version: 6,
16512
16584
  name: "idempotency-key",
16513
- up: up6,
16585
+ up: up7,
16514
16586
  artifacts: {
16515
16587
  columns: [{ table: "memories", column: "idempotency_key" }]
16516
16588
  }
@@ -16518,42 +16590,42 @@ var MIGRATIONS = [
16518
16590
  {
16519
16591
  version: 7,
16520
16592
  name: "documents-and-connectors",
16521
- up: up7,
16593
+ up: up8,
16522
16594
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16523
16595
  },
16524
16596
  {
16525
16597
  version: 8,
16526
16598
  name: "embeddings-unique-hash",
16527
- up: up8
16599
+ up: up9
16528
16600
  },
16529
16601
  {
16530
16602
  version: 9,
16531
16603
  name: "summary-jobs",
16532
- up: up9,
16604
+ up: up10,
16533
16605
  artifacts: { tables: ["summary_jobs"] }
16534
16606
  },
16535
16607
  {
16536
16608
  version: 10,
16537
16609
  name: "umap-cache",
16538
- up: up10,
16610
+ up: up11,
16539
16611
  artifacts: { tables: ["umap_cache"] }
16540
16612
  },
16541
16613
  {
16542
16614
  version: 11,
16543
16615
  name: "session-scores",
16544
- up: up11,
16616
+ up: up12,
16545
16617
  artifacts: { tables: ["session_scores"] }
16546
16618
  },
16547
16619
  {
16548
16620
  version: 12,
16549
16621
  name: "scheduled-tasks",
16550
- up: up12,
16622
+ up: up13,
16551
16623
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16552
16624
  },
16553
16625
  {
16554
16626
  version: 13,
16555
16627
  name: "ingestion-tracking",
16556
- up: up13,
16628
+ up: up14,
16557
16629
  artifacts: {
16558
16630
  columns: [
16559
16631
  { table: "memories", column: "source_path" },
@@ -16564,13 +16636,13 @@ var MIGRATIONS = [
16564
16636
  {
16565
16637
  version: 14,
16566
16638
  name: "telemetry",
16567
- up: up14,
16639
+ up: up15,
16568
16640
  artifacts: { tables: ["telemetry_events"] }
16569
16641
  },
16570
16642
  {
16571
16643
  version: 15,
16572
16644
  name: "session-memories",
16573
- up: up15,
16645
+ up: up16,
16574
16646
  artifacts: {
16575
16647
  tables: ["session_memories"],
16576
16648
  columns: [
@@ -16582,13 +16654,13 @@ var MIGRATIONS = [
16582
16654
  {
16583
16655
  version: 16,
16584
16656
  name: "session-checkpoints",
16585
- up: up16,
16657
+ up: up17,
16586
16658
  artifacts: { tables: ["session_checkpoints"] }
16587
16659
  },
16588
16660
  {
16589
16661
  version: 17,
16590
16662
  name: "task-skills",
16591
- up: up17,
16663
+ up: up18,
16592
16664
  artifacts: {
16593
16665
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16594
16666
  }
@@ -16596,13 +16668,13 @@ var MIGRATIONS = [
16596
16668
  {
16597
16669
  version: 18,
16598
16670
  name: "skill-meta",
16599
- up: up18,
16671
+ up: up19,
16600
16672
  artifacts: { tables: ["skill_meta"] }
16601
16673
  },
16602
16674
  {
16603
16675
  version: 19,
16604
16676
  name: "knowledge-structure",
16605
- up: up19,
16677
+ up: up20,
16606
16678
  artifacts: {
16607
16679
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16608
16680
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16611,7 +16683,7 @@ var MIGRATIONS = [
16611
16683
  {
16612
16684
  version: 20,
16613
16685
  name: "session-structural-columns",
16614
- up: up20,
16686
+ up: up21,
16615
16687
  artifacts: {
16616
16688
  columns: [
16617
16689
  { table: "session_memories", column: "entity_slot" },
@@ -16624,7 +16696,7 @@ var MIGRATIONS = [
16624
16696
  {
16625
16697
  version: 21,
16626
16698
  name: "checkpoint-structural",
16627
- up: up21,
16699
+ up: up22,
16628
16700
  artifacts: {
16629
16701
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16630
16702
  }
@@ -16632,7 +16704,7 @@ var MIGRATIONS = [
16632
16704
  {
16633
16705
  version: 22,
16634
16706
  name: "entity-pinning",
16635
- up: up22,
16707
+ up: up23,
16636
16708
  artifacts: {
16637
16709
  columns: [
16638
16710
  { table: "entities", column: "pinned" },
@@ -16643,17 +16715,17 @@ var MIGRATIONS = [
16643
16715
  {
16644
16716
  version: 23,
16645
16717
  name: "retired-scorer-gap",
16646
- up: up23
16718
+ up: up24
16647
16719
  },
16648
16720
  {
16649
16721
  version: 24,
16650
16722
  name: "retired-scorer-gap",
16651
- up: up24
16723
+ up: up25
16652
16724
  },
16653
16725
  {
16654
16726
  version: 25,
16655
16727
  name: "agent-feedback",
16656
- up: up25,
16728
+ up: up26,
16657
16729
  artifacts: {
16658
16730
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16659
16731
  }
@@ -16661,32 +16733,32 @@ var MIGRATIONS = [
16661
16733
  {
16662
16734
  version: 26,
16663
16735
  name: "retired-scorer-gap",
16664
- up: up26
16736
+ up: up27
16665
16737
  },
16666
16738
  {
16667
16739
  version: 27,
16668
16740
  name: "backfill-canonical-names",
16669
- up: up27
16741
+ up: up28
16670
16742
  },
16671
16743
  {
16672
16744
  version: 28,
16673
16745
  name: "lossless-retention",
16674
- up: up28
16746
+ up: up29
16675
16747
  },
16676
16748
  {
16677
16749
  version: 29,
16678
16750
  name: "session-summary-dag",
16679
- up: up29
16751
+ up: up30
16680
16752
  },
16681
16753
  {
16682
16754
  version: 30,
16683
16755
  name: "nullable-memory-job-memory-id",
16684
- up: up30
16756
+ up: up31
16685
16757
  },
16686
16758
  {
16687
16759
  version: 31,
16688
16760
  name: "dependency-reason",
16689
- up: up31,
16761
+ up: up32,
16690
16762
  artifacts: {
16691
16763
  columns: [
16692
16764
  { table: "entity_dependencies", column: "reason" },
@@ -16697,7 +16769,7 @@ var MIGRATIONS = [
16697
16769
  {
16698
16770
  version: 32,
16699
16771
  name: "embeddings-vector-column",
16700
- up: up32,
16772
+ up: up33,
16701
16773
  artifacts: {
16702
16774
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16703
16775
  }
@@ -16705,7 +16777,7 @@ var MIGRATIONS = [
16705
16777
  {
16706
16778
  version: 33,
16707
16779
  name: "scope",
16708
- up: up33,
16780
+ up: up34,
16709
16781
  artifacts: {
16710
16782
  columns: [{ table: "memories", column: "scope" }]
16711
16783
  }
@@ -16713,17 +16785,17 @@ var MIGRATIONS = [
16713
16785
  {
16714
16786
  version: 34,
16715
16787
  name: "scope-aware-dedup",
16716
- up: up34
16788
+ up: up35
16717
16789
  },
16718
16790
  {
16719
16791
  version: 35,
16720
16792
  name: "entity-fts",
16721
- up: up35
16793
+ up: up36
16722
16794
  },
16723
16795
  {
16724
16796
  version: 36,
16725
16797
  name: "dependency-confidence",
16726
- up: up36,
16798
+ up: up37,
16727
16799
  artifacts: {
16728
16800
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16729
16801
  }
@@ -16731,7 +16803,7 @@ var MIGRATIONS = [
16731
16803
  {
16732
16804
  version: 37,
16733
16805
  name: "entity-communities",
16734
- up: up37,
16806
+ up: up38,
16735
16807
  artifacts: {
16736
16808
  tables: ["entity_communities"],
16737
16809
  columns: [{ table: "entities", column: "community_id" }]
@@ -16740,24 +16812,24 @@ var MIGRATIONS = [
16740
16812
  {
16741
16813
  version: 38,
16742
16814
  name: "memory-hints",
16743
- up: up38,
16815
+ up: up39,
16744
16816
  artifacts: { tables: ["memory_hints"] }
16745
16817
  },
16746
16818
  {
16747
16819
  version: 39,
16748
16820
  name: "dedup-entity-dependencies",
16749
- up: up39
16821
+ up: up40
16750
16822
  },
16751
16823
  {
16752
16824
  version: 40,
16753
16825
  name: "session-transcripts",
16754
- up: up40,
16826
+ up: up41,
16755
16827
  artifacts: { tables: ["session_transcripts"] }
16756
16828
  },
16757
16829
  {
16758
16830
  version: 41,
16759
16831
  name: "path-feedback",
16760
- up: up41,
16832
+ up: up42,
16761
16833
  artifacts: {
16762
16834
  tables: [
16763
16835
  "path_feedback_events",
@@ -16772,7 +16844,7 @@ var MIGRATIONS = [
16772
16844
  {
16773
16845
  version: 42,
16774
16846
  name: "session-memories-agent-id",
16775
- up: up42,
16847
+ up: up43,
16776
16848
  artifacts: {
16777
16849
  columns: [{ table: "session_memories", column: "agent_id" }]
16778
16850
  }
@@ -16780,7 +16852,7 @@ var MIGRATIONS = [
16780
16852
  {
16781
16853
  version: 43,
16782
16854
  name: "agents-table",
16783
- up: up43,
16855
+ up: up44,
16784
16856
  artifacts: {
16785
16857
  tables: ["agents"],
16786
16858
  columns: [
@@ -16792,7 +16864,7 @@ var MIGRATIONS = [
16792
16864
  {
16793
16865
  version: 44,
16794
16866
  name: "memory-md-temporal-head",
16795
- up: up44,
16867
+ up: up45,
16796
16868
  artifacts: {
16797
16869
  columns: [
16798
16870
  { table: "session_summaries", column: "source_type" },
@@ -16804,7 +16876,7 @@ var MIGRATIONS = [
16804
16876
  {
16805
16877
  version: 45,
16806
16878
  name: "lossless-working-memory-hardening",
16807
- up: up45,
16879
+ up: up46,
16808
16880
  artifacts: {
16809
16881
  tables: ["session_transcripts_fts", "memory_md_heads"],
16810
16882
  columns: [
@@ -16817,17 +16889,17 @@ var MIGRATIONS = [
16817
16889
  {
16818
16890
  version: 46,
16819
16891
  name: "session-summary-uniqueness",
16820
- up: up46
16892
+ up: up47
16821
16893
  },
16822
16894
  {
16823
16895
  version: 47,
16824
16896
  name: "agent-scoped-temporal-uniqueness",
16825
- up: up47
16897
+ up: up48
16826
16898
  },
16827
16899
  {
16828
16900
  version: 48,
16829
16901
  name: "thread-heads",
16830
- up: up48,
16902
+ up: up49,
16831
16903
  artifacts: {
16832
16904
  tables: ["memory_thread_heads"]
16833
16905
  }
@@ -16835,7 +16907,7 @@ var MIGRATIONS = [
16835
16907
  {
16836
16908
  version: 49,
16837
16909
  name: "session-extract-cursors",
16838
- up: up49,
16910
+ up: up50,
16839
16911
  artifacts: {
16840
16912
  tables: ["session_extract_cursors"]
16841
16913
  }
@@ -16843,7 +16915,7 @@ var MIGRATIONS = [
16843
16915
  {
16844
16916
  version: 50,
16845
16917
  name: "related-to-audit",
16846
- up: up50,
16918
+ up: up51,
16847
16919
  artifacts: {
16848
16920
  tables: ["entity_dependency_history"]
16849
16921
  }
@@ -16851,7 +16923,7 @@ var MIGRATIONS = [
16851
16923
  {
16852
16924
  version: 51,
16853
16925
  name: "memory-md-rolling-window-lineage",
16854
- up: up51,
16926
+ up: up52,
16855
16927
  artifacts: {
16856
16928
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16857
16929
  columns: [
@@ -16866,7 +16938,7 @@ var MIGRATIONS = [
16866
16938
  {
16867
16939
  version: 52,
16868
16940
  name: "mcp-invocations",
16869
- up: up52,
16941
+ up: up53,
16870
16942
  artifacts: {
16871
16943
  tables: ["mcp_invocations"]
16872
16944
  }
@@ -16874,7 +16946,7 @@ var MIGRATIONS = [
16874
16946
  {
16875
16947
  version: 53,
16876
16948
  name: "skill-invocations",
16877
- up: up53,
16949
+ up: up54,
16878
16950
  artifacts: {
16879
16951
  tables: ["skill_invocations"]
16880
16952
  }
@@ -16882,7 +16954,7 @@ var MIGRATIONS = [
16882
16954
  {
16883
16955
  version: 54,
16884
16956
  name: "task-agent-scope",
16885
- up: up54,
16957
+ up: up55,
16886
16958
  artifacts: {
16887
16959
  tables: ["task_scope_hints"]
16888
16960
  }
@@ -16890,7 +16962,7 @@ var MIGRATIONS = [
16890
16962
  {
16891
16963
  version: 55,
16892
16964
  name: "dreaming-state",
16893
- up: up55,
16965
+ up: up56,
16894
16966
  artifacts: {
16895
16967
  tables: ["dreaming_state", "dreaming_passes"]
16896
16968
  }
@@ -16898,22 +16970,22 @@ var MIGRATIONS = [
16898
16970
  {
16899
16971
  version: 56,
16900
16972
  name: "agent-scoped-content-hash",
16901
- up: up56
16973
+ up: up57
16902
16974
  },
16903
16975
  {
16904
16976
  version: 57,
16905
16977
  name: "memories-fts-tokenizer-repair",
16906
- up: up57
16978
+ up: up58
16907
16979
  },
16908
16980
  {
16909
16981
  version: 58,
16910
16982
  name: "knowledge-graph-indices",
16911
- up: up58
16983
+ up: up59
16912
16984
  },
16913
16985
  {
16914
16986
  version: 59,
16915
16987
  name: "entity-attribute-claim-key",
16916
- up: up59,
16988
+ up: up60,
16917
16989
  artifacts: {
16918
16990
  columns: [{ table: "entity_attributes", column: "claim_key" }]
16919
16991
  }
@@ -16921,7 +16993,7 @@ var MIGRATIONS = [
16921
16993
  {
16922
16994
  version: 60,
16923
16995
  name: "entity-attribute-group-key",
16924
- up: up60,
16996
+ up: up61,
16925
16997
  artifacts: {
16926
16998
  columns: [{ table: "entity_attributes", column: "group_key" }]
16927
16999
  }
@@ -16929,7 +17001,7 @@ var MIGRATIONS = [
16929
17001
  {
16930
17002
  version: 61,
16931
17003
  name: "memory-artifact-source-mtime",
16932
- up: up61,
17004
+ up: up62,
16933
17005
  artifacts: {
16934
17006
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
16935
17007
  }
@@ -16937,7 +17009,7 @@ var MIGRATIONS = [
16937
17009
  {
16938
17010
  version: 62,
16939
17011
  name: "memory-artifact-soft-delete",
16940
- up: up62,
17012
+ up: up63,
16941
17013
  artifacts: {
16942
17014
  columns: [
16943
17015
  { table: "memory_artifacts", column: "is_deleted" },
@@ -16948,12 +17020,12 @@ var MIGRATIONS = [
16948
17020
  {
16949
17021
  version: 63,
16950
17022
  name: "content-only-memories-fts-update",
16951
- up: up63
17023
+ up: up64
16952
17024
  },
16953
17025
  {
16954
17026
  version: 64,
16955
17027
  name: "source-graph-provenance",
16956
- up: up64,
17028
+ up: up65,
16957
17029
  artifacts: {
16958
17030
  columns: [
16959
17031
  { table: "entities", column: "source_path" },
@@ -16966,7 +17038,7 @@ var MIGRATIONS = [
16966
17038
  {
16967
17039
  version: 65,
16968
17040
  name: "source-embedding-agent-scope",
16969
- up: up65,
17041
+ up: up66,
16970
17042
  artifacts: {
16971
17043
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
16972
17044
  }
@@ -16974,7 +17046,7 @@ var MIGRATIONS = [
16974
17046
  {
16975
17047
  version: 66,
16976
17048
  name: "memory-search-telemetry",
16977
- up: up66,
17049
+ up: up67,
16978
17050
  artifacts: {
16979
17051
  tables: ["memory_search_telemetry"]
16980
17052
  }
@@ -16982,7 +17054,7 @@ var MIGRATIONS = [
16982
17054
  {
16983
17055
  version: 67,
16984
17056
  name: "ontology-proposals",
16985
- up: up67,
17057
+ up: up68,
16986
17058
  artifacts: {
16987
17059
  tables: ["ontology_proposals"],
16988
17060
  columns: [
@@ -16996,7 +17068,7 @@ var MIGRATIONS = [
16996
17068
  {
16997
17069
  version: 68,
16998
17070
  name: "daily-reflections",
16999
- up: up68,
17071
+ up: up69,
17000
17072
  artifacts: {
17001
17073
  tables: ["daily_reflections"]
17002
17074
  }
@@ -17004,7 +17076,7 @@ var MIGRATIONS = [
17004
17076
  {
17005
17077
  version: 69,
17006
17078
  name: "daily-reflections-multiple-insights",
17007
- up: up69,
17079
+ up: up70,
17008
17080
  artifacts: {
17009
17081
  tables: ["daily_reflections"]
17010
17082
  }
@@ -17012,7 +17084,7 @@ var MIGRATIONS = [
17012
17084
  {
17013
17085
  version: 70,
17014
17086
  name: "ontology-control-plane-state",
17015
- up: up70,
17087
+ up: up71,
17016
17088
  artifacts: {
17017
17089
  columns: [
17018
17090
  { table: "entities", column: "status" },
@@ -17027,7 +17099,7 @@ var MIGRATIONS = [
17027
17099
  {
17028
17100
  version: 71,
17029
17101
  name: "epistemic-assertions",
17030
- up: up71,
17102
+ up: up72,
17031
17103
  artifacts: {
17032
17104
  tables: ["epistemic_assertions"]
17033
17105
  }
@@ -17035,7 +17107,7 @@ var MIGRATIONS = [
17035
17107
  {
17036
17108
  version: 72,
17037
17109
  name: "agent-scoped-idempotency-key",
17038
- up: up72,
17110
+ up: up73,
17039
17111
  artifacts: {
17040
17112
  columns: [
17041
17113
  { table: "memories", column: "idempotency_key" },
@@ -17046,7 +17118,7 @@ var MIGRATIONS = [
17046
17118
  {
17047
17119
  version: 73,
17048
17120
  name: "recall-context-dedupe",
17049
- up: up73,
17121
+ up: up74,
17050
17122
  artifacts: {
17051
17123
  tables: ["session_context_epochs", "session_recall_events"]
17052
17124
  }
@@ -17054,7 +17126,7 @@ var MIGRATIONS = [
17054
17126
  {
17055
17127
  version: 74,
17056
17128
  name: "aggregate-memory-links",
17057
- up: up74,
17129
+ up: up75,
17058
17130
  artifacts: {
17059
17131
  tables: ["aggregate_memory_sources"]
17060
17132
  }
@@ -17062,7 +17134,7 @@ var MIGRATIONS = [
17062
17134
  {
17063
17135
  version: 75,
17064
17136
  name: "memory-artifact-source-provenance",
17065
- up: up75,
17137
+ up: up76,
17066
17138
  artifacts: {
17067
17139
  columns: [
17068
17140
  { table: "memory_artifacts", column: "source_id" },
@@ -17076,7 +17148,7 @@ var MIGRATIONS = [
17076
17148
  {
17077
17149
  version: 76,
17078
17150
  name: "temporal-edges",
17079
- up: up76,
17151
+ up: up77,
17080
17152
  artifacts: {
17081
17153
  tables: ["temporal_edges"]
17082
17154
  }
@@ -17084,7 +17156,7 @@ var MIGRATIONS = [
17084
17156
  {
17085
17157
  version: 77,
17086
17158
  name: "entity-aliases",
17087
- up: up77,
17159
+ up: up78,
17088
17160
  artifacts: {
17089
17161
  tables: ["entity_aliases"]
17090
17162
  }
@@ -17092,7 +17164,7 @@ var MIGRATIONS = [
17092
17164
  {
17093
17165
  version: 78,
17094
17166
  name: "api-keys",
17095
- up: up78,
17167
+ up: up79,
17096
17168
  artifacts: {
17097
17169
  tables: ["api_keys"]
17098
17170
  }
@@ -17100,7 +17172,7 @@ var MIGRATIONS = [
17100
17172
  {
17101
17173
  version: 79,
17102
17174
  name: "transcript-capture-jobs",
17103
- up: up79,
17175
+ up: up80,
17104
17176
  artifacts: {
17105
17177
  tables: ["transcript_capture_jobs"]
17106
17178
  }
@@ -17108,7 +17180,7 @@ var MIGRATIONS = [
17108
17180
  {
17109
17181
  version: 80,
17110
17182
  name: "document-scope-columns",
17111
- up: up80,
17183
+ up: up81,
17112
17184
  artifacts: {
17113
17185
  columns: [
17114
17186
  { table: "documents", column: "agent_id" },
@@ -17119,7 +17191,7 @@ var MIGRATIONS = [
17119
17191
  {
17120
17192
  version: 81,
17121
17193
  name: "aggregate-evidence-sources",
17122
- up: up81,
17194
+ up: up82,
17123
17195
  artifacts: {
17124
17196
  tables: ["aggregate_evidence_sources"]
17125
17197
  }
@@ -17127,7 +17199,7 @@ var MIGRATIONS = [
17127
17199
  {
17128
17200
  version: 82,
17129
17201
  name: "skill-invocations-harness",
17130
- up: up82,
17202
+ up: up83,
17131
17203
  artifacts: {
17132
17204
  columns: [
17133
17205
  { table: "skill_invocations", column: "harness" },
@@ -17138,7 +17210,7 @@ var MIGRATIONS = [
17138
17210
  {
17139
17211
  version: 83,
17140
17212
  name: "memory-lifecycle-repair",
17141
- up: up83,
17213
+ up: up84,
17142
17214
  artifacts: {
17143
17215
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17144
17216
  columns: [
@@ -17153,7 +17225,7 @@ var MIGRATIONS = [
17153
17225
  {
17154
17226
  version: 84,
17155
17227
  name: "legacy-markdown-import-state",
17156
- up: up84,
17228
+ up: up85,
17157
17229
  artifacts: {
17158
17230
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17159
17231
  }
@@ -17161,7 +17233,7 @@ var MIGRATIONS = [
17161
17233
  {
17162
17234
  version: 85,
17163
17235
  name: "backfill-relations-to-dependencies",
17164
- up: up85,
17236
+ up: up86,
17165
17237
  artifacts: {
17166
17238
  tables: ["entity_dependencies"]
17167
17239
  }
@@ -17169,7 +17241,7 @@ var MIGRATIONS = [
17169
17241
  {
17170
17242
  version: 86,
17171
17243
  name: "summary-jobs-content-hash",
17172
- up: up86,
17244
+ up: up87,
17173
17245
  artifacts: {
17174
17246
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17175
17247
  }
@@ -17177,7 +17249,7 @@ var MIGRATIONS = [
17177
17249
  {
17178
17250
  version: 87,
17179
17251
  name: "summary-jobs-boundary-reason",
17180
- up: up87,
17252
+ up: up88,
17181
17253
  artifacts: {
17182
17254
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17183
17255
  }
@@ -17185,7 +17257,7 @@ var MIGRATIONS = [
17185
17257
  {
17186
17258
  version: 88,
17187
17259
  name: "transcript-recovery-files",
17188
- up: up88,
17260
+ up: up89,
17189
17261
  artifacts: {
17190
17262
  tables: ["transcript_recovery_files"]
17191
17263
  }
@@ -17193,7 +17265,7 @@ var MIGRATIONS = [
17193
17265
  {
17194
17266
  version: 89,
17195
17267
  name: "job-cancellations",
17196
- up: up89,
17268
+ up: up90,
17197
17269
  artifacts: {
17198
17270
  tables: ["job_cancellations"]
17199
17271
  }
@@ -17201,7 +17273,7 @@ var MIGRATIONS = [
17201
17273
  {
17202
17274
  version: 90,
17203
17275
  name: "job-archive",
17204
- up: up90,
17276
+ up: up91,
17205
17277
  artifacts: {
17206
17278
  tables: ["job_archive"]
17207
17279
  }
@@ -17209,25 +17281,25 @@ var MIGRATIONS = [
17209
17281
  {
17210
17282
  version: 91,
17211
17283
  name: "embedding-index-generations",
17212
- up: up91,
17284
+ up: up92,
17213
17285
  artifacts: { tables: ["embedding_index_state"] }
17214
17286
  },
17215
17287
  {
17216
17288
  version: 92,
17217
17289
  name: "embedding-staging-store",
17218
- up: up92,
17290
+ up: up93,
17219
17291
  artifacts: { tables: ["embeddings_staging"] }
17220
17292
  },
17221
17293
  {
17222
17294
  version: 93,
17223
17295
  name: "dreaming-evidence-cursor",
17224
- up: up93,
17296
+ up: up94,
17225
17297
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17226
17298
  },
17227
17299
  {
17228
17300
  version: 94,
17229
17301
  name: "memory-kind",
17230
- up: up94,
17302
+ up: up95,
17231
17303
  artifacts: {
17232
17304
  columns: [
17233
17305
  { table: "memories", column: "memory_kind" },
@@ -17238,35 +17310,35 @@ var MIGRATIONS = [
17238
17310
  {
17239
17311
  version: 95,
17240
17312
  name: "compaction-recall-projections",
17241
- up: up95
17313
+ up: up96
17242
17314
  },
17243
17315
  {
17244
17316
  version: 96,
17245
17317
  name: "retire-legacy-ingestion",
17246
- up: up96
17318
+ up: up97
17247
17319
  },
17248
17320
  {
17249
17321
  version: 97,
17250
17322
  name: "dreaming-failure-backoff",
17251
- up: up97,
17323
+ up: up98,
17252
17324
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17253
17325
  },
17254
17326
  {
17255
17327
  version: 98,
17256
17328
  name: "dreaming-evidence-exclusions",
17257
- up: up98,
17329
+ up: up99,
17258
17330
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17259
17331
  },
17260
17332
  {
17261
17333
  version: 99,
17262
17334
  name: "dreaming-tool-calls",
17263
- up: up99,
17335
+ up: up100,
17264
17336
  artifacts: { tables: ["dreaming_tool_calls"] }
17265
17337
  },
17266
17338
  {
17267
17339
  version: 100,
17268
17340
  name: "dreaming-runbook",
17269
- up: up100,
17341
+ up: up101,
17270
17342
  artifacts: {
17271
17343
  columns: [
17272
17344
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17277,23 +17349,23 @@ var MIGRATIONS = [
17277
17349
  {
17278
17350
  version: 101,
17279
17351
  name: "dreaming-attention",
17280
- up: up101,
17352
+ up: up102,
17281
17353
  artifacts: { tables: ["dreaming_attention"] }
17282
17354
  },
17283
17355
  {
17284
17356
  version: 102,
17285
17357
  name: "attribute-semantic-memories",
17286
- up: up102
17358
+ up: up103
17287
17359
  },
17288
17360
  {
17289
17361
  version: 103,
17290
17362
  name: "semantic-memory-kind",
17291
- up: up103
17363
+ up: up104
17292
17364
  },
17293
17365
  {
17294
17366
  version: 104,
17295
17367
  name: "derived-memory-provenance",
17296
- up: up104,
17368
+ up: up105,
17297
17369
  artifacts: {
17298
17370
  tables: ["derived_memory_sources"],
17299
17371
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17302,12 +17374,12 @@ var MIGRATIONS = [
17302
17374
  {
17303
17375
  version: 105,
17304
17376
  name: "agent-scoped-entity-name",
17305
- up: up105
17377
+ up: up106
17306
17378
  },
17307
17379
  {
17308
17380
  version: 106,
17309
17381
  name: "memory-review-after",
17310
- up: up106,
17382
+ up: up107,
17311
17383
  artifacts: {
17312
17384
  columns: [{ table: "memories", column: "review_after" }]
17313
17385
  }
@@ -17315,7 +17387,7 @@ var MIGRATIONS = [
17315
17387
  {
17316
17388
  version: 107,
17317
17389
  name: "dreaming-pass-usage",
17318
- up: up107,
17390
+ up: up108,
17319
17391
  artifacts: {
17320
17392
  columns: [
17321
17393
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17329,7 +17401,7 @@ var MIGRATIONS = [
17329
17401
  {
17330
17402
  version: 108,
17331
17403
  name: "embedding-usage",
17332
- up: up108,
17404
+ up: up109,
17333
17405
  artifacts: {
17334
17406
  tables: ["embedding_usage"]
17335
17407
  }
@@ -17337,7 +17409,7 @@ var MIGRATIONS = [
17337
17409
  {
17338
17410
  version: 109,
17339
17411
  name: "telemetry-install",
17340
- up: up109,
17412
+ up: up110,
17341
17413
  artifacts: {
17342
17414
  tables: ["telemetry_install"]
17343
17415
  }
@@ -17345,12 +17417,12 @@ var MIGRATIONS = [
17345
17417
  {
17346
17418
  version: 110,
17347
17419
  name: "memory-mention-join-index",
17348
- up: up110
17420
+ up: up111
17349
17421
  },
17350
17422
  {
17351
17423
  version: 111,
17352
17424
  name: "telemetry-first-use",
17353
- up: up111,
17425
+ up: up112,
17354
17426
  artifacts: {
17355
17427
  columns: [
17356
17428
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17361,7 +17433,7 @@ var MIGRATIONS = [
17361
17433
  {
17362
17434
  version: 112,
17363
17435
  name: "telemetry-queue-ownership",
17364
- up: up112,
17436
+ up: up113,
17365
17437
  artifacts: {
17366
17438
  columns: [
17367
17439
  { table: "telemetry_events", column: "source" },
@@ -17373,7 +17445,7 @@ var MIGRATIONS = [
17373
17445
  {
17374
17446
  version: 113,
17375
17447
  name: "session-claims",
17376
- up: up113,
17448
+ up: up114,
17377
17449
  artifacts: {
17378
17450
  tables: ["session_claims"],
17379
17451
  columns: [
@@ -17387,12 +17459,12 @@ var MIGRATIONS = [
17387
17459
  {
17388
17460
  version: 114,
17389
17461
  name: "memory-traversal-hydration-index",
17390
- up: up114
17462
+ up: up115
17391
17463
  },
17392
17464
  {
17393
17465
  version: 115,
17394
17466
  name: "cross-agent-message-notifications",
17395
- up: up115,
17467
+ up: up116,
17396
17468
  artifacts: {
17397
17469
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17398
17470
  }
@@ -17400,7 +17472,7 @@ var MIGRATIONS = [
17400
17472
  {
17401
17473
  version: 116,
17402
17474
  name: "acp-delivery-reconciliation",
17403
- up: up116,
17475
+ up: up117,
17404
17476
  artifacts: {
17405
17477
  columns: [
17406
17478
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17414,7 +17486,7 @@ var MIGRATIONS = [
17414
17486
  {
17415
17487
  version: 117,
17416
17488
  name: "retire-summary-worker",
17417
- up: up117,
17489
+ up: up118,
17418
17490
  artifacts: {
17419
17491
  columns: [
17420
17492
  { table: "session_transcripts", column: "completed_at" },
@@ -17425,24 +17497,24 @@ var MIGRATIONS = [
17425
17497
  {
17426
17498
  version: 118,
17427
17499
  name: "queue-pressure-indices",
17428
- up: up118
17500
+ up: up119
17429
17501
  },
17430
17502
  {
17431
17503
  version: 119,
17432
17504
  name: "telemetry-version-observation",
17433
- up: up119,
17505
+ up: up120,
17434
17506
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17435
17507
  },
17436
17508
  {
17437
17509
  version: 120,
17438
17510
  name: "source-lifecycle-telemetry",
17439
- up: up120,
17511
+ up: up121,
17440
17512
  artifacts: { tables: ["source_lifecycle_state"] }
17441
17513
  },
17442
17514
  {
17443
17515
  version: 121,
17444
17516
  name: "telemetry-delivery-health",
17445
- up: up121,
17517
+ up: up122,
17446
17518
  artifacts: {
17447
17519
  tables: ["telemetry_delivery_state"],
17448
17520
  columns: [
@@ -17456,7 +17528,7 @@ var MIGRATIONS = [
17456
17528
  {
17457
17529
  version: 122,
17458
17530
  name: "dreaming-evidence-retry",
17459
- up: up122,
17531
+ up: up123,
17460
17532
  artifacts: {
17461
17533
  columns: [
17462
17534
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17469,13 +17541,13 @@ var MIGRATIONS = [
17469
17541
  {
17470
17542
  version: 123,
17471
17543
  name: "embedding-index-failures",
17472
- up: up123,
17544
+ up: up124,
17473
17545
  artifacts: { tables: ["embedding_index_failures"] }
17474
17546
  },
17475
17547
  {
17476
17548
  version: 124,
17477
17549
  name: "import-derived-lifecycle",
17478
- up: up124,
17550
+ up: up125,
17479
17551
  artifacts: {
17480
17552
  tables: ["imported_source_lifecycle"]
17481
17553
  }
@@ -17483,77 +17555,77 @@ var MIGRATIONS = [
17483
17555
  {
17484
17556
  version: 125,
17485
17557
  name: "memory-content-safety",
17486
- up: up125,
17558
+ up: up126,
17487
17559
  artifacts: { tables: ["memory_content_safety"] }
17488
17560
  },
17489
17561
  {
17490
17562
  version: 126,
17491
17563
  name: "dreaming-surprisal-attention",
17492
- up: up126,
17564
+ up: up127,
17493
17565
  artifacts: { tables: ["dreaming_attention"] }
17494
17566
  },
17495
17567
  {
17496
17568
  version: 127,
17497
17569
  name: "ontology-contradictions",
17498
- up: up127,
17570
+ up: up128,
17499
17571
  artifacts: { tables: ["ontology_contradictions"] }
17500
17572
  },
17501
17573
  {
17502
17574
  version: 128,
17503
17575
  name: "bounded-queue-diagnostics",
17504
- up: up128
17576
+ up: up129
17505
17577
  },
17506
17578
  {
17507
17579
  version: 129,
17508
17580
  name: "retire-structural-jobs",
17509
- up: up129
17581
+ up: up130
17510
17582
  },
17511
17583
  {
17512
17584
  version: 130,
17513
17585
  name: "embedding-repair-state",
17514
- up: up130,
17586
+ up: up131,
17515
17587
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17516
17588
  },
17517
17589
  {
17518
17590
  version: 131,
17519
17591
  name: "dreaming-evidence-consumption",
17520
- up: up131,
17592
+ up: up132,
17521
17593
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17522
17594
  },
17523
17595
  {
17524
17596
  version: 132,
17525
17597
  name: "observer-scoped-epistemic-assertions",
17526
- up: up132,
17598
+ up: up133,
17527
17599
  artifacts: { tables: ["epistemic_assertions"] }
17528
17600
  },
17529
17601
  {
17530
17602
  version: 133,
17531
17603
  name: "dreaming-memory-head",
17532
- up: up133,
17604
+ up: up134,
17533
17605
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17534
17606
  },
17535
17607
  {
17536
17608
  version: 134,
17537
17609
  name: "scope-memory-head-entries",
17538
- up: up134,
17610
+ up: up135,
17539
17611
  artifacts: { tables: ["memory_head_entries"] }
17540
17612
  },
17541
17613
  {
17542
17614
  version: 135,
17543
17615
  name: "memory-head-publication",
17544
- up: up135,
17616
+ up: up136,
17545
17617
  artifacts: { tables: ["memory_head_publications"] }
17546
17618
  },
17547
17619
  {
17548
17620
  version: 136,
17549
17621
  name: "memory-head-revisions",
17550
- up: up136,
17622
+ up: up137,
17551
17623
  artifacts: { tables: ["memory_head_revisions"] }
17552
17624
  },
17553
17625
  {
17554
17626
  version: 137,
17555
17627
  name: "dreaming-head-manifest",
17556
- up: up137,
17628
+ up: up138,
17557
17629
  artifacts: {
17558
17630
  columns: [
17559
17631
  { table: "dreaming_passes", column: "head_revision" },
@@ -17564,7 +17636,7 @@ var MIGRATIONS = [
17564
17636
  {
17565
17637
  version: 138,
17566
17638
  name: "bounded-status-projections",
17567
- up: up138,
17639
+ up: up139,
17568
17640
  artifacts: {
17569
17641
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17570
17642
  }
@@ -17572,31 +17644,31 @@ var MIGRATIONS = [
17572
17644
  {
17573
17645
  version: 139,
17574
17646
  name: "native-source-sync-state",
17575
- up: up139,
17647
+ up: up140,
17576
17648
  artifacts: { tables: ["native_source_sync_state"] }
17577
17649
  },
17578
17650
  {
17579
17651
  version: 140,
17580
17652
  name: "transcript-recovery-frontier",
17581
- up: up140,
17653
+ up: up141,
17582
17654
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17583
17655
  },
17584
17656
  {
17585
17657
  version: 141,
17586
17658
  name: "source-sync-checkpoints",
17587
- up: up141,
17659
+ up: up142,
17588
17660
  artifacts: { tables: ["source_sync_checkpoints"] }
17589
17661
  },
17590
17662
  {
17591
17663
  version: 142,
17592
17664
  name: "source-sync-frontier",
17593
- up: up142,
17665
+ up: up143,
17594
17666
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17595
17667
  },
17596
17668
  {
17597
17669
  version: 143,
17598
17670
  name: "embedding-index-progress",
17599
- up: up143,
17671
+ up: up144,
17600
17672
  artifacts: {
17601
17673
  columns: [
17602
17674
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17612,19 +17684,19 @@ var MIGRATIONS = [
17612
17684
  {
17613
17685
  version: 144,
17614
17686
  name: "memory-job-lease-token",
17615
- up: up144,
17687
+ up: up145,
17616
17688
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17617
17689
  },
17618
17690
  {
17619
17691
  version: 145,
17620
17692
  name: "dreaming-evidence-reviews",
17621
- up: up145,
17693
+ up: up146,
17622
17694
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17623
17695
  },
17624
17696
  {
17625
17697
  version: 146,
17626
17698
  name: "source-transcript-import",
17627
- up: up146,
17699
+ up: up147,
17628
17700
  artifacts: {
17629
17701
  tables: [
17630
17702
  "source_import_jobs",
@@ -17643,19 +17715,19 @@ var MIGRATIONS = [
17643
17715
  {
17644
17716
  version: 147,
17645
17717
  name: "source-import-replay-file-slots",
17646
- up: up147,
17718
+ up: up148,
17647
17719
  artifacts: { tables: ["source_import_files"] }
17648
17720
  },
17649
17721
  {
17650
17722
  version: 148,
17651
17723
  name: "source-import-attempt-provenance",
17652
- up: up148,
17724
+ up: up149,
17653
17725
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17654
17726
  },
17655
17727
  {
17656
17728
  version: 149,
17657
17729
  name: "transcript-import-state-machine",
17658
- up: up149,
17730
+ up: up150,
17659
17731
  artifacts: {
17660
17732
  columns: [
17661
17733
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17667,13 +17739,42 @@ var MIGRATIONS = [
17667
17739
  {
17668
17740
  version: 150,
17669
17741
  name: "memory-head-freshness",
17670
- up: up150,
17742
+ up: up151,
17671
17743
  artifacts: {
17672
17744
  columns: [
17673
17745
  { table: "memory_md_heads", column: "is_current" },
17674
17746
  { table: "dreaming_passes", column: "head_base_revision" }
17675
17747
  ]
17676
17748
  }
17749
+ },
17750
+ {
17751
+ version: 151,
17752
+ name: "transcript-import-bytes",
17753
+ up,
17754
+ artifacts: {
17755
+ tables: [
17756
+ "source_import_chunks",
17757
+ "source_import_capacity",
17758
+ "source_import_migrations",
17759
+ "source_import_migration_streams",
17760
+ "source_import_migration_counts"
17761
+ ],
17762
+ columns: [
17763
+ { table: "source_import_files", column: "storage_state" },
17764
+ { table: "source_import_files", column: "upload_generation" },
17765
+ { table: "source_import_files", column: "upload_offset" },
17766
+ { table: "source_import_files", column: "upload_size" },
17767
+ { table: "source_import_files", column: "upload_digest" },
17768
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
17769
+ table: "source_import_files",
17770
+ column
17771
+ })),
17772
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
17773
+ table: "source_import_jobs",
17774
+ column
17775
+ }))
17776
+ ]
17777
+ }
17677
17778
  }
17678
17779
  ];
17679
17780
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;