@signetai/connector-base 1.0.2-next.2663 → 1.0.2-next.2664

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/agent-dir.js +447 -347
  2. package/dist/index.js +447 -347
  3. package/package.json +2 -2
package/dist/agent-dir.js CHANGED
@@ -10402,6 +10402,79 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
10402
10402
  "dreaming"
10403
10403
  ];
10404
10404
  function up(db) {
10405
+ if (!db.prepare("PRAGMA table_info(source_import_records)").all().some((row) => row.name === "redacted_bytes"))
10406
+ db.exec("ALTER TABLE source_import_records ADD COLUMN redacted_bytes INTEGER NOT NULL DEFAULT 0");
10407
+ db.exec(`
10408
+ CREATE TABLE IF NOT EXISTS session_transcript_deletions (
10409
+ agent_id TEXT NOT NULL,
10410
+ session_key TEXT NOT NULL,
10411
+ generation INTEGER NOT NULL DEFAULT 1,
10412
+ watermark TEXT NOT NULL,
10413
+ opened_at TEXT,
10414
+ blocked INTEGER NOT NULL DEFAULT 1,
10415
+ ended INTEGER NOT NULL DEFAULT 0,
10416
+ pending_start INTEGER NOT NULL DEFAULT 0,
10417
+ lifecycle_intent_seq INTEGER NOT NULL DEFAULT 0,
10418
+ receipt_generation INTEGER NOT NULL DEFAULT 1,
10419
+ harness TEXT,
10420
+ project TEXT,
10421
+ hard INTEGER NOT NULL DEFAULT 0,
10422
+ phase TEXT NOT NULL DEFAULT 'evidence',
10423
+ counts TEXT NOT NULL DEFAULT '{}',
10424
+ PRIMARY KEY (agent_id, session_key)
10425
+ );
10426
+ CREATE TABLE IF NOT EXISTS session_transcript_deleted_prefixes (
10427
+ agent_id TEXT NOT NULL,
10428
+ session_key TEXT NOT NULL,
10429
+ generation INTEGER NOT NULL,
10430
+ origin TEXT NOT NULL,
10431
+ record_count INTEGER NOT NULL,
10432
+ record_hash TEXT NOT NULL,
10433
+ PRIMARY KEY (agent_id, session_key, generation, origin)
10434
+ );
10435
+ CREATE TABLE IF NOT EXISTS session_transcript_deleted_positions (
10436
+ agent_id TEXT NOT NULL,
10437
+ session_key TEXT NOT NULL,
10438
+ generation INTEGER NOT NULL,
10439
+ origin TEXT NOT NULL,
10440
+ position INTEGER NOT NULL,
10441
+ record_hash TEXT NOT NULL,
10442
+ PRIMARY KEY (agent_id, session_key, generation, origin, position),
10443
+ FOREIGN KEY (agent_id, session_key, generation, origin)
10444
+ REFERENCES session_transcript_deleted_prefixes(agent_id, session_key, generation, origin) ON DELETE CASCADE
10445
+ );
10446
+ CREATE TABLE IF NOT EXISTS session_transcript_deleted_sources (
10447
+ agent_id TEXT NOT NULL,
10448
+ session_key TEXT NOT NULL,
10449
+ generation INTEGER NOT NULL,
10450
+ kind TEXT NOT NULL,
10451
+ id TEXT NOT NULL,
10452
+ outcome TEXT NOT NULL DEFAULT 'deleted',
10453
+ PRIMARY KEY (agent_id, session_key, generation, kind, id)
10454
+ );
10455
+ CREATE TABLE IF NOT EXISTS session_transcript_delete_files (
10456
+ agent_id TEXT NOT NULL,
10457
+ session_key TEXT NOT NULL,
10458
+ generation INTEGER NOT NULL,
10459
+ path TEXT NOT NULL,
10460
+ checkpoint TEXT,
10461
+ done INTEGER NOT NULL DEFAULT 0,
10462
+ PRIMARY KEY (agent_id, session_key, generation, path)
10463
+ );
10464
+ CREATE INDEX IF NOT EXISTS idx_session_delete_files_pending ON session_transcript_delete_files(path) WHERE done = 0 AND checkpoint IS NOT NULL;
10465
+ CREATE INDEX IF NOT EXISTS idx_import_records_session_delete ON source_import_records(agent_id,canonical_key,redacted_bytes);
10466
+ CREATE INDEX IF NOT EXISTS idx_memories_session_delete_source ON memories(agent_id,source_id);
10467
+ CREATE INDEX IF NOT EXISTS idx_capture_jobs_session_delete ON transcript_capture_jobs(agent_id,session_key);
10468
+ CREATE INDEX IF NOT EXISTS idx_session_delete_source_lookup
10469
+ ON session_transcript_deleted_sources(agent_id, kind, id, outcome);
10470
+ `);
10471
+ const columns = db.prepare("PRAGMA table_info(session_transcript_deletions)").all();
10472
+ for (const column of ["pending_start", "lifecycle_intent_seq"]) {
10473
+ if (!columns.some((row) => row.name === column))
10474
+ db.exec(`ALTER TABLE session_transcript_deletions ADD COLUMN ${column} INTEGER NOT NULL DEFAULT 0`);
10475
+ }
10476
+ }
10477
+ function up2(db) {
10405
10478
  const hasColumn = (table, column) => {
10406
10479
  const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
10407
10480
  try {
@@ -10461,7 +10534,7 @@ function up(db) {
10461
10534
  CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
10462
10535
  `);
10463
10536
  }
10464
- function up2(db) {
10537
+ function up3(db) {
10465
10538
  db.exec(`
10466
10539
  DROP INDEX IF EXISTS idx_memory_artifacts_agent_sha;
10467
10540
  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)
@@ -10473,7 +10546,7 @@ function addColumnIfMissing(db, column, definition) {
10473
10546
  return;
10474
10547
  db.exec(`ALTER TABLE transcript_capture_jobs ADD COLUMN ${column} ${definition}`);
10475
10548
  }
10476
- function up3(db) {
10549
+ function up4(db) {
10477
10550
  const table = db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'transcript_capture_jobs'").get();
10478
10551
  if (!table?.present)
10479
10552
  return;
@@ -10490,7 +10563,7 @@ function up3(db) {
10490
10563
  ON transcript_capture_jobs(agent_id, source_sha256);
10491
10564
  `);
10492
10565
  }
10493
- function up4(db) {
10566
+ function up5(db) {
10494
10567
  db.exec(`
10495
10568
  CREATE TABLE IF NOT EXISTS source_sync_failures (
10496
10569
  agent_id TEXT NOT NULL,
@@ -10513,7 +10586,7 @@ function up4(db) {
10513
10586
  WHERE resolved_at IS NULL;
10514
10587
  `);
10515
10588
  }
10516
- function up5(db) {
10589
+ function up6(db) {
10517
10590
  db.exec("DROP TABLE IF EXISTS mcp_invocations");
10518
10591
  }
10519
10592
  var MEMORIES_FTS_TOKENIZER = "porter unicode61";
@@ -10628,7 +10701,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
10628
10701
  return false;
10629
10702
  return !normalizeSql(sql).includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
10630
10703
  }
10631
- function up6(db) {
10704
+ function up7(db) {
10632
10705
  db.exec(`
10633
10706
  CREATE TABLE IF NOT EXISTS schema_migrations (
10634
10707
  version INTEGER PRIMARY KEY,
@@ -10726,7 +10799,7 @@ function addColumnIfMissing2(db, table, column, definition) {
10726
10799
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10727
10800
  }
10728
10801
  }
10729
- function up7(db) {
10802
+ function up8(db) {
10730
10803
  addColumnIfMissing2(db, "memories", "content_hash", "TEXT");
10731
10804
  addColumnIfMissing2(db, "memories", "normalized_content", "TEXT");
10732
10805
  addColumnIfMissing2(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -10844,7 +10917,7 @@ function addColumnIfMissing3(db, table, column, definition) {
10844
10917
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10845
10918
  return true;
10846
10919
  }
10847
- function up8(db) {
10920
+ function up9(db) {
10848
10921
  addColumnIfMissing3(db, "memories", "why", "TEXT");
10849
10922
  addColumnIfMissing3(db, "memories", "project", "TEXT");
10850
10923
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -10881,7 +10954,7 @@ function addColumnIfMissing4(db, table, column, definition) {
10881
10954
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10882
10955
  }
10883
10956
  }
10884
- function up9(db) {
10957
+ function up10(db) {
10885
10958
  addColumnIfMissing4(db, "memory_history", "actor_type", "TEXT");
10886
10959
  addColumnIfMissing4(db, "memory_history", "session_id", "TEXT");
10887
10960
  addColumnIfMissing4(db, "memory_history", "request_id", "TEXT");
@@ -10914,7 +10987,7 @@ function addColumnIfMissing5(db, table, column, definition) {
10914
10987
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10915
10988
  }
10916
10989
  }
10917
- function up10(db) {
10990
+ function up11(db) {
10918
10991
  addColumnIfMissing5(db, "entities", "canonical_name", "TEXT");
10919
10992
  addColumnIfMissing5(db, "entities", "mentions", "INTEGER DEFAULT 0");
10920
10993
  addColumnIfMissing5(db, "entities", "embedding", "BLOB");
@@ -10931,7 +11004,7 @@ function hasColumn4(db, table, column) {
10931
11004
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
10932
11005
  return rows.some((r) => r.name === column);
10933
11006
  }
10934
- function up11(db) {
11007
+ function up12(db) {
10935
11008
  if (!hasColumn4(db, "memories", "idempotency_key")) {
10936
11009
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
10937
11010
  }
@@ -10946,7 +11019,7 @@ function hasColumn5(db, table, column) {
10946
11019
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
10947
11020
  return rows.some((r) => r.name === column);
10948
11021
  }
10949
- function up12(db) {
11022
+ function up13(db) {
10950
11023
  db.exec(`
10951
11024
  CREATE TABLE IF NOT EXISTS documents (
10952
11025
  id TEXT PRIMARY KEY,
@@ -11003,7 +11076,7 @@ function up12(db) {
11003
11076
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11004
11077
  }
11005
11078
  }
11006
- function up13(db) {
11079
+ function up14(db) {
11007
11080
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11008
11081
  if (tables.length === 0)
11009
11082
  return;
@@ -11020,7 +11093,7 @@ function up13(db) {
11020
11093
  ON embeddings(content_hash)
11021
11094
  `);
11022
11095
  }
11023
- function up14(db) {
11096
+ function up15(db) {
11024
11097
  db.exec(`
11025
11098
  CREATE TABLE IF NOT EXISTS summary_jobs (
11026
11099
  id TEXT PRIMARY KEY,
@@ -11040,7 +11113,7 @@ function up14(db) {
11040
11113
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11041
11114
  ON summary_jobs(status)`);
11042
11115
  }
11043
- function up15(db) {
11116
+ function up16(db) {
11044
11117
  db.exec(`
11045
11118
  CREATE TABLE IF NOT EXISTS umap_cache (
11046
11119
  id INTEGER PRIMARY KEY,
@@ -11051,7 +11124,7 @@ function up15(db) {
11051
11124
  )
11052
11125
  `);
11053
11126
  }
11054
- function up16(db) {
11127
+ function up17(db) {
11055
11128
  db.exec(`
11056
11129
  CREATE TABLE IF NOT EXISTS session_scores (
11057
11130
  id TEXT PRIMARY KEY,
@@ -11071,7 +11144,7 @@ function up16(db) {
11071
11144
  ON session_scores(session_key);
11072
11145
  `);
11073
11146
  }
11074
- function up17(db) {
11147
+ function up18(db) {
11075
11148
  db.exec(`
11076
11149
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11077
11150
  id TEXT PRIMARY KEY,
@@ -11112,7 +11185,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11112
11185
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11113
11186
  }
11114
11187
  }
11115
- function up18(db) {
11188
+ function up19(db) {
11116
11189
  db.exec(`
11117
11190
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11118
11191
  id TEXT PRIMARY KEY,
@@ -11138,7 +11211,7 @@ function up18(db) {
11138
11211
  addColumnIfMissing6(db, "memories", "source_path", "TEXT");
11139
11212
  addColumnIfMissing6(db, "memories", "source_section", "TEXT");
11140
11213
  }
11141
- function up19(db) {
11214
+ function up20(db) {
11142
11215
  db.exec(`
11143
11216
  CREATE TABLE IF NOT EXISTS telemetry_events (
11144
11217
  id TEXT PRIMARY KEY,
@@ -11163,7 +11236,7 @@ function addColumnIfMissing7(db, table, column, definition) {
11163
11236
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11164
11237
  }
11165
11238
  }
11166
- function up20(db) {
11239
+ function up21(db) {
11167
11240
  db.exec(`
11168
11241
  CREATE TABLE IF NOT EXISTS session_memories (
11169
11242
  id TEXT PRIMARY KEY,
@@ -11190,7 +11263,7 @@ function up20(db) {
11190
11263
  addColumnIfMissing7(db, "session_scores", "confidence", "REAL");
11191
11264
  addColumnIfMissing7(db, "session_scores", "continuity_reasoning", "TEXT");
11192
11265
  }
11193
- function up21(db) {
11266
+ function up22(db) {
11194
11267
  db.exec(`
11195
11268
  CREATE TABLE IF NOT EXISTS session_checkpoints (
11196
11269
  id TEXT PRIMARY KEY,
@@ -11212,7 +11285,7 @@ function up21(db) {
11212
11285
  ON session_checkpoints(project_normalized, created_at DESC);
11213
11286
  `);
11214
11287
  }
11215
- function up22(db) {
11288
+ function up23(db) {
11216
11289
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
11217
11290
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
11218
11291
  if (!colNames.has("skill_name")) {
@@ -11223,7 +11296,7 @@ function up22(db) {
11223
11296
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
11224
11297
  }
11225
11298
  }
11226
- function up23(db) {
11299
+ function up24(db) {
11227
11300
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
11228
11301
  if (existing)
11229
11302
  return;
@@ -11255,7 +11328,7 @@ function up23(db) {
11255
11328
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
11256
11329
  `);
11257
11330
  }
11258
- function up24(db) {
11331
+ function up25(db) {
11259
11332
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
11260
11333
  const entityColNames = new Set(entityCols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
11261
11334
  if (!entityColNames.has("agent_id")) {
@@ -11340,13 +11413,13 @@ function addColumnIfMissing8(db, table, column, definition) {
11340
11413
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11341
11414
  }
11342
11415
  }
11343
- function up25(db) {
11416
+ function up26(db) {
11344
11417
  addColumnIfMissing8(db, "session_memories", "entity_slot", "INTEGER");
11345
11418
  addColumnIfMissing8(db, "session_memories", "aspect_slot", "INTEGER");
11346
11419
  addColumnIfMissing8(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
11347
11420
  addColumnIfMissing8(db, "session_memories", "structural_density", "INTEGER");
11348
11421
  }
11349
- function up26(db) {
11422
+ function up27(db) {
11350
11423
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
11351
11424
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
11352
11425
  if (!columnNames.has("focal_entity_ids")) {
@@ -11371,25 +11444,25 @@ function addColumnIfMissing9(db, table, column, definition) {
11371
11444
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11372
11445
  }
11373
11446
  }
11374
- function up27(db) {
11447
+ function up28(db) {
11375
11448
  addColumnIfMissing9(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
11376
11449
  addColumnIfMissing9(db, "entities", "pinned_at", "TEXT");
11377
11450
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
11378
11451
  }
11379
- function up28(_db) {}
11380
11452
  function up29(_db) {}
11453
+ function up30(_db) {}
11381
11454
  function addColumnIfMissing10(db, table, column, definition) {
11382
11455
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
11383
11456
  if (!cols.some((c) => c.name === column)) {
11384
11457
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11385
11458
  }
11386
11459
  }
11387
- function up30(db) {
11460
+ function up31(db) {
11388
11461
  addColumnIfMissing10(db, "session_memories", "agent_relevance_score", "REAL");
11389
11462
  addColumnIfMissing10(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
11390
11463
  }
11391
- function up31(_db) {}
11392
- function up32(db) {
11464
+ function up32(_db) {}
11465
+ function up33(db) {
11393
11466
  db.exec(`
11394
11467
  UPDATE entities
11395
11468
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -11398,7 +11471,7 @@ function up32(db) {
11398
11471
  WHERE canonical_name IS NULL
11399
11472
  `);
11400
11473
  }
11401
- function up33(db) {
11474
+ function up34(db) {
11402
11475
  db.exec(`
11403
11476
  CREATE TABLE IF NOT EXISTS memories_cold (
11404
11477
  archive_id TEXT PRIMARY KEY,
@@ -11435,7 +11508,7 @@ function up33(db) {
11435
11508
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
11436
11509
  `);
11437
11510
  }
11438
- function up34(db) {
11511
+ function up35(db) {
11439
11512
  db.exec(`
11440
11513
  CREATE TABLE IF NOT EXISTS session_summaries (
11441
11514
  id TEXT PRIMARY KEY,
@@ -11480,7 +11553,7 @@ function up34(db) {
11480
11553
  WHERE session_key IS NOT NULL;
11481
11554
  `);
11482
11555
  }
11483
- function up35(db) {
11556
+ function up36(db) {
11484
11557
  db.exec(`
11485
11558
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
11486
11559
  id TEXT PRIMARY KEY,
@@ -11525,7 +11598,7 @@ function up35(db) {
11525
11598
  ON memory_jobs(failed_at);
11526
11599
  `);
11527
11600
  }
11528
- function up36(db) {
11601
+ function up37(db) {
11529
11602
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
11530
11603
  if (!depCols.some((c) => c.name === "reason")) {
11531
11604
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -11535,7 +11608,7 @@ function up36(db) {
11535
11608
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
11536
11609
  }
11537
11610
  }
11538
- function up37(db) {
11611
+ function up38(db) {
11539
11612
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
11540
11613
  if (cols.length === 0)
11541
11614
  return;
@@ -11543,14 +11616,14 @@ function up37(db) {
11543
11616
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
11544
11617
  }
11545
11618
  }
11546
- function up38(db) {
11619
+ function up39(db) {
11547
11620
  const cols = db.prepare("PRAGMA table_info(memories)").all();
11548
11621
  if (!cols.some((c) => c.name === "scope")) {
11549
11622
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
11550
11623
  }
11551
11624
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
11552
11625
  }
11553
- function up39(db) {
11626
+ function up40(db) {
11554
11627
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
11555
11628
  db.exec(`
11556
11629
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -11558,7 +11631,7 @@ function up39(db) {
11558
11631
  WHERE content_hash IS NOT NULL AND is_deleted = 0
11559
11632
  `);
11560
11633
  }
11561
- function up40(db) {
11634
+ function up41(db) {
11562
11635
  db.exec(`
11563
11636
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
11564
11637
  name, canonical_name,
@@ -11590,13 +11663,13 @@ function up40(db) {
11590
11663
  END
11591
11664
  `);
11592
11665
  }
11593
- function up41(db) {
11666
+ function up42(db) {
11594
11667
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
11595
11668
  if (!cols.some((c) => c.name === "confidence")) {
11596
11669
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
11597
11670
  }
11598
11671
  }
11599
- function up42(db) {
11672
+ function up43(db) {
11600
11673
  db.exec(`
11601
11674
  CREATE TABLE IF NOT EXISTS entity_communities (
11602
11675
  id TEXT PRIMARY KEY,
@@ -11614,7 +11687,7 @@ function up42(db) {
11614
11687
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
11615
11688
  }
11616
11689
  }
11617
- function up43(db) {
11690
+ function up44(db) {
11618
11691
  db.exec(`
11619
11692
  CREATE TABLE IF NOT EXISTS memory_hints (
11620
11693
  id TEXT PRIMARY KEY,
@@ -11654,7 +11727,7 @@ function up43(db) {
11654
11727
  END
11655
11728
  `);
11656
11729
  }
11657
- function up44(db) {
11730
+ function up45(db) {
11658
11731
  db.exec(`
11659
11732
  DELETE FROM entity_dependencies
11660
11733
  WHERE id NOT IN (
@@ -11672,7 +11745,7 @@ function up44(db) {
11672
11745
  )
11673
11746
  `);
11674
11747
  }
11675
- function up45(db) {
11748
+ function up46(db) {
11676
11749
  db.exec(`
11677
11750
  CREATE TABLE IF NOT EXISTS session_transcripts (
11678
11751
  session_key TEXT PRIMARY KEY,
@@ -11695,7 +11768,7 @@ function addColumnIfMissing11(db, table, column, definition) {
11695
11768
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11696
11769
  }
11697
11770
  }
11698
- function up46(db) {
11771
+ function up47(db) {
11699
11772
  addColumnIfMissing11(db, "session_memories", "path_json", "TEXT");
11700
11773
  db.exec(`
11701
11774
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -11770,7 +11843,7 @@ function addColumnIfMissing12(db, table, column, definition) {
11770
11843
  return;
11771
11844
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11772
11845
  }
11773
- function up47(db) {
11846
+ function up48(db) {
11774
11847
  addColumnIfMissing12(db, "session_memories", "entity_slot", "INTEGER");
11775
11848
  addColumnIfMissing12(db, "session_memories", "aspect_slot", "INTEGER");
11776
11849
  addColumnIfMissing12(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -11858,7 +11931,7 @@ function addColumnIfMissing13(db, table, column, definition) {
11858
11931
  return;
11859
11932
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11860
11933
  }
11861
- function up48(db) {
11934
+ function up49(db) {
11862
11935
  db.exec(`
11863
11936
  CREATE TABLE IF NOT EXISTS agents (
11864
11937
  id TEXT PRIMARY KEY,
@@ -11887,7 +11960,7 @@ function addColumnIfMissing14(db, table, column, definition) {
11887
11960
  return;
11888
11961
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11889
11962
  }
11890
- function up49(db) {
11963
+ function up50(db) {
11891
11964
  addColumnIfMissing14(db, "session_summaries", "source_type", "TEXT");
11892
11965
  addColumnIfMissing14(db, "session_summaries", "source_ref", "TEXT");
11893
11966
  addColumnIfMissing14(db, "session_summaries", "meta_json", "TEXT");
@@ -11913,7 +11986,7 @@ function addColumnIfMissing15(db, table, column, definition) {
11913
11986
  return;
11914
11987
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11915
11988
  }
11916
- function up50(db) {
11989
+ function up51(db) {
11917
11990
  addColumnIfMissing15(db, "session_transcripts", "updated_at", "TEXT");
11918
11991
  addColumnIfMissing15(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
11919
11992
  addColumnIfMissing15(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -11984,7 +12057,7 @@ function up50(db) {
11984
12057
  ON memory_md_heads(lease_expires_at);
11985
12058
  `);
11986
12059
  }
11987
- function up51(db) {
12060
+ function up52(db) {
11988
12061
  db.exec(`
11989
12062
  DROP INDEX IF EXISTS idx_summaries_session_depth;
11990
12063
 
@@ -12045,7 +12118,7 @@ function up51(db) {
12045
12118
  AND COALESCE(source_type, 'summary') = 'summary';
12046
12119
  `);
12047
12120
  }
12048
- function up52(db) {
12121
+ function up53(db) {
12049
12122
  db.exec(`
12050
12123
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12051
12124
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -12143,7 +12216,7 @@ function up52(db) {
12143
12216
  AND COALESCE(source_type, 'summary') = 'summary';
12144
12217
  `);
12145
12218
  }
12146
- function up53(db) {
12219
+ function up54(db) {
12147
12220
  db.exec(`
12148
12221
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
12149
12222
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -12261,7 +12334,7 @@ function up53(db) {
12261
12334
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
12262
12335
  `);
12263
12336
  }
12264
- function up54(db) {
12337
+ function up55(db) {
12265
12338
  db.exec(`
12266
12339
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
12267
12340
  session_key TEXT NOT NULL,
@@ -12278,7 +12351,7 @@ function hasTable(db, name) {
12278
12351
  WHERE type = 'table' AND name = ?
12279
12352
  LIMIT 1`).get(name) !== undefined;
12280
12353
  }
12281
- function up55(db) {
12354
+ function up56(db) {
12282
12355
  db.exec(`
12283
12356
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
12284
12357
  id TEXT PRIMARY KEY,
@@ -12448,7 +12521,7 @@ function addColumnIfMissing16(db, table, column, definition) {
12448
12521
  return;
12449
12522
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12450
12523
  }
12451
- function up56(db) {
12524
+ function up57(db) {
12452
12525
  addColumnIfMissing16(db, "summary_jobs", "session_id", "TEXT");
12453
12526
  addColumnIfMissing16(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
12454
12527
  addColumnIfMissing16(db, "summary_jobs", "captured_at", "TEXT");
@@ -12540,8 +12613,8 @@ function up56(db) {
12540
12613
  VALUES ('rebuild');
12541
12614
  `);
12542
12615
  }
12543
- function up57(_db) {}
12544
- function up58(db) {
12616
+ function up58(_db) {}
12617
+ function up59(db) {
12545
12618
  db.exec(`
12546
12619
  CREATE TABLE IF NOT EXISTS skill_invocations (
12547
12620
  id TEXT PRIMARY KEY,
@@ -12557,7 +12630,7 @@ function up58(db) {
12557
12630
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
12558
12631
  `);
12559
12632
  }
12560
- function up59(db) {
12633
+ function up60(db) {
12561
12634
  db.exec(`
12562
12635
  CREATE TABLE IF NOT EXISTS task_scope_hints (
12563
12636
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -12588,7 +12661,7 @@ function up59(db) {
12588
12661
  ON task_scope_hints(agent_id, updated_at);
12589
12662
  `);
12590
12663
  }
12591
- function up60(db) {
12664
+ function up61(db) {
12592
12665
  db.exec(`
12593
12666
  CREATE TABLE IF NOT EXISTS dreaming_state (
12594
12667
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -12631,7 +12704,7 @@ function ensureMemoriesScopeColumns(db) {
12631
12704
  if (!names.has("scope"))
12632
12705
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
12633
12706
  }
12634
- function up61(db) {
12707
+ function up62(db) {
12635
12708
  ensureMemoriesScopeColumns(db);
12636
12709
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12637
12710
  db.exec(`
@@ -12644,20 +12717,20 @@ function up61(db) {
12644
12717
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12645
12718
  `);
12646
12719
  }
12647
- function up62(db) {
12720
+ function up63(db) {
12648
12721
  const sql = readMemoriesFtsSql(db);
12649
12722
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
12650
12723
  return;
12651
12724
  recreateMemoriesFts(db);
12652
12725
  }
12653
- function up63(db) {
12726
+ function up64(db) {
12654
12727
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
12655
12728
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
12656
12729
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
12657
12730
  ON entities(entity_type, mentions)
12658
12731
  WHERE entity_type = 'extracted'`);
12659
12732
  }
12660
- function up64(db) {
12733
+ function up65(db) {
12661
12734
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
12662
12735
  if (!cols.some((col) => col.name === "claim_key")) {
12663
12736
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -12666,7 +12739,7 @@ function up64(db) {
12666
12739
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
12667
12740
  WHERE claim_key IS NOT NULL`);
12668
12741
  }
12669
- function up65(db) {
12742
+ function up66(db) {
12670
12743
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
12671
12744
  if (!cols.some((col) => col.name === "group_key")) {
12672
12745
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -12678,13 +12751,13 @@ function up65(db) {
12678
12751
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
12679
12752
  WHERE claim_key IS NOT NULL`);
12680
12753
  }
12681
- function up66(db) {
12754
+ function up67(db) {
12682
12755
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
12683
12756
  if (cols.some((col) => col.name === "source_mtime_ms"))
12684
12757
  return;
12685
12758
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
12686
12759
  }
12687
- function up67(db) {
12760
+ function up68(db) {
12688
12761
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
12689
12762
  const names = new Set(cols.map((col) => col.name));
12690
12763
  if (!names.has("is_deleted")) {
@@ -12698,7 +12771,7 @@ function up67(db) {
12698
12771
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
12699
12772
  `);
12700
12773
  }
12701
- function up68(db) {
12774
+ function up69(db) {
12702
12775
  db.exec("DROP TRIGGER IF EXISTS memories_au");
12703
12776
  db.exec(`
12704
12777
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -12716,7 +12789,7 @@ function addColumnIfMissing17(db, table, column, definition) {
12716
12789
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12717
12790
  }
12718
12791
  }
12719
- function up69(db) {
12792
+ function up70(db) {
12720
12793
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
12721
12794
  addColumnIfMissing17(db, table, "source_id", "TEXT");
12722
12795
  addColumnIfMissing17(db, table, "source_kind", "TEXT");
@@ -12736,7 +12809,7 @@ function hasColumn7(db, table, column) {
12736
12809
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
12737
12810
  return rows.some((row) => row.name === column);
12738
12811
  }
12739
- function up70(db) {
12812
+ function up71(db) {
12740
12813
  if (!hasTable2(db, "embeddings"))
12741
12814
  return;
12742
12815
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -12744,7 +12817,7 @@ function up70(db) {
12744
12817
  }
12745
12818
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
12746
12819
  }
12747
- function up71(db) {
12820
+ function up72(db) {
12748
12821
  db.exec(`
12749
12822
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
12750
12823
  id TEXT PRIMARY KEY,
@@ -12785,7 +12858,7 @@ function addColumnIfMissing18(db, table, column, definition) {
12785
12858
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12786
12859
  }
12787
12860
  }
12788
- function up72(db) {
12861
+ function up73(db) {
12789
12862
  db.exec(`
12790
12863
  CREATE TABLE IF NOT EXISTS ontology_proposals (
12791
12864
  id TEXT PRIMARY KEY,
@@ -12828,7 +12901,7 @@ function up72(db) {
12828
12901
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
12829
12902
  }
12830
12903
  }
12831
- function up73(db) {
12904
+ function up74(db) {
12832
12905
  db.exec(`
12833
12906
  CREATE TABLE IF NOT EXISTS daily_reflections (
12834
12907
  id TEXT PRIMARY KEY,
@@ -12855,7 +12928,7 @@ function up73(db) {
12855
12928
  WHERE content_key IS NOT NULL;
12856
12929
  `);
12857
12930
  }
12858
- function up74(db) {
12931
+ function up75(db) {
12859
12932
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
12860
12933
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
12861
12934
  if (!colNames.has("content_key")) {
@@ -12892,7 +12965,7 @@ function backfillVersionRoots(db) {
12892
12965
  WHERE version_root_id IS NULL
12893
12966
  `);
12894
12967
  }
12895
- function up75(db) {
12968
+ function up76(db) {
12896
12969
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
12897
12970
  addColumnIfMissing19(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
12898
12971
  addColumnIfMissing19(db, table, "archived_at", "TEXT");
@@ -12927,7 +13000,7 @@ function up75(db) {
12927
13000
  ON entity_aspects(agent_id, proposal_id);
12928
13001
  `);
12929
13002
  }
12930
- function up76(db) {
13003
+ function up77(db) {
12931
13004
  db.exec(`
12932
13005
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
12933
13006
  id TEXT PRIMARY KEY,
@@ -12983,7 +13056,7 @@ function ensureMemoriesScopeColumns2(db) {
12983
13056
  if (!names.has("runtime_path"))
12984
13057
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
12985
13058
  }
12986
- function up77(db) {
13059
+ function up78(db) {
12987
13060
  ensureMemoriesScopeColumns2(db);
12988
13061
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
12989
13062
  db.exec(`
@@ -12997,7 +13070,7 @@ function up77(db) {
12997
13070
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
12998
13071
  `);
12999
13072
  }
13000
- function up78(db) {
13073
+ function up79(db) {
13001
13074
  db.exec(`
13002
13075
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13003
13076
  session_key TEXT NOT NULL,
@@ -13032,7 +13105,7 @@ function up78(db) {
13032
13105
  ON session_recall_events(item_kind, item_id, created_at DESC);
13033
13106
  `);
13034
13107
  }
13035
- function up79(db) {
13108
+ function up80(db) {
13036
13109
  db.exec(`
13037
13110
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13038
13111
  aggregate_memory_id TEXT NOT NULL,
@@ -13051,7 +13124,7 @@ function addColumnIfMissing20(db, table, column, definition) {
13051
13124
  return;
13052
13125
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13053
13126
  }
13054
- function up80(db) {
13127
+ function up81(db) {
13055
13128
  addColumnIfMissing20(db, "memory_artifacts", "source_id", "TEXT");
13056
13129
  addColumnIfMissing20(db, "memory_artifacts", "source_root", "TEXT");
13057
13130
  addColumnIfMissing20(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -13064,7 +13137,7 @@ function up80(db) {
13064
13137
  ON memory_artifacts(agent_id, source_id, source_root);
13065
13138
  `);
13066
13139
  }
13067
- function up81(db) {
13140
+ function up82(db) {
13068
13141
  db.exec(`
13069
13142
  CREATE TABLE IF NOT EXISTS temporal_edges (
13070
13143
  id TEXT PRIMARY KEY,
@@ -13087,7 +13160,7 @@ function up81(db) {
13087
13160
  ON temporal_edges(agent_id, subject_type, subject_id);
13088
13161
  `);
13089
13162
  }
13090
- function up82(db) {
13163
+ function up83(db) {
13091
13164
  db.exec(`
13092
13165
  CREATE TABLE IF NOT EXISTS entity_aliases (
13093
13166
  id TEXT PRIMARY KEY,
@@ -13111,7 +13184,7 @@ function up82(db) {
13111
13184
  ON entity_aliases(agent_id, canonical_alias, status);
13112
13185
  `);
13113
13186
  }
13114
- function up83(db) {
13187
+ function up84(db) {
13115
13188
  db.exec(`
13116
13189
  CREATE TABLE IF NOT EXISTS api_keys (
13117
13190
  id TEXT PRIMARY KEY,
@@ -13139,7 +13212,7 @@ function up83(db) {
13139
13212
  ON api_keys(connector, harness);
13140
13213
  `);
13141
13214
  }
13142
- function up84(db) {
13215
+ function up85(db) {
13143
13216
  db.exec(`
13144
13217
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
13145
13218
  id TEXT PRIMARY KEY,
@@ -13174,7 +13247,7 @@ function hasColumn10(db, table, column) {
13174
13247
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13175
13248
  return rows.some((row) => row.name === column);
13176
13249
  }
13177
- function up85(db) {
13250
+ function up86(db) {
13178
13251
  if (!hasColumn10(db, "documents", "agent_id")) {
13179
13252
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
13180
13253
  }
@@ -13260,7 +13333,7 @@ function up85(db) {
13260
13333
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
13261
13334
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
13262
13335
  }
13263
- function up86(db) {
13336
+ function up87(db) {
13264
13337
  db.exec(`
13265
13338
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
13266
13339
  aggregate_memory_id TEXT NOT NULL,
@@ -13282,7 +13355,7 @@ function hasColumn11(db, table, column) {
13282
13355
  return rows.some((row) => row.name === column);
13283
13356
  }
13284
13357
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
13285
- function up87(db) {
13358
+ function up88(db) {
13286
13359
  for (const column of COLUMNS) {
13287
13360
  if (!hasColumn11(db, "skill_invocations", column)) {
13288
13361
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -13363,7 +13436,7 @@ function documentScopeColumnsPreservingExisting(db) {
13363
13436
  `);
13364
13437
  }
13365
13438
  try {
13366
- up85(db);
13439
+ up86(db);
13367
13440
  if (preserveAgentId) {
13368
13441
  db.exec(`
13369
13442
  UPDATE documents
@@ -13383,12 +13456,12 @@ function documentScopeColumnsPreservingExisting(db) {
13383
13456
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
13384
13457
  }
13385
13458
  }
13386
- function up88(db) {
13387
- up84(db);
13459
+ function up89(db) {
13460
+ up85(db);
13388
13461
  if (hasTable3(db, "documents")) {
13389
13462
  documentScopeColumnsPreservingExisting(db);
13390
13463
  }
13391
- up86(db);
13464
+ up87(db);
13392
13465
  addColumnIfMissing21(db, "memories", "superseded_by", "TEXT");
13393
13466
  addColumnIfMissing21(db, "memories", "superseded_at", "TEXT");
13394
13467
  addColumnIfMissing21(db, "memories", "superseded_reason", "TEXT");
@@ -13445,7 +13518,7 @@ function up88(db) {
13445
13518
  AND ${sourceAgentId} = ${targetAgentId}
13446
13519
  `);
13447
13520
  }
13448
- function up89(db) {
13521
+ function up90(db) {
13449
13522
  db.exec(`
13450
13523
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
13451
13524
  path TEXT PRIMARY KEY,
@@ -13475,7 +13548,7 @@ function up89(db) {
13475
13548
  ON legacy_markdown_chunks(memory_id);
13476
13549
  `);
13477
13550
  }
13478
- function up90(db) {
13551
+ function up91(db) {
13479
13552
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
13480
13553
  const tableNames = new Set(tables.map((r) => String(r.name)));
13481
13554
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -13534,7 +13607,7 @@ function addColumnIfMissing22(db, table, column, definition) {
13534
13607
  return;
13535
13608
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13536
13609
  }
13537
- function up91(db) {
13610
+ function up92(db) {
13538
13611
  addColumnIfMissing22(db, "summary_jobs", "content_hash", "TEXT");
13539
13612
  db.exec(`
13540
13613
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -13547,14 +13620,14 @@ function addColumnIfMissing23(db, table, column, definition) {
13547
13620
  return;
13548
13621
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13549
13622
  }
13550
- function up92(db) {
13623
+ function up93(db) {
13551
13624
  addColumnIfMissing23(db, "summary_jobs", "boundary_reason", "TEXT");
13552
13625
  db.exec(`
13553
13626
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
13554
13627
  ON summary_jobs(agent_id, session_key, boundary_reason)
13555
13628
  `);
13556
13629
  }
13557
- function up93(db) {
13630
+ function up94(db) {
13558
13631
  db.exec(`
13559
13632
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
13560
13633
  agent_id TEXT NOT NULL,
@@ -13572,7 +13645,7 @@ function up93(db) {
13572
13645
  ON transcript_capture_jobs(agent_id, session_id, status);
13573
13646
  `);
13574
13647
  }
13575
- function up94(db) {
13648
+ function up95(db) {
13576
13649
  db.exec(`
13577
13650
  CREATE TABLE IF NOT EXISTS job_cancellations (
13578
13651
  id TEXT PRIMARY KEY,
@@ -13600,7 +13673,7 @@ function indexExists(db, table, indexName) {
13600
13673
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
13601
13674
  return rows.some((row) => row.name === indexName);
13602
13675
  }
13603
- function up95(db) {
13676
+ function up96(db) {
13604
13677
  db.exec(`
13605
13678
  CREATE TABLE IF NOT EXISTS job_archive (
13606
13679
  id TEXT PRIMARY KEY,
@@ -13627,7 +13700,7 @@ function indexExists2(db, table, indexName) {
13627
13700
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
13628
13701
  return rows.some((row) => row.name === indexName);
13629
13702
  }
13630
- function up96(db) {
13703
+ function up97(db) {
13631
13704
  db.exec(`
13632
13705
  CREATE TABLE IF NOT EXISTS embedding_index_state (
13633
13706
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -13640,7 +13713,7 @@ function up96(db) {
13640
13713
  )
13641
13714
  `);
13642
13715
  }
13643
- function up97(db) {
13716
+ function up98(db) {
13644
13717
  db.exec(`
13645
13718
  CREATE TABLE IF NOT EXISTS embeddings_staging (
13646
13719
  id TEXT PRIMARY KEY,
@@ -13659,7 +13732,7 @@ function up97(db) {
13659
13732
  ON embeddings_staging(agent_id, source_type, source_id);
13660
13733
  `);
13661
13734
  }
13662
- function up98(db) {
13735
+ function up99(db) {
13663
13736
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
13664
13737
  if (!columns.some((column) => column.name === "evidence_cursor")) {
13665
13738
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -13670,7 +13743,7 @@ function hasColumn13(db, table, column) {
13670
13743
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13671
13744
  return rows.some((r) => r.name === column);
13672
13745
  }
13673
- function up99(db) {
13746
+ function up100(db) {
13674
13747
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
13675
13748
  if (tables.length === 0)
13676
13749
  return;
@@ -13695,23 +13768,23 @@ function up99(db) {
13695
13768
  function hasColumn14(db, table, column) {
13696
13769
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13697
13770
  }
13698
- function up100(db) {
13771
+ function up101(db) {
13699
13772
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
13700
13773
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
13701
13774
  return;
13702
13775
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
13703
13776
  }
13704
- function up101(db) {
13777
+ function up102(db) {
13705
13778
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
13706
13779
  }
13707
- function up102(db) {
13780
+ function up103(db) {
13708
13781
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
13709
13782
  if (!columns.some((column) => column.name === "last_failure_at")) {
13710
13783
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
13711
13784
  }
13712
13785
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
13713
13786
  }
13714
- function up103(db) {
13787
+ function up104(db) {
13715
13788
  db.exec(`
13716
13789
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
13717
13790
  agent_id TEXT NOT NULL,
@@ -13728,7 +13801,7 @@ function up103(db) {
13728
13801
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
13729
13802
  `);
13730
13803
  }
13731
- function up104(db) {
13804
+ function up105(db) {
13732
13805
  db.exec(`
13733
13806
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
13734
13807
  id TEXT PRIMARY KEY,
@@ -13748,7 +13821,7 @@ function up104(db) {
13748
13821
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
13749
13822
  `);
13750
13823
  }
13751
- function up105(db) {
13824
+ function up106(db) {
13752
13825
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
13753
13826
  if (!columns.some((column) => column.name === "evidence_window_json")) {
13754
13827
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -13757,7 +13830,7 @@ function up105(db) {
13757
13830
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
13758
13831
  }
13759
13832
  }
13760
- function up106(db) {
13833
+ function up107(db) {
13761
13834
  db.exec(`
13762
13835
  CREATE TABLE IF NOT EXISTS dreaming_attention (
13763
13836
  id TEXT PRIMARY KEY,
@@ -13779,7 +13852,7 @@ function up106(db) {
13779
13852
  function hasColumn15(db, table, column) {
13780
13853
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13781
13854
  }
13782
- function up107(db) {
13855
+ function up108(db) {
13783
13856
  const requiredMemoryColumns = [
13784
13857
  "content_hash",
13785
13858
  "normalized_content",
@@ -13830,7 +13903,7 @@ function up107(db) {
13830
13903
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
13831
13904
  `);
13832
13905
  }
13833
- function up108(db) {
13906
+ function up109(db) {
13834
13907
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
13835
13908
  if (tables.length !== 2)
13836
13909
  return;
@@ -13853,7 +13926,7 @@ function tableExists(db, table) {
13853
13926
  function hasColumn16(db, table, column) {
13854
13927
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13855
13928
  }
13856
- function up109(db) {
13929
+ function up110(db) {
13857
13930
  db.exec(`
13858
13931
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
13859
13932
  derived_memory_id TEXT NOT NULL,
@@ -13896,7 +13969,7 @@ function up109(db) {
13896
13969
  `);
13897
13970
  }
13898
13971
  }
13899
- function up110(db) {
13972
+ function up111(db) {
13900
13973
  db.exec(`
13901
13974
  DROP TRIGGER IF EXISTS entities_fts_ai;
13902
13975
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -13985,7 +14058,7 @@ function up110(db) {
13985
14058
  function hasColumn17(db, table, column) {
13986
14059
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13987
14060
  }
13988
- function up111(db) {
14061
+ function up112(db) {
13989
14062
  if (!hasColumn17(db, "memories", "review_after")) {
13990
14063
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
13991
14064
  }
@@ -14001,14 +14074,14 @@ var TOKEN_COLUMNS = [
14001
14074
  ["tokens_cache_write", "INTEGER"],
14002
14075
  ["tokens_cost", "REAL"]
14003
14076
  ];
14004
- function up112(db) {
14077
+ function up113(db) {
14005
14078
  for (const [column, type] of TOKEN_COLUMNS) {
14006
14079
  if (!hasColumn18(db, "dreaming_passes", column)) {
14007
14080
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14008
14081
  }
14009
14082
  }
14010
14083
  }
14011
- function up113(db) {
14084
+ function up114(db) {
14012
14085
  db.exec(`
14013
14086
  CREATE TABLE IF NOT EXISTS embedding_usage (
14014
14087
  day TEXT NOT NULL,
@@ -14021,7 +14094,7 @@ function up113(db) {
14021
14094
  );
14022
14095
  `);
14023
14096
  }
14024
- function up114(db) {
14097
+ function up115(db) {
14025
14098
  db.exec(`
14026
14099
  CREATE TABLE IF NOT EXISTS telemetry_install (
14027
14100
  id TEXT PRIMARY KEY,
@@ -14029,7 +14102,7 @@ function up114(db) {
14029
14102
  );
14030
14103
  `);
14031
14104
  }
14032
- function up115(db) {
14105
+ function up116(db) {
14033
14106
  db.exec(`
14034
14107
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14035
14108
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14040,7 +14113,7 @@ function hasColumn19(db, table, column) {
14040
14113
  return rows.some((row) => row.name === column);
14041
14114
  }
14042
14115
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14043
- function up116(db) {
14116
+ function up117(db) {
14044
14117
  for (const column of COLUMNS2) {
14045
14118
  if (!hasColumn19(db, "telemetry_install", column)) {
14046
14119
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14056,7 +14129,7 @@ function addColumnIfMissing24(db, column, definition) {
14056
14129
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14057
14130
  }
14058
14131
  }
14059
- function up117(db) {
14132
+ function up118(db) {
14060
14133
  addColumnIfMissing24(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14061
14134
  addColumnIfMissing24(db, "claim_token", "TEXT");
14062
14135
  addColumnIfMissing24(db, "claimed_at", "TEXT");
@@ -14065,7 +14138,7 @@ function up117(db) {
14065
14138
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14066
14139
  `);
14067
14140
  }
14068
- function up118(db) {
14141
+ function up119(db) {
14069
14142
  db.exec(`
14070
14143
  CREATE TABLE IF NOT EXISTS session_claims (
14071
14144
  session_key TEXT NOT NULL,
@@ -14086,7 +14159,7 @@ function up118(db) {
14086
14159
  ON session_claims(agent_id, state, expires_at);
14087
14160
  `);
14088
14161
  }
14089
- function up119(db) {
14162
+ function up120(db) {
14090
14163
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
14091
14164
  if (table == null)
14092
14165
  return;
@@ -14095,7 +14168,7 @@ function up119(db) {
14095
14168
  ON entity_attributes(memory_id, agent_id, status, importance);
14096
14169
  `);
14097
14170
  }
14098
- function up120(db) {
14171
+ function up121(db) {
14099
14172
  db.exec(`
14100
14173
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
14101
14174
  id TEXT PRIMARY KEY,
@@ -14152,7 +14225,7 @@ function addColumnIfMissing25(db, column, definition) {
14152
14225
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
14153
14226
  }
14154
14227
  }
14155
- function up121(db) {
14228
+ function up122(db) {
14156
14229
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
14157
14230
  if (table == null)
14158
14231
  return;
@@ -14353,7 +14426,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
14353
14426
  insert.run(...values);
14354
14427
  }
14355
14428
  }
14356
- function up122(db) {
14429
+ function up123(db) {
14357
14430
  if (!hasTable4(db, "session_transcripts"))
14358
14431
  return;
14359
14432
  addColumnIfMissing26(db, "session_transcripts", "completed_at", "TEXT");
@@ -14406,7 +14479,7 @@ function up122(db) {
14406
14479
  ON session_transcripts(agent_id, content_hash);
14407
14480
  `);
14408
14481
  }
14409
- function up123(db) {
14482
+ function up124(db) {
14410
14483
  db.exec(`
14411
14484
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
14412
14485
  ON memory_jobs(status)
@@ -14425,12 +14498,12 @@ function up123(db) {
14425
14498
  function hasColumn22(db, table, column) {
14426
14499
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14427
14500
  }
14428
- function up124(db) {
14501
+ function up125(db) {
14429
14502
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
14430
14503
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
14431
14504
  }
14432
14505
  }
14433
- function up125(db) {
14506
+ function up126(db) {
14434
14507
  db.exec(`
14435
14508
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
14436
14509
  agent_id TEXT NOT NULL,
@@ -14459,7 +14532,7 @@ function addColumnIfMissing27(db, column, definition) {
14459
14532
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14460
14533
  }
14461
14534
  }
14462
- function up126(db) {
14535
+ function up127(db) {
14463
14536
  addColumnIfMissing27(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
14464
14537
  addColumnIfMissing27(db, "last_attempt_at", "TEXT");
14465
14538
  addColumnIfMissing27(db, "sent_at", "TEXT");
@@ -14480,7 +14553,7 @@ function up126(db) {
14480
14553
  VALUES (1, CURRENT_TIMESTAMP);
14481
14554
  `);
14482
14555
  }
14483
- function up127(db) {
14556
+ function up128(db) {
14484
14557
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
14485
14558
  const names = new Set(columns.map((column) => column.name));
14486
14559
  if (!names.has("failure_class")) {
@@ -14497,7 +14570,7 @@ function up127(db) {
14497
14570
  }
14498
14571
  db.exec("CREATE INDEX IF NOT EXISTS idx_dreaming_evidence_exclusions_retry ON dreaming_evidence_exclusions (resolved_at, requeue_requested_at, failure_class, retry_count, last_requeued_at)");
14499
14572
  }
14500
- function up128(db) {
14573
+ function up129(db) {
14501
14574
  db.exec(`
14502
14575
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
14503
14576
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -14521,7 +14594,7 @@ function up128(db) {
14521
14594
  ON embedding_index_failures(source_type, source_id);
14522
14595
  `);
14523
14596
  }
14524
- function up129(db) {
14597
+ function up130(db) {
14525
14598
  db.exec(`
14526
14599
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
14527
14600
  id TEXT PRIMARY KEY,
@@ -14539,7 +14612,7 @@ function up129(db) {
14539
14612
  ON imported_source_lifecycle(agent_id, status, updated_at DESC);
14540
14613
  `);
14541
14614
  }
14542
- function up130(db) {
14615
+ function up131(db) {
14543
14616
  db.exec(`
14544
14617
  CREATE TABLE IF NOT EXISTS memory_content_safety (
14545
14618
  agent_id TEXT NOT NULL,
@@ -14559,7 +14632,7 @@ function up130(db) {
14559
14632
  ON memory_content_safety(agent_id, source_kind, context_eligible);
14560
14633
  `);
14561
14634
  }
14562
- function up131(db) {
14635
+ function up132(db) {
14563
14636
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
14564
14637
  if (!table)
14565
14638
  return;
@@ -14593,7 +14666,7 @@ function up131(db) {
14593
14666
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
14594
14667
  `);
14595
14668
  }
14596
- function up132(db) {
14669
+ function up133(db) {
14597
14670
  db.exec(`
14598
14671
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
14599
14672
  id TEXT PRIMARY KEY,
@@ -14649,7 +14722,7 @@ function up132(db) {
14649
14722
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
14650
14723
  `);
14651
14724
  }
14652
- function up133(db) {
14725
+ function up134(db) {
14653
14726
  db.exec(`
14654
14727
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
14655
14728
  ON memory_jobs(status, created_at)
@@ -14664,7 +14737,7 @@ function up133(db) {
14664
14737
  function tableExists2(db, table) {
14665
14738
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
14666
14739
  }
14667
- function up134(db) {
14740
+ function up135(db) {
14668
14741
  if (!tableExists2(db, "memory_jobs"))
14669
14742
  return;
14670
14743
  if (!tableExists2(db, "job_cancellations")) {
@@ -14713,7 +14786,7 @@ function up134(db) {
14713
14786
  AND status IN ('pending', 'leased');
14714
14787
  `);
14715
14788
  }
14716
- function up135(db) {
14789
+ function up136(db) {
14717
14790
  db.exec(`
14718
14791
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
14719
14792
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14753,7 +14826,7 @@ function up135(db) {
14753
14826
  END;
14754
14827
  `);
14755
14828
  }
14756
- function up136(db) {
14829
+ function up137(db) {
14757
14830
  db.exec(`
14758
14831
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
14759
14832
  agent_id TEXT NOT NULL,
@@ -14776,13 +14849,13 @@ function up136(db) {
14776
14849
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
14777
14850
  `);
14778
14851
  }
14779
- function up137(db) {
14852
+ function up138(db) {
14780
14853
  db.exec(`
14781
14854
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
14782
14855
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
14783
14856
  `);
14784
14857
  }
14785
- function up138(db) {
14858
+ function up139(db) {
14786
14859
  db.exec(`
14787
14860
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
14788
14861
  id TEXT PRIMARY KEY,
@@ -14834,7 +14907,7 @@ function up138(db) {
14834
14907
  if (!names.has("format_version"))
14835
14908
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
14836
14909
  }
14837
- function up139(db) {
14910
+ function up140(db) {
14838
14911
  db.exec(`
14839
14912
  CREATE TABLE memory_head_entries_v134 (
14840
14913
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -14852,7 +14925,7 @@ function up139(db) {
14852
14925
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
14853
14926
  `);
14854
14927
  }
14855
- function up140(db) {
14928
+ function up141(db) {
14856
14929
  db.exec(`
14857
14930
  CREATE TABLE IF NOT EXISTS memory_head_publications (
14858
14931
  agent_id TEXT NOT NULL,
@@ -14868,7 +14941,7 @@ function up140(db) {
14868
14941
  ON memory_head_publications(agent_id, status, revision DESC);
14869
14942
  `);
14870
14943
  }
14871
- function up141(db) {
14944
+ function up142(db) {
14872
14945
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r) => r.name));
14873
14946
  for (const [name, type] of [
14874
14947
  ["entry_id", "TEXT"],
@@ -14882,7 +14955,7 @@ function up141(db) {
14882
14955
  }
14883
14956
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
14884
14957
  }
14885
- function up142(db) {
14958
+ function up143(db) {
14886
14959
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r) => r.name));
14887
14960
  for (const [name, type] of [
14888
14961
  ["head_revision", "INTEGER"],
@@ -14904,7 +14977,7 @@ function addColumnIfMissing28(db, table, column, definition) {
14904
14977
  if (!hasColumn24(db, table, column))
14905
14978
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14906
14979
  }
14907
- function up143(db) {
14980
+ function up144(db) {
14908
14981
  addColumnIfMissing28(db, "memories", "manual_override", "INTEGER DEFAULT 0");
14909
14982
  db.exec(`
14910
14983
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -15209,7 +15282,7 @@ function up143(db) {
15209
15282
  GROUP BY j.agent_id;
15210
15283
  `);
15211
15284
  }
15212
- function up144(db) {
15285
+ function up145(db) {
15213
15286
  db.exec(`
15214
15287
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
15215
15288
  agent_id TEXT NOT NULL,
@@ -15225,7 +15298,7 @@ function up144(db) {
15225
15298
  ON native_source_sync_state(agent_id, status);
15226
15299
  `);
15227
15300
  }
15228
- function up145(db) {
15301
+ function up146(db) {
15229
15302
  db.exec(`
15230
15303
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
15231
15304
  agent_id TEXT NOT NULL,
@@ -15237,7 +15310,7 @@ function up145(db) {
15237
15310
  );
15238
15311
  `);
15239
15312
  }
15240
- function up146(db) {
15313
+ function up147(db) {
15241
15314
  db.exec(`
15242
15315
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
15243
15316
  agent_id TEXT NOT NULL,
@@ -15251,13 +15324,13 @@ function up146(db) {
15251
15324
  );
15252
15325
  `);
15253
15326
  }
15254
- function up147(db) {
15327
+ function up148(db) {
15255
15328
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
15256
15329
  if (!columns.some((column) => column.name === "frontier")) {
15257
15330
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
15258
15331
  }
15259
15332
  }
15260
- function up148(db) {
15333
+ function up149(db) {
15261
15334
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
15262
15335
  const additions = [
15263
15336
  ["migration_phase", "TEXT"],
@@ -15292,13 +15365,13 @@ function up148(db) {
15292
15365
  `);
15293
15366
  }
15294
15367
  }
15295
- function up149(db) {
15368
+ function up150(db) {
15296
15369
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
15297
15370
  if (!columns.has("lease_token")) {
15298
15371
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
15299
15372
  }
15300
15373
  }
15301
- function up150(db) {
15374
+ function up151(db) {
15302
15375
  db.exec(`
15303
15376
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
15304
15377
  agent_id TEXT NOT NULL,
@@ -15316,7 +15389,7 @@ function up150(db) {
15316
15389
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
15317
15390
  `);
15318
15391
  }
15319
- function up151(db) {
15392
+ function up152(db) {
15320
15393
  db.exec(`
15321
15394
  CREATE TABLE IF NOT EXISTS source_import_jobs (
15322
15395
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -15383,16 +15456,16 @@ function up151(db) {
15383
15456
  }
15384
15457
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
15385
15458
  }
15386
- function up152(db) {
15459
+ function up153(db) {
15387
15460
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
15388
15461
  }
15389
- function up153(db) {
15462
+ function up154(db) {
15390
15463
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
15391
15464
  if (!columns.some((column) => column.name === "source_id")) {
15392
15465
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
15393
15466
  }
15394
15467
  }
15395
- function up154(db) {
15468
+ function up155(db) {
15396
15469
  const addColumn = (table, column, definition) => {
15397
15470
  const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
15398
15471
  let exists;
@@ -15413,7 +15486,7 @@ function addColumnIfMissing29(db, table, column, definition) {
15413
15486
  if (!columns.some((row) => row.name === column))
15414
15487
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15415
15488
  }
15416
- function up155(db) {
15489
+ function up156(db) {
15417
15490
  addColumnIfMissing29(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
15418
15491
  addColumnIfMissing29(db, "dreaming_passes", "head_base_revision", "INTEGER");
15419
15492
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -15563,7 +15636,7 @@ function up155(db) {
15563
15636
  `);
15564
15637
  }
15565
15638
  }
15566
- function up156(db) {
15639
+ function up157(db) {
15567
15640
  db.exec(`
15568
15641
  CREATE TABLE IF NOT EXISTS vector_repair_checkpoints (
15569
15642
  operation TEXT NOT NULL CHECK (operation IN ('resync', 'clean-orphans')),
@@ -15588,7 +15661,7 @@ function up156(db) {
15588
15661
  ON vector_repair_checkpoints(status, updated_at);
15589
15662
  `);
15590
15663
  }
15591
- function up157(db) {
15664
+ function up158(db) {
15592
15665
  db.exec(`
15593
15666
  CREATE TABLE IF NOT EXISTS embedding_repair_checkpoints (
15594
15667
  checkpoint_id TEXT PRIMARY KEY,
@@ -15609,7 +15682,7 @@ function up157(db) {
15609
15682
  ON embedding_repair_checkpoints(status, updated_at);
15610
15683
  `);
15611
15684
  }
15612
- function up158(db) {
15685
+ function up159(db) {
15613
15686
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_repair_checkpoints)").all().map((row) => row.name));
15614
15687
  if (!columns.has("profile_fingerprint")) {
15615
15688
  db.exec("ALTER TABLE embedding_repair_checkpoints ADD COLUMN profile_fingerprint TEXT");
@@ -15624,7 +15697,7 @@ function up158(db) {
15624
15697
  );
15625
15698
  `);
15626
15699
  }
15627
- function up159(db) {
15700
+ function up160(db) {
15628
15701
  db.exec(`
15629
15702
  CREATE INDEX IF NOT EXISTS idx_memories_agent_kind
15630
15703
  ON memories(agent_id, memory_kind);
@@ -15691,7 +15764,7 @@ function rebuildLedgerWithoutGlobalKeyPrimaryKey(db) {
15691
15764
  throw error;
15692
15765
  }
15693
15766
  }
15694
- function up160(db) {
15767
+ function up161(db) {
15695
15768
  db.exec(`
15696
15769
  CREATE TABLE IF NOT EXISTS import_admission_ledger (
15697
15770
  key TEXT NOT NULL, agent_id TEXT NOT NULL, workspace_id TEXT NOT NULL DEFAULT '', file_name TEXT NOT NULL,
@@ -15726,13 +15799,13 @@ function up160(db) {
15726
15799
  CREATE INDEX IF NOT EXISTS idx_import_admission_events_key ON import_admission_events(admission_key, agent_id, workspace_id, id);
15727
15800
  `);
15728
15801
  }
15729
- function up161(db) {
15802
+ function up162(db) {
15730
15803
  db.exec(`
15731
15804
  CREATE INDEX IF NOT EXISTS idx_entities_agent_updated_id
15732
15805
  ON entities(agent_id, updated_at DESC, id DESC);
15733
15806
  `);
15734
15807
  }
15735
- function up162(db) {
15808
+ function up163(db) {
15736
15809
  db.exec(`
15737
15810
  CREATE TABLE IF NOT EXISTS generic_entity_prune_scan_state (
15738
15811
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15773,7 +15846,7 @@ function up162(db) {
15773
15846
  END;
15774
15847
  `);
15775
15848
  }
15776
- function up163(db) {
15849
+ function up164(db) {
15777
15850
  db.exec(`
15778
15851
  DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_ai;
15779
15852
  DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_au;
@@ -15783,7 +15856,7 @@ function up163(db) {
15783
15856
  `);
15784
15857
  }
15785
15858
  var COLUMNS3 = ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"];
15786
- function up164(db) {
15859
+ function up165(db) {
15787
15860
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
15788
15861
  for (const column of COLUMNS3) {
15789
15862
  if (!cols.some((col) => col.name === column)) {
@@ -15791,7 +15864,7 @@ function up164(db) {
15791
15864
  }
15792
15865
  }
15793
15866
  }
15794
- function up165(db) {
15867
+ function up166(db) {
15795
15868
  const passColumns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
15796
15869
  if (!passColumns.some((column) => column.name === "scope_key")) {
15797
15870
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN scope_key TEXT");
@@ -15814,13 +15887,13 @@ function up165(db) {
15814
15887
  ON dreaming_history_nodes(pass_id) WHERE pass_id IS NOT NULL;
15815
15888
  `);
15816
15889
  }
15817
- function up166(db) {
15890
+ function up167(db) {
15818
15891
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
15819
15892
  if (!columns.some((column) => column.name === "tokens_peak_context")) {
15820
15893
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN tokens_peak_context INTEGER");
15821
15894
  }
15822
15895
  }
15823
- function up167(db) {
15896
+ function up168(db) {
15824
15897
  const sql = readMemoriesFtsSql(db);
15825
15898
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
15826
15899
  return;
@@ -15832,7 +15905,7 @@ function hasTable5(db, table) {
15832
15905
  function hasColumn25(db, table, column) {
15833
15906
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15834
15907
  }
15835
- function up168(db) {
15908
+ function up169(db) {
15836
15909
  if (!hasTable5(db, "entity_attributes") || !hasTable5(db, "entity_aspects") || !hasTable5(db, "entities") || !hasColumn25(db, "entity_attributes", "source_root") || !hasColumn25(db, "entities", "source_root")) {
15837
15910
  return;
15838
15911
  }
@@ -15905,7 +15978,7 @@ function up168(db) {
15905
15978
  DROP TABLE retired_source_paragraphs;
15906
15979
  `);
15907
15980
  }
15908
- function up169(db) {
15981
+ function up170(db) {
15909
15982
  if (db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_evidence_consumption'").get() == null)
15910
15983
  return;
15911
15984
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_consumption)").all();
@@ -15916,7 +15989,7 @@ function up169(db) {
15916
15989
  db.exec("ALTER TABLE dreaming_evidence_consumption ADD COLUMN stalled_passes INTEGER NOT NULL DEFAULT 0 CHECK (stalled_passes >= 0)");
15917
15990
  }
15918
15991
  }
15919
- function up170(db) {
15992
+ function up171(db) {
15920
15993
  db.exec(`
15921
15994
  CREATE TABLE IF NOT EXISTS dependency_history_compaction_state (
15922
15995
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15927,7 +16000,7 @@ function up170(db) {
15927
16000
  INSERT OR IGNORE INTO dependency_history_compaction_state (id) VALUES (1);
15928
16001
  `);
15929
16002
  }
15930
- function up171(db) {
16003
+ function up172(db) {
15931
16004
  db.exec(`
15932
16005
  CREATE TABLE IF NOT EXISTS cross_agent_message_wakes (
15933
16006
  message_id TEXT PRIMARY KEY,
@@ -16106,7 +16179,7 @@ function repairBoardNotices(db) {
16106
16179
  throw error;
16107
16180
  }
16108
16181
  }
16109
- function up172(db) {
16182
+ function up173(db) {
16110
16183
  db.exec(`
16111
16184
  CREATE TABLE IF NOT EXISTS dreaming_policies (
16112
16185
  hash TEXT PRIMARY KEY,
@@ -16120,7 +16193,7 @@ function up172(db) {
16120
16193
  if (!columns.has("policy_source"))
16121
16194
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN policy_source TEXT CHECK (policy_source IN ('default', 'custom'))");
16122
16195
  }
16123
- function up173(db) {
16196
+ function up174(db) {
16124
16197
  db.exec(`
16125
16198
  CREATE INDEX IF NOT EXISTS idx_memory_artifacts_native_paths
16126
16199
  ON memory_artifacts(agent_id, harness, source_kind, source_id, source_path, is_deleted)
@@ -16131,13 +16204,13 @@ var MIGRATIONS = [
16131
16204
  {
16132
16205
  version: 1,
16133
16206
  name: "baseline",
16134
- up: up6,
16207
+ up: up7,
16135
16208
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16136
16209
  },
16137
16210
  {
16138
16211
  version: 2,
16139
16212
  name: "pipeline-v2",
16140
- up: up7,
16213
+ up: up8,
16141
16214
  artifacts: {
16142
16215
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16143
16216
  }
@@ -16145,12 +16218,12 @@ var MIGRATIONS = [
16145
16218
  {
16146
16219
  version: 3,
16147
16220
  name: "unique-content-hash",
16148
- up: up8
16221
+ up: up9
16149
16222
  },
16150
16223
  {
16151
16224
  version: 4,
16152
16225
  name: "history-actor-and-retention",
16153
- up: up9,
16226
+ up: up10,
16154
16227
  artifacts: {
16155
16228
  columns: [{ table: "memory_history", column: "actor_type" }]
16156
16229
  }
@@ -16158,7 +16231,7 @@ var MIGRATIONS = [
16158
16231
  {
16159
16232
  version: 5,
16160
16233
  name: "graph-extended",
16161
- up: up10,
16234
+ up: up11,
16162
16235
  artifacts: {
16163
16236
  columns: [{ table: "entities", column: "canonical_name" }]
16164
16237
  }
@@ -16166,7 +16239,7 @@ var MIGRATIONS = [
16166
16239
  {
16167
16240
  version: 6,
16168
16241
  name: "idempotency-key",
16169
- up: up11,
16242
+ up: up12,
16170
16243
  artifacts: {
16171
16244
  columns: [{ table: "memories", column: "idempotency_key" }]
16172
16245
  }
@@ -16174,42 +16247,42 @@ var MIGRATIONS = [
16174
16247
  {
16175
16248
  version: 7,
16176
16249
  name: "documents-and-connectors",
16177
- up: up12,
16250
+ up: up13,
16178
16251
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16179
16252
  },
16180
16253
  {
16181
16254
  version: 8,
16182
16255
  name: "embeddings-unique-hash",
16183
- up: up13
16256
+ up: up14
16184
16257
  },
16185
16258
  {
16186
16259
  version: 9,
16187
16260
  name: "summary-jobs",
16188
- up: up14,
16261
+ up: up15,
16189
16262
  artifacts: { tables: ["summary_jobs"] }
16190
16263
  },
16191
16264
  {
16192
16265
  version: 10,
16193
16266
  name: "umap-cache",
16194
- up: up15,
16267
+ up: up16,
16195
16268
  artifacts: { tables: ["umap_cache"] }
16196
16269
  },
16197
16270
  {
16198
16271
  version: 11,
16199
16272
  name: "session-scores",
16200
- up: up16,
16273
+ up: up17,
16201
16274
  artifacts: { tables: ["session_scores"] }
16202
16275
  },
16203
16276
  {
16204
16277
  version: 12,
16205
16278
  name: "scheduled-tasks",
16206
- up: up17,
16279
+ up: up18,
16207
16280
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16208
16281
  },
16209
16282
  {
16210
16283
  version: 13,
16211
16284
  name: "ingestion-tracking",
16212
- up: up18,
16285
+ up: up19,
16213
16286
  artifacts: {
16214
16287
  columns: [
16215
16288
  { table: "memories", column: "source_path" },
@@ -16220,13 +16293,13 @@ var MIGRATIONS = [
16220
16293
  {
16221
16294
  version: 14,
16222
16295
  name: "telemetry",
16223
- up: up19,
16296
+ up: up20,
16224
16297
  artifacts: { tables: ["telemetry_events"] }
16225
16298
  },
16226
16299
  {
16227
16300
  version: 15,
16228
16301
  name: "session-memories",
16229
- up: up20,
16302
+ up: up21,
16230
16303
  artifacts: {
16231
16304
  tables: ["session_memories"],
16232
16305
  columns: [
@@ -16238,13 +16311,13 @@ var MIGRATIONS = [
16238
16311
  {
16239
16312
  version: 16,
16240
16313
  name: "session-checkpoints",
16241
- up: up21,
16314
+ up: up22,
16242
16315
  artifacts: { tables: ["session_checkpoints"] }
16243
16316
  },
16244
16317
  {
16245
16318
  version: 17,
16246
16319
  name: "task-skills",
16247
- up: up22,
16320
+ up: up23,
16248
16321
  artifacts: {
16249
16322
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16250
16323
  }
@@ -16252,13 +16325,13 @@ var MIGRATIONS = [
16252
16325
  {
16253
16326
  version: 18,
16254
16327
  name: "skill-meta",
16255
- up: up23,
16328
+ up: up24,
16256
16329
  artifacts: { tables: ["skill_meta"] }
16257
16330
  },
16258
16331
  {
16259
16332
  version: 19,
16260
16333
  name: "knowledge-structure",
16261
- up: up24,
16334
+ up: up25,
16262
16335
  artifacts: {
16263
16336
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16264
16337
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16267,7 +16340,7 @@ var MIGRATIONS = [
16267
16340
  {
16268
16341
  version: 20,
16269
16342
  name: "session-structural-columns",
16270
- up: up25,
16343
+ up: up26,
16271
16344
  artifacts: {
16272
16345
  columns: [
16273
16346
  { table: "session_memories", column: "entity_slot" },
@@ -16280,7 +16353,7 @@ var MIGRATIONS = [
16280
16353
  {
16281
16354
  version: 21,
16282
16355
  name: "checkpoint-structural",
16283
- up: up26,
16356
+ up: up27,
16284
16357
  artifacts: {
16285
16358
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16286
16359
  }
@@ -16288,7 +16361,7 @@ var MIGRATIONS = [
16288
16361
  {
16289
16362
  version: 22,
16290
16363
  name: "entity-pinning",
16291
- up: up27,
16364
+ up: up28,
16292
16365
  artifacts: {
16293
16366
  columns: [
16294
16367
  { table: "entities", column: "pinned" },
@@ -16299,17 +16372,17 @@ var MIGRATIONS = [
16299
16372
  {
16300
16373
  version: 23,
16301
16374
  name: "retired-scorer-gap",
16302
- up: up28
16375
+ up: up29
16303
16376
  },
16304
16377
  {
16305
16378
  version: 24,
16306
16379
  name: "retired-scorer-gap",
16307
- up: up29
16380
+ up: up30
16308
16381
  },
16309
16382
  {
16310
16383
  version: 25,
16311
16384
  name: "agent-feedback",
16312
- up: up30,
16385
+ up: up31,
16313
16386
  artifacts: {
16314
16387
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16315
16388
  }
@@ -16317,32 +16390,32 @@ var MIGRATIONS = [
16317
16390
  {
16318
16391
  version: 26,
16319
16392
  name: "retired-scorer-gap",
16320
- up: up31
16393
+ up: up32
16321
16394
  },
16322
16395
  {
16323
16396
  version: 27,
16324
16397
  name: "backfill-canonical-names",
16325
- up: up32
16398
+ up: up33
16326
16399
  },
16327
16400
  {
16328
16401
  version: 28,
16329
16402
  name: "lossless-retention",
16330
- up: up33
16403
+ up: up34
16331
16404
  },
16332
16405
  {
16333
16406
  version: 29,
16334
16407
  name: "session-summary-dag",
16335
- up: up34
16408
+ up: up35
16336
16409
  },
16337
16410
  {
16338
16411
  version: 30,
16339
16412
  name: "nullable-memory-job-memory-id",
16340
- up: up35
16413
+ up: up36
16341
16414
  },
16342
16415
  {
16343
16416
  version: 31,
16344
16417
  name: "dependency-reason",
16345
- up: up36,
16418
+ up: up37,
16346
16419
  artifacts: {
16347
16420
  columns: [
16348
16421
  { table: "entity_dependencies", column: "reason" },
@@ -16353,7 +16426,7 @@ var MIGRATIONS = [
16353
16426
  {
16354
16427
  version: 32,
16355
16428
  name: "embeddings-vector-column",
16356
- up: up37,
16429
+ up: up38,
16357
16430
  artifacts: {
16358
16431
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16359
16432
  }
@@ -16361,7 +16434,7 @@ var MIGRATIONS = [
16361
16434
  {
16362
16435
  version: 33,
16363
16436
  name: "scope",
16364
- up: up38,
16437
+ up: up39,
16365
16438
  artifacts: {
16366
16439
  columns: [{ table: "memories", column: "scope" }]
16367
16440
  }
@@ -16369,17 +16442,17 @@ var MIGRATIONS = [
16369
16442
  {
16370
16443
  version: 34,
16371
16444
  name: "scope-aware-dedup",
16372
- up: up39
16445
+ up: up40
16373
16446
  },
16374
16447
  {
16375
16448
  version: 35,
16376
16449
  name: "entity-fts",
16377
- up: up40
16450
+ up: up41
16378
16451
  },
16379
16452
  {
16380
16453
  version: 36,
16381
16454
  name: "dependency-confidence",
16382
- up: up41,
16455
+ up: up42,
16383
16456
  artifacts: {
16384
16457
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16385
16458
  }
@@ -16387,7 +16460,7 @@ var MIGRATIONS = [
16387
16460
  {
16388
16461
  version: 37,
16389
16462
  name: "entity-communities",
16390
- up: up42,
16463
+ up: up43,
16391
16464
  artifacts: {
16392
16465
  tables: ["entity_communities"],
16393
16466
  columns: [{ table: "entities", column: "community_id" }]
@@ -16396,24 +16469,24 @@ var MIGRATIONS = [
16396
16469
  {
16397
16470
  version: 38,
16398
16471
  name: "memory-hints",
16399
- up: up43,
16472
+ up: up44,
16400
16473
  artifacts: { tables: ["memory_hints"] }
16401
16474
  },
16402
16475
  {
16403
16476
  version: 39,
16404
16477
  name: "dedup-entity-dependencies",
16405
- up: up44
16478
+ up: up45
16406
16479
  },
16407
16480
  {
16408
16481
  version: 40,
16409
16482
  name: "session-transcripts",
16410
- up: up45,
16483
+ up: up46,
16411
16484
  artifacts: { tables: ["session_transcripts"] }
16412
16485
  },
16413
16486
  {
16414
16487
  version: 41,
16415
16488
  name: "path-feedback",
16416
- up: up46,
16489
+ up: up47,
16417
16490
  artifacts: {
16418
16491
  tables: [
16419
16492
  "path_feedback_events",
@@ -16428,7 +16501,7 @@ var MIGRATIONS = [
16428
16501
  {
16429
16502
  version: 42,
16430
16503
  name: "session-memories-agent-id",
16431
- up: up47,
16504
+ up: up48,
16432
16505
  artifacts: {
16433
16506
  columns: [{ table: "session_memories", column: "agent_id" }]
16434
16507
  }
@@ -16436,7 +16509,7 @@ var MIGRATIONS = [
16436
16509
  {
16437
16510
  version: 43,
16438
16511
  name: "agents-table",
16439
- up: up48,
16512
+ up: up49,
16440
16513
  artifacts: {
16441
16514
  tables: ["agents"],
16442
16515
  columns: [
@@ -16448,7 +16521,7 @@ var MIGRATIONS = [
16448
16521
  {
16449
16522
  version: 44,
16450
16523
  name: "memory-md-temporal-head",
16451
- up: up49,
16524
+ up: up50,
16452
16525
  artifacts: {
16453
16526
  columns: [
16454
16527
  { table: "session_summaries", column: "source_type" },
@@ -16460,7 +16533,7 @@ var MIGRATIONS = [
16460
16533
  {
16461
16534
  version: 45,
16462
16535
  name: "lossless-working-memory-hardening",
16463
- up: up50,
16536
+ up: up51,
16464
16537
  artifacts: {
16465
16538
  tables: ["session_transcripts_fts", "memory_md_heads"],
16466
16539
  columns: [
@@ -16473,17 +16546,17 @@ var MIGRATIONS = [
16473
16546
  {
16474
16547
  version: 46,
16475
16548
  name: "session-summary-uniqueness",
16476
- up: up51
16549
+ up: up52
16477
16550
  },
16478
16551
  {
16479
16552
  version: 47,
16480
16553
  name: "agent-scoped-temporal-uniqueness",
16481
- up: up52
16554
+ up: up53
16482
16555
  },
16483
16556
  {
16484
16557
  version: 48,
16485
16558
  name: "thread-heads",
16486
- up: up53,
16559
+ up: up54,
16487
16560
  artifacts: {
16488
16561
  tables: ["memory_thread_heads"]
16489
16562
  }
@@ -16491,7 +16564,7 @@ var MIGRATIONS = [
16491
16564
  {
16492
16565
  version: 49,
16493
16566
  name: "session-extract-cursors",
16494
- up: up54,
16567
+ up: up55,
16495
16568
  artifacts: {
16496
16569
  tables: ["session_extract_cursors"]
16497
16570
  }
@@ -16499,7 +16572,7 @@ var MIGRATIONS = [
16499
16572
  {
16500
16573
  version: 50,
16501
16574
  name: "related-to-audit",
16502
- up: up55,
16575
+ up: up56,
16503
16576
  artifacts: {
16504
16577
  tables: ["entity_dependency_history"]
16505
16578
  }
@@ -16507,7 +16580,7 @@ var MIGRATIONS = [
16507
16580
  {
16508
16581
  version: 51,
16509
16582
  name: "memory-md-rolling-window-lineage",
16510
- up: up56,
16583
+ up: up57,
16511
16584
  artifacts: {
16512
16585
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16513
16586
  columns: [
@@ -16522,12 +16595,12 @@ var MIGRATIONS = [
16522
16595
  {
16523
16596
  version: 52,
16524
16597
  name: "mcp-invocations",
16525
- up: up57
16598
+ up: up58
16526
16599
  },
16527
16600
  {
16528
16601
  version: 53,
16529
16602
  name: "skill-invocations",
16530
- up: up58,
16603
+ up: up59,
16531
16604
  artifacts: {
16532
16605
  tables: ["skill_invocations"]
16533
16606
  }
@@ -16535,7 +16608,7 @@ var MIGRATIONS = [
16535
16608
  {
16536
16609
  version: 54,
16537
16610
  name: "task-agent-scope",
16538
- up: up59,
16611
+ up: up60,
16539
16612
  artifacts: {
16540
16613
  tables: ["task_scope_hints"]
16541
16614
  }
@@ -16543,7 +16616,7 @@ var MIGRATIONS = [
16543
16616
  {
16544
16617
  version: 55,
16545
16618
  name: "dreaming-state",
16546
- up: up60,
16619
+ up: up61,
16547
16620
  artifacts: {
16548
16621
  tables: ["dreaming_state", "dreaming_passes"]
16549
16622
  }
@@ -16551,22 +16624,22 @@ var MIGRATIONS = [
16551
16624
  {
16552
16625
  version: 56,
16553
16626
  name: "agent-scoped-content-hash",
16554
- up: up61
16627
+ up: up62
16555
16628
  },
16556
16629
  {
16557
16630
  version: 57,
16558
16631
  name: "memories-fts-tokenizer-repair",
16559
- up: up62
16632
+ up: up63
16560
16633
  },
16561
16634
  {
16562
16635
  version: 58,
16563
16636
  name: "knowledge-graph-indices",
16564
- up: up63
16637
+ up: up64
16565
16638
  },
16566
16639
  {
16567
16640
  version: 59,
16568
16641
  name: "entity-attribute-claim-key",
16569
- up: up64,
16642
+ up: up65,
16570
16643
  artifacts: {
16571
16644
  columns: [{ table: "entity_attributes", column: "claim_key" }]
16572
16645
  }
@@ -16574,7 +16647,7 @@ var MIGRATIONS = [
16574
16647
  {
16575
16648
  version: 60,
16576
16649
  name: "entity-attribute-group-key",
16577
- up: up65,
16650
+ up: up66,
16578
16651
  artifacts: {
16579
16652
  columns: [{ table: "entity_attributes", column: "group_key" }]
16580
16653
  }
@@ -16582,7 +16655,7 @@ var MIGRATIONS = [
16582
16655
  {
16583
16656
  version: 61,
16584
16657
  name: "memory-artifact-source-mtime",
16585
- up: up66,
16658
+ up: up67,
16586
16659
  artifacts: {
16587
16660
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
16588
16661
  }
@@ -16590,7 +16663,7 @@ var MIGRATIONS = [
16590
16663
  {
16591
16664
  version: 62,
16592
16665
  name: "memory-artifact-soft-delete",
16593
- up: up67,
16666
+ up: up68,
16594
16667
  artifacts: {
16595
16668
  columns: [
16596
16669
  { table: "memory_artifacts", column: "is_deleted" },
@@ -16601,12 +16674,12 @@ var MIGRATIONS = [
16601
16674
  {
16602
16675
  version: 63,
16603
16676
  name: "content-only-memories-fts-update",
16604
- up: up68
16677
+ up: up69
16605
16678
  },
16606
16679
  {
16607
16680
  version: 64,
16608
16681
  name: "source-graph-provenance",
16609
- up: up69,
16682
+ up: up70,
16610
16683
  artifacts: {
16611
16684
  columns: [
16612
16685
  { table: "entities", column: "source_path" },
@@ -16619,7 +16692,7 @@ var MIGRATIONS = [
16619
16692
  {
16620
16693
  version: 65,
16621
16694
  name: "source-embedding-agent-scope",
16622
- up: up70,
16695
+ up: up71,
16623
16696
  artifacts: {
16624
16697
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
16625
16698
  }
@@ -16627,7 +16700,7 @@ var MIGRATIONS = [
16627
16700
  {
16628
16701
  version: 66,
16629
16702
  name: "memory-search-telemetry",
16630
- up: up71,
16703
+ up: up72,
16631
16704
  artifacts: {
16632
16705
  tables: ["memory_search_telemetry"]
16633
16706
  }
@@ -16635,7 +16708,7 @@ var MIGRATIONS = [
16635
16708
  {
16636
16709
  version: 67,
16637
16710
  name: "ontology-proposals",
16638
- up: up72,
16711
+ up: up73,
16639
16712
  artifacts: {
16640
16713
  tables: ["ontology_proposals"],
16641
16714
  columns: [
@@ -16649,7 +16722,7 @@ var MIGRATIONS = [
16649
16722
  {
16650
16723
  version: 68,
16651
16724
  name: "daily-reflections",
16652
- up: up73,
16725
+ up: up74,
16653
16726
  artifacts: {
16654
16727
  tables: ["daily_reflections"]
16655
16728
  }
@@ -16657,7 +16730,7 @@ var MIGRATIONS = [
16657
16730
  {
16658
16731
  version: 69,
16659
16732
  name: "daily-reflections-multiple-insights",
16660
- up: up74,
16733
+ up: up75,
16661
16734
  artifacts: {
16662
16735
  tables: ["daily_reflections"]
16663
16736
  }
@@ -16665,7 +16738,7 @@ var MIGRATIONS = [
16665
16738
  {
16666
16739
  version: 70,
16667
16740
  name: "ontology-control-plane-state",
16668
- up: up75,
16741
+ up: up76,
16669
16742
  artifacts: {
16670
16743
  columns: [
16671
16744
  { table: "entities", column: "status" },
@@ -16680,7 +16753,7 @@ var MIGRATIONS = [
16680
16753
  {
16681
16754
  version: 71,
16682
16755
  name: "epistemic-assertions",
16683
- up: up76,
16756
+ up: up77,
16684
16757
  artifacts: {
16685
16758
  tables: ["epistemic_assertions"]
16686
16759
  }
@@ -16688,7 +16761,7 @@ var MIGRATIONS = [
16688
16761
  {
16689
16762
  version: 72,
16690
16763
  name: "agent-scoped-idempotency-key",
16691
- up: up77,
16764
+ up: up78,
16692
16765
  artifacts: {
16693
16766
  columns: [
16694
16767
  { table: "memories", column: "idempotency_key" },
@@ -16699,7 +16772,7 @@ var MIGRATIONS = [
16699
16772
  {
16700
16773
  version: 73,
16701
16774
  name: "recall-context-dedupe",
16702
- up: up78,
16775
+ up: up79,
16703
16776
  artifacts: {
16704
16777
  tables: ["session_context_epochs", "session_recall_events"]
16705
16778
  }
@@ -16707,7 +16780,7 @@ var MIGRATIONS = [
16707
16780
  {
16708
16781
  version: 74,
16709
16782
  name: "aggregate-memory-links",
16710
- up: up79,
16783
+ up: up80,
16711
16784
  artifacts: {
16712
16785
  tables: ["aggregate_memory_sources"]
16713
16786
  }
@@ -16715,7 +16788,7 @@ var MIGRATIONS = [
16715
16788
  {
16716
16789
  version: 75,
16717
16790
  name: "memory-artifact-source-provenance",
16718
- up: up80,
16791
+ up: up81,
16719
16792
  artifacts: {
16720
16793
  columns: [
16721
16794
  { table: "memory_artifacts", column: "source_id" },
@@ -16729,7 +16802,7 @@ var MIGRATIONS = [
16729
16802
  {
16730
16803
  version: 76,
16731
16804
  name: "temporal-edges",
16732
- up: up81,
16805
+ up: up82,
16733
16806
  artifacts: {
16734
16807
  tables: ["temporal_edges"]
16735
16808
  }
@@ -16737,7 +16810,7 @@ var MIGRATIONS = [
16737
16810
  {
16738
16811
  version: 77,
16739
16812
  name: "entity-aliases",
16740
- up: up82,
16813
+ up: up83,
16741
16814
  artifacts: {
16742
16815
  tables: ["entity_aliases"]
16743
16816
  }
@@ -16745,7 +16818,7 @@ var MIGRATIONS = [
16745
16818
  {
16746
16819
  version: 78,
16747
16820
  name: "api-keys",
16748
- up: up83,
16821
+ up: up84,
16749
16822
  artifacts: {
16750
16823
  tables: ["api_keys"]
16751
16824
  }
@@ -16753,7 +16826,7 @@ var MIGRATIONS = [
16753
16826
  {
16754
16827
  version: 79,
16755
16828
  name: "transcript-capture-jobs",
16756
- up: up84,
16829
+ up: up85,
16757
16830
  artifacts: {
16758
16831
  tables: ["transcript_capture_jobs"]
16759
16832
  }
@@ -16761,7 +16834,7 @@ var MIGRATIONS = [
16761
16834
  {
16762
16835
  version: 80,
16763
16836
  name: "document-scope-columns",
16764
- up: up85,
16837
+ up: up86,
16765
16838
  artifacts: {
16766
16839
  columns: [
16767
16840
  { table: "documents", column: "agent_id" },
@@ -16772,7 +16845,7 @@ var MIGRATIONS = [
16772
16845
  {
16773
16846
  version: 81,
16774
16847
  name: "aggregate-evidence-sources",
16775
- up: up86,
16848
+ up: up87,
16776
16849
  artifacts: {
16777
16850
  tables: ["aggregate_evidence_sources"]
16778
16851
  }
@@ -16780,7 +16853,7 @@ var MIGRATIONS = [
16780
16853
  {
16781
16854
  version: 82,
16782
16855
  name: "skill-invocations-harness",
16783
- up: up87,
16856
+ up: up88,
16784
16857
  artifacts: {
16785
16858
  columns: [
16786
16859
  { table: "skill_invocations", column: "harness" },
@@ -16791,7 +16864,7 @@ var MIGRATIONS = [
16791
16864
  {
16792
16865
  version: 83,
16793
16866
  name: "memory-lifecycle-repair",
16794
- up: up88,
16867
+ up: up89,
16795
16868
  artifacts: {
16796
16869
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
16797
16870
  columns: [
@@ -16806,7 +16879,7 @@ var MIGRATIONS = [
16806
16879
  {
16807
16880
  version: 84,
16808
16881
  name: "legacy-markdown-import-state",
16809
- up: up89,
16882
+ up: up90,
16810
16883
  artifacts: {
16811
16884
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
16812
16885
  }
@@ -16814,7 +16887,7 @@ var MIGRATIONS = [
16814
16887
  {
16815
16888
  version: 85,
16816
16889
  name: "backfill-relations-to-dependencies",
16817
- up: up90,
16890
+ up: up91,
16818
16891
  artifacts: {
16819
16892
  tables: ["entity_dependencies"]
16820
16893
  }
@@ -16822,7 +16895,7 @@ var MIGRATIONS = [
16822
16895
  {
16823
16896
  version: 86,
16824
16897
  name: "summary-jobs-content-hash",
16825
- up: up91,
16898
+ up: up92,
16826
16899
  artifacts: {
16827
16900
  columns: [{ table: "summary_jobs", column: "content_hash" }]
16828
16901
  }
@@ -16830,7 +16903,7 @@ var MIGRATIONS = [
16830
16903
  {
16831
16904
  version: 87,
16832
16905
  name: "summary-jobs-boundary-reason",
16833
- up: up92,
16906
+ up: up93,
16834
16907
  artifacts: {
16835
16908
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
16836
16909
  }
@@ -16838,7 +16911,7 @@ var MIGRATIONS = [
16838
16911
  {
16839
16912
  version: 88,
16840
16913
  name: "transcript-recovery-files",
16841
- up: up93,
16914
+ up: up94,
16842
16915
  artifacts: {
16843
16916
  tables: ["transcript_recovery_files"]
16844
16917
  }
@@ -16846,7 +16919,7 @@ var MIGRATIONS = [
16846
16919
  {
16847
16920
  version: 89,
16848
16921
  name: "job-cancellations",
16849
- up: up94,
16922
+ up: up95,
16850
16923
  artifacts: {
16851
16924
  tables: ["job_cancellations"]
16852
16925
  }
@@ -16854,7 +16927,7 @@ var MIGRATIONS = [
16854
16927
  {
16855
16928
  version: 90,
16856
16929
  name: "job-archive",
16857
- up: up95,
16930
+ up: up96,
16858
16931
  artifacts: {
16859
16932
  tables: ["job_archive"]
16860
16933
  }
@@ -16862,25 +16935,25 @@ var MIGRATIONS = [
16862
16935
  {
16863
16936
  version: 91,
16864
16937
  name: "embedding-index-generations",
16865
- up: up96,
16938
+ up: up97,
16866
16939
  artifacts: { tables: ["embedding_index_state"] }
16867
16940
  },
16868
16941
  {
16869
16942
  version: 92,
16870
16943
  name: "embedding-staging-store",
16871
- up: up97,
16944
+ up: up98,
16872
16945
  artifacts: { tables: ["embeddings_staging"] }
16873
16946
  },
16874
16947
  {
16875
16948
  version: 93,
16876
16949
  name: "dreaming-evidence-cursor",
16877
- up: up98,
16950
+ up: up99,
16878
16951
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
16879
16952
  },
16880
16953
  {
16881
16954
  version: 94,
16882
16955
  name: "memory-kind",
16883
- up: up99,
16956
+ up: up100,
16884
16957
  artifacts: {
16885
16958
  columns: [
16886
16959
  { table: "memories", column: "memory_kind" },
@@ -16891,35 +16964,35 @@ var MIGRATIONS = [
16891
16964
  {
16892
16965
  version: 95,
16893
16966
  name: "compaction-recall-projections",
16894
- up: up100
16967
+ up: up101
16895
16968
  },
16896
16969
  {
16897
16970
  version: 96,
16898
16971
  name: "retire-legacy-ingestion",
16899
- up: up101
16972
+ up: up102
16900
16973
  },
16901
16974
  {
16902
16975
  version: 97,
16903
16976
  name: "dreaming-failure-backoff",
16904
- up: up102,
16977
+ up: up103,
16905
16978
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
16906
16979
  },
16907
16980
  {
16908
16981
  version: 98,
16909
16982
  name: "dreaming-evidence-exclusions",
16910
- up: up103,
16983
+ up: up104,
16911
16984
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
16912
16985
  },
16913
16986
  {
16914
16987
  version: 99,
16915
16988
  name: "dreaming-tool-calls",
16916
- up: up104,
16989
+ up: up105,
16917
16990
  artifacts: { tables: ["dreaming_tool_calls"] }
16918
16991
  },
16919
16992
  {
16920
16993
  version: 100,
16921
16994
  name: "dreaming-runbook",
16922
- up: up105,
16995
+ up: up106,
16923
16996
  artifacts: {
16924
16997
  columns: [
16925
16998
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -16930,23 +17003,23 @@ var MIGRATIONS = [
16930
17003
  {
16931
17004
  version: 101,
16932
17005
  name: "dreaming-attention",
16933
- up: up106,
17006
+ up: up107,
16934
17007
  artifacts: { tables: ["dreaming_attention"] }
16935
17008
  },
16936
17009
  {
16937
17010
  version: 102,
16938
17011
  name: "attribute-semantic-memories",
16939
- up: up107
17012
+ up: up108
16940
17013
  },
16941
17014
  {
16942
17015
  version: 103,
16943
17016
  name: "semantic-memory-kind",
16944
- up: up108
17017
+ up: up109
16945
17018
  },
16946
17019
  {
16947
17020
  version: 104,
16948
17021
  name: "derived-memory-provenance",
16949
- up: up109,
17022
+ up: up110,
16950
17023
  artifacts: {
16951
17024
  tables: ["derived_memory_sources"],
16952
17025
  columns: [{ table: "memories", column: "stale_at" }]
@@ -16955,12 +17028,12 @@ var MIGRATIONS = [
16955
17028
  {
16956
17029
  version: 105,
16957
17030
  name: "agent-scoped-entity-name",
16958
- up: up110
17031
+ up: up111
16959
17032
  },
16960
17033
  {
16961
17034
  version: 106,
16962
17035
  name: "memory-review-after",
16963
- up: up111,
17036
+ up: up112,
16964
17037
  artifacts: {
16965
17038
  columns: [{ table: "memories", column: "review_after" }]
16966
17039
  }
@@ -16968,7 +17041,7 @@ var MIGRATIONS = [
16968
17041
  {
16969
17042
  version: 107,
16970
17043
  name: "dreaming-pass-usage",
16971
- up: up112,
17044
+ up: up113,
16972
17045
  artifacts: {
16973
17046
  columns: [
16974
17047
  { table: "dreaming_passes", column: "tokens_input" },
@@ -16982,7 +17055,7 @@ var MIGRATIONS = [
16982
17055
  {
16983
17056
  version: 108,
16984
17057
  name: "embedding-usage",
16985
- up: up113,
17058
+ up: up114,
16986
17059
  artifacts: {
16987
17060
  tables: ["embedding_usage"]
16988
17061
  }
@@ -16990,7 +17063,7 @@ var MIGRATIONS = [
16990
17063
  {
16991
17064
  version: 109,
16992
17065
  name: "telemetry-install",
16993
- up: up114,
17066
+ up: up115,
16994
17067
  artifacts: {
16995
17068
  tables: ["telemetry_install"]
16996
17069
  }
@@ -16998,12 +17071,12 @@ var MIGRATIONS = [
16998
17071
  {
16999
17072
  version: 110,
17000
17073
  name: "memory-mention-join-index",
17001
- up: up115
17074
+ up: up116
17002
17075
  },
17003
17076
  {
17004
17077
  version: 111,
17005
17078
  name: "telemetry-first-use",
17006
- up: up116,
17079
+ up: up117,
17007
17080
  artifacts: {
17008
17081
  columns: [
17009
17082
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17014,7 +17087,7 @@ var MIGRATIONS = [
17014
17087
  {
17015
17088
  version: 112,
17016
17089
  name: "telemetry-queue-ownership",
17017
- up: up117,
17090
+ up: up118,
17018
17091
  artifacts: {
17019
17092
  columns: [
17020
17093
  { table: "telemetry_events", column: "source" },
@@ -17026,7 +17099,7 @@ var MIGRATIONS = [
17026
17099
  {
17027
17100
  version: 113,
17028
17101
  name: "session-claims",
17029
- up: up118,
17102
+ up: up119,
17030
17103
  artifacts: {
17031
17104
  tables: ["session_claims"],
17032
17105
  columns: [
@@ -17040,12 +17113,12 @@ var MIGRATIONS = [
17040
17113
  {
17041
17114
  version: 114,
17042
17115
  name: "memory-traversal-hydration-index",
17043
- up: up119
17116
+ up: up120
17044
17117
  },
17045
17118
  {
17046
17119
  version: 115,
17047
17120
  name: "cross-agent-message-notifications",
17048
- up: up120,
17121
+ up: up121,
17049
17122
  artifacts: {
17050
17123
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17051
17124
  }
@@ -17053,7 +17126,7 @@ var MIGRATIONS = [
17053
17126
  {
17054
17127
  version: 116,
17055
17128
  name: "acp-delivery-reconciliation",
17056
- up: up121,
17129
+ up: up122,
17057
17130
  artifacts: {
17058
17131
  columns: [
17059
17132
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17067,7 +17140,7 @@ var MIGRATIONS = [
17067
17140
  {
17068
17141
  version: 117,
17069
17142
  name: "retire-summary-worker",
17070
- up: up122,
17143
+ up: up123,
17071
17144
  artifacts: {
17072
17145
  columns: [
17073
17146
  { table: "session_transcripts", column: "completed_at" },
@@ -17078,24 +17151,24 @@ var MIGRATIONS = [
17078
17151
  {
17079
17152
  version: 118,
17080
17153
  name: "queue-pressure-indices",
17081
- up: up123
17154
+ up: up124
17082
17155
  },
17083
17156
  {
17084
17157
  version: 119,
17085
17158
  name: "telemetry-version-observation",
17086
- up: up124,
17159
+ up: up125,
17087
17160
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17088
17161
  },
17089
17162
  {
17090
17163
  version: 120,
17091
17164
  name: "source-lifecycle-telemetry",
17092
- up: up125,
17165
+ up: up126,
17093
17166
  artifacts: { tables: ["source_lifecycle_state"] }
17094
17167
  },
17095
17168
  {
17096
17169
  version: 121,
17097
17170
  name: "telemetry-delivery-health",
17098
- up: up126,
17171
+ up: up127,
17099
17172
  artifacts: {
17100
17173
  tables: ["telemetry_delivery_state"],
17101
17174
  columns: [
@@ -17109,7 +17182,7 @@ var MIGRATIONS = [
17109
17182
  {
17110
17183
  version: 122,
17111
17184
  name: "dreaming-evidence-retry",
17112
- up: up127,
17185
+ up: up128,
17113
17186
  artifacts: {
17114
17187
  columns: [
17115
17188
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17122,13 +17195,13 @@ var MIGRATIONS = [
17122
17195
  {
17123
17196
  version: 123,
17124
17197
  name: "embedding-index-failures",
17125
- up: up128,
17198
+ up: up129,
17126
17199
  artifacts: { tables: ["embedding_index_failures"] }
17127
17200
  },
17128
17201
  {
17129
17202
  version: 124,
17130
17203
  name: "import-derived-lifecycle",
17131
- up: up129,
17204
+ up: up130,
17132
17205
  artifacts: {
17133
17206
  tables: ["imported_source_lifecycle"]
17134
17207
  }
@@ -17136,76 +17209,76 @@ var MIGRATIONS = [
17136
17209
  {
17137
17210
  version: 125,
17138
17211
  name: "memory-content-safety",
17139
- up: up130
17212
+ up: up131
17140
17213
  },
17141
17214
  {
17142
17215
  version: 126,
17143
17216
  name: "dreaming-surprisal-attention",
17144
- up: up131,
17217
+ up: up132,
17145
17218
  artifacts: { tables: ["dreaming_attention"] }
17146
17219
  },
17147
17220
  {
17148
17221
  version: 127,
17149
17222
  name: "ontology-contradictions",
17150
- up: up132,
17223
+ up: up133,
17151
17224
  artifacts: { tables: ["ontology_contradictions"] }
17152
17225
  },
17153
17226
  {
17154
17227
  version: 128,
17155
17228
  name: "bounded-queue-diagnostics",
17156
- up: up133
17229
+ up: up134
17157
17230
  },
17158
17231
  {
17159
17232
  version: 129,
17160
17233
  name: "retire-structural-jobs",
17161
- up: up134
17234
+ up: up135
17162
17235
  },
17163
17236
  {
17164
17237
  version: 130,
17165
17238
  name: "embedding-repair-state",
17166
- up: up135,
17239
+ up: up136,
17167
17240
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17168
17241
  },
17169
17242
  {
17170
17243
  version: 131,
17171
17244
  name: "dreaming-evidence-consumption",
17172
- up: up136,
17245
+ up: up137,
17173
17246
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17174
17247
  },
17175
17248
  {
17176
17249
  version: 132,
17177
17250
  name: "observer-scoped-epistemic-assertions",
17178
- up: up137,
17251
+ up: up138,
17179
17252
  artifacts: { tables: ["epistemic_assertions"] }
17180
17253
  },
17181
17254
  {
17182
17255
  version: 133,
17183
17256
  name: "dreaming-memory-head",
17184
- up: up138,
17257
+ up: up139,
17185
17258
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17186
17259
  },
17187
17260
  {
17188
17261
  version: 134,
17189
17262
  name: "scope-memory-head-entries",
17190
- up: up139,
17263
+ up: up140,
17191
17264
  artifacts: { tables: ["memory_head_entries"] }
17192
17265
  },
17193
17266
  {
17194
17267
  version: 135,
17195
17268
  name: "memory-head-publication",
17196
- up: up140,
17269
+ up: up141,
17197
17270
  artifacts: { tables: ["memory_head_publications"] }
17198
17271
  },
17199
17272
  {
17200
17273
  version: 136,
17201
17274
  name: "memory-head-revisions",
17202
- up: up141,
17275
+ up: up142,
17203
17276
  artifacts: { tables: ["memory_head_revisions"] }
17204
17277
  },
17205
17278
  {
17206
17279
  version: 137,
17207
17280
  name: "dreaming-head-manifest",
17208
- up: up142,
17281
+ up: up143,
17209
17282
  artifacts: {
17210
17283
  columns: [
17211
17284
  { table: "dreaming_passes", column: "head_revision" },
@@ -17216,7 +17289,7 @@ var MIGRATIONS = [
17216
17289
  {
17217
17290
  version: 138,
17218
17291
  name: "bounded-status-projections",
17219
- up: up143,
17292
+ up: up144,
17220
17293
  artifacts: {
17221
17294
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17222
17295
  }
@@ -17224,31 +17297,31 @@ var MIGRATIONS = [
17224
17297
  {
17225
17298
  version: 139,
17226
17299
  name: "native-source-sync-state",
17227
- up: up144,
17300
+ up: up145,
17228
17301
  artifacts: { tables: ["native_source_sync_state"] }
17229
17302
  },
17230
17303
  {
17231
17304
  version: 140,
17232
17305
  name: "transcript-recovery-frontier",
17233
- up: up145,
17306
+ up: up146,
17234
17307
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17235
17308
  },
17236
17309
  {
17237
17310
  version: 141,
17238
17311
  name: "source-sync-checkpoints",
17239
- up: up146,
17312
+ up: up147,
17240
17313
  artifacts: { tables: ["source_sync_checkpoints"] }
17241
17314
  },
17242
17315
  {
17243
17316
  version: 142,
17244
17317
  name: "source-sync-frontier",
17245
- up: up147,
17318
+ up: up148,
17246
17319
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17247
17320
  },
17248
17321
  {
17249
17322
  version: 143,
17250
17323
  name: "embedding-index-progress",
17251
- up: up148,
17324
+ up: up149,
17252
17325
  artifacts: {
17253
17326
  columns: [
17254
17327
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17264,19 +17337,19 @@ var MIGRATIONS = [
17264
17337
  {
17265
17338
  version: 144,
17266
17339
  name: "memory-job-lease-token",
17267
- up: up149,
17340
+ up: up150,
17268
17341
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17269
17342
  },
17270
17343
  {
17271
17344
  version: 145,
17272
17345
  name: "dreaming-evidence-reviews",
17273
- up: up150,
17346
+ up: up151,
17274
17347
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17275
17348
  },
17276
17349
  {
17277
17350
  version: 146,
17278
17351
  name: "source-transcript-import",
17279
- up: up151,
17352
+ up: up152,
17280
17353
  artifacts: {
17281
17354
  tables: [
17282
17355
  "source_import_jobs",
@@ -17295,19 +17368,19 @@ var MIGRATIONS = [
17295
17368
  {
17296
17369
  version: 147,
17297
17370
  name: "source-import-replay-file-slots",
17298
- up: up152,
17371
+ up: up153,
17299
17372
  artifacts: { tables: ["source_import_files"] }
17300
17373
  },
17301
17374
  {
17302
17375
  version: 148,
17303
17376
  name: "source-import-attempt-provenance",
17304
- up: up153,
17377
+ up: up154,
17305
17378
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17306
17379
  },
17307
17380
  {
17308
17381
  version: 149,
17309
17382
  name: "transcript-import-state-machine",
17310
- up: up154,
17383
+ up: up155,
17311
17384
  artifacts: {
17312
17385
  columns: [
17313
17386
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17319,7 +17392,7 @@ var MIGRATIONS = [
17319
17392
  {
17320
17393
  version: 150,
17321
17394
  name: "memory-head-freshness",
17322
- up: up155,
17395
+ up: up156,
17323
17396
  artifacts: {
17324
17397
  columns: [
17325
17398
  { table: "memory_md_heads", column: "is_current" },
@@ -17330,7 +17403,7 @@ var MIGRATIONS = [
17330
17403
  {
17331
17404
  version: 151,
17332
17405
  name: "transcript-import-bytes",
17333
- up,
17406
+ up: up2,
17334
17407
  artifacts: {
17335
17408
  tables: [
17336
17409
  "source_import_chunks",
@@ -17359,19 +17432,19 @@ var MIGRATIONS = [
17359
17432
  {
17360
17433
  version: 152,
17361
17434
  name: "memory-artifact-sha-index",
17362
- up: up2,
17435
+ up: up3,
17363
17436
  artifacts: { indexes: ["idx_memory_artifacts_agent_sha"] }
17364
17437
  },
17365
17438
  {
17366
17439
  version: 153,
17367
17440
  name: "vector-repair-checkpoints",
17368
- up: up156,
17441
+ up: up157,
17369
17442
  artifacts: { tables: ["vector_repair_checkpoints"] }
17370
17443
  },
17371
17444
  {
17372
17445
  version: 154,
17373
17446
  name: "transcript-capture-source-identity",
17374
- up: up3,
17447
+ up: up4,
17375
17448
  artifacts: {
17376
17449
  columns: [
17377
17450
  { table: "transcript_capture_jobs", column: "source_identity" },
@@ -17386,19 +17459,19 @@ var MIGRATIONS = [
17386
17459
  {
17387
17460
  version: 155,
17388
17461
  name: "source-sync-failures",
17389
- up: up4,
17462
+ up: up5,
17390
17463
  artifacts: { tables: ["source_sync_failures"], indexes: ["idx_source_sync_failures_active"] }
17391
17464
  },
17392
17465
  {
17393
17466
  version: 156,
17394
17467
  name: "embedding-repair-checkpoints",
17395
- up: up157,
17468
+ up: up158,
17396
17469
  artifacts: { tables: ["embedding_repair_checkpoints"] }
17397
17470
  },
17398
17471
  {
17399
17472
  version: 157,
17400
17473
  name: "embedding-repair-progress",
17401
- up: up158,
17474
+ up: up159,
17402
17475
  artifacts: {
17403
17476
  tables: ["embedding_repair_progress"],
17404
17477
  columns: [{ table: "embedding_repair_checkpoints", column: "profile_fingerprint" }]
@@ -17407,18 +17480,18 @@ var MIGRATIONS = [
17407
17480
  {
17408
17481
  version: 158,
17409
17482
  name: "dreaming-candidate-scan-index",
17410
- up: up159,
17483
+ up: up160,
17411
17484
  artifacts: { indexes: ["idx_memories_agent_kind"] }
17412
17485
  },
17413
17486
  {
17414
17487
  version: 159,
17415
17488
  name: "retire-obsolete-invocation-ledger",
17416
- up: up5
17489
+ up: up6
17417
17490
  },
17418
17491
  {
17419
17492
  version: 160,
17420
17493
  name: "import-admission-ledger",
17421
- up: up160,
17494
+ up: up161,
17422
17495
  artifacts: {
17423
17496
  tables: ["import_admission_ledger", "import_admission_events"],
17424
17497
  indexes: ["idx_import_admission_status", "idx_import_admission_events_key"],
@@ -17430,24 +17503,24 @@ var MIGRATIONS = [
17430
17503
  {
17431
17504
  version: 161,
17432
17505
  name: "entity-prune-keyset-index",
17433
- up: up161,
17506
+ up: up162,
17434
17507
  artifacts: { indexes: ["idx_entities_agent_updated_id"] }
17435
17508
  },
17436
17509
  {
17437
17510
  version: 162,
17438
17511
  name: "generic-entity-prune-scan-generation",
17439
- up: up162,
17512
+ up: up163,
17440
17513
  artifacts: { tables: ["generic_entity_prune_scan_state"] }
17441
17514
  },
17442
17515
  {
17443
17516
  version: 163,
17444
17517
  name: "retire-memory-content-safety",
17445
- up: up163
17518
+ up: up164
17446
17519
  },
17447
17520
  {
17448
17521
  version: 164,
17449
17522
  name: "claim-event-time",
17450
- up: up164,
17523
+ up: up165,
17451
17524
  artifacts: {
17452
17525
  columns: ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"].map((column) => ({
17453
17526
  table: "entity_attributes",
@@ -17458,7 +17531,7 @@ var MIGRATIONS = [
17458
17531
  {
17459
17532
  version: 165,
17460
17533
  name: "dreaming-history",
17461
- up: up165,
17534
+ up: up166,
17462
17535
  artifacts: {
17463
17536
  tables: ["dreaming_history_nodes"],
17464
17537
  indexes: ["idx_dreaming_history_nodes_pass"],
@@ -17468,23 +17541,23 @@ var MIGRATIONS = [
17468
17541
  {
17469
17542
  version: 166,
17470
17543
  name: "dreaming-pass-peak-context",
17471
- up: up166,
17544
+ up: up167,
17472
17545
  artifacts: { columns: [{ table: "dreaming_passes", column: "tokens_peak_context" }] }
17473
17546
  },
17474
17547
  {
17475
17548
  version: 167,
17476
17549
  name: "memories-fts-porter",
17477
- up: up167
17550
+ up: up168
17478
17551
  },
17479
17552
  {
17480
17553
  version: 168,
17481
17554
  name: "retire-source-paragraph-claims",
17482
- up: up168
17555
+ up: up169
17483
17556
  },
17484
17557
  {
17485
17558
  version: 169,
17486
17559
  name: "dreaming-evidence-review-cursor",
17487
- up: up169,
17560
+ up: up170,
17488
17561
  artifacts: {
17489
17562
  columns: [
17490
17563
  { table: "dreaming_evidence_consumption", column: "cursor_basis" },
@@ -17495,7 +17568,7 @@ var MIGRATIONS = [
17495
17568
  {
17496
17569
  version: 170,
17497
17570
  name: "dependency-history-compaction-state",
17498
- up: up170,
17571
+ up: up171,
17499
17572
  artifacts: {
17500
17573
  tables: ["dependency_history_compaction_state"]
17501
17574
  }
@@ -17503,7 +17576,7 @@ var MIGRATIONS = [
17503
17576
  {
17504
17577
  version: 171,
17505
17578
  name: "agent-wake-and-message-board",
17506
- up: up171,
17579
+ up: up172,
17507
17580
  artifacts: {
17508
17581
  columns: [
17509
17582
  { table: "cross_agent_message_wakes", column: "session_key" },
@@ -17527,7 +17600,7 @@ var MIGRATIONS = [
17527
17600
  {
17528
17601
  version: 172,
17529
17602
  name: "dreaming-pass-policy",
17530
- up: up172,
17603
+ up: up173,
17531
17604
  artifacts: {
17532
17605
  tables: ["dreaming_policies"],
17533
17606
  columns: [
@@ -17539,8 +17612,35 @@ var MIGRATIONS = [
17539
17612
  {
17540
17613
  version: 173,
17541
17614
  name: "memory-artifact-native-path-index",
17542
- up: up173,
17615
+ up: up174,
17543
17616
  artifacts: { indexes: ["idx_memory_artifacts_native_paths"] }
17617
+ },
17618
+ {
17619
+ version: 174,
17620
+ name: "session-transcript-deletions",
17621
+ up,
17622
+ artifacts: {
17623
+ tables: [
17624
+ "session_transcript_deletions",
17625
+ "session_transcript_deleted_prefixes",
17626
+ "session_transcript_deleted_positions",
17627
+ "session_transcript_deleted_sources",
17628
+ "session_transcript_delete_files"
17629
+ ],
17630
+ indexes: [
17631
+ "idx_session_delete_files_pending",
17632
+ "idx_session_delete_source_lookup",
17633
+ "idx_memories_session_delete_source",
17634
+ "idx_capture_jobs_session_delete",
17635
+ "idx_import_records_session_delete"
17636
+ ],
17637
+ columns: [
17638
+ { table: "source_import_records", column: "redacted_bytes" },
17639
+ { table: "session_transcript_deletions", column: "pending_start" },
17640
+ { table: "session_transcript_deletions", column: "lifecycle_intent_seq" },
17641
+ { table: "session_transcript_deleted_prefixes", column: "origin" }
17642
+ ]
17643
+ }
17544
17644
  }
17545
17645
  ];
17546
17646
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;