@signetai/signet-memory-openclaw 0.221.7 → 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 (2) hide show
  1. package/dist/index.js +810 -608
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11562,6 +11562,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
11562
11562
  "checkpoint",
11563
11563
  "dreaming"
11564
11564
  ];
11565
+ function up(db) {
11566
+ const hasColumn = (table, column) => {
11567
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
11568
+ try {
11569
+ return statement.get(column) != null;
11570
+ } finally {
11571
+ statement.finalize?.();
11572
+ }
11573
+ };
11574
+ for (const [column, definition] of [
11575
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
11576
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
11577
+ ["upload_size", "INTEGER"],
11578
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
11579
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
11580
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
11581
+ ["original_path", "TEXT"],
11582
+ [
11583
+ "storage_state",
11584
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
11585
+ ]
11586
+ ]) {
11587
+ if (!hasColumn("source_import_files", column))
11588
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
11589
+ }
11590
+ if (!hasColumn("source_import_jobs", "retry_count"))
11591
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
11592
+ if (!hasColumn("source_import_jobs", "cleanup_state"))
11593
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
11594
+ if (!hasColumn("source_import_jobs", "retry_cursor"))
11595
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
11596
+ if (!hasColumn("source_import_jobs", "retry_requested"))
11597
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
11598
+ db.exec(`
11599
+ 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);
11600
+ 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;
11601
+ 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;
11602
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
11603
+ 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));
11604
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
11605
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
11606
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
11607
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
11608
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
11609
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
11610
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
11611
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
11612
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
11613
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
11614
+ ) WITHOUT ROWID;
11615
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
11616
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
11617
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
11618
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
11619
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
11620
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
11621
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
11622
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
11623
+ `);
11624
+ }
11565
11625
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11566
11626
  var FTS_STATE_TABLE = "memories_fts_state";
11567
11627
  function normalizeSql(sql) {
@@ -11677,7 +11737,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11677
11737
  return true;
11678
11738
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
11679
11739
  }
