@signetai/connector-base 0.226.8 → 0.226.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/agent-dir.js +491 -453
  2. package/dist/index.js +491 -453
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11414,6 +11414,29 @@ function up2(db) {
11414
11414
  CREATE INDEX idx_memory_artifacts_agent_sha ON memory_artifacts(agent_id, source_sha256, COALESCE(source_id, ''), COALESCE(is_deleted, 0), captured_at DESC, source_path)
11415
11415
  `);
11416
11416
  }
11417
+ function addColumnIfMissing(db, column, definition) {
11418
+ const columns = db.prepare("PRAGMA table_info(transcript_capture_jobs)").all();
11419
+ if (columns.some((row) => row.name === column))
11420
+ return;
11421
+ db.exec(`ALTER TABLE transcript_capture_jobs ADD COLUMN ${column} ${definition}`);
11422
+ }
11423
+ function up3(db) {
11424
+ const table = db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'transcript_capture_jobs'").get();
11425
+ if (!table?.present)
11426
+ return;
11427
+ addColumnIfMissing(db, "source_identity", "TEXT");
11428
+ addColumnIfMissing(db, "source_sha256", "TEXT");
11429
+ addColumnIfMissing(db, "source_size_bytes", "INTEGER");
11430
+ addColumnIfMissing(db, "source_mtime_ms", "REAL");
11431
+ addColumnIfMissing(db, "source_format", "TEXT");
11432
+ addColumnIfMissing(db, "audit_path", "TEXT");
11433
+ db.exec(`
11434
+ CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_source_identity
11435
+ ON transcript_capture_jobs(agent_id, source_identity, status);
11436
+ CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_source_digest
11437
+ ON transcript_capture_jobs(agent_id, source_sha256);
11438
+ `);
11439
+ }
11417
11440
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11418
11441
  var FTS_STATE_TABLE = "memories_fts_state";
11419
11442
  function normalizeSql(sql) {
@@ -11529,7 +11552,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11529
11552
  return true;
11530
11553
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
11531
11554
  }
11532
- function up3(db) {
11555
+ function up4(db) {
11533
11556
  db.exec(`
11534
11557
  CREATE TABLE IF NOT EXISTS schema_migrations (
11535
11558
  version INTEGER PRIMARY KEY,
@@ -11622,27 +11645,27 @@ function hasColumn(db, table, column) {
11622
11645
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11623
11646
  return rows.some((r2) => r2.name === column);
11624
11647
  }
11625
- function addColumnIfMissing(db, table, column, definition) {
11648
+ function addColumnIfMissing2(db, table, column, definition) {
11626
11649
  if (!hasColumn(db, table, column)) {
11627
11650
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11628
11651
  }
11629
11652
  }
11630
- function up4(db) {
11631
- addColumnIfMissing(db, "memories", "content_hash", "TEXT");
11632
- addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
11633
- addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
11634
- addColumnIfMissing(db, "memories", "deleted_at", "TEXT");
11635
- addColumnIfMissing(db, "memories", "extraction_status", "TEXT DEFAULT 'none'");
11636
- addColumnIfMissing(db, "memories", "embedding_model", "TEXT");
11637
- addColumnIfMissing(db, "memories", "extraction_model", "TEXT");
11638
- addColumnIfMissing(db, "memories", "update_count", "INTEGER DEFAULT 0");
11639
- addColumnIfMissing(db, "memories", "who", "TEXT");
11640
- addColumnIfMissing(db, "memories", "why", "TEXT");
11641
- addColumnIfMissing(db, "memories", "project", "TEXT");
11642
- addColumnIfMissing(db, "memories", "pinned", "INTEGER DEFAULT 0");
11643
- addColumnIfMissing(db, "memories", "importance", "REAL DEFAULT 0.5");
11644
- addColumnIfMissing(db, "memories", "last_accessed", "TEXT");
11645
- addColumnIfMissing(db, "memories", "access_count", "INTEGER DEFAULT 0");
11653
+ function up5(db) {
11654
+ addColumnIfMissing2(db, "memories", "content_hash", "TEXT");
11655
+ addColumnIfMissing2(db, "memories", "normalized_content", "TEXT");
11656
+ addColumnIfMissing2(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
11657
+ addColumnIfMissing2(db, "memories", "deleted_at", "TEXT");
11658
+ addColumnIfMissing2(db, "memories", "extraction_status", "TEXT DEFAULT 'none'");
11659
+ addColumnIfMissing2(db, "memories", "embedding_model", "TEXT");
11660
+ addColumnIfMissing2(db, "memories", "extraction_model", "TEXT");
11661
+ addColumnIfMissing2(db, "memories", "update_count", "INTEGER DEFAULT 0");
11662
+ addColumnIfMissing2(db, "memories", "who", "TEXT");
11663
+ addColumnIfMissing2(db, "memories", "why", "TEXT");
11664
+ addColumnIfMissing2(db, "memories", "project", "TEXT");
11665
+ addColumnIfMissing2(db, "memories", "pinned", "INTEGER DEFAULT 0");
11666
+ addColumnIfMissing2(db, "memories", "importance", "REAL DEFAULT 0.5");
11667
+ addColumnIfMissing2(db, "memories", "last_accessed", "TEXT");
11668
+ addColumnIfMissing2(db, "memories", "access_count", "INTEGER DEFAULT 0");
11646
11669
  db.exec(`
11647
11670
  CREATE TABLE IF NOT EXISTS memory_history (
11648
11671
  id TEXT PRIMARY KEY,
@@ -11738,16 +11761,16 @@ function up4(db) {
11738
11761
  ON memory_entity_mentions(entity_id);
11739
11762
  `);
11740
11763
  }
11741
- function addColumnIfMissing2(db, table, column, definition) {
11764
+ function addColumnIfMissing3(db, table, column, definition) {
11742
11765
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11743
11766
  if (rows.some((r2) => r2.name === column))
11744
11767
  return false;
11745
11768
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11746
11769
  return true;
11747
11770
  }
11748
- function up5(db) {
11749
- addColumnIfMissing2(db, "memories", "why", "TEXT");
11750
- addColumnIfMissing2(db, "memories", "project", "TEXT");
11771
+ function up6(db) {
11772
+ addColumnIfMissing3(db, "memories", "why", "TEXT");
11773
+ addColumnIfMissing3(db, "memories", "project", "TEXT");
11751
11774
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
11752
11775
  db.exec(`
11753
11776
  UPDATE memories
@@ -11777,15 +11800,15 @@ function hasColumn2(db, table, column) {
11777
11800
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11778
11801
  return rows.some((r2) => r2.name === column);
11779
11802
  }
11780
- function addColumnIfMissing3(db, table, column, definition) {
11803
+ function addColumnIfMissing4(db, table, column, definition) {
11781
11804
  if (!hasColumn2(db, table, column)) {
11782
11805
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11783
11806
  }
11784
11807
  }
11785
- function up6(db) {
11786
- addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
11787
- addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
11788
- addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
11808
+ function up7(db) {
11809
+ addColumnIfMissing4(db, "memory_history", "actor_type", "TEXT");
11810
+ addColumnIfMissing4(db, "memory_history", "session_id", "TEXT");
11811
+ addColumnIfMissing4(db, "memory_history", "request_id", "TEXT");
11789
11812
  db.exec(`
11790
11813
  CREATE INDEX IF NOT EXISTS idx_memories_deleted_at
11791
11814
  ON memories(deleted_at)
@@ -11810,21 +11833,21 @@ function hasColumn3(db, table, column) {
11810
11833
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11811
11834
  return rows.some((r2) => r2.name === column);
11812
11835
  }
11813
- function addColumnIfMissing4(db, table, column, definition) {
11836
+ function addColumnIfMissing5(db, table, column, definition) {
11814
11837
  if (!hasColumn3(db, table, column)) {
11815
11838
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11816
11839
  }
11817
11840
  }
11818
- function up7(db) {
11819
- addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
11820
- addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
11821
- addColumnIfMissing4(db, "entities", "embedding", "BLOB");
11822
- addColumnIfMissing4(db, "relations", "mentions", "INTEGER DEFAULT 1");
11823
- addColumnIfMissing4(db, "relations", "confidence", "REAL DEFAULT 0.5");
11824
- addColumnIfMissing4(db, "relations", "updated_at", "TEXT");
11825
- addColumnIfMissing4(db, "memory_entity_mentions", "mention_text", "TEXT");
11826
- addColumnIfMissing4(db, "memory_entity_mentions", "confidence", "REAL");
11827
- addColumnIfMissing4(db, "memory_entity_mentions", "created_at", "TEXT");
11841
+ function up8(db) {
11842
+ addColumnIfMissing5(db, "entities", "canonical_name", "TEXT");
11843
+ addColumnIfMissing5(db, "entities", "mentions", "INTEGER DEFAULT 0");
11844
+ addColumnIfMissing5(db, "entities", "embedding", "BLOB");
11845
+ addColumnIfMissing5(db, "relations", "mentions", "INTEGER DEFAULT 1");
11846
+ addColumnIfMissing5(db, "relations", "confidence", "REAL DEFAULT 0.5");
11847
+ addColumnIfMissing5(db, "relations", "updated_at", "TEXT");
11848
+ addColumnIfMissing5(db, "memory_entity_mentions", "mention_text", "TEXT");
11849
+ addColumnIfMissing5(db, "memory_entity_mentions", "confidence", "REAL");
11850
+ addColumnIfMissing5(db, "memory_entity_mentions", "created_at", "TEXT");
11828
11851
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_canonical_name ON entities(canonical_name)");
11829
11852
  db.exec("CREATE INDEX IF NOT EXISTS idx_relations_composite ON relations(source_entity_id, relation_type)");
11830
11853
  }
@@ -11832,7 +11855,7 @@ function hasColumn4(db, table, column) {
11832
11855
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11833
11856
  return rows.some((r2) => r2.name === column);
11834
11857
  }
11835
- function up8(db) {
11858
+ function up9(db) {
11836
11859
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11837
11860
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11838
11861
  }
@@ -11847,7 +11870,7 @@ function hasColumn5(db, table, column) {
11847
11870
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11848
11871
  return rows.some((r2) => r2.name === column);
11849
11872
  }
11850
- function up9(db) {
11873
+ function up10(db) {
11851
11874
  db.exec(`
11852
11875
  CREATE TABLE IF NOT EXISTS documents (
11853
11876
  id TEXT PRIMARY KEY,
@@ -11904,7 +11927,7 @@ function up9(db) {
11904
11927
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11905
11928
  }
11906
11929
  }
11907
- function up10(db) {
11930
+ function up11(db) {
11908
11931
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11909
11932
  if (tables.length === 0)
11910
11933
  return;
@@ -11921,7 +11944,7 @@ function up10(db) {
11921
11944
  ON embeddings(content_hash)
11922
11945
  `);
11923
11946
  }
11924
- function up11(db) {
11947
+ function up12(db) {
11925
11948
  db.exec(`
11926
11949
  CREATE TABLE IF NOT EXISTS summary_jobs (
11927
11950
  id TEXT PRIMARY KEY,
@@ -11941,7 +11964,7 @@ function up11(db) {
11941
11964
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11942
11965
  ON summary_jobs(status)`);
11943
11966
  }
11944
- function up12(db) {
11967
+ function up13(db) {
11945
11968
  db.exec(`
11946
11969
  CREATE TABLE IF NOT EXISTS umap_cache (
11947
11970
  id INTEGER PRIMARY KEY,
@@ -11952,7 +11975,7 @@ function up12(db) {
11952
11975
  )
11953
11976
  `);
11954
11977
  }
11955
- function up13(db) {
11978
+ function up14(db) {
11956
11979
  db.exec(`
11957
11980
  CREATE TABLE IF NOT EXISTS session_scores (
11958
11981
  id TEXT PRIMARY KEY,
@@ -11972,7 +11995,7 @@ function up13(db) {
11972
11995
  ON session_scores(session_key);
11973
11996
  `);
11974
11997
  }
11975
- function up14(db) {
11998
+ function up15(db) {
11976
11999
  db.exec(`
11977
12000
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11978
12001
  id TEXT PRIMARY KEY,
@@ -12007,13 +12030,13 @@ function up14(db) {
12007
12030
  ON task_runs(status);
12008
12031
  `);
12009
12032
  }
12010
- function addColumnIfMissing5(db, table, column, definition) {
12033
+ function addColumnIfMissing6(db, table, column, definition) {
12011
12034
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12012
12035
  if (!cols.some((c2) => c2.name === column)) {
12013
12036
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12014
12037
  }
12015
12038
  }
12016
- function up15(db) {
12039
+ function up16(db) {
12017
12040
  db.exec(`
12018
12041
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
12019
12042
  id TEXT PRIMARY KEY,
@@ -12036,10 +12059,10 @@ function up15(db) {
12036
12059
  CREATE INDEX IF NOT EXISTS idx_ingestion_jobs_source_path
12037
12060
  ON ingestion_jobs(source_path);
12038
12061
  `);
12039
- addColumnIfMissing5(db, "memories", "source_path", "TEXT");
12040
- addColumnIfMissing5(db, "memories", "source_section", "TEXT");
12062
+ addColumnIfMissing6(db, "memories", "source_path", "TEXT");
12063
+ addColumnIfMissing6(db, "memories", "source_section", "TEXT");
12041
12064
  }
12042
- function up16(db) {
12065
+ function up17(db) {
12043
12066
  db.exec(`
12044
12067
  CREATE TABLE IF NOT EXISTS telemetry_events (
12045
12068
  id TEXT PRIMARY KEY,
@@ -12058,13 +12081,13 @@ function up16(db) {
12058
12081
  ON telemetry_events(sent_to_posthog) WHERE sent_to_posthog = 0;
12059
12082
  `);
12060
12083
  }
12061
- function addColumnIfMissing6(db, table, column, definition) {
12084
+ function addColumnIfMissing7(db, table, column, definition) {
12062
12085
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12063
12086
  if (!cols.some((c2) => c2.name === column)) {
12064
12087
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12065
12088
  }
12066
12089
  }
12067
- function up17(db) {
12090
+ function up18(db) {
12068
12091
  db.exec(`
12069
12092
  CREATE TABLE IF NOT EXISTS session_memories (
12070
12093
  id TEXT PRIMARY KEY,
@@ -12088,10 +12111,10 @@ function up17(db) {
12088
12111
  CREATE INDEX IF NOT EXISTS idx_session_memories_memory
12089
12112
  ON session_memories(memory_id);
12090
12113
  `);
12091
- addColumnIfMissing6(db, "session_scores", "confidence", "REAL");
12092
- addColumnIfMissing6(db, "session_scores", "continuity_reasoning", "TEXT");
12114
+ addColumnIfMissing7(db, "session_scores", "confidence", "REAL");
12115
+ addColumnIfMissing7(db, "session_scores", "continuity_reasoning", "TEXT");
12093
12116
  }
12094
- function up18(db) {
12117
+ function up19(db) {
12095
12118
  db.exec(`
12096
12119
  CREATE TABLE IF NOT EXISTS session_checkpoints (
12097
12120
  id TEXT PRIMARY KEY,
@@ -12113,7 +12136,7 @@ function up18(db) {
12113
12136
  ON session_checkpoints(project_normalized, created_at DESC);
12114
12137
  `);
12115
12138
  }
12116
- function up19(db) {
12139
+ function up20(db) {
12117
12140
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12118
12141
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12119
12142
  if (!colNames.has("skill_name")) {
@@ -12124,7 +12147,7 @@ function up19(db) {
12124
12147
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
12125
12148
  }
12126
12149
  }
12127
- function up20(db) {
12150
+ function up21(db) {
12128
12151
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12129
12152
  if (existing)
12130
12153
  return;
@@ -12156,7 +12179,7 @@ function up20(db) {
12156
12179
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
12157
12180
  `);
12158
12181
  }
12159
- function up21(db) {
12182
+ function up22(db) {
12160
12183
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12161
12184
  const entityColNames = new Set(entityCols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12162
12185
  if (!entityColNames.has("agent_id")) {
@@ -12235,19 +12258,19 @@ function up21(db) {
12235
12258
  CREATE INDEX IF NOT EXISTS idx_task_meta_retention ON task_meta(retention_until);
12236
12259
  `);
12237
12260
  }
12238
- function addColumnIfMissing7(db, table, column, definition) {
12261
+ function addColumnIfMissing8(db, table, column, definition) {
12239
12262
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12240
12263
  if (!cols.some((c2) => c2.name === column)) {
12241
12264
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12242
12265
  }
12243
12266
  }
12244
- function up22(db) {
12245
- addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12246
- addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12247
- addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12248
- addColumnIfMissing7(db, "session_memories", "structural_density", "INTEGER");
12249
- }
12250
12267
  function up23(db) {
12268
+ addColumnIfMissing8(db, "session_memories", "entity_slot", "INTEGER");
12269
+ addColumnIfMissing8(db, "session_memories", "aspect_slot", "INTEGER");
12270
+ addColumnIfMissing8(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12271
+ addColumnIfMissing8(db, "session_memories", "structural_density", "INTEGER");
12272
+ }
12273
+ function up24(db) {
12251
12274
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12252
12275
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12253
12276
  if (!columnNames.has("focal_entity_ids")) {
@@ -12266,31 +12289,31 @@ function up23(db) {
12266
12289
  db.exec("ALTER TABLE session_checkpoints ADD COLUMN traversal_memory_count INTEGER");
12267
12290
  }
12268
12291
  }
12269
- function addColumnIfMissing8(db, table, column, definition) {
12292
+ function addColumnIfMissing9(db, table, column, definition) {
12270
12293
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12271
12294
  if (!cols.some((c2) => c2.name === column)) {
12272
12295
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12273
12296
  }
12274
12297
  }
12275
- function up24(db) {
12276
- addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12277
- addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12298
+ function up25(db) {
12299
+ addColumnIfMissing9(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12300
+ addColumnIfMissing9(db, "entities", "pinned_at", "TEXT");
12278
12301
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12279
12302
  }
12280
- function up25(_db) {}
12281
12303
  function up26(_db) {}
12282
- function addColumnIfMissing9(db, table, column, definition) {
12304
+ function up27(_db) {}
12305
+ function addColumnIfMissing10(db, table, column, definition) {
12283
12306
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12284
12307
  if (!cols.some((c2) => c2.name === column)) {
12285
12308
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12286
12309
  }
12287
12310
  }
12288
- function up27(db) {
12289
- addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12290
- addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12311
+ function up28(db) {
12312
+ addColumnIfMissing10(db, "session_memories", "agent_relevance_score", "REAL");
12313
+ addColumnIfMissing10(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12291
12314
  }
12292
- function up28(_db) {}
12293
- function up29(db) {
12315
+ function up29(_db) {}
12316
+ function up30(db) {
12294
12317
  db.exec(`
12295
12318
  UPDATE entities
12296
12319
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12299,7 +12322,7 @@ function up29(db) {
12299
12322
  WHERE canonical_name IS NULL
12300
12323
  `);
12301
12324
  }
12302
- function up30(db) {
12325
+ function up31(db) {
12303
12326
  db.exec(`
12304
12327
  CREATE TABLE IF NOT EXISTS memories_cold (
12305
12328
  archive_id TEXT PRIMARY KEY,
@@ -12336,7 +12359,7 @@ function up30(db) {
12336
12359
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
12337
12360
  `);
12338
12361
  }
12339
- function up31(db) {
12362
+ function up32(db) {
12340
12363
  db.exec(`
12341
12364
  CREATE TABLE IF NOT EXISTS session_summaries (
12342
12365
  id TEXT PRIMARY KEY,
@@ -12381,7 +12404,7 @@ function up31(db) {
12381
12404
  WHERE session_key IS NOT NULL;
12382
12405
  `);
12383
12406
  }
12384
- function up32(db) {
12407
+ function up33(db) {
12385
12408
  db.exec(`
12386
12409
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12387
12410
  id TEXT PRIMARY KEY,
@@ -12426,7 +12449,7 @@ function up32(db) {
12426
12449
  ON memory_jobs(failed_at);
12427
12450
  `);
12428
12451
  }
12429
- function up33(db) {
12452
+ function up34(db) {
12430
12453
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12431
12454
  if (!depCols.some((c2) => c2.name === "reason")) {
12432
12455
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12436,7 +12459,7 @@ function up33(db) {
12436
12459
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
12437
12460
  }
12438
12461
  }
12439
- function up34(db) {
12462
+ function up35(db) {
12440
12463
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12441
12464
  if (cols.length === 0)
12442
12465
  return;
@@ -12444,14 +12467,14 @@ function up34(db) {
12444
12467
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
12445
12468
  }
12446
12469
  }
12447
- function up35(db) {
12470
+ function up36(db) {
12448
12471
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12449
12472
  if (!cols.some((c2) => c2.name === "scope")) {
12450
12473
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
12451
12474
  }
12452
12475
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
12453
12476
  }
12454
- function up36(db) {
12477
+ function up37(db) {
12455
12478
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12456
12479
  db.exec(`
12457
12480
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12459,7 +12482,7 @@ function up36(db) {
12459
12482
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12460
12483
  `);
12461
12484
  }
12462
- function up37(db) {
12485
+ function up38(db) {
12463
12486
  db.exec(`
12464
12487
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12465
12488
  name, canonical_name,
@@ -12491,13 +12514,13 @@ function up37(db) {
12491
12514
  END
12492
12515
  `);
12493
12516
  }
12494
- function up38(db) {
12517
+ function up39(db) {
12495
12518
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12496
12519
  if (!cols.some((c2) => c2.name === "confidence")) {
12497
12520
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
12498
12521
  }
12499
12522
  }
12500
- function up39(db) {
12523
+ function up40(db) {
12501
12524
  db.exec(`
12502
12525
  CREATE TABLE IF NOT EXISTS entity_communities (
12503
12526
  id TEXT PRIMARY KEY,
@@ -12515,7 +12538,7 @@ function up39(db) {
12515
12538
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
12516
12539
  }
12517
12540
  }
12518
- function up40(db) {
12541
+ function up41(db) {
12519
12542
  db.exec(`
12520
12543
  CREATE TABLE IF NOT EXISTS memory_hints (
12521
12544
  id TEXT PRIMARY KEY,
@@ -12555,7 +12578,7 @@ function up40(db) {
12555
12578
  END
12556
12579
  `);
12557
12580
  }
12558
- function up41(db) {
12581
+ function up42(db) {
12559
12582
  db.exec(`
12560
12583
  DELETE FROM entity_dependencies
12561
12584
  WHERE id NOT IN (
@@ -12573,7 +12596,7 @@ function up41(db) {
12573
12596
  )
12574
12597
  `);
12575
12598
  }
12576
- function up42(db) {
12599
+ function up43(db) {
12577
12600
  db.exec(`
12578
12601
  CREATE TABLE IF NOT EXISTS session_transcripts (
12579
12602
  session_key TEXT PRIMARY KEY,
@@ -12590,14 +12613,14 @@ function up42(db) {
12590
12613
  ON session_transcripts(created_at);
12591
12614
  `);
12592
12615
  }
12593
- function addColumnIfMissing10(db, table, column, definition) {
12616
+ function addColumnIfMissing11(db, table, column, definition) {
12594
12617
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12595
12618
  if (!cols.some((c2) => c2.name === column)) {
12596
12619
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12597
12620
  }
12598
12621
  }
12599
- function up43(db) {
12600
- addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
12622
+ function up44(db) {
12623
+ addColumnIfMissing11(db, "session_memories", "path_json", "TEXT");
12601
12624
  db.exec(`
12602
12625
  CREATE TABLE IF NOT EXISTS path_feedback_events (
12603
12626
  id TEXT PRIMARY KEY,
@@ -12665,21 +12688,21 @@ function up43(db) {
12665
12688
  );
12666
12689
  `);
12667
12690
  }
12668
- function addColumnIfMissing11(db, table, column, definition) {
12691
+ function addColumnIfMissing12(db, table, column, definition) {
12669
12692
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12670
12693
  if (cols.some((col) => col.name === column))
12671
12694
  return;
12672
12695
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12673
12696
  }
12674
- function up44(db) {
12675
- addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
12676
- addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
12677
- addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12678
- addColumnIfMissing11(db, "session_memories", "structural_density", "INTEGER");
12679
- addColumnIfMissing11(db, "session_memories", "predictor_rank", "INTEGER");
12680
- addColumnIfMissing11(db, "session_memories", "agent_relevance_score", "REAL");
12681
- addColumnIfMissing11(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12682
- addColumnIfMissing11(db, "session_memories", "path_json", "TEXT");
12697
+ function up45(db) {
12698
+ addColumnIfMissing12(db, "session_memories", "entity_slot", "INTEGER");
12699
+ addColumnIfMissing12(db, "session_memories", "aspect_slot", "INTEGER");
12700
+ addColumnIfMissing12(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12701
+ addColumnIfMissing12(db, "session_memories", "structural_density", "INTEGER");
12702
+ addColumnIfMissing12(db, "session_memories", "predictor_rank", "INTEGER");
12703
+ addColumnIfMissing12(db, "session_memories", "agent_relevance_score", "REAL");
12704
+ addColumnIfMissing12(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12705
+ addColumnIfMissing12(db, "session_memories", "path_json", "TEXT");
12683
12706
  const cols = db.prepare("PRAGMA table_info(session_memories)").all();
12684
12707
  const hasAgent = cols.some((col) => col.name === "agent_id");
12685
12708
  const agentExpr = hasAgent ? "COALESCE(NULLIF(agent_id, ''), 'default')" : "'default'";
@@ -12753,13 +12776,13 @@ function up44(db) {
12753
12776
  ON session_memories(agent_id, session_key);
12754
12777
  `);
12755
12778
  }
12756
- function addColumnIfMissing12(db, table, column, definition) {
12779
+ function addColumnIfMissing13(db, table, column, definition) {
12757
12780
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12758
12781
  if (cols.some((c2) => c2.name === column))
12759
12782
  return;
12760
12783
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12761
12784
  }
12762
- function up45(db) {
12785
+ function up46(db) {
12763
12786
  db.exec(`
12764
12787
  CREATE TABLE IF NOT EXISTS agents (
12765
12788
  id TEXT PRIMARY KEY,
@@ -12773,8 +12796,8 @@ function up45(db) {
12773
12796
  const now = new Date().toISOString();
12774
12797
  db.prepare(`INSERT OR IGNORE INTO agents (id, name, read_policy, created_at, updated_at)
12775
12798
  VALUES ('default', 'default', 'shared', ?, ?)`).run(now, now);
12776
- addColumnIfMissing12(db, "memories", "agent_id", "TEXT DEFAULT 'default'");
12777
- addColumnIfMissing12(db, "memories", "visibility", "TEXT DEFAULT 'global'");
12799
+ addColumnIfMissing13(db, "memories", "agent_id", "TEXT DEFAULT 'default'");
12800
+ addColumnIfMissing13(db, "memories", "visibility", "TEXT DEFAULT 'global'");
12778
12801
  db.exec(`
12779
12802
  CREATE INDEX IF NOT EXISTS idx_memories_agent_id
12780
12803
  ON memories(agent_id);
@@ -12782,16 +12805,16 @@ function up45(db) {
12782
12805
  ON memories(agent_id, visibility);
12783
12806
  `);
12784
12807
  }
12785
- function addColumnIfMissing13(db, table, column, definition) {
12808
+ function addColumnIfMissing14(db, table, column, definition) {
12786
12809
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12787
12810
  if (cols.some((c2) => c2.name === column))
12788
12811
  return;
12789
12812
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12790
12813
  }
12791
- function up46(db) {
12792
- addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
12793
- addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
12794
- addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
12814
+ function up47(db) {
12815
+ addColumnIfMissing14(db, "session_summaries", "source_type", "TEXT");
12816
+ addColumnIfMissing14(db, "session_summaries", "source_ref", "TEXT");
12817
+ addColumnIfMissing14(db, "session_summaries", "meta_json", "TEXT");
12795
12818
  db.exec(`
12796
12819
  UPDATE session_summaries
12797
12820
  SET source_type = CASE
@@ -12808,16 +12831,16 @@ function up46(db) {
12808
12831
  ON session_summaries(source_ref);
12809
12832
  `);
12810
12833
  }
12811
- function addColumnIfMissing14(db, table, column, definition) {
12834
+ function addColumnIfMissing15(db, table, column, definition) {
12812
12835
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12813
12836
  if (cols.some((col) => col.name === column))
12814
12837
  return;
12815
12838
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12816
12839
  }
12817
- function up47(db) {
12818
- addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
12819
- addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12820
- addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12840
+ function up48(db) {
12841
+ addColumnIfMissing15(db, "session_transcripts", "updated_at", "TEXT");
12842
+ addColumnIfMissing15(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12843
+ addColumnIfMissing15(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12821
12844
  db.exec(`
12822
12845
  UPDATE session_transcripts
12823
12846
  SET updated_at = COALESCE(updated_at, created_at)
@@ -12885,7 +12908,7 @@ function up47(db) {
12885
12908
  ON memory_md_heads(lease_expires_at);
12886
12909
  `);
12887
12910
  }
12888
- function up48(db) {
12911
+ function up49(db) {
12889
12912
  db.exec(`
12890
12913
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12891
12914
 
@@ -12946,7 +12969,7 @@ function up48(db) {
12946
12969
  AND COALESCE(source_type, 'summary') = 'summary';
12947
12970
  `);
12948
12971
  }
12949
- function up49(db) {
12972
+ function up50(db) {
12950
12973
  db.exec(`
12951
12974
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12952
12975
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -13044,7 +13067,7 @@ function up49(db) {
13044
13067
  AND COALESCE(source_type, 'summary') = 'summary';
13045
13068
  `);
13046
13069
  }
13047
- function up50(db) {
13070
+ function up51(db) {
13048
13071
  db.exec(`
13049
13072
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
13050
13073
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13162,7 +13185,7 @@ function up50(db) {
13162
13185
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
13163
13186
  `);
13164
13187
  }
13165
- function up51(db) {
13188
+ function up52(db) {
13166
13189
  db.exec(`
13167
13190
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13168
13191
  session_key TEXT NOT NULL,
@@ -13179,7 +13202,7 @@ function hasTable(db, name) {
13179
13202
  WHERE type = 'table' AND name = ?
13180
13203
  LIMIT 1`).get(name) !== undefined;
13181
13204
  }
13182
- function up52(db) {
13205
+ function up53(db) {
13183
13206
  db.exec(`
13184
13207
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13185
13208
  id TEXT PRIMARY KEY,
@@ -13343,18 +13366,18 @@ function up52(db) {
13343
13366
  AND (reason IS NULL OR length(trim(reason)) = 0)
13344
13367
  `);
13345
13368
  }
13346
- function addColumnIfMissing15(db, table, column, definition) {
13369
+ function addColumnIfMissing16(db, table, column, definition) {
13347
13370
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
13348
13371
  if (cols.some((col) => col.name === column))
13349
13372
  return;
13350
13373
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13351
13374
  }
13352
- function up53(db) {
13353
- addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13354
- addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13355
- addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
13356
- addColumnIfMissing15(db, "summary_jobs", "started_at", "TEXT");
13357
- addColumnIfMissing15(db, "summary_jobs", "ended_at", "TEXT");
13375
+ function up54(db) {
13376
+ addColumnIfMissing16(db, "summary_jobs", "session_id", "TEXT");
13377
+ addColumnIfMissing16(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13378
+ addColumnIfMissing16(db, "summary_jobs", "captured_at", "TEXT");
13379
+ addColumnIfMissing16(db, "summary_jobs", "started_at", "TEXT");
13380
+ addColumnIfMissing16(db, "summary_jobs", "ended_at", "TEXT");
13358
13381
  db.exec(`
13359
13382
  UPDATE summary_jobs
13360
13383
  SET
@@ -13441,7 +13464,7 @@ function up53(db) {
13441
13464
  VALUES ('rebuild');
13442
13465
  `);
13443
13466
  }
13444
- function up54(db) {
13467
+ function up55(db) {
13445
13468
  db.exec(`
13446
13469
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13447
13470
  id TEXT PRIMARY KEY,
@@ -13458,7 +13481,7 @@ function up54(db) {
13458
13481
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13459
13482
  `);
13460
13483
  }
13461
- function up55(db) {
13484
+ function up56(db) {
13462
13485
  db.exec(`
13463
13486
  CREATE TABLE IF NOT EXISTS skill_invocations (
13464
13487
  id TEXT PRIMARY KEY,
@@ -13474,7 +13497,7 @@ function up55(db) {
13474
13497
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
13475
13498
  `);
13476
13499
  }
13477
- function up56(db) {
13500
+ function up57(db) {
13478
13501
  db.exec(`
13479
13502
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13480
13503
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13505,7 +13528,7 @@ function up56(db) {
13505
13528
  ON task_scope_hints(agent_id, updated_at);
13506
13529
  `);
13507
13530
  }
13508
- function up57(db) {
13531
+ function up58(db) {
13509
13532
  db.exec(`
13510
13533
  CREATE TABLE IF NOT EXISTS dreaming_state (
13511
13534
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13548,7 +13571,7 @@ function ensureMemoriesScopeColumns(db) {
13548
13571
  if (!names.has("scope"))
13549
13572
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13550
13573
  }
13551
- function up58(db) {
13574
+ function up59(db) {
13552
13575
  ensureMemoriesScopeColumns(db);
13553
13576
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13554
13577
  db.exec(`
@@ -13561,20 +13584,20 @@ function up58(db) {
13561
13584
  WHERE content_hash IS NOT NULL AND is_deleted = 0
13562
13585
  `);
13563
13586
  }
13564
- function up59(db) {
13587
+ function up60(db) {
13565
13588
  const sql = readMemoriesFtsSql(db);
13566
13589
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13567
13590
  return;
13568
13591
  recreateMemoriesFts(db);
13569
13592
  }
13570
- function up60(db) {
13593
+ function up61(db) {
13571
13594
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13572
13595
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13573
13596
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
13574
13597
  ON entities(entity_type, mentions)
13575
13598
  WHERE entity_type = 'extracted'`);
13576
13599
  }
13577
- function up61(db) {
13600
+ function up62(db) {
13578
13601
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13579
13602
  if (!cols.some((col) => col.name === "claim_key")) {
13580
13603
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13583,7 +13606,7 @@ function up61(db) {
13583
13606
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
13584
13607
  WHERE claim_key IS NOT NULL`);
13585
13608
  }
13586
- function up62(db) {
13609
+ function up63(db) {
13587
13610
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13588
13611
  if (!cols.some((col) => col.name === "group_key")) {
13589
13612
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13595,13 +13618,13 @@ function up62(db) {
13595
13618
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
13596
13619
  WHERE claim_key IS NOT NULL`);
13597
13620
  }
13598
- function up63(db) {
13621
+ function up64(db) {
13599
13622
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13600
13623
  if (cols.some((col) => col.name === "source_mtime_ms"))
13601
13624
  return;
13602
13625
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
13603
13626
  }
13604
- function up64(db) {
13627
+ function up65(db) {
13605
13628
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13606
13629
  const names = new Set(cols.map((col) => col.name));
13607
13630
  if (!names.has("is_deleted")) {
@@ -13615,7 +13638,7 @@ function up64(db) {
13615
13638
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
13616
13639
  `);
13617
13640
  }
13618
- function up65(db) {
13641
+ function up66(db) {
13619
13642
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13620
13643
  db.exec(`
13621
13644
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13628,17 +13651,17 @@ function hasColumn6(db, table, column) {
13628
13651
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13629
13652
  return rows.some((row) => row.name === column);
13630
13653
  }
13631
- function addColumnIfMissing16(db, table, column, definition) {
13654
+ function addColumnIfMissing17(db, table, column, definition) {
13632
13655
  if (!hasColumn6(db, table, column)) {
13633
13656
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13634
13657
  }
13635
13658
  }
13636
- function up66(db) {
13659
+ function up67(db) {
13637
13660
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13638
- addColumnIfMissing16(db, table, "source_id", "TEXT");
13639
- addColumnIfMissing16(db, table, "source_kind", "TEXT");
13640
- addColumnIfMissing16(db, table, "source_path", "TEXT");
13641
- addColumnIfMissing16(db, table, "source_root", "TEXT");
13661
+ addColumnIfMissing17(db, table, "source_id", "TEXT");
13662
+ addColumnIfMissing17(db, table, "source_kind", "TEXT");
13663
+ addColumnIfMissing17(db, table, "source_path", "TEXT");
13664
+ addColumnIfMissing17(db, table, "source_root", "TEXT");
13642
13665
  }
13643
13666
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_source ON entities(agent_id, source_id, source_path)");
13644
13667
  db.exec("CREATE INDEX IF NOT EXISTS idx_entity_communities_source ON entity_communities(agent_id, source_id, source_path)");
@@ -13653,7 +13676,7 @@ function hasColumn7(db, table, column) {
13653
13676
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13654
13677
  return rows.some((row) => row.name === column);
13655
13678
  }
13656
- function up67(db) {
13679
+ function up68(db) {
13657
13680
  if (!hasTable2(db, "embeddings"))
13658
13681
  return;
13659
13682
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13661,7 +13684,7 @@ function up67(db) {
13661
13684
  }
13662
13685
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
13663
13686
  }
13664
- function up68(db) {
13687
+ function up69(db) {
13665
13688
  db.exec(`
13666
13689
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13667
13690
  id TEXT PRIMARY KEY,
@@ -13697,12 +13720,12 @@ function hasColumn8(db, table, column) {
13697
13720
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13698
13721
  return rows.some((row) => row.name === column);
13699
13722
  }
13700
- function addColumnIfMissing17(db, table, column, definition) {
13723
+ function addColumnIfMissing18(db, table, column, definition) {
13701
13724
  if (!hasColumn8(db, table, column)) {
13702
13725
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13703
13726
  }
13704
13727
  }
13705
- function up69(db) {
13728
+ function up70(db) {
13706
13729
  db.exec(`
13707
13730
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13708
13731
  id TEXT PRIMARY KEY,
@@ -13740,12 +13763,12 @@ function up69(db) {
13740
13763
  ON ontology_proposals(agent_id, source_kind, source_id);
13741
13764
  `);
13742
13765
  for (const table of ["entity_attributes", "entity_dependencies"]) {
13743
- addColumnIfMissing17(db, table, "proposal_id", "TEXT");
13744
- addColumnIfMissing17(db, table, "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
13766
+ addColumnIfMissing18(db, table, "proposal_id", "TEXT");
13767
+ addColumnIfMissing18(db, table, "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
13745
13768
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
13746
13769
  }
13747
13770
  }
13748
- function up70(db) {
13771
+ function up71(db) {
13749
13772
  db.exec(`
13750
13773
  CREATE TABLE IF NOT EXISTS daily_reflections (
13751
13774
  id TEXT PRIMARY KEY,
@@ -13772,7 +13795,7 @@ function up70(db) {
13772
13795
  WHERE content_key IS NOT NULL;
13773
13796
  `);
13774
13797
  }
13775
- function up71(db) {
13798
+ function up72(db) {
13776
13799
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13777
13800
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
13778
13801
  if (!colNames.has("content_key")) {
@@ -13797,7 +13820,7 @@ function hasColumn9(db, table, column) {
13797
13820
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13798
13821
  return rows.some((row) => row.name === column);
13799
13822
  }
13800
- function addColumnIfMissing18(db, table, column, definition) {
13823
+ function addColumnIfMissing19(db, table, column, definition) {
13801
13824
  if (!hasColumn9(db, table, column)) {
13802
13825
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13803
13826
  }
@@ -13809,23 +13832,23 @@ function backfillVersionRoots(db) {
13809
13832
  WHERE version_root_id IS NULL
13810
13833
  `);
13811
13834
  }
13812
- function up72(db) {
13835
+ function up73(db) {
13813
13836
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13814
- addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13815
- addColumnIfMissing18(db, table, "archived_at", "TEXT");
13816
- addColumnIfMissing18(db, table, "archived_by", "TEXT");
13817
- addColumnIfMissing18(db, table, "archive_reason", "TEXT");
13837
+ addColumnIfMissing19(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13838
+ addColumnIfMissing19(db, table, "archived_at", "TEXT");
13839
+ addColumnIfMissing19(db, table, "archived_by", "TEXT");
13840
+ addColumnIfMissing19(db, table, "archive_reason", "TEXT");
13818
13841
  }
13819
13842
  for (const table of ["entities", "entity_aspects"]) {
13820
- addColumnIfMissing18(db, table, "proposal_id", "TEXT");
13821
- addColumnIfMissing18(db, table, "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
13822
- }
13823
- addColumnIfMissing18(db, "entity_attributes", "version", "INTEGER NOT NULL DEFAULT 1");
13824
- addColumnIfMissing18(db, "entity_attributes", "version_root_id", "TEXT");
13825
- addColumnIfMissing18(db, "entity_attributes", "previous_attribute_id", "TEXT");
13826
- addColumnIfMissing18(db, "entity_attributes", "archived_at", "TEXT");
13827
- addColumnIfMissing18(db, "entity_attributes", "archived_by", "TEXT");
13828
- addColumnIfMissing18(db, "entity_attributes", "archive_reason", "TEXT");
13843
+ addColumnIfMissing19(db, table, "proposal_id", "TEXT");
13844
+ addColumnIfMissing19(db, table, "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
13845
+ }
13846
+ addColumnIfMissing19(db, "entity_attributes", "version", "INTEGER NOT NULL DEFAULT 1");
13847
+ addColumnIfMissing19(db, "entity_attributes", "version_root_id", "TEXT");
13848
+ addColumnIfMissing19(db, "entity_attributes", "previous_attribute_id", "TEXT");
13849
+ addColumnIfMissing19(db, "entity_attributes", "archived_at", "TEXT");
13850
+ addColumnIfMissing19(db, "entity_attributes", "archived_by", "TEXT");
13851
+ addColumnIfMissing19(db, "entity_attributes", "archive_reason", "TEXT");
13829
13852
  backfillVersionRoots(db);
13830
13853
  db.exec(`
13831
13854
  CREATE INDEX IF NOT EXISTS idx_entities_status
@@ -13844,7 +13867,7 @@ function up72(db) {
13844
13867
  ON entity_aspects(agent_id, proposal_id);
13845
13868
  `);
13846
13869
  }
13847
- function up73(db) {
13870
+ function up74(db) {
13848
13871
  db.exec(`
13849
13872
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13850
13873
  id TEXT PRIMARY KEY,
@@ -13900,7 +13923,7 @@ function ensureMemoriesScopeColumns2(db) {
13900
13923
  if (!names.has("runtime_path"))
13901
13924
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13902
13925
  }
13903
- function up74(db) {
13926
+ function up75(db) {
13904
13927
  ensureMemoriesScopeColumns2(db);
13905
13928
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13906
13929
  db.exec(`
@@ -13914,7 +13937,7 @@ function up74(db) {
13914
13937
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
13915
13938
  `);
13916
13939
  }
13917
- function up75(db) {
13940
+ function up76(db) {
13918
13941
  db.exec(`
13919
13942
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13920
13943
  session_key TEXT NOT NULL,
@@ -13949,7 +13972,7 @@ function up75(db) {
13949
13972
  ON session_recall_events(item_kind, item_id, created_at DESC);
13950
13973
  `);
13951
13974
  }
13952
- function up76(db) {
13975
+ function up77(db) {
13953
13976
  db.exec(`
13954
13977
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13955
13978
  aggregate_memory_id TEXT NOT NULL,
@@ -13962,18 +13985,18 @@ function up76(db) {
13962
13985
  ON aggregate_memory_sources(agent_id, aggregate_memory_id);
13963
13986
  `);
13964
13987
  }
13965
- function addColumnIfMissing19(db, table, column, definition) {
13988
+ function addColumnIfMissing20(db, table, column, definition) {
13966
13989
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
13967
13990
  if (cols.some((col) => col.name === column))
13968
13991
  return;
13969
13992
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13970
13993
  }
13971
- function up77(db) {
13972
- addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
13973
- addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
13974
- addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
13975
- addColumnIfMissing19(db, "memory_artifacts", "source_parent_path", "TEXT");
13976
- addColumnIfMissing19(db, "memory_artifacts", "source_meta_json", "TEXT");
13994
+ function up78(db) {
13995
+ addColumnIfMissing20(db, "memory_artifacts", "source_id", "TEXT");
13996
+ addColumnIfMissing20(db, "memory_artifacts", "source_root", "TEXT");
13997
+ addColumnIfMissing20(db, "memory_artifacts", "source_external_id", "TEXT");
13998
+ addColumnIfMissing20(db, "memory_artifacts", "source_parent_path", "TEXT");
13999
+ addColumnIfMissing20(db, "memory_artifacts", "source_meta_json", "TEXT");
13977
14000
  db.exec(`
13978
14001
  CREATE INDEX IF NOT EXISTS idx_memory_artifacts_agent_source
13979
14002
  ON memory_artifacts(agent_id, source_id, source_external_id);
@@ -13981,7 +14004,7 @@ function up77(db) {
13981
14004
  ON memory_artifacts(agent_id, source_id, source_root);
13982
14005
  `);
13983
14006
  }
13984
- function up78(db) {
14007
+ function up79(db) {
13985
14008
  db.exec(`
13986
14009
  CREATE TABLE IF NOT EXISTS temporal_edges (
13987
14010
  id TEXT PRIMARY KEY,
@@ -14004,7 +14027,7 @@ function up78(db) {
14004
14027
  ON temporal_edges(agent_id, subject_type, subject_id);
14005
14028
  `);
14006
14029
  }
14007
- function up79(db) {
14030
+ function up80(db) {
14008
14031
  db.exec(`
14009
14032
  CREATE TABLE IF NOT EXISTS entity_aliases (
14010
14033
  id TEXT PRIMARY KEY,
@@ -14028,7 +14051,7 @@ function up79(db) {
14028
14051
  ON entity_aliases(agent_id, canonical_alias, status);
14029
14052
  `);
14030
14053
  }
14031
- function up80(db) {
14054
+ function up81(db) {
14032
14055
  db.exec(`
14033
14056
  CREATE TABLE IF NOT EXISTS api_keys (
14034
14057
  id TEXT PRIMARY KEY,
@@ -14056,7 +14079,7 @@ function up80(db) {
14056
14079
  ON api_keys(connector, harness);
14057
14080
  `);
14058
14081
  }
14059
- function up81(db) {
14082
+ function up82(db) {
14060
14083
  db.exec(`
14061
14084
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
14062
14085
  id TEXT PRIMARY KEY,
@@ -14091,7 +14114,7 @@ function hasColumn10(db, table, column) {
14091
14114
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14092
14115
  return rows.some((row) => row.name === column);
14093
14116
  }
14094
- function up82(db) {
14117
+ function up83(db) {
14095
14118
  if (!hasColumn10(db, "documents", "agent_id")) {
14096
14119
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
14097
14120
  }
@@ -14177,7 +14200,7 @@ function up82(db) {
14177
14200
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
14178
14201
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
14179
14202
  }
14180
- function up83(db) {
14203
+ function up84(db) {
14181
14204
  db.exec(`
14182
14205
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14183
14206
  aggregate_memory_id TEXT NOT NULL,
@@ -14199,7 +14222,7 @@ function hasColumn11(db, table, column) {
14199
14222
  return rows.some((row) => row.name === column);
14200
14223
  }
14201
14224
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14202
- function up84(db) {
14225
+ function up85(db) {
14203
14226
  for (const column of COLUMNS) {
14204
14227
  if (!hasColumn11(db, "skill_invocations", column)) {
14205
14228
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14257,7 +14280,7 @@ function hasColumn12(db, table, column) {
14257
14280
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14258
14281
  return rows.some((row) => row.name === column);
14259
14282
  }
14260
- function addColumnIfMissing20(db, table, column, definition) {
14283
+ function addColumnIfMissing21(db, table, column, definition) {
14261
14284
  if (!hasColumn12(db, table, column))
14262
14285
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14263
14286
  }
@@ -14280,7 +14303,7 @@ function documentScopeColumnsPreservingExisting(db) {
14280
14303
  `);
14281
14304
  }
14282
14305
  try {
14283
- up82(db);
14306
+ up83(db);
14284
14307
  if (preserveAgentId) {
14285
14308
  db.exec(`
14286
14309
  UPDATE documents
@@ -14300,25 +14323,25 @@ function documentScopeColumnsPreservingExisting(db) {
14300
14323
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14301
14324
  }
14302
14325
  }
14303
- function up85(db) {
14304
- up81(db);
14326
+ function up86(db) {
14327
+ up82(db);
14305
14328
  if (hasTable3(db, "documents")) {
14306
14329
  documentScopeColumnsPreservingExisting(db);
14307
14330
  }
14308
- up83(db);
14309
- addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14310
- addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14311
- addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
14331
+ up84(db);
14332
+ addColumnIfMissing21(db, "memories", "superseded_by", "TEXT");
14333
+ addColumnIfMissing21(db, "memories", "superseded_at", "TEXT");
14334
+ addColumnIfMissing21(db, "memories", "superseded_reason", "TEXT");
14312
14335
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_superseded_by ON memories(superseded_by)");
14313
14336
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_active_supersession ON memories(is_deleted, superseded_by)");
14314
14337
  if (!hasTable3(db, "relations") || !hasTable3(db, "entity_dependencies"))
14315
14338
  return;
14316
- addColumnIfMissing20(db, "entity_dependencies", "confidence", "REAL");
14317
- addColumnIfMissing20(db, "entity_dependencies", "reason", "TEXT");
14318
- addColumnIfMissing20(db, "entity_dependencies", "source_id", "TEXT");
14319
- addColumnIfMissing20(db, "entity_dependencies", "source_kind", "TEXT");
14320
- addColumnIfMissing20(db, "entity_dependencies", "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
14321
- addColumnIfMissing20(db, "entity_dependencies", "status", "TEXT NOT NULL DEFAULT 'active'");
14339
+ addColumnIfMissing21(db, "entity_dependencies", "confidence", "REAL");
14340
+ addColumnIfMissing21(db, "entity_dependencies", "reason", "TEXT");
14341
+ addColumnIfMissing21(db, "entity_dependencies", "source_id", "TEXT");
14342
+ addColumnIfMissing21(db, "entity_dependencies", "source_kind", "TEXT");
14343
+ addColumnIfMissing21(db, "entity_dependencies", "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
14344
+ addColumnIfMissing21(db, "entity_dependencies", "status", "TEXT NOT NULL DEFAULT 'active'");
14322
14345
  const relationConfidence = hasColumn12(db, "relations", "confidence") ? "r.confidence" : "NULL";
14323
14346
  const relationUpdatedAt = hasColumn12(db, "relations", "updated_at") ? "r.updated_at" : "r.created_at";
14324
14347
  const sourceAgentId = hasColumn12(db, "entities", "agent_id") ? "COALESCE(NULLIF(TRIM(src.agent_id), ''), 'default')" : "'default'";
@@ -14362,7 +14385,7 @@ function up85(db) {
14362
14385
  AND ${sourceAgentId} = ${targetAgentId}
14363
14386
  `);
14364
14387
  }
14365
- function up86(db) {
14388
+ function up87(db) {
14366
14389
  db.exec(`
14367
14390
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14368
14391
  path TEXT PRIMARY KEY,
@@ -14392,7 +14415,7 @@ function up86(db) {
14392
14415
  ON legacy_markdown_chunks(memory_id);
14393
14416
  `);
14394
14417
  }
14395
- function up87(db) {
14418
+ function up88(db) {
14396
14419
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14397
14420
  const tableNames = new Set(tables.map((r2) => String(r2.name)));
14398
14421
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14445,33 +14468,33 @@ function up87(db) {
14445
14468
  AND target_entity_id IS NOT NULL
14446
14469
  AND relation_type IS NOT NULL`);
14447
14470
  }
14448
- function addColumnIfMissing21(db, table, column, definition) {
14471
+ function addColumnIfMissing22(db, table, column, definition) {
14449
14472
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
14450
14473
  if (cols.some((col) => col.name === column))
14451
14474
  return;
14452
14475
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14453
14476
  }
14454
- function up88(db) {
14455
- addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
14477
+ function up89(db) {
14478
+ addColumnIfMissing22(db, "summary_jobs", "content_hash", "TEXT");
14456
14479
  db.exec(`
14457
14480
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
14458
14481
  ON summary_jobs(agent_id, session_key, content_hash)
14459
14482
  `);
14460
14483
  }
14461
- function addColumnIfMissing22(db, table, column, definition) {
14484
+ function addColumnIfMissing23(db, table, column, definition) {
14462
14485
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
14463
14486
  if (cols.some((col) => col.name === column))
14464
14487
  return;
14465
14488
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14466
14489
  }
14467
- function up89(db) {
14468
- addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
14490
+ function up90(db) {
14491
+ addColumnIfMissing23(db, "summary_jobs", "boundary_reason", "TEXT");
14469
14492
  db.exec(`
14470
14493
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
14471
14494
  ON summary_jobs(agent_id, session_key, boundary_reason)
14472
14495
  `);
14473
14496
  }
14474
- function up90(db) {
14497
+ function up91(db) {
14475
14498
  db.exec(`
14476
14499
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14477
14500
  agent_id TEXT NOT NULL,
@@ -14489,7 +14512,7 @@ function up90(db) {
14489
14512
  ON transcript_capture_jobs(agent_id, session_id, status);
14490
14513
  `);
14491
14514
  }
14492
- function up91(db) {
14515
+ function up92(db) {
14493
14516
  db.exec(`
14494
14517
  CREATE TABLE IF NOT EXISTS job_cancellations (
14495
14518
  id TEXT PRIMARY KEY,
@@ -14517,7 +14540,7 @@ function indexExists(db, table, indexName) {
14517
14540
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14518
14541
  return rows.some((row) => row.name === indexName);
14519
14542
  }
14520
- function up92(db) {
14543
+ function up93(db) {
14521
14544
  db.exec(`
14522
14545
  CREATE TABLE IF NOT EXISTS job_archive (
14523
14546
  id TEXT PRIMARY KEY,
@@ -14544,7 +14567,7 @@ function indexExists2(db, table, indexName) {
14544
14567
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14545
14568
  return rows.some((row) => row.name === indexName);
14546
14569
  }
14547
- function up93(db) {
14570
+ function up94(db) {
14548
14571
  db.exec(`
14549
14572
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14550
14573
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14557,7 +14580,7 @@ function up93(db) {
14557
14580
  )
14558
14581
  `);
14559
14582
  }
14560
- function up94(db) {
14583
+ function up95(db) {
14561
14584
  db.exec(`
14562
14585
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14563
14586
  id TEXT PRIMARY KEY,
@@ -14576,7 +14599,7 @@ function up94(db) {
14576
14599
  ON embeddings_staging(agent_id, source_type, source_id);
14577
14600
  `);
14578
14601
  }
14579
- function up95(db) {
14602
+ function up96(db) {
14580
14603
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14581
14604
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14582
14605
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14587,7 +14610,7 @@ function hasColumn13(db, table, column) {
14587
14610
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14588
14611
  return rows.some((r2) => r2.name === column);
14589
14612
  }
14590
- function up96(db) {
14613
+ function up97(db) {
14591
14614
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14592
14615
  if (tables.length === 0)
14593
14616
  return;
@@ -14612,23 +14635,23 @@ function up96(db) {
14612
14635
  function hasColumn14(db, table, column) {
14613
14636
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14614
14637
  }
14615
- function up97(db) {
14638
+ function up98(db) {
14616
14639
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14617
14640
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14618
14641
  return;
14619
14642
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
14620
14643
  }
14621
- function up98(db) {
14644
+ function up99(db) {
14622
14645
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14623
14646
  }
14624
- function up99(db) {
14647
+ function up100(db) {
14625
14648
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14626
14649
  if (!columns.some((column) => column.name === "last_failure_at")) {
14627
14650
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
14628
14651
  }
14629
14652
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
14630
14653
  }
14631
- function up100(db) {
14654
+ function up101(db) {
14632
14655
  db.exec(`
14633
14656
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14634
14657
  agent_id TEXT NOT NULL,
@@ -14645,7 +14668,7 @@ function up100(db) {
14645
14668
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
14646
14669
  `);
14647
14670
  }
14648
- function up101(db) {
14671
+ function up102(db) {
14649
14672
  db.exec(`
14650
14673
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14651
14674
  id TEXT PRIMARY KEY,
@@ -14665,7 +14688,7 @@ function up101(db) {
14665
14688
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
14666
14689
  `);
14667
14690
  }
14668
- function up102(db) {
14691
+ function up103(db) {
14669
14692
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14670
14693
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14671
14694
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14674,7 +14697,7 @@ function up102(db) {
14674
14697
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
14675
14698
  }
14676
14699
  }
14677
- function up103(db) {
14700
+ function up104(db) {
14678
14701
  db.exec(`
14679
14702
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14680
14703
  id TEXT PRIMARY KEY,
@@ -14696,7 +14719,7 @@ function up103(db) {
14696
14719
  function hasColumn15(db, table, column) {
14697
14720
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14698
14721
  }
14699
- function up104(db) {
14722
+ function up105(db) {
14700
14723
  const requiredMemoryColumns = [
14701
14724
  "content_hash",
14702
14725
  "normalized_content",
@@ -14747,7 +14770,7 @@ function up104(db) {
14747
14770
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
14748
14771
  `);
14749
14772
  }
14750
- function up105(db) {
14773
+ function up106(db) {
14751
14774
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14752
14775
  if (tables.length !== 2)
14753
14776
  return;
@@ -14770,7 +14793,7 @@ function tableExists(db, table) {
14770
14793
  function hasColumn16(db, table, column) {
14771
14794
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14772
14795
  }
14773
- function up106(db) {
14796
+ function up107(db) {
14774
14797
  db.exec(`
14775
14798
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14776
14799
  derived_memory_id TEXT NOT NULL,
@@ -14813,7 +14836,7 @@ function up106(db) {
14813
14836
  `);
14814
14837
  }
14815
14838
  }
14816
- function up107(db) {
14839
+ function up108(db) {
14817
14840
  db.exec(`
14818
14841
  DROP TRIGGER IF EXISTS entities_fts_ai;
14819
14842
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -14902,7 +14925,7 @@ function up107(db) {
14902
14925
  function hasColumn17(db, table, column) {
14903
14926
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14904
14927
  }
14905
- function up108(db) {
14928
+ function up109(db) {
14906
14929
  if (!hasColumn17(db, "memories", "review_after")) {
14907
14930
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
14908
14931
  }
@@ -14918,14 +14941,14 @@ var TOKEN_COLUMNS = [
14918
14941
  ["tokens_cache_write", "INTEGER"],
14919
14942
  ["tokens_cost", "REAL"]
14920
14943
  ];
14921
- function up109(db) {
14944
+ function up110(db) {
14922
14945
  for (const [column, type] of TOKEN_COLUMNS) {
14923
14946
  if (!hasColumn18(db, "dreaming_passes", column)) {
14924
14947
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14925
14948
  }
14926
14949
  }
14927
14950
  }
14928
- function up110(db) {
14951
+ function up111(db) {
14929
14952
  db.exec(`
14930
14953
  CREATE TABLE IF NOT EXISTS embedding_usage (
14931
14954
  day TEXT NOT NULL,
@@ -14938,7 +14961,7 @@ function up110(db) {
14938
14961
  );
14939
14962
  `);
14940
14963
  }
14941
- function up111(db) {
14964
+ function up112(db) {
14942
14965
  db.exec(`
14943
14966
  CREATE TABLE IF NOT EXISTS telemetry_install (
14944
14967
  id TEXT PRIMARY KEY,
@@ -14946,7 +14969,7 @@ function up111(db) {
14946
14969
  );
14947
14970
  `);
14948
14971
  }
14949
- function up112(db) {
14972
+ function up113(db) {
14950
14973
  db.exec(`
14951
14974
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14952
14975
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14957,7 +14980,7 @@ function hasColumn19(db, table, column) {
14957
14980
  return rows.some((row) => row.name === column);
14958
14981
  }
14959
14982
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14960
- function up113(db) {
14983
+ function up114(db) {
14961
14984
  for (const column of COLUMNS2) {
14962
14985
  if (!hasColumn19(db, "telemetry_install", column)) {
14963
14986
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14968,21 +14991,21 @@ function hasColumn20(db, table, column) {
14968
14991
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14969
14992
  return rows.some((row) => row.name === column);
14970
14993
  }
14971
- function addColumnIfMissing23(db, column, definition) {
14994
+ function addColumnIfMissing24(db, column, definition) {
14972
14995
  if (!hasColumn20(db, "telemetry_events", column)) {
14973
14996
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14974
14997
  }
14975
14998
  }
14976
- function up114(db) {
14977
- addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14978
- addColumnIfMissing23(db, "claim_token", "TEXT");
14979
- addColumnIfMissing23(db, "claimed_at", "TEXT");
14999
+ function up115(db) {
15000
+ addColumnIfMissing24(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
15001
+ addColumnIfMissing24(db, "claim_token", "TEXT");
15002
+ addColumnIfMissing24(db, "claimed_at", "TEXT");
14980
15003
  db.exec(`
14981
15004
  CREATE INDEX IF NOT EXISTS idx_telemetry_events_queue
14982
15005
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14983
15006
  `);
14984
15007
  }
14985
- function up115(db) {
15008
+ function up116(db) {
14986
15009
  db.exec(`
14987
15010
  CREATE TABLE IF NOT EXISTS session_claims (
14988
15011
  session_key TEXT NOT NULL,
@@ -15003,7 +15026,7 @@ function up115(db) {
15003
15026
  ON session_claims(agent_id, state, expires_at);
15004
15027
  `);
15005
15028
  }
15006
- function up116(db) {
15029
+ function up117(db) {
15007
15030
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
15008
15031
  if (table == null)
15009
15032
  return;
@@ -15012,7 +15035,7 @@ function up116(db) {
15012
15035
  ON entity_attributes(memory_id, agent_id, status, importance);
15013
15036
  `);
15014
15037
  }
15015
- function up117(db) {
15038
+ function up118(db) {
15016
15039
  db.exec(`
15017
15040
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
15018
15041
  id TEXT PRIMARY KEY,
@@ -15064,26 +15087,26 @@ function up117(db) {
15064
15087
  function hasColumn21(db, table, column) {
15065
15088
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15066
15089
  }
15067
- function addColumnIfMissing24(db, column, definition) {
15090
+ function addColumnIfMissing25(db, column, definition) {
15068
15091
  if (!hasColumn21(db, "cross_agent_messages", column)) {
15069
15092
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
15070
15093
  }
15071
15094
  }
15072
- function up118(db) {
15095
+ function up119(db) {
15073
15096
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
15074
15097
  if (table == null)
15075
15098
  return;
15076
- addColumnIfMissing24(db, "delivery_state", "TEXT NOT NULL DEFAULT 'pending'");
15077
- addColumnIfMissing24(db, "delivery_attempt_id", "TEXT");
15078
- addColumnIfMissing24(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15079
- addColumnIfMissing24(db, "delivery_lease_token", "TEXT");
15080
- addColumnIfMissing24(db, "delivery_lease_expires_at", "TEXT");
15081
- addColumnIfMissing24(db, "delivery_attempt_started_at", "TEXT");
15082
- addColumnIfMissing24(db, "delivery_updated_at", "TEXT");
15083
- addColumnIfMissing24(db, "acp_base_url", "TEXT");
15084
- addColumnIfMissing24(db, "acp_target_agent_name", "TEXT");
15085
- addColumnIfMissing24(db, "acp_timeout_ms", "INTEGER");
15086
- addColumnIfMissing24(db, "acp_metadata_json", "TEXT");
15099
+ addColumnIfMissing25(db, "delivery_state", "TEXT NOT NULL DEFAULT 'pending'");
15100
+ addColumnIfMissing25(db, "delivery_attempt_id", "TEXT");
15101
+ addColumnIfMissing25(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15102
+ addColumnIfMissing25(db, "delivery_lease_token", "TEXT");
15103
+ addColumnIfMissing25(db, "delivery_lease_expires_at", "TEXT");
15104
+ addColumnIfMissing25(db, "delivery_attempt_started_at", "TEXT");
15105
+ addColumnIfMissing25(db, "delivery_updated_at", "TEXT");
15106
+ addColumnIfMissing25(db, "acp_base_url", "TEXT");
15107
+ addColumnIfMissing25(db, "acp_target_agent_name", "TEXT");
15108
+ addColumnIfMissing25(db, "acp_timeout_ms", "INTEGER");
15109
+ addColumnIfMissing25(db, "acp_metadata_json", "TEXT");
15087
15110
  db.exec(`
15088
15111
  UPDATE cross_agent_messages
15089
15112
  SET delivery_state = CASE delivery_status
@@ -15108,7 +15131,7 @@ function up118(db) {
15108
15131
  function hasTable4(db, table) {
15109
15132
  return db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15110
15133
  }
15111
- function addColumnIfMissing25(db, table, column, definition) {
15134
+ function addColumnIfMissing26(db, table, column, definition) {
15112
15135
  const columns = db.prepare(`PRAGMA table_info(${table})`).all();
15113
15136
  if (columns.some((row) => row.name === column))
15114
15137
  return;
@@ -15270,11 +15293,11 @@ function backfillTranscriptsFromSummaryJobs(db) {
15270
15293
  insert.run(...values);
15271
15294
  }
15272
15295
  }
15273
- function up119(db) {
15296
+ function up120(db) {
15274
15297
  if (!hasTable4(db, "session_transcripts"))
15275
15298
  return;
15276
- addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
15277
- addColumnIfMissing25(db, "session_transcripts", "content_hash", "TEXT");
15299
+ addColumnIfMissing26(db, "session_transcripts", "completed_at", "TEXT");
15300
+ addColumnIfMissing26(db, "session_transcripts", "content_hash", "TEXT");
15278
15301
  backfillTranscriptHashes(db);
15279
15302
  if (hasTable4(db, "transcript_capture_jobs")) {
15280
15303
  const captureColumns = db.prepare("PRAGMA table_info(transcript_capture_jobs)").all();
@@ -15323,7 +15346,7 @@ function up119(db) {
15323
15346
  ON session_transcripts(agent_id, content_hash);
15324
15347
  `);
15325
15348
  }
15326
- function up120(db) {
15349
+ function up121(db) {
15327
15350
  db.exec(`
15328
15351
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15329
15352
  ON memory_jobs(status)
@@ -15342,12 +15365,12 @@ function up120(db) {
15342
15365
  function hasColumn22(db, table, column) {
15343
15366
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15344
15367
  }
15345
- function up121(db) {
15368
+ function up122(db) {
15346
15369
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15347
15370
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15348
15371
  }
15349
15372
  }
15350
- function up122(db) {
15373
+ function up123(db) {
15351
15374
  db.exec(`
15352
15375
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15353
15376
  agent_id TEXT NOT NULL,
@@ -15371,16 +15394,16 @@ function up122(db) {
15371
15394
  function hasColumn23(db, table, column) {
15372
15395
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15373
15396
  }
15374
- function addColumnIfMissing26(db, column, definition) {
15397
+ function addColumnIfMissing27(db, column, definition) {
15375
15398
  if (!hasColumn23(db, "telemetry_events", column)) {
15376
15399
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15377
15400
  }
15378
15401
  }
15379
- function up123(db) {
15380
- addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15381
- addColumnIfMissing26(db, "last_attempt_at", "TEXT");
15382
- addColumnIfMissing26(db, "sent_at", "TEXT");
15383
- addColumnIfMissing26(db, "last_failure_code", "TEXT");
15402
+ function up124(db) {
15403
+ addColumnIfMissing27(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15404
+ addColumnIfMissing27(db, "last_attempt_at", "TEXT");
15405
+ addColumnIfMissing27(db, "sent_at", "TEXT");
15406
+ addColumnIfMissing27(db, "last_failure_code", "TEXT");
15384
15407
  db.exec(`
15385
15408
  CREATE TABLE IF NOT EXISTS telemetry_delivery_state (
15386
15409
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15397,7 +15420,7 @@ function up123(db) {
15397
15420
  VALUES (1, CURRENT_TIMESTAMP);
15398
15421
  `);
15399
15422
  }
15400
- function up124(db) {
15423
+ function up125(db) {
15401
15424
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15402
15425
  const names = new Set(columns.map((column) => column.name));
15403
15426
  if (!names.has("failure_class")) {
@@ -15414,7 +15437,7 @@ function up124(db) {
15414
15437
  }
15415
15438
  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)");
15416
15439
  }
15417
- function up125(db) {
15440
+ function up126(db) {
15418
15441
  db.exec(`
15419
15442
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15420
15443
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15438,7 +15461,7 @@ function up125(db) {
15438
15461
  ON embedding_index_failures(source_type, source_id);
15439
15462
  `);
15440
15463
  }
15441
- function up126(db) {
15464
+ function up127(db) {
15442
15465
  db.exec(`
15443
15466
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15444
15467
  id TEXT PRIMARY KEY,
@@ -15488,7 +15511,7 @@ function backfillTable(db, params) {
15488
15511
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15489
15512
  backfill(db, rows, params.sourceKind, params.scannedAt);
15490
15513
  }
15491
- function up127(db) {
15514
+ function up128(db) {
15492
15515
  db.exec(`
15493
15516
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15494
15517
  agent_id TEXT NOT NULL,
@@ -15545,7 +15568,7 @@ function up127(db) {
15545
15568
  scannedAt
15546
15569
  });
15547
15570
  }
15548
- function up128(db) {
15571
+ function up129(db) {
15549
15572
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15550
15573
  if (!table)
15551
15574
  return;
@@ -15579,7 +15602,7 @@ function up128(db) {
15579
15602
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
15580
15603
  `);
15581
15604
  }
15582
- function up129(db) {
15605
+ function up130(db) {
15583
15606
  db.exec(`
15584
15607
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15585
15608
  id TEXT PRIMARY KEY,
@@ -15635,7 +15658,7 @@ function up129(db) {
15635
15658
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
15636
15659
  `);
15637
15660
  }
15638
- function up130(db) {
15661
+ function up131(db) {
15639
15662
  db.exec(`
15640
15663
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15641
15664
  ON memory_jobs(status, created_at)
@@ -15650,7 +15673,7 @@ function up130(db) {
15650
15673
  function tableExists3(db, table) {
15651
15674
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15652
15675
  }
15653
- function up131(db) {
15676
+ function up132(db) {
15654
15677
  if (!tableExists3(db, "memory_jobs"))
15655
15678
  return;
15656
15679
  if (!tableExists3(db, "job_cancellations")) {
@@ -15699,7 +15722,7 @@ function up131(db) {
15699
15722
  AND status IN ('pending', 'leased');
15700
15723
  `);
15701
15724
  }
15702
- function up132(db) {
15725
+ function up133(db) {
15703
15726
  db.exec(`
15704
15727
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15705
15728
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15739,7 +15762,7 @@ function up132(db) {
15739
15762
  END;
15740
15763
  `);
15741
15764
  }
15742
- function up133(db) {
15765
+ function up134(db) {
15743
15766
  db.exec(`
15744
15767
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15745
15768
  agent_id TEXT NOT NULL,
@@ -15762,13 +15785,13 @@ function up133(db) {
15762
15785
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
15763
15786
  `);
15764
15787
  }
15765
- function up134(db) {
15788
+ function up135(db) {
15766
15789
  db.exec(`
15767
15790
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15768
15791
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
15769
15792
  `);
15770
15793
  }
15771
- function up135(db) {
15794
+ function up136(db) {
15772
15795
  db.exec(`
15773
15796
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15774
15797
  id TEXT PRIMARY KEY,
@@ -15820,7 +15843,7 @@ function up135(db) {
15820
15843
  if (!names.has("format_version"))
15821
15844
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
15822
15845
  }
15823
- function up136(db) {
15846
+ function up137(db) {
15824
15847
  db.exec(`
15825
15848
  CREATE TABLE memory_head_entries_v134 (
15826
15849
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15838,7 +15861,7 @@ function up136(db) {
15838
15861
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
15839
15862
  `);
15840
15863
  }
15841
- function up137(db) {
15864
+ function up138(db) {
15842
15865
  db.exec(`
15843
15866
  CREATE TABLE IF NOT EXISTS memory_head_publications (
15844
15867
  agent_id TEXT NOT NULL,
@@ -15854,7 +15877,7 @@ function up137(db) {
15854
15877
  ON memory_head_publications(agent_id, status, revision DESC);
15855
15878
  `);
15856
15879
  }
15857
- function up138(db) {
15880
+ function up139(db) {
15858
15881
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r2) => r2.name));
15859
15882
  for (const [name, type] of [
15860
15883
  ["entry_id", "TEXT"],
@@ -15868,7 +15891,7 @@ function up138(db) {
15868
15891
  }
15869
15892
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
15870
15893
  }
15871
- function up139(db) {
15894
+ function up140(db) {
15872
15895
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r2) => r2.name));
15873
15896
  for (const [name, type] of [
15874
15897
  ["head_revision", "INTEGER"],
@@ -15886,12 +15909,12 @@ function hasColumn25(db, table, column) {
15886
15909
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
15887
15910
  return rows.some((row) => row.name === column);
15888
15911
  }
15889
- function addColumnIfMissing27(db, table, column, definition) {
15912
+ function addColumnIfMissing28(db, table, column, definition) {
15890
15913
  if (!hasColumn25(db, table, column))
15891
15914
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15892
15915
  }
15893
- function up140(db) {
15894
- addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
15916
+ function up141(db) {
15917
+ addColumnIfMissing28(db, "memories", "manual_override", "INTEGER DEFAULT 0");
15895
15918
  db.exec(`
15896
15919
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
15897
15920
  agent_id TEXT PRIMARY KEY,
@@ -16195,7 +16218,7 @@ function up140(db) {
16195
16218
  GROUP BY j.agent_id;
16196
16219
  `);
16197
16220
  }
16198
- function up141(db) {
16221
+ function up142(db) {
16199
16222
  db.exec(`
16200
16223
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16201
16224
  agent_id TEXT NOT NULL,
@@ -16211,7 +16234,7 @@ function up141(db) {
16211
16234
  ON native_source_sync_state(agent_id, status);
16212
16235
  `);
16213
16236
  }
16214
- function up142(db) {
16237
+ function up143(db) {
16215
16238
  db.exec(`
16216
16239
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16217
16240
  agent_id TEXT NOT NULL,
@@ -16223,7 +16246,7 @@ function up142(db) {
16223
16246
  );
16224
16247
  `);
16225
16248
  }
16226
- function up143(db) {
16249
+ function up144(db) {
16227
16250
  db.exec(`
16228
16251
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16229
16252
  agent_id TEXT NOT NULL,
@@ -16237,13 +16260,13 @@ function up143(db) {
16237
16260
  );
16238
16261
  `);
16239
16262
  }
16240
- function up144(db) {
16263
+ function up145(db) {
16241
16264
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16242
16265
  if (!columns.some((column) => column.name === "frontier")) {
16243
16266
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
16244
16267
  }
16245
16268
  }
16246
- function up145(db) {
16269
+ function up146(db) {
16247
16270
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16248
16271
  const additions = [
16249
16272
  ["migration_phase", "TEXT"],
@@ -16278,13 +16301,13 @@ function up145(db) {
16278
16301
  `);
16279
16302
  }
16280
16303
  }
16281
- function up146(db) {
16304
+ function up147(db) {
16282
16305
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16283
16306
  if (!columns.has("lease_token")) {
16284
16307
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
16285
16308
  }
16286
16309
  }
16287
- function up147(db) {
16310
+ function up148(db) {
16288
16311
  db.exec(`
16289
16312
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16290
16313
  agent_id TEXT NOT NULL,
@@ -16302,7 +16325,7 @@ function up147(db) {
16302
16325
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
16303
16326
  `);
16304
16327
  }
16305
- function up148(db) {
16328
+ function up149(db) {
16306
16329
  db.exec(`
16307
16330
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16308
16331
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16369,16 +16392,16 @@ function up148(db) {
16369
16392
  }
16370
16393
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
16371
16394
  }
16372
- function up149(db) {
16395
+ function up150(db) {
16373
16396
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16374
16397
  }
16375
- function up150(db) {
16398
+ function up151(db) {
16376
16399
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16377
16400
  if (!columns.some((column) => column.name === "source_id")) {
16378
16401
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
16379
16402
  }
16380
16403
  }
16381
- function up151(db) {
16404
+ function up152(db) {
16382
16405
  const addColumn = (table, column, definition) => {
16383
16406
  const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16384
16407
  let exists;
@@ -16394,14 +16417,14 @@ function up151(db) {
16394
16417
  addColumn("source_import_jobs", "next_attempt_at", "TEXT");
16395
16418
  addColumn("source_import_files", "error", "TEXT");
16396
16419
  }
16397
- function addColumnIfMissing28(db, table, column, definition) {
16420
+ function addColumnIfMissing29(db, table, column, definition) {
16398
16421
  const columns = db.prepare(`PRAGMA table_info(${table})`).all();
16399
16422
  if (!columns.some((row) => row.name === column))
16400
16423
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16401
16424
  }
16402
- function up152(db) {
16403
- addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16404
- addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
16425
+ function up153(db) {
16426
+ addColumnIfMissing29(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16427
+ addColumnIfMissing29(db, "dreaming_passes", "head_base_revision", "INTEGER");
16405
16428
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
16406
16429
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_md_heads_content_hash ON memory_md_heads(content_hash)");
16407
16430
  db.exec(`
@@ -16549,7 +16572,7 @@ function up152(db) {
16549
16572
  `);
16550
16573
  }
16551
16574
  }
16552
- function up153(db) {
16575
+ function up154(db) {
16553
16576
  db.exec(`
16554
16577
  CREATE TABLE IF NOT EXISTS vector_repair_checkpoints (
16555
16578
  operation TEXT NOT NULL CHECK (operation IN ('resync', 'clean-orphans')),
@@ -16578,13 +16601,13 @@ var MIGRATIONS = [
16578
16601
  {
16579
16602
  version: 1,
16580
16603
  name: "baseline",
16581
- up: up3,
16604
+ up: up4,
16582
16605
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16583
16606
  },
16584
16607
  {
16585
16608
  version: 2,
16586
16609
  name: "pipeline-v2",
16587
- up: up4,
16610
+ up: up5,
16588
16611
  artifacts: {
16589
16612
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16590
16613
  }
@@ -16592,12 +16615,12 @@ var MIGRATIONS = [
16592
16615
  {
16593
16616
  version: 3,
16594
16617
  name: "unique-content-hash",
16595
- up: up5
16618
+ up: up6
16596
16619
  },
16597
16620
  {
16598
16621
  version: 4,
16599
16622
  name: "history-actor-and-retention",
16600
- up: up6,
16623
+ up: up7,
16601
16624
  artifacts: {
16602
16625
  columns: [{ table: "memory_history", column: "actor_type" }]
16603
16626
  }
@@ -16605,7 +16628,7 @@ var MIGRATIONS = [
16605
16628
  {
16606
16629
  version: 5,
16607
16630
  name: "graph-extended",
16608
- up: up7,
16631
+ up: up8,
16609
16632
  artifacts: {
16610
16633
  columns: [{ table: "entities", column: "canonical_name" }]
16611
16634
  }
@@ -16613,7 +16636,7 @@ var MIGRATIONS = [
16613
16636
  {
16614
16637
  version: 6,
16615
16638
  name: "idempotency-key",
16616
- up: up8,
16639
+ up: up9,
16617
16640
  artifacts: {
16618
16641
  columns: [{ table: "memories", column: "idempotency_key" }]
16619
16642
  }
@@ -16621,42 +16644,42 @@ var MIGRATIONS = [
16621
16644
  {
16622
16645
  version: 7,
16623
16646
  name: "documents-and-connectors",
16624
- up: up9,
16647
+ up: up10,
16625
16648
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16626
16649
  },
16627
16650
  {
16628
16651
  version: 8,
16629
16652
  name: "embeddings-unique-hash",
16630
- up: up10
16653
+ up: up11
16631
16654
  },
16632
16655
  {
16633
16656
  version: 9,
16634
16657
  name: "summary-jobs",
16635
- up: up11,
16658
+ up: up12,
16636
16659
  artifacts: { tables: ["summary_jobs"] }
16637
16660
  },
16638
16661
  {
16639
16662
  version: 10,
16640
16663
  name: "umap-cache",
16641
- up: up12,
16664
+ up: up13,
16642
16665
  artifacts: { tables: ["umap_cache"] }
16643
16666
  },
16644
16667
  {
16645
16668
  version: 11,
16646
16669
  name: "session-scores",
16647
- up: up13,
16670
+ up: up14,
16648
16671
  artifacts: { tables: ["session_scores"] }
16649
16672
  },
16650
16673
  {
16651
16674
  version: 12,
16652
16675
  name: "scheduled-tasks",
16653
- up: up14,
16676
+ up: up15,
16654
16677
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16655
16678
  },
16656
16679
  {
16657
16680
  version: 13,
16658
16681
  name: "ingestion-tracking",
16659
- up: up15,
16682
+ up: up16,
16660
16683
  artifacts: {
16661
16684
  columns: [
16662
16685
  { table: "memories", column: "source_path" },
@@ -16667,13 +16690,13 @@ var MIGRATIONS = [
16667
16690
  {
16668
16691
  version: 14,
16669
16692
  name: "telemetry",
16670
- up: up16,
16693
+ up: up17,
16671
16694
  artifacts: { tables: ["telemetry_events"] }
16672
16695
  },
16673
16696
  {
16674
16697
  version: 15,
16675
16698
  name: "session-memories",
16676
- up: up17,
16699
+ up: up18,
16677
16700
  artifacts: {
16678
16701
  tables: ["session_memories"],
16679
16702
  columns: [
@@ -16685,13 +16708,13 @@ var MIGRATIONS = [
16685
16708
  {
16686
16709
  version: 16,
16687
16710
  name: "session-checkpoints",
16688
- up: up18,
16711
+ up: up19,
16689
16712
  artifacts: { tables: ["session_checkpoints"] }
16690
16713
  },
16691
16714
  {
16692
16715
  version: 17,
16693
16716
  name: "task-skills",
16694
- up: up19,
16717
+ up: up20,
16695
16718
  artifacts: {
16696
16719
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16697
16720
  }
@@ -16699,13 +16722,13 @@ var MIGRATIONS = [
16699
16722
  {
16700
16723
  version: 18,
16701
16724
  name: "skill-meta",
16702
- up: up20,
16725
+ up: up21,
16703
16726
  artifacts: { tables: ["skill_meta"] }
16704
16727
  },
16705
16728
  {
16706
16729
  version: 19,
16707
16730
  name: "knowledge-structure",
16708
- up: up21,
16731
+ up: up22,
16709
16732
  artifacts: {
16710
16733
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16711
16734
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16714,7 +16737,7 @@ var MIGRATIONS = [
16714
16737
  {
16715
16738
  version: 20,
16716
16739
  name: "session-structural-columns",
16717
- up: up22,
16740
+ up: up23,
16718
16741
  artifacts: {
16719
16742
  columns: [
16720
16743
  { table: "session_memories", column: "entity_slot" },
@@ -16727,7 +16750,7 @@ var MIGRATIONS = [
16727
16750
  {
16728
16751
  version: 21,
16729
16752
  name: "checkpoint-structural",
16730
- up: up23,
16753
+ up: up24,
16731
16754
  artifacts: {
16732
16755
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16733
16756
  }
@@ -16735,7 +16758,7 @@ var MIGRATIONS = [
16735
16758
  {
16736
16759
  version: 22,
16737
16760
  name: "entity-pinning",
16738
- up: up24,
16761
+ up: up25,
16739
16762
  artifacts: {
16740
16763
  columns: [
16741
16764
  { table: "entities", column: "pinned" },
@@ -16746,17 +16769,17 @@ var MIGRATIONS = [
16746
16769
  {
16747
16770
  version: 23,
16748
16771
  name: "retired-scorer-gap",
16749
- up: up25
16772
+ up: up26
16750
16773
  },
16751
16774
  {
16752
16775
  version: 24,
16753
16776
  name: "retired-scorer-gap",
16754
- up: up26
16777
+ up: up27
16755
16778
  },
16756
16779
  {
16757
16780
  version: 25,
16758
16781
  name: "agent-feedback",
16759
- up: up27,
16782
+ up: up28,
16760
16783
  artifacts: {
16761
16784
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16762
16785
  }
@@ -16764,32 +16787,32 @@ var MIGRATIONS = [
16764
16787
  {
16765
16788
  version: 26,
16766
16789
  name: "retired-scorer-gap",
16767
- up: up28
16790
+ up: up29
16768
16791
  },
16769
16792
  {
16770
16793
  version: 27,
16771
16794
  name: "backfill-canonical-names",
16772
- up: up29
16795
+ up: up30
16773
16796
  },
16774
16797
  {
16775
16798
  version: 28,
16776
16799
  name: "lossless-retention",
16777
- up: up30
16800
+ up: up31
16778
16801
  },
16779
16802
  {
16780
16803
  version: 29,
16781
16804
  name: "session-summary-dag",
16782
- up: up31
16805
+ up: up32
16783
16806
  },
16784
16807
  {
16785
16808
  version: 30,
16786
16809
  name: "nullable-memory-job-memory-id",
16787
- up: up32
16810
+ up: up33
16788
16811
  },
16789
16812
  {
16790
16813
  version: 31,
16791
16814
  name: "dependency-reason",
16792
- up: up33,
16815
+ up: up34,
16793
16816
  artifacts: {
16794
16817
  columns: [
16795
16818
  { table: "entity_dependencies", column: "reason" },
@@ -16800,7 +16823,7 @@ var MIGRATIONS = [
16800
16823
  {
16801
16824
  version: 32,
16802
16825
  name: "embeddings-vector-column",
16803
- up: up34,
16826
+ up: up35,
16804
16827
  artifacts: {
16805
16828
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16806
16829
  }
@@ -16808,7 +16831,7 @@ var MIGRATIONS = [
16808
16831
  {
16809
16832
  version: 33,
16810
16833
  name: "scope",
16811
- up: up35,
16834
+ up: up36,
16812
16835
  artifacts: {
16813
16836
  columns: [{ table: "memories", column: "scope" }]
16814
16837
  }
@@ -16816,17 +16839,17 @@ var MIGRATIONS = [
16816
16839
  {
16817
16840
  version: 34,
16818
16841
  name: "scope-aware-dedup",
16819
- up: up36
16842
+ up: up37
16820
16843
  },
16821
16844
  {
16822
16845
  version: 35,
16823
16846
  name: "entity-fts",
16824
- up: up37
16847
+ up: up38
16825
16848
  },
16826
16849
  {
16827
16850
  version: 36,
16828
16851
  name: "dependency-confidence",
16829
- up: up38,
16852
+ up: up39,
16830
16853
  artifacts: {
16831
16854
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16832
16855
  }
@@ -16834,7 +16857,7 @@ var MIGRATIONS = [
16834
16857
  {
16835
16858
  version: 37,
16836
16859
  name: "entity-communities",
16837
- up: up39,
16860
+ up: up40,
16838
16861
  artifacts: {
16839
16862
  tables: ["entity_communities"],
16840
16863
  columns: [{ table: "entities", column: "community_id" }]
@@ -16843,24 +16866,24 @@ var MIGRATIONS = [
16843
16866
  {
16844
16867
  version: 38,
16845
16868
  name: "memory-hints",
16846
- up: up40,
16869
+ up: up41,
16847
16870
  artifacts: { tables: ["memory_hints"] }
16848
16871
  },
16849
16872
  {
16850
16873
  version: 39,
16851
16874
  name: "dedup-entity-dependencies",
16852
- up: up41
16875
+ up: up42
16853
16876
  },
16854
16877
  {
16855
16878
  version: 40,
16856
16879
  name: "session-transcripts",
16857
- up: up42,
16880
+ up: up43,
16858
16881
  artifacts: { tables: ["session_transcripts"] }
16859
16882
  },
16860
16883
  {
16861
16884
  version: 41,
16862
16885
  name: "path-feedback",
16863
- up: up43,
16886
+ up: up44,
16864
16887
  artifacts: {
16865
16888
  tables: [
16866
16889
  "path_feedback_events",
@@ -16875,7 +16898,7 @@ var MIGRATIONS = [
16875
16898
  {
16876
16899
  version: 42,
16877
16900
  name: "session-memories-agent-id",
16878
- up: up44,
16901
+ up: up45,
16879
16902
  artifacts: {
16880
16903
  columns: [{ table: "session_memories", column: "agent_id" }]
16881
16904
  }
@@ -16883,7 +16906,7 @@ var MIGRATIONS = [
16883
16906
  {
16884
16907
  version: 43,
16885
16908
  name: "agents-table",
16886
- up: up45,
16909
+ up: up46,
16887
16910
  artifacts: {
16888
16911
  tables: ["agents"],
16889
16912
  columns: [
@@ -16895,7 +16918,7 @@ var MIGRATIONS = [
16895
16918
  {
16896
16919
  version: 44,
16897
16920
  name: "memory-md-temporal-head",
16898
- up: up46,
16921
+ up: up47,
16899
16922
  artifacts: {
16900
16923
  columns: [
16901
16924
  { table: "session_summaries", column: "source_type" },
@@ -16907,7 +16930,7 @@ var MIGRATIONS = [
16907
16930
  {
16908
16931
  version: 45,
16909
16932
  name: "lossless-working-memory-hardening",
16910
- up: up47,
16933
+ up: up48,
16911
16934
  artifacts: {
16912
16935
  tables: ["session_transcripts_fts", "memory_md_heads"],
16913
16936
  columns: [
@@ -16920,17 +16943,17 @@ var MIGRATIONS = [
16920
16943
  {
16921
16944
  version: 46,
16922
16945
  name: "session-summary-uniqueness",
16923
- up: up48
16946
+ up: up49
16924
16947
  },
16925
16948
  {
16926
16949
  version: 47,
16927
16950
  name: "agent-scoped-temporal-uniqueness",
16928
- up: up49
16951
+ up: up50
16929
16952
  },
16930
16953
  {
16931
16954
  version: 48,
16932
16955
  name: "thread-heads",
16933
- up: up50,
16956
+ up: up51,
16934
16957
  artifacts: {
16935
16958
  tables: ["memory_thread_heads"]
16936
16959
  }
@@ -16938,7 +16961,7 @@ var MIGRATIONS = [
16938
16961
  {
16939
16962
  version: 49,
16940
16963
  name: "session-extract-cursors",
16941
- up: up51,
16964
+ up: up52,
16942
16965
  artifacts: {
16943
16966
  tables: ["session_extract_cursors"]
16944
16967
  }
@@ -16946,7 +16969,7 @@ var MIGRATIONS = [
16946
16969
  {
16947
16970
  version: 50,
16948
16971
  name: "related-to-audit",
16949
- up: up52,
16972
+ up: up53,
16950
16973
  artifacts: {
16951
16974
  tables: ["entity_dependency_history"]
16952
16975
  }
@@ -16954,7 +16977,7 @@ var MIGRATIONS = [
16954
16977
  {
16955
16978
  version: 51,
16956
16979
  name: "memory-md-rolling-window-lineage",
16957
- up: up53,
16980
+ up: up54,
16958
16981
  artifacts: {
16959
16982
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16960
16983
  columns: [
@@ -16969,7 +16992,7 @@ var MIGRATIONS = [
16969
16992
  {
16970
16993
  version: 52,
16971
16994
  name: "mcp-invocations",
16972
- up: up54,
16995
+ up: up55,
16973
16996
  artifacts: {
16974
16997
  tables: ["mcp_invocations"]
16975
16998
  }
@@ -16977,7 +17000,7 @@ var MIGRATIONS = [
16977
17000
  {
16978
17001
  version: 53,
16979
17002
  name: "skill-invocations",
16980
- up: up55,
17003
+ up: up56,
16981
17004
  artifacts: {
16982
17005
  tables: ["skill_invocations"]
16983
17006
  }
@@ -16985,7 +17008,7 @@ var MIGRATIONS = [
16985
17008
  {
16986
17009
  version: 54,
16987
17010
  name: "task-agent-scope",
16988
- up: up56,
17011
+ up: up57,
16989
17012
  artifacts: {
16990
17013
  tables: ["task_scope_hints"]
16991
17014
  }
@@ -16993,7 +17016,7 @@ var MIGRATIONS = [
16993
17016
  {
16994
17017
  version: 55,
16995
17018
  name: "dreaming-state",
16996
- up: up57,
17019
+ up: up58,
16997
17020
  artifacts: {
16998
17021
  tables: ["dreaming_state", "dreaming_passes"]
16999
17022
  }
@@ -17001,22 +17024,22 @@ var MIGRATIONS = [
17001
17024
  {
17002
17025
  version: 56,
17003
17026
  name: "agent-scoped-content-hash",
17004
- up: up58
17027
+ up: up59
17005
17028
  },
17006
17029
  {
17007
17030
  version: 57,
17008
17031
  name: "memories-fts-tokenizer-repair",
17009
- up: up59
17032
+ up: up60
17010
17033
  },
17011
17034
  {
17012
17035
  version: 58,
17013
17036
  name: "knowledge-graph-indices",
17014
- up: up60
17037
+ up: up61
17015
17038
  },
17016
17039
  {
17017
17040
  version: 59,
17018
17041
  name: "entity-attribute-claim-key",
17019
- up: up61,
17042
+ up: up62,
17020
17043
  artifacts: {
17021
17044
  columns: [{ table: "entity_attributes", column: "claim_key" }]
17022
17045
  }
@@ -17024,7 +17047,7 @@ var MIGRATIONS = [
17024
17047
  {
17025
17048
  version: 60,
17026
17049
  name: "entity-attribute-group-key",
17027
- up: up62,
17050
+ up: up63,
17028
17051
  artifacts: {
17029
17052
  columns: [{ table: "entity_attributes", column: "group_key" }]
17030
17053
  }
@@ -17032,7 +17055,7 @@ var MIGRATIONS = [
17032
17055
  {
17033
17056
  version: 61,
17034
17057
  name: "memory-artifact-source-mtime",
17035
- up: up63,
17058
+ up: up64,
17036
17059
  artifacts: {
17037
17060
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
17038
17061
  }
@@ -17040,7 +17063,7 @@ var MIGRATIONS = [
17040
17063
  {
17041
17064
  version: 62,
17042
17065
  name: "memory-artifact-soft-delete",
17043
- up: up64,
17066
+ up: up65,
17044
17067
  artifacts: {
17045
17068
  columns: [
17046
17069
  { table: "memory_artifacts", column: "is_deleted" },
@@ -17051,12 +17074,12 @@ var MIGRATIONS = [
17051
17074
  {
17052
17075
  version: 63,
17053
17076
  name: "content-only-memories-fts-update",
17054
- up: up65
17077
+ up: up66
17055
17078
  },
17056
17079
  {
17057
17080
  version: 64,
17058
17081
  name: "source-graph-provenance",
17059
- up: up66,
17082
+ up: up67,
17060
17083
  artifacts: {
17061
17084
  columns: [
17062
17085
  { table: "entities", column: "source_path" },
@@ -17069,7 +17092,7 @@ var MIGRATIONS = [
17069
17092
  {
17070
17093
  version: 65,
17071
17094
  name: "source-embedding-agent-scope",
17072
- up: up67,
17095
+ up: up68,
17073
17096
  artifacts: {
17074
17097
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
17075
17098
  }
@@ -17077,7 +17100,7 @@ var MIGRATIONS = [
17077
17100
  {
17078
17101
  version: 66,
17079
17102
  name: "memory-search-telemetry",
17080
- up: up68,
17103
+ up: up69,
17081
17104
  artifacts: {
17082
17105
  tables: ["memory_search_telemetry"]
17083
17106
  }
@@ -17085,7 +17108,7 @@ var MIGRATIONS = [
17085
17108
  {
17086
17109
  version: 67,
17087
17110
  name: "ontology-proposals",
17088
- up: up69,
17111
+ up: up70,
17089
17112
  artifacts: {
17090
17113
  tables: ["ontology_proposals"],
17091
17114
  columns: [
@@ -17099,7 +17122,7 @@ var MIGRATIONS = [
17099
17122
  {
17100
17123
  version: 68,
17101
17124
  name: "daily-reflections",
17102
- up: up70,
17125
+ up: up71,
17103
17126
  artifacts: {
17104
17127
  tables: ["daily_reflections"]
17105
17128
  }
@@ -17107,7 +17130,7 @@ var MIGRATIONS = [
17107
17130
  {
17108
17131
  version: 69,
17109
17132
  name: "daily-reflections-multiple-insights",
17110
- up: up71,
17133
+ up: up72,
17111
17134
  artifacts: {
17112
17135
  tables: ["daily_reflections"]
17113
17136
  }
@@ -17115,7 +17138,7 @@ var MIGRATIONS = [
17115
17138
  {
17116
17139
  version: 70,
17117
17140
  name: "ontology-control-plane-state",
17118
- up: up72,
17141
+ up: up73,
17119
17142
  artifacts: {
17120
17143
  columns: [
17121
17144
  { table: "entities", column: "status" },
@@ -17130,7 +17153,7 @@ var MIGRATIONS = [
17130
17153
  {
17131
17154
  version: 71,
17132
17155
  name: "epistemic-assertions",
17133
- up: up73,
17156
+ up: up74,
17134
17157
  artifacts: {
17135
17158
  tables: ["epistemic_assertions"]
17136
17159
  }
@@ -17138,7 +17161,7 @@ var MIGRATIONS = [
17138
17161
  {
17139
17162
  version: 72,
17140
17163
  name: "agent-scoped-idempotency-key",
17141
- up: up74,
17164
+ up: up75,
17142
17165
  artifacts: {
17143
17166
  columns: [
17144
17167
  { table: "memories", column: "idempotency_key" },
@@ -17149,7 +17172,7 @@ var MIGRATIONS = [
17149
17172
  {
17150
17173
  version: 73,
17151
17174
  name: "recall-context-dedupe",
17152
- up: up75,
17175
+ up: up76,
17153
17176
  artifacts: {
17154
17177
  tables: ["session_context_epochs", "session_recall_events"]
17155
17178
  }
@@ -17157,7 +17180,7 @@ var MIGRATIONS = [
17157
17180
  {
17158
17181
  version: 74,
17159
17182
  name: "aggregate-memory-links",
17160
- up: up76,
17183
+ up: up77,
17161
17184
  artifacts: {
17162
17185
  tables: ["aggregate_memory_sources"]
17163
17186
  }
@@ -17165,7 +17188,7 @@ var MIGRATIONS = [
17165
17188
  {
17166
17189
  version: 75,
17167
17190
  name: "memory-artifact-source-provenance",
17168
- up: up77,
17191
+ up: up78,
17169
17192
  artifacts: {
17170
17193
  columns: [
17171
17194
  { table: "memory_artifacts", column: "source_id" },
@@ -17179,7 +17202,7 @@ var MIGRATIONS = [
17179
17202
  {
17180
17203
  version: 76,
17181
17204
  name: "temporal-edges",
17182
- up: up78,
17205
+ up: up79,
17183
17206
  artifacts: {
17184
17207
  tables: ["temporal_edges"]
17185
17208
  }
@@ -17187,7 +17210,7 @@ var MIGRATIONS = [
17187
17210
  {
17188
17211
  version: 77,
17189
17212
  name: "entity-aliases",
17190
- up: up79,
17213
+ up: up80,
17191
17214
  artifacts: {
17192
17215
  tables: ["entity_aliases"]
17193
17216
  }
@@ -17195,7 +17218,7 @@ var MIGRATIONS = [
17195
17218
  {
17196
17219
  version: 78,
17197
17220
  name: "api-keys",
17198
- up: up80,
17221
+ up: up81,
17199
17222
  artifacts: {
17200
17223
  tables: ["api_keys"]
17201
17224
  }
@@ -17203,7 +17226,7 @@ var MIGRATIONS = [
17203
17226
  {
17204
17227
  version: 79,
17205
17228
  name: "transcript-capture-jobs",
17206
- up: up81,
17229
+ up: up82,
17207
17230
  artifacts: {
17208
17231
  tables: ["transcript_capture_jobs"]
17209
17232
  }
@@ -17211,7 +17234,7 @@ var MIGRATIONS = [
17211
17234
  {
17212
17235
  version: 80,
17213
17236
  name: "document-scope-columns",
17214
- up: up82,
17237
+ up: up83,
17215
17238
  artifacts: {
17216
17239
  columns: [
17217
17240
  { table: "documents", column: "agent_id" },
@@ -17222,7 +17245,7 @@ var MIGRATIONS = [
17222
17245
  {
17223
17246
  version: 81,
17224
17247
  name: "aggregate-evidence-sources",
17225
- up: up83,
17248
+ up: up84,
17226
17249
  artifacts: {
17227
17250
  tables: ["aggregate_evidence_sources"]
17228
17251
  }
@@ -17230,7 +17253,7 @@ var MIGRATIONS = [
17230
17253
  {
17231
17254
  version: 82,
17232
17255
  name: "skill-invocations-harness",
17233
- up: up84,
17256
+ up: up85,
17234
17257
  artifacts: {
17235
17258
  columns: [
17236
17259
  { table: "skill_invocations", column: "harness" },
@@ -17241,7 +17264,7 @@ var MIGRATIONS = [
17241
17264
  {
17242
17265
  version: 83,
17243
17266
  name: "memory-lifecycle-repair",
17244
- up: up85,
17267
+ up: up86,
17245
17268
  artifacts: {
17246
17269
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17247
17270
  columns: [
@@ -17256,7 +17279,7 @@ var MIGRATIONS = [
17256
17279
  {
17257
17280
  version: 84,
17258
17281
  name: "legacy-markdown-import-state",
17259
- up: up86,
17282
+ up: up87,
17260
17283
  artifacts: {
17261
17284
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17262
17285
  }
@@ -17264,7 +17287,7 @@ var MIGRATIONS = [
17264
17287
  {
17265
17288
  version: 85,
17266
17289
  name: "backfill-relations-to-dependencies",
17267
- up: up87,
17290
+ up: up88,
17268
17291
  artifacts: {
17269
17292
  tables: ["entity_dependencies"]
17270
17293
  }
@@ -17272,7 +17295,7 @@ var MIGRATIONS = [
17272
17295
  {
17273
17296
  version: 86,
17274
17297
  name: "summary-jobs-content-hash",
17275
- up: up88,
17298
+ up: up89,
17276
17299
  artifacts: {
17277
17300
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17278
17301
  }
@@ -17280,7 +17303,7 @@ var MIGRATIONS = [
17280
17303
  {
17281
17304
  version: 87,
17282
17305
  name: "summary-jobs-boundary-reason",
17283
- up: up89,
17306
+ up: up90,
17284
17307
  artifacts: {
17285
17308
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17286
17309
  }
@@ -17288,7 +17311,7 @@ var MIGRATIONS = [
17288
17311
  {
17289
17312
  version: 88,
17290
17313
  name: "transcript-recovery-files",
17291
- up: up90,
17314
+ up: up91,
17292
17315
  artifacts: {
17293
17316
  tables: ["transcript_recovery_files"]
17294
17317
  }
@@ -17296,7 +17319,7 @@ var MIGRATIONS = [
17296
17319
  {
17297
17320
  version: 89,
17298
17321
  name: "job-cancellations",
17299
- up: up91,
17322
+ up: up92,
17300
17323
  artifacts: {
17301
17324
  tables: ["job_cancellations"]
17302
17325
  }
@@ -17304,7 +17327,7 @@ var MIGRATIONS = [
17304
17327
  {
17305
17328
  version: 90,
17306
17329
  name: "job-archive",
17307
- up: up92,
17330
+ up: up93,
17308
17331
  artifacts: {
17309
17332
  tables: ["job_archive"]
17310
17333
  }
@@ -17312,25 +17335,25 @@ var MIGRATIONS = [
17312
17335
  {
17313
17336
  version: 91,
17314
17337
  name: "embedding-index-generations",
17315
- up: up93,
17338
+ up: up94,
17316
17339
  artifacts: { tables: ["embedding_index_state"] }
17317
17340
  },
17318
17341
  {
17319
17342
  version: 92,
17320
17343
  name: "embedding-staging-store",
17321
- up: up94,
17344
+ up: up95,
17322
17345
  artifacts: { tables: ["embeddings_staging"] }
17323
17346
  },
17324
17347
  {
17325
17348
  version: 93,
17326
17349
  name: "dreaming-evidence-cursor",
17327
- up: up95,
17350
+ up: up96,
17328
17351
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17329
17352
  },
17330
17353
  {
17331
17354
  version: 94,
17332
17355
  name: "memory-kind",
17333
- up: up96,
17356
+ up: up97,
17334
17357
  artifacts: {
17335
17358
  columns: [
17336
17359
  { table: "memories", column: "memory_kind" },
@@ -17341,35 +17364,35 @@ var MIGRATIONS = [
17341
17364
  {
17342
17365
  version: 95,
17343
17366
  name: "compaction-recall-projections",
17344
- up: up97
17367
+ up: up98
17345
17368
  },
17346
17369
  {
17347
17370
  version: 96,
17348
17371
  name: "retire-legacy-ingestion",
17349
- up: up98
17372
+ up: up99
17350
17373
  },
17351
17374
  {
17352
17375
  version: 97,
17353
17376
  name: "dreaming-failure-backoff",
17354
- up: up99,
17377
+ up: up100,
17355
17378
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17356
17379
  },
17357
17380
  {
17358
17381
  version: 98,
17359
17382
  name: "dreaming-evidence-exclusions",
17360
- up: up100,
17383
+ up: up101,
17361
17384
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17362
17385
  },
17363
17386
  {
17364
17387
  version: 99,
17365
17388
  name: "dreaming-tool-calls",
17366
- up: up101,
17389
+ up: up102,
17367
17390
  artifacts: { tables: ["dreaming_tool_calls"] }
17368
17391
  },
17369
17392
  {
17370
17393
  version: 100,
17371
17394
  name: "dreaming-runbook",
17372
- up: up102,
17395
+ up: up103,
17373
17396
  artifacts: {
17374
17397
  columns: [
17375
17398
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17380,23 +17403,23 @@ var MIGRATIONS = [
17380
17403
  {
17381
17404
  version: 101,
17382
17405
  name: "dreaming-attention",
17383
- up: up103,
17406
+ up: up104,
17384
17407
  artifacts: { tables: ["dreaming_attention"] }
17385
17408
  },
17386
17409
  {
17387
17410
  version: 102,
17388
17411
  name: "attribute-semantic-memories",
17389
- up: up104
17412
+ up: up105
17390
17413
  },
17391
17414
  {
17392
17415
  version: 103,
17393
17416
  name: "semantic-memory-kind",
17394
- up: up105
17417
+ up: up106
17395
17418
  },
17396
17419
  {
17397
17420
  version: 104,
17398
17421
  name: "derived-memory-provenance",
17399
- up: up106,
17422
+ up: up107,
17400
17423
  artifacts: {
17401
17424
  tables: ["derived_memory_sources"],
17402
17425
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17405,12 +17428,12 @@ var MIGRATIONS = [
17405
17428
  {
17406
17429
  version: 105,
17407
17430
  name: "agent-scoped-entity-name",
17408
- up: up107
17431
+ up: up108
17409
17432
  },
17410
17433
  {
17411
17434
  version: 106,
17412
17435
  name: "memory-review-after",
17413
- up: up108,
17436
+ up: up109,
17414
17437
  artifacts: {
17415
17438
  columns: [{ table: "memories", column: "review_after" }]
17416
17439
  }
@@ -17418,7 +17441,7 @@ var MIGRATIONS = [
17418
17441
  {
17419
17442
  version: 107,
17420
17443
  name: "dreaming-pass-usage",
17421
- up: up109,
17444
+ up: up110,
17422
17445
  artifacts: {
17423
17446
  columns: [
17424
17447
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17432,7 +17455,7 @@ var MIGRATIONS = [
17432
17455
  {
17433
17456
  version: 108,
17434
17457
  name: "embedding-usage",
17435
- up: up110,
17458
+ up: up111,
17436
17459
  artifacts: {
17437
17460
  tables: ["embedding_usage"]
17438
17461
  }
@@ -17440,7 +17463,7 @@ var MIGRATIONS = [
17440
17463
  {
17441
17464
  version: 109,
17442
17465
  name: "telemetry-install",
17443
- up: up111,
17466
+ up: up112,
17444
17467
  artifacts: {
17445
17468
  tables: ["telemetry_install"]
17446
17469
  }
@@ -17448,12 +17471,12 @@ var MIGRATIONS = [
17448
17471
  {
17449
17472
  version: 110,
17450
17473
  name: "memory-mention-join-index",
17451
- up: up112
17474
+ up: up113
17452
17475
  },
17453
17476
  {
17454
17477
  version: 111,
17455
17478
  name: "telemetry-first-use",
17456
- up: up113,
17479
+ up: up114,
17457
17480
  artifacts: {
17458
17481
  columns: [
17459
17482
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17464,7 +17487,7 @@ var MIGRATIONS = [
17464
17487
  {
17465
17488
  version: 112,
17466
17489
  name: "telemetry-queue-ownership",
17467
- up: up114,
17490
+ up: up115,
17468
17491
  artifacts: {
17469
17492
  columns: [
17470
17493
  { table: "telemetry_events", column: "source" },
@@ -17476,7 +17499,7 @@ var MIGRATIONS = [
17476
17499
  {
17477
17500
  version: 113,
17478
17501
  name: "session-claims",
17479
- up: up115,
17502
+ up: up116,
17480
17503
  artifacts: {
17481
17504
  tables: ["session_claims"],
17482
17505
  columns: [
@@ -17490,12 +17513,12 @@ var MIGRATIONS = [
17490
17513
  {
17491
17514
  version: 114,
17492
17515
  name: "memory-traversal-hydration-index",
17493
- up: up116
17516
+ up: up117
17494
17517
  },
17495
17518
  {
17496
17519
  version: 115,
17497
17520
  name: "cross-agent-message-notifications",
17498
- up: up117,
17521
+ up: up118,
17499
17522
  artifacts: {
17500
17523
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17501
17524
  }
@@ -17503,7 +17526,7 @@ var MIGRATIONS = [
17503
17526
  {
17504
17527
  version: 116,
17505
17528
  name: "acp-delivery-reconciliation",
17506
- up: up118,
17529
+ up: up119,
17507
17530
  artifacts: {
17508
17531
  columns: [
17509
17532
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17517,7 +17540,7 @@ var MIGRATIONS = [
17517
17540
  {
17518
17541
  version: 117,
17519
17542
  name: "retire-summary-worker",
17520
- up: up119,
17543
+ up: up120,
17521
17544
  artifacts: {
17522
17545
  columns: [
17523
17546
  { table: "session_transcripts", column: "completed_at" },
@@ -17528,24 +17551,24 @@ var MIGRATIONS = [
17528
17551
  {
17529
17552
  version: 118,
17530
17553
  name: "queue-pressure-indices",
17531
- up: up120
17554
+ up: up121
17532
17555
  },
17533
17556
  {
17534
17557
  version: 119,
17535
17558
  name: "telemetry-version-observation",
17536
- up: up121,
17559
+ up: up122,
17537
17560
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17538
17561
  },
17539
17562
  {
17540
17563
  version: 120,
17541
17564
  name: "source-lifecycle-telemetry",
17542
- up: up122,
17565
+ up: up123,
17543
17566
  artifacts: { tables: ["source_lifecycle_state"] }
17544
17567
  },
17545
17568
  {
17546
17569
  version: 121,
17547
17570
  name: "telemetry-delivery-health",
17548
- up: up123,
17571
+ up: up124,
17549
17572
  artifacts: {
17550
17573
  tables: ["telemetry_delivery_state"],
17551
17574
  columns: [
@@ -17559,7 +17582,7 @@ var MIGRATIONS = [
17559
17582
  {
17560
17583
  version: 122,
17561
17584
  name: "dreaming-evidence-retry",
17562
- up: up124,
17585
+ up: up125,
17563
17586
  artifacts: {
17564
17587
  columns: [
17565
17588
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17572,13 +17595,13 @@ var MIGRATIONS = [
17572
17595
  {
17573
17596
  version: 123,
17574
17597
  name: "embedding-index-failures",
17575
- up: up125,
17598
+ up: up126,
17576
17599
  artifacts: { tables: ["embedding_index_failures"] }
17577
17600
  },
17578
17601
  {
17579
17602
  version: 124,
17580
17603
  name: "import-derived-lifecycle",
17581
- up: up126,
17604
+ up: up127,
17582
17605
  artifacts: {
17583
17606
  tables: ["imported_source_lifecycle"]
17584
17607
  }
@@ -17586,77 +17609,77 @@ var MIGRATIONS = [
17586
17609
  {
17587
17610
  version: 125,
17588
17611
  name: "memory-content-safety",
17589
- up: up127,
17612
+ up: up128,
17590
17613
  artifacts: { tables: ["memory_content_safety"] }
17591
17614
  },
17592
17615
  {
17593
17616
  version: 126,
17594
17617
  name: "dreaming-surprisal-attention",
17595
- up: up128,
17618
+ up: up129,
17596
17619
  artifacts: { tables: ["dreaming_attention"] }
17597
17620
  },
17598
17621
  {
17599
17622
  version: 127,
17600
17623
  name: "ontology-contradictions",
17601
- up: up129,
17624
+ up: up130,
17602
17625
  artifacts: { tables: ["ontology_contradictions"] }
17603
17626
  },
17604
17627
  {
17605
17628
  version: 128,
17606
17629
  name: "bounded-queue-diagnostics",
17607
- up: up130
17630
+ up: up131
17608
17631
  },
17609
17632
  {
17610
17633
  version: 129,
17611
17634
  name: "retire-structural-jobs",
17612
- up: up131
17635
+ up: up132
17613
17636
  },
17614
17637
  {
17615
17638
  version: 130,
17616
17639
  name: "embedding-repair-state",
17617
- up: up132,
17640
+ up: up133,
17618
17641
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17619
17642
  },
17620
17643
  {
17621
17644
  version: 131,
17622
17645
  name: "dreaming-evidence-consumption",
17623
- up: up133,
17646
+ up: up134,
17624
17647
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17625
17648
  },
17626
17649
  {
17627
17650
  version: 132,
17628
17651
  name: "observer-scoped-epistemic-assertions",
17629
- up: up134,
17652
+ up: up135,
17630
17653
  artifacts: { tables: ["epistemic_assertions"] }
17631
17654
  },
17632
17655
  {
17633
17656
  version: 133,
17634
17657
  name: "dreaming-memory-head",
17635
- up: up135,
17658
+ up: up136,
17636
17659
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17637
17660
  },
17638
17661
  {
17639
17662
  version: 134,
17640
17663
  name: "scope-memory-head-entries",
17641
- up: up136,
17664
+ up: up137,
17642
17665
  artifacts: { tables: ["memory_head_entries"] }
17643
17666
  },
17644
17667
  {
17645
17668
  version: 135,
17646
17669
  name: "memory-head-publication",
17647
- up: up137,
17670
+ up: up138,
17648
17671
  artifacts: { tables: ["memory_head_publications"] }
17649
17672
  },
17650
17673
  {
17651
17674
  version: 136,
17652
17675
  name: "memory-head-revisions",
17653
- up: up138,
17676
+ up: up139,
17654
17677
  artifacts: { tables: ["memory_head_revisions"] }
17655
17678
  },
17656
17679
  {
17657
17680
  version: 137,
17658
17681
  name: "dreaming-head-manifest",
17659
- up: up139,
17682
+ up: up140,
17660
17683
  artifacts: {
17661
17684
  columns: [
17662
17685
  { table: "dreaming_passes", column: "head_revision" },
@@ -17667,7 +17690,7 @@ var MIGRATIONS = [
17667
17690
  {
17668
17691
  version: 138,
17669
17692
  name: "bounded-status-projections",
17670
- up: up140,
17693
+ up: up141,
17671
17694
  artifacts: {
17672
17695
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17673
17696
  }
@@ -17675,31 +17698,31 @@ var MIGRATIONS = [
17675
17698
  {
17676
17699
  version: 139,
17677
17700
  name: "native-source-sync-state",
17678
- up: up141,
17701
+ up: up142,
17679
17702
  artifacts: { tables: ["native_source_sync_state"] }
17680
17703
  },
17681
17704
  {
17682
17705
  version: 140,
17683
17706
  name: "transcript-recovery-frontier",
17684
- up: up142,
17707
+ up: up143,
17685
17708
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17686
17709
  },
17687
17710
  {
17688
17711
  version: 141,
17689
17712
  name: "source-sync-checkpoints",
17690
- up: up143,
17713
+ up: up144,
17691
17714
  artifacts: { tables: ["source_sync_checkpoints"] }
17692
17715
  },
17693
17716
  {
17694
17717
  version: 142,
17695
17718
  name: "source-sync-frontier",
17696
- up: up144,
17719
+ up: up145,
17697
17720
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17698
17721
  },
17699
17722
  {
17700
17723
  version: 143,
17701
17724
  name: "embedding-index-progress",
17702
- up: up145,
17725
+ up: up146,
17703
17726
  artifacts: {
17704
17727
  columns: [
17705
17728
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17715,19 +17738,19 @@ var MIGRATIONS = [
17715
17738
  {
17716
17739
  version: 144,
17717
17740
  name: "memory-job-lease-token",
17718
- up: up146,
17741
+ up: up147,
17719
17742
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17720
17743
  },
17721
17744
  {
17722
17745
  version: 145,
17723
17746
  name: "dreaming-evidence-reviews",
17724
- up: up147,
17747
+ up: up148,
17725
17748
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17726
17749
  },
17727
17750
  {
17728
17751
  version: 146,
17729
17752
  name: "source-transcript-import",
17730
- up: up148,
17753
+ up: up149,
17731
17754
  artifacts: {
17732
17755
  tables: [
17733
17756
  "source_import_jobs",
@@ -17746,19 +17769,19 @@ var MIGRATIONS = [
17746
17769
  {
17747
17770
  version: 147,
17748
17771
  name: "source-import-replay-file-slots",
17749
- up: up149,
17772
+ up: up150,
17750
17773
  artifacts: { tables: ["source_import_files"] }
17751
17774
  },
17752
17775
  {
17753
17776
  version: 148,
17754
17777
  name: "source-import-attempt-provenance",
17755
- up: up150,
17778
+ up: up151,
17756
17779
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17757
17780
  },
17758
17781
  {
17759
17782
  version: 149,
17760
17783
  name: "transcript-import-state-machine",
17761
- up: up151,
17784
+ up: up152,
17762
17785
  artifacts: {
17763
17786
  columns: [
17764
17787
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17770,7 +17793,7 @@ var MIGRATIONS = [
17770
17793
  {
17771
17794
  version: 150,
17772
17795
  name: "memory-head-freshness",
17773
- up: up152,
17796
+ up: up153,
17774
17797
  artifacts: {
17775
17798
  columns: [
17776
17799
  { table: "memory_md_heads", column: "is_current" },
@@ -17816,8 +17839,23 @@ var MIGRATIONS = [
17816
17839
  {
17817
17840
  version: 153,
17818
17841
  name: "vector-repair-checkpoints",
17819
- up: up153,
17842
+ up: up154,
17820
17843
  artifacts: { tables: ["vector_repair_checkpoints"] }
17844
+ },
17845
+ {
17846
+ version: 154,
17847
+ name: "transcript-capture-source-identity",
17848
+ up: up3,
17849
+ artifacts: {
17850
+ columns: [
17851
+ { table: "transcript_capture_jobs", column: "source_identity" },
17852
+ { table: "transcript_capture_jobs", column: "source_sha256" },
17853
+ { table: "transcript_capture_jobs", column: "source_size_bytes" },
17854
+ { table: "transcript_capture_jobs", column: "source_mtime_ms" },
17855
+ { table: "transcript_capture_jobs", column: "source_format" },
17856
+ { table: "transcript_capture_jobs", column: "audit_path" }
17857
+ ]
17858
+ }
17821
17859
  }
17822
17860
  ];
17823
17861
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;