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