11680
- function up(db) {
11740
+ function up2(db) {
11681
11741
  db.exec(`
11682
11742
  CREATE TABLE IF NOT EXISTS schema_migrations (
11683
11743
  version INTEGER PRIMARY KEY,
@@ -11775,7 +11835,7 @@ function addColumnIfMissing(db, table, column, definition) {
11775
11835
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11776
11836
  }
11777
11837
  }
11778
- function up2(db) {
11838
+ function up3(db) {
11779
11839
  addColumnIfMissing(db, "memories", "content_hash", "TEXT");
11780
11840
  addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
11781
11841
  addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -11893,7 +11953,7 @@ function addColumnIfMissing2(db, table, column, definition) {
11893
11953
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11894
11954
  return true;
11895
11955
  }
11896
- function up3(db) {
11956
+ function up4(db) {
11897
11957
  addColumnIfMissing2(db, "memories", "why", "TEXT");
11898
11958
  addColumnIfMissing2(db, "memories", "project", "TEXT");
11899
11959
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -11930,7 +11990,7 @@ function addColumnIfMissing3(db, table, column, definition) {
11930
11990
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11931
11991
  }
11932
11992
  }
11933
- function up4(db) {
11993
+ function up5(db) {
11934
11994
  addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
11935
11995
  addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
11936
11996
  addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
@@ -11963,7 +12023,7 @@ function addColumnIfMissing4(db, table, column, definition) {
11963
12023
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11964
12024
  }
11965
12025
  }
11966
- function up5(db) {
12026
+ function up6(db) {
11967
12027
  addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
11968
12028
  addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
11969
12029
  addColumnIfMissing4(db, "entities", "embedding", "BLOB");
@@ -11980,7 +12040,7 @@ function hasColumn4(db, table, column) {
11980
12040
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11981
12041
  return rows.some((r2) => r2.name === column);
11982
12042
  }
11983
- function up6(db) {
12043
+ function up7(db) {
11984
12044
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11985
12045
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11986
12046
  }
@@ -11995,7 +12055,7 @@ function hasColumn5(db, table, column) {
11995
12055
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11996
12056
  return rows.some((r2) => r2.name === column);
11997
12057
  }
11998
- function up7(db) {
12058
+ function up8(db) {
11999
12059
  db.exec(`
12000
12060
  CREATE TABLE IF NOT EXISTS documents (
12001
12061
  id TEXT PRIMARY KEY,
@@ -12052,7 +12112,7 @@ function up7(db) {
12052
12112
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
12053
12113
  }
12054
12114
  }
12055
- function up8(db) {
12115
+ function up9(db) {
12056
12116
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
12057
12117
  if (tables.length === 0)
12058
12118
  return;
@@ -12069,7 +12129,7 @@ function up8(db) {
12069
12129
  ON embeddings(content_hash)
12070
12130
  `);
12071
12131
  }
12072
- function up9(db) {
12132
+ function up10(db) {
12073
12133
  db.exec(`
12074
12134
  CREATE TABLE IF NOT EXISTS summary_jobs (
12075
12135
  id TEXT PRIMARY KEY,
@@ -12089,7 +12149,7 @@ function up9(db) {
12089
12149
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
12090
12150
  ON summary_jobs(status)`);
12091
12151
  }
12092
- function up10(db) {
12152
+ function up11(db) {
12093
12153
  db.exec(`
12094
12154
  CREATE TABLE IF NOT EXISTS umap_cache (
12095
12155
  id INTEGER PRIMARY KEY,
@@ -12100,7 +12160,7 @@ function up10(db) {
12100
12160
  )
12101
12161
  `);
12102
12162
  }
12103
- function up11(db) {
12163
+ function up12(db) {
12104
12164
  db.exec(`
12105
12165
  CREATE TABLE IF NOT EXISTS session_scores (
12106
12166
  id TEXT PRIMARY KEY,
@@ -12120,7 +12180,7 @@ function up11(db) {
12120
12180
  ON session_scores(session_key);
12121
12181
  `);
12122
12182
  }
12123
- function up12(db) {
12183
+ function up13(db) {
12124
12184
  db.exec(`
12125
12185
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
12126
12186
  id TEXT PRIMARY KEY,
@@ -12161,7 +12221,7 @@ function addColumnIfMissing5(db, table, column, definition) {
12161
12221
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12162
12222
  }
12163
12223
  }
12164
- function up13(db) {
12224
+ function up14(db) {
12165
12225
  db.exec(`
12166
12226
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
12167
12227
  id TEXT PRIMARY KEY,
@@ -12187,7 +12247,7 @@ function up13(db) {
12187
12247
  addColumnIfMissing5(db, "memories", "source_path", "TEXT");
12188
12248
  addColumnIfMissing5(db, "memories", "source_section", "TEXT");
12189
12249
  }
12190
- function up14(db) {
12250
+ function up15(db) {
12191
12251
  db.exec(`
12192
12252
  CREATE TABLE IF NOT EXISTS telemetry_events (
12193
12253
  id TEXT PRIMARY KEY,
@@ -12212,7 +12272,7 @@ function addColumnIfMissing6(db, table, column, definition) {
12212
12272
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12213
12273
  }
12214
12274
  }
12215
- function up15(db) {
12275
+ function up16(db) {
12216
12276
  db.exec(`
12217
12277
  CREATE TABLE IF NOT EXISTS session_memories (
12218
12278
  id TEXT PRIMARY KEY,
@@ -12239,7 +12299,7 @@ function up15(db) {
12239
12299
  addColumnIfMissing6(db, "session_scores", "confidence", "REAL");
12240
12300
  addColumnIfMissing6(db, "session_scores", "continuity_reasoning", "TEXT");
12241
12301
  }
12242
- function up16(db) {
12302
+ function up17(db) {
12243
12303
  db.exec(`
12244
12304
  CREATE TABLE IF NOT EXISTS session_checkpoints (
12245
12305
  id TEXT PRIMARY KEY,
@@ -12261,7 +12321,7 @@ function up16(db) {
12261
12321
  ON session_checkpoints(project_normalized, created_at DESC);
12262
12322
  `);
12263
12323
  }
12264
- function up17(db) {
12324
+ function up18(db) {
12265
12325
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12266
12326
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12267
12327
  if (!colNames.has("skill_name")) {
@@ -12272,7 +12332,7 @@ function up17(db) {
12272
12332
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
12273
12333
  }
12274
12334
  }
12275
- function up18(db) {
12335
+ function up19(db) {
12276
12336
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12277
12337
  if (existing)
12278
12338
  return;
@@ -12304,7 +12364,7 @@ function up18(db) {
12304
12364
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
12305
12365
  `);
12306
12366
  }
12307
- function up19(db) {
12367
+ function up20(db) {
12308
12368
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12309
12369
  const entityColNames = new Set(entityCols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12310
12370
  if (!entityColNames.has("agent_id")) {
@@ -12389,13 +12449,13 @@ function addColumnIfMissing7(db, table, column, definition) {
12389
12449
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12390
12450
  }
12391
12451
  }
12392
- function up20(db) {
12452
+ function up21(db) {
12393
12453
  addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12394
12454
  addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12395
12455
  addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12396
12456
  addColumnIfMissing7(db, "session_memories", "structural_density", "INTEGER");
12397
12457
  }
12398
- function up21(db) {
12458
+ function up22(db) {
12399
12459
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12400
12460
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12401
12461
  if (!columnNames.has("focal_entity_ids")) {
@@ -12420,25 +12480,25 @@ function addColumnIfMissing8(db, table, column, definition) {
12420
12480
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12421
12481
  }
12422
12482
  }
12423
- function up22(db) {
12483
+ function up23(db) {
12424
12484
  addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12425
12485
  addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12426
12486
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12427
12487
  }
12428
- function up23(_db) {}
12429
12488
  function up24(_db) {}
12489
+ function up25(_db) {}
12430
12490
  function addColumnIfMissing9(db, table, column, definition) {
12431
12491
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12432
12492
  if (!cols.some((c2) => c2.name === column)) {
12433
12493
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12434
12494
  }
12435
12495
  }
12436
- function up25(db) {
12496
+ function up26(db) {
12437
12497
  addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12438
12498
  addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12439
12499
  }
12440
- function up26(_db) {}
12441
- function up27(db) {
12500
+ function up27(_db) {}
12501
+ function up28(db) {
12442
12502
  db.exec(`
12443
12503
  UPDATE entities
12444
12504
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12447,7 +12507,7 @@ function up27(db) {
12447
12507
  WHERE canonical_name IS NULL
12448
12508
  `);
12449
12509
  }
12450
- function up28(db) {
12510
+ function up29(db) {
12451
12511
  db.exec(`
12452
12512
  CREATE TABLE IF NOT EXISTS memories_cold (
12453
12513
  archive_id TEXT PRIMARY KEY,
@@ -12484,7 +12544,7 @@ function up28(db) {
12484
12544
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
12485
12545
  `);
12486
12546
  }
12487
- function up29(db) {
12547
+ function up30(db) {
12488
12548
  db.exec(`
12489
12549
  CREATE TABLE IF NOT EXISTS session_summaries (
12490
12550
  id TEXT PRIMARY KEY,
@@ -12529,7 +12589,7 @@ function up29(db) {
12529
12589
  WHERE session_key IS NOT NULL;
12530
12590
  `);
12531
12591
  }
12532
- function up30(db) {
12592
+ function up31(db) {
12533
12593
  db.exec(`
12534
12594
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12535
12595
  id TEXT PRIMARY KEY,
@@ -12574,7 +12634,7 @@ function up30(db) {
12574
12634
  ON memory_jobs(failed_at);
12575
12635
  `);
12576
12636
  }
12577
- function up31(db) {
12637
+ function up32(db) {
12578
12638
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12579
12639
  if (!depCols.some((c2) => c2.name === "reason")) {
12580
12640
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12584,7 +12644,7 @@ function up31(db) {
12584
12644
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
12585
12645
  }
12586
12646
  }
12587
- function up32(db) {
12647
+ function up33(db) {
12588
12648
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12589
12649
  if (cols.length === 0)
12590
12650
  return;
@@ -12592,14 +12652,14 @@ function up32(db) {
12592
12652
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
12593
12653
  }
12594
12654
  }
12595
- function up33(db) {
12655
+ function up34(db) {
12596
12656
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12597
12657
  if (!cols.some((c2) => c2.name === "scope")) {
12598
12658
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
12599
12659
  }
12600
12660
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
12601
12661
  }
12602
- function up34(db) {
12662
+ function up35(db) {
12603
12663
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12604
12664
  db.exec(`
12605
12665
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12607,7 +12667,7 @@ function up34(db) {
12607
12667
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12608
12668
  `);
12609
12669
  }
12610
- function up35(db) {
12670
+ function up36(db) {
12611
12671
  db.exec(`
12612
12672
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12613
12673
  name, canonical_name,
@@ -12639,13 +12699,13 @@ function up35(db) {
12639
12699
  END
12640
12700
  `);
12641
12701
  }
12642
- function up36(db) {
12702
+ function up37(db) {
12643
12703
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12644
12704
  if (!cols.some((c2) => c2.name === "confidence")) {
12645
12705
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
12646
12706
  }
12647
12707
  }
12648
- function up37(db) {
12708
+ function up38(db) {
12649
12709
  db.exec(`
12650
12710
  CREATE TABLE IF NOT EXISTS entity_communities (
12651
12711
  id TEXT PRIMARY KEY,
@@ -12663,7 +12723,7 @@ function up37(db) {
12663
12723
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
12664
12724
  }
12665
12725
  }
12666
- function up38(db) {
12726
+ function up39(db) {
12667
12727
  db.exec(`
12668
12728
  CREATE TABLE IF NOT EXISTS memory_hints (
12669
12729
  id TEXT PRIMARY KEY,
@@ -12703,7 +12763,7 @@ function up38(db) {
12703
12763
  END
12704
12764
  `);
12705
12765
  }
12706
- function up39(db) {
12766
+ function up40(db) {
12707
12767
  db.exec(`
12708
12768
  DELETE FROM entity_dependencies
12709
12769
  WHERE id NOT IN (
@@ -12721,7 +12781,7 @@ function up39(db) {
12721
12781
  )
12722
12782
  `);
12723
12783
  }
12724
- function up40(db) {
12784
+ function up41(db) {
12725
12785
  db.exec(`
12726
12786
  CREATE TABLE IF NOT EXISTS session_transcripts (
12727
12787
  session_key TEXT PRIMARY KEY,
@@ -12744,7 +12804,7 @@ function addColumnIfMissing10(db, table, column, definition) {
12744
12804
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12745
12805
  }
12746
12806
  }
12747
- function up41(db) {
12807
+ function up42(db) {
12748
12808
  addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
12749
12809
  db.exec(`
12750
12810
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -12819,7 +12879,7 @@ function addColumnIfMissing11(db, table, column, definition) {
12819
12879
  return;
12820
12880
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12821
12881
  }
12822
- function up42(db) {
12882
+ function up43(db) {
12823
12883
  addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
12824
12884
  addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
12825
12885
  addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12907,7 +12967,7 @@ function addColumnIfMissing12(db, table, column, definition) {
12907
12967
  return;
12908
12968
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12909
12969
  }
12910
- function up43(db) {
12970
+ function up44(db) {
12911
12971
  db.exec(`
12912
12972
  CREATE TABLE IF NOT EXISTS agents (
12913
12973
  id TEXT PRIMARY KEY,
@@ -12936,7 +12996,7 @@ function addColumnIfMissing13(db, table, column, definition) {
12936
12996
  return;
12937
12997
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12938
12998
  }
12939
- function up44(db) {
12999
+ function up45(db) {
12940
13000
  addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
12941
13001
  addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
12942
13002
  addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
@@ -12962,7 +13022,7 @@ function addColumnIfMissing14(db, table, column, definition) {
12962
13022
  return;
12963
13023
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12964
13024
  }
12965
- function up45(db) {
13025
+ function up46(db) {
12966
13026
  addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
12967
13027
  addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12968
13028
  addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -13033,7 +13093,7 @@ function up45(db) {
13033
13093
  ON memory_md_heads(lease_expires_at);
13034
13094
  `);
13035
13095
  }
13036
- function up46(db) {
13096
+ function up47(db) {
13037
13097
  db.exec(`
13038
13098
  DROP INDEX IF EXISTS idx_summaries_session_depth;
13039
13099
 
@@ -13094,7 +13154,7 @@ function up46(db) {
13094
13154
  AND COALESCE(source_type, 'summary') = 'summary';
13095
13155
  `);
13096
13156
  }
13097
- function up47(db) {
13157
+ function up48(db) {
13098
13158
  db.exec(`
13099
13159
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
13100
13160
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -13192,7 +13252,7 @@ function up47(db) {
13192
13252
  AND COALESCE(source_type, 'summary') = 'summary';
13193
13253
  `);
13194
13254
  }
13195
- function up48(db) {
13255
+ function up49(db) {
13196
13256
  db.exec(`
13197
13257
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
13198
13258
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13310,7 +13370,7 @@ function up48(db) {
13310
13370
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
13311
13371
  `);
13312
13372
  }
13313
- function up49(db) {
13373
+ function up50(db) {
13314
13374
  db.exec(`
13315
13375
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13316
13376
  session_key TEXT NOT NULL,
@@ -13327,7 +13387,7 @@ function hasTable(db, name) {
13327
13387
  WHERE type = 'table' AND name = ?
13328
13388
  LIMIT 1`).get(name) !== undefined;
13329
13389
  }
13330
- function up50(db) {
13390
+ function up51(db) {
13331
13391
  db.exec(`
13332
13392
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13333
13393
  id TEXT PRIMARY KEY,
@@ -13497,7 +13557,7 @@ function addColumnIfMissing15(db, table, column, definition) {
13497
13557
  return;
13498
13558
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13499
13559
  }
13500
- function up51(db) {
13560
+ function up52(db) {
13501
13561
  addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13502
13562
  addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13503
13563
  addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
@@ -13589,7 +13649,7 @@ function up51(db) {
13589
13649
  VALUES ('rebuild');
13590
13650
  `);
13591
13651
  }
13592
- function up52(db) {
13652
+ function up53(db) {
13593
13653
  db.exec(`
13594
13654
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13595
13655
  id TEXT PRIMARY KEY,
@@ -13606,7 +13666,7 @@ function up52(db) {
13606
13666
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13607
13667
  `);
13608
13668
  }
13609
- function up53(db) {
13669
+ function up54(db) {
13610
13670
  db.exec(`
13611
13671
  CREATE TABLE IF NOT EXISTS skill_invocations (
13612
13672
  id TEXT PRIMARY KEY,
@@ -13622,7 +13682,7 @@ function up53(db) {
13622
13682
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
13623
13683
  `);
13624
13684
  }
13625
- function up54(db) {
13685
+ function up55(db) {
13626
13686
  db.exec(`
13627
13687
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13628
13688
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13653,7 +13713,7 @@ function up54(db) {
13653
13713
  ON task_scope_hints(agent_id, updated_at);
13654
13714
  `);
13655
13715
  }
13656
- function up55(db) {
13716
+ function up56(db) {
13657
13717
  db.exec(`
13658
13718
  CREATE TABLE IF NOT EXISTS dreaming_state (
13659
13719
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13696,7 +13756,7 @@ function ensureMemoriesScopeColumns(db) {
13696
13756
  if (!names.has("scope"))
13697
13757
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13698
13758
  }
13699
- function up56(db) {
13759
+ function up57(db) {
13700
13760
  ensureMemoriesScopeColumns(db);
13701
13761
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13702
13762
  db.exec(`
@@ -13709,20 +13769,20 @@ function up56(db) {
13709
13769
  WHERE content_hash IS NOT NULL AND is_deleted = 0
13710
13770
  `);
13711
13771
  }
13712
- function up57(db) {
13772
+ function up58(db) {
13713
13773
  const sql = readMemoriesFtsSql(db);
13714
13774
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13715
13775
  return;
13716
13776
  recreateMemoriesFts(db);
13717
13777
  }
13718
- function up58(db) {
13778
+ function up59(db) {
13719
13779
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13720
13780
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13721
13781
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
13722
13782
  ON entities(entity_type, mentions)
13723
13783
  WHERE entity_type = 'extracted'`);
13724
13784
  }
13725
- function up59(db) {
13785
+ function up60(db) {
13726
13786
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13727
13787
  if (!cols.some((col) => col.name === "claim_key")) {
13728
13788
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13731,7 +13791,7 @@ function up59(db) {
13731
13791
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
13732
13792
  WHERE claim_key IS NOT NULL`);
13733
13793
  }
13734
- function up60(db) {
13794
+ function up61(db) {
13735
13795
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13736
13796
  if (!cols.some((col) => col.name === "group_key")) {
13737
13797
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13743,13 +13803,13 @@ function up60(db) {
13743
13803
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
13744
13804
  WHERE claim_key IS NOT NULL`);
13745
13805
  }
13746
- function up61(db) {
13806
+ function up62(db) {
13747
13807
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13748
13808
  if (cols.some((col) => col.name === "source_mtime_ms"))
13749
13809
  return;
13750
13810
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
13751
13811
  }
13752
- function up62(db) {
13812
+ function up63(db) {
13753
13813
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13754
13814
  const names = new Set(cols.map((col) => col.name));
13755
13815
  if (!names.has("is_deleted")) {
@@ -13763,7 +13823,7 @@ function up62(db) {
13763
13823
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
13764
13824
  `);
13765
13825
  }
13766
- function up63(db) {
13826
+ function up64(db) {
13767
13827
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13768
13828
  db.exec(`
13769
13829
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13781,7 +13841,7 @@ function addColumnIfMissing16(db, table, column, definition) {
13781
13841
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13782
13842
  }
13783
13843
  }
13784
- function up64(db) {
13844
+ function up65(db) {
13785
13845
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13786
13846
  addColumnIfMissing16(db, table, "source_id", "TEXT");
13787
13847
  addColumnIfMissing16(db, table, "source_kind", "TEXT");
@@ -13801,7 +13861,7 @@ function hasColumn7(db, table, column) {
13801
13861
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13802
13862
  return rows.some((row) => row.name === column);
13803
13863
  }
13804
- function up65(db) {
13864
+ function up66(db) {
13805
13865
  if (!hasTable2(db, "embeddings"))
13806
13866
  return;
13807
13867
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13809,7 +13869,7 @@ function up65(db) {
13809
13869
  }
13810
13870
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
13811
13871
  }
13812
- function up66(db) {
13872
+ function up67(db) {
13813
13873
  db.exec(`
13814
13874
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13815
13875
  id TEXT PRIMARY KEY,
@@ -13850,7 +13910,7 @@ function addColumnIfMissing17(db, table, column, definition) {
13850
13910
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13851
13911
  }
13852
13912
  }
13853
- function up67(db) {
13913
+ function up68(db) {
13854
13914
  db.exec(`
13855
13915
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13856
13916
  id TEXT PRIMARY KEY,
@@ -13893,7 +13953,7 @@ function up67(db) {
13893
13953
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
13894
13954
  }
13895
13955
  }
13896
- function up68(db) {
13956
+ function up69(db) {
13897
13957
  db.exec(`
13898
13958
  CREATE TABLE IF NOT EXISTS daily_reflections (
13899
13959
  id TEXT PRIMARY KEY,
@@ -13920,7 +13980,7 @@ function up68(db) {
13920
13980
  WHERE content_key IS NOT NULL;
13921
13981
  `);
13922
13982
  }
13923
- function up69(db) {
13983
+ function up70(db) {
13924
13984
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13925
13985
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
13926
13986
  if (!colNames.has("content_key")) {
@@ -13957,7 +14017,7 @@ function backfillVersionRoots(db) {
13957
14017
  WHERE version_root_id IS NULL
13958
14018
  `);
13959
14019
  }
13960
- function up70(db) {
14020
+ function up71(db) {
13961
14021
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13962
14022
  addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13963
14023
  addColumnIfMissing18(db, table, "archived_at", "TEXT");
@@ -13992,7 +14052,7 @@ function up70(db) {
13992
14052
  ON entity_aspects(agent_id, proposal_id);
13993
14053
  `);
13994
14054
  }
13995
- function up71(db) {
14055
+ function up72(db) {
13996
14056
  db.exec(`
13997
14057
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13998
14058
  id TEXT PRIMARY KEY,
@@ -14048,7 +14108,7 @@ function ensureMemoriesScopeColumns2(db) {
14048
14108
  if (!names.has("runtime_path"))
14049
14109
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
14050
14110
  }
14051
- function up72(db) {
14111
+ function up73(db) {
14052
14112
  ensureMemoriesScopeColumns2(db);
14053
14113
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
14054
14114
  db.exec(`
@@ -14062,7 +14122,7 @@ function up72(db) {
14062
14122
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
14063
14123
  `);
14064
14124
  }
14065
- function up73(db) {
14125
+ function up74(db) {
14066
14126
  db.exec(`
14067
14127
  CREATE TABLE IF NOT EXISTS session_context_epochs (
14068
14128
  session_key TEXT NOT NULL,
@@ -14097,7 +14157,7 @@ function up73(db) {
14097
14157
  ON session_recall_events(item_kind, item_id, created_at DESC);
14098
14158
  `);
14099
14159
  }
14100
- function up74(db) {
14160
+ function up75(db) {
14101
14161
  db.exec(`
14102
14162
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
14103
14163
  aggregate_memory_id TEXT NOT NULL,
@@ -14116,7 +14176,7 @@ function addColumnIfMissing19(db, table, column, definition) {
14116
14176
  return;
14117
14177
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14118
14178
  }
14119
- function up75(db) {
14179
+ function up76(db) {
14120
14180
  addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
14121
14181
  addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
14122
14182
  addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -14129,7 +14189,7 @@ function up75(db) {
14129
14189
  ON memory_artifacts(agent_id, source_id, source_root);
14130
14190
  `);
14131
14191
  }
14132
- function up76(db) {
14192
+ function up77(db) {
14133
14193
  db.exec(`
14134
14194
  CREATE TABLE IF NOT EXISTS temporal_edges (
14135
14195
  id TEXT PRIMARY KEY,
@@ -14152,7 +14212,7 @@ function up76(db) {
14152
14212
  ON temporal_edges(agent_id, subject_type, subject_id);
14153
14213
  `);
14154
14214
  }
14155
- function up77(db) {
14215
+ function up78(db) {
14156
14216
  db.exec(`
14157
14217
  CREATE TABLE IF NOT EXISTS entity_aliases (
14158
14218
  id TEXT PRIMARY KEY,
@@ -14176,7 +14236,7 @@ function up77(db) {
14176
14236
  ON entity_aliases(agent_id, canonical_alias, status);
14177
14237
  `);
14178
14238
  }
14179
- function up78(db) {
14239
+ function up79(db) {
14180
14240
  db.exec(`
14181
14241
  CREATE TABLE IF NOT EXISTS api_keys (
14182
14242
  id TEXT PRIMARY KEY,
@@ -14204,7 +14264,7 @@ function up78(db) {
14204
14264
  ON api_keys(connector, harness);
14205
14265
  `);
14206
14266
  }
14207
- function up79(db) {
14267
+ function up80(db) {
14208
14268
  db.exec(`
14209
14269
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
14210
14270
  id TEXT PRIMARY KEY,
@@ -14239,7 +14299,7 @@ function hasColumn10(db, table, column) {
14239
14299
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14240
14300
  return rows.some((row) => row.name === column);
14241
14301
  }
14242
- function up80(db) {
14302
+ function up81(db) {
14243
14303
  if (!hasColumn10(db, "documents", "agent_id")) {
14244
14304
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
14245
14305
  }
@@ -14325,7 +14385,7 @@ function up80(db) {
14325
14385
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
14326
14386
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
14327
14387
  }
14328
- function up81(db) {
14388
+ function up82(db) {
14329
14389
  db.exec(`
14330
14390
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14331
14391
  aggregate_memory_id TEXT NOT NULL,
@@ -14347,7 +14407,7 @@ function hasColumn11(db, table, column) {
14347
14407
  return rows.some((row) => row.name === column);
14348
14408
  }
14349
14409
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14350
- function up82(db) {
14410
+ function up83(db) {
14351
14411
  for (const column of COLUMNS) {
14352
14412
  if (!hasColumn11(db, "skill_invocations", column)) {
14353
14413
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14428,7 +14488,7 @@ function documentScopeColumnsPreservingExisting(db) {
14428
14488
  `);
14429
14489
  }
14430
14490
  try {
14431
- up80(db);
14491
+ up81(db);
14432
14492
  if (preserveAgentId) {
14433
14493
  db.exec(`
14434
14494
  UPDATE documents
@@ -14448,12 +14508,12 @@ function documentScopeColumnsPreservingExisting(db) {
14448
14508
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14449
14509
  }
14450
14510
  }
14451
- function up83(db) {
14452
- up79(db);
14511
+ function up84(db) {
14512
+ up80(db);
14453
14513
  if (hasTable3(db, "documents")) {
14454
14514
  documentScopeColumnsPreservingExisting(db);
14455
14515
  }
14456
- up81(db);
14516
+ up82(db);
14457
14517
  addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14458
14518
  addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14459
14519
  addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
@@ -14510,7 +14570,7 @@ function up83(db) {
14510
14570
  AND ${sourceAgentId} = ${targetAgentId}
14511
14571
  `);
14512
14572
  }
14513
- function up84(db) {
14573
+ function up85(db) {
14514
14574
  db.exec(`
14515
14575
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14516
14576
  path TEXT PRIMARY KEY,
@@ -14540,7 +14600,7 @@ function up84(db) {
14540
14600
  ON legacy_markdown_chunks(memory_id);
14541
14601
  `);
14542
14602
  }
14543
- function up85(db) {
14603
+ function up86(db) {
14544
14604
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14545
14605
  const tableNames = new Set(tables.map((r2) => String(r2.name)));
14546
14606
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14599,7 +14659,7 @@ function addColumnIfMissing21(db, table, column, definition) {
14599
14659
  return;
14600
14660
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14601
14661
  }
14602
- function up86(db) {
14662
+ function up87(db) {
14603
14663
  addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
14604
14664
  db.exec(`
14605
14665
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -14612,14 +14672,14 @@ function addColumnIfMissing22(db, table, column, definition) {
14612
14672
  return;
14613
14673
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14614
14674
  }
14615
- function up87(db) {
14675
+ function up88(db) {
14616
14676
  addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
14617
14677
  db.exec(`
14618
14678
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
14619
14679
  ON summary_jobs(agent_id, session_key, boundary_reason)
14620
14680
  `);
14621
14681
  }
14622
- function up88(db) {
14682
+ function up89(db) {
14623
14683
  db.exec(`
14624
14684
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14625
14685
  agent_id TEXT NOT NULL,
@@ -14637,7 +14697,7 @@ function up88(db) {
14637
14697
  ON transcript_capture_jobs(agent_id, session_id, status);
14638
14698
  `);
14639
14699
  }
14640
- function up89(db) {
14700
+ function up90(db) {
14641
14701
  db.exec(`
14642
14702
  CREATE TABLE IF NOT EXISTS job_cancellations (
14643
14703
  id TEXT PRIMARY KEY,
@@ -14665,7 +14725,7 @@ function indexExists(db, table, indexName) {
14665
14725
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14666
14726
  return rows.some((row) => row.name === indexName);
14667
14727
  }
14668
- function up90(db) {
14728
+ function up91(db) {
14669
14729
  db.exec(`
14670
14730
  CREATE TABLE IF NOT EXISTS job_archive (
14671
14731
  id TEXT PRIMARY KEY,
@@ -14692,7 +14752,7 @@ function indexExists2(db, table, indexName) {
14692
14752
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14693
14753
  return rows.some((row) => row.name === indexName);
14694
14754
  }
14695
- function up91(db) {
14755
+ function up92(db) {
14696
14756
  db.exec(`
14697
14757
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14698
14758
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14705,7 +14765,7 @@ function up91(db) {
14705
14765
  )
14706
14766
  `);
14707
14767
  }
14708
- function up92(db) {
14768
+ function up93(db) {
14709
14769
  db.exec(`
14710
14770
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14711
14771
  id TEXT PRIMARY KEY,
@@ -14724,7 +14784,7 @@ function up92(db) {
14724
14784
  ON embeddings_staging(agent_id, source_type, source_id);
14725
14785
  `);
14726
14786
  }
14727
- function up93(db) {
14787
+ function up94(db) {
14728
14788
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14729
14789
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14730
14790
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14735,7 +14795,7 @@ function hasColumn13(db, table, column) {
14735
14795
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14736
14796
  return rows.some((r2) => r2.name === column);
14737
14797
  }
14738
- function up94(db) {
14798
+ function up95(db) {
14739
14799
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14740
14800
  if (tables.length === 0)
14741
14801
  return;
@@ -14760,23 +14820,23 @@ function up94(db) {
14760
14820
  function hasColumn14(db, table, column) {
14761
14821
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14762
14822
  }
14763
- function up95(db) {
14823
+ function up96(db) {
14764
14824
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14765
14825
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14766
14826
  return;
14767
14827
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
14768
14828
  }
14769
- function up96(db) {
14829
+ function up97(db) {
14770
14830
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14771
14831
  }
14772
- function up97(db) {
14832
+ function up98(db) {
14773
14833
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14774
14834
  if (!columns.some((column) => column.name === "last_failure_at")) {
14775
14835
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
14776
14836
  }
14777
14837
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
14778
14838
  }
14779
- function up98(db) {
14839
+ function up99(db) {
14780
14840
  db.exec(`
14781
14841
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14782
14842
  agent_id TEXT NOT NULL,
@@ -14793,7 +14853,7 @@ function up98(db) {
14793
14853
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
14794
14854
  `);
14795
14855
  }
14796
- function up99(db) {
14856
+ function up100(db) {
14797
14857
  db.exec(`
14798
14858
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14799
14859
  id TEXT PRIMARY KEY,
@@ -14813,7 +14873,7 @@ function up99(db) {
14813
14873
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
14814
14874
  `);
14815
14875
  }
14816
- function up100(db) {
14876
+ function up101(db) {
14817
14877
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14818
14878
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14819
14879
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14822,7 +14882,7 @@ function up100(db) {
14822
14882
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
14823
14883
  }
14824
14884
  }
14825
- function up101(db) {
14885
+ function up102(db) {
14826
14886
  db.exec(`
14827
14887
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14828
14888
  id TEXT PRIMARY KEY,
@@ -14844,7 +14904,7 @@ function up101(db) {
14844
14904
  function hasColumn15(db, table, column) {
14845
14905
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14846
14906
  }
14847
- function up102(db) {
14907
+ function up103(db) {
14848
14908
  const requiredMemoryColumns = [
14849
14909
  "content_hash",
14850
14910
  "normalized_content",
@@ -14895,7 +14955,7 @@ function up102(db) {
14895
14955
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
14896
14956
  `);
14897
14957
  }
14898
- function up103(db) {
14958
+ function up104(db) {
14899
14959
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14900
14960
  if (tables.length !== 2)
14901
14961
  return;
@@ -14918,7 +14978,7 @@ function tableExists(db, table) {
14918
14978
  function hasColumn16(db, table, column) {
14919
14979
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14920
14980
  }
14921
- function up104(db) {
14981
+ function up105(db) {
14922
14982
  db.exec(`
14923
14983
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14924
14984
  derived_memory_id TEXT NOT NULL,
@@ -14961,7 +15021,7 @@ function up104(db) {
14961
15021
  `);
14962
15022
  }
14963
15023
  }
14964
- function up105(db) {
15024
+ function up106(db) {
14965
15025
  db.exec(`
14966
15026
  DROP TRIGGER IF EXISTS entities_fts_ai;
14967
15027
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -15050,7 +15110,7 @@ function up105(db) {
15050
15110
  function hasColumn17(db, table, column) {
15051
15111
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15052
15112
  }
15053
- function up106(db) {
15113
+ function up107(db) {
15054
15114
  if (!hasColumn17(db, "memories", "review_after")) {
15055
15115
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
15056
15116
  }
@@ -15066,14 +15126,14 @@ var TOKEN_COLUMNS = [
15066
15126
  ["tokens_cache_write", "INTEGER"],
15067
15127
  ["tokens_cost", "REAL"]
15068
15128
  ];
15069
- function up107(db) {
15129
+ function up108(db) {
15070
15130
  for (const [column, type] of TOKEN_COLUMNS) {
15071
15131
  if (!hasColumn18(db, "dreaming_passes", column)) {
15072
15132
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
15073
15133
  }
15074
15134
  }
15075
15135
  }
15076
- function up108(db) {
15136
+ function up109(db) {
15077
15137
  db.exec(`
15078
15138
  CREATE TABLE IF NOT EXISTS embedding_usage (
15079
15139
  day TEXT NOT NULL,
@@ -15086,7 +15146,7 @@ function up108(db) {
15086
15146
  );
15087
15147
  `);
15088
15148
  }
15089
- function up109(db) {
15149
+ function up110(db) {
15090
15150
  db.exec(`
15091
15151
  CREATE TABLE IF NOT EXISTS telemetry_install (
15092
15152
  id TEXT PRIMARY KEY,
@@ -15094,7 +15154,7 @@ function up109(db) {
15094
15154
  );
15095
15155
  `);
15096
15156
  }
15097
- function up110(db) {
15157
+ function up111(db) {
15098
15158
  db.exec(`
15099
15159
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
15100
15160
  ON memory_entity_mentions(entity_id, memory_id);
@@ -15105,7 +15165,7 @@ function hasColumn19(db, table, column) {
15105
15165
  return rows.some((row) => row.name === column);
15106
15166
  }
15107
15167
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
15108
- function up111(db) {
15168
+ function up112(db) {
15109
15169
  for (const column of COLUMNS2) {
15110
15170
  if (!hasColumn19(db, "telemetry_install", column)) {
15111
15171
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -15121,7 +15181,7 @@ function addColumnIfMissing23(db, column, definition) {
15121
15181
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15122
15182
  }
15123
15183
  }
15124
- function up112(db) {
15184
+ function up113(db) {
15125
15185
  addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
15126
15186
  addColumnIfMissing23(db, "claim_token", "TEXT");
15127
15187
  addColumnIfMissing23(db, "claimed_at", "TEXT");
@@ -15130,7 +15190,7 @@ function up112(db) {
15130
15190
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
15131
15191
  `);
15132
15192
  }
15133
- function up113(db) {
15193
+ function up114(db) {
15134
15194
  db.exec(`
15135
15195
  CREATE TABLE IF NOT EXISTS session_claims (
15136
15196
  session_key TEXT NOT NULL,
@@ -15151,7 +15211,7 @@ function up113(db) {
15151
15211
  ON session_claims(agent_id, state, expires_at);
15152
15212
  `);
15153
15213
  }
15154
- function up114(db) {
15214
+ function up115(db) {
15155
15215
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
15156
15216
  if (table == null)
15157
15217
  return;
@@ -15160,7 +15220,7 @@ function up114(db) {
15160
15220
  ON entity_attributes(memory_id, agent_id, status, importance);
15161
15221
  `);
15162
15222
  }
15163
- function up115(db) {
15223
+ function up116(db) {
15164
15224
  db.exec(`
15165
15225
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
15166
15226
  id TEXT PRIMARY KEY,
@@ -15217,7 +15277,7 @@ function addColumnIfMissing24(db, column, definition) {
15217
15277
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
15218
15278
  }
15219
15279
  }
15220
- function up116(db) {
15280
+ function up117(db) {
15221
15281
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
15222
15282
  if (table == null)
15223
15283
  return;
@@ -15418,7 +15478,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15418
15478
  insert.run(...values);
15419
15479
  }
15420
15480
  }
15421
- function up117(db) {
15481
+ function up118(db) {
15422
15482
  if (!hasTable4(db, "session_transcripts"))
15423
15483
  return;
15424
15484
  addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
@@ -15471,7 +15531,7 @@ function up117(db) {
15471
15531
  ON session_transcripts(agent_id, content_hash);
15472
15532
  `);
15473
15533
  }
15474
- function up118(db) {
15534
+ function up119(db) {
15475
15535
  db.exec(`
15476
15536
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15477
15537
  ON memory_jobs(status)
@@ -15490,12 +15550,12 @@ function up118(db) {
15490
15550
  function hasColumn22(db, table, column) {
15491
15551
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15492
15552
  }
15493
- function up119(db) {
15553
+ function up120(db) {
15494
15554
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15495
15555
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15496
15556
  }
15497
15557
  }
15498
- function up120(db) {
15558
+ function up121(db) {
15499
15559
  db.exec(`
15500
15560
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15501
15561
  agent_id TEXT NOT NULL,
@@ -15524,7 +15584,7 @@ function addColumnIfMissing26(db, column, definition) {
15524
15584
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15525
15585
  }
15526
15586
  }
15527
- function up121(db) {
15587
+ function up122(db) {
15528
15588
  addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15529
15589
  addColumnIfMissing26(db, "last_attempt_at", "TEXT");
15530
15590
  addColumnIfMissing26(db, "sent_at", "TEXT");
@@ -15545,7 +15605,7 @@ function up121(db) {
15545
15605
  VALUES (1, CURRENT_TIMESTAMP);
15546
15606
  `);
15547
15607
  }
15548
- function up122(db) {
15608
+ function up123(db) {
15549
15609
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15550
15610
  const names = new Set(columns.map((column) => column.name));
15551
15611
  if (!names.has("failure_class")) {
@@ -15562,7 +15622,7 @@ function up122(db) {
15562
15622
  }
15563
15623
  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)");
15564
15624
  }
15565
- function up123(db) {
15625
+ function up124(db) {
15566
15626
  db.exec(`
15567
15627
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15568
15628
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15586,7 +15646,7 @@ function up123(db) {
15586
15646
  ON embedding_index_failures(source_type, source_id);
15587
15647
  `);
15588
15648
  }
15589
- function up124(db) {
15649
+ function up125(db) {
15590
15650
  db.exec(`
15591
15651
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15592
15652
  id TEXT PRIMARY KEY,
@@ -15636,7 +15696,7 @@ function backfillTable(db, params) {
15636
15696
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15637
15697
  backfill(db, rows, params.sourceKind, params.scannedAt);
15638
15698
  }
15639
- function up125(db) {
15699
+ function up126(db) {
15640
15700
  db.exec(`
15641
15701
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15642
15702
  agent_id TEXT NOT NULL,
@@ -15693,7 +15753,7 @@ function up125(db) {
15693
15753
  scannedAt
15694
15754
  });
15695
15755
  }
15696
- function up126(db) {
15756
+ function up127(db) {
15697
15757
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15698
15758
  if (!table)
15699
15759
  return;
@@ -15727,7 +15787,7 @@ function up126(db) {
15727
15787
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
15728
15788
  `);
15729
15789
  }
15730
- function up127(db) {
15790
+ function up128(db) {
15731
15791
  db.exec(`
15732
15792
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15733
15793
  id TEXT PRIMARY KEY,
@@ -15783,7 +15843,7 @@ function up127(db) {
15783
15843
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
15784
15844
  `);
15785
15845
  }
15786
- function up128(db) {
15846
+ function up129(db) {
15787
15847
  db.exec(`
15788
15848
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15789
15849
  ON memory_jobs(status, created_at)
@@ -15798,7 +15858,7 @@ function up128(db) {
15798
15858
  function tableExists3(db, table) {
15799
15859
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15800
15860
  }
15801
- function up129(db) {
15861
+ function up130(db) {
15802
15862
  if (!tableExists3(db, "memory_jobs"))
15803
15863
  return;
15804
15864
  if (!tableExists3(db, "job_cancellations")) {
@@ -15847,7 +15907,7 @@ function up129(db) {
15847
15907
  AND status IN ('pending', 'leased');
15848
15908
  `);
15849
15909
  }
15850
- function up130(db) {
15910
+ function up131(db) {
15851
15911
  db.exec(`
15852
15912
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15853
15913
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15887,7 +15947,7 @@ function up130(db) {
15887
15947
  END;
15888
15948
  `);
15889
15949
  }
15890
- function up131(db) {
15950
+ function up132(db) {
15891
15951
  db.exec(`
15892
15952
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15893
15953
  agent_id TEXT NOT NULL,
@@ -15910,13 +15970,13 @@ function up131(db) {
15910
15970
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
15911
15971
  `);
15912
15972
  }
15913
- function up132(db) {
15973
+ function up133(db) {
15914
15974
  db.exec(`
15915
15975
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15916
15976
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
15917
15977
  `);
15918
15978
  }
15919
- function up133(db) {
15979
+ function up134(db) {
15920
15980
  db.exec(`
15921
15981
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15922
15982
  id TEXT PRIMARY KEY,
@@ -15968,7 +16028,7 @@ function up133(db) {
15968
16028
  if (!names.has("format_version"))
15969
16029
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
15970
16030
  }
15971
- function up134(db) {
16031
+ function up135(db) {
15972
16032
  db.exec(`
15973
16033
  CREATE TABLE memory_head_entries_v134 (
15974
16034
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15986,7 +16046,7 @@ function up134(db) {
15986
16046
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
15987
16047
  `);
15988
16048
  }
15989
- function up135(db) {
16049
+ function up136(db) {
15990
16050
  db.exec(`
15991
16051
  CREATE TABLE IF NOT EXISTS memory_head_publications (
15992
16052
  agent_id TEXT NOT NULL,
@@ -16002,7 +16062,7 @@ function up135(db) {
16002
16062
  ON memory_head_publications(agent_id, status, revision DESC);
16003
16063
  `);
16004
16064
  }
16005
- function up136(db) {
16065
+ function up137(db) {
16006
16066
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r2) => r2.name));
16007
16067
  for (const [name, type] of [
16008
16068
  ["entry_id", "TEXT"],
@@ -16016,7 +16076,7 @@ function up136(db) {
16016
16076
  }
16017
16077
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
16018
16078
  }
16019
- function up137(db) {
16079
+ function up138(db) {
16020
16080
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r2) => r2.name));
16021
16081
  for (const [name, type] of [
16022
16082
  ["head_revision", "INTEGER"],
@@ -16038,7 +16098,7 @@ function addColumnIfMissing27(db, table, column, definition) {
16038
16098
  if (!hasColumn25(db, table, column))
16039
16099
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16040
16100
  }
16041
- function up138(db) {
16101
+ function up139(db) {
16042
16102
  addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
16043
16103
  db.exec(`
16044
16104
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16343,7 +16403,7 @@ function up138(db) {
16343
16403
  GROUP BY j.agent_id;
16344
16404
  `);
16345
16405
  }
16346
- function up139(db) {
16406
+ function up140(db) {
16347
16407
  db.exec(`
16348
16408
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16349
16409
  agent_id TEXT NOT NULL,
@@ -16359,7 +16419,7 @@ function up139(db) {
16359
16419
  ON native_source_sync_state(agent_id, status);
16360
16420
  `);
16361
16421
  }
16362
- function up140(db) {
16422
+ function up141(db) {
16363
16423
  db.exec(`
16364
16424
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16365
16425
  agent_id TEXT NOT NULL,
@@ -16371,7 +16431,7 @@ function up140(db) {
16371
16431
  );
16372
16432
  `);
16373
16433
  }
16374
- function up141(db) {
16434
+ function up142(db) {
16375
16435
  db.exec(`
16376
16436
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16377
16437
  agent_id TEXT NOT NULL,
@@ -16385,13 +16445,13 @@ function up141(db) {
16385
16445
  );
16386
16446
  `);
16387
16447
  }
16388
- function up142(db) {
16448
+ function up143(db) {
16389
16449
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16390
16450
  if (!columns.some((column) => column.name === "frontier")) {
16391
16451
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
16392
16452
  }
16393
16453
  }
16394
- function up143(db) {
16454
+ function up144(db) {
16395
16455
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16396
16456
  const additions = [
16397
16457
  ["migration_phase", "TEXT"],
@@ -16426,13 +16486,13 @@ function up143(db) {
16426
16486
  `);
16427
16487
  }
16428
16488
  }
16429
- function up144(db) {
16489
+ function up145(db) {
16430
16490
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16431
16491
  if (!columns.has("lease_token")) {
16432
16492
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
16433
16493
  }
16434
16494
  }
16435
- function up145(db) {
16495
+ function up146(db) {
16436
16496
  db.exec(`
16437
16497
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16438
16498
  agent_id TEXT NOT NULL,
@@ -16450,7 +16510,7 @@ function up145(db) {
16450
16510
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
16451
16511
  `);
16452
16512
  }
16453
- function up146(db) {
16513
+ function up147(db) {
16454
16514
  db.exec(`
16455
16515
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16456
16516
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16505,24 +16565,36 @@ function up146(db) {
16505
16565
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
16506
16566
  `);
16507
16567
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
16508
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
16568
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
16569
+ let exists;
16570
+ try {
16571
+ exists = statement.get(column);
16572
+ } finally {
16573
+ statement.finalize?.();
16574
+ }
16509
16575
  if (exists == null)
16510
16576
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
16511
16577
  }
16512
16578
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
16513
16579
  }
16514
- function up147(db) {
16580
+ function up148(db) {
16515
16581
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16516
16582
  }
16517
- function up148(db) {
16583
+ function up149(db) {
16518
16584
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16519
16585
  if (!columns.some((column) => column.name === "source_id")) {
16520
16586
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
16521
16587
  }
16522
16588
  }
16523
- function up149(db) {
16589
+ function up150(db) {
16524
16590
  const addColumn = (table, column, definition) => {
16525
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
16591
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16592
+ let exists;
16593
+ try {
16594
+ exists = statement.get(table, column);
16595
+ } finally {
16596
+ statement.finalize?.();
16597
+ }
16526
16598
  if (exists == null)
16527
16599
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16528
16600
  };
@@ -16535,7 +16607,7 @@ function addColumnIfMissing28(db, table, column, definition) {
16535
16607
  if (!columns.some((row) => row.name === column))
16536
16608
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16537
16609
  }
16538
- function up150(db) {
16610
+ function up151(db) {
16539
16611
  addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16540
16612
  addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
16541
16613
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -16689,13 +16761,13 @@ var MIGRATIONS = [
16689
16761
  {
16690
16762
  version: 1,
16691
16763
  name: "baseline",
16692
- up,
16764
+ up: up2,
16693
16765
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16694
16766
  },
16695
16767
  {
16696
16768
  version: 2,
16697
16769
  name: "pipeline-v2",
16698
- up: up2,
16770
+ up: up3,
16699
16771
  artifacts: {
16700
16772
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16701
16773
  }
@@ -16703,12 +16775,12 @@ var MIGRATIONS = [
16703
16775
  {
16704
16776
  version: 3,
16705
16777
  name: "unique-content-hash",
16706
- up: up3
16778
+ up: up4
16707
16779
  },
16708
16780
  {
16709
16781
  version: 4,
16710
16782
  name: "history-actor-and-retention",
16711
- up: up4,
16783
+ up: up5,
16712
16784
  artifacts: {
16713
16785
  columns: [{ table: "memory_history", column: "actor_type" }]
16714
16786
  }
@@ -16716,7 +16788,7 @@ var MIGRATIONS = [
16716
16788
  {
16717
16789
  version: 5,
16718
16790
  name: "graph-extended",
16719
- up: up5,
16791
+ up: up6,
16720
16792
  artifacts: {
16721
16793
  columns: [{ table: "entities", column: "canonical_name" }]
16722
16794
  }
@@ -16724,7 +16796,7 @@ var MIGRATIONS = [
16724
16796
  {
16725
16797
  version: 6,
16726
16798
  name: "idempotency-key",
16727
- up: up6,
16799
+ up: up7,
16728
16800
  artifacts: {
16729
16801
  columns: [{ table: "memories", column: "idempotency_key" }]
16730
16802
  }
@@ -16732,42 +16804,42 @@ var MIGRATIONS = [
16732
16804
  {
16733
16805
  version: 7,
16734
16806
  name: "documents-and-connectors",
16735
- up: up7,
16807
+ up: up8,
16736
16808
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16737
16809
  },
16738
16810
  {
16739
16811
  version: 8,
16740
16812
  name: "embeddings-unique-hash",
16741
- up: up8
16813
+ up: up9
16742
16814
  },
16743
16815
  {
16744
16816
  version: 9,
16745
16817
  name: "summary-jobs",
16746
- up: up9,
16818
+ up: up10,
16747
16819
  artifacts: { tables: ["summary_jobs"] }
16748
16820
  },
16749
16821
  {
16750
16822
  version: 10,
16751
16823
  name: "umap-cache",
16752
- up: up10,
16824
+ up: up11,
16753
16825
  artifacts: { tables: ["umap_cache"] }
16754
16826
  },
16755
16827
  {
16756
16828
  version: 11,
16757
16829
  name: "session-scores",
16758
- up: up11,
16830
+ up: up12,
16759
16831
  artifacts: { tables: ["session_scores"] }
16760
16832
  },
16761
16833
  {
16762
16834
  version: 12,
16763
16835
  name: "scheduled-tasks",
16764
- up: up12,
16836
+ up: up13,
16765
16837
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16766
16838
  },
16767
16839
  {
16768
16840
  version: 13,
16769
16841
  name: "ingestion-tracking",
16770
- up: up13,
16842
+ up: up14,
16771
16843
  artifacts: {
16772
16844
  columns: [
16773
16845
  { table: "memories", column: "source_path" },
@@ -16778,13 +16850,13 @@ var MIGRATIONS = [
16778
16850
  {
16779
16851
  version: 14,
16780
16852
  name: "telemetry",
16781
- up: up14,
16853
+ up: up15,
16782
16854
  artifacts: { tables: ["telemetry_events"] }
16783
16855
  },
16784
16856
  {
16785
16857
  version: 15,
16786
16858
  name: "session-memories",
16787
- up: up15,
16859
+ up: up16,
16788
16860
  artifacts: {
16789
16861
  tables: ["session_memories"],
16790
16862
  columns: [
@@ -16796,13 +16868,13 @@ var MIGRATIONS = [
16796
16868
  {
16797
16869
  version: 16,
16798
16870
  name: "session-checkpoints",
16799
- up: up16,
16871
+ up: up17,
16800
16872
  artifacts: { tables: ["session_checkpoints"] }
16801
16873
  },
16802
16874
  {
16803
16875
  version: 17,
16804
16876
  name: "task-skills",
16805
- up: up17,
16877
+ up: up18,
16806
16878
  artifacts: {
16807
16879
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16808
16880
  }
@@ -16810,13 +16882,13 @@ var MIGRATIONS = [
16810
16882
  {
16811
16883
  version: 18,
16812
16884
  name: "skill-meta",
16813
- up: up18,
16885
+ up: up19,
16814
16886
  artifacts: { tables: ["skill_meta"] }
16815
16887
  },
16816
16888
  {
16817
16889
  version: 19,
16818
16890
  name: "knowledge-structure",
16819
- up: up19,
16891
+ up: up20,
16820
16892
  artifacts: {
16821
16893
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16822
16894
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16825,7 +16897,7 @@ var MIGRATIONS = [
16825
16897
  {
16826
16898
  version: 20,
16827
16899
  name: "session-structural-columns",
16828
- up: up20,
16900
+ up: up21,
16829
16901
  artifacts: {
16830
16902
  columns: [
16831
16903
  { table: "session_memories", column: "entity_slot" },
@@ -16838,7 +16910,7 @@ var MIGRATIONS = [
16838
16910
  {
16839
16911
  version: 21,
16840
16912
  name: "checkpoint-structural",
16841
- up: up21,
16913
+ up: up22,
16842
16914
  artifacts: {
16843
16915
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16844
16916
  }
@@ -16846,7 +16918,7 @@ var MIGRATIONS = [
16846
16918
  {
16847
16919
  version: 22,
16848
16920
  name: "entity-pinning",
16849
- up: up22,
16921
+ up: up23,
16850
16922
  artifacts: {
16851
16923
  columns: [
16852
16924
  { table: "entities", column: "pinned" },
@@ -16857,17 +16929,17 @@ var MIGRATIONS = [
16857
16929
  {
16858
16930
  version: 23,
16859
16931
  name: "retired-scorer-gap",
16860
- up: up23
16932
+ up: up24
16861
16933
  },
16862
16934
  {
16863
16935
  version: 24,
16864
16936
  name: "retired-scorer-gap",
16865
- up: up24
16937
+ up: up25
16866
16938
  },
16867
16939
  {
16868
16940
  version: 25,
16869
16941
  name: "agent-feedback",
16870
- up: up25,
16942
+ up: up26,
16871
16943
  artifacts: {
16872
16944
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16873
16945
  }
@@ -16875,32 +16947,32 @@ var MIGRATIONS = [
16875
16947
  {
16876
16948
  version: 26,
16877
16949
  name: "retired-scorer-gap",
16878
- up: up26
16950
+ up: up27
16879
16951
  },
16880
16952
  {
16881
16953
  version: 27,
16882
16954
  name: "backfill-canonical-names",
16883
- up: up27
16955
+ up: up28
16884
16956
  },
16885
16957
  {
16886
16958
  version: 28,
16887
16959
  name: "lossless-retention",
16888
- up: up28
16960
+ up: up29
16889
16961
  },
16890
16962
  {
16891
16963
  version: 29,
16892
16964
  name: "session-summary-dag",
16893
- up: up29
16965
+ up: up30
16894
16966
  },
16895
16967
  {
16896
16968
  version: 30,
16897
16969
  name: "nullable-memory-job-memory-id",
16898
- up: up30
16970
+ up: up31
16899
16971
  },
16900
16972
  {
16901
16973
  version: 31,
16902
16974
  name: "dependency-reason",
16903
- up: up31,
16975
+ up: up32,
16904
16976
  artifacts: {
16905
16977
  columns: [
16906
16978
  { table: "entity_dependencies", column: "reason" },
@@ -16911,7 +16983,7 @@ var MIGRATIONS = [
16911
16983
  {
16912
16984
  version: 32,
16913
16985
  name: "embeddings-vector-column",
16914
- up: up32,
16986
+ up: up33,
16915
16987
  artifacts: {
16916
16988
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16917
16989
  }
@@ -16919,7 +16991,7 @@ var MIGRATIONS = [
16919
16991
  {
16920
16992
  version: 33,
16921
16993
  name: "scope",
16922
- up: up33,
16994
+ up: up34,
16923
16995
  artifacts: {
16924
16996
  columns: [{ table: "memories", column: "scope" }]
16925
16997
  }
@@ -16927,17 +16999,17 @@ var MIGRATIONS = [
16927
16999
  {
16928
17000
  version: 34,
16929
17001
  name: "scope-aware-dedup",
16930
- up: up34
17002
+ up: up35
16931
17003
  },
16932
17004
  {
16933
17005
  version: 35,
16934
17006
  name: "entity-fts",
16935
- up: up35
17007
+ up: up36
16936
17008
  },
16937
17009
  {
16938
17010
  version: 36,
16939
17011
  name: "dependency-confidence",
16940
- up: up36,
17012
+ up: up37,
16941
17013
  artifacts: {
16942
17014
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16943
17015
  }
@@ -16945,7 +17017,7 @@ var MIGRATIONS = [
16945
17017
  {
16946
17018
  version: 37,
16947
17019
  name: "entity-communities",
16948
- up: up37,
17020
+ up: up38,
16949
17021
  artifacts: {
16950
17022
  tables: ["entity_communities"],
16951
17023
  columns: [{ table: "entities", column: "community_id" }]
@@ -16954,24 +17026,24 @@ var MIGRATIONS = [
16954
17026
  {
16955
17027
  version: 38,
16956
17028
  name: "memory-hints",
16957
- up: up38,
17029
+ up: up39,
16958
17030
  artifacts: { tables: ["memory_hints"] }
16959
17031
  },
16960
17032
  {
16961
17033
  version: 39,
16962
17034
  name: "dedup-entity-dependencies",
16963
- up: up39
17035
+ up: up40
16964
17036
  },
16965
17037
  {
16966
17038
  version: 40,
16967
17039
  name: "session-transcripts",
16968
- up: up40,
17040
+ up: up41,
16969
17041
  artifacts: { tables: ["session_transcripts"] }
16970
17042
  },
16971
17043
  {
16972
17044
  version: 41,
16973
17045
  name: "path-feedback",
16974
- up: up41,
17046
+ up: up42,
16975
17047
  artifacts: {
16976
17048
  tables: [
16977
17049
  "path_feedback_events",
@@ -16986,7 +17058,7 @@ var MIGRATIONS = [
16986
17058
  {
16987
17059
  version: 42,
16988
17060
  name: "session-memories-agent-id",
16989
- up: up42,
17061
+ up: up43,
16990
17062
  artifacts: {
16991
17063
  columns: [{ table: "session_memories", column: "agent_id" }]
16992
17064
  }
@@ -16994,7 +17066,7 @@ var MIGRATIONS = [
16994
17066
  {
16995
17067
  version: 43,
16996
17068
  name: "agents-table",
16997
- up: up43,
17069
+ up: up44,
16998
17070
  artifacts: {
16999
17071
  tables: ["agents"],
17000
17072
  columns: [
@@ -17006,7 +17078,7 @@ var MIGRATIONS = [
17006
17078
  {
17007
17079
  version: 44,
17008
17080
  name: "memory-md-temporal-head",
17009
- up: up44,
17081
+ up: up45,
17010
17082
  artifacts: {
17011
17083
  columns: [
17012
17084
  { table: "session_summaries", column: "source_type" },
@@ -17018,7 +17090,7 @@ var MIGRATIONS = [
17018
17090
  {
17019
17091
  version: 45,
17020
17092
  name: "lossless-working-memory-hardening",
17021
- up: up45,
17093
+ up: up46,
17022
17094
  artifacts: {
17023
17095
  tables: ["session_transcripts_fts", "memory_md_heads"],
17024
17096
  columns: [
@@ -17031,17 +17103,17 @@ var MIGRATIONS = [
17031
17103
  {
17032
17104
  version: 46,
17033
17105
  name: "session-summary-uniqueness",
17034
- up: up46
17106
+ up: up47
17035
17107
  },
17036
17108
  {
17037
17109
  version: 47,
17038
17110
  name: "agent-scoped-temporal-uniqueness",
17039
- up: up47
17111
+ up: up48
17040
17112
  },
17041
17113
  {
17042
17114
  version: 48,
17043
17115
  name: "thread-heads",
17044
- up: up48,
17116
+ up: up49,
17045
17117
  artifacts: {
17046
17118
  tables: ["memory_thread_heads"]
17047
17119
  }
@@ -17049,7 +17121,7 @@ var MIGRATIONS = [
17049
17121
  {
17050
17122
  version: 49,
17051
17123
  name: "session-extract-cursors",
17052
- up: up49,
17124
+ up: up50,
17053
17125
  artifacts: {
17054
17126
  tables: ["session_extract_cursors"]
17055
17127
  }
@@ -17057,7 +17129,7 @@ var MIGRATIONS = [
17057
17129
  {
17058
17130
  version: 50,
17059
17131
  name: "related-to-audit",
17060
- up: up50,
17132
+ up: up51,
17061
17133
  artifacts: {
17062
17134
  tables: ["entity_dependency_history"]
17063
17135
  }
@@ -17065,7 +17137,7 @@ var MIGRATIONS = [
17065
17137
  {
17066
17138
  version: 51,
17067
17139
  name: "memory-md-rolling-window-lineage",
17068
- up: up51,
17140
+ up: up52,
17069
17141
  artifacts: {
17070
17142
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
17071
17143
  columns: [
@@ -17080,7 +17152,7 @@ var MIGRATIONS = [
17080
17152
  {
17081
17153
  version: 52,
17082
17154
  name: "mcp-invocations",
17083
- up: up52,
17155
+ up: up53,
17084
17156
  artifacts: {
17085
17157
  tables: ["mcp_invocations"]
17086
17158
  }
@@ -17088,7 +17160,7 @@ var MIGRATIONS = [
17088
17160
  {
17089
17161
  version: 53,
17090
17162
  name: "skill-invocations",
17091
- up: up53,
17163
+ up: up54,
17092
17164
  artifacts: {
17093
17165
  tables: ["skill_invocations"]
17094
17166
  }
@@ -17096,7 +17168,7 @@ var MIGRATIONS = [
17096
17168
  {
17097
17169
  version: 54,
17098
17170
  name: "task-agent-scope",
17099
- up: up54,
17171
+ up: up55,
17100
17172
  artifacts: {
17101
17173
  tables: ["task_scope_hints"]
17102
17174
  }
@@ -17104,7 +17176,7 @@ var MIGRATIONS = [
17104
17176
  {
17105
17177
  version: 55,
17106
17178
  name: "dreaming-state",
17107
- up: up55,
17179
+ up: up56,
17108
17180
  artifacts: {
17109
17181
  tables: ["dreaming_state", "dreaming_passes"]
17110
17182
  }
@@ -17112,22 +17184,22 @@ var MIGRATIONS = [
17112
17184
  {
17113
17185
  version: 56,
17114
17186
  name: "agent-scoped-content-hash",
17115
- up: up56
17187
+ up: up57
17116
17188
  },
17117
17189
  {
17118
17190
  version: 57,
17119
17191
  name: "memories-fts-tokenizer-repair",
17120
- up: up57
17192
+ up: up58
17121
17193
  },
17122
17194
  {
17123
17195
  version: 58,
17124
17196
  name: "knowledge-graph-indices",
17125
- up: up58
17197
+ up: up59
17126
17198
  },
17127
17199
  {
17128
17200
  version: 59,
17129
17201
  name: "entity-attribute-claim-key",
17130
- up: up59,
17202
+ up: up60,
17131
17203
  artifacts: {
17132
17204
  columns: [{ table: "entity_attributes", column: "claim_key" }]
17133
17205
  }
@@ -17135,7 +17207,7 @@ var MIGRATIONS = [
17135
17207
  {
17136
17208
  version: 60,
17137
17209
  name: "entity-attribute-group-key",
17138
- up: up60,
17210
+ up: up61,
17139
17211
  artifacts: {
17140
17212
  columns: [{ table: "entity_attributes", column: "group_key" }]
17141
17213
  }
@@ -17143,7 +17215,7 @@ var MIGRATIONS = [
17143
17215
  {
17144
17216
  version: 61,
17145
17217
  name: "memory-artifact-source-mtime",
17146
- up: up61,
17218
+ up: up62,
17147
17219
  artifacts: {
17148
17220
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
17149
17221
  }
@@ -17151,7 +17223,7 @@ var MIGRATIONS = [
17151
17223
  {
17152
17224
  version: 62,
17153
17225
  name: "memory-artifact-soft-delete",
17154
- up: up62,
17226
+ up: up63,
17155
17227
  artifacts: {
17156
17228
  columns: [
17157
17229
  { table: "memory_artifacts", column: "is_deleted" },
@@ -17162,12 +17234,12 @@ var MIGRATIONS = [
17162
17234
  {
17163
17235
  version: 63,
17164
17236
  name: "content-only-memories-fts-update",
17165
- up: up63
17237
+ up: up64
17166
17238
  },
17167
17239
  {
17168
17240
  version: 64,
17169
17241
  name: "source-graph-provenance",
17170
- up: up64,
17242
+ up: up65,
17171
17243
  artifacts: {
17172
17244
  columns: [
17173
17245
  { table: "entities", column: "source_path" },
@@ -17180,7 +17252,7 @@ var MIGRATIONS = [
17180
17252
  {
17181
17253
  version: 65,
17182
17254
  name: "source-embedding-agent-scope",
17183
- up: up65,
17255
+ up: up66,
17184
17256
  artifacts: {
17185
17257
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
17186
17258
  }
@@ -17188,7 +17260,7 @@ var MIGRATIONS = [
17188
17260
  {
17189
17261
  version: 66,
17190
17262
  name: "memory-search-telemetry",
17191
- up: up66,
17263
+ up: up67,
17192
17264
  artifacts: {
17193
17265
  tables: ["memory_search_telemetry"]
17194
17266
  }
@@ -17196,7 +17268,7 @@ var MIGRATIONS = [
17196
17268
  {
17197
17269
  version: 67,
17198
17270
  name: "ontology-proposals",
17199
- up: up67,
17271
+ up: up68,
17200
17272
  artifacts: {
17201
17273
  tables: ["ontology_proposals"],
17202
17274
  columns: [
@@ -17210,7 +17282,7 @@ var MIGRATIONS = [
17210
17282
  {
17211
17283
  version: 68,
17212
17284
  name: "daily-reflections",
17213
- up: up68,
17285
+ up: up69,
17214
17286
  artifacts: {
17215
17287
  tables: ["daily_reflections"]
17216
17288
  }
@@ -17218,7 +17290,7 @@ var MIGRATIONS = [
17218
17290
  {
17219
17291
  version: 69,
17220
17292
  name: "daily-reflections-multiple-insights",
17221
- up: up69,
17293
+ up: up70,
17222
17294
  artifacts: {
17223
17295
  tables: ["daily_reflections"]
17224
17296
  }
@@ -17226,7 +17298,7 @@ var MIGRATIONS = [
17226
17298
  {
17227
17299
  version: 70,
17228
17300
  name: "ontology-control-plane-state",
17229
- up: up70,
17301
+ up: up71,
17230
17302
  artifacts: {
17231
17303
  columns: [
17232
17304
  { table: "entities", column: "status" },
@@ -17241,7 +17313,7 @@ var MIGRATIONS = [
17241
17313
  {
17242
17314
  version: 71,
17243
17315
  name: "epistemic-assertions",
17244
- up: up71,
17316
+ up: up72,
17245
17317
  artifacts: {
17246
17318
  tables: ["epistemic_assertions"]
17247
17319
  }
@@ -17249,7 +17321,7 @@ var MIGRATIONS = [
17249
17321
  {
17250
17322
  version: 72,
17251
17323
  name: "agent-scoped-idempotency-key",
17252
- up: up72,
17324
+ up: up73,
17253
17325
  artifacts: {
17254
17326
  columns: [
17255
17327
  { table: "memories", column: "idempotency_key" },
@@ -17260,7 +17332,7 @@ var MIGRATIONS = [
17260
17332
  {
17261
17333
  version: 73,
17262
17334
  name: "recall-context-dedupe",
17263
- up: up73,
17335
+ up: up74,
17264
17336
  artifacts: {
17265
17337
  tables: ["session_context_epochs", "session_recall_events"]
17266
17338
  }
@@ -17268,7 +17340,7 @@ var MIGRATIONS = [
17268
17340
  {
17269
17341
  version: 74,
17270
17342
  name: "aggregate-memory-links",
17271
- up: up74,
17343
+ up: up75,
17272
17344
  artifacts: {
17273
17345
  tables: ["aggregate_memory_sources"]
17274
17346
  }
@@ -17276,7 +17348,7 @@ var MIGRATIONS = [
17276
17348
  {
17277
17349
  version: 75,
17278
17350
  name: "memory-artifact-source-provenance",
17279
- up: up75,
17351
+ up: up76,
17280
17352
  artifacts: {
17281
17353
  columns: [
17282
17354
  { table: "memory_artifacts", column: "source_id" },
@@ -17290,7 +17362,7 @@ var MIGRATIONS = [
17290
17362
  {
17291
17363
  version: 76,
17292
17364
  name: "temporal-edges",
17293
- up: up76,
17365
+ up: up77,
17294
17366
  artifacts: {
17295
17367
  tables: ["temporal_edges"]
17296
17368
  }
@@ -17298,7 +17370,7 @@ var MIGRATIONS = [
17298
17370
  {
17299
17371
  version: 77,
17300
17372
  name: "entity-aliases",
17301
- up: up77,
17373
+ up: up78,
17302
17374
  artifacts: {
17303
17375
  tables: ["entity_aliases"]
17304
17376
  }
@@ -17306,7 +17378,7 @@ var MIGRATIONS = [
17306
17378
  {
17307
17379
  version: 78,
17308
17380
  name: "api-keys",
17309
- up: up78,
17381
+ up: up79,
17310
17382
  artifacts: {
17311
17383
  tables: ["api_keys"]
17312
17384
  }
@@ -17314,7 +17386,7 @@ var MIGRATIONS = [
17314
17386
  {
17315
17387
  version: 79,
17316
17388
  name: "transcript-capture-jobs",
17317
- up: up79,
17389
+ up: up80,
17318
17390
  artifacts: {
17319
17391
  tables: ["transcript_capture_jobs"]
17320
17392
  }
@@ -17322,7 +17394,7 @@ var MIGRATIONS = [
17322
17394
  {
17323
17395
  version: 80,
17324
17396
  name: "document-scope-columns",
17325
- up: up80,
17397
+ up: up81,
17326
17398
  artifacts: {
17327
17399
  columns: [
17328
17400
  { table: "documents", column: "agent_id" },
@@ -17333,7 +17405,7 @@ var MIGRATIONS = [
17333
17405
  {
17334
17406
  version: 81,
17335
17407
  name: "aggregate-evidence-sources",
17336
- up: up81,
17408
+ up: up82,
17337
17409
  artifacts: {
17338
17410
  tables: ["aggregate_evidence_sources"]
17339
17411
  }
@@ -17341,7 +17413,7 @@ var MIGRATIONS = [
17341
17413
  {
17342
17414
  version: 82,
17343
17415
  name: "skill-invocations-harness",
17344
- up: up82,
17416
+ up: up83,
17345
17417
  artifacts: {
17346
17418
  columns: [
17347
17419
  { table: "skill_invocations", column: "harness" },
@@ -17352,7 +17424,7 @@ var MIGRATIONS = [
17352
17424
  {
17353
17425
  version: 83,
17354
17426
  name: "memory-lifecycle-repair",
17355
- up: up83,
17427
+ up: up84,
17356
17428
  artifacts: {
17357
17429
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17358
17430
  columns: [
@@ -17367,7 +17439,7 @@ var MIGRATIONS = [
17367
17439
  {
17368
17440
  version: 84,
17369
17441
  name: "legacy-markdown-import-state",
17370
- up: up84,
17442
+ up: up85,
17371
17443
  artifacts: {
17372
17444
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17373
17445
  }
@@ -17375,7 +17447,7 @@ var MIGRATIONS = [
17375
17447
  {
17376
17448
  version: 85,
17377
17449
  name: "backfill-relations-to-dependencies",
17378
- up: up85,
17450
+ up: up86,
17379
17451
  artifacts: {
17380
17452
  tables: ["entity_dependencies"]
17381
17453
  }
@@ -17383,7 +17455,7 @@ var MIGRATIONS = [
17383
17455
  {
17384
17456
  version: 86,
17385
17457
  name: "summary-jobs-content-hash",
17386
- up: up86,
17458
+ up: up87,
17387
17459
  artifacts: {
17388
17460
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17389
17461
  }
@@ -17391,7 +17463,7 @@ var MIGRATIONS = [
17391
17463
  {
17392
17464
  version: 87,
17393
17465
  name: "summary-jobs-boundary-reason",
17394
- up: up87,
17466
+ up: up88,
17395
17467
  artifacts: {
17396
17468
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17397
17469
  }
@@ -17399,7 +17471,7 @@ var MIGRATIONS = [
17399
17471
  {
17400
17472
  version: 88,
17401
17473
  name: "transcript-recovery-files",
17402
- up: up88,
17474
+ up: up89,
17403
17475
  artifacts: {
17404
17476
  tables: ["transcript_recovery_files"]
17405
17477
  }
@@ -17407,7 +17479,7 @@ var MIGRATIONS = [
17407
17479
  {
17408
17480
  version: 89,
17409
17481
  name: "job-cancellations",
17410
- up: up89,
17482
+ up: up90,
17411
17483
  artifacts: {
17412
17484
  tables: ["job_cancellations"]
17413
17485
  }
@@ -17415,7 +17487,7 @@ var MIGRATIONS = [
17415
17487
  {
17416
17488
  version: 90,
17417
17489
  name: "job-archive",
17418
- up: up90,
17490
+ up: up91,
17419
17491
  artifacts: {
17420
17492
  tables: ["job_archive"]
17421
17493
  }
@@ -17423,25 +17495,25 @@ var MIGRATIONS = [
17423
17495
  {
17424
17496
  version: 91,
17425
17497
  name: "embedding-index-generations",
17426
- up: up91,
17498
+ up: up92,
17427
17499
  artifacts: { tables: ["embedding_index_state"] }
17428
17500
  },
17429
17501
  {
17430
17502
  version: 92,
17431
17503
  name: "embedding-staging-store",
17432
- up: up92,
17504
+ up: up93,
17433
17505
  artifacts: { tables: ["embeddings_staging"] }
17434
17506
  },
17435
17507
  {
17436
17508
  version: 93,
17437
17509
  name: "dreaming-evidence-cursor",
17438
- up: up93,
17510
+ up: up94,
17439
17511
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17440
17512
  },
17441
17513
  {
17442
17514
  version: 94,
17443
17515
  name: "memory-kind",
17444
- up: up94,
17516
+ up: up95,
17445
17517
  artifacts: {
17446
17518
  columns: [
17447
17519
  { table: "memories", column: "memory_kind" },
@@ -17452,35 +17524,35 @@ var MIGRATIONS = [
17452
17524
  {
17453
17525
  version: 95,
17454
17526
  name: "compaction-recall-projections",
17455
- up: up95
17527
+ up: up96
17456
17528
  },
17457
17529
  {
17458
17530
  version: 96,
17459
17531
  name: "retire-legacy-ingestion",
17460
- up: up96
17532
+ up: up97
17461
17533
  },
17462
17534
  {
17463
17535
  version: 97,
17464
17536
  name: "dreaming-failure-backoff",
17465
- up: up97,
17537
+ up: up98,
17466
17538
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17467
17539
  },
17468
17540
  {
17469
17541
  version: 98,
17470
17542
  name: "dreaming-evidence-exclusions",
17471
- up: up98,
17543
+ up: up99,
17472
17544
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17473
17545
  },
17474
17546
  {
17475
17547
  version: 99,
17476
17548
  name: "dreaming-tool-calls",
17477
- up: up99,
17549
+ up: up100,
17478
17550
  artifacts: { tables: ["dreaming_tool_calls"] }
17479
17551
  },
17480
17552
  {
17481
17553
  version: 100,
17482
17554
  name: "dreaming-runbook",
17483
- up: up100,
17555
+ up: up101,
17484
17556
  artifacts: {
17485
17557
  columns: [
17486
17558
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17491,23 +17563,23 @@ var MIGRATIONS = [
17491
17563
  {
17492
17564
  version: 101,
17493
17565
  name: "dreaming-attention",
17494
- up: up101,
17566
+ up: up102,
17495
17567
  artifacts: { tables: ["dreaming_attention"] }
17496
17568
  },
17497
17569
  {
17498
17570
  version: 102,
17499
17571
  name: "attribute-semantic-memories",
17500
- up: up102
17572
+ up: up103
17501
17573
  },
17502
17574
  {
17503
17575
  version: 103,
17504
17576
  name: "semantic-memory-kind",
17505
- up: up103
17577
+ up: up104
17506
17578
  },
17507
17579
  {
17508
17580
  version: 104,
17509
17581
  name: "derived-memory-provenance",
17510
- up: up104,
17582
+ up: up105,
17511
17583
  artifacts: {
17512
17584
  tables: ["derived_memory_sources"],
17513
17585
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17516,12 +17588,12 @@ var MIGRATIONS = [
17516
17588
  {
17517
17589
  version: 105,
17518
17590
  name: "agent-scoped-entity-name",
17519
- up: up105
17591
+ up: up106
17520
17592
  },
17521
17593
  {
17522
17594
  version: 106,
17523
17595
  name: "memory-review-after",
17524
- up: up106,
17596
+ up: up107,
17525
17597
  artifacts: {
17526
17598
  columns: [{ table: "memories", column: "review_after" }]
17527
17599
  }
@@ -17529,7 +17601,7 @@ var MIGRATIONS = [
17529
17601
  {
17530
17602
  version: 107,
17531
17603
  name: "dreaming-pass-usage",
17532
- up: up107,
17604
+ up: up108,
17533
17605
  artifacts: {
17534
17606
  columns: [
17535
17607
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17543,7 +17615,7 @@ var MIGRATIONS = [
17543
17615
  {
17544
17616
  version: 108,
17545
17617
  name: "embedding-usage",
17546
- up: up108,
17618
+ up: up109,
17547
17619
  artifacts: {
17548
17620
  tables: ["embedding_usage"]
17549
17621
  }
@@ -17551,7 +17623,7 @@ var MIGRATIONS = [
17551
17623
  {
17552
17624
  version: 109,
17553
17625
  name: "telemetry-install",
17554
- up: up109,
17626
+ up: up110,
17555
17627
  artifacts: {
17556
17628
  tables: ["telemetry_install"]
17557
17629
  }
@@ -17559,12 +17631,12 @@ var MIGRATIONS = [
17559
17631
  {
17560
17632
  version: 110,
17561
17633
  name: "memory-mention-join-index",
17562
- up: up110
17634
+ up: up111
17563
17635
  },
17564
17636
  {
17565
17637
  version: 111,
17566
17638
  name: "telemetry-first-use",
17567
- up: up111,
17639
+ up: up112,
17568
17640
  artifacts: {
17569
17641
  columns: [
17570
17642
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17575,7 +17647,7 @@ var MIGRATIONS = [
17575
17647
  {
17576
17648
  version: 112,
17577
17649
  name: "telemetry-queue-ownership",
17578
- up: up112,
17650
+ up: up113,
17579
17651
  artifacts: {
17580
17652
  columns: [
17581
17653
  { table: "telemetry_events", column: "source" },
@@ -17587,7 +17659,7 @@ var MIGRATIONS = [
17587
17659
  {
17588
17660
  version: 113,
17589
17661
  name: "session-claims",
17590
- up: up113,
17662
+ up: up114,
17591
17663
  artifacts: {
17592
17664
  tables: ["session_claims"],
17593
17665
  columns: [
@@ -17601,12 +17673,12 @@ var MIGRATIONS = [
17601
17673
  {
17602
17674
  version: 114,
17603
17675
  name: "memory-traversal-hydration-index",
17604
- up: up114
17676
+ up: up115
17605
17677
  },
17606
17678
  {
17607
17679
  version: 115,
17608
17680
  name: "cross-agent-message-notifications",
17609
- up: up115,
17681
+ up: up116,
17610
17682
  artifacts: {
17611
17683
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17612
17684
  }
@@ -17614,7 +17686,7 @@ var MIGRATIONS = [
17614
17686
  {
17615
17687
  version: 116,
17616
17688
  name: "acp-delivery-reconciliation",
17617
- up: up116,
17689
+ up: up117,
17618
17690
  artifacts: {
17619
17691
  columns: [
17620
17692
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17628,7 +17700,7 @@ var MIGRATIONS = [
17628
17700
  {
17629
17701
  version: 117,
17630
17702
  name: "retire-summary-worker",
17631
- up: up117,
17703
+ up: up118,
17632
17704
  artifacts: {
17633
17705
  columns: [
17634
17706
  { table: "session_transcripts", column: "completed_at" },
@@ -17639,24 +17711,24 @@ var MIGRATIONS = [
17639
17711
  {
17640
17712
  version: 118,
17641
17713
  name: "queue-pressure-indices",
17642
- up: up118
17714
+ up: up119
17643
17715
  },
17644
17716
  {
17645
17717
  version: 119,
17646
17718
  name: "telemetry-version-observation",
17647
- up: up119,
17719
+ up: up120,
17648
17720
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17649
17721
  },
17650
17722
  {
17651
17723
  version: 120,
17652
17724
  name: "source-lifecycle-telemetry",
17653
- up: up120,
17725
+ up: up121,
17654
17726
  artifacts: { tables: ["source_lifecycle_state"] }
17655
17727
  },
17656
17728
  {
17657
17729
  version: 121,
17658
17730
  name: "telemetry-delivery-health",
17659
- up: up121,
17731
+ up: up122,
17660
17732
  artifacts: {
17661
17733
  tables: ["telemetry_delivery_state"],
17662
17734
  columns: [
@@ -17670,7 +17742,7 @@ var MIGRATIONS = [
17670
17742
  {
17671
17743
  version: 122,
17672
17744
  name: "dreaming-evidence-retry",
17673
- up: up122,
17745
+ up: up123,
17674
17746
  artifacts: {
17675
17747
  columns: [
17676
17748
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17683,13 +17755,13 @@ var MIGRATIONS = [
17683
17755
  {
17684
17756
  version: 123,
17685
17757
  name: "embedding-index-failures",
17686
- up: up123,
17758
+ up: up124,
17687
17759
  artifacts: { tables: ["embedding_index_failures"] }
17688
17760
  },
17689
17761
  {
17690
17762
  version: 124,
17691
17763
  name: "import-derived-lifecycle",
17692
- up: up124,
17764
+ up: up125,
17693
17765
  artifacts: {
17694
17766
  tables: ["imported_source_lifecycle"]
17695
17767
  }
@@ -17697,77 +17769,77 @@ var MIGRATIONS = [
17697
17769
  {
17698
17770
  version: 125,
17699
17771
  name: "memory-content-safety",
17700
- up: up125,
17772
+ up: up126,
17701
17773
  artifacts: { tables: ["memory_content_safety"] }
17702
17774
  },
17703
17775
  {
17704
17776
  version: 126,
17705
17777
  name: "dreaming-surprisal-attention",
17706
- up: up126,
17778
+ up: up127,
17707
17779
  artifacts: { tables: ["dreaming_attention"] }
17708
17780
  },
17709
17781
  {
17710
17782
  version: 127,
17711
17783
  name: "ontology-contradictions",
17712
- up: up127,
17784
+ up: up128,
17713
17785
  artifacts: { tables: ["ontology_contradictions"] }
17714
17786
  },
17715
17787
  {
17716
17788
  version: 128,
17717
17789
  name: "bounded-queue-diagnostics",
17718
- up: up128
17790
+ up: up129
17719
17791
  },
17720
17792
  {
17721
17793
  version: 129,
17722
17794
  name: "retire-structural-jobs",
17723
- up: up129
17795
+ up: up130
17724
17796
  },
17725
17797
  {
17726
17798
  version: 130,
17727
17799
  name: "embedding-repair-state",
17728
- up: up130,
17800
+ up: up131,
17729
17801
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17730
17802
  },
17731
17803
  {
17732
17804
  version: 131,
17733
17805
  name: "dreaming-evidence-consumption",
17734
- up: up131,
17806
+ up: up132,
17735
17807
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17736
17808
  },
17737
17809
  {
17738
17810
  version: 132,
17739
17811
  name: "observer-scoped-epistemic-assertions",
17740
- up: up132,
17812
+ up: up133,
17741
17813
  artifacts: { tables: ["epistemic_assertions"] }
17742
17814
  },
17743
17815
  {
17744
17816
  version: 133,
17745
17817
  name: "dreaming-memory-head",
17746
- up: up133,
17818
+ up: up134,
17747
17819
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17748
17820
  },
17749
17821
  {
17750
17822
  version: 134,
17751
17823
  name: "scope-memory-head-entries",
17752
- up: up134,
17824
+ up: up135,
17753
17825
  artifacts: { tables: ["memory_head_entries"] }
17754
17826
  },
17755
17827
  {
17756
17828
  version: 135,
17757
17829
  name: "memory-head-publication",
17758
- up: up135,
17830
+ up: up136,
17759
17831
  artifacts: { tables: ["memory_head_publications"] }
17760
17832
  },
17761
17833
  {
17762
17834
  version: 136,
17763
17835
  name: "memory-head-revisions",
17764
- up: up136,
17836
+ up: up137,
17765
17837
  artifacts: { tables: ["memory_head_revisions"] }
17766
17838
  },
17767
17839
  {
17768
17840
  version: 137,
17769
17841
  name: "dreaming-head-manifest",
17770
- up: up137,
17842
+ up: up138,
17771
17843
  artifacts: {
17772
17844
  columns: [
17773
17845
  { table: "dreaming_passes", column: "head_revision" },
@@ -17778,7 +17850,7 @@ var MIGRATIONS = [
17778
17850
  {
17779
17851
  version: 138,
17780
17852
  name: "bounded-status-projections",
17781
- up: up138,
17853
+ up: up139,
17782
17854
  artifacts: {
17783
17855
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17784
17856
  }
@@ -17786,31 +17858,31 @@ var MIGRATIONS = [
17786
17858
  {
17787
17859
  version: 139,
17788
17860
  name: "native-source-sync-state",
17789
- up: up139,
17861
+ up: up140,
17790
17862
  artifacts: { tables: ["native_source_sync_state"] }
17791
17863
  },
17792
17864
  {
17793
17865
  version: 140,
17794
17866
  name: "transcript-recovery-frontier",
17795
- up: up140,
17867
+ up: up141,
17796
17868
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17797
17869
  },
17798
17870
  {
17799
17871
  version: 141,
17800
17872
  name: "source-sync-checkpoints",
17801
- up: up141,
17873
+ up: up142,
17802
17874
  artifacts: { tables: ["source_sync_checkpoints"] }
17803
17875
  },
17804
17876
  {
17805
17877
  version: 142,
17806
17878
  name: "source-sync-frontier",
17807
- up: up142,
17879
+ up: up143,
17808
17880
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17809
17881
  },
17810
17882
  {
17811
17883
  version: 143,
17812
17884
  name: "embedding-index-progress",
17813
- up: up143,
17885
+ up: up144,
17814
17886
  artifacts: {
17815
17887
  columns: [
17816
17888
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17826,19 +17898,19 @@ var MIGRATIONS = [
17826
17898
  {
17827
17899
  version: 144,
17828
17900
  name: "memory-job-lease-token",
17829
- up: up144,
17901
+ up: up145,
17830
17902
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17831
17903
  },
17832
17904
  {
17833
17905
  version: 145,
17834
17906
  name: "dreaming-evidence-reviews",
17835
- up: up145,
17907
+ up: up146,
17836
17908
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17837
17909
  },
17838
17910
  {
17839
17911
  version: 146,
17840
17912
  name: "source-transcript-import",
17841
- up: up146,
17913
+ up: up147,
17842
17914
  artifacts: {
17843
17915
  tables: [
17844
17916
  "source_import_jobs",
@@ -17857,19 +17929,19 @@ var MIGRATIONS = [
17857
17929
  {
17858
17930
  version: 147,
17859
17931
  name: "source-import-replay-file-slots",
17860
- up: up147,
17932
+ up: up148,
17861
17933
  artifacts: { tables: ["source_import_files"] }
17862
17934
  },
17863
17935
  {
17864
17936
  version: 148,
17865
17937
  name: "source-import-attempt-provenance",
17866
- up: up148,
17938
+ up: up149,
17867
17939
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17868
17940
  },
17869
17941
  {
17870
17942
  version: 149,
17871
17943
  name: "transcript-import-state-machine",
17872
- up: up149,
17944
+ up: up150,
17873
17945
  artifacts: {
17874
17946
  columns: [
17875
17947
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17881,13 +17953,42 @@ var MIGRATIONS = [
17881
17953
  {
17882
17954
  version: 150,
17883
17955
  name: "memory-head-freshness",
17884
- up: up150,
17956
+ up: up151,
17885
17957
  artifacts: {
17886
17958
  columns: [
17887
17959
  { table: "memory_md_heads", column: "is_current" },
17888
17960
  { table: "dreaming_passes", column: "head_base_revision" }
17889
17961
  ]
17890
17962
  }
17963
+ },
17964
+ {
17965
+ version: 151,
17966
+ name: "transcript-import-bytes",
17967
+ up,
17968
+ artifacts: {
17969
+ tables: [
17970
+ "source_import_chunks",
17971
+ "source_import_capacity",
17972
+ "source_import_migrations",
17973
+ "source_import_migration_streams",
17974
+ "source_import_migration_counts"
17975
+ ],
17976
+ columns: [
17977
+ { table: "source_import_files", column: "storage_state" },
17978
+ { table: "source_import_files", column: "upload_generation" },
17979
+ { table: "source_import_files", column: "upload_offset" },
17980
+ { table: "source_import_files", column: "upload_size" },
17981
+ { table: "source_import_files", column: "upload_digest" },
17982
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
17983
+ table: "source_import_files",
17984
+ column
17985
+ })),
17986
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
17987
+ table: "source_import_jobs",
17988
+ column
17989
+ }))
17990
+ ]
17991
+ }
17891
17992
  }
17892
17993
  ];
17893
17994
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -29789,6 +29890,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
29789
29890
  "checkpoint",
29790
29891
  "dreaming"
29791
29892
  ];
29893
+ function up152(db) {
29894
+ const hasColumn26 = (table, column) => {
29895
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
29896
+ try {
29897
+ return statement.get(column) != null;
29898
+ } finally {
29899
+ statement.finalize?.();
29900
+ }
29901
+ };
29902
+ for (const [column, definition] of [
29903
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
29904
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
29905
+ ["upload_size", "INTEGER"],
29906
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
29907
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
29908
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
29909
+ ["original_path", "TEXT"],
29910
+ [
29911
+ "storage_state",
29912
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
29913
+ ]
29914
+ ]) {
29915
+ if (!hasColumn26("source_import_files", column))
29916
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
29917
+ }
29918
+ if (!hasColumn26("source_import_jobs", "retry_count"))
29919
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
29920
+ if (!hasColumn26("source_import_jobs", "cleanup_state"))
29921
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
29922
+ if (!hasColumn26("source_import_jobs", "retry_cursor"))
29923
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
29924
+ if (!hasColumn26("source_import_jobs", "retry_requested"))
29925
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
29926
+ db.exec(`
29927
+ 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);
29928
+ 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;
29929
+ 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;
29930
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
29931
+ 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));
29932
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
29933
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
29934
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
29935
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
29936
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
29937
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
29938
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
29939
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
29940
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
29941
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
29942
+ ) WITHOUT ROWID;
29943
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
29944
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
29945
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
29946
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
29947
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
29948
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
29949
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
29950
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
29951
+ `);
29952
+ }
29792
29953
  var MEMORIES_FTS_TOKENIZER2 = "unicode61";
29793
29954
  var FTS_STATE_TABLE2 = "memories_fts_state";
29794
29955
  function normalizeSql2(sql) {
@@ -29904,7 +30065,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
29904
30065
  return true;
29905
30066
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
29906
30067
  }
29907
- function up151(db) {
30068
+ function up210(db) {
29908
30069
  db.exec(`
29909
30070
  CREATE TABLE IF NOT EXISTS schema_migrations (
29910
30071
  version INTEGER PRIMARY KEY,
@@ -30002,7 +30163,7 @@ function addColumnIfMissing29(db, table, column, definition) {
30002
30163
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30003
30164
  }
30004
30165
  }
30005
- function up210(db) {
30166
+ function up310(db) {
30006
30167
  addColumnIfMissing29(db, "memories", "content_hash", "TEXT");
30007
30168
  addColumnIfMissing29(db, "memories", "normalized_content", "TEXT");
30008
30169
  addColumnIfMissing29(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -30120,7 +30281,7 @@ function addColumnIfMissing210(db, table, column, definition) {
30120
30281
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30121
30282
  return true;
30122
30283
  }
30123
- function up310(db) {
30284
+ function up410(db) {
30124
30285
  addColumnIfMissing210(db, "memories", "why", "TEXT");
30125
30286
  addColumnIfMissing210(db, "memories", "project", "TEXT");
30126
30287
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -30157,7 +30318,7 @@ function addColumnIfMissing32(db, table, column, definition) {
30157
30318
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30158
30319
  }
30159
30320
  }
30160
- function up410(db) {
30321
+ function up510(db) {
30161
30322
  addColumnIfMissing32(db, "memory_history", "actor_type", "TEXT");
30162
30323
  addColumnIfMissing32(db, "memory_history", "session_id", "TEXT");
30163
30324
  addColumnIfMissing32(db, "memory_history", "request_id", "TEXT");
@@ -30190,7 +30351,7 @@ function addColumnIfMissing42(db, table, column, definition) {
30190
30351
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30191
30352
  }
30192
30353
  }
30193
- function up510(db) {
30354
+ function up610(db) {
30194
30355
  addColumnIfMissing42(db, "entities", "canonical_name", "TEXT");
30195
30356
  addColumnIfMissing42(db, "entities", "mentions", "INTEGER DEFAULT 0");
30196
30357
  addColumnIfMissing42(db, "entities", "embedding", "BLOB");
@@ -30207,7 +30368,7 @@ function hasColumn42(db, table, column) {
30207
30368
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
30208
30369
  return rows.some((r22) => r22.name === column);
30209
30370
  }
30210
- function up610(db) {
30371
+ function up710(db) {
30211
30372
  if (!hasColumn42(db, "memories", "idempotency_key")) {
30212
30373
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
30213
30374
  }
@@ -30222,7 +30383,7 @@ function hasColumn52(db, table, column) {
30222
30383
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
30223
30384
  return rows.some((r22) => r22.name === column);
30224
30385
  }
30225
- function up710(db) {
30386
+ function up810(db) {
30226
30387
  db.exec(`
30227
30388
  CREATE TABLE IF NOT EXISTS documents (
30228
30389
  id TEXT PRIMARY KEY,
@@ -30279,7 +30440,7 @@ function up710(db) {
30279
30440
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
30280
30441
  }
30281
30442
  }
30282
- function up810(db) {
30443
+ function up910(db) {
30283
30444
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
30284
30445
  if (tables.length === 0)
30285
30446
  return;
@@ -30296,7 +30457,7 @@ function up810(db) {
30296
30457
  ON embeddings(content_hash)
30297
30458
  `);
30298
30459
  }
30299
- function up910(db) {
30460
+ function up1010(db) {
30300
30461
  db.exec(`
30301
30462
  CREATE TABLE IF NOT EXISTS summary_jobs (
30302
30463
  id TEXT PRIMARY KEY,
@@ -30316,7 +30477,7 @@ function up910(db) {
30316
30477
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
30317
30478
  ON summary_jobs(status)`);
30318
30479
  }
30319
- function up1010(db) {
30480
+ function up1110(db) {
30320
30481
  db.exec(`
30321
30482
  CREATE TABLE IF NOT EXISTS umap_cache (
30322
30483
  id INTEGER PRIMARY KEY,
@@ -30327,7 +30488,7 @@ function up1010(db) {
30327
30488
  )
30328
30489
  `);
30329
30490
  }
30330
- function up1110(db) {
30491
+ function up1210(db) {
30331
30492
  db.exec(`
30332
30493
  CREATE TABLE IF NOT EXISTS session_scores (
30333
30494
  id TEXT PRIMARY KEY,
@@ -30347,7 +30508,7 @@ function up1110(db) {
30347
30508
  ON session_scores(session_key);
30348
30509
  `);
30349
30510
  }
30350
- function up1210(db) {
30511
+ function up1310(db) {
30351
30512
  db.exec(`
30352
30513
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
30353
30514
  id TEXT PRIMARY KEY,
@@ -30388,7 +30549,7 @@ function addColumnIfMissing52(db, table, column, definition) {
30388
30549
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30389
30550
  }
30390
30551
  }
30391
- function up1310(db) {
30552
+ function up1410(db) {
30392
30553
  db.exec(`
30393
30554
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
30394
30555
  id TEXT PRIMARY KEY,
@@ -30414,7 +30575,7 @@ function up1310(db) {
30414
30575
  addColumnIfMissing52(db, "memories", "source_path", "TEXT");
30415
30576
  addColumnIfMissing52(db, "memories", "source_section", "TEXT");
30416
30577
  }
30417
- function up1410(db) {
30578
+ function up153(db) {
30418
30579
  db.exec(`
30419
30580
  CREATE TABLE IF NOT EXISTS telemetry_events (
30420
30581
  id TEXT PRIMARY KEY,
@@ -30439,7 +30600,7 @@ function addColumnIfMissing62(db, table, column, definition) {
30439
30600
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30440
30601
  }
30441
30602
  }
30442
- function up152(db) {
30603
+ function up162(db) {
30443
30604
  db.exec(`
30444
30605
  CREATE TABLE IF NOT EXISTS session_memories (
30445
30606
  id TEXT PRIMARY KEY,
@@ -30466,7 +30627,7 @@ function up152(db) {
30466
30627
  addColumnIfMissing62(db, "session_scores", "confidence", "REAL");
30467
30628
  addColumnIfMissing62(db, "session_scores", "continuity_reasoning", "TEXT");
30468
30629
  }
30469
- function up162(db) {
30630
+ function up172(db) {
30470
30631
  db.exec(`
30471
30632
  CREATE TABLE IF NOT EXISTS session_checkpoints (
30472
30633
  id TEXT PRIMARY KEY,
@@ -30488,7 +30649,7 @@ function up162(db) {
30488
30649
  ON session_checkpoints(project_normalized, created_at DESC);
30489
30650
  `);
30490
30651
  }
30491
- function up172(db) {
30652
+ function up182(db) {
30492
30653
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
30493
30654
  const colNames = new Set(cols.flatMap((c22) => typeof c22.name === "string" ? [c22.name] : []));
30494
30655
  if (!colNames.has("skill_name")) {
@@ -30499,7 +30660,7 @@ function up172(db) {
30499
30660
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
30500
30661
  }
30501
30662
  }
30502
- function up182(db) {
30663
+ function up192(db) {
30503
30664
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
30504
30665
  if (existing)
30505
30666
  return;
@@ -30531,7 +30692,7 @@ function up182(db) {
30531
30692
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
30532
30693
  `);
30533
30694
  }
30534
- function up192(db) {
30695
+ function up202(db) {
30535
30696
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
30536
30697
  const entityColNames = new Set(entityCols.flatMap((c22) => typeof c22.name === "string" ? [c22.name] : []));
30537
30698
  if (!entityColNames.has("agent_id")) {
@@ -30616,13 +30777,13 @@ function addColumnIfMissing72(db, table, column, definition) {
30616
30777
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30617
30778
  }
30618
30779
  }
30619
- function up202(db) {
30780
+ function up212(db) {
30620
30781
  addColumnIfMissing72(db, "session_memories", "entity_slot", "INTEGER");
30621
30782
  addColumnIfMissing72(db, "session_memories", "aspect_slot", "INTEGER");
30622
30783
  addColumnIfMissing72(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
30623
30784
  addColumnIfMissing72(db, "session_memories", "structural_density", "INTEGER");
30624
30785
  }
30625
- function up212(db) {
30786
+ function up222(db) {
30626
30787
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
30627
30788
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
30628
30789
  if (!columnNames.has("focal_entity_ids")) {
@@ -30647,25 +30808,25 @@ function addColumnIfMissing82(db, table, column, definition) {
30647
30808
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30648
30809
  }
30649
30810
  }
30650
- function up222(db) {
30811
+ function up232(db) {
30651
30812
  addColumnIfMissing82(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
30652
30813
  addColumnIfMissing82(db, "entities", "pinned_at", "TEXT");
30653
30814
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
30654
30815
  }
30655
- function up232(_db) {}
30656
30816
  function up242(_db) {}
30817
+ function up252(_db) {}
30657
30818
  function addColumnIfMissing92(db, table, column, definition) {
30658
30819
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
30659
30820
  if (!cols.some((c22) => c22.name === column)) {
30660
30821
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30661
30822
  }
30662
30823
  }
30663
- function up252(db) {
30824
+ function up262(db) {
30664
30825
  addColumnIfMissing92(db, "session_memories", "agent_relevance_score", "REAL");
30665
30826
  addColumnIfMissing92(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
30666
30827
  }
30667
- function up262(_db) {}
30668
- function up272(db) {
30828
+ function up272(_db) {}
30829
+ function up282(db) {
30669
30830
  db.exec(`
30670
30831
  UPDATE entities
30671
30832
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -30674,7 +30835,7 @@ function up272(db) {
30674
30835
  WHERE canonical_name IS NULL
30675
30836
  `);
30676
30837
  }
30677
- function up282(db) {
30838
+ function up292(db) {
30678
30839
  db.exec(`
30679
30840
  CREATE TABLE IF NOT EXISTS memories_cold (
30680
30841
  archive_id TEXT PRIMARY KEY,
@@ -30711,7 +30872,7 @@ function up282(db) {
30711
30872
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
30712
30873
  `);
30713
30874
  }
30714
- function up292(db) {
30875
+ function up302(db) {
30715
30876
  db.exec(`
30716
30877
  CREATE TABLE IF NOT EXISTS session_summaries (
30717
30878
  id TEXT PRIMARY KEY,
@@ -30756,7 +30917,7 @@ function up292(db) {
30756
30917
  WHERE session_key IS NOT NULL;
30757
30918
  `);
30758
30919
  }
30759
- function up302(db) {
30920
+ function up312(db) {
30760
30921
  db.exec(`
30761
30922
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
30762
30923
  id TEXT PRIMARY KEY,
@@ -30801,7 +30962,7 @@ function up302(db) {
30801
30962
  ON memory_jobs(failed_at);
30802
30963
  `);
30803
30964
  }
30804
- function up312(db) {
30965
+ function up322(db) {
30805
30966
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30806
30967
  if (!depCols.some((c22) => c22.name === "reason")) {
30807
30968
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -30811,7 +30972,7 @@ function up312(db) {
30811
30972
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
30812
30973
  }
30813
30974
  }
30814
- function up322(db) {
30975
+ function up332(db) {
30815
30976
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
30816
30977
  if (cols.length === 0)
30817
30978
  return;
@@ -30819,14 +30980,14 @@ function up322(db) {
30819
30980
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
30820
30981
  }
30821
30982
  }
30822
- function up332(db) {
30983
+ function up342(db) {
30823
30984
  const cols = db.prepare("PRAGMA table_info(memories)").all();
30824
30985
  if (!cols.some((c22) => c22.name === "scope")) {
30825
30986
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
30826
30987
  }
30827
30988
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
30828
30989
  }
30829
- function up342(db) {
30990
+ function up352(db) {
30830
30991
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
30831
30992
  db.exec(`
30832
30993
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -30834,7 +30995,7 @@ function up342(db) {
30834
30995
  WHERE content_hash IS NOT NULL AND is_deleted = 0
30835
30996
  `);
30836
30997
  }
30837
- function up352(db) {
30998
+ function up362(db) {
30838
30999
  db.exec(`
30839
31000
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
30840
31001
  name, canonical_name,
@@ -30866,13 +31027,13 @@ function up352(db) {
30866
31027
  END
30867
31028
  `);
30868
31029
  }
30869
- function up362(db) {
31030
+ function up372(db) {
30870
31031
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30871
31032
  if (!cols.some((c22) => c22.name === "confidence")) {
30872
31033
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
30873
31034
  }
30874
31035
  }
30875
- function up372(db) {
31036
+ function up382(db) {
30876
31037
  db.exec(`
30877
31038
  CREATE TABLE IF NOT EXISTS entity_communities (
30878
31039
  id TEXT PRIMARY KEY,
@@ -30890,7 +31051,7 @@ function up372(db) {
30890
31051
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
30891
31052
  }
30892
31053
  }
30893
- function up382(db) {
31054
+ function up392(db) {
30894
31055
  db.exec(`
30895
31056
  CREATE TABLE IF NOT EXISTS memory_hints (
30896
31057
  id TEXT PRIMARY KEY,
@@ -30930,7 +31091,7 @@ function up382(db) {
30930
31091
  END
30931
31092
  `);
30932
31093
  }
30933
- function up392(db) {
31094
+ function up402(db) {
30934
31095
  db.exec(`
30935
31096
  DELETE FROM entity_dependencies
30936
31097
  WHERE id NOT IN (
@@ -30948,7 +31109,7 @@ function up392(db) {
30948
31109
  )
30949
31110
  `);
30950
31111
  }
30951
- function up402(db) {
31112
+ function up412(db) {
30952
31113
  db.exec(`
30953
31114
  CREATE TABLE IF NOT EXISTS session_transcripts (
30954
31115
  session_key TEXT PRIMARY KEY,
@@ -30971,7 +31132,7 @@ function addColumnIfMissing102(db, table, column, definition) {
30971
31132
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30972
31133
  }
30973
31134
  }
30974
- function up412(db) {
31135
+ function up422(db) {
30975
31136
  addColumnIfMissing102(db, "session_memories", "path_json", "TEXT");
30976
31137
  db.exec(`
30977
31138
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -31046,7 +31207,7 @@ function addColumnIfMissing112(db, table, column, definition) {
31046
31207
  return;
31047
31208
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31048
31209
  }
31049
- function up422(db) {
31210
+ function up432(db) {
31050
31211
  addColumnIfMissing112(db, "session_memories", "entity_slot", "INTEGER");
31051
31212
  addColumnIfMissing112(db, "session_memories", "aspect_slot", "INTEGER");
31052
31213
  addColumnIfMissing112(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -31134,7 +31295,7 @@ function addColumnIfMissing122(db, table, column, definition) {
31134
31295
  return;
31135
31296
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31136
31297
  }
31137
- function up432(db) {
31298
+ function up442(db) {
31138
31299
  db.exec(`
31139
31300
  CREATE TABLE IF NOT EXISTS agents (
31140
31301
  id TEXT PRIMARY KEY,
@@ -31163,7 +31324,7 @@ function addColumnIfMissing132(db, table, column, definition) {
31163
31324
  return;
31164
31325
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31165
31326
  }
31166
- function up442(db) {
31327
+ function up452(db) {
31167
31328
  addColumnIfMissing132(db, "session_summaries", "source_type", "TEXT");
31168
31329
  addColumnIfMissing132(db, "session_summaries", "source_ref", "TEXT");
31169
31330
  addColumnIfMissing132(db, "session_summaries", "meta_json", "TEXT");
@@ -31189,7 +31350,7 @@ function addColumnIfMissing142(db, table, column, definition) {
31189
31350
  return;
31190
31351
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31191
31352
  }
31192
- function up452(db) {
31353
+ function up462(db) {
31193
31354
  addColumnIfMissing142(db, "session_transcripts", "updated_at", "TEXT");
31194
31355
  addColumnIfMissing142(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
31195
31356
  addColumnIfMissing142(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -31260,7 +31421,7 @@ function up452(db) {
31260
31421
  ON memory_md_heads(lease_expires_at);
31261
31422
  `);
31262
31423
  }
31263
- function up462(db) {
31424
+ function up472(db) {
31264
31425
  db.exec(`
31265
31426
  DROP INDEX IF EXISTS idx_summaries_session_depth;
31266
31427
 
@@ -31321,7 +31482,7 @@ function up462(db) {
31321
31482
  AND COALESCE(source_type, 'summary') = 'summary';
31322
31483
  `);
31323
31484
  }
31324
- function up472(db) {
31485
+ function up482(db) {
31325
31486
  db.exec(`
31326
31487
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
31327
31488
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -31419,7 +31580,7 @@ function up472(db) {
31419
31580
  AND COALESCE(source_type, 'summary') = 'summary';
31420
31581
  `);
31421
31582
  }
31422
- function up482(db) {
31583
+ function up492(db) {
31423
31584
  db.exec(`
31424
31585
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
31425
31586
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -31537,7 +31698,7 @@ function up482(db) {
31537
31698
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
31538
31699
  `);
31539
31700
  }
31540
- function up492(db) {
31701
+ function up502(db) {
31541
31702
  db.exec(`
31542
31703
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
31543
31704
  session_key TEXT NOT NULL,
@@ -31554,7 +31715,7 @@ function hasTable5(db, name) {
31554
31715
  WHERE type = 'table' AND name = ?
31555
31716
  LIMIT 1`).get(name) !== undefined;
31556
31717
  }
31557
- function up502(db) {
31718
+ function up512(db) {
31558
31719
  db.exec(`
31559
31720
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
31560
31721
  id TEXT PRIMARY KEY,
@@ -31724,7 +31885,7 @@ function addColumnIfMissing152(db, table, column, definition) {
31724
31885
  return;
31725
31886
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31726
31887
  }
31727
- function up512(db) {
31888
+ function up522(db) {
31728
31889
  addColumnIfMissing152(db, "summary_jobs", "session_id", "TEXT");
31729
31890
  addColumnIfMissing152(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
31730
31891
  addColumnIfMissing152(db, "summary_jobs", "captured_at", "TEXT");
@@ -31816,7 +31977,7 @@ function up512(db) {
31816
31977
  VALUES ('rebuild');
31817
31978
  `);
31818
31979
  }
31819
- function up522(db) {
31980
+ function up532(db) {
31820
31981
  db.exec(`
31821
31982
  CREATE TABLE IF NOT EXISTS mcp_invocations (
31822
31983
  id TEXT PRIMARY KEY,
@@ -31833,7 +31994,7 @@ function up522(db) {
31833
31994
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
31834
31995
  `);
31835
31996
  }
31836
- function up532(db) {
31997
+ function up542(db) {
31837
31998
  db.exec(`
31838
31999
  CREATE TABLE IF NOT EXISTS skill_invocations (
31839
32000
  id TEXT PRIMARY KEY,
@@ -31849,7 +32010,7 @@ function up532(db) {
31849
32010
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
31850
32011
  `);
31851
32012
  }
31852
- function up542(db) {
32013
+ function up552(db) {
31853
32014
  db.exec(`
31854
32015
  CREATE TABLE IF NOT EXISTS task_scope_hints (
31855
32016
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -31880,7 +32041,7 @@ function up542(db) {
31880
32041
  ON task_scope_hints(agent_id, updated_at);
31881
32042
  `);
31882
32043
  }
31883
- function up552(db) {
32044
+ function up562(db) {
31884
32045
  db.exec(`
31885
32046
  CREATE TABLE IF NOT EXISTS dreaming_state (
31886
32047
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -31923,7 +32084,7 @@ function ensureMemoriesScopeColumns3(db) {
31923
32084
  if (!names.has("scope"))
31924
32085
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
31925
32086
  }
31926
- function up562(db) {
32087
+ function up572(db) {
31927
32088
  ensureMemoriesScopeColumns3(db);
31928
32089
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
31929
32090
  db.exec(`
@@ -31936,20 +32097,20 @@ function up562(db) {
31936
32097
  WHERE content_hash IS NOT NULL AND is_deleted = 0
31937
32098
  `);
31938
32099
  }
31939
- function up572(db) {
32100
+ function up582(db) {
31940
32101
  const sql = readMemoriesFtsSql2(db);
31941
32102
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
31942
32103
  return;
31943
32104
  recreateMemoriesFts2(db);
31944
32105
  }
31945
- function up582(db) {
32106
+ function up592(db) {
31946
32107
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
31947
32108
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
31948
32109
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
31949
32110
  ON entities(entity_type, mentions)
31950
32111
  WHERE entity_type = 'extracted'`);
31951
32112
  }
31952
- function up592(db) {
32113
+ function up602(db) {
31953
32114
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31954
32115
  if (!cols.some((col) => col.name === "claim_key")) {
31955
32116
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -31958,7 +32119,7 @@ function up592(db) {
31958
32119
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
31959
32120
  WHERE claim_key IS NOT NULL`);
31960
32121
  }
31961
- function up602(db) {
32122
+ function up612(db) {
31962
32123
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31963
32124
  if (!cols.some((col) => col.name === "group_key")) {
31964
32125
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -31970,13 +32131,13 @@ function up602(db) {
31970
32131
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
31971
32132
  WHERE claim_key IS NOT NULL`);
31972
32133
  }
31973
- function up612(db) {
32134
+ function up622(db) {
31974
32135
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31975
32136
  if (cols.some((col) => col.name === "source_mtime_ms"))
31976
32137
  return;
31977
32138
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
31978
32139
  }
31979
- function up622(db) {
32140
+ function up632(db) {
31980
32141
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31981
32142
  const names = new Set(cols.map((col) => col.name));
31982
32143
  if (!names.has("is_deleted")) {
@@ -31990,7 +32151,7 @@ function up622(db) {
31990
32151
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
31991
32152
  `);
31992
32153
  }
31993
- function up632(db) {
32154
+ function up642(db) {
31994
32155
  db.exec("DROP TRIGGER IF EXISTS memories_au");
31995
32156
  db.exec(`
31996
32157
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -32008,7 +32169,7 @@ function addColumnIfMissing162(db, table, column, definition) {
32008
32169
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32009
32170
  }
32010
32171
  }
32011
- function up642(db) {
32172
+ function up652(db) {
32012
32173
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
32013
32174
  addColumnIfMissing162(db, table, "source_id", "TEXT");
32014
32175
  addColumnIfMissing162(db, table, "source_kind", "TEXT");
@@ -32028,7 +32189,7 @@ function hasColumn72(db, table, column) {
32028
32189
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32029
32190
  return rows.some((row) => row.name === column);
32030
32191
  }
32031
- function up652(db) {
32192
+ function up662(db) {
32032
32193
  if (!hasTable22(db, "embeddings"))
32033
32194
  return;
32034
32195
  if (!hasColumn72(db, "embeddings", "agent_id")) {
@@ -32036,7 +32197,7 @@ function up652(db) {
32036
32197
  }
32037
32198
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
32038
32199
  }
32039
- function up662(db) {
32200
+ function up672(db) {
32040
32201
  db.exec(`
32041
32202
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
32042
32203
  id TEXT PRIMARY KEY,
@@ -32077,7 +32238,7 @@ function addColumnIfMissing172(db, table, column, definition) {
32077
32238
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32078
32239
  }
32079
32240
  }
32080
- function up672(db) {
32241
+ function up682(db) {
32081
32242
  db.exec(`
32082
32243
  CREATE TABLE IF NOT EXISTS ontology_proposals (
32083
32244
  id TEXT PRIMARY KEY,
@@ -32120,7 +32281,7 @@ function up672(db) {
32120
32281
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
32121
32282
  }
32122
32283
  }
32123
- function up682(db) {
32284
+ function up692(db) {
32124
32285
  db.exec(`
32125
32286
  CREATE TABLE IF NOT EXISTS daily_reflections (
32126
32287
  id TEXT PRIMARY KEY,
@@ -32147,7 +32308,7 @@ function up682(db) {
32147
32308
  WHERE content_key IS NOT NULL;
32148
32309
  `);
32149
32310
  }
32150
- function up692(db) {
32311
+ function up702(db) {
32151
32312
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
32152
32313
  const colNames = new Set(cols.flatMap((c22) => typeof c22.name === "string" ? [c22.name] : []));
32153
32314
  if (!colNames.has("content_key")) {
@@ -32184,7 +32345,7 @@ function backfillVersionRoots2(db) {
32184
32345
  WHERE version_root_id IS NULL
32185
32346
  `);
32186
32347
  }
32187
- function up702(db) {
32348
+ function up712(db) {
32188
32349
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
32189
32350
  addColumnIfMissing182(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
32190
32351
  addColumnIfMissing182(db, table, "archived_at", "TEXT");
@@ -32219,7 +32380,7 @@ function up702(db) {
32219
32380
  ON entity_aspects(agent_id, proposal_id);
32220
32381
  `);
32221
32382
  }
32222
- function up712(db) {
32383
+ function up722(db) {
32223
32384
  db.exec(`
32224
32385
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
32225
32386
  id TEXT PRIMARY KEY,
@@ -32275,7 +32436,7 @@ function ensureMemoriesScopeColumns22(db) {
32275
32436
  if (!names.has("runtime_path"))
32276
32437
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
32277
32438
  }
32278
- function up722(db) {
32439
+ function up732(db) {
32279
32440
  ensureMemoriesScopeColumns22(db);
32280
32441
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
32281
32442
  db.exec(`
@@ -32289,7 +32450,7 @@ function up722(db) {
32289
32450
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
32290
32451
  `);
32291
32452
  }
32292
- function up732(db) {
32453
+ function up742(db) {
32293
32454
  db.exec(`
32294
32455
  CREATE TABLE IF NOT EXISTS session_context_epochs (
32295
32456
  session_key TEXT NOT NULL,
@@ -32324,7 +32485,7 @@ function up732(db) {
32324
32485
  ON session_recall_events(item_kind, item_id, created_at DESC);
32325
32486
  `);
32326
32487
  }
32327
- function up742(db) {
32488
+ function up752(db) {
32328
32489
  db.exec(`
32329
32490
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
32330
32491
  aggregate_memory_id TEXT NOT NULL,
@@ -32343,7 +32504,7 @@ function addColumnIfMissing192(db, table, column, definition) {
32343
32504
  return;
32344
32505
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32345
32506
  }
32346
- function up752(db) {
32507
+ function up762(db) {
32347
32508
  addColumnIfMissing192(db, "memory_artifacts", "source_id", "TEXT");
32348
32509
  addColumnIfMissing192(db, "memory_artifacts", "source_root", "TEXT");
32349
32510
  addColumnIfMissing192(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -32356,7 +32517,7 @@ function up752(db) {
32356
32517
  ON memory_artifacts(agent_id, source_id, source_root);
32357
32518
  `);
32358
32519
  }
32359
- function up762(db) {
32520
+ function up772(db) {
32360
32521
  db.exec(`
32361
32522
  CREATE TABLE IF NOT EXISTS temporal_edges (
32362
32523
  id TEXT PRIMARY KEY,
@@ -32379,7 +32540,7 @@ function up762(db) {
32379
32540
  ON temporal_edges(agent_id, subject_type, subject_id);
32380
32541
  `);
32381
32542
  }
32382
- function up772(db) {
32543
+ function up782(db) {
32383
32544
  db.exec(`
32384
32545
  CREATE TABLE IF NOT EXISTS entity_aliases (
32385
32546
  id TEXT PRIMARY KEY,
@@ -32403,7 +32564,7 @@ function up772(db) {
32403
32564
  ON entity_aliases(agent_id, canonical_alias, status);
32404
32565
  `);
32405
32566
  }
32406
- function up782(db) {
32567
+ function up792(db) {
32407
32568
  db.exec(`
32408
32569
  CREATE TABLE IF NOT EXISTS api_keys (
32409
32570
  id TEXT PRIMARY KEY,
@@ -32431,7 +32592,7 @@ function up782(db) {
32431
32592
  ON api_keys(connector, harness);
32432
32593
  `);
32433
32594
  }
32434
- function up792(db) {
32595
+ function up802(db) {
32435
32596
  db.exec(`
32436
32597
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
32437
32598
  id TEXT PRIMARY KEY,
@@ -32466,7 +32627,7 @@ function hasColumn102(db, table, column) {
32466
32627
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32467
32628
  return rows.some((row) => row.name === column);
32468
32629
  }
32469
- function up802(db) {
32630
+ function up812(db) {
32470
32631
  if (!hasColumn102(db, "documents", "agent_id")) {
32471
32632
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
32472
32633
  }
@@ -32552,7 +32713,7 @@ function up802(db) {
32552
32713
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
32553
32714
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
32554
32715
  }
32555
- function up812(db) {
32716
+ function up822(db) {
32556
32717
  db.exec(`
32557
32718
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
32558
32719
  aggregate_memory_id TEXT NOT NULL,
@@ -32574,7 +32735,7 @@ function hasColumn112(db, table, column) {
32574
32735
  return rows.some((row) => row.name === column);
32575
32736
  }
32576
32737
  var COLUMNS3 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
32577
- function up822(db) {
32738
+ function up832(db) {
32578
32739
  for (const column of COLUMNS3) {
32579
32740
  if (!hasColumn112(db, "skill_invocations", column)) {
32580
32741
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -32655,7 +32816,7 @@ function documentScopeColumnsPreservingExisting2(db) {
32655
32816
  `);
32656
32817
  }
32657
32818
  try {
32658
- up802(db);
32819
+ up812(db);
32659
32820
  if (preserveAgentId) {
32660
32821
  db.exec(`
32661
32822
  UPDATE documents
@@ -32675,12 +32836,12 @@ function documentScopeColumnsPreservingExisting2(db) {
32675
32836
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
32676
32837
  }
32677
32838
  }
32678
- function up832(db) {
32679
- up792(db);
32839
+ function up842(db) {
32840
+ up802(db);
32680
32841
  if (hasTable32(db, "documents")) {
32681
32842
  documentScopeColumnsPreservingExisting2(db);
32682
32843
  }
32683
- up812(db);
32844
+ up822(db);
32684
32845
  addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
32685
32846
  addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
32686
32847
  addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
@@ -32737,7 +32898,7 @@ function up832(db) {
32737
32898
  AND ${sourceAgentId} = ${targetAgentId}
32738
32899
  `);
32739
32900
  }
32740
- function up842(db) {
32901
+ function up852(db) {
32741
32902
  db.exec(`
32742
32903
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
32743
32904
  path TEXT PRIMARY KEY,
@@ -32767,7 +32928,7 @@ function up842(db) {
32767
32928
  ON legacy_markdown_chunks(memory_id);
32768
32929
  `);
32769
32930
  }
32770
- function up852(db) {
32931
+ function up862(db) {
32771
32932
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
32772
32933
  const tableNames = new Set(tables.map((r22) => String(r22.name)));
32773
32934
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -32826,7 +32987,7 @@ function addColumnIfMissing212(db, table, column, definition) {
32826
32987
  return;
32827
32988
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32828
32989
  }
32829
- function up862(db) {
32990
+ function up872(db) {
32830
32991
  addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
32831
32992
  db.exec(`
32832
32993
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -32839,14 +33000,14 @@ function addColumnIfMissing222(db, table, column, definition) {
32839
33000
  return;
32840
33001
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32841
33002
  }
32842
- function up872(db) {
33003
+ function up882(db) {
32843
33004
  addColumnIfMissing222(db, "summary_jobs", "boundary_reason", "TEXT");
32844
33005
  db.exec(`
32845
33006
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
32846
33007
  ON summary_jobs(agent_id, session_key, boundary_reason)
32847
33008
  `);
32848
33009
  }
32849
- function up882(db) {
33010
+ function up892(db) {
32850
33011
  db.exec(`
32851
33012
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
32852
33013
  agent_id TEXT NOT NULL,
@@ -32864,7 +33025,7 @@ function up882(db) {
32864
33025
  ON transcript_capture_jobs(agent_id, session_id, status);
32865
33026
  `);
32866
33027
  }
32867
- function up892(db) {
33028
+ function up902(db) {
32868
33029
  db.exec(`
32869
33030
  CREATE TABLE IF NOT EXISTS job_cancellations (
32870
33031
  id TEXT PRIMARY KEY,
@@ -32892,7 +33053,7 @@ function indexExists3(db, table, indexName) {
32892
33053
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32893
33054
  return rows.some((row) => row.name === indexName);
32894
33055
  }
32895
- function up902(db) {
33056
+ function up912(db) {
32896
33057
  db.exec(`
32897
33058
  CREATE TABLE IF NOT EXISTS job_archive (
32898
33059
  id TEXT PRIMARY KEY,
@@ -32919,7 +33080,7 @@ function indexExists22(db, table, indexName) {
32919
33080
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32920
33081
  return rows.some((row) => row.name === indexName);
32921
33082
  }
32922
- function up912(db) {
33083
+ function up922(db) {
32923
33084
  db.exec(`
32924
33085
  CREATE TABLE IF NOT EXISTS embedding_index_state (
32925
33086
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -32932,7 +33093,7 @@ function up912(db) {
32932
33093
  )
32933
33094
  `);
32934
33095
  }
32935
- function up922(db) {
33096
+ function up932(db) {
32936
33097
  db.exec(`
32937
33098
  CREATE TABLE IF NOT EXISTS embeddings_staging (
32938
33099
  id TEXT PRIMARY KEY,
@@ -32951,7 +33112,7 @@ function up922(db) {
32951
33112
  ON embeddings_staging(agent_id, source_type, source_id);
32952
33113
  `);
32953
33114
  }
32954
- function up932(db) {
33115
+ function up942(db) {
32955
33116
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32956
33117
  if (!columns.some((column) => column.name === "evidence_cursor")) {
32957
33118
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -32962,7 +33123,7 @@ function hasColumn132(db, table, column) {
32962
33123
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32963
33124
  return rows.some((r22) => r22.name === column);
32964
33125
  }
32965
- function up942(db) {
33126
+ function up952(db) {
32966
33127
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
32967
33128
  if (tables.length === 0)
32968
33129
  return;
@@ -32987,23 +33148,23 @@ function up942(db) {
32987
33148
  function hasColumn142(db, table, column) {
32988
33149
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32989
33150
  }
32990
- function up952(db) {
33151
+ function up962(db) {
32991
33152
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
32992
33153
  if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
32993
33154
  return;
32994
33155
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
32995
33156
  }
32996
- function up962(db) {
33157
+ function up972(db) {
32997
33158
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
32998
33159
  }
32999
- function up972(db) {
33160
+ function up982(db) {
33000
33161
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
33001
33162
  if (!columns.some((column) => column.name === "last_failure_at")) {
33002
33163
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
33003
33164
  }
33004
33165
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
33005
33166
  }
33006
- function up982(db) {
33167
+ function up992(db) {
33007
33168
  db.exec(`
33008
33169
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
33009
33170
  agent_id TEXT NOT NULL,
@@ -33020,7 +33181,7 @@ function up982(db) {
33020
33181
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
33021
33182
  `);
33022
33183
  }
33023
- function up992(db) {
33184
+ function up1002(db) {
33024
33185
  db.exec(`
33025
33186
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
33026
33187
  id TEXT PRIMARY KEY,
@@ -33040,7 +33201,7 @@ function up992(db) {
33040
33201
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
33041
33202
  `);
33042
33203
  }
33043
- function up1002(db) {
33204
+ function up1012(db) {
33044
33205
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
33045
33206
  if (!columns.some((column) => column.name === "evidence_window_json")) {
33046
33207
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -33049,7 +33210,7 @@ function up1002(db) {
33049
33210
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
33050
33211
  }
33051
33212
  }
33052
- function up1012(db) {
33213
+ function up1022(db) {
33053
33214
  db.exec(`
33054
33215
  CREATE TABLE IF NOT EXISTS dreaming_attention (
33055
33216
  id TEXT PRIMARY KEY,
@@ -33071,7 +33232,7 @@ function up1012(db) {
33071
33232
  function hasColumn152(db, table, column) {
33072
33233
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33073
33234
  }
33074
- function up1022(db) {
33235
+ function up1032(db) {
33075
33236
  const requiredMemoryColumns = [
33076
33237
  "content_hash",
33077
33238
  "normalized_content",
@@ -33122,7 +33283,7 @@ function up1022(db) {
33122
33283
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
33123
33284
  `);
33124
33285
  }
33125
- function up1032(db) {
33286
+ function up1042(db) {
33126
33287
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
33127
33288
  if (tables.length !== 2)
33128
33289
  return;
@@ -33145,7 +33306,7 @@ function tableExists4(db, table) {
33145
33306
  function hasColumn162(db, table, column) {
33146
33307
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33147
33308
  }
33148
- function up1042(db) {
33309
+ function up1052(db) {
33149
33310
  db.exec(`
33150
33311
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
33151
33312
  derived_memory_id TEXT NOT NULL,
@@ -33188,7 +33349,7 @@ function up1042(db) {
33188
33349
  `);
33189
33350
  }
33190
33351
  }
33191
- function up1052(db) {
33352
+ function up1062(db) {
33192
33353
  db.exec(`
33193
33354
  DROP TRIGGER IF EXISTS entities_fts_ai;
33194
33355
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -33277,7 +33438,7 @@ function up1052(db) {
33277
33438
  function hasColumn172(db, table, column) {
33278
33439
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33279
33440
  }
33280
- function up1062(db) {
33441
+ function up1072(db) {
33281
33442
  if (!hasColumn172(db, "memories", "review_after")) {
33282
33443
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
33283
33444
  }
@@ -33293,14 +33454,14 @@ var TOKEN_COLUMNS2 = [
33293
33454
  ["tokens_cache_write", "INTEGER"],
33294
33455
  ["tokens_cost", "REAL"]
33295
33456
  ];
33296
- function up1072(db) {
33457
+ function up1082(db) {
33297
33458
  for (const [column, type] of TOKEN_COLUMNS2) {
33298
33459
  if (!hasColumn182(db, "dreaming_passes", column)) {
33299
33460
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
33300
33461
  }
33301
33462
  }
33302
33463
  }
33303
- function up1082(db) {
33464
+ function up1092(db) {
33304
33465
  db.exec(`
33305
33466
  CREATE TABLE IF NOT EXISTS embedding_usage (
33306
33467
  day TEXT NOT NULL,
@@ -33313,7 +33474,7 @@ function up1082(db) {
33313
33474
  );
33314
33475
  `);
33315
33476
  }
33316
- function up1092(db) {
33477
+ function up1102(db) {
33317
33478
  db.exec(`
33318
33479
  CREATE TABLE IF NOT EXISTS telemetry_install (
33319
33480
  id TEXT PRIMARY KEY,
@@ -33321,7 +33482,7 @@ function up1092(db) {
33321
33482
  );
33322
33483
  `);
33323
33484
  }
33324
- function up1102(db) {
33485
+ function up1112(db) {
33325
33486
  db.exec(`
33326
33487
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
33327
33488
  ON memory_entity_mentions(entity_id, memory_id);
@@ -33332,7 +33493,7 @@ function hasColumn192(db, table, column) {
33332
33493
  return rows.some((row) => row.name === column);
33333
33494
  }
33334
33495
  var COLUMNS22 = ["first_remember_at", "first_recall_at"];
33335
- function up1112(db) {
33496
+ function up1122(db) {
33336
33497
  for (const column of COLUMNS22) {
33337
33498
  if (!hasColumn192(db, "telemetry_install", column)) {
33338
33499
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -33348,7 +33509,7 @@ function addColumnIfMissing232(db, column, definition) {
33348
33509
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33349
33510
  }
33350
33511
  }
33351
- function up1122(db) {
33512
+ function up1132(db) {
33352
33513
  addColumnIfMissing232(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
33353
33514
  addColumnIfMissing232(db, "claim_token", "TEXT");
33354
33515
  addColumnIfMissing232(db, "claimed_at", "TEXT");
@@ -33357,7 +33518,7 @@ function up1122(db) {
33357
33518
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
33358
33519
  `);
33359
33520
  }
33360
- function up1132(db) {
33521
+ function up1142(db) {
33361
33522
  db.exec(`
33362
33523
  CREATE TABLE IF NOT EXISTS session_claims (
33363
33524
  session_key TEXT NOT NULL,
@@ -33378,7 +33539,7 @@ function up1132(db) {
33378
33539
  ON session_claims(agent_id, state, expires_at);
33379
33540
  `);
33380
33541
  }
33381
- function up1142(db) {
33542
+ function up1152(db) {
33382
33543
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
33383
33544
  if (table == null)
33384
33545
  return;
@@ -33387,7 +33548,7 @@ function up1142(db) {
33387
33548
  ON entity_attributes(memory_id, agent_id, status, importance);
33388
33549
  `);
33389
33550
  }
33390
- function up1152(db) {
33551
+ function up1162(db) {
33391
33552
  db.exec(`
33392
33553
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
33393
33554
  id TEXT PRIMARY KEY,
@@ -33444,7 +33605,7 @@ function addColumnIfMissing242(db, column, definition) {
33444
33605
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
33445
33606
  }
33446
33607
  }
33447
- function up1162(db) {
33608
+ function up1172(db) {
33448
33609
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
33449
33610
  if (table == null)
33450
33611
  return;
@@ -33645,7 +33806,7 @@ function backfillTranscriptsFromSummaryJobs2(db) {
33645
33806
  insert.run(...values);
33646
33807
  }
33647
33808
  }
33648
- function up1172(db) {
33809
+ function up1182(db) {
33649
33810
  if (!hasTable42(db, "session_transcripts"))
33650
33811
  return;
33651
33812
  addColumnIfMissing252(db, "session_transcripts", "completed_at", "TEXT");
@@ -33698,7 +33859,7 @@ function up1172(db) {
33698
33859
  ON session_transcripts(agent_id, content_hash);
33699
33860
  `);
33700
33861
  }
33701
- function up1182(db) {
33862
+ function up1192(db) {
33702
33863
  db.exec(`
33703
33864
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
33704
33865
  ON memory_jobs(status)
@@ -33717,12 +33878,12 @@ function up1182(db) {
33717
33878
  function hasColumn222(db, table, column) {
33718
33879
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33719
33880
  }
33720
- function up1192(db) {
33881
+ function up1202(db) {
33721
33882
  if (!hasColumn222(db, "telemetry_install", "last_seen_version")) {
33722
33883
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
33723
33884
  }
33724
33885
  }
33725
- function up1202(db) {
33886
+ function up1212(db) {
33726
33887
  db.exec(`
33727
33888
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
33728
33889
  agent_id TEXT NOT NULL,
@@ -33751,7 +33912,7 @@ function addColumnIfMissing262(db, column, definition) {
33751
33912
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33752
33913
  }
33753
33914
  }
33754
- function up1212(db) {
33915
+ function up1222(db) {
33755
33916
  addColumnIfMissing262(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
33756
33917
  addColumnIfMissing262(db, "last_attempt_at", "TEXT");
33757
33918
  addColumnIfMissing262(db, "sent_at", "TEXT");
@@ -33772,7 +33933,7 @@ function up1212(db) {
33772
33933
  VALUES (1, CURRENT_TIMESTAMP);
33773
33934
  `);
33774
33935
  }
33775
- function up1222(db) {
33936
+ function up1232(db) {
33776
33937
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
33777
33938
  const names = new Set(columns.map((column) => column.name));
33778
33939
  if (!names.has("failure_class")) {
@@ -33789,7 +33950,7 @@ function up1222(db) {
33789
33950
  }
33790
33951
  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)");
33791
33952
  }
33792
- function up1232(db) {
33953
+ function up1242(db) {
33793
33954
  db.exec(`
33794
33955
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
33795
33956
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -33813,7 +33974,7 @@ function up1232(db) {
33813
33974
  ON embedding_index_failures(source_type, source_id);
33814
33975
  `);
33815
33976
  }
33816
- function up1242(db) {
33977
+ function up1252(db) {
33817
33978
  db.exec(`
33818
33979
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
33819
33980
  id TEXT PRIMARY KEY,
@@ -33863,7 +34024,7 @@ function backfillTable2(db, params) {
33863
34024
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
33864
34025
  backfill2(db, rows, params.sourceKind, params.scannedAt);
33865
34026
  }
33866
- function up1252(db) {
34027
+ function up1262(db) {
33867
34028
  db.exec(`
33868
34029
  CREATE TABLE IF NOT EXISTS memory_content_safety (
33869
34030
  agent_id TEXT NOT NULL,
@@ -33920,7 +34081,7 @@ function up1252(db) {
33920
34081
  scannedAt
33921
34082
  });
33922
34083
  }
33923
- function up1262(db) {
34084
+ function up1272(db) {
33924
34085
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
33925
34086
  if (!table)
33926
34087
  return;
@@ -33954,7 +34115,7 @@ function up1262(db) {
33954
34115
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
33955
34116
  `);
33956
34117
  }
33957
- function up1272(db) {
34118
+ function up1282(db) {
33958
34119
  db.exec(`
33959
34120
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
33960
34121
  id TEXT PRIMARY KEY,
@@ -34010,7 +34171,7 @@ function up1272(db) {
34010
34171
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
34011
34172
  `);
34012
34173
  }
34013
- function up1282(db) {
34174
+ function up1292(db) {
34014
34175
  db.exec(`
34015
34176
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
34016
34177
  ON memory_jobs(status, created_at)
@@ -34025,7 +34186,7 @@ function up1282(db) {
34025
34186
  function tableExists32(db, table) {
34026
34187
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
34027
34188
  }
34028
- function up1292(db) {
34189
+ function up1302(db) {
34029
34190
  if (!tableExists32(db, "memory_jobs"))
34030
34191
  return;
34031
34192
  if (!tableExists32(db, "job_cancellations")) {
@@ -34074,7 +34235,7 @@ function up1292(db) {
34074
34235
  AND status IN ('pending', 'leased');
34075
34236
  `);
34076
34237
  }
34077
- function up1302(db) {
34238
+ function up1312(db) {
34078
34239
  db.exec(`
34079
34240
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
34080
34241
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -34114,7 +34275,7 @@ function up1302(db) {
34114
34275
  END;
34115
34276
  `);
34116
34277
  }
34117
- function up1312(db) {
34278
+ function up1322(db) {
34118
34279
  db.exec(`
34119
34280
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
34120
34281
  agent_id TEXT NOT NULL,
@@ -34137,13 +34298,13 @@ function up1312(db) {
34137
34298
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
34138
34299
  `);
34139
34300
  }
34140
- function up1322(db) {
34301
+ function up1332(db) {
34141
34302
  db.exec(`
34142
34303
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
34143
34304
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
34144
34305
  `);
34145
34306
  }
34146
- function up1332(db) {
34307
+ function up1342(db) {
34147
34308
  db.exec(`
34148
34309
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
34149
34310
  id TEXT PRIMARY KEY,
@@ -34195,7 +34356,7 @@ function up1332(db) {
34195
34356
  if (!names.has("format_version"))
34196
34357
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
34197
34358
  }
34198
- function up1342(db) {
34359
+ function up1352(db) {
34199
34360
  db.exec(`
34200
34361
  CREATE TABLE memory_head_entries_v134 (
34201
34362
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -34213,7 +34374,7 @@ function up1342(db) {
34213
34374
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
34214
34375
  `);
34215
34376
  }
34216
- function up1352(db) {
34377
+ function up1362(db) {
34217
34378
  db.exec(`
34218
34379
  CREATE TABLE IF NOT EXISTS memory_head_publications (
34219
34380
  agent_id TEXT NOT NULL,
@@ -34229,7 +34390,7 @@ function up1352(db) {
34229
34390
  ON memory_head_publications(agent_id, status, revision DESC);
34230
34391
  `);
34231
34392
  }
34232
- function up1362(db) {
34393
+ function up1372(db) {
34233
34394
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r22) => r22.name));
34234
34395
  for (const [name, type] of [
34235
34396
  ["entry_id", "TEXT"],
@@ -34243,7 +34404,7 @@ function up1362(db) {
34243
34404
  }
34244
34405
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
34245
34406
  }
34246
- function up1372(db) {
34407
+ function up1382(db) {
34247
34408
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r22) => r22.name));
34248
34409
  for (const [name, type] of [
34249
34410
  ["head_revision", "INTEGER"],
@@ -34265,7 +34426,7 @@ function addColumnIfMissing272(db, table, column, definition) {
34265
34426
  if (!hasColumn252(db, table, column))
34266
34427
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34267
34428
  }
34268
- function up1382(db) {
34429
+ function up1392(db) {
34269
34430
  addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
34270
34431
  db.exec(`
34271
34432
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -34570,7 +34731,7 @@ function up1382(db) {
34570
34731
  GROUP BY j.agent_id;
34571
34732
  `);
34572
34733
  }
34573
- function up1392(db) {
34734
+ function up1402(db) {
34574
34735
  db.exec(`
34575
34736
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
34576
34737
  agent_id TEXT NOT NULL,
@@ -34586,7 +34747,7 @@ function up1392(db) {
34586
34747
  ON native_source_sync_state(agent_id, status);
34587
34748
  `);
34588
34749
  }
34589
- function up1402(db) {
34750
+ function up1412(db) {
34590
34751
  db.exec(`
34591
34752
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
34592
34753
  agent_id TEXT NOT NULL,
@@ -34598,7 +34759,7 @@ function up1402(db) {
34598
34759
  );
34599
34760
  `);
34600
34761
  }
34601
- function up1412(db) {
34762
+ function up1422(db) {
34602
34763
  db.exec(`
34603
34764
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
34604
34765
  agent_id TEXT NOT NULL,
@@ -34612,13 +34773,13 @@ function up1412(db) {
34612
34773
  );
34613
34774
  `);
34614
34775
  }
34615
- function up1422(db) {
34776
+ function up1432(db) {
34616
34777
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
34617
34778
  if (!columns.some((column) => column.name === "frontier")) {
34618
34779
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
34619
34780
  }
34620
34781
  }
34621
- function up1432(db) {
34782
+ function up1442(db) {
34622
34783
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34623
34784
  const additions = [
34624
34785
  ["migration_phase", "TEXT"],
@@ -34653,13 +34814,13 @@ function up1432(db) {
34653
34814
  `);
34654
34815
  }
34655
34816
  }
34656
- function up1442(db) {
34817
+ function up1452(db) {
34657
34818
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34658
34819
  if (!columns.has("lease_token")) {
34659
34820
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
34660
34821
  }
34661
34822
  }
34662
- function up1452(db) {
34823
+ function up1462(db) {
34663
34824
  db.exec(`
34664
34825
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
34665
34826
  agent_id TEXT NOT NULL,
@@ -34677,7 +34838,7 @@ function up1452(db) {
34677
34838
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
34678
34839
  `);
34679
34840
  }
34680
- function up1462(db) {
34841
+ function up1472(db) {
34681
34842
  db.exec(`
34682
34843
  CREATE TABLE IF NOT EXISTS source_import_jobs (
34683
34844
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -34732,24 +34893,36 @@ function up1462(db) {
34732
34893
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
34733
34894
  `);
34734
34895
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
34735
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
34896
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
34897
+ let exists;
34898
+ try {
34899
+ exists = statement.get(column);
34900
+ } finally {
34901
+ statement.finalize?.();
34902
+ }
34736
34903
  if (exists == null)
34737
34904
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
34738
34905
  }
34739
34906
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
34740
34907
  }
34741
- function up1472(db) {
34908
+ function up1482(db) {
34742
34909
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
34743
34910
  }
34744
- function up1482(db) {
34911
+ function up1492(db) {
34745
34912
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
34746
34913
  if (!columns.some((column) => column.name === "source_id")) {
34747
34914
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
34748
34915
  }
34749
34916
  }
34750
- function up1492(db) {
34917
+ function up1502(db) {
34751
34918
  const addColumn = (table, column, definition) => {
34752
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
34919
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
34920
+ let exists;
34921
+ try {
34922
+ exists = statement.get(table, column);
34923
+ } finally {
34924
+ statement.finalize?.();
34925
+ }
34753
34926
  if (exists == null)
34754
34927
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34755
34928
  };
@@ -34762,7 +34935,7 @@ function addColumnIfMissing282(db, table, column, definition) {
34762
34935
  if (!columns.some((row) => row.name === column))
34763
34936
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34764
34937
  }
34765
- function up1502(db) {
34938
+ function up1512(db) {
34766
34939
  addColumnIfMissing282(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
34767
34940
  addColumnIfMissing282(db, "dreaming_passes", "head_base_revision", "INTEGER");
34768
34941
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -34916,13 +35089,13 @@ var MIGRATIONS2 = [
34916
35089
  {
34917
35090
  version: 1,
34918
35091
  name: "baseline",
34919
- up: up151,
35092
+ up: up210,
34920
35093
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
34921
35094
  },
34922
35095
  {
34923
35096
  version: 2,
34924
35097
  name: "pipeline-v2",
34925
- up: up210,
35098
+ up: up310,
34926
35099
  artifacts: {
34927
35100
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
34928
35101
  }
@@ -34930,12 +35103,12 @@ var MIGRATIONS2 = [
34930
35103
  {
34931
35104
  version: 3,
34932
35105
  name: "unique-content-hash",
34933
- up: up310
35106
+ up: up410
34934
35107
  },
34935
35108
  {
34936
35109
  version: 4,
34937
35110
  name: "history-actor-and-retention",
34938
- up: up410,
35111
+ up: up510,
34939
35112
  artifacts: {
34940
35113
  columns: [{ table: "memory_history", column: "actor_type" }]
34941
35114
  }
@@ -34943,7 +35116,7 @@ var MIGRATIONS2 = [
34943
35116
  {
34944
35117
  version: 5,
34945
35118
  name: "graph-extended",
34946
- up: up510,
35119
+ up: up610,
34947
35120
  artifacts: {
34948
35121
  columns: [{ table: "entities", column: "canonical_name" }]
34949
35122
  }
@@ -34951,7 +35124,7 @@ var MIGRATIONS2 = [
34951
35124
  {
34952
35125
  version: 6,
34953
35126
  name: "idempotency-key",
34954
- up: up610,
35127
+ up: up710,
34955
35128
  artifacts: {
34956
35129
  columns: [{ table: "memories", column: "idempotency_key" }]
34957
35130
  }
@@ -34959,42 +35132,42 @@ var MIGRATIONS2 = [
34959
35132
  {
34960
35133
  version: 7,
34961
35134
  name: "documents-and-connectors",
34962
- up: up710,
35135
+ up: up810,
34963
35136
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
34964
35137
  },
34965
35138
  {
34966
35139
  version: 8,
34967
35140
  name: "embeddings-unique-hash",
34968
- up: up810
35141
+ up: up910
34969
35142
  },
34970
35143
  {
34971
35144
  version: 9,
34972
35145
  name: "summary-jobs",
34973
- up: up910,
35146
+ up: up1010,
34974
35147
  artifacts: { tables: ["summary_jobs"] }
34975
35148
  },
34976
35149
  {
34977
35150
  version: 10,
34978
35151
  name: "umap-cache",
34979
- up: up1010,
35152
+ up: up1110,
34980
35153
  artifacts: { tables: ["umap_cache"] }
34981
35154
  },
34982
35155
  {
34983
35156
  version: 11,
34984
35157
  name: "session-scores",
34985
- up: up1110,
35158
+ up: up1210,
34986
35159
  artifacts: { tables: ["session_scores"] }
34987
35160
  },
34988
35161
  {
34989
35162
  version: 12,
34990
35163
  name: "scheduled-tasks",
34991
- up: up1210,
35164
+ up: up1310,
34992
35165
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
34993
35166
  },
34994
35167
  {
34995
35168
  version: 13,
34996
35169
  name: "ingestion-tracking",
34997
- up: up1310,
35170
+ up: up1410,
34998
35171
  artifacts: {
34999
35172
  columns: [
35000
35173
  { table: "memories", column: "source_path" },
@@ -35005,13 +35178,13 @@ var MIGRATIONS2 = [
35005
35178
  {
35006
35179
  version: 14,
35007
35180
  name: "telemetry",
35008
- up: up1410,
35181
+ up: up153,
35009
35182
  artifacts: { tables: ["telemetry_events"] }
35010
35183
  },
35011
35184
  {
35012
35185
  version: 15,
35013
35186
  name: "session-memories",
35014
- up: up152,
35187
+ up: up162,
35015
35188
  artifacts: {
35016
35189
  tables: ["session_memories"],
35017
35190
  columns: [
@@ -35023,13 +35196,13 @@ var MIGRATIONS2 = [
35023
35196
  {
35024
35197
  version: 16,
35025
35198
  name: "session-checkpoints",
35026
- up: up162,
35199
+ up: up172,
35027
35200
  artifacts: { tables: ["session_checkpoints"] }
35028
35201
  },
35029
35202
  {
35030
35203
  version: 17,
35031
35204
  name: "task-skills",
35032
- up: up172,
35205
+ up: up182,
35033
35206
  artifacts: {
35034
35207
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
35035
35208
  }
@@ -35037,13 +35210,13 @@ var MIGRATIONS2 = [
35037
35210
  {
35038
35211
  version: 18,
35039
35212
  name: "skill-meta",
35040
- up: up182,
35213
+ up: up192,
35041
35214
  artifacts: { tables: ["skill_meta"] }
35042
35215
  },
35043
35216
  {
35044
35217
  version: 19,
35045
35218
  name: "knowledge-structure",
35046
- up: up192,
35219
+ up: up202,
35047
35220
  artifacts: {
35048
35221
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
35049
35222
  columns: [{ table: "entities", column: "agent_id" }]
@@ -35052,7 +35225,7 @@ var MIGRATIONS2 = [
35052
35225
  {
35053
35226
  version: 20,
35054
35227
  name: "session-structural-columns",
35055
- up: up202,
35228
+ up: up212,
35056
35229
  artifacts: {
35057
35230
  columns: [
35058
35231
  { table: "session_memories", column: "entity_slot" },
@@ -35065,7 +35238,7 @@ var MIGRATIONS2 = [
35065
35238
  {
35066
35239
  version: 21,
35067
35240
  name: "checkpoint-structural",
35068
- up: up212,
35241
+ up: up222,
35069
35242
  artifacts: {
35070
35243
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
35071
35244
  }
@@ -35073,7 +35246,7 @@ var MIGRATIONS2 = [
35073
35246
  {
35074
35247
  version: 22,
35075
35248
  name: "entity-pinning",
35076
- up: up222,
35249
+ up: up232,
35077
35250
  artifacts: {
35078
35251
  columns: [
35079
35252
  { table: "entities", column: "pinned" },
@@ -35084,17 +35257,17 @@ var MIGRATIONS2 = [
35084
35257
  {
35085
35258
  version: 23,
35086
35259
  name: "retired-scorer-gap",
35087
- up: up232
35260
+ up: up242
35088
35261
  },
35089
35262
  {
35090
35263
  version: 24,
35091
35264
  name: "retired-scorer-gap",
35092
- up: up242
35265
+ up: up252
35093
35266
  },
35094
35267
  {
35095
35268
  version: 25,
35096
35269
  name: "agent-feedback",
35097
- up: up252,
35270
+ up: up262,
35098
35271
  artifacts: {
35099
35272
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
35100
35273
  }
@@ -35102,32 +35275,32 @@ var MIGRATIONS2 = [
35102
35275
  {
35103
35276
  version: 26,
35104
35277
  name: "retired-scorer-gap",
35105
- up: up262
35278
+ up: up272
35106
35279
  },
35107
35280
  {
35108
35281
  version: 27,
35109
35282
  name: "backfill-canonical-names",
35110
- up: up272
35283
+ up: up282
35111
35284
  },
35112
35285
  {
35113
35286
  version: 28,
35114
35287
  name: "lossless-retention",
35115
- up: up282
35288
+ up: up292
35116
35289
  },
35117
35290
  {
35118
35291
  version: 29,
35119
35292
  name: "session-summary-dag",
35120
- up: up292
35293
+ up: up302
35121
35294
  },
35122
35295
  {
35123
35296
  version: 30,
35124
35297
  name: "nullable-memory-job-memory-id",
35125
- up: up302
35298
+ up: up312
35126
35299
  },
35127
35300
  {
35128
35301
  version: 31,
35129
35302
  name: "dependency-reason",
35130
- up: up312,
35303
+ up: up322,
35131
35304
  artifacts: {
35132
35305
  columns: [
35133
35306
  { table: "entity_dependencies", column: "reason" },
@@ -35138,7 +35311,7 @@ var MIGRATIONS2 = [
35138
35311
  {
35139
35312
  version: 32,
35140
35313
  name: "embeddings-vector-column",
35141
- up: up322,
35314
+ up: up332,
35142
35315
  artifacts: {
35143
35316
  columns: [{ table: "embeddings", column: "vector", optional: true }]
35144
35317
  }
@@ -35146,7 +35319,7 @@ var MIGRATIONS2 = [
35146
35319
  {
35147
35320
  version: 33,
35148
35321
  name: "scope",
35149
- up: up332,
35322
+ up: up342,
35150
35323
  artifacts: {
35151
35324
  columns: [{ table: "memories", column: "scope" }]
35152
35325
  }
@@ -35154,17 +35327,17 @@ var MIGRATIONS2 = [
35154
35327
  {
35155
35328
  version: 34,
35156
35329
  name: "scope-aware-dedup",
35157
- up: up342
35330
+ up: up352
35158
35331
  },
35159
35332
  {
35160
35333
  version: 35,
35161
35334
  name: "entity-fts",
35162
- up: up352
35335
+ up: up362
35163
35336
  },
35164
35337
  {
35165
35338
  version: 36,
35166
35339
  name: "dependency-confidence",
35167
- up: up362,
35340
+ up: up372,
35168
35341
  artifacts: {
35169
35342
  columns: [{ table: "entity_dependencies", column: "confidence" }]
35170
35343
  }
@@ -35172,7 +35345,7 @@ var MIGRATIONS2 = [
35172
35345
  {
35173
35346
  version: 37,
35174
35347
  name: "entity-communities",
35175
- up: up372,
35348
+ up: up382,
35176
35349
  artifacts: {
35177
35350
  tables: ["entity_communities"],
35178
35351
  columns: [{ table: "entities", column: "community_id" }]
@@ -35181,24 +35354,24 @@ var MIGRATIONS2 = [
35181
35354
  {
35182
35355
  version: 38,
35183
35356
  name: "memory-hints",
35184
- up: up382,
35357
+ up: up392,
35185
35358
  artifacts: { tables: ["memory_hints"] }
35186
35359
  },
35187
35360
  {
35188
35361
  version: 39,
35189
35362
  name: "dedup-entity-dependencies",
35190
- up: up392
35363
+ up: up402
35191
35364
  },
35192
35365
  {
35193
35366
  version: 40,
35194
35367
  name: "session-transcripts",
35195
- up: up402,
35368
+ up: up412,
35196
35369
  artifacts: { tables: ["session_transcripts"] }
35197
35370
  },
35198
35371
  {
35199
35372
  version: 41,
35200
35373
  name: "path-feedback",
35201
- up: up412,
35374
+ up: up422,
35202
35375
  artifacts: {
35203
35376
  tables: [
35204
35377
  "path_feedback_events",
@@ -35213,7 +35386,7 @@ var MIGRATIONS2 = [
35213
35386
  {
35214
35387
  version: 42,
35215
35388
  name: "session-memories-agent-id",
35216
- up: up422,
35389
+ up: up432,
35217
35390
  artifacts: {
35218
35391
  columns: [{ table: "session_memories", column: "agent_id" }]
35219
35392
  }
@@ -35221,7 +35394,7 @@ var MIGRATIONS2 = [
35221
35394
  {
35222
35395
  version: 43,
35223
35396
  name: "agents-table",
35224
- up: up432,
35397
+ up: up442,
35225
35398
  artifacts: {
35226
35399
  tables: ["agents"],
35227
35400
  columns: [
@@ -35233,7 +35406,7 @@ var MIGRATIONS2 = [
35233
35406
  {
35234
35407
  version: 44,
35235
35408
  name: "memory-md-temporal-head",
35236
- up: up442,
35409
+ up: up452,
35237
35410
  artifacts: {
35238
35411
  columns: [
35239
35412
  { table: "session_summaries", column: "source_type" },
@@ -35245,7 +35418,7 @@ var MIGRATIONS2 = [
35245
35418
  {
35246
35419
  version: 45,
35247
35420
  name: "lossless-working-memory-hardening",
35248
- up: up452,
35421
+ up: up462,
35249
35422
  artifacts: {
35250
35423
  tables: ["session_transcripts_fts", "memory_md_heads"],
35251
35424
  columns: [
@@ -35258,17 +35431,17 @@ var MIGRATIONS2 = [
35258
35431
  {
35259
35432
  version: 46,
35260
35433
  name: "session-summary-uniqueness",
35261
- up: up462
35434
+ up: up472
35262
35435
  },
35263
35436
  {
35264
35437
  version: 47,
35265
35438
  name: "agent-scoped-temporal-uniqueness",
35266
- up: up472
35439
+ up: up482
35267
35440
  },
35268
35441
  {
35269
35442
  version: 48,
35270
35443
  name: "thread-heads",
35271
- up: up482,
35444
+ up: up492,
35272
35445
  artifacts: {
35273
35446
  tables: ["memory_thread_heads"]
35274
35447
  }
@@ -35276,7 +35449,7 @@ var MIGRATIONS2 = [
35276
35449
  {
35277
35450
  version: 49,
35278
35451
  name: "session-extract-cursors",
35279
- up: up492,
35452
+ up: up502,
35280
35453
  artifacts: {
35281
35454
  tables: ["session_extract_cursors"]
35282
35455
  }
@@ -35284,7 +35457,7 @@ var MIGRATIONS2 = [
35284
35457
  {
35285
35458
  version: 50,
35286
35459
  name: "related-to-audit",
35287
- up: up502,
35460
+ up: up512,
35288
35461
  artifacts: {
35289
35462
  tables: ["entity_dependency_history"]
35290
35463
  }
@@ -35292,7 +35465,7 @@ var MIGRATIONS2 = [
35292
35465
  {
35293
35466
  version: 51,
35294
35467
  name: "memory-md-rolling-window-lineage",
35295
- up: up512,
35468
+ up: up522,
35296
35469
  artifacts: {
35297
35470
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
35298
35471
  columns: [
@@ -35307,7 +35480,7 @@ var MIGRATIONS2 = [
35307
35480
  {
35308
35481
  version: 52,
35309
35482
  name: "mcp-invocations",
35310
- up: up522,
35483
+ up: up532,
35311
35484
  artifacts: {
35312
35485
  tables: ["mcp_invocations"]
35313
35486
  }
@@ -35315,7 +35488,7 @@ var MIGRATIONS2 = [
35315
35488
  {
35316
35489
  version: 53,
35317
35490
  name: "skill-invocations",
35318
- up: up532,
35491
+ up: up542,
35319
35492
  artifacts: {
35320
35493
  tables: ["skill_invocations"]
35321
35494
  }
@@ -35323,7 +35496,7 @@ var MIGRATIONS2 = [
35323
35496
  {
35324
35497
  version: 54,
35325
35498
  name: "task-agent-scope",
35326
- up: up542,
35499
+ up: up552,
35327
35500
  artifacts: {
35328
35501
  tables: ["task_scope_hints"]
35329
35502
  }
@@ -35331,7 +35504,7 @@ var MIGRATIONS2 = [
35331
35504
  {
35332
35505
  version: 55,
35333
35506
  name: "dreaming-state",
35334
- up: up552,
35507
+ up: up562,
35335
35508
  artifacts: {
35336
35509
  tables: ["dreaming_state", "dreaming_passes"]
35337
35510
  }
@@ -35339,22 +35512,22 @@ var MIGRATIONS2 = [
35339
35512
  {
35340
35513
  version: 56,
35341
35514
  name: "agent-scoped-content-hash",
35342
- up: up562
35515
+ up: up572
35343
35516
  },
35344
35517
  {
35345
35518
  version: 57,
35346
35519
  name: "memories-fts-tokenizer-repair",
35347
- up: up572
35520
+ up: up582
35348
35521
  },
35349
35522
  {
35350
35523
  version: 58,
35351
35524
  name: "knowledge-graph-indices",
35352
- up: up582
35525
+ up: up592
35353
35526
  },
35354
35527
  {
35355
35528
  version: 59,
35356
35529
  name: "entity-attribute-claim-key",
35357
- up: up592,
35530
+ up: up602,
35358
35531
  artifacts: {
35359
35532
  columns: [{ table: "entity_attributes", column: "claim_key" }]
35360
35533
  }
@@ -35362,7 +35535,7 @@ var MIGRATIONS2 = [
35362
35535
  {
35363
35536
  version: 60,
35364
35537
  name: "entity-attribute-group-key",
35365
- up: up602,
35538
+ up: up612,
35366
35539
  artifacts: {
35367
35540
  columns: [{ table: "entity_attributes", column: "group_key" }]
35368
35541
  }
@@ -35370,7 +35543,7 @@ var MIGRATIONS2 = [
35370
35543
  {
35371
35544
  version: 61,
35372
35545
  name: "memory-artifact-source-mtime",
35373
- up: up612,
35546
+ up: up622,
35374
35547
  artifacts: {
35375
35548
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
35376
35549
  }
@@ -35378,7 +35551,7 @@ var MIGRATIONS2 = [
35378
35551
  {
35379
35552
  version: 62,
35380
35553
  name: "memory-artifact-soft-delete",
35381
- up: up622,
35554
+ up: up632,
35382
35555
  artifacts: {
35383
35556
  columns: [
35384
35557
  { table: "memory_artifacts", column: "is_deleted" },
@@ -35389,12 +35562,12 @@ var MIGRATIONS2 = [
35389
35562
  {
35390
35563
  version: 63,
35391
35564
  name: "content-only-memories-fts-update",
35392
- up: up632
35565
+ up: up642
35393
35566
  },
35394
35567
  {
35395
35568
  version: 64,
35396
35569
  name: "source-graph-provenance",
35397
- up: up642,
35570
+ up: up652,
35398
35571
  artifacts: {
35399
35572
  columns: [
35400
35573
  { table: "entities", column: "source_path" },
@@ -35407,7 +35580,7 @@ var MIGRATIONS2 = [
35407
35580
  {
35408
35581
  version: 65,
35409
35582
  name: "source-embedding-agent-scope",
35410
- up: up652,
35583
+ up: up662,
35411
35584
  artifacts: {
35412
35585
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
35413
35586
  }
@@ -35415,7 +35588,7 @@ var MIGRATIONS2 = [
35415
35588
  {
35416
35589
  version: 66,
35417
35590
  name: "memory-search-telemetry",
35418
- up: up662,
35591
+ up: up672,
35419
35592
  artifacts: {
35420
35593
  tables: ["memory_search_telemetry"]
35421
35594
  }
@@ -35423,7 +35596,7 @@ var MIGRATIONS2 = [
35423
35596
  {
35424
35597
  version: 67,
35425
35598
  name: "ontology-proposals",
35426
- up: up672,
35599
+ up: up682,
35427
35600
  artifacts: {
35428
35601
  tables: ["ontology_proposals"],
35429
35602
  columns: [
@@ -35437,7 +35610,7 @@ var MIGRATIONS2 = [
35437
35610
  {
35438
35611
  version: 68,
35439
35612
  name: "daily-reflections",
35440
- up: up682,
35613
+ up: up692,
35441
35614
  artifacts: {
35442
35615
  tables: ["daily_reflections"]
35443
35616
  }
@@ -35445,7 +35618,7 @@ var MIGRATIONS2 = [
35445
35618
  {
35446
35619
  version: 69,
35447
35620
  name: "daily-reflections-multiple-insights",
35448
- up: up692,
35621
+ up: up702,
35449
35622
  artifacts: {
35450
35623
  tables: ["daily_reflections"]
35451
35624
  }
@@ -35453,7 +35626,7 @@ var MIGRATIONS2 = [
35453
35626
  {
35454
35627
  version: 70,
35455
35628
  name: "ontology-control-plane-state",
35456
- up: up702,
35629
+ up: up712,
35457
35630
  artifacts: {
35458
35631
  columns: [
35459
35632
  { table: "entities", column: "status" },
@@ -35468,7 +35641,7 @@ var MIGRATIONS2 = [
35468
35641
  {
35469
35642
  version: 71,
35470
35643
  name: "epistemic-assertions",
35471
- up: up712,
35644
+ up: up722,
35472
35645
  artifacts: {
35473
35646
  tables: ["epistemic_assertions"]
35474
35647
  }
@@ -35476,7 +35649,7 @@ var MIGRATIONS2 = [
35476
35649
  {
35477
35650
  version: 72,
35478
35651
  name: "agent-scoped-idempotency-key",
35479
- up: up722,
35652
+ up: up732,
35480
35653
  artifacts: {
35481
35654
  columns: [
35482
35655
  { table: "memories", column: "idempotency_key" },
@@ -35487,7 +35660,7 @@ var MIGRATIONS2 = [
35487
35660
  {
35488
35661
  version: 73,
35489
35662
  name: "recall-context-dedupe",
35490
- up: up732,
35663
+ up: up742,
35491
35664
  artifacts: {
35492
35665
  tables: ["session_context_epochs", "session_recall_events"]
35493
35666
  }
@@ -35495,7 +35668,7 @@ var MIGRATIONS2 = [
35495
35668
  {
35496
35669
  version: 74,
35497
35670
  name: "aggregate-memory-links",
35498
- up: up742,
35671
+ up: up752,
35499
35672
  artifacts: {
35500
35673
  tables: ["aggregate_memory_sources"]
35501
35674
  }
@@ -35503,7 +35676,7 @@ var MIGRATIONS2 = [
35503
35676
  {
35504
35677
  version: 75,
35505
35678
  name: "memory-artifact-source-provenance",
35506
- up: up752,
35679
+ up: up762,
35507
35680
  artifacts: {
35508
35681
  columns: [
35509
35682
  { table: "memory_artifacts", column: "source_id" },
@@ -35517,7 +35690,7 @@ var MIGRATIONS2 = [
35517
35690
  {
35518
35691
  version: 76,
35519
35692
  name: "temporal-edges",
35520
- up: up762,
35693
+ up: up772,
35521
35694
  artifacts: {
35522
35695
  tables: ["temporal_edges"]
35523
35696
  }
@@ -35525,7 +35698,7 @@ var MIGRATIONS2 = [
35525
35698
  {
35526
35699
  version: 77,
35527
35700
  name: "entity-aliases",
35528
- up: up772,
35701
+ up: up782,
35529
35702
  artifacts: {
35530
35703
  tables: ["entity_aliases"]
35531
35704
  }
@@ -35533,7 +35706,7 @@ var MIGRATIONS2 = [
35533
35706
  {
35534
35707
  version: 78,
35535
35708
  name: "api-keys",
35536
- up: up782,
35709
+ up: up792,
35537
35710
  artifacts: {
35538
35711
  tables: ["api_keys"]
35539
35712
  }
@@ -35541,7 +35714,7 @@ var MIGRATIONS2 = [
35541
35714
  {
35542
35715
  version: 79,
35543
35716
  name: "transcript-capture-jobs",
35544
- up: up792,
35717
+ up: up802,
35545
35718
  artifacts: {
35546
35719
  tables: ["transcript_capture_jobs"]
35547
35720
  }
@@ -35549,7 +35722,7 @@ var MIGRATIONS2 = [
35549
35722
  {
35550
35723
  version: 80,
35551
35724
  name: "document-scope-columns",
35552
- up: up802,
35725
+ up: up812,
35553
35726
  artifacts: {
35554
35727
  columns: [
35555
35728
  { table: "documents", column: "agent_id" },
@@ -35560,7 +35733,7 @@ var MIGRATIONS2 = [
35560
35733
  {
35561
35734
  version: 81,
35562
35735
  name: "aggregate-evidence-sources",
35563
- up: up812,
35736
+ up: up822,
35564
35737
  artifacts: {
35565
35738
  tables: ["aggregate_evidence_sources"]
35566
35739
  }
@@ -35568,7 +35741,7 @@ var MIGRATIONS2 = [
35568
35741
  {
35569
35742
  version: 82,
35570
35743
  name: "skill-invocations-harness",
35571
- up: up822,
35744
+ up: up832,
35572
35745
  artifacts: {
35573
35746
  columns: [
35574
35747
  { table: "skill_invocations", column: "harness" },
@@ -35579,7 +35752,7 @@ var MIGRATIONS2 = [
35579
35752
  {
35580
35753
  version: 83,
35581
35754
  name: "memory-lifecycle-repair",
35582
- up: up832,
35755
+ up: up842,
35583
35756
  artifacts: {
35584
35757
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
35585
35758
  columns: [
@@ -35594,7 +35767,7 @@ var MIGRATIONS2 = [
35594
35767
  {
35595
35768
  version: 84,
35596
35769
  name: "legacy-markdown-import-state",
35597
- up: up842,
35770
+ up: up852,
35598
35771
  artifacts: {
35599
35772
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
35600
35773
  }
@@ -35602,7 +35775,7 @@ var MIGRATIONS2 = [
35602
35775
  {
35603
35776
  version: 85,
35604
35777
  name: "backfill-relations-to-dependencies",
35605
- up: up852,
35778
+ up: up862,
35606
35779
  artifacts: {
35607
35780
  tables: ["entity_dependencies"]
35608
35781
  }
@@ -35610,7 +35783,7 @@ var MIGRATIONS2 = [
35610
35783
  {
35611
35784
  version: 86,
35612
35785
  name: "summary-jobs-content-hash",
35613
- up: up862,
35786
+ up: up872,
35614
35787
  artifacts: {
35615
35788
  columns: [{ table: "summary_jobs", column: "content_hash" }]
35616
35789
  }
@@ -35618,7 +35791,7 @@ var MIGRATIONS2 = [
35618
35791
  {
35619
35792
  version: 87,
35620
35793
  name: "summary-jobs-boundary-reason",
35621
- up: up872,
35794
+ up: up882,
35622
35795
  artifacts: {
35623
35796
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
35624
35797
  }
@@ -35626,7 +35799,7 @@ var MIGRATIONS2 = [
35626
35799
  {
35627
35800
  version: 88,
35628
35801
  name: "transcript-recovery-files",
35629
- up: up882,
35802
+ up: up892,
35630
35803
  artifacts: {
35631
35804
  tables: ["transcript_recovery_files"]
35632
35805
  }
@@ -35634,7 +35807,7 @@ var MIGRATIONS2 = [
35634
35807
  {
35635
35808
  version: 89,
35636
35809
  name: "job-cancellations",
35637
- up: up892,
35810
+ up: up902,
35638
35811
  artifacts: {
35639
35812
  tables: ["job_cancellations"]
35640
35813
  }
@@ -35642,7 +35815,7 @@ var MIGRATIONS2 = [
35642
35815
  {
35643
35816
  version: 90,
35644
35817
  name: "job-archive",
35645
- up: up902,
35818
+ up: up912,
35646
35819
  artifacts: {
35647
35820
  tables: ["job_archive"]
35648
35821
  }
@@ -35650,25 +35823,25 @@ var MIGRATIONS2 = [
35650
35823
  {
35651
35824
  version: 91,
35652
35825
  name: "embedding-index-generations",
35653
- up: up912,
35826
+ up: up922,
35654
35827
  artifacts: { tables: ["embedding_index_state"] }
35655
35828
  },
35656
35829
  {
35657
35830
  version: 92,
35658
35831
  name: "embedding-staging-store",
35659
- up: up922,
35832
+ up: up932,
35660
35833
  artifacts: { tables: ["embeddings_staging"] }
35661
35834
  },
35662
35835
  {
35663
35836
  version: 93,
35664
35837
  name: "dreaming-evidence-cursor",
35665
- up: up932,
35838
+ up: up942,
35666
35839
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
35667
35840
  },
35668
35841
  {
35669
35842
  version: 94,
35670
35843
  name: "memory-kind",
35671
- up: up942,
35844
+ up: up952,
35672
35845
  artifacts: {
35673
35846
  columns: [
35674
35847
  { table: "memories", column: "memory_kind" },
@@ -35679,35 +35852,35 @@ var MIGRATIONS2 = [
35679
35852
  {
35680
35853
  version: 95,
35681
35854
  name: "compaction-recall-projections",
35682
- up: up952
35855
+ up: up962
35683
35856
  },
35684
35857
  {
35685
35858
  version: 96,
35686
35859
  name: "retire-legacy-ingestion",
35687
- up: up962
35860
+ up: up972
35688
35861
  },
35689
35862
  {
35690
35863
  version: 97,
35691
35864
  name: "dreaming-failure-backoff",
35692
- up: up972,
35865
+ up: up982,
35693
35866
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
35694
35867
  },
35695
35868
  {
35696
35869
  version: 98,
35697
35870
  name: "dreaming-evidence-exclusions",
35698
- up: up982,
35871
+ up: up992,
35699
35872
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
35700
35873
  },
35701
35874
  {
35702
35875
  version: 99,
35703
35876
  name: "dreaming-tool-calls",
35704
- up: up992,
35877
+ up: up1002,
35705
35878
  artifacts: { tables: ["dreaming_tool_calls"] }
35706
35879
  },
35707
35880
  {
35708
35881
  version: 100,
35709
35882
  name: "dreaming-runbook",
35710
- up: up1002,
35883
+ up: up1012,
35711
35884
  artifacts: {
35712
35885
  columns: [
35713
35886
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -35718,23 +35891,23 @@ var MIGRATIONS2 = [
35718
35891
  {
35719
35892
  version: 101,
35720
35893
  name: "dreaming-attention",
35721
- up: up1012,
35894
+ up: up1022,
35722
35895
  artifacts: { tables: ["dreaming_attention"] }
35723
35896
  },
35724
35897
  {
35725
35898
  version: 102,
35726
35899
  name: "attribute-semantic-memories",
35727
- up: up1022
35900
+ up: up1032
35728
35901
  },
35729
35902
  {
35730
35903
  version: 103,
35731
35904
  name: "semantic-memory-kind",
35732
- up: up1032
35905
+ up: up1042
35733
35906
  },
35734
35907
  {
35735
35908
  version: 104,
35736
35909
  name: "derived-memory-provenance",
35737
- up: up1042,
35910
+ up: up1052,
35738
35911
  artifacts: {
35739
35912
  tables: ["derived_memory_sources"],
35740
35913
  columns: [{ table: "memories", column: "stale_at" }]
@@ -35743,12 +35916,12 @@ var MIGRATIONS2 = [
35743
35916
  {
35744
35917
  version: 105,
35745
35918
  name: "agent-scoped-entity-name",
35746
- up: up1052
35919
+ up: up1062
35747
35920
  },
35748
35921
  {
35749
35922
  version: 106,
35750
35923
  name: "memory-review-after",
35751
- up: up1062,
35924
+ up: up1072,
35752
35925
  artifacts: {
35753
35926
  columns: [{ table: "memories", column: "review_after" }]
35754
35927
  }
@@ -35756,7 +35929,7 @@ var MIGRATIONS2 = [
35756
35929
  {
35757
35930
  version: 107,
35758
35931
  name: "dreaming-pass-usage",
35759
- up: up1072,
35932
+ up: up1082,
35760
35933
  artifacts: {
35761
35934
  columns: [
35762
35935
  { table: "dreaming_passes", column: "tokens_input" },
@@ -35770,7 +35943,7 @@ var MIGRATIONS2 = [
35770
35943
  {
35771
35944
  version: 108,
35772
35945
  name: "embedding-usage",
35773
- up: up1082,
35946
+ up: up1092,
35774
35947
  artifacts: {
35775
35948
  tables: ["embedding_usage"]
35776
35949
  }
@@ -35778,7 +35951,7 @@ var MIGRATIONS2 = [
35778
35951
  {
35779
35952
  version: 109,
35780
35953
  name: "telemetry-install",
35781
- up: up1092,
35954
+ up: up1102,
35782
35955
  artifacts: {
35783
35956
  tables: ["telemetry_install"]
35784
35957
  }
@@ -35786,12 +35959,12 @@ var MIGRATIONS2 = [
35786
35959
  {
35787
35960
  version: 110,
35788
35961
  name: "memory-mention-join-index",
35789
- up: up1102
35962
+ up: up1112
35790
35963
  },
35791
35964
  {
35792
35965
  version: 111,
35793
35966
  name: "telemetry-first-use",
35794
- up: up1112,
35967
+ up: up1122,
35795
35968
  artifacts: {
35796
35969
  columns: [
35797
35970
  { table: "telemetry_install", column: "first_remember_at" },
@@ -35802,7 +35975,7 @@ var MIGRATIONS2 = [
35802
35975
  {
35803
35976
  version: 112,
35804
35977
  name: "telemetry-queue-ownership",
35805
- up: up1122,
35978
+ up: up1132,
35806
35979
  artifacts: {
35807
35980
  columns: [
35808
35981
  { table: "telemetry_events", column: "source" },
@@ -35814,7 +35987,7 @@ var MIGRATIONS2 = [
35814
35987
  {
35815
35988
  version: 113,
35816
35989
  name: "session-claims",
35817
- up: up1132,
35990
+ up: up1142,
35818
35991
  artifacts: {
35819
35992
  tables: ["session_claims"],
35820
35993
  columns: [
@@ -35828,12 +36001,12 @@ var MIGRATIONS2 = [
35828
36001
  {
35829
36002
  version: 114,
35830
36003
  name: "memory-traversal-hydration-index",
35831
- up: up1142
36004
+ up: up1152
35832
36005
  },
35833
36006
  {
35834
36007
  version: 115,
35835
36008
  name: "cross-agent-message-notifications",
35836
- up: up1152,
36009
+ up: up1162,
35837
36010
  artifacts: {
35838
36011
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
35839
36012
  }
@@ -35841,7 +36014,7 @@ var MIGRATIONS2 = [
35841
36014
  {
35842
36015
  version: 116,
35843
36016
  name: "acp-delivery-reconciliation",
35844
- up: up1162,
36017
+ up: up1172,
35845
36018
  artifacts: {
35846
36019
  columns: [
35847
36020
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -35855,7 +36028,7 @@ var MIGRATIONS2 = [
35855
36028
  {
35856
36029
  version: 117,
35857
36030
  name: "retire-summary-worker",
35858
- up: up1172,
36031
+ up: up1182,
35859
36032
  artifacts: {
35860
36033
  columns: [
35861
36034
  { table: "session_transcripts", column: "completed_at" },
@@ -35866,24 +36039,24 @@ var MIGRATIONS2 = [
35866
36039
  {
35867
36040
  version: 118,
35868
36041
  name: "queue-pressure-indices",
35869
- up: up1182
36042
+ up: up1192
35870
36043
  },
35871
36044
  {
35872
36045
  version: 119,
35873
36046
  name: "telemetry-version-observation",
35874
- up: up1192,
36047
+ up: up1202,
35875
36048
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
35876
36049
  },
35877
36050
  {
35878
36051
  version: 120,
35879
36052
  name: "source-lifecycle-telemetry",
35880
- up: up1202,
36053
+ up: up1212,
35881
36054
  artifacts: { tables: ["source_lifecycle_state"] }
35882
36055
  },
35883
36056
  {
35884
36057
  version: 121,
35885
36058
  name: "telemetry-delivery-health",
35886
- up: up1212,
36059
+ up: up1222,
35887
36060
  artifacts: {
35888
36061
  tables: ["telemetry_delivery_state"],
35889
36062
  columns: [
@@ -35897,7 +36070,7 @@ var MIGRATIONS2 = [
35897
36070
  {
35898
36071
  version: 122,
35899
36072
  name: "dreaming-evidence-retry",
35900
- up: up1222,
36073
+ up: up1232,
35901
36074
  artifacts: {
35902
36075
  columns: [
35903
36076
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -35910,13 +36083,13 @@ var MIGRATIONS2 = [
35910
36083
  {
35911
36084
  version: 123,
35912
36085
  name: "embedding-index-failures",
35913
- up: up1232,
36086
+ up: up1242,
35914
36087
  artifacts: { tables: ["embedding_index_failures"] }
35915
36088
  },
35916
36089
  {
35917
36090
  version: 124,
35918
36091
  name: "import-derived-lifecycle",
35919
- up: up1242,
36092
+ up: up1252,
35920
36093
  artifacts: {
35921
36094
  tables: ["imported_source_lifecycle"]
35922
36095
  }
@@ -35924,77 +36097,77 @@ var MIGRATIONS2 = [
35924
36097
  {
35925
36098
  version: 125,
35926
36099
  name: "memory-content-safety",
35927
- up: up1252,
36100
+ up: up1262,
35928
36101
  artifacts: { tables: ["memory_content_safety"] }
35929
36102
  },
35930
36103
  {
35931
36104
  version: 126,
35932
36105
  name: "dreaming-surprisal-attention",
35933
- up: up1262,
36106
+ up: up1272,
35934
36107
  artifacts: { tables: ["dreaming_attention"] }
35935
36108
  },
35936
36109
  {
35937
36110
  version: 127,
35938
36111
  name: "ontology-contradictions",
35939
- up: up1272,
36112
+ up: up1282,
35940
36113
  artifacts: { tables: ["ontology_contradictions"] }
35941
36114
  },
35942
36115
  {
35943
36116
  version: 128,
35944
36117
  name: "bounded-queue-diagnostics",
35945
- up: up1282
36118
+ up: up1292
35946
36119
  },
35947
36120
  {
35948
36121
  version: 129,
35949
36122
  name: "retire-structural-jobs",
35950
- up: up1292
36123
+ up: up1302
35951
36124
  },
35952
36125
  {
35953
36126
  version: 130,
35954
36127
  name: "embedding-repair-state",
35955
- up: up1302,
36128
+ up: up1312,
35956
36129
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
35957
36130
  },
35958
36131
  {
35959
36132
  version: 131,
35960
36133
  name: "dreaming-evidence-consumption",
35961
- up: up1312,
36134
+ up: up1322,
35962
36135
  artifacts: { tables: ["dreaming_evidence_consumption"] }
35963
36136
  },
35964
36137
  {
35965
36138
  version: 132,
35966
36139
  name: "observer-scoped-epistemic-assertions",
35967
- up: up1322,
36140
+ up: up1332,
35968
36141
  artifacts: { tables: ["epistemic_assertions"] }
35969
36142
  },
35970
36143
  {
35971
36144
  version: 133,
35972
36145
  name: "dreaming-memory-head",
35973
- up: up1332,
36146
+ up: up1342,
35974
36147
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
35975
36148
  },
35976
36149
  {
35977
36150
  version: 134,
35978
36151
  name: "scope-memory-head-entries",
35979
- up: up1342,
36152
+ up: up1352,
35980
36153
  artifacts: { tables: ["memory_head_entries"] }
35981
36154
  },
35982
36155
  {
35983
36156
  version: 135,
35984
36157
  name: "memory-head-publication",
35985
- up: up1352,
36158
+ up: up1362,
35986
36159
  artifacts: { tables: ["memory_head_publications"] }
35987
36160
  },
35988
36161
  {
35989
36162
  version: 136,
35990
36163
  name: "memory-head-revisions",
35991
- up: up1362,
36164
+ up: up1372,
35992
36165
  artifacts: { tables: ["memory_head_revisions"] }
35993
36166
  },
35994
36167
  {
35995
36168
  version: 137,
35996
36169
  name: "dreaming-head-manifest",
35997
- up: up1372,
36170
+ up: up1382,
35998
36171
  artifacts: {
35999
36172
  columns: [
36000
36173
  { table: "dreaming_passes", column: "head_revision" },
@@ -36005,7 +36178,7 @@ var MIGRATIONS2 = [
36005
36178
  {
36006
36179
  version: 138,
36007
36180
  name: "bounded-status-projections",
36008
- up: up1382,
36181
+ up: up1392,
36009
36182
  artifacts: {
36010
36183
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
36011
36184
  }
@@ -36013,31 +36186,31 @@ var MIGRATIONS2 = [
36013
36186
  {
36014
36187
  version: 139,
36015
36188
  name: "native-source-sync-state",
36016
- up: up1392,
36189
+ up: up1402,
36017
36190
  artifacts: { tables: ["native_source_sync_state"] }
36018
36191
  },
36019
36192
  {
36020
36193
  version: 140,
36021
36194
  name: "transcript-recovery-frontier",
36022
- up: up1402,
36195
+ up: up1412,
36023
36196
  artifacts: { tables: ["transcript_recovery_frontiers"] }
36024
36197
  },
36025
36198
  {
36026
36199
  version: 141,
36027
36200
  name: "source-sync-checkpoints",
36028
- up: up1412,
36201
+ up: up1422,
36029
36202
  artifacts: { tables: ["source_sync_checkpoints"] }
36030
36203
  },
36031
36204
  {
36032
36205
  version: 142,
36033
36206
  name: "source-sync-frontier",
36034
- up: up1422,
36207
+ up: up1432,
36035
36208
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
36036
36209
  },
36037
36210
  {
36038
36211
  version: 143,
36039
36212
  name: "embedding-index-progress",
36040
- up: up1432,
36213
+ up: up1442,
36041
36214
  artifacts: {
36042
36215
  columns: [
36043
36216
  { table: "embedding_index_state", column: "migration_phase" },
@@ -36053,19 +36226,19 @@ var MIGRATIONS2 = [
36053
36226
  {
36054
36227
  version: 144,
36055
36228
  name: "memory-job-lease-token",
36056
- up: up1442,
36229
+ up: up1452,
36057
36230
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
36058
36231
  },
36059
36232
  {
36060
36233
  version: 145,
36061
36234
  name: "dreaming-evidence-reviews",
36062
- up: up1452,
36235
+ up: up1462,
36063
36236
  artifacts: { tables: ["dreaming_evidence_reviews"] }
36064
36237
  },
36065
36238
  {
36066
36239
  version: 146,
36067
36240
  name: "source-transcript-import",
36068
- up: up1462,
36241
+ up: up1472,
36069
36242
  artifacts: {
36070
36243
  tables: [
36071
36244
  "source_import_jobs",
@@ -36084,19 +36257,19 @@ var MIGRATIONS2 = [
36084
36257
  {
36085
36258
  version: 147,
36086
36259
  name: "source-import-replay-file-slots",
36087
- up: up1472,
36260
+ up: up1482,
36088
36261
  artifacts: { tables: ["source_import_files"] }
36089
36262
  },
36090
36263
  {
36091
36264
  version: 148,
36092
36265
  name: "source-import-attempt-provenance",
36093
- up: up1482,
36266
+ up: up1492,
36094
36267
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
36095
36268
  },
36096
36269
  {
36097
36270
  version: 149,
36098
36271
  name: "transcript-import-state-machine",
36099
- up: up1492,
36272
+ up: up1502,
36100
36273
  artifacts: {
36101
36274
  columns: [
36102
36275
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -36108,13 +36281,42 @@ var MIGRATIONS2 = [
36108
36281
  {
36109
36282
  version: 150,
36110
36283
  name: "memory-head-freshness",
36111
- up: up1502,
36284
+ up: up1512,
36112
36285
  artifacts: {
36113
36286
  columns: [
36114
36287
  { table: "memory_md_heads", column: "is_current" },
36115
36288
  { table: "dreaming_passes", column: "head_base_revision" }
36116
36289
  ]
36117
36290
  }
36291
+ },
36292
+ {
36293
+ version: 151,
36294
+ name: "transcript-import-bytes",
36295
+ up: up152,
36296
+ artifacts: {
36297
+ tables: [
36298
+ "source_import_chunks",
36299
+ "source_import_capacity",
36300
+ "source_import_migrations",
36301
+ "source_import_migration_streams",
36302
+ "source_import_migration_counts"
36303
+ ],
36304
+ columns: [
36305
+ { table: "source_import_files", column: "storage_state" },
36306
+ { table: "source_import_files", column: "upload_generation" },
36307
+ { table: "source_import_files", column: "upload_offset" },
36308
+ { table: "source_import_files", column: "upload_size" },
36309
+ { table: "source_import_files", column: "upload_digest" },
36310
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
36311
+ table: "source_import_files",
36312
+ column
36313
+ })),
36314
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
36315
+ table: "source_import_jobs",
36316
+ column
36317
+ }))
36318
+ ]
36319
+ }
36118
36320
  }
36119
36321
  ];
36120
36322
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;