@signetai/core 0.221.10 → 0.221.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.
package/dist/index.js CHANGED
@@ -11775,6 +11775,14 @@ function up(db) {
11775
11775
  `);
11776
11776
  }
11777
11777
 
11778
+ // src/migrations/152-memory-artifact-sha-index.ts
11779
+ function up2(db) {
11780
+ db.exec(`
11781
+ DROP INDEX IF EXISTS idx_memory_artifacts_agent_sha;
11782
+ 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)
11783
+ `);
11784
+ }
11785
+
11778
11786
  // src/fts-schema.ts
11779
11787
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11780
11788
  var FTS_STATE_TABLE = "memories_fts_state";
@@ -11942,7 +11950,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11942
11950
  }
11943
11951
 
11944
11952
  // src/migrations/001-baseline.ts
11945
- function up2(db) {
11953
+ function up3(db) {
11946
11954
  db.exec(`
11947
11955
  CREATE TABLE IF NOT EXISTS schema_migrations (
11948
11956
  version INTEGER PRIMARY KEY,
@@ -12042,7 +12050,7 @@ function addColumnIfMissing(db, table, column, definition) {
12042
12050
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12043
12051
  }
12044
12052
  }
12045
- function up3(db) {
12053
+ function up4(db) {
12046
12054
  addColumnIfMissing(db, "memories", "content_hash", "TEXT");
12047
12055
  addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
12048
12056
  addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -12162,7 +12170,7 @@ function addColumnIfMissing2(db, table, column, definition) {
12162
12170
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12163
12171
  return true;
12164
12172
  }
12165
- function up4(db) {
12173
+ function up5(db) {
12166
12174
  addColumnIfMissing2(db, "memories", "why", "TEXT");
12167
12175
  addColumnIfMissing2(db, "memories", "project", "TEXT");
12168
12176
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -12201,7 +12209,7 @@ function addColumnIfMissing3(db, table, column, definition) {
12201
12209
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12202
12210
  }
12203
12211
  }
12204
- function up5(db) {
12212
+ function up6(db) {
12205
12213
  addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
12206
12214
  addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
12207
12215
  addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
@@ -12236,7 +12244,7 @@ function addColumnIfMissing4(db, table, column, definition) {
12236
12244
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12237
12245
  }
12238
12246
  }
12239
- function up6(db) {
12247
+ function up7(db) {
12240
12248
  addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
12241
12249
  addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
12242
12250
  addColumnIfMissing4(db, "entities", "embedding", "BLOB");
@@ -12255,7 +12263,7 @@ function hasColumn4(db, table, column) {
12255
12263
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
12256
12264
  return rows.some((r) => r.name === column);
12257
12265
  }
12258
- function up7(db) {
12266
+ function up8(db) {
12259
12267
  if (!hasColumn4(db, "memories", "idempotency_key")) {
12260
12268
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
12261
12269
  }
@@ -12272,7 +12280,7 @@ function hasColumn5(db, table, column) {
12272
12280
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
12273
12281
  return rows.some((r) => r.name === column);
12274
12282
  }
12275
- function up8(db) {
12283
+ function up9(db) {
12276
12284
  db.exec(`
12277
12285
  CREATE TABLE IF NOT EXISTS documents (
12278
12286
  id TEXT PRIMARY KEY,
@@ -12331,7 +12339,7 @@ function up8(db) {
12331
12339
  }
12332
12340
 
12333
12341
  // src/migrations/008-embeddings-unique-hash.ts
12334
- function up9(db) {
12342
+ function up10(db) {
12335
12343
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
12336
12344
  if (tables.length === 0)
12337
12345
  return;
@@ -12350,7 +12358,7 @@ function up9(db) {
12350
12358
  }
12351
12359
 
12352
12360
  // src/migrations/009-summary-jobs.ts
12353
- function up10(db) {
12361
+ function up11(db) {
12354
12362
  db.exec(`
12355
12363
  CREATE TABLE IF NOT EXISTS summary_jobs (
12356
12364
  id TEXT PRIMARY KEY,
@@ -12372,7 +12380,7 @@ function up10(db) {
12372
12380
  }
12373
12381
 
12374
12382
  // src/migrations/010-umap-cache.ts
12375
- function up11(db) {
12383
+ function up12(db) {
12376
12384
  db.exec(`
12377
12385
  CREATE TABLE IF NOT EXISTS umap_cache (
12378
12386
  id INTEGER PRIMARY KEY,
@@ -12385,7 +12393,7 @@ function up11(db) {
12385
12393
  }
12386
12394
 
12387
12395
  // src/migrations/011-session-scores.ts
12388
- function up12(db) {
12396
+ function up13(db) {
12389
12397
  db.exec(`
12390
12398
  CREATE TABLE IF NOT EXISTS session_scores (
12391
12399
  id TEXT PRIMARY KEY,
@@ -12407,7 +12415,7 @@ function up12(db) {
12407
12415
  }
12408
12416
 
12409
12417
  // src/migrations/012-scheduled-tasks.ts
12410
- function up13(db) {
12418
+ function up14(db) {
12411
12419
  db.exec(`
12412
12420
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
12413
12421
  id TEXT PRIMARY KEY,
@@ -12450,7 +12458,7 @@ function addColumnIfMissing5(db, table, column, definition) {
12450
12458
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12451
12459
  }
12452
12460
  }
12453
- function up14(db) {
12461
+ function up15(db) {
12454
12462
  db.exec(`
12455
12463
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
12456
12464
  id TEXT PRIMARY KEY,
@@ -12478,7 +12486,7 @@ function up14(db) {
12478
12486
  }
12479
12487
 
12480
12488
  // src/migrations/014-telemetry.ts
12481
- function up15(db) {
12489
+ function up16(db) {
12482
12490
  db.exec(`
12483
12491
  CREATE TABLE IF NOT EXISTS telemetry_events (
12484
12492
  id TEXT PRIMARY KEY,
@@ -12505,7 +12513,7 @@ function addColumnIfMissing6(db, table, column, definition) {
12505
12513
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12506
12514
  }
12507
12515
  }
12508
- function up16(db) {
12516
+ function up17(db) {
12509
12517
  db.exec(`
12510
12518
  CREATE TABLE IF NOT EXISTS session_memories (
12511
12519
  id TEXT PRIMARY KEY,
@@ -12534,7 +12542,7 @@ function up16(db) {
12534
12542
  }
12535
12543
 
12536
12544
  // src/migrations/016-session-checkpoints.ts
12537
- function up17(db) {
12545
+ function up18(db) {
12538
12546
  db.exec(`
12539
12547
  CREATE TABLE IF NOT EXISTS session_checkpoints (
12540
12548
  id TEXT PRIMARY KEY,
@@ -12558,7 +12566,7 @@ function up17(db) {
12558
12566
  }
12559
12567
 
12560
12568
  // src/migrations/017-task-skills.ts
12561
- function up18(db) {
12569
+ function up19(db) {
12562
12570
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12563
12571
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
12564
12572
  if (!colNames.has("skill_name")) {
@@ -12571,7 +12579,7 @@ function up18(db) {
12571
12579
  }
12572
12580
 
12573
12581
  // src/migrations/018-skill-meta.ts
12574
- function up19(db) {
12582
+ function up20(db) {
12575
12583
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12576
12584
  if (existing)
12577
12585
  return;
@@ -12605,7 +12613,7 @@ function up19(db) {
12605
12613
  }
12606
12614
 
12607
12615
  // src/migrations/019-knowledge-structure.ts
12608
- function up20(db) {
12616
+ function up21(db) {
12609
12617
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12610
12618
  const entityColNames = new Set(entityCols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
12611
12619
  if (!entityColNames.has("agent_id")) {
@@ -12692,7 +12700,7 @@ function addColumnIfMissing7(db, table, column, definition) {
12692
12700
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12693
12701
  }
12694
12702
  }
12695
- function up21(db) {
12703
+ function up22(db) {
12696
12704
  addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12697
12705
  addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12698
12706
  addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12700,7 +12708,7 @@ function up21(db) {
12700
12708
  }
12701
12709
 
12702
12710
  // src/migrations/021-checkpoint-structural.ts
12703
- function up22(db) {
12711
+ function up23(db) {
12704
12712
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12705
12713
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12706
12714
  if (!columnNames.has("focal_entity_ids")) {
@@ -12727,17 +12735,17 @@ function addColumnIfMissing8(db, table, column, definition) {
12727
12735
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12728
12736
  }
12729
12737
  }
12730
- function up23(db) {
12738
+ function up24(db) {
12731
12739
  addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12732
12740
  addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12733
12741
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12734
12742
  }
12735
12743
 
12736
12744
  // src/migrations/023-predictor-columns.ts
12737
- function up24(_db) {}
12745
+ function up25(_db) {}
12738
12746
 
12739
12747
  // src/migrations/024-predictor-comparison-columns.ts
12740
- function up25(_db) {}
12748
+ function up26(_db) {}
12741
12749
 
12742
12750
  // src/migrations/025-agent-feedback.ts
12743
12751
  function addColumnIfMissing9(db, table, column, definition) {
@@ -12746,16 +12754,16 @@ function addColumnIfMissing9(db, table, column, definition) {
12746
12754
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12747
12755
  }
12748
12756
  }
12749
- function up26(db) {
12757
+ function up27(db) {
12750
12758
  addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12751
12759
  addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12752
12760
  }
12753
12761
 
12754
12762
  // src/migrations/026-predictor-training-pairs.ts
12755
- function up27(_db) {}
12763
+ function up28(_db) {}
12756
12764
 
12757
12765
  // src/migrations/027-backfill-canonical-names.ts
12758
- function up28(db) {
12766
+ function up29(db) {
12759
12767
  db.exec(`
12760
12768
  UPDATE entities
12761
12769
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12766,7 +12774,7 @@ function up28(db) {
12766
12774
  }
12767
12775
 
12768
12776
  // src/migrations/028-lossless-retention.ts
12769
- function up29(db) {
12777
+ function up30(db) {
12770
12778
  db.exec(`
12771
12779
  CREATE TABLE IF NOT EXISTS memories_cold (
12772
12780
  archive_id TEXT PRIMARY KEY,
@@ -12805,7 +12813,7 @@ function up29(db) {
12805
12813
  }
12806
12814
 
12807
12815
  // src/migrations/029-session-summary-dag.ts
12808
- function up30(db) {
12816
+ function up31(db) {
12809
12817
  db.exec(`
12810
12818
  CREATE TABLE IF NOT EXISTS session_summaries (
12811
12819
  id TEXT PRIMARY KEY,
@@ -12852,7 +12860,7 @@ function up30(db) {
12852
12860
  }
12853
12861
 
12854
12862
  // src/migrations/030-nullable-memory-job-memory-id.ts
12855
- function up31(db) {
12863
+ function up32(db) {
12856
12864
  db.exec(`
12857
12865
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12858
12866
  id TEXT PRIMARY KEY,
@@ -12899,7 +12907,7 @@ function up31(db) {
12899
12907
  }
12900
12908
 
12901
12909
  // src/migrations/031-dependency-reason.ts
12902
- function up32(db) {
12910
+ function up33(db) {
12903
12911
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12904
12912
  if (!depCols.some((c) => c.name === "reason")) {
12905
12913
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12911,7 +12919,7 @@ function up32(db) {
12911
12919
  }
12912
12920
 
12913
12921
  // src/migrations/032-embeddings-vector-column.ts
12914
- function up33(db) {
12922
+ function up34(db) {
12915
12923
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12916
12924
  if (cols.length === 0)
12917
12925
  return;
@@ -12921,7 +12929,7 @@ function up33(db) {
12921
12929
  }
12922
12930
 
12923
12931
  // src/migrations/033-scope.ts
12924
- function up34(db) {
12932
+ function up35(db) {
12925
12933
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12926
12934
  if (!cols.some((c) => c.name === "scope")) {
12927
12935
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
@@ -12930,7 +12938,7 @@ function up34(db) {
12930
12938
  }
12931
12939
 
12932
12940
  // src/migrations/034-scope-aware-dedup.ts
12933
- function up35(db) {
12941
+ function up36(db) {
12934
12942
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12935
12943
  db.exec(`
12936
12944
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12940,7 +12948,7 @@ function up35(db) {
12940
12948
  }
12941
12949
 
12942
12950
  // src/migrations/035-entity-fts.ts
12943
- function up36(db) {
12951
+ function up37(db) {
12944
12952
  db.exec(`
12945
12953
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12946
12954
  name, canonical_name,
@@ -12974,7 +12982,7 @@ function up36(db) {
12974
12982
  }
12975
12983
 
12976
12984
  // src/migrations/036-dependency-confidence.ts
12977
- function up37(db) {
12985
+ function up38(db) {
12978
12986
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12979
12987
  if (!cols.some((c) => c.name === "confidence")) {
12980
12988
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
@@ -12982,7 +12990,7 @@ function up37(db) {
12982
12990
  }
12983
12991
 
12984
12992
  // src/migrations/037-entity-communities.ts
12985
- function up38(db) {
12993
+ function up39(db) {
12986
12994
  db.exec(`
12987
12995
  CREATE TABLE IF NOT EXISTS entity_communities (
12988
12996
  id TEXT PRIMARY KEY,
@@ -13002,7 +13010,7 @@ function up38(db) {
13002
13010
  }
13003
13011
 
13004
13012
  // src/migrations/038-memory-hints.ts
13005
- function up39(db) {
13013
+ function up40(db) {
13006
13014
  db.exec(`
13007
13015
  CREATE TABLE IF NOT EXISTS memory_hints (
13008
13016
  id TEXT PRIMARY KEY,
@@ -13044,7 +13052,7 @@ function up39(db) {
13044
13052
  }
13045
13053
 
13046
13054
  // src/migrations/039-dedup-entity-dependencies.ts
13047
- function up40(db) {
13055
+ function up41(db) {
13048
13056
  db.exec(`
13049
13057
  DELETE FROM entity_dependencies
13050
13058
  WHERE id NOT IN (
@@ -13064,7 +13072,7 @@ function up40(db) {
13064
13072
  }
13065
13073
 
13066
13074
  // src/migrations/040-session-transcripts.ts
13067
- function up41(db) {
13075
+ function up42(db) {
13068
13076
  db.exec(`
13069
13077
  CREATE TABLE IF NOT EXISTS session_transcripts (
13070
13078
  session_key TEXT PRIMARY KEY,
@@ -13089,7 +13097,7 @@ function addColumnIfMissing10(db, table, column, definition) {
13089
13097
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13090
13098
  }
13091
13099
  }
13092
- function up42(db) {
13100
+ function up43(db) {
13093
13101
  addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
13094
13102
  db.exec(`
13095
13103
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -13166,7 +13174,7 @@ function addColumnIfMissing11(db, table, column, definition) {
13166
13174
  return;
13167
13175
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13168
13176
  }
13169
- function up43(db) {
13177
+ function up44(db) {
13170
13178
  addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
13171
13179
  addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
13172
13180
  addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -13256,7 +13264,7 @@ function addColumnIfMissing12(db, table, column, definition) {
13256
13264
  return;
13257
13265
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13258
13266
  }
13259
- function up44(db) {
13267
+ function up45(db) {
13260
13268
  db.exec(`
13261
13269
  CREATE TABLE IF NOT EXISTS agents (
13262
13270
  id TEXT PRIMARY KEY,
@@ -13287,7 +13295,7 @@ function addColumnIfMissing13(db, table, column, definition) {
13287
13295
  return;
13288
13296
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13289
13297
  }
13290
- function up45(db) {
13298
+ function up46(db) {
13291
13299
  addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
13292
13300
  addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
13293
13301
  addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
@@ -13315,7 +13323,7 @@ function addColumnIfMissing14(db, table, column, definition) {
13315
13323
  return;
13316
13324
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13317
13325
  }
13318
- function up46(db) {
13326
+ function up47(db) {
13319
13327
  addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
13320
13328
  addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
13321
13329
  addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -13388,7 +13396,7 @@ function up46(db) {
13388
13396
  }
13389
13397
 
13390
13398
  // src/migrations/046-session-summary-uniqueness.ts
13391
- function up47(db) {
13399
+ function up48(db) {
13392
13400
  db.exec(`
13393
13401
  DROP INDEX IF EXISTS idx_summaries_session_depth;
13394
13402
 
@@ -13451,7 +13459,7 @@ function up47(db) {
13451
13459
  }
13452
13460
 
13453
13461
  // src/migrations/047-agent-scoped-temporal-uniqueness.ts
13454
- function up48(db) {
13462
+ function up49(db) {
13455
13463
  db.exec(`
13456
13464
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
13457
13465
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -13551,7 +13559,7 @@ function up48(db) {
13551
13559
  }
13552
13560
 
13553
13561
  // src/migrations/048-thread-heads.ts
13554
- function up49(db) {
13562
+ function up50(db) {
13555
13563
  db.exec(`
13556
13564
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
13557
13565
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13671,7 +13679,7 @@ function up49(db) {
13671
13679
  }
13672
13680
 
13673
13681
  // src/migrations/049-session-extract-cursors.ts
13674
- function up50(db) {
13682
+ function up51(db) {
13675
13683
  db.exec(`
13676
13684
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13677
13685
  session_key TEXT NOT NULL,
@@ -13690,7 +13698,7 @@ function hasTable(db, name) {
13690
13698
  WHERE type = 'table' AND name = ?
13691
13699
  LIMIT 1`).get(name) !== undefined;
13692
13700
  }
13693
- function up51(db) {
13701
+ function up52(db) {
13694
13702
  db.exec(`
13695
13703
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13696
13704
  id TEXT PRIMARY KEY,
@@ -13862,7 +13870,7 @@ function addColumnIfMissing15(db, table, column, definition) {
13862
13870
  return;
13863
13871
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13864
13872
  }
13865
- function up52(db) {
13873
+ function up53(db) {
13866
13874
  addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13867
13875
  addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13868
13876
  addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
@@ -13956,7 +13964,7 @@ function up52(db) {
13956
13964
  }
13957
13965
 
13958
13966
  // src/migrations/052-mcp-invocations.ts
13959
- function up53(db) {
13967
+ function up54(db) {
13960
13968
  db.exec(`
13961
13969
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13962
13970
  id TEXT PRIMARY KEY,
@@ -13975,7 +13983,7 @@ function up53(db) {
13975
13983
  }
13976
13984
 
13977
13985
  // src/migrations/053-skill-invocations.ts
13978
- function up54(db) {
13986
+ function up55(db) {
13979
13987
  db.exec(`
13980
13988
  CREATE TABLE IF NOT EXISTS skill_invocations (
13981
13989
  id TEXT PRIMARY KEY,
@@ -13993,7 +14001,7 @@ function up54(db) {
13993
14001
  }
13994
14002
 
13995
14003
  // src/migrations/054-task-agent-scope.ts
13996
- function up55(db) {
14004
+ function up56(db) {
13997
14005
  db.exec(`
13998
14006
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13999
14007
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -14026,7 +14034,7 @@ function up55(db) {
14026
14034
  }
14027
14035
 
14028
14036
  // src/migrations/055-dreaming-state.ts
14029
- function up56(db) {
14037
+ function up57(db) {
14030
14038
  db.exec(`
14031
14039
  CREATE TABLE IF NOT EXISTS dreaming_state (
14032
14040
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -14071,7 +14079,7 @@ function ensureMemoriesScopeColumns(db) {
14071
14079
  if (!names.has("scope"))
14072
14080
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
14073
14081
  }
14074
- function up57(db) {
14082
+ function up58(db) {
14075
14083
  ensureMemoriesScopeColumns(db);
14076
14084
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
14077
14085
  db.exec(`
@@ -14086,7 +14094,7 @@ function up57(db) {
14086
14094
  }
14087
14095
 
14088
14096
  // src/migrations/057-memories-fts-tokenizer-repair.ts
14089
- function up58(db) {
14097
+ function up59(db) {
14090
14098
  const sql = readMemoriesFtsSql(db);
14091
14099
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
14092
14100
  return;
@@ -14094,7 +14102,7 @@ function up58(db) {
14094
14102
  }
14095
14103
 
14096
14104
  // src/migrations/058-knowledge-graph-indices.ts
14097
- function up59(db) {
14105
+ function up60(db) {
14098
14106
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
14099
14107
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
14100
14108
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
@@ -14103,7 +14111,7 @@ function up59(db) {
14103
14111
  }
14104
14112
 
14105
14113
  // src/migrations/059-entity-attribute-claim-key.ts
14106
- function up60(db) {
14114
+ function up61(db) {
14107
14115
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
14108
14116
  if (!cols.some((col) => col.name === "claim_key")) {
14109
14117
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -14114,7 +14122,7 @@ function up60(db) {
14114
14122
  }
14115
14123
 
14116
14124
  // src/migrations/060-entity-attribute-group-key.ts
14117
- function up61(db) {
14125
+ function up62(db) {
14118
14126
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
14119
14127
  if (!cols.some((col) => col.name === "group_key")) {
14120
14128
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -14128,7 +14136,7 @@ function up61(db) {
14128
14136
  }
14129
14137
 
14130
14138
  // src/migrations/061-memory-artifact-source-mtime.ts
14131
- function up62(db) {
14139
+ function up63(db) {
14132
14140
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
14133
14141
  if (cols.some((col) => col.name === "source_mtime_ms"))
14134
14142
  return;
@@ -14136,7 +14144,7 @@ function up62(db) {
14136
14144
  }
14137
14145
 
14138
14146
  // src/migrations/062-memory-artifact-soft-delete.ts
14139
- function up63(db) {
14147
+ function up64(db) {
14140
14148
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
14141
14149
  const names = new Set(cols.map((col) => col.name));
14142
14150
  if (!names.has("is_deleted")) {
@@ -14152,7 +14160,7 @@ function up63(db) {
14152
14160
  }
14153
14161
 
14154
14162
  // src/migrations/063-content-only-memories-fts-update.ts
14155
- function up64(db) {
14163
+ function up65(db) {
14156
14164
  db.exec("DROP TRIGGER IF EXISTS memories_au");
14157
14165
  db.exec(`
14158
14166
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -14172,7 +14180,7 @@ function addColumnIfMissing16(db, table, column, definition) {
14172
14180
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14173
14181
  }
14174
14182
  }
14175
- function up65(db) {
14183
+ function up66(db) {
14176
14184
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
14177
14185
  addColumnIfMissing16(db, table, "source_id", "TEXT");
14178
14186
  addColumnIfMissing16(db, table, "source_kind", "TEXT");
@@ -14194,7 +14202,7 @@ function hasColumn7(db, table, column) {
14194
14202
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14195
14203
  return rows.some((row) => row.name === column);
14196
14204
  }
14197
- function up66(db) {
14205
+ function up67(db) {
14198
14206
  if (!hasTable2(db, "embeddings"))
14199
14207
  return;
14200
14208
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -14204,7 +14212,7 @@ function up66(db) {
14204
14212
  }
14205
14213
 
14206
14214
  // src/migrations/066-memory-search-telemetry.ts
14207
- function up67(db) {
14215
+ function up68(db) {
14208
14216
  db.exec(`
14209
14217
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
14210
14218
  id TEXT PRIMARY KEY,
@@ -14247,7 +14255,7 @@ function addColumnIfMissing17(db, table, column, definition) {
14247
14255
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14248
14256
  }
14249
14257
  }
14250
- function up68(db) {
14258
+ function up69(db) {
14251
14259
  db.exec(`
14252
14260
  CREATE TABLE IF NOT EXISTS ontology_proposals (
14253
14261
  id TEXT PRIMARY KEY,
@@ -14292,7 +14300,7 @@ function up68(db) {
14292
14300
  }
14293
14301
 
14294
14302
  // src/migrations/068-daily-reflections.ts
14295
- function up69(db) {
14303
+ function up70(db) {
14296
14304
  db.exec(`
14297
14305
  CREATE TABLE IF NOT EXISTS daily_reflections (
14298
14306
  id TEXT PRIMARY KEY,
@@ -14321,7 +14329,7 @@ function up69(db) {
14321
14329
  }
14322
14330
 
14323
14331
  // src/migrations/069-daily-reflections-multiple-insights.ts
14324
- function up70(db) {
14332
+ function up71(db) {
14325
14333
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
14326
14334
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
14327
14335
  if (!colNames.has("content_key")) {
@@ -14360,7 +14368,7 @@ function backfillVersionRoots(db) {
14360
14368
  WHERE version_root_id IS NULL
14361
14369
  `);
14362
14370
  }
14363
- function up71(db) {
14371
+ function up72(db) {
14364
14372
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
14365
14373
  addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
14366
14374
  addColumnIfMissing18(db, table, "archived_at", "TEXT");
@@ -14397,7 +14405,7 @@ function up71(db) {
14397
14405
  }
14398
14406
 
14399
14407
  // src/migrations/071-epistemic-assertions.ts
14400
- function up72(db) {
14408
+ function up73(db) {
14401
14409
  db.exec(`
14402
14410
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
14403
14411
  id TEXT PRIMARY KEY,
@@ -14455,7 +14463,7 @@ function ensureMemoriesScopeColumns2(db) {
14455
14463
  if (!names.has("runtime_path"))
14456
14464
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
14457
14465
  }
14458
- function up73(db) {
14466
+ function up74(db) {
14459
14467
  ensureMemoriesScopeColumns2(db);
14460
14468
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
14461
14469
  db.exec(`
@@ -14471,7 +14479,7 @@ function up73(db) {
14471
14479
  }
14472
14480
 
14473
14481
  // src/migrations/073-recall-context-dedupe.ts
14474
- function up74(db) {
14482
+ function up75(db) {
14475
14483
  db.exec(`
14476
14484
  CREATE TABLE IF NOT EXISTS session_context_epochs (
14477
14485
  session_key TEXT NOT NULL,
@@ -14508,7 +14516,7 @@ function up74(db) {
14508
14516
  }
14509
14517
 
14510
14518
  // src/migrations/074-aggregate-memory-links.ts
14511
- function up75(db) {
14519
+ function up76(db) {
14512
14520
  db.exec(`
14513
14521
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
14514
14522
  aggregate_memory_id TEXT NOT NULL,
@@ -14529,7 +14537,7 @@ function addColumnIfMissing19(db, table, column, definition) {
14529
14537
  return;
14530
14538
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14531
14539
  }
14532
- function up76(db) {
14540
+ function up77(db) {
14533
14541
  addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
14534
14542
  addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
14535
14543
  addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -14544,7 +14552,7 @@ function up76(db) {
14544
14552
  }
14545
14553
 
14546
14554
  // src/migrations/076-temporal-edges.ts
14547
- function up77(db) {
14555
+ function up78(db) {
14548
14556
  db.exec(`
14549
14557
  CREATE TABLE IF NOT EXISTS temporal_edges (
14550
14558
  id TEXT PRIMARY KEY,
@@ -14569,7 +14577,7 @@ function up77(db) {
14569
14577
  }
14570
14578
 
14571
14579
  // src/migrations/077-entity-aliases.ts
14572
- function up78(db) {
14580
+ function up79(db) {
14573
14581
  db.exec(`
14574
14582
  CREATE TABLE IF NOT EXISTS entity_aliases (
14575
14583
  id TEXT PRIMARY KEY,
@@ -14595,7 +14603,7 @@ function up78(db) {
14595
14603
  }
14596
14604
 
14597
14605
  // src/migrations/078-api-keys.ts
14598
- function up79(db) {
14606
+ function up80(db) {
14599
14607
  db.exec(`
14600
14608
  CREATE TABLE IF NOT EXISTS api_keys (
14601
14609
  id TEXT PRIMARY KEY,
@@ -14625,7 +14633,7 @@ function up79(db) {
14625
14633
  }
14626
14634
 
14627
14635
  // src/migrations/079-transcript-capture-jobs.ts
14628
- function up80(db) {
14636
+ function up81(db) {
14629
14637
  db.exec(`
14630
14638
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
14631
14639
  id TEXT PRIMARY KEY,
@@ -14662,7 +14670,7 @@ function hasColumn10(db, table, column) {
14662
14670
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14663
14671
  return rows.some((row) => row.name === column);
14664
14672
  }
14665
- function up81(db) {
14673
+ function up82(db) {
14666
14674
  if (!hasColumn10(db, "documents", "agent_id")) {
14667
14675
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
14668
14676
  }
@@ -14750,7 +14758,7 @@ function up81(db) {
14750
14758
  }
14751
14759
 
14752
14760
  // src/migrations/081-aggregate-evidence-sources.ts
14753
- function up82(db) {
14761
+ function up83(db) {
14754
14762
  db.exec(`
14755
14763
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14756
14764
  aggregate_memory_id TEXT NOT NULL,
@@ -14774,7 +14782,7 @@ function hasColumn11(db, table, column) {
14774
14782
  return rows.some((row) => row.name === column);
14775
14783
  }
14776
14784
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14777
- function up83(db) {
14785
+ function up84(db) {
14778
14786
  for (const column of COLUMNS) {
14779
14787
  if (!hasColumn11(db, "skill_invocations", column)) {
14780
14788
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14857,7 +14865,7 @@ function documentScopeColumnsPreservingExisting(db) {
14857
14865
  `);
14858
14866
  }
14859
14867
  try {
14860
- up81(db);
14868
+ up82(db);
14861
14869
  if (preserveAgentId) {
14862
14870
  db.exec(`
14863
14871
  UPDATE documents
@@ -14877,12 +14885,12 @@ function documentScopeColumnsPreservingExisting(db) {
14877
14885
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14878
14886
  }
14879
14887
  }
14880
- function up84(db) {
14881
- up80(db);
14888
+ function up85(db) {
14889
+ up81(db);
14882
14890
  if (hasTable3(db, "documents")) {
14883
14891
  documentScopeColumnsPreservingExisting(db);
14884
14892
  }
14885
- up82(db);
14893
+ up83(db);
14886
14894
  addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14887
14895
  addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14888
14896
  addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
@@ -14941,7 +14949,7 @@ function up84(db) {
14941
14949
  }
14942
14950
 
14943
14951
  // src/migrations/084-legacy-markdown-import-state.ts
14944
- function up85(db) {
14952
+ function up86(db) {
14945
14953
  db.exec(`
14946
14954
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14947
14955
  path TEXT PRIMARY KEY,
@@ -14973,7 +14981,7 @@ function up85(db) {
14973
14981
  }
14974
14982
 
14975
14983
  // src/migrations/085-backfill-relations-to-dependencies.ts
14976
- function up86(db) {
14984
+ function up87(db) {
14977
14985
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14978
14986
  const tableNames = new Set(tables.map((r) => String(r.name)));
14979
14987
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -15034,7 +15042,7 @@ function addColumnIfMissing21(db, table, column, definition) {
15034
15042
  return;
15035
15043
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15036
15044
  }
15037
- function up87(db) {
15045
+ function up88(db) {
15038
15046
  addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
15039
15047
  db.exec(`
15040
15048
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -15049,7 +15057,7 @@ function addColumnIfMissing22(db, table, column, definition) {
15049
15057
  return;
15050
15058
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15051
15059
  }
15052
- function up88(db) {
15060
+ function up89(db) {
15053
15061
  addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
15054
15062
  db.exec(`
15055
15063
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
@@ -15058,7 +15066,7 @@ function up88(db) {
15058
15066
  }
15059
15067
 
15060
15068
  // src/migrations/088-transcript-recovery-files.ts
15061
- function up89(db) {
15069
+ function up90(db) {
15062
15070
  db.exec(`
15063
15071
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
15064
15072
  agent_id TEXT NOT NULL,
@@ -15078,7 +15086,7 @@ function up89(db) {
15078
15086
  }
15079
15087
 
15080
15088
  // src/migrations/089-job-cancellations.ts
15081
- function up90(db) {
15089
+ function up91(db) {
15082
15090
  db.exec(`
15083
15091
  CREATE TABLE IF NOT EXISTS job_cancellations (
15084
15092
  id TEXT PRIMARY KEY,
@@ -15108,7 +15116,7 @@ function indexExists(db, table, indexName) {
15108
15116
  }
15109
15117
 
15110
15118
  // src/migrations/090-job-archive.ts
15111
- function up91(db) {
15119
+ function up92(db) {
15112
15120
  db.exec(`
15113
15121
  CREATE TABLE IF NOT EXISTS job_archive (
15114
15122
  id TEXT PRIMARY KEY,
@@ -15137,7 +15145,7 @@ function indexExists2(db, table, indexName) {
15137
15145
  }
15138
15146
 
15139
15147
  // src/migrations/091-embedding-index-generations.ts
15140
- function up92(db) {
15148
+ function up93(db) {
15141
15149
  db.exec(`
15142
15150
  CREATE TABLE IF NOT EXISTS embedding_index_state (
15143
15151
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15152,7 +15160,7 @@ function up92(db) {
15152
15160
  }
15153
15161
 
15154
15162
  // src/migrations/092-embedding-staging-store.ts
15155
- function up93(db) {
15163
+ function up94(db) {
15156
15164
  db.exec(`
15157
15165
  CREATE TABLE IF NOT EXISTS embeddings_staging (
15158
15166
  id TEXT PRIMARY KEY,
@@ -15173,7 +15181,7 @@ function up93(db) {
15173
15181
  }
15174
15182
 
15175
15183
  // src/migrations/093-dreaming-evidence-cursor.ts
15176
- function up94(db) {
15184
+ function up95(db) {
15177
15185
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
15178
15186
  if (!columns.some((column) => column.name === "evidence_cursor")) {
15179
15187
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -15186,7 +15194,7 @@ function hasColumn13(db, table, column) {
15186
15194
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
15187
15195
  return rows.some((r) => r.name === column);
15188
15196
  }
15189
- function up95(db) {
15197
+ function up96(db) {
15190
15198
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
15191
15199
  if (tables.length === 0)
15192
15200
  return;
@@ -15213,7 +15221,7 @@ function up95(db) {
15213
15221
  function hasColumn14(db, table, column) {
15214
15222
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15215
15223
  }
15216
- function up96(db) {
15224
+ function up97(db) {
15217
15225
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
15218
15226
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
15219
15227
  return;
@@ -15221,12 +15229,12 @@ function up96(db) {
15221
15229
  }
15222
15230
 
15223
15231
  // src/migrations/096-retire-legacy-ingestion.ts
15224
- function up97(db) {
15232
+ function up98(db) {
15225
15233
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
15226
15234
  }
15227
15235
 
15228
15236
  // src/migrations/097-dreaming-failure-backoff.ts
15229
- function up98(db) {
15237
+ function up99(db) {
15230
15238
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
15231
15239
  if (!columns.some((column) => column.name === "last_failure_at")) {
15232
15240
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
@@ -15235,7 +15243,7 @@ function up98(db) {
15235
15243
  }
15236
15244
 
15237
15245
  // src/migrations/098-dreaming-evidence-exclusions.ts
15238
- function up99(db) {
15246
+ function up100(db) {
15239
15247
  db.exec(`
15240
15248
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
15241
15249
  agent_id TEXT NOT NULL,
@@ -15254,7 +15262,7 @@ function up99(db) {
15254
15262
  }
15255
15263
 
15256
15264
  // src/migrations/099-dreaming-tool-calls.ts
15257
- function up100(db) {
15265
+ function up101(db) {
15258
15266
  db.exec(`
15259
15267
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
15260
15268
  id TEXT PRIMARY KEY,
@@ -15276,7 +15284,7 @@ function up100(db) {
15276
15284
  }
15277
15285
 
15278
15286
  // src/migrations/100-dreaming-runbook.ts
15279
- function up101(db) {
15287
+ function up102(db) {
15280
15288
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
15281
15289
  if (!columns.some((column) => column.name === "evidence_window_json")) {
15282
15290
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -15287,7 +15295,7 @@ function up101(db) {
15287
15295
  }
15288
15296
 
15289
15297
  // src/migrations/101-dreaming-attention.ts
15290
- function up102(db) {
15298
+ function up103(db) {
15291
15299
  db.exec(`
15292
15300
  CREATE TABLE IF NOT EXISTS dreaming_attention (
15293
15301
  id TEXT PRIMARY KEY,
@@ -15311,7 +15319,7 @@ function up102(db) {
15311
15319
  function hasColumn15(db, table, column) {
15312
15320
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15313
15321
  }
15314
- function up103(db) {
15322
+ function up104(db) {
15315
15323
  const requiredMemoryColumns = [
15316
15324
  "content_hash",
15317
15325
  "normalized_content",
@@ -15364,7 +15372,7 @@ function up103(db) {
15364
15372
  }
15365
15373
 
15366
15374
  // src/migrations/103-semantic-memory-kind.ts
15367
- function up104(db) {
15375
+ function up105(db) {
15368
15376
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
15369
15377
  if (tables.length !== 2)
15370
15378
  return;
@@ -15389,7 +15397,7 @@ function tableExists(db, table) {
15389
15397
  function hasColumn16(db, table, column) {
15390
15398
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15391
15399
  }
15392
- function up105(db) {
15400
+ function up106(db) {
15393
15401
  db.exec(`
15394
15402
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
15395
15403
  derived_memory_id TEXT NOT NULL,
@@ -15434,7 +15442,7 @@ function up105(db) {
15434
15442
  }
15435
15443
 
15436
15444
  // src/migrations/105-agent-scoped-entity-name.ts
15437
- function up106(db) {
15445
+ function up107(db) {
15438
15446
  db.exec(`
15439
15447
  DROP TRIGGER IF EXISTS entities_fts_ai;
15440
15448
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -15525,7 +15533,7 @@ function up106(db) {
15525
15533
  function hasColumn17(db, table, column) {
15526
15534
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15527
15535
  }
15528
- function up107(db) {
15536
+ function up108(db) {
15529
15537
  if (!hasColumn17(db, "memories", "review_after")) {
15530
15538
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
15531
15539
  }
@@ -15543,7 +15551,7 @@ var TOKEN_COLUMNS = [
15543
15551
  ["tokens_cache_write", "INTEGER"],
15544
15552
  ["tokens_cost", "REAL"]
15545
15553
  ];
15546
- function up108(db) {
15554
+ function up109(db) {
15547
15555
  for (const [column, type] of TOKEN_COLUMNS) {
15548
15556
  if (!hasColumn18(db, "dreaming_passes", column)) {
15549
15557
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
@@ -15552,7 +15560,7 @@ function up108(db) {
15552
15560
  }
15553
15561
 
15554
15562
  // src/migrations/108-embedding-usage.ts
15555
- function up109(db) {
15563
+ function up110(db) {
15556
15564
  db.exec(`
15557
15565
  CREATE TABLE IF NOT EXISTS embedding_usage (
15558
15566
  day TEXT NOT NULL,
@@ -15567,7 +15575,7 @@ function up109(db) {
15567
15575
  }
15568
15576
 
15569
15577
  // src/migrations/109-telemetry-install.ts
15570
- function up110(db) {
15578
+ function up111(db) {
15571
15579
  db.exec(`
15572
15580
  CREATE TABLE IF NOT EXISTS telemetry_install (
15573
15581
  id TEXT PRIMARY KEY,
@@ -15577,7 +15585,7 @@ function up110(db) {
15577
15585
  }
15578
15586
 
15579
15587
  // src/migrations/110-memory-mention-join-index.ts
15580
- function up111(db) {
15588
+ function up112(db) {
15581
15589
  db.exec(`
15582
15590
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
15583
15591
  ON memory_entity_mentions(entity_id, memory_id);
@@ -15590,7 +15598,7 @@ function hasColumn19(db, table, column) {
15590
15598
  return rows.some((row) => row.name === column);
15591
15599
  }
15592
15600
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
15593
- function up112(db) {
15601
+ function up113(db) {
15594
15602
  for (const column of COLUMNS2) {
15595
15603
  if (!hasColumn19(db, "telemetry_install", column)) {
15596
15604
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -15608,7 +15616,7 @@ function addColumnIfMissing23(db, column, definition) {
15608
15616
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15609
15617
  }
15610
15618
  }
15611
- function up113(db) {
15619
+ function up114(db) {
15612
15620
  addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
15613
15621
  addColumnIfMissing23(db, "claim_token", "TEXT");
15614
15622
  addColumnIfMissing23(db, "claimed_at", "TEXT");
@@ -15619,7 +15627,7 @@ function up113(db) {
15619
15627
  }
15620
15628
 
15621
15629
  // src/migrations/113-session-claims.ts
15622
- function up114(db) {
15630
+ function up115(db) {
15623
15631
  db.exec(`
15624
15632
  CREATE TABLE IF NOT EXISTS session_claims (
15625
15633
  session_key TEXT NOT NULL,
@@ -15642,7 +15650,7 @@ function up114(db) {
15642
15650
  }
15643
15651
 
15644
15652
  // src/migrations/114-memory-traversal-hydration-index.ts
15645
- function up115(db) {
15653
+ function up116(db) {
15646
15654
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
15647
15655
  if (table == null)
15648
15656
  return;
@@ -15653,7 +15661,7 @@ function up115(db) {
15653
15661
  }
15654
15662
 
15655
15663
  // src/migrations/115-cross-agent-message-notifications.ts
15656
- function up116(db) {
15664
+ function up117(db) {
15657
15665
  db.exec(`
15658
15666
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
15659
15667
  id TEXT PRIMARY KEY,
@@ -15712,7 +15720,7 @@ function addColumnIfMissing24(db, column, definition) {
15712
15720
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
15713
15721
  }
15714
15722
  }
15715
- function up117(db) {
15723
+ function up118(db) {
15716
15724
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
15717
15725
  if (table == null)
15718
15726
  return;
@@ -15916,7 +15924,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15916
15924
  insert.run(...values);
15917
15925
  }
15918
15926
  }
15919
- function up118(db) {
15927
+ function up119(db) {
15920
15928
  if (!hasTable4(db, "session_transcripts"))
15921
15929
  return;
15922
15930
  addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
@@ -15971,7 +15979,7 @@ function up118(db) {
15971
15979
  }
15972
15980
 
15973
15981
  // src/migrations/118-queue-pressure-indices.ts
15974
- function up119(db) {
15982
+ function up120(db) {
15975
15983
  db.exec(`
15976
15984
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15977
15985
  ON memory_jobs(status)
@@ -15992,14 +16000,14 @@ function up119(db) {
15992
16000
  function hasColumn22(db, table, column) {
15993
16001
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15994
16002
  }
15995
- function up120(db) {
16003
+ function up121(db) {
15996
16004
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15997
16005
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15998
16006
  }
15999
16007
  }
16000
16008
 
16001
16009
  // src/migrations/120-source-lifecycle-telemetry.ts
16002
- function up121(db) {
16010
+ function up122(db) {
16003
16011
  db.exec(`
16004
16012
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
16005
16013
  agent_id TEXT NOT NULL,
@@ -16030,7 +16038,7 @@ function addColumnIfMissing26(db, column, definition) {
16030
16038
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
16031
16039
  }
16032
16040
  }
16033
- function up122(db) {
16041
+ function up123(db) {
16034
16042
  addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
16035
16043
  addColumnIfMissing26(db, "last_attempt_at", "TEXT");
16036
16044
  addColumnIfMissing26(db, "sent_at", "TEXT");
@@ -16053,7 +16061,7 @@ function up122(db) {
16053
16061
  }
16054
16062
 
16055
16063
  // src/migrations/122-dreaming-evidence-retry.ts
16056
- function up123(db) {
16064
+ function up124(db) {
16057
16065
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
16058
16066
  const names = new Set(columns.map((column) => column.name));
16059
16067
  if (!names.has("failure_class")) {
@@ -16072,7 +16080,7 @@ function up123(db) {
16072
16080
  }
16073
16081
 
16074
16082
  // src/migrations/123-embedding-index-failures.ts
16075
- function up124(db) {
16083
+ function up125(db) {
16076
16084
  db.exec(`
16077
16085
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
16078
16086
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -16098,7 +16106,7 @@ function up124(db) {
16098
16106
  }
16099
16107
 
16100
16108
  // src/migrations/124-import-derived-lifecycle.ts
16101
- function up125(db) {
16109
+ function up126(db) {
16102
16110
  db.exec(`
16103
16111
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
16104
16112
  id TEXT PRIMARY KEY,
@@ -16150,7 +16158,7 @@ function backfillTable(db, params) {
16150
16158
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
16151
16159
  backfill(db, rows, params.sourceKind, params.scannedAt);
16152
16160
  }
16153
- function up126(db) {
16161
+ function up127(db) {
16154
16162
  db.exec(`
16155
16163
  CREATE TABLE IF NOT EXISTS memory_content_safety (
16156
16164
  agent_id TEXT NOT NULL,
@@ -16209,7 +16217,7 @@ function up126(db) {
16209
16217
  }
16210
16218
 
16211
16219
  // src/migrations/126-dreaming-surprisal-attention.ts
16212
- function up127(db) {
16220
+ function up128(db) {
16213
16221
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
16214
16222
  if (!table)
16215
16223
  return;
@@ -16245,7 +16253,7 @@ function up127(db) {
16245
16253
  }
16246
16254
 
16247
16255
  // src/migrations/127-ontology-contradictions.ts
16248
- function up128(db) {
16256
+ function up129(db) {
16249
16257
  db.exec(`
16250
16258
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
16251
16259
  id TEXT PRIMARY KEY,
@@ -16303,7 +16311,7 @@ function up128(db) {
16303
16311
  }
16304
16312
 
16305
16313
  // src/migrations/128-bounded-queue-diagnostics.ts
16306
- function up129(db) {
16314
+ function up130(db) {
16307
16315
  db.exec(`
16308
16316
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
16309
16317
  ON memory_jobs(status, created_at)
@@ -16320,7 +16328,7 @@ function up129(db) {
16320
16328
  function tableExists3(db, table) {
16321
16329
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
16322
16330
  }
16323
- function up130(db) {
16331
+ function up131(db) {
16324
16332
  if (!tableExists3(db, "memory_jobs"))
16325
16333
  return;
16326
16334
  if (!tableExists3(db, "job_cancellations")) {
@@ -16371,7 +16379,7 @@ function up130(db) {
16371
16379
  }
16372
16380
 
16373
16381
  // src/migrations/130-embedding-repair-state.ts
16374
- function up131(db) {
16382
+ function up132(db) {
16375
16383
  db.exec(`
16376
16384
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
16377
16385
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -16413,7 +16421,7 @@ function up131(db) {
16413
16421
  }
16414
16422
 
16415
16423
  // src/migrations/131-dreaming-evidence-consumption.ts
16416
- function up132(db) {
16424
+ function up133(db) {
16417
16425
  db.exec(`
16418
16426
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
16419
16427
  agent_id TEXT NOT NULL,
@@ -16438,7 +16446,7 @@ function up132(db) {
16438
16446
  }
16439
16447
 
16440
16448
  // src/migrations/132-observer-scoped-epistemic-assertions.ts
16441
- function up133(db) {
16449
+ function up134(db) {
16442
16450
  db.exec(`
16443
16451
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
16444
16452
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
@@ -16446,7 +16454,7 @@ function up133(db) {
16446
16454
  }
16447
16455
 
16448
16456
  // src/migrations/133-dreaming-memory-head.ts
16449
- function up134(db) {
16457
+ function up135(db) {
16450
16458
  db.exec(`
16451
16459
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
16452
16460
  id TEXT PRIMARY KEY,
@@ -16500,7 +16508,7 @@ function up134(db) {
16500
16508
  }
16501
16509
 
16502
16510
  // src/migrations/134-scope-memory-head-entries.ts
16503
- function up135(db) {
16511
+ function up136(db) {
16504
16512
  db.exec(`
16505
16513
  CREATE TABLE memory_head_entries_v134 (
16506
16514
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -16520,7 +16528,7 @@ function up135(db) {
16520
16528
  }
16521
16529
 
16522
16530
  // src/migrations/135-memory-head-publication.ts
16523
- function up136(db) {
16531
+ function up137(db) {
16524
16532
  db.exec(`
16525
16533
  CREATE TABLE IF NOT EXISTS memory_head_publications (
16526
16534
  agent_id TEXT NOT NULL,
@@ -16538,7 +16546,7 @@ function up136(db) {
16538
16546
  }
16539
16547
 
16540
16548
  // src/migrations/136-memory-head-revisions.ts
16541
- function up137(db) {
16549
+ function up138(db) {
16542
16550
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r) => r.name));
16543
16551
  for (const [name, type] of [
16544
16552
  ["entry_id", "TEXT"],
@@ -16554,7 +16562,7 @@ function up137(db) {
16554
16562
  }
16555
16563
 
16556
16564
  // src/migrations/137-dreaming-head-manifest.ts
16557
- function up138(db) {
16565
+ function up139(db) {
16558
16566
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r) => r.name));
16559
16567
  for (const [name, type] of [
16560
16568
  ["head_revision", "INTEGER"],
@@ -16578,7 +16586,7 @@ function addColumnIfMissing27(db, table, column, definition) {
16578
16586
  if (!hasColumn25(db, table, column))
16579
16587
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16580
16588
  }
16581
- function up139(db) {
16589
+ function up140(db) {
16582
16590
  addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
16583
16591
  db.exec(`
16584
16592
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16885,7 +16893,7 @@ function up139(db) {
16885
16893
  }
16886
16894
 
16887
16895
  // src/migrations/139-native-source-sync-state.ts
16888
- function up140(db) {
16896
+ function up141(db) {
16889
16897
  db.exec(`
16890
16898
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16891
16899
  agent_id TEXT NOT NULL,
@@ -16903,7 +16911,7 @@ function up140(db) {
16903
16911
  }
16904
16912
 
16905
16913
  // src/migrations/140-transcript-recovery-frontier.ts
16906
- function up141(db) {
16914
+ function up142(db) {
16907
16915
  db.exec(`
16908
16916
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16909
16917
  agent_id TEXT NOT NULL,
@@ -16917,7 +16925,7 @@ function up141(db) {
16917
16925
  }
16918
16926
 
16919
16927
  // src/migrations/141-source-sync-checkpoints.ts
16920
- function up142(db) {
16928
+ function up143(db) {
16921
16929
  db.exec(`
16922
16930
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16923
16931
  agent_id TEXT NOT NULL,
@@ -16933,7 +16941,7 @@ function up142(db) {
16933
16941
  }
16934
16942
 
16935
16943
  // src/migrations/142-source-sync-frontier.ts
16936
- function up143(db) {
16944
+ function up144(db) {
16937
16945
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16938
16946
  if (!columns.some((column) => column.name === "frontier")) {
16939
16947
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
@@ -16941,7 +16949,7 @@ function up143(db) {
16941
16949
  }
16942
16950
 
16943
16951
  // src/migrations/143-embedding-index-progress.ts
16944
- function up144(db) {
16952
+ function up145(db) {
16945
16953
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16946
16954
  const additions = [
16947
16955
  ["migration_phase", "TEXT"],
@@ -16978,7 +16986,7 @@ function up144(db) {
16978
16986
  }
16979
16987
 
16980
16988
  // src/migrations/144-memory-job-lease-token.ts
16981
- function up145(db) {
16989
+ function up146(db) {
16982
16990
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16983
16991
  if (!columns.has("lease_token")) {
16984
16992
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
@@ -16986,7 +16994,7 @@ function up145(db) {
16986
16994
  }
16987
16995
 
16988
16996
  // src/migrations/145-dreaming-evidence-reviews.ts
16989
- function up146(db) {
16997
+ function up147(db) {
16990
16998
  db.exec(`
16991
16999
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16992
17000
  agent_id TEXT NOT NULL,
@@ -17006,7 +17014,7 @@ function up146(db) {
17006
17014
  }
17007
17015
 
17008
17016
  // src/migrations/146-source-transcript-import.ts
17009
- function up147(db) {
17017
+ function up148(db) {
17010
17018
  db.exec(`
17011
17019
  CREATE TABLE IF NOT EXISTS source_import_jobs (
17012
17020
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -17075,12 +17083,12 @@ function up147(db) {
17075
17083
  }
17076
17084
 
17077
17085
  // src/migrations/147-source-import-replay-file-slots.ts
17078
- function up148(db) {
17086
+ function up149(db) {
17079
17087
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
17080
17088
  }
17081
17089
 
17082
17090
  // src/migrations/148-source-import-attempt-provenance.ts
17083
- function up149(db) {
17091
+ function up150(db) {
17084
17092
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
17085
17093
  if (!columns.some((column) => column.name === "source_id")) {
17086
17094
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
@@ -17088,7 +17096,7 @@ function up149(db) {
17088
17096
  }
17089
17097
 
17090
17098
  // src/migrations/149-transcript-import-state-machine.ts
17091
- function up150(db) {
17099
+ function up151(db) {
17092
17100
  const addColumn = (table, column, definition) => {
17093
17101
  const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
17094
17102
  let exists;
@@ -17111,7 +17119,7 @@ function addColumnIfMissing28(db, table, column, definition) {
17111
17119
  if (!columns.some((row) => row.name === column))
17112
17120
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
17113
17121
  }
17114
- function up151(db) {
17122
+ function up152(db) {
17115
17123
  addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
17116
17124
  addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
17117
17125
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -17267,13 +17275,13 @@ var MIGRATIONS = [
17267
17275
  {
17268
17276
  version: 1,
17269
17277
  name: "baseline",
17270
- up: up2,
17278
+ up: up3,
17271
17279
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
17272
17280
  },
17273
17281
  {
17274
17282
  version: 2,
17275
17283
  name: "pipeline-v2",
17276
- up: up3,
17284
+ up: up4,
17277
17285
  artifacts: {
17278
17286
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
17279
17287
  }
@@ -17281,12 +17289,12 @@ var MIGRATIONS = [
17281
17289
  {
17282
17290
  version: 3,
17283
17291
  name: "unique-content-hash",
17284
- up: up4
17292
+ up: up5
17285
17293
  },
17286
17294
  {
17287
17295
  version: 4,
17288
17296
  name: "history-actor-and-retention",
17289
- up: up5,
17297
+ up: up6,
17290
17298
  artifacts: {
17291
17299
  columns: [{ table: "memory_history", column: "actor_type" }]
17292
17300
  }
@@ -17294,7 +17302,7 @@ var MIGRATIONS = [
17294
17302
  {
17295
17303
  version: 5,
17296
17304
  name: "graph-extended",
17297
- up: up6,
17305
+ up: up7,
17298
17306
  artifacts: {
17299
17307
  columns: [{ table: "entities", column: "canonical_name" }]
17300
17308
  }
@@ -17302,7 +17310,7 @@ var MIGRATIONS = [
17302
17310
  {
17303
17311
  version: 6,
17304
17312
  name: "idempotency-key",
17305
- up: up7,
17313
+ up: up8,
17306
17314
  artifacts: {
17307
17315
  columns: [{ table: "memories", column: "idempotency_key" }]
17308
17316
  }
@@ -17310,42 +17318,42 @@ var MIGRATIONS = [
17310
17318
  {
17311
17319
  version: 7,
17312
17320
  name: "documents-and-connectors",
17313
- up: up8,
17321
+ up: up9,
17314
17322
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
17315
17323
  },
17316
17324
  {
17317
17325
  version: 8,
17318
17326
  name: "embeddings-unique-hash",
17319
- up: up9
17327
+ up: up10
17320
17328
  },
17321
17329
  {
17322
17330
  version: 9,
17323
17331
  name: "summary-jobs",
17324
- up: up10,
17332
+ up: up11,
17325
17333
  artifacts: { tables: ["summary_jobs"] }
17326
17334
  },
17327
17335
  {
17328
17336
  version: 10,
17329
17337
  name: "umap-cache",
17330
- up: up11,
17338
+ up: up12,
17331
17339
  artifacts: { tables: ["umap_cache"] }
17332
17340
  },
17333
17341
  {
17334
17342
  version: 11,
17335
17343
  name: "session-scores",
17336
- up: up12,
17344
+ up: up13,
17337
17345
  artifacts: { tables: ["session_scores"] }
17338
17346
  },
17339
17347
  {
17340
17348
  version: 12,
17341
17349
  name: "scheduled-tasks",
17342
- up: up13,
17350
+ up: up14,
17343
17351
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
17344
17352
  },
17345
17353
  {
17346
17354
  version: 13,
17347
17355
  name: "ingestion-tracking",
17348
- up: up14,
17356
+ up: up15,
17349
17357
  artifacts: {
17350
17358
  columns: [
17351
17359
  { table: "memories", column: "source_path" },
@@ -17356,13 +17364,13 @@ var MIGRATIONS = [
17356
17364
  {
17357
17365
  version: 14,
17358
17366
  name: "telemetry",
17359
- up: up15,
17367
+ up: up16,
17360
17368
  artifacts: { tables: ["telemetry_events"] }
17361
17369
  },
17362
17370
  {
17363
17371
  version: 15,
17364
17372
  name: "session-memories",
17365
- up: up16,
17373
+ up: up17,
17366
17374
  artifacts: {
17367
17375
  tables: ["session_memories"],
17368
17376
  columns: [
@@ -17374,13 +17382,13 @@ var MIGRATIONS = [
17374
17382
  {
17375
17383
  version: 16,
17376
17384
  name: "session-checkpoints",
17377
- up: up17,
17385
+ up: up18,
17378
17386
  artifacts: { tables: ["session_checkpoints"] }
17379
17387
  },
17380
17388
  {
17381
17389
  version: 17,
17382
17390
  name: "task-skills",
17383
- up: up18,
17391
+ up: up19,
17384
17392
  artifacts: {
17385
17393
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
17386
17394
  }
@@ -17388,13 +17396,13 @@ var MIGRATIONS = [
17388
17396
  {
17389
17397
  version: 18,
17390
17398
  name: "skill-meta",
17391
- up: up19,
17399
+ up: up20,
17392
17400
  artifacts: { tables: ["skill_meta"] }
17393
17401
  },
17394
17402
  {
17395
17403
  version: 19,
17396
17404
  name: "knowledge-structure",
17397
- up: up20,
17405
+ up: up21,
17398
17406
  artifacts: {
17399
17407
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
17400
17408
  columns: [{ table: "entities", column: "agent_id" }]
@@ -17403,7 +17411,7 @@ var MIGRATIONS = [
17403
17411
  {
17404
17412
  version: 20,
17405
17413
  name: "session-structural-columns",
17406
- up: up21,
17414
+ up: up22,
17407
17415
  artifacts: {
17408
17416
  columns: [
17409
17417
  { table: "session_memories", column: "entity_slot" },
@@ -17416,7 +17424,7 @@ var MIGRATIONS = [
17416
17424
  {
17417
17425
  version: 21,
17418
17426
  name: "checkpoint-structural",
17419
- up: up22,
17427
+ up: up23,
17420
17428
  artifacts: {
17421
17429
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
17422
17430
  }
@@ -17424,7 +17432,7 @@ var MIGRATIONS = [
17424
17432
  {
17425
17433
  version: 22,
17426
17434
  name: "entity-pinning",
17427
- up: up23,
17435
+ up: up24,
17428
17436
  artifacts: {
17429
17437
  columns: [
17430
17438
  { table: "entities", column: "pinned" },
@@ -17435,17 +17443,17 @@ var MIGRATIONS = [
17435
17443
  {
17436
17444
  version: 23,
17437
17445
  name: "retired-scorer-gap",
17438
- up: up24
17446
+ up: up25
17439
17447
  },
17440
17448
  {
17441
17449
  version: 24,
17442
17450
  name: "retired-scorer-gap",
17443
- up: up25
17451
+ up: up26
17444
17452
  },
17445
17453
  {
17446
17454
  version: 25,
17447
17455
  name: "agent-feedback",
17448
- up: up26,
17456
+ up: up27,
17449
17457
  artifacts: {
17450
17458
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
17451
17459
  }
@@ -17453,32 +17461,32 @@ var MIGRATIONS = [
17453
17461
  {
17454
17462
  version: 26,
17455
17463
  name: "retired-scorer-gap",
17456
- up: up27
17464
+ up: up28
17457
17465
  },
17458
17466
  {
17459
17467
  version: 27,
17460
17468
  name: "backfill-canonical-names",
17461
- up: up28
17469
+ up: up29
17462
17470
  },
17463
17471
  {
17464
17472
  version: 28,
17465
17473
  name: "lossless-retention",
17466
- up: up29
17474
+ up: up30
17467
17475
  },
17468
17476
  {
17469
17477
  version: 29,
17470
17478
  name: "session-summary-dag",
17471
- up: up30
17479
+ up: up31
17472
17480
  },
17473
17481
  {
17474
17482
  version: 30,
17475
17483
  name: "nullable-memory-job-memory-id",
17476
- up: up31
17484
+ up: up32
17477
17485
  },
17478
17486
  {
17479
17487
  version: 31,
17480
17488
  name: "dependency-reason",
17481
- up: up32,
17489
+ up: up33,
17482
17490
  artifacts: {
17483
17491
  columns: [
17484
17492
  { table: "entity_dependencies", column: "reason" },
@@ -17489,7 +17497,7 @@ var MIGRATIONS = [
17489
17497
  {
17490
17498
  version: 32,
17491
17499
  name: "embeddings-vector-column",
17492
- up: up33,
17500
+ up: up34,
17493
17501
  artifacts: {
17494
17502
  columns: [{ table: "embeddings", column: "vector", optional: true }]
17495
17503
  }
@@ -17497,7 +17505,7 @@ var MIGRATIONS = [
17497
17505
  {
17498
17506
  version: 33,
17499
17507
  name: "scope",
17500
- up: up34,
17508
+ up: up35,
17501
17509
  artifacts: {
17502
17510
  columns: [{ table: "memories", column: "scope" }]
17503
17511
  }
@@ -17505,17 +17513,17 @@ var MIGRATIONS = [
17505
17513
  {
17506
17514
  version: 34,
17507
17515
  name: "scope-aware-dedup",
17508
- up: up35
17516
+ up: up36
17509
17517
  },
17510
17518
  {
17511
17519
  version: 35,
17512
17520
  name: "entity-fts",
17513
- up: up36
17521
+ up: up37
17514
17522
  },
17515
17523
  {
17516
17524
  version: 36,
17517
17525
  name: "dependency-confidence",
17518
- up: up37,
17526
+ up: up38,
17519
17527
  artifacts: {
17520
17528
  columns: [{ table: "entity_dependencies", column: "confidence" }]
17521
17529
  }
@@ -17523,7 +17531,7 @@ var MIGRATIONS = [
17523
17531
  {
17524
17532
  version: 37,
17525
17533
  name: "entity-communities",
17526
- up: up38,
17534
+ up: up39,
17527
17535
  artifacts: {
17528
17536
  tables: ["entity_communities"],
17529
17537
  columns: [{ table: "entities", column: "community_id" }]
@@ -17532,24 +17540,24 @@ var MIGRATIONS = [
17532
17540
  {
17533
17541
  version: 38,
17534
17542
  name: "memory-hints",
17535
- up: up39,
17543
+ up: up40,
17536
17544
  artifacts: { tables: ["memory_hints"] }
17537
17545
  },
17538
17546
  {
17539
17547
  version: 39,
17540
17548
  name: "dedup-entity-dependencies",
17541
- up: up40
17549
+ up: up41
17542
17550
  },
17543
17551
  {
17544
17552
  version: 40,
17545
17553
  name: "session-transcripts",
17546
- up: up41,
17554
+ up: up42,
17547
17555
  artifacts: { tables: ["session_transcripts"] }
17548
17556
  },
17549
17557
  {
17550
17558
  version: 41,
17551
17559
  name: "path-feedback",
17552
- up: up42,
17560
+ up: up43,
17553
17561
  artifacts: {
17554
17562
  tables: [
17555
17563
  "path_feedback_events",
@@ -17564,7 +17572,7 @@ var MIGRATIONS = [
17564
17572
  {
17565
17573
  version: 42,
17566
17574
  name: "session-memories-agent-id",
17567
- up: up43,
17575
+ up: up44,
17568
17576
  artifacts: {
17569
17577
  columns: [{ table: "session_memories", column: "agent_id" }]
17570
17578
  }
@@ -17572,7 +17580,7 @@ var MIGRATIONS = [
17572
17580
  {
17573
17581
  version: 43,
17574
17582
  name: "agents-table",
17575
- up: up44,
17583
+ up: up45,
17576
17584
  artifacts: {
17577
17585
  tables: ["agents"],
17578
17586
  columns: [
@@ -17584,7 +17592,7 @@ var MIGRATIONS = [
17584
17592
  {
17585
17593
  version: 44,
17586
17594
  name: "memory-md-temporal-head",
17587
- up: up45,
17595
+ up: up46,
17588
17596
  artifacts: {
17589
17597
  columns: [
17590
17598
  { table: "session_summaries", column: "source_type" },
@@ -17596,7 +17604,7 @@ var MIGRATIONS = [
17596
17604
  {
17597
17605
  version: 45,
17598
17606
  name: "lossless-working-memory-hardening",
17599
- up: up46,
17607
+ up: up47,
17600
17608
  artifacts: {
17601
17609
  tables: ["session_transcripts_fts", "memory_md_heads"],
17602
17610
  columns: [
@@ -17609,17 +17617,17 @@ var MIGRATIONS = [
17609
17617
  {
17610
17618
  version: 46,
17611
17619
  name: "session-summary-uniqueness",
17612
- up: up47
17620
+ up: up48
17613
17621
  },
17614
17622
  {
17615
17623
  version: 47,
17616
17624
  name: "agent-scoped-temporal-uniqueness",
17617
- up: up48
17625
+ up: up49
17618
17626
  },
17619
17627
  {
17620
17628
  version: 48,
17621
17629
  name: "thread-heads",
17622
- up: up49,
17630
+ up: up50,
17623
17631
  artifacts: {
17624
17632
  tables: ["memory_thread_heads"]
17625
17633
  }
@@ -17627,7 +17635,7 @@ var MIGRATIONS = [
17627
17635
  {
17628
17636
  version: 49,
17629
17637
  name: "session-extract-cursors",
17630
- up: up50,
17638
+ up: up51,
17631
17639
  artifacts: {
17632
17640
  tables: ["session_extract_cursors"]
17633
17641
  }
@@ -17635,7 +17643,7 @@ var MIGRATIONS = [
17635
17643
  {
17636
17644
  version: 50,
17637
17645
  name: "related-to-audit",
17638
- up: up51,
17646
+ up: up52,
17639
17647
  artifacts: {
17640
17648
  tables: ["entity_dependency_history"]
17641
17649
  }
@@ -17643,7 +17651,7 @@ var MIGRATIONS = [
17643
17651
  {
17644
17652
  version: 51,
17645
17653
  name: "memory-md-rolling-window-lineage",
17646
- up: up52,
17654
+ up: up53,
17647
17655
  artifacts: {
17648
17656
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
17649
17657
  columns: [
@@ -17658,7 +17666,7 @@ var MIGRATIONS = [
17658
17666
  {
17659
17667
  version: 52,
17660
17668
  name: "mcp-invocations",
17661
- up: up53,
17669
+ up: up54,
17662
17670
  artifacts: {
17663
17671
  tables: ["mcp_invocations"]
17664
17672
  }
@@ -17666,7 +17674,7 @@ var MIGRATIONS = [
17666
17674
  {
17667
17675
  version: 53,
17668
17676
  name: "skill-invocations",
17669
- up: up54,
17677
+ up: up55,
17670
17678
  artifacts: {
17671
17679
  tables: ["skill_invocations"]
17672
17680
  }
@@ -17674,7 +17682,7 @@ var MIGRATIONS = [
17674
17682
  {
17675
17683
  version: 54,
17676
17684
  name: "task-agent-scope",
17677
- up: up55,
17685
+ up: up56,
17678
17686
  artifacts: {
17679
17687
  tables: ["task_scope_hints"]
17680
17688
  }
@@ -17682,7 +17690,7 @@ var MIGRATIONS = [
17682
17690
  {
17683
17691
  version: 55,
17684
17692
  name: "dreaming-state",
17685
- up: up56,
17693
+ up: up57,
17686
17694
  artifacts: {
17687
17695
  tables: ["dreaming_state", "dreaming_passes"]
17688
17696
  }
@@ -17690,22 +17698,22 @@ var MIGRATIONS = [
17690
17698
  {
17691
17699
  version: 56,
17692
17700
  name: "agent-scoped-content-hash",
17693
- up: up57
17701
+ up: up58
17694
17702
  },
17695
17703
  {
17696
17704
  version: 57,
17697
17705
  name: "memories-fts-tokenizer-repair",
17698
- up: up58
17706
+ up: up59
17699
17707
  },
17700
17708
  {
17701
17709
  version: 58,
17702
17710
  name: "knowledge-graph-indices",
17703
- up: up59
17711
+ up: up60
17704
17712
  },
17705
17713
  {
17706
17714
  version: 59,
17707
17715
  name: "entity-attribute-claim-key",
17708
- up: up60,
17716
+ up: up61,
17709
17717
  artifacts: {
17710
17718
  columns: [{ table: "entity_attributes", column: "claim_key" }]
17711
17719
  }
@@ -17713,7 +17721,7 @@ var MIGRATIONS = [
17713
17721
  {
17714
17722
  version: 60,
17715
17723
  name: "entity-attribute-group-key",
17716
- up: up61,
17724
+ up: up62,
17717
17725
  artifacts: {
17718
17726
  columns: [{ table: "entity_attributes", column: "group_key" }]
17719
17727
  }
@@ -17721,7 +17729,7 @@ var MIGRATIONS = [
17721
17729
  {
17722
17730
  version: 61,
17723
17731
  name: "memory-artifact-source-mtime",
17724
- up: up62,
17732
+ up: up63,
17725
17733
  artifacts: {
17726
17734
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
17727
17735
  }
@@ -17729,7 +17737,7 @@ var MIGRATIONS = [
17729
17737
  {
17730
17738
  version: 62,
17731
17739
  name: "memory-artifact-soft-delete",
17732
- up: up63,
17740
+ up: up64,
17733
17741
  artifacts: {
17734
17742
  columns: [
17735
17743
  { table: "memory_artifacts", column: "is_deleted" },
@@ -17740,12 +17748,12 @@ var MIGRATIONS = [
17740
17748
  {
17741
17749
  version: 63,
17742
17750
  name: "content-only-memories-fts-update",
17743
- up: up64
17751
+ up: up65
17744
17752
  },
17745
17753
  {
17746
17754
  version: 64,
17747
17755
  name: "source-graph-provenance",
17748
- up: up65,
17756
+ up: up66,
17749
17757
  artifacts: {
17750
17758
  columns: [
17751
17759
  { table: "entities", column: "source_path" },
@@ -17758,7 +17766,7 @@ var MIGRATIONS = [
17758
17766
  {
17759
17767
  version: 65,
17760
17768
  name: "source-embedding-agent-scope",
17761
- up: up66,
17769
+ up: up67,
17762
17770
  artifacts: {
17763
17771
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
17764
17772
  }
@@ -17766,7 +17774,7 @@ var MIGRATIONS = [
17766
17774
  {
17767
17775
  version: 66,
17768
17776
  name: "memory-search-telemetry",
17769
- up: up67,
17777
+ up: up68,
17770
17778
  artifacts: {
17771
17779
  tables: ["memory_search_telemetry"]
17772
17780
  }
@@ -17774,7 +17782,7 @@ var MIGRATIONS = [
17774
17782
  {
17775
17783
  version: 67,
17776
17784
  name: "ontology-proposals",
17777
- up: up68,
17785
+ up: up69,
17778
17786
  artifacts: {
17779
17787
  tables: ["ontology_proposals"],
17780
17788
  columns: [
@@ -17788,7 +17796,7 @@ var MIGRATIONS = [
17788
17796
  {
17789
17797
  version: 68,
17790
17798
  name: "daily-reflections",
17791
- up: up69,
17799
+ up: up70,
17792
17800
  artifacts: {
17793
17801
  tables: ["daily_reflections"]
17794
17802
  }
@@ -17796,7 +17804,7 @@ var MIGRATIONS = [
17796
17804
  {
17797
17805
  version: 69,
17798
17806
  name: "daily-reflections-multiple-insights",
17799
- up: up70,
17807
+ up: up71,
17800
17808
  artifacts: {
17801
17809
  tables: ["daily_reflections"]
17802
17810
  }
@@ -17804,7 +17812,7 @@ var MIGRATIONS = [
17804
17812
  {
17805
17813
  version: 70,
17806
17814
  name: "ontology-control-plane-state",
17807
- up: up71,
17815
+ up: up72,
17808
17816
  artifacts: {
17809
17817
  columns: [
17810
17818
  { table: "entities", column: "status" },
@@ -17819,7 +17827,7 @@ var MIGRATIONS = [
17819
17827
  {
17820
17828
  version: 71,
17821
17829
  name: "epistemic-assertions",
17822
- up: up72,
17830
+ up: up73,
17823
17831
  artifacts: {
17824
17832
  tables: ["epistemic_assertions"]
17825
17833
  }
@@ -17827,7 +17835,7 @@ var MIGRATIONS = [
17827
17835
  {
17828
17836
  version: 72,
17829
17837
  name: "agent-scoped-idempotency-key",
17830
- up: up73,
17838
+ up: up74,
17831
17839
  artifacts: {
17832
17840
  columns: [
17833
17841
  { table: "memories", column: "idempotency_key" },
@@ -17838,7 +17846,7 @@ var MIGRATIONS = [
17838
17846
  {
17839
17847
  version: 73,
17840
17848
  name: "recall-context-dedupe",
17841
- up: up74,
17849
+ up: up75,
17842
17850
  artifacts: {
17843
17851
  tables: ["session_context_epochs", "session_recall_events"]
17844
17852
  }
@@ -17846,7 +17854,7 @@ var MIGRATIONS = [
17846
17854
  {
17847
17855
  version: 74,
17848
17856
  name: "aggregate-memory-links",
17849
- up: up75,
17857
+ up: up76,
17850
17858
  artifacts: {
17851
17859
  tables: ["aggregate_memory_sources"]
17852
17860
  }
@@ -17854,7 +17862,7 @@ var MIGRATIONS = [
17854
17862
  {
17855
17863
  version: 75,
17856
17864
  name: "memory-artifact-source-provenance",
17857
- up: up76,
17865
+ up: up77,
17858
17866
  artifacts: {
17859
17867
  columns: [
17860
17868
  { table: "memory_artifacts", column: "source_id" },
@@ -17868,7 +17876,7 @@ var MIGRATIONS = [
17868
17876
  {
17869
17877
  version: 76,
17870
17878
  name: "temporal-edges",
17871
- up: up77,
17879
+ up: up78,
17872
17880
  artifacts: {
17873
17881
  tables: ["temporal_edges"]
17874
17882
  }
@@ -17876,7 +17884,7 @@ var MIGRATIONS = [
17876
17884
  {
17877
17885
  version: 77,
17878
17886
  name: "entity-aliases",
17879
- up: up78,
17887
+ up: up79,
17880
17888
  artifacts: {
17881
17889
  tables: ["entity_aliases"]
17882
17890
  }
@@ -17884,7 +17892,7 @@ var MIGRATIONS = [
17884
17892
  {
17885
17893
  version: 78,
17886
17894
  name: "api-keys",
17887
- up: up79,
17895
+ up: up80,
17888
17896
  artifacts: {
17889
17897
  tables: ["api_keys"]
17890
17898
  }
@@ -17892,7 +17900,7 @@ var MIGRATIONS = [
17892
17900
  {
17893
17901
  version: 79,
17894
17902
  name: "transcript-capture-jobs",
17895
- up: up80,
17903
+ up: up81,
17896
17904
  artifacts: {
17897
17905
  tables: ["transcript_capture_jobs"]
17898
17906
  }
@@ -17900,7 +17908,7 @@ var MIGRATIONS = [
17900
17908
  {
17901
17909
  version: 80,
17902
17910
  name: "document-scope-columns",
17903
- up: up81,
17911
+ up: up82,
17904
17912
  artifacts: {
17905
17913
  columns: [
17906
17914
  { table: "documents", column: "agent_id" },
@@ -17911,7 +17919,7 @@ var MIGRATIONS = [
17911
17919
  {
17912
17920
  version: 81,
17913
17921
  name: "aggregate-evidence-sources",
17914
- up: up82,
17922
+ up: up83,
17915
17923
  artifacts: {
17916
17924
  tables: ["aggregate_evidence_sources"]
17917
17925
  }
@@ -17919,7 +17927,7 @@ var MIGRATIONS = [
17919
17927
  {
17920
17928
  version: 82,
17921
17929
  name: "skill-invocations-harness",
17922
- up: up83,
17930
+ up: up84,
17923
17931
  artifacts: {
17924
17932
  columns: [
17925
17933
  { table: "skill_invocations", column: "harness" },
@@ -17930,7 +17938,7 @@ var MIGRATIONS = [
17930
17938
  {
17931
17939
  version: 83,
17932
17940
  name: "memory-lifecycle-repair",
17933
- up: up84,
17941
+ up: up85,
17934
17942
  artifacts: {
17935
17943
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17936
17944
  columns: [
@@ -17945,7 +17953,7 @@ var MIGRATIONS = [
17945
17953
  {
17946
17954
  version: 84,
17947
17955
  name: "legacy-markdown-import-state",
17948
- up: up85,
17956
+ up: up86,
17949
17957
  artifacts: {
17950
17958
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17951
17959
  }
@@ -17953,7 +17961,7 @@ var MIGRATIONS = [
17953
17961
  {
17954
17962
  version: 85,
17955
17963
  name: "backfill-relations-to-dependencies",
17956
- up: up86,
17964
+ up: up87,
17957
17965
  artifacts: {
17958
17966
  tables: ["entity_dependencies"]
17959
17967
  }
@@ -17961,7 +17969,7 @@ var MIGRATIONS = [
17961
17969
  {
17962
17970
  version: 86,
17963
17971
  name: "summary-jobs-content-hash",
17964
- up: up87,
17972
+ up: up88,
17965
17973
  artifacts: {
17966
17974
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17967
17975
  }
@@ -17969,7 +17977,7 @@ var MIGRATIONS = [
17969
17977
  {
17970
17978
  version: 87,
17971
17979
  name: "summary-jobs-boundary-reason",
17972
- up: up88,
17980
+ up: up89,
17973
17981
  artifacts: {
17974
17982
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17975
17983
  }
@@ -17977,7 +17985,7 @@ var MIGRATIONS = [
17977
17985
  {
17978
17986
  version: 88,
17979
17987
  name: "transcript-recovery-files",
17980
- up: up89,
17988
+ up: up90,
17981
17989
  artifacts: {
17982
17990
  tables: ["transcript_recovery_files"]
17983
17991
  }
@@ -17985,7 +17993,7 @@ var MIGRATIONS = [
17985
17993
  {
17986
17994
  version: 89,
17987
17995
  name: "job-cancellations",
17988
- up: up90,
17996
+ up: up91,
17989
17997
  artifacts: {
17990
17998
  tables: ["job_cancellations"]
17991
17999
  }
@@ -17993,7 +18001,7 @@ var MIGRATIONS = [
17993
18001
  {
17994
18002
  version: 90,
17995
18003
  name: "job-archive",
17996
- up: up91,
18004
+ up: up92,
17997
18005
  artifacts: {
17998
18006
  tables: ["job_archive"]
17999
18007
  }
@@ -18001,25 +18009,25 @@ var MIGRATIONS = [
18001
18009
  {
18002
18010
  version: 91,
18003
18011
  name: "embedding-index-generations",
18004
- up: up92,
18012
+ up: up93,
18005
18013
  artifacts: { tables: ["embedding_index_state"] }
18006
18014
  },
18007
18015
  {
18008
18016
  version: 92,
18009
18017
  name: "embedding-staging-store",
18010
- up: up93,
18018
+ up: up94,
18011
18019
  artifacts: { tables: ["embeddings_staging"] }
18012
18020
  },
18013
18021
  {
18014
18022
  version: 93,
18015
18023
  name: "dreaming-evidence-cursor",
18016
- up: up94,
18024
+ up: up95,
18017
18025
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
18018
18026
  },
18019
18027
  {
18020
18028
  version: 94,
18021
18029
  name: "memory-kind",
18022
- up: up95,
18030
+ up: up96,
18023
18031
  artifacts: {
18024
18032
  columns: [
18025
18033
  { table: "memories", column: "memory_kind" },
@@ -18030,35 +18038,35 @@ var MIGRATIONS = [
18030
18038
  {
18031
18039
  version: 95,
18032
18040
  name: "compaction-recall-projections",
18033
- up: up96
18041
+ up: up97
18034
18042
  },
18035
18043
  {
18036
18044
  version: 96,
18037
18045
  name: "retire-legacy-ingestion",
18038
- up: up97
18046
+ up: up98
18039
18047
  },
18040
18048
  {
18041
18049
  version: 97,
18042
18050
  name: "dreaming-failure-backoff",
18043
- up: up98,
18051
+ up: up99,
18044
18052
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
18045
18053
  },
18046
18054
  {
18047
18055
  version: 98,
18048
18056
  name: "dreaming-evidence-exclusions",
18049
- up: up99,
18057
+ up: up100,
18050
18058
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
18051
18059
  },
18052
18060
  {
18053
18061
  version: 99,
18054
18062
  name: "dreaming-tool-calls",
18055
- up: up100,
18063
+ up: up101,
18056
18064
  artifacts: { tables: ["dreaming_tool_calls"] }
18057
18065
  },
18058
18066
  {
18059
18067
  version: 100,
18060
18068
  name: "dreaming-runbook",
18061
- up: up101,
18069
+ up: up102,
18062
18070
  artifacts: {
18063
18071
  columns: [
18064
18072
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -18069,23 +18077,23 @@ var MIGRATIONS = [
18069
18077
  {
18070
18078
  version: 101,
18071
18079
  name: "dreaming-attention",
18072
- up: up102,
18080
+ up: up103,
18073
18081
  artifacts: { tables: ["dreaming_attention"] }
18074
18082
  },
18075
18083
  {
18076
18084
  version: 102,
18077
18085
  name: "attribute-semantic-memories",
18078
- up: up103
18086
+ up: up104
18079
18087
  },
18080
18088
  {
18081
18089
  version: 103,
18082
18090
  name: "semantic-memory-kind",
18083
- up: up104
18091
+ up: up105
18084
18092
  },
18085
18093
  {
18086
18094
  version: 104,
18087
18095
  name: "derived-memory-provenance",
18088
- up: up105,
18096
+ up: up106,
18089
18097
  artifacts: {
18090
18098
  tables: ["derived_memory_sources"],
18091
18099
  columns: [{ table: "memories", column: "stale_at" }]
@@ -18094,12 +18102,12 @@ var MIGRATIONS = [
18094
18102
  {
18095
18103
  version: 105,
18096
18104
  name: "agent-scoped-entity-name",
18097
- up: up106
18105
+ up: up107
18098
18106
  },
18099
18107
  {
18100
18108
  version: 106,
18101
18109
  name: "memory-review-after",
18102
- up: up107,
18110
+ up: up108,
18103
18111
  artifacts: {
18104
18112
  columns: [{ table: "memories", column: "review_after" }]
18105
18113
  }
@@ -18107,7 +18115,7 @@ var MIGRATIONS = [
18107
18115
  {
18108
18116
  version: 107,
18109
18117
  name: "dreaming-pass-usage",
18110
- up: up108,
18118
+ up: up109,
18111
18119
  artifacts: {
18112
18120
  columns: [
18113
18121
  { table: "dreaming_passes", column: "tokens_input" },
@@ -18121,7 +18129,7 @@ var MIGRATIONS = [
18121
18129
  {
18122
18130
  version: 108,
18123
18131
  name: "embedding-usage",
18124
- up: up109,
18132
+ up: up110,
18125
18133
  artifacts: {
18126
18134
  tables: ["embedding_usage"]
18127
18135
  }
@@ -18129,7 +18137,7 @@ var MIGRATIONS = [
18129
18137
  {
18130
18138
  version: 109,
18131
18139
  name: "telemetry-install",
18132
- up: up110,
18140
+ up: up111,
18133
18141
  artifacts: {
18134
18142
  tables: ["telemetry_install"]
18135
18143
  }
@@ -18137,12 +18145,12 @@ var MIGRATIONS = [
18137
18145
  {
18138
18146
  version: 110,
18139
18147
  name: "memory-mention-join-index",
18140
- up: up111
18148
+ up: up112
18141
18149
  },
18142
18150
  {
18143
18151
  version: 111,
18144
18152
  name: "telemetry-first-use",
18145
- up: up112,
18153
+ up: up113,
18146
18154
  artifacts: {
18147
18155
  columns: [
18148
18156
  { table: "telemetry_install", column: "first_remember_at" },
@@ -18153,7 +18161,7 @@ var MIGRATIONS = [
18153
18161
  {
18154
18162
  version: 112,
18155
18163
  name: "telemetry-queue-ownership",
18156
- up: up113,
18164
+ up: up114,
18157
18165
  artifacts: {
18158
18166
  columns: [
18159
18167
  { table: "telemetry_events", column: "source" },
@@ -18165,7 +18173,7 @@ var MIGRATIONS = [
18165
18173
  {
18166
18174
  version: 113,
18167
18175
  name: "session-claims",
18168
- up: up114,
18176
+ up: up115,
18169
18177
  artifacts: {
18170
18178
  tables: ["session_claims"],
18171
18179
  columns: [
@@ -18179,12 +18187,12 @@ var MIGRATIONS = [
18179
18187
  {
18180
18188
  version: 114,
18181
18189
  name: "memory-traversal-hydration-index",
18182
- up: up115
18190
+ up: up116
18183
18191
  },
18184
18192
  {
18185
18193
  version: 115,
18186
18194
  name: "cross-agent-message-notifications",
18187
- up: up116,
18195
+ up: up117,
18188
18196
  artifacts: {
18189
18197
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
18190
18198
  }
@@ -18192,7 +18200,7 @@ var MIGRATIONS = [
18192
18200
  {
18193
18201
  version: 116,
18194
18202
  name: "acp-delivery-reconciliation",
18195
- up: up117,
18203
+ up: up118,
18196
18204
  artifacts: {
18197
18205
  columns: [
18198
18206
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -18206,7 +18214,7 @@ var MIGRATIONS = [
18206
18214
  {
18207
18215
  version: 117,
18208
18216
  name: "retire-summary-worker",
18209
- up: up118,
18217
+ up: up119,
18210
18218
  artifacts: {
18211
18219
  columns: [
18212
18220
  { table: "session_transcripts", column: "completed_at" },
@@ -18217,24 +18225,24 @@ var MIGRATIONS = [
18217
18225
  {
18218
18226
  version: 118,
18219
18227
  name: "queue-pressure-indices",
18220
- up: up119
18228
+ up: up120
18221
18229
  },
18222
18230
  {
18223
18231
  version: 119,
18224
18232
  name: "telemetry-version-observation",
18225
- up: up120,
18233
+ up: up121,
18226
18234
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
18227
18235
  },
18228
18236
  {
18229
18237
  version: 120,
18230
18238
  name: "source-lifecycle-telemetry",
18231
- up: up121,
18239
+ up: up122,
18232
18240
  artifacts: { tables: ["source_lifecycle_state"] }
18233
18241
  },
18234
18242
  {
18235
18243
  version: 121,
18236
18244
  name: "telemetry-delivery-health",
18237
- up: up122,
18245
+ up: up123,
18238
18246
  artifacts: {
18239
18247
  tables: ["telemetry_delivery_state"],
18240
18248
  columns: [
@@ -18248,7 +18256,7 @@ var MIGRATIONS = [
18248
18256
  {
18249
18257
  version: 122,
18250
18258
  name: "dreaming-evidence-retry",
18251
- up: up123,
18259
+ up: up124,
18252
18260
  artifacts: {
18253
18261
  columns: [
18254
18262
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -18261,13 +18269,13 @@ var MIGRATIONS = [
18261
18269
  {
18262
18270
  version: 123,
18263
18271
  name: "embedding-index-failures",
18264
- up: up124,
18272
+ up: up125,
18265
18273
  artifacts: { tables: ["embedding_index_failures"] }
18266
18274
  },
18267
18275
  {
18268
18276
  version: 124,
18269
18277
  name: "import-derived-lifecycle",
18270
- up: up125,
18278
+ up: up126,
18271
18279
  artifacts: {
18272
18280
  tables: ["imported_source_lifecycle"]
18273
18281
  }
@@ -18275,77 +18283,77 @@ var MIGRATIONS = [
18275
18283
  {
18276
18284
  version: 125,
18277
18285
  name: "memory-content-safety",
18278
- up: up126,
18286
+ up: up127,
18279
18287
  artifacts: { tables: ["memory_content_safety"] }
18280
18288
  },
18281
18289
  {
18282
18290
  version: 126,
18283
18291
  name: "dreaming-surprisal-attention",
18284
- up: up127,
18292
+ up: up128,
18285
18293
  artifacts: { tables: ["dreaming_attention"] }
18286
18294
  },
18287
18295
  {
18288
18296
  version: 127,
18289
18297
  name: "ontology-contradictions",
18290
- up: up128,
18298
+ up: up129,
18291
18299
  artifacts: { tables: ["ontology_contradictions"] }
18292
18300
  },
18293
18301
  {
18294
18302
  version: 128,
18295
18303
  name: "bounded-queue-diagnostics",
18296
- up: up129
18304
+ up: up130
18297
18305
  },
18298
18306
  {
18299
18307
  version: 129,
18300
18308
  name: "retire-structural-jobs",
18301
- up: up130
18309
+ up: up131
18302
18310
  },
18303
18311
  {
18304
18312
  version: 130,
18305
18313
  name: "embedding-repair-state",
18306
- up: up131,
18314
+ up: up132,
18307
18315
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
18308
18316
  },
18309
18317
  {
18310
18318
  version: 131,
18311
18319
  name: "dreaming-evidence-consumption",
18312
- up: up132,
18320
+ up: up133,
18313
18321
  artifacts: { tables: ["dreaming_evidence_consumption"] }
18314
18322
  },
18315
18323
  {
18316
18324
  version: 132,
18317
18325
  name: "observer-scoped-epistemic-assertions",
18318
- up: up133,
18326
+ up: up134,
18319
18327
  artifacts: { tables: ["epistemic_assertions"] }
18320
18328
  },
18321
18329
  {
18322
18330
  version: 133,
18323
18331
  name: "dreaming-memory-head",
18324
- up: up134,
18332
+ up: up135,
18325
18333
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
18326
18334
  },
18327
18335
  {
18328
18336
  version: 134,
18329
18337
  name: "scope-memory-head-entries",
18330
- up: up135,
18338
+ up: up136,
18331
18339
  artifacts: { tables: ["memory_head_entries"] }
18332
18340
  },
18333
18341
  {
18334
18342
  version: 135,
18335
18343
  name: "memory-head-publication",
18336
- up: up136,
18344
+ up: up137,
18337
18345
  artifacts: { tables: ["memory_head_publications"] }
18338
18346
  },
18339
18347
  {
18340
18348
  version: 136,
18341
18349
  name: "memory-head-revisions",
18342
- up: up137,
18350
+ up: up138,
18343
18351
  artifacts: { tables: ["memory_head_revisions"] }
18344
18352
  },
18345
18353
  {
18346
18354
  version: 137,
18347
18355
  name: "dreaming-head-manifest",
18348
- up: up138,
18356
+ up: up139,
18349
18357
  artifacts: {
18350
18358
  columns: [
18351
18359
  { table: "dreaming_passes", column: "head_revision" },
@@ -18356,7 +18364,7 @@ var MIGRATIONS = [
18356
18364
  {
18357
18365
  version: 138,
18358
18366
  name: "bounded-status-projections",
18359
- up: up139,
18367
+ up: up140,
18360
18368
  artifacts: {
18361
18369
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
18362
18370
  }
@@ -18364,31 +18372,31 @@ var MIGRATIONS = [
18364
18372
  {
18365
18373
  version: 139,
18366
18374
  name: "native-source-sync-state",
18367
- up: up140,
18375
+ up: up141,
18368
18376
  artifacts: { tables: ["native_source_sync_state"] }
18369
18377
  },
18370
18378
  {
18371
18379
  version: 140,
18372
18380
  name: "transcript-recovery-frontier",
18373
- up: up141,
18381
+ up: up142,
18374
18382
  artifacts: { tables: ["transcript_recovery_frontiers"] }
18375
18383
  },
18376
18384
  {
18377
18385
  version: 141,
18378
18386
  name: "source-sync-checkpoints",
18379
- up: up142,
18387
+ up: up143,
18380
18388
  artifacts: { tables: ["source_sync_checkpoints"] }
18381
18389
  },
18382
18390
  {
18383
18391
  version: 142,
18384
18392
  name: "source-sync-frontier",
18385
- up: up143,
18393
+ up: up144,
18386
18394
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
18387
18395
  },
18388
18396
  {
18389
18397
  version: 143,
18390
18398
  name: "embedding-index-progress",
18391
- up: up144,
18399
+ up: up145,
18392
18400
  artifacts: {
18393
18401
  columns: [
18394
18402
  { table: "embedding_index_state", column: "migration_phase" },
@@ -18404,19 +18412,19 @@ var MIGRATIONS = [
18404
18412
  {
18405
18413
  version: 144,
18406
18414
  name: "memory-job-lease-token",
18407
- up: up145,
18415
+ up: up146,
18408
18416
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
18409
18417
  },
18410
18418
  {
18411
18419
  version: 145,
18412
18420
  name: "dreaming-evidence-reviews",
18413
- up: up146,
18421
+ up: up147,
18414
18422
  artifacts: { tables: ["dreaming_evidence_reviews"] }
18415
18423
  },
18416
18424
  {
18417
18425
  version: 146,
18418
18426
  name: "source-transcript-import",
18419
- up: up147,
18427
+ up: up148,
18420
18428
  artifacts: {
18421
18429
  tables: [
18422
18430
  "source_import_jobs",
@@ -18435,19 +18443,19 @@ var MIGRATIONS = [
18435
18443
  {
18436
18444
  version: 147,
18437
18445
  name: "source-import-replay-file-slots",
18438
- up: up148,
18446
+ up: up149,
18439
18447
  artifacts: { tables: ["source_import_files"] }
18440
18448
  },
18441
18449
  {
18442
18450
  version: 148,
18443
18451
  name: "source-import-attempt-provenance",
18444
- up: up149,
18452
+ up: up150,
18445
18453
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
18446
18454
  },
18447
18455
  {
18448
18456
  version: 149,
18449
18457
  name: "transcript-import-state-machine",
18450
- up: up150,
18458
+ up: up151,
18451
18459
  artifacts: {
18452
18460
  columns: [
18453
18461
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -18459,7 +18467,7 @@ var MIGRATIONS = [
18459
18467
  {
18460
18468
  version: 150,
18461
18469
  name: "memory-head-freshness",
18462
- up: up151,
18470
+ up: up152,
18463
18471
  artifacts: {
18464
18472
  columns: [
18465
18473
  { table: "memory_md_heads", column: "is_current" },
@@ -18495,6 +18503,12 @@ var MIGRATIONS = [
18495
18503
  }))
18496
18504
  ]
18497
18505
  }
18506
+ },
18507
+ {
18508
+ version: 152,
18509
+ name: "memory-artifact-sha-index",
18510
+ up: up2,
18511
+ artifacts: { indexes: ["idx_memory_artifacts_agent_sha"] }
18498
18512
  }
18499
18513
  ];
18500
18514
  function checksum(m) {
@@ -18550,6 +18564,10 @@ function existingTables(db) {
18550
18564
  const rows = db.prepare("SELECT name FROM sqlite_master WHERE type='table'").all();
18551
18565
  return new Set(rows.filter(hasStringName).map((r) => r.name));
18552
18566
  }
18567
+ function existingIndexes(db) {
18568
+ const rows = db.prepare("SELECT name FROM sqlite_master WHERE type='index'").all();
18569
+ return new Set(rows.filter(hasStringName).map((r) => r.name));
18570
+ }
18553
18571
  function tableColumns2(db, table, cache) {
18554
18572
  let cols = cache.get(table);
18555
18573
  if (cols)
@@ -18559,45 +18577,38 @@ function tableColumns2(db, table, cache) {
18559
18577
  cache.set(table, cols);
18560
18578
  return cols;
18561
18579
  }
18580
+ function missingArtifact(db, artifacts, tables, indexes, colCache) {
18581
+ for (const table of artifacts.tables ?? []) {
18582
+ if (!tables.has(table))
18583
+ return `table "${table}"`;
18584
+ }
18585
+ for (const column of artifacts.columns ?? []) {
18586
+ if (!tables.has(column.table)) {
18587
+ if (column.optional)
18588
+ continue;
18589
+ return `column "${column.table}.${column.column}" (table missing)`;
18590
+ }
18591
+ if (!tableColumns2(db, column.table, colCache).has(column.column)) {
18592
+ if (column.optional)
18593
+ continue;
18594
+ return `column "${column.table}.${column.column}"`;
18595
+ }
18596
+ }
18597
+ for (const index of artifacts.indexes ?? []) {
18598
+ if (!indexes.has(index))
18599
+ return `index "${index}"`;
18600
+ }
18601
+ return;
18602
+ }
18562
18603
  function findPhantomVersions(db, precomputedApplied) {
18563
18604
  const tables = existingTables(db);
18605
+ const indexes = existingIndexes(db);
18564
18606
  const colCache = new Map;
18565
18607
  const phantoms = new Set;
18566
18608
  const applied = precomputedApplied ?? appliedVersions(db);
18567
18609
  for (const migration of MIGRATIONS) {
18568
- if (!migration.artifacts)
18569
- continue;
18570
- if (migration.version === 1)
18571
- continue;
18572
- if (!applied.has(migration.version))
18573
- continue;
18574
- let missing = false;
18575
- if (migration.artifacts.tables) {
18576
- for (const t of migration.artifacts.tables) {
18577
- if (!tables.has(t)) {
18578
- missing = true;
18579
- break;
18580
- }
18581
- }
18582
- }
18583
- if (!missing && migration.artifacts.columns) {
18584
- for (const col of migration.artifacts.columns) {
18585
- if (!tables.has(col.table)) {
18586
- if (col.optional)
18587
- continue;
18588
- missing = true;
18589
- break;
18590
- }
18591
- const cols = tableColumns2(db, col.table, colCache);
18592
- if (!cols.has(col.column)) {
18593
- if (col.optional)
18594
- continue;
18595
- missing = true;
18596
- break;
18597
- }
18598
- }
18599
- }
18600
- if (missing)
18610
+ const artifacts = migration.artifacts;
18611
+ if (artifacts && migration.version !== 1 && applied.has(migration.version) && missingArtifact(db, artifacts, tables, indexes, colCache))
18601
18612
  phantoms.add(migration.version);
18602
18613
  }
18603
18614
  return phantoms;
@@ -18620,30 +18631,12 @@ function appliedVersions(db) {
18620
18631
  return new Set(rows.filter(hasNumericVersion).map((r) => r.version));
18621
18632
  }
18622
18633
  function verifyArtifacts(db, migration) {
18623
- if (!migration.artifacts)
18634
+ const artifacts = migration.artifacts;
18635
+ if (!artifacts)
18624
18636
  return;
18625
- const tables = existingTables(db);
18626
- if (migration.artifacts.tables) {
18627
- for (const t of migration.artifacts.tables) {
18628
- if (!tables.has(t)) {
18629
- throw new Error(`Post-DDL verification failed: migration ${migration.version} (${migration.name}) ` + `declares table "${t}" but it was not created`);
18630
- }
18631
- }
18632
- }
18633
- if (migration.artifacts.columns) {
18634
- const colCache = new Map;
18635
- for (const col of migration.artifacts.columns) {
18636
- if (!tables.has(col.table)) {
18637
- if (col.optional)
18638
- continue;
18639
- throw new Error(`Post-DDL verification failed: migration ${migration.version} (${migration.name}) ` + `declares column "${col.table}.${col.column}" but table does not exist`);
18640
- }
18641
- const colNames = tableColumns2(db, col.table, colCache);
18642
- if (!colNames.has(col.column)) {
18643
- throw new Error(`Post-DDL verification failed: migration ${migration.version} (${migration.name}) ` + `declares column "${col.table}.${col.column}" but it was not created`);
18644
- }
18645
- }
18646
- }
18637
+ const missing = missingArtifact(db, artifacts, existingTables(db), existingIndexes(db), new Map);
18638
+ if (missing)
18639
+ throw new Error(`Post-DDL verification failed: migration ${migration.version} (${migration.name}) declares ${missing} but it was not created`);
18647
18640
  }
18648
18641
  function hasPendingMigrations(db) {
18649
18642
  ensureMetaTables(db);