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

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 +457 -347
  2. package/dist/index.js +457 -347
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -10442,6 +10442,79 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
10442
10442
  "dreaming"
10443
10443
  ];
10444
10444
  function up(db) {
10445
+ if (!db.prepare("PRAGMA table_info(source_import_records)").all().some((row) => row.name === "redacted_bytes"))
10446
+ db.exec("ALTER TABLE source_import_records ADD COLUMN redacted_bytes INTEGER NOT NULL DEFAULT 0");
10447
+ db.exec(`
10448
+ CREATE TABLE IF NOT EXISTS session_transcript_deletions (
10449
+ agent_id TEXT NOT NULL,
10450
+ session_key TEXT NOT NULL,
10451
+ generation INTEGER NOT NULL DEFAULT 1,
10452
+ watermark TEXT NOT NULL,
10453
+ opened_at TEXT,
10454
+ blocked INTEGER NOT NULL DEFAULT 1,
10455
+ ended INTEGER NOT NULL DEFAULT 0,
10456
+ pending_start INTEGER NOT NULL DEFAULT 0,
10457
+ lifecycle_intent_seq INTEGER NOT NULL DEFAULT 0,
10458
+ receipt_generation INTEGER NOT NULL DEFAULT 1,
10459
+ harness TEXT,
10460
+ project TEXT,
10461
+ hard INTEGER NOT NULL DEFAULT 0,
10462
+ phase TEXT NOT NULL DEFAULT 'evidence',
10463
+ counts TEXT NOT NULL DEFAULT '{}',
10464
+ PRIMARY KEY (agent_id, session_key)
10465
+ );
10466
+ CREATE TABLE IF NOT EXISTS session_transcript_deleted_prefixes (
10467
+ agent_id TEXT NOT NULL,
10468
+ session_key TEXT NOT NULL,
10469
+ generation INTEGER NOT NULL,
10470
+ origin TEXT NOT NULL,
10471
+ record_count INTEGER NOT NULL,
10472
+ record_hash TEXT NOT NULL,
10473
+ PRIMARY KEY (agent_id, session_key, generation, origin)
10474
+ );
10475
+ CREATE TABLE IF NOT EXISTS session_transcript_deleted_positions (
10476
+ agent_id TEXT NOT NULL,
10477
+ session_key TEXT NOT NULL,
10478
+ generation INTEGER NOT NULL,
10479
+ origin TEXT NOT NULL,
10480
+ position INTEGER NOT NULL,
10481
+ record_hash TEXT NOT NULL,
10482
+ PRIMARY KEY (agent_id, session_key, generation, origin, position),
10483
+ FOREIGN KEY (agent_id, session_key, generation, origin)
10484
+ REFERENCES session_transcript_deleted_prefixes(agent_id, session_key, generation, origin) ON DELETE CASCADE
10485
+ );
10486
+ CREATE TABLE IF NOT EXISTS session_transcript_deleted_sources (
10487
+ agent_id TEXT NOT NULL,
10488
+ session_key TEXT NOT NULL,
10489
+ generation INTEGER NOT NULL,
10490
+ kind TEXT NOT NULL,
10491
+ id TEXT NOT NULL,
10492
+ outcome TEXT NOT NULL DEFAULT 'deleted',
10493
+ PRIMARY KEY (agent_id, session_key, generation, kind, id)
10494
+ );
10495
+ CREATE TABLE IF NOT EXISTS session_transcript_delete_files (
10496
+ agent_id TEXT NOT NULL,
10497
+ session_key TEXT NOT NULL,
10498
+ generation INTEGER NOT NULL,
10499
+ path TEXT NOT NULL,
10500
+ checkpoint TEXT,
10501
+ done INTEGER NOT NULL DEFAULT 0,
10502
+ PRIMARY KEY (agent_id, session_key, generation, path)
10503
+ );
10504
+ CREATE INDEX IF NOT EXISTS idx_session_delete_files_pending ON session_transcript_delete_files(path) WHERE done = 0 AND checkpoint IS NOT NULL;
10505
+ CREATE INDEX IF NOT EXISTS idx_import_records_session_delete ON source_import_records(agent_id,canonical_key,redacted_bytes);
10506
+ CREATE INDEX IF NOT EXISTS idx_memories_session_delete_source ON memories(agent_id,source_id);
10507
+ CREATE INDEX IF NOT EXISTS idx_capture_jobs_session_delete ON transcript_capture_jobs(agent_id,session_key);
10508
+ CREATE INDEX IF NOT EXISTS idx_session_delete_source_lookup
10509
+ ON session_transcript_deleted_sources(agent_id, kind, id, outcome);
10510
+ `);
10511
+ const columns = db.prepare("PRAGMA table_info(session_transcript_deletions)").all();
10512
+ for (const column of ["pending_start", "lifecycle_intent_seq"]) {
10513
+ if (!columns.some((row) => row.name === column))
10514
+ db.exec(`ALTER TABLE session_transcript_deletions ADD COLUMN ${column} INTEGER NOT NULL DEFAULT 0`);
10515
+ }
10516
+ }
10517
+ function up2(db) {
10445
10518
  const hasColumn = (table, column) => {
10446
10519
  const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
10447
10520
  try {
@@ -10501,7 +10574,7 @@ function up(db) {
10501
10574
  CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
10502
10575
  `);
10503
10576
  }
10504
- function up2(db) {
10577
+ function up3(db) {
10505
10578
  db.exec(`
10506
10579
  DROP INDEX IF EXISTS idx_memory_artifacts_agent_sha;
10507
10580
  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)
@@ -10513,7 +10586,7 @@ function addColumnIfMissing(db, column, definition) {
10513
10586
  return;
10514
10587
  db.exec(`ALTER TABLE transcript_capture_jobs ADD COLUMN ${column} ${definition}`);
10515
10588
  }
10516
- function up3(db) {
10589
+ function up4(db) {
10517
10590
  const table = db.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'transcript_capture_jobs'").get();
10518
10591
  if (!table?.present)
10519
10592
  return;
@@ -10530,7 +10603,7 @@ function up3(db) {
10530
10603
  ON transcript_capture_jobs(agent_id, source_sha256);
10531
10604
  `);
10532
10605
  }
10533
- function up4(db) {
10606
+ function up5(db) {
10534
10607
  db.exec(`
10535
10608
  CREATE TABLE IF NOT EXISTS source_sync_failures (
10536
10609
  agent_id TEXT NOT NULL,
@@ -10553,7 +10626,7 @@ function up4(db) {
10553
10626
  WHERE resolved_at IS NULL;
10554
10627
  `);
10555
10628
  }
10556
- function up5(db) {
10629
+ function up6(db) {
10557
10630
  db.exec("DROP TABLE IF EXISTS mcp_invocations");
10558
10631
  }
10559
10632
  var MEMORIES_FTS_TOKENIZER = "porter unicode61";
@@ -10668,7 +10741,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
10668
10741
  return false;
10669
10742
  return !normalizeSql(sql).includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
10670
10743
  }
10671
- function up6(db) {
10744
+ function up7(db) {
10672
10745
  db.exec(`
10673
10746
  CREATE TABLE IF NOT EXISTS schema_migrations (
10674
10747
  version INTEGER PRIMARY KEY,
@@ -10766,7 +10839,7 @@ function addColumnIfMissing2(db, table, column, definition) {
10766
10839
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10767
10840
  }
10768
10841
  }
10769
- function up7(db) {
10842
+ function up8(db) {
10770
10843
  addColumnIfMissing2(db, "memories", "content_hash", "TEXT");
10771
10844
  addColumnIfMissing2(db, "memories", "normalized_content", "TEXT");
10772
10845
  addColumnIfMissing2(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -10884,7 +10957,7 @@ function addColumnIfMissing3(db, table, column, definition) {
10884
10957
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10885
10958
  return true;
10886
10959
  }
10887
- function up8(db) {
10960
+ function up9(db) {
10888
10961
  addColumnIfMissing3(db, "memories", "why", "TEXT");
10889
10962
  addColumnIfMissing3(db, "memories", "project", "TEXT");
10890
10963
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -10921,7 +10994,7 @@ function addColumnIfMissing4(db, table, column, definition) {
10921
10994
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10922
10995
  }
10923
10996
  }
10924
- function up9(db) {
10997
+ function up10(db) {
10925
10998
  addColumnIfMissing4(db, "memory_history", "actor_type", "TEXT");
10926
10999
  addColumnIfMissing4(db, "memory_history", "session_id", "TEXT");
10927
11000
  addColumnIfMissing4(db, "memory_history", "request_id", "TEXT");
@@ -10954,7 +11027,7 @@ function addColumnIfMissing5(db, table, column, definition) {
10954
11027
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
10955
11028
  }
10956
11029
  }
10957
- function up10(db) {
11030
+ function up11(db) {
10958
11031
  addColumnIfMissing5(db, "entities", "canonical_name", "TEXT");
10959
11032
  addColumnIfMissing5(db, "entities", "mentions", "INTEGER DEFAULT 0");
10960
11033
  addColumnIfMissing5(db, "entities", "embedding", "BLOB");
@@ -10971,7 +11044,7 @@ function hasColumn4(db, table, column) {
10971
11044
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
10972
11045
  return rows.some((r) => r.name === column);
10973
11046
  }
10974
- function up11(db) {
11047
+ function up12(db) {
10975
11048
  if (!hasColumn4(db, "memories", "idempotency_key")) {
10976
11049
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
10977
11050
  }
@@ -10986,7 +11059,7 @@ function hasColumn5(db, table, column) {
10986
11059
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
10987
11060
  return rows.some((r) => r.name === column);
10988
11061
  }
10989
- function up12(db) {
11062
+ function up13(db) {
10990
11063
  db.exec(`
10991
11064
  CREATE TABLE IF NOT EXISTS documents (
10992
11065
  id TEXT PRIMARY KEY,
@@ -11043,7 +11116,7 @@ function up12(db) {
11043
11116
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11044
11117
  }
11045
11118
  }
11046
- function up13(db) {
11119
+ function up14(db) {
11047
11120
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11048
11121
  if (tables.length === 0)
11049
11122
  return;
@@ -11060,7 +11133,7 @@ function up13(db) {
11060
11133
  ON embeddings(content_hash)
11061
11134
  `);
11062
11135
  }
11063
- function up14(db) {
11136
+ function up15(db) {
11064
11137
  db.exec(`
11065
11138
  CREATE TABLE IF NOT EXISTS summary_jobs (
11066
11139
  id TEXT PRIMARY KEY,
@@ -11080,7 +11153,7 @@ function up14(db) {
11080
11153
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11081
11154
  ON summary_jobs(status)`);
11082
11155
  }
11083
- function up15(db) {
11156
+ function up16(db) {
11084
11157
  db.exec(`
11085
11158
  CREATE TABLE IF NOT EXISTS umap_cache (
11086
11159
  id INTEGER PRIMARY KEY,
@@ -11091,7 +11164,7 @@ function up15(db) {
11091
11164
  )
11092
11165
  `);
11093
11166
  }
11094
- function up16(db) {
11167
+ function up17(db) {
11095
11168
  db.exec(`
11096
11169
  CREATE TABLE IF NOT EXISTS session_scores (
11097
11170
  id TEXT PRIMARY KEY,
@@ -11111,7 +11184,7 @@ function up16(db) {
11111
11184
  ON session_scores(session_key);
11112
11185
  `);
11113
11186
  }
11114
- function up17(db) {
11187
+ function up18(db) {
11115
11188
  db.exec(`
11116
11189
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11117
11190
  id TEXT PRIMARY KEY,
@@ -11152,7 +11225,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11152
11225
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11153
11226
  }
11154
11227
  }
11155
- function up18(db) {
11228
+ function up19(db) {
11156
11229
  db.exec(`
11157
11230
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11158
11231
  id TEXT PRIMARY KEY,
@@ -11178,7 +11251,7 @@ function up18(db) {
11178
11251
  addColumnIfMissing6(db, "memories", "source_path", "TEXT");
11179
11252
  addColumnIfMissing6(db, "memories", "source_section", "TEXT");
11180
11253
  }
11181
- function up19(db) {
11254
+ function up20(db) {
11182
11255
  db.exec(`
11183
11256
  CREATE TABLE IF NOT EXISTS telemetry_events (
11184
11257
  id TEXT PRIMARY KEY,
@@ -11203,7 +11276,7 @@ function addColumnIfMissing7(db, table, column, definition) {
11203
11276
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11204
11277
  }
11205
11278
  }
11206
- function up20(db) {
11279
+ function up21(db) {
11207
11280
  db.exec(`
11208
11281
  CREATE TABLE IF NOT EXISTS session_memories (
11209
11282
  id TEXT PRIMARY KEY,
@@ -11230,7 +11303,7 @@ function up20(db) {
11230
11303
  addColumnIfMissing7(db, "session_scores", "confidence", "REAL");
11231
11304
  addColumnIfMissing7(db, "session_scores", "continuity_reasoning", "TEXT");
11232
11305
  }
11233
- function up21(db) {
11306
+ function up22(db) {
11234
11307
  db.exec(`
11235
11308
  CREATE TABLE IF NOT EXISTS session_checkpoints (
11236
11309
  id TEXT PRIMARY KEY,
@@ -11252,7 +11325,7 @@ function up21(db) {
11252
11325
  ON session_checkpoints(project_normalized, created_at DESC);
11253
11326
  `);
11254
11327
  }
11255
- function up22(db) {
11328
+ function up23(db) {
11256
11329
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
11257
11330
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
11258
11331
  if (!colNames.has("skill_name")) {
@@ -11263,7 +11336,7 @@ function up22(db) {
11263
11336
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
11264
11337
  }
11265
11338
  }
11266
- function up23(db) {
11339
+ function up24(db) {
11267
11340
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
11268
11341
  if (existing)
11269
11342
  return;
@@ -11295,7 +11368,7 @@ function up23(db) {
11295
11368
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
11296
11369
  `);
11297
11370
  }
11298
- function up24(db) {
11371
+ function up25(db) {
11299
11372
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
11300
11373
  const entityColNames = new Set(entityCols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
11301
11374
  if (!entityColNames.has("agent_id")) {
@@ -11380,13 +11453,13 @@ function addColumnIfMissing8(db, table, column, definition) {
11380
11453
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11381
11454
  }
11382
11455
  }
11383
- function up25(db) {
11456
+ function up26(db) {
11384
11457
  addColumnIfMissing8(db, "session_memories", "entity_slot", "INTEGER");
11385
11458
  addColumnIfMissing8(db, "session_memories", "aspect_slot", "INTEGER");
11386
11459
  addColumnIfMissing8(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
11387
11460
  addColumnIfMissing8(db, "session_memories", "structural_density", "INTEGER");
11388
11461
  }
11389
- function up26(db) {
11462
+ function up27(db) {
11390
11463
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
11391
11464
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
11392
11465
  if (!columnNames.has("focal_entity_ids")) {
@@ -11411,25 +11484,25 @@ function addColumnIfMissing9(db, table, column, definition) {
11411
11484
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11412
11485
  }
11413
11486
  }
11414
- function up27(db) {
11487
+ function up28(db) {
11415
11488
  addColumnIfMissing9(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
11416
11489
  addColumnIfMissing9(db, "entities", "pinned_at", "TEXT");
11417
11490
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
11418
11491
  }
11419
- function up28(_db) {}
11420
11492
  function up29(_db) {}
11493
+ function up30(_db) {}
11421
11494
  function addColumnIfMissing10(db, table, column, definition) {
11422
11495
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
11423
11496
  if (!cols.some((c) => c.name === column)) {
11424
11497
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11425
11498
  }
11426
11499
  }
11427
- function up30(db) {
11500
+ function up31(db) {
11428
11501
  addColumnIfMissing10(db, "session_memories", "agent_relevance_score", "REAL");
11429
11502
  addColumnIfMissing10(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
11430
11503
  }
11431
- function up31(_db) {}
11432
- function up32(db) {
11504
+ function up32(_db) {}
11505
+ function up33(db) {
11433
11506
  db.exec(`
11434
11507
  UPDATE entities
11435
11508
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -11438,7 +11511,7 @@ function up32(db) {
11438
11511
  WHERE canonical_name IS NULL
11439
11512
  `);
11440
11513
  }
11441
- function up33(db) {
11514
+ function up34(db) {
11442
11515
  db.exec(`
11443
11516
  CREATE TABLE IF NOT EXISTS memories_cold (
11444
11517
  archive_id TEXT PRIMARY KEY,
@@ -11475,7 +11548,7 @@ function up33(db) {
11475
11548
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
11476
11549
  `);
11477
11550
  }
11478
- function up34(db) {
11551
+ function up35(db) {
11479
11552
  db.exec(`
11480
11553
  CREATE TABLE IF NOT EXISTS session_summaries (
11481
11554
  id TEXT PRIMARY KEY,
@@ -11520,7 +11593,7 @@ function up34(db) {
11520
11593
  WHERE session_key IS NOT NULL;
11521
11594
  `);
11522
11595
  }
11523
- function up35(db) {
11596
+ function up36(db) {
11524
11597
  db.exec(`
11525
11598
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
11526
11599
  id TEXT PRIMARY KEY,
@@ -11565,7 +11638,7 @@ function up35(db) {
11565
11638
  ON memory_jobs(failed_at);
11566
11639
  `);
11567
11640
  }
11568
- function up36(db) {
11641
+ function up37(db) {
11569
11642
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
11570
11643
  if (!depCols.some((c) => c.name === "reason")) {
11571
11644
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -11575,7 +11648,7 @@ function up36(db) {
11575
11648
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
11576
11649
  }
11577
11650
  }
11578
- function up37(db) {
11651
+ function up38(db) {
11579
11652
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
11580
11653
  if (cols.length === 0)
11581
11654
  return;
@@ -11583,14 +11656,14 @@ function up37(db) {
11583
11656
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
11584
11657
  }
11585
11658
  }
11586
- function up38(db) {
11659
+ function up39(db) {
11587
11660
  const cols = db.prepare("PRAGMA table_info(memories)").all();
11588
11661
  if (!cols.some((c) => c.name === "scope")) {
11589
11662
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
11590
11663
  }
11591
11664
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
11592
11665
  }
11593
- function up39(db) {
11666
+ function up40(db) {
11594
11667
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
11595
11668
  db.exec(`
11596
11669
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -11598,7 +11671,7 @@ function up39(db) {
11598
11671
  WHERE content_hash IS NOT NULL AND is_deleted = 0
11599
11672
  `);
11600
11673
  }
11601
- function up40(db) {
11674
+ function up41(db) {
11602
11675
  db.exec(`
11603
11676
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
11604
11677
  name, canonical_name,
@@ -11630,13 +11703,13 @@ function up40(db) {
11630
11703
  END
11631
11704
  `);
11632
11705
  }
11633
- function up41(db) {
11706
+ function up42(db) {
11634
11707
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
11635
11708
  if (!cols.some((c) => c.name === "confidence")) {
11636
11709
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
11637
11710
  }
11638
11711
  }
11639
- function up42(db) {
11712
+ function up43(db) {
11640
11713
  db.exec(`
11641
11714
  CREATE TABLE IF NOT EXISTS entity_communities (
11642
11715
  id TEXT PRIMARY KEY,
@@ -11654,7 +11727,7 @@ function up42(db) {
11654
11727
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
11655
11728
  }
11656
11729
  }
11657
- function up43(db) {
11730
+ function up44(db) {
11658
11731
  db.exec(`
11659
11732
  CREATE TABLE IF NOT EXISTS memory_hints (
11660
11733
  id TEXT PRIMARY KEY,
@@ -11694,7 +11767,7 @@ function up43(db) {
11694
11767
  END
11695
11768
  `);
11696
11769
  }
11697
- function up44(db) {
11770
+ function up45(db) {
11698
11771
  db.exec(`
11699
11772
  DELETE FROM entity_dependencies
11700
11773
  WHERE id NOT IN (
@@ -11712,7 +11785,7 @@ function up44(db) {
11712
11785
  )
11713
11786
  `);
11714
11787
  }
11715
- function up45(db) {
11788
+ function up46(db) {
11716
11789
  db.exec(`
11717
11790
  CREATE TABLE IF NOT EXISTS session_transcripts (
11718
11791
  session_key TEXT PRIMARY KEY,
@@ -11735,7 +11808,7 @@ function addColumnIfMissing11(db, table, column, definition) {
11735
11808
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11736
11809
  }
11737
11810
  }
11738
- function up46(db) {
11811
+ function up47(db) {
11739
11812
  addColumnIfMissing11(db, "session_memories", "path_json", "TEXT");
11740
11813
  db.exec(`
11741
11814
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -11810,7 +11883,7 @@ function addColumnIfMissing12(db, table, column, definition) {
11810
11883
  return;
11811
11884
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11812
11885
  }
11813
- function up47(db) {
11886
+ function up48(db) {
11814
11887
  addColumnIfMissing12(db, "session_memories", "entity_slot", "INTEGER");
11815
11888
  addColumnIfMissing12(db, "session_memories", "aspect_slot", "INTEGER");
11816
11889
  addColumnIfMissing12(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -11898,7 +11971,7 @@ function addColumnIfMissing13(db, table, column, definition) {
11898
11971
  return;
11899
11972
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11900
11973
  }
11901
- function up48(db) {
11974
+ function up49(db) {
11902
11975
  db.exec(`
11903
11976
  CREATE TABLE IF NOT EXISTS agents (
11904
11977
  id TEXT PRIMARY KEY,
@@ -11927,7 +12000,7 @@ function addColumnIfMissing14(db, table, column, definition) {
11927
12000
  return;
11928
12001
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11929
12002
  }
11930
- function up49(db) {
12003
+ function up50(db) {
11931
12004
  addColumnIfMissing14(db, "session_summaries", "source_type", "TEXT");
11932
12005
  addColumnIfMissing14(db, "session_summaries", "source_ref", "TEXT");
11933
12006
  addColumnIfMissing14(db, "session_summaries", "meta_json", "TEXT");
@@ -11953,7 +12026,7 @@ function addColumnIfMissing15(db, table, column, definition) {
11953
12026
  return;
11954
12027
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11955
12028
  }
11956
- function up50(db) {
12029
+ function up51(db) {
11957
12030
  addColumnIfMissing15(db, "session_transcripts", "updated_at", "TEXT");
11958
12031
  addColumnIfMissing15(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
11959
12032
  addColumnIfMissing15(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -12024,7 +12097,7 @@ function up50(db) {
12024
12097
  ON memory_md_heads(lease_expires_at);
12025
12098
  `);
12026
12099
  }
12027
- function up51(db) {
12100
+ function up52(db) {
12028
12101
  db.exec(`
12029
12102
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12030
12103
 
@@ -12085,7 +12158,7 @@ function up51(db) {
12085
12158
  AND COALESCE(source_type, 'summary') = 'summary';
12086
12159
  `);
12087
12160
  }
12088
- function up52(db) {
12161
+ function up53(db) {
12089
12162
  db.exec(`
12090
12163
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12091
12164
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -12183,7 +12256,7 @@ function up52(db) {
12183
12256
  AND COALESCE(source_type, 'summary') = 'summary';
12184
12257
  `);
12185
12258
  }
12186
- function up53(db) {
12259
+ function up54(db) {
12187
12260
  db.exec(`
12188
12261
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
12189
12262
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -12301,7 +12374,7 @@ function up53(db) {
12301
12374
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
12302
12375
  `);
12303
12376
  }
12304
- function up54(db) {
12377
+ function up55(db) {
12305
12378
  db.exec(`
12306
12379
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
12307
12380
  session_key TEXT NOT NULL,
@@ -12318,7 +12391,7 @@ function hasTable(db, name) {
12318
12391
  WHERE type = 'table' AND name = ?
12319
12392
  LIMIT 1`).get(name) !== undefined;
12320
12393
  }
12321
- function up55(db) {
12394
+ function up56(db) {
12322
12395
  db.exec(`
12323
12396
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
12324
12397
  id TEXT PRIMARY KEY,
@@ -12488,7 +12561,7 @@ function addColumnIfMissing16(db, table, column, definition) {
12488
12561
  return;
12489
12562
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12490
12563
  }
12491
- function up56(db) {
12564
+ function up57(db) {
12492
12565
  addColumnIfMissing16(db, "summary_jobs", "session_id", "TEXT");
12493
12566
  addColumnIfMissing16(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
12494
12567
  addColumnIfMissing16(db, "summary_jobs", "captured_at", "TEXT");
@@ -12580,8 +12653,8 @@ function up56(db) {
12580
12653
  VALUES ('rebuild');
12581
12654
  `);
12582
12655
  }
12583
- function up57(_db) {}
12584
- function up58(db) {
12656
+ function up58(_db) {}
12657
+ function up59(db) {
12585
12658
  db.exec(`
12586
12659
  CREATE TABLE IF NOT EXISTS skill_invocations (
12587
12660
  id TEXT PRIMARY KEY,
@@ -12597,7 +12670,7 @@ function up58(db) {
12597
12670
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
12598
12671
  `);
12599
12672
  }
12600
- function up59(db) {
12673
+ function up60(db) {
12601
12674
  db.exec(`
12602
12675
  CREATE TABLE IF NOT EXISTS task_scope_hints (
12603
12676
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -12628,7 +12701,7 @@ function up59(db) {
12628
12701
  ON task_scope_hints(agent_id, updated_at);
12629
12702
  `);
12630
12703
  }
12631
- function up60(db) {
12704
+ function up61(db) {
12632
12705
  db.exec(`
12633
12706
  CREATE TABLE IF NOT EXISTS dreaming_state (
12634
12707
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -12671,7 +12744,7 @@ function ensureMemoriesScopeColumns(db) {
12671
12744
  if (!names.has("scope"))
12672
12745
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
12673
12746
  }
12674
- function up61(db) {
12747
+ function up62(db) {
12675
12748
  ensureMemoriesScopeColumns(db);
12676
12749
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12677
12750
  db.exec(`
@@ -12684,20 +12757,20 @@ function up61(db) {
12684
12757
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12685
12758
  `);
12686
12759
  }
12687
- function up62(db) {
12760
+ function up63(db) {
12688
12761
  const sql = readMemoriesFtsSql(db);
12689
12762
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
12690
12763
  return;
12691
12764
  recreateMemoriesFts(db);
12692
12765
  }
12693
- function up63(db) {
12766
+ function up64(db) {
12694
12767
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
12695
12768
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
12696
12769
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
12697
12770
  ON entities(entity_type, mentions)
12698
12771
  WHERE entity_type = 'extracted'`);
12699
12772
  }
12700
- function up64(db) {
12773
+ function up65(db) {
12701
12774
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
12702
12775
  if (!cols.some((col) => col.name === "claim_key")) {
12703
12776
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -12706,7 +12779,7 @@ function up64(db) {
12706
12779
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
12707
12780
  WHERE claim_key IS NOT NULL`);
12708
12781
  }
12709
- function up65(db) {
12782
+ function up66(db) {
12710
12783
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
12711
12784
  if (!cols.some((col) => col.name === "group_key")) {
12712
12785
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -12718,13 +12791,13 @@ function up65(db) {
12718
12791
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
12719
12792
  WHERE claim_key IS NOT NULL`);
12720
12793
  }
12721
- function up66(db) {
12794
+ function up67(db) {
12722
12795
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
12723
12796
  if (cols.some((col) => col.name === "source_mtime_ms"))
12724
12797
  return;
12725
12798
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
12726
12799
  }
12727
- function up67(db) {
12800
+ function up68(db) {
12728
12801
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
12729
12802
  const names = new Set(cols.map((col) => col.name));
12730
12803
  if (!names.has("is_deleted")) {
@@ -12738,7 +12811,7 @@ function up67(db) {
12738
12811
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
12739
12812
  `);
12740
12813
  }
12741
- function up68(db) {
12814
+ function up69(db) {
12742
12815
  db.exec("DROP TRIGGER IF EXISTS memories_au");
12743
12816
  db.exec(`
12744
12817
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -12756,7 +12829,7 @@ function addColumnIfMissing17(db, table, column, definition) {
12756
12829
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12757
12830
  }
12758
12831
  }
12759
- function up69(db) {
12832
+ function up70(db) {
12760
12833
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
12761
12834
  addColumnIfMissing17(db, table, "source_id", "TEXT");
12762
12835
  addColumnIfMissing17(db, table, "source_kind", "TEXT");
@@ -12776,7 +12849,7 @@ function hasColumn7(db, table, column) {
12776
12849
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
12777
12850
  return rows.some((row) => row.name === column);
12778
12851
  }
12779
- function up70(db) {
12852
+ function up71(db) {
12780
12853
  if (!hasTable2(db, "embeddings"))
12781
12854
  return;
12782
12855
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -12784,7 +12857,7 @@ function up70(db) {
12784
12857
  }
12785
12858
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
12786
12859
  }
12787
- function up71(db) {
12860
+ function up72(db) {
12788
12861
  db.exec(`
12789
12862
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
12790
12863
  id TEXT PRIMARY KEY,
@@ -12825,7 +12898,7 @@ function addColumnIfMissing18(db, table, column, definition) {
12825
12898
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12826
12899
  }
12827
12900
  }
12828
- function up72(db) {
12901
+ function up73(db) {
12829
12902
  db.exec(`
12830
12903
  CREATE TABLE IF NOT EXISTS ontology_proposals (
12831
12904
  id TEXT PRIMARY KEY,
@@ -12868,7 +12941,7 @@ function up72(db) {
12868
12941
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
12869
12942
  }
12870
12943
  }
12871
- function up73(db) {
12944
+ function up74(db) {
12872
12945
  db.exec(`
12873
12946
  CREATE TABLE IF NOT EXISTS daily_reflections (
12874
12947
  id TEXT PRIMARY KEY,
@@ -12895,7 +12968,7 @@ function up73(db) {
12895
12968
  WHERE content_key IS NOT NULL;
12896
12969
  `);
12897
12970
  }
12898
- function up74(db) {
12971
+ function up75(db) {
12899
12972
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
12900
12973
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
12901
12974
  if (!colNames.has("content_key")) {
@@ -12932,7 +13005,7 @@ function backfillVersionRoots(db) {
12932
13005
  WHERE version_root_id IS NULL
12933
13006
  `);
12934
13007
  }
12935
- function up75(db) {
13008
+ function up76(db) {
12936
13009
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
12937
13010
  addColumnIfMissing19(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
12938
13011
  addColumnIfMissing19(db, table, "archived_at", "TEXT");
@@ -12967,7 +13040,7 @@ function up75(db) {
12967
13040
  ON entity_aspects(agent_id, proposal_id);
12968
13041
  `);
12969
13042
  }
12970
- function up76(db) {
13043
+ function up77(db) {
12971
13044
  db.exec(`
12972
13045
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
12973
13046
  id TEXT PRIMARY KEY,
@@ -13023,7 +13096,7 @@ function ensureMemoriesScopeColumns2(db) {
13023
13096
  if (!names.has("runtime_path"))
13024
13097
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13025
13098
  }
13026
- function up77(db) {
13099
+ function up78(db) {
13027
13100
  ensureMemoriesScopeColumns2(db);
13028
13101
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13029
13102
  db.exec(`
@@ -13037,7 +13110,7 @@ function up77(db) {
13037
13110
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
13038
13111
  `);
13039
13112
  }
13040
- function up78(db) {
13113
+ function up79(db) {
13041
13114
  db.exec(`
13042
13115
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13043
13116
  session_key TEXT NOT NULL,
@@ -13072,7 +13145,7 @@ function up78(db) {
13072
13145
  ON session_recall_events(item_kind, item_id, created_at DESC);
13073
13146
  `);
13074
13147
  }
13075
- function up79(db) {
13148
+ function up80(db) {
13076
13149
  db.exec(`
13077
13150
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13078
13151
  aggregate_memory_id TEXT NOT NULL,
@@ -13091,7 +13164,7 @@ function addColumnIfMissing20(db, table, column, definition) {
13091
13164
  return;
13092
13165
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13093
13166
  }
13094
- function up80(db) {
13167
+ function up81(db) {
13095
13168
  addColumnIfMissing20(db, "memory_artifacts", "source_id", "TEXT");
13096
13169
  addColumnIfMissing20(db, "memory_artifacts", "source_root", "TEXT");
13097
13170
  addColumnIfMissing20(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -13104,7 +13177,7 @@ function up80(db) {
13104
13177
  ON memory_artifacts(agent_id, source_id, source_root);
13105
13178
  `);
13106
13179
  }
13107
- function up81(db) {
13180
+ function up82(db) {
13108
13181
  db.exec(`
13109
13182
  CREATE TABLE IF NOT EXISTS temporal_edges (
13110
13183
  id TEXT PRIMARY KEY,
@@ -13127,7 +13200,7 @@ function up81(db) {
13127
13200
  ON temporal_edges(agent_id, subject_type, subject_id);
13128
13201
  `);
13129
13202
  }
13130
- function up82(db) {
13203
+ function up83(db) {
13131
13204
  db.exec(`
13132
13205
  CREATE TABLE IF NOT EXISTS entity_aliases (
13133
13206
  id TEXT PRIMARY KEY,
@@ -13151,7 +13224,7 @@ function up82(db) {
13151
13224
  ON entity_aliases(agent_id, canonical_alias, status);
13152
13225
  `);
13153
13226
  }
13154
- function up83(db) {
13227
+ function up84(db) {
13155
13228
  db.exec(`
13156
13229
  CREATE TABLE IF NOT EXISTS api_keys (
13157
13230
  id TEXT PRIMARY KEY,
@@ -13179,7 +13252,7 @@ function up83(db) {
13179
13252
  ON api_keys(connector, harness);
13180
13253
  `);
13181
13254
  }
13182
- function up84(db) {
13255
+ function up85(db) {
13183
13256
  db.exec(`
13184
13257
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
13185
13258
  id TEXT PRIMARY KEY,
@@ -13214,7 +13287,7 @@ function hasColumn10(db, table, column) {
13214
13287
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13215
13288
  return rows.some((row) => row.name === column);
13216
13289
  }
13217
- function up85(db) {
13290
+ function up86(db) {
13218
13291
  if (!hasColumn10(db, "documents", "agent_id")) {
13219
13292
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
13220
13293
  }
@@ -13300,7 +13373,7 @@ function up85(db) {
13300
13373
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
13301
13374
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
13302
13375
  }
13303
- function up86(db) {
13376
+ function up87(db) {
13304
13377
  db.exec(`
13305
13378
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
13306
13379
  aggregate_memory_id TEXT NOT NULL,
@@ -13322,7 +13395,7 @@ function hasColumn11(db, table, column) {
13322
13395
  return rows.some((row) => row.name === column);
13323
13396
  }
13324
13397
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
13325
- function up87(db) {
13398
+ function up88(db) {
13326
13399
  for (const column of COLUMNS) {
13327
13400
  if (!hasColumn11(db, "skill_invocations", column)) {
13328
13401
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -13403,7 +13476,7 @@ function documentScopeColumnsPreservingExisting(db) {
13403
13476
  `);
13404
13477
  }
13405
13478
  try {
13406
- up85(db);
13479
+ up86(db);
13407
13480
  if (preserveAgentId) {
13408
13481
  db.exec(`
13409
13482
  UPDATE documents
@@ -13423,12 +13496,12 @@ function documentScopeColumnsPreservingExisting(db) {
13423
13496
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
13424
13497
  }
13425
13498
  }
13426
- function up88(db) {
13427
- up84(db);
13499
+ function up89(db) {
13500
+ up85(db);
13428
13501
  if (hasTable3(db, "documents")) {
13429
13502
  documentScopeColumnsPreservingExisting(db);
13430
13503
  }
13431
- up86(db);
13504
+ up87(db);
13432
13505
  addColumnIfMissing21(db, "memories", "superseded_by", "TEXT");
13433
13506
  addColumnIfMissing21(db, "memories", "superseded_at", "TEXT");
13434
13507
  addColumnIfMissing21(db, "memories", "superseded_reason", "TEXT");
@@ -13485,7 +13558,7 @@ function up88(db) {
13485
13558
  AND ${sourceAgentId} = ${targetAgentId}
13486
13559
  `);
13487
13560
  }
13488
- function up89(db) {
13561
+ function up90(db) {
13489
13562
  db.exec(`
13490
13563
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
13491
13564
  path TEXT PRIMARY KEY,
@@ -13515,7 +13588,7 @@ function up89(db) {
13515
13588
  ON legacy_markdown_chunks(memory_id);
13516
13589
  `);
13517
13590
  }
13518
- function up90(db) {
13591
+ function up91(db) {
13519
13592
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
13520
13593
  const tableNames = new Set(tables.map((r) => String(r.name)));
13521
13594
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -13574,7 +13647,7 @@ function addColumnIfMissing22(db, table, column, definition) {
13574
13647
  return;
13575
13648
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13576
13649
  }
13577
- function up91(db) {
13650
+ function up92(db) {
13578
13651
  addColumnIfMissing22(db, "summary_jobs", "content_hash", "TEXT");
13579
13652
  db.exec(`
13580
13653
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -13587,14 +13660,14 @@ function addColumnIfMissing23(db, table, column, definition) {
13587
13660
  return;
13588
13661
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13589
13662
  }
13590
- function up92(db) {
13663
+ function up93(db) {
13591
13664
  addColumnIfMissing23(db, "summary_jobs", "boundary_reason", "TEXT");
13592
13665
  db.exec(`
13593
13666
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
13594
13667
  ON summary_jobs(agent_id, session_key, boundary_reason)
13595
13668
  `);
13596
13669
  }
13597
- function up93(db) {
13670
+ function up94(db) {
13598
13671
  db.exec(`
13599
13672
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
13600
13673
  agent_id TEXT NOT NULL,
@@ -13612,7 +13685,7 @@ function up93(db) {
13612
13685
  ON transcript_capture_jobs(agent_id, session_id, status);
13613
13686
  `);
13614
13687
  }
13615
- function up94(db) {
13688
+ function up95(db) {
13616
13689
  db.exec(`
13617
13690
  CREATE TABLE IF NOT EXISTS job_cancellations (
13618
13691
  id TEXT PRIMARY KEY,
@@ -13640,7 +13713,7 @@ function indexExists(db, table, indexName) {
13640
13713
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
13641
13714
  return rows.some((row) => row.name === indexName);
13642
13715
  }
13643
- function up95(db) {
13716
+ function up96(db) {
13644
13717
  db.exec(`
13645
13718
  CREATE TABLE IF NOT EXISTS job_archive (
13646
13719
  id TEXT PRIMARY KEY,
@@ -13667,7 +13740,7 @@ function indexExists2(db, table, indexName) {
13667
13740
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
13668
13741
  return rows.some((row) => row.name === indexName);
13669
13742
  }
13670
- function up96(db) {
13743
+ function up97(db) {
13671
13744
  db.exec(`
13672
13745
  CREATE TABLE IF NOT EXISTS embedding_index_state (
13673
13746
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -13680,7 +13753,7 @@ function up96(db) {
13680
13753
  )
13681
13754
  `);
13682
13755
  }
13683
- function up97(db) {
13756
+ function up98(db) {
13684
13757
  db.exec(`
13685
13758
  CREATE TABLE IF NOT EXISTS embeddings_staging (
13686
13759
  id TEXT PRIMARY KEY,
@@ -13699,7 +13772,7 @@ function up97(db) {
13699
13772
  ON embeddings_staging(agent_id, source_type, source_id);
13700
13773
  `);
13701
13774
  }
13702
- function up98(db) {
13775
+ function up99(db) {
13703
13776
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
13704
13777
  if (!columns.some((column) => column.name === "evidence_cursor")) {
13705
13778
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -13710,7 +13783,7 @@ function hasColumn13(db, table, column) {
13710
13783
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13711
13784
  return rows.some((r) => r.name === column);
13712
13785
  }
13713
- function up99(db) {
13786
+ function up100(db) {
13714
13787
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
13715
13788
  if (tables.length === 0)
13716
13789
  return;
@@ -13735,23 +13808,23 @@ function up99(db) {
13735
13808
  function hasColumn14(db, table, column) {
13736
13809
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13737
13810
  }
13738
- function up100(db) {
13811
+ function up101(db) {
13739
13812
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
13740
13813
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
13741
13814
  return;
13742
13815
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
13743
13816
  }
13744
- function up101(db) {
13817
+ function up102(db) {
13745
13818
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
13746
13819
  }
13747
- function up102(db) {
13820
+ function up103(db) {
13748
13821
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
13749
13822
  if (!columns.some((column) => column.name === "last_failure_at")) {
13750
13823
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
13751
13824
  }
13752
13825
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
13753
13826
  }
13754
- function up103(db) {
13827
+ function up104(db) {
13755
13828
  db.exec(`
13756
13829
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
13757
13830
  agent_id TEXT NOT NULL,
@@ -13768,7 +13841,7 @@ function up103(db) {
13768
13841
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
13769
13842
  `);
13770
13843
  }
13771
- function up104(db) {
13844
+ function up105(db) {
13772
13845
  db.exec(`
13773
13846
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
13774
13847
  id TEXT PRIMARY KEY,
@@ -13788,7 +13861,7 @@ function up104(db) {
13788
13861
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
13789
13862
  `);
13790
13863
  }
13791
- function up105(db) {
13864
+ function up106(db) {
13792
13865
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
13793
13866
  if (!columns.some((column) => column.name === "evidence_window_json")) {
13794
13867
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -13797,7 +13870,7 @@ function up105(db) {
13797
13870
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
13798
13871
  }
13799
13872
  }
13800
- function up106(db) {
13873
+ function up107(db) {
13801
13874
  db.exec(`
13802
13875
  CREATE TABLE IF NOT EXISTS dreaming_attention (
13803
13876
  id TEXT PRIMARY KEY,
@@ -13819,7 +13892,7 @@ function up106(db) {
13819
13892
  function hasColumn15(db, table, column) {
13820
13893
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13821
13894
  }
13822
- function up107(db) {
13895
+ function up108(db) {
13823
13896
  const requiredMemoryColumns = [
13824
13897
  "content_hash",
13825
13898
  "normalized_content",
@@ -13870,7 +13943,7 @@ function up107(db) {
13870
13943
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
13871
13944
  `);
13872
13945
  }
13873
- function up108(db) {
13946
+ function up109(db) {
13874
13947
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
13875
13948
  if (tables.length !== 2)
13876
13949
  return;
@@ -13893,7 +13966,7 @@ function tableExists(db, table) {
13893
13966
  function hasColumn16(db, table, column) {
13894
13967
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
13895
13968
  }
13896
- function up109(db) {
13969
+ function up110(db) {
13897
13970
  db.exec(`
13898
13971
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
13899
13972
  derived_memory_id TEXT NOT NULL,
@@ -13936,7 +14009,7 @@ function up109(db) {
13936
14009
  `);
13937
14010
  }
13938
14011
  }
13939
- function up110(db) {
14012
+ function up111(db) {
13940
14013
  db.exec(`
13941
14014
  DROP TRIGGER IF EXISTS entities_fts_ai;
13942
14015
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -14025,7 +14098,7 @@ function up110(db) {
14025
14098
  function hasColumn17(db, table, column) {
14026
14099
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14027
14100
  }
14028
- function up111(db) {
14101
+ function up112(db) {
14029
14102
  if (!hasColumn17(db, "memories", "review_after")) {
14030
14103
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
14031
14104
  }
@@ -14041,14 +14114,14 @@ var TOKEN_COLUMNS = [
14041
14114
  ["tokens_cache_write", "INTEGER"],
14042
14115
  ["tokens_cost", "REAL"]
14043
14116
  ];
14044
- function up112(db) {
14117
+ function up113(db) {
14045
14118
  for (const [column, type] of TOKEN_COLUMNS) {
14046
14119
  if (!hasColumn18(db, "dreaming_passes", column)) {
14047
14120
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14048
14121
  }
14049
14122
  }
14050
14123
  }
14051
- function up113(db) {
14124
+ function up114(db) {
14052
14125
  db.exec(`
14053
14126
  CREATE TABLE IF NOT EXISTS embedding_usage (
14054
14127
  day TEXT NOT NULL,
@@ -14061,7 +14134,7 @@ function up113(db) {
14061
14134
  );
14062
14135
  `);
14063
14136
  }
14064
- function up114(db) {
14137
+ function up115(db) {
14065
14138
  db.exec(`
14066
14139
  CREATE TABLE IF NOT EXISTS telemetry_install (
14067
14140
  id TEXT PRIMARY KEY,
@@ -14069,7 +14142,7 @@ function up114(db) {
14069
14142
  );
14070
14143
  `);
14071
14144
  }
14072
- function up115(db) {
14145
+ function up116(db) {
14073
14146
  db.exec(`
14074
14147
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14075
14148
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14080,7 +14153,7 @@ function hasColumn19(db, table, column) {
14080
14153
  return rows.some((row) => row.name === column);
14081
14154
  }
14082
14155
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14083
- function up116(db) {
14156
+ function up117(db) {
14084
14157
  for (const column of COLUMNS2) {
14085
14158
  if (!hasColumn19(db, "telemetry_install", column)) {
14086
14159
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14096,7 +14169,7 @@ function addColumnIfMissing24(db, column, definition) {
14096
14169
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14097
14170
  }
14098
14171
  }
14099
- function up117(db) {
14172
+ function up118(db) {
14100
14173
  addColumnIfMissing24(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14101
14174
  addColumnIfMissing24(db, "claim_token", "TEXT");
14102
14175
  addColumnIfMissing24(db, "claimed_at", "TEXT");
@@ -14105,7 +14178,7 @@ function up117(db) {
14105
14178
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14106
14179
  `);
14107
14180
  }
14108
- function up118(db) {
14181
+ function up119(db) {
14109
14182
  db.exec(`
14110
14183
  CREATE TABLE IF NOT EXISTS session_claims (
14111
14184
  session_key TEXT NOT NULL,
@@ -14126,7 +14199,7 @@ function up118(db) {
14126
14199
  ON session_claims(agent_id, state, expires_at);
14127
14200
  `);
14128
14201
  }
14129
- function up119(db) {
14202
+ function up120(db) {
14130
14203
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
14131
14204
  if (table == null)
14132
14205
  return;
@@ -14135,7 +14208,7 @@ function up119(db) {
14135
14208
  ON entity_attributes(memory_id, agent_id, status, importance);
14136
14209
  `);
14137
14210
  }
14138
- function up120(db) {
14211
+ function up121(db) {
14139
14212
  db.exec(`
14140
14213
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
14141
14214
  id TEXT PRIMARY KEY,
@@ -14192,7 +14265,7 @@ function addColumnIfMissing25(db, column, definition) {
14192
14265
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
14193
14266
  }
14194
14267
  }
14195
- function up121(db) {
14268
+ function up122(db) {
14196
14269
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
14197
14270
  if (table == null)
14198
14271
  return;
@@ -14393,7 +14466,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
14393
14466
  insert.run(...values);
14394
14467
  }
14395
14468
  }
14396
- function up122(db) {
14469
+ function up123(db) {
14397
14470
  if (!hasTable4(db, "session_transcripts"))
14398
14471
  return;
14399
14472
  addColumnIfMissing26(db, "session_transcripts", "completed_at", "TEXT");
@@ -14446,7 +14519,7 @@ function up122(db) {
14446
14519
  ON session_transcripts(agent_id, content_hash);
14447
14520
  `);
14448
14521
  }
14449
- function up123(db) {
14522
+ function up124(db) {
14450
14523
  db.exec(`
14451
14524
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
14452
14525
  ON memory_jobs(status)
@@ -14465,12 +14538,12 @@ function up123(db) {
14465
14538
  function hasColumn22(db, table, column) {
14466
14539
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14467
14540
  }
14468
- function up124(db) {
14541
+ function up125(db) {
14469
14542
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
14470
14543
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
14471
14544
  }
14472
14545
  }
14473
- function up125(db) {
14546
+ function up126(db) {
14474
14547
  db.exec(`
14475
14548
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
14476
14549
  agent_id TEXT NOT NULL,
@@ -14499,7 +14572,7 @@ function addColumnIfMissing27(db, column, definition) {
14499
14572
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14500
14573
  }
14501
14574
  }
14502
- function up126(db) {
14575
+ function up127(db) {
14503
14576
  addColumnIfMissing27(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
14504
14577
  addColumnIfMissing27(db, "last_attempt_at", "TEXT");
14505
14578
  addColumnIfMissing27(db, "sent_at", "TEXT");
@@ -14520,7 +14593,7 @@ function up126(db) {
14520
14593
  VALUES (1, CURRENT_TIMESTAMP);
14521
14594
  `);
14522
14595
  }
14523
- function up127(db) {
14596
+ function up128(db) {
14524
14597
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
14525
14598
  const names = new Set(columns.map((column) => column.name));
14526
14599
  if (!names.has("failure_class")) {
@@ -14537,7 +14610,7 @@ function up127(db) {
14537
14610
  }
14538
14611
  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)");
14539
14612
  }
14540
- function up128(db) {
14613
+ function up129(db) {
14541
14614
  db.exec(`
14542
14615
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
14543
14616
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -14561,7 +14634,7 @@ function up128(db) {
14561
14634
  ON embedding_index_failures(source_type, source_id);
14562
14635
  `);
14563
14636
  }
14564
- function up129(db) {
14637
+ function up130(db) {
14565
14638
  db.exec(`
14566
14639
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
14567
14640
  id TEXT PRIMARY KEY,
@@ -14579,7 +14652,7 @@ function up129(db) {
14579
14652
  ON imported_source_lifecycle(agent_id, status, updated_at DESC);
14580
14653
  `);
14581
14654
  }
14582
- function up130(db) {
14655
+ function up131(db) {
14583
14656
  db.exec(`
14584
14657
  CREATE TABLE IF NOT EXISTS memory_content_safety (
14585
14658
  agent_id TEXT NOT NULL,
@@ -14599,7 +14672,7 @@ function up130(db) {
14599
14672
  ON memory_content_safety(agent_id, source_kind, context_eligible);
14600
14673
  `);
14601
14674
  }
14602
- function up131(db) {
14675
+ function up132(db) {
14603
14676
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
14604
14677
  if (!table)
14605
14678
  return;
@@ -14633,7 +14706,7 @@ function up131(db) {
14633
14706
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
14634
14707
  `);
14635
14708
  }
14636
- function up132(db) {
14709
+ function up133(db) {
14637
14710
  db.exec(`
14638
14711
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
14639
14712
  id TEXT PRIMARY KEY,
@@ -14689,7 +14762,7 @@ function up132(db) {
14689
14762
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
14690
14763
  `);
14691
14764
  }
14692
- function up133(db) {
14765
+ function up134(db) {
14693
14766
  db.exec(`
14694
14767
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
14695
14768
  ON memory_jobs(status, created_at)
@@ -14704,7 +14777,7 @@ function up133(db) {
14704
14777
  function tableExists2(db, table) {
14705
14778
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
14706
14779
  }
14707
- function up134(db) {
14780
+ function up135(db) {
14708
14781
  if (!tableExists2(db, "memory_jobs"))
14709
14782
  return;
14710
14783
  if (!tableExists2(db, "job_cancellations")) {
@@ -14753,7 +14826,7 @@ function up134(db) {
14753
14826
  AND status IN ('pending', 'leased');
14754
14827
  `);
14755
14828
  }
14756
- function up135(db) {
14829
+ function up136(db) {
14757
14830
  db.exec(`
14758
14831
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
14759
14832
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14793,7 +14866,7 @@ function up135(db) {
14793
14866
  END;
14794
14867
  `);
14795
14868
  }
14796
- function up136(db) {
14869
+ function up137(db) {
14797
14870
  db.exec(`
14798
14871
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
14799
14872
  agent_id TEXT NOT NULL,
@@ -14816,13 +14889,13 @@ function up136(db) {
14816
14889
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
14817
14890
  `);
14818
14891
  }
14819
- function up137(db) {
14892
+ function up138(db) {
14820
14893
  db.exec(`
14821
14894
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
14822
14895
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
14823
14896
  `);
14824
14897
  }
14825
- function up138(db) {
14898
+ function up139(db) {
14826
14899
  db.exec(`
14827
14900
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
14828
14901
  id TEXT PRIMARY KEY,
@@ -14874,7 +14947,7 @@ function up138(db) {
14874
14947
  if (!names.has("format_version"))
14875
14948
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
14876
14949
  }
14877
- function up139(db) {
14950
+ function up140(db) {
14878
14951
  db.exec(`
14879
14952
  CREATE TABLE memory_head_entries_v134 (
14880
14953
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -14892,7 +14965,7 @@ function up139(db) {
14892
14965
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
14893
14966
  `);
14894
14967
  }
14895
- function up140(db) {
14968
+ function up141(db) {
14896
14969
  db.exec(`
14897
14970
  CREATE TABLE IF NOT EXISTS memory_head_publications (
14898
14971
  agent_id TEXT NOT NULL,
@@ -14908,7 +14981,7 @@ function up140(db) {
14908
14981
  ON memory_head_publications(agent_id, status, revision DESC);
14909
14982
  `);
14910
14983
  }
14911
- function up141(db) {
14984
+ function up142(db) {
14912
14985
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r) => r.name));
14913
14986
  for (const [name, type] of [
14914
14987
  ["entry_id", "TEXT"],
@@ -14922,7 +14995,7 @@ function up141(db) {
14922
14995
  }
14923
14996
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
14924
14997
  }
14925
- function up142(db) {
14998
+ function up143(db) {
14926
14999
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r) => r.name));
14927
15000
  for (const [name, type] of [
14928
15001
  ["head_revision", "INTEGER"],
@@ -14944,7 +15017,7 @@ function addColumnIfMissing28(db, table, column, definition) {
14944
15017
  if (!hasColumn24(db, table, column))
14945
15018
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14946
15019
  }
14947
- function up143(db) {
15020
+ function up144(db) {
14948
15021
  addColumnIfMissing28(db, "memories", "manual_override", "INTEGER DEFAULT 0");
14949
15022
  db.exec(`
14950
15023
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -15249,7 +15322,7 @@ function up143(db) {
15249
15322
  GROUP BY j.agent_id;
15250
15323
  `);
15251
15324
  }
15252
- function up144(db) {
15325
+ function up145(db) {
15253
15326
  db.exec(`
15254
15327
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
15255
15328
  agent_id TEXT NOT NULL,
@@ -15265,7 +15338,7 @@ function up144(db) {
15265
15338
  ON native_source_sync_state(agent_id, status);
15266
15339
  `);
15267
15340
  }
15268
- function up145(db) {
15341
+ function up146(db) {
15269
15342
  db.exec(`
15270
15343
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
15271
15344
  agent_id TEXT NOT NULL,
@@ -15277,7 +15350,7 @@ function up145(db) {
15277
15350
  );
15278
15351
  `);
15279
15352
  }
15280
- function up146(db) {
15353
+ function up147(db) {
15281
15354
  db.exec(`
15282
15355
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
15283
15356
  agent_id TEXT NOT NULL,
@@ -15291,13 +15364,13 @@ function up146(db) {
15291
15364
  );
15292
15365
  `);
15293
15366
  }
15294
- function up147(db) {
15367
+ function up148(db) {
15295
15368
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
15296
15369
  if (!columns.some((column) => column.name === "frontier")) {
15297
15370
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
15298
15371
  }
15299
15372
  }
15300
- function up148(db) {
15373
+ function up149(db) {
15301
15374
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
15302
15375
  const additions = [
15303
15376
  ["migration_phase", "TEXT"],
@@ -15332,13 +15405,13 @@ function up148(db) {
15332
15405
  `);
15333
15406
  }
15334
15407
  }
15335
- function up149(db) {
15408
+ function up150(db) {
15336
15409
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
15337
15410
  if (!columns.has("lease_token")) {
15338
15411
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
15339
15412
  }
15340
15413
  }
15341
- function up150(db) {
15414
+ function up151(db) {
15342
15415
  db.exec(`
15343
15416
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
15344
15417
  agent_id TEXT NOT NULL,
@@ -15356,7 +15429,7 @@ function up150(db) {
15356
15429
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
15357
15430
  `);
15358
15431
  }
15359
- function up151(db) {
15432
+ function up152(db) {
15360
15433
  db.exec(`
15361
15434
  CREATE TABLE IF NOT EXISTS source_import_jobs (
15362
15435
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -15423,16 +15496,16 @@ function up151(db) {
15423
15496
  }
15424
15497
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
15425
15498
  }
15426
- function up152(db) {
15499
+ function up153(db) {
15427
15500
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
15428
15501
  }
15429
- function up153(db) {
15502
+ function up154(db) {
15430
15503
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
15431
15504
  if (!columns.some((column) => column.name === "source_id")) {
15432
15505
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
15433
15506
  }
15434
15507
  }
15435
- function up154(db) {
15508
+ function up155(db) {
15436
15509
  const addColumn = (table, column, definition) => {
15437
15510
  const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
15438
15511
  let exists;
@@ -15453,7 +15526,7 @@ function addColumnIfMissing29(db, table, column, definition) {
15453
15526
  if (!columns.some((row) => row.name === column))
15454
15527
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15455
15528
  }
15456
- function up155(db) {
15529
+ function up156(db) {
15457
15530
  addColumnIfMissing29(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
15458
15531
  addColumnIfMissing29(db, "dreaming_passes", "head_base_revision", "INTEGER");
15459
15532
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -15603,7 +15676,7 @@ function up155(db) {
15603
15676
  `);
15604
15677
  }
15605
15678
  }
15606
- function up156(db) {
15679
+ function up157(db) {
15607
15680
  db.exec(`
15608
15681
  CREATE TABLE IF NOT EXISTS vector_repair_checkpoints (
15609
15682
  operation TEXT NOT NULL CHECK (operation IN ('resync', 'clean-orphans')),
@@ -15628,7 +15701,7 @@ function up156(db) {
15628
15701
  ON vector_repair_checkpoints(status, updated_at);
15629
15702
  `);
15630
15703
  }
15631
- function up157(db) {
15704
+ function up158(db) {
15632
15705
  db.exec(`
15633
15706
  CREATE TABLE IF NOT EXISTS embedding_repair_checkpoints (
15634
15707
  checkpoint_id TEXT PRIMARY KEY,
@@ -15649,7 +15722,7 @@ function up157(db) {
15649
15722
  ON embedding_repair_checkpoints(status, updated_at);
15650
15723
  `);
15651
15724
  }
15652
- function up158(db) {
15725
+ function up159(db) {
15653
15726
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_repair_checkpoints)").all().map((row) => row.name));
15654
15727
  if (!columns.has("profile_fingerprint")) {
15655
15728
  db.exec("ALTER TABLE embedding_repair_checkpoints ADD COLUMN profile_fingerprint TEXT");
@@ -15664,7 +15737,7 @@ function up158(db) {
15664
15737
  );
15665
15738
  `);
15666
15739
  }
15667
- function up159(db) {
15740
+ function up160(db) {
15668
15741
  db.exec(`
15669
15742
  CREATE INDEX IF NOT EXISTS idx_memories_agent_kind
15670
15743
  ON memories(agent_id, memory_kind);
@@ -15731,7 +15804,7 @@ function rebuildLedgerWithoutGlobalKeyPrimaryKey(db) {
15731
15804
  throw error;
15732
15805
  }
15733
15806
  }
15734
- function up160(db) {
15807
+ function up161(db) {
15735
15808
  db.exec(`
15736
15809
  CREATE TABLE IF NOT EXISTS import_admission_ledger (
15737
15810
  key TEXT NOT NULL, agent_id TEXT NOT NULL, workspace_id TEXT NOT NULL DEFAULT '', file_name TEXT NOT NULL,
@@ -15766,13 +15839,13 @@ function up160(db) {
15766
15839
  CREATE INDEX IF NOT EXISTS idx_import_admission_events_key ON import_admission_events(admission_key, agent_id, workspace_id, id);
15767
15840
  `);
15768
15841
  }
15769
- function up161(db) {
15842
+ function up162(db) {
15770
15843
  db.exec(`
15771
15844
  CREATE INDEX IF NOT EXISTS idx_entities_agent_updated_id
15772
15845
  ON entities(agent_id, updated_at DESC, id DESC);
15773
15846
  `);
15774
15847
  }
15775
- function up162(db) {
15848
+ function up163(db) {
15776
15849
  db.exec(`
15777
15850
  CREATE TABLE IF NOT EXISTS generic_entity_prune_scan_state (
15778
15851
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15813,7 +15886,7 @@ function up162(db) {
15813
15886
  END;
15814
15887
  `);
15815
15888
  }
15816
- function up163(db) {
15889
+ function up164(db) {
15817
15890
  db.exec(`
15818
15891
  DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_ai;
15819
15892
  DROP TRIGGER IF EXISTS memory_content_safety_head_freshness_au;
@@ -15823,7 +15896,7 @@ function up163(db) {
15823
15896
  `);
15824
15897
  }
15825
15898
  var COLUMNS3 = ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"];
15826
- function up164(db) {
15899
+ function up165(db) {
15827
15900
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
15828
15901
  for (const column of COLUMNS3) {
15829
15902
  if (!cols.some((col) => col.name === column)) {
@@ -15831,7 +15904,7 @@ function up164(db) {
15831
15904
  }
15832
15905
  }
15833
15906
  }
15834
- function up165(db) {
15907
+ function up166(db) {
15835
15908
  const passColumns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
15836
15909
  if (!passColumns.some((column) => column.name === "scope_key")) {
15837
15910
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN scope_key TEXT");
@@ -15854,13 +15927,13 @@ function up165(db) {
15854
15927
  ON dreaming_history_nodes(pass_id) WHERE pass_id IS NOT NULL;
15855
15928
  `);
15856
15929
  }
15857
- function up166(db) {
15930
+ function up167(db) {
15858
15931
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
15859
15932
  if (!columns.some((column) => column.name === "tokens_peak_context")) {
15860
15933
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN tokens_peak_context INTEGER");
15861
15934
  }
15862
15935
  }
15863
- function up167(db) {
15936
+ function up168(db) {
15864
15937
  const sql = readMemoriesFtsSql(db);
15865
15938
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
15866
15939
  return;
@@ -15872,7 +15945,7 @@ function hasTable5(db, table) {
15872
15945
  function hasColumn25(db, table, column) {
15873
15946
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15874
15947
  }
15875
- function up168(db) {
15948
+ function up169(db) {
15876
15949
  if (!hasTable5(db, "entity_attributes") || !hasTable5(db, "entity_aspects") || !hasTable5(db, "entities") || !hasColumn25(db, "entity_attributes", "source_root") || !hasColumn25(db, "entities", "source_root")) {
15877
15950
  return;
15878
15951
  }
@@ -15945,7 +16018,7 @@ function up168(db) {
15945
16018
  DROP TABLE retired_source_paragraphs;
15946
16019
  `);
15947
16020
  }
15948
- function up169(db) {
16021
+ function up170(db) {
15949
16022
  if (db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_evidence_consumption'").get() == null)
15950
16023
  return;
15951
16024
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_consumption)").all();
@@ -15956,7 +16029,7 @@ function up169(db) {
15956
16029
  db.exec("ALTER TABLE dreaming_evidence_consumption ADD COLUMN stalled_passes INTEGER NOT NULL DEFAULT 0 CHECK (stalled_passes >= 0)");
15957
16030
  }
15958
16031
  }
15959
- function up170(db) {
16032
+ function up171(db) {
15960
16033
  db.exec(`
15961
16034
  CREATE TABLE IF NOT EXISTS dependency_history_compaction_state (
15962
16035
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15967,7 +16040,7 @@ function up170(db) {
15967
16040
  INSERT OR IGNORE INTO dependency_history_compaction_state (id) VALUES (1);
15968
16041
  `);
15969
16042
  }
15970
- function up171(db) {
16043
+ function up172(db) {
15971
16044
  db.exec(`
15972
16045
  CREATE TABLE IF NOT EXISTS cross_agent_message_wakes (
15973
16046
  message_id TEXT PRIMARY KEY,
@@ -16146,7 +16219,7 @@ function repairBoardNotices(db) {
16146
16219
  throw error;
16147
16220
  }
16148
16221
  }
16149
- function up172(db) {
16222
+ function up173(db) {
16150
16223
  db.exec(`
16151
16224
  CREATE TABLE IF NOT EXISTS dreaming_policies (
16152
16225
  hash TEXT PRIMARY KEY,
@@ -16160,7 +16233,7 @@ function up172(db) {
16160
16233
  if (!columns.has("policy_source"))
16161
16234
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN policy_source TEXT CHECK (policy_source IN ('default', 'custom'))");
16162
16235
  }
16163
- function up173(db) {
16236
+ function up174(db) {
16164
16237
  db.exec(`
16165
16238
  CREATE INDEX IF NOT EXISTS idx_memory_artifacts_native_paths
16166
16239
  ON memory_artifacts(agent_id, harness, source_kind, source_id, source_path, is_deleted)
@@ -16171,13 +16244,13 @@ var MIGRATIONS = [
16171
16244
  {
16172
16245
  version: 1,
16173
16246
  name: "baseline",
16174
- up: up6,
16247
+ up: up7,
16175
16248
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16176
16249
  },
16177
16250
  {
16178
16251
  version: 2,
16179
16252
  name: "pipeline-v2",
16180
- up: up7,
16253
+ up: up8,
16181
16254
  artifacts: {
16182
16255
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16183
16256
  }
@@ -16185,12 +16258,12 @@ var MIGRATIONS = [
16185
16258
  {
16186
16259
  version: 3,
16187
16260
  name: "unique-content-hash",
16188
- up: up8
16261
+ up: up9
16189
16262
  },
16190
16263
  {
16191
16264
  version: 4,
16192
16265
  name: "history-actor-and-retention",
16193
- up: up9,
16266
+ up: up10,
16194
16267
  artifacts: {
16195
16268
  columns: [{ table: "memory_history", column: "actor_type" }]
16196
16269
  }
@@ -16198,7 +16271,7 @@ var MIGRATIONS = [
16198
16271
  {
16199
16272
  version: 5,
16200
16273
  name: "graph-extended",
16201
- up: up10,
16274
+ up: up11,
16202
16275
  artifacts: {
16203
16276
  columns: [{ table: "entities", column: "canonical_name" }]
16204
16277
  }
@@ -16206,7 +16279,7 @@ var MIGRATIONS = [
16206
16279
  {
16207
16280
  version: 6,
16208
16281
  name: "idempotency-key",
16209
- up: up11,
16282
+ up: up12,
16210
16283
  artifacts: {
16211
16284
  columns: [{ table: "memories", column: "idempotency_key" }]
16212
16285
  }
@@ -16214,42 +16287,42 @@ var MIGRATIONS = [
16214
16287
  {
16215
16288
  version: 7,
16216
16289
  name: "documents-and-connectors",
16217
- up: up12,
16290
+ up: up13,
16218
16291
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16219
16292
  },
16220
16293
  {
16221
16294
  version: 8,
16222
16295
  name: "embeddings-unique-hash",
16223
- up: up13
16296
+ up: up14
16224
16297
  },
16225
16298
  {
16226
16299
  version: 9,
16227
16300
  name: "summary-jobs",
16228
- up: up14,
16301
+ up: up15,
16229
16302
  artifacts: { tables: ["summary_jobs"] }
16230
16303
  },
16231
16304
  {
16232
16305
  version: 10,
16233
16306
  name: "umap-cache",
16234
- up: up15,
16307
+ up: up16,
16235
16308
  artifacts: { tables: ["umap_cache"] }
16236
16309
  },
16237
16310
  {
16238
16311
  version: 11,
16239
16312
  name: "session-scores",
16240
- up: up16,
16313
+ up: up17,
16241
16314
  artifacts: { tables: ["session_scores"] }
16242
16315
  },
16243
16316
  {
16244
16317
  version: 12,
16245
16318
  name: "scheduled-tasks",
16246
- up: up17,
16319
+ up: up18,
16247
16320
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16248
16321
  },
16249
16322
  {
16250
16323
  version: 13,
16251
16324
  name: "ingestion-tracking",
16252
- up: up18,
16325
+ up: up19,
16253
16326
  artifacts: {
16254
16327
  columns: [
16255
16328
  { table: "memories", column: "source_path" },
@@ -16260,13 +16333,13 @@ var MIGRATIONS = [
16260
16333
  {
16261
16334
  version: 14,
16262
16335
  name: "telemetry",
16263
- up: up19,
16336
+ up: up20,
16264
16337
  artifacts: { tables: ["telemetry_events"] }
16265
16338
  },
16266
16339
  {
16267
16340
  version: 15,
16268
16341
  name: "session-memories",
16269
- up: up20,
16342
+ up: up21,
16270
16343
  artifacts: {
16271
16344
  tables: ["session_memories"],
16272
16345
  columns: [
@@ -16278,13 +16351,13 @@ var MIGRATIONS = [
16278
16351
  {
16279
16352
  version: 16,
16280
16353
  name: "session-checkpoints",
16281
- up: up21,
16354
+ up: up22,
16282
16355
  artifacts: { tables: ["session_checkpoints"] }
16283
16356
  },
16284
16357
  {
16285
16358
  version: 17,
16286
16359
  name: "task-skills",
16287
- up: up22,
16360
+ up: up23,
16288
16361
  artifacts: {
16289
16362
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16290
16363
  }
@@ -16292,13 +16365,13 @@ var MIGRATIONS = [
16292
16365
  {
16293
16366
  version: 18,
16294
16367
  name: "skill-meta",
16295
- up: up23,
16368
+ up: up24,
16296
16369
  artifacts: { tables: ["skill_meta"] }
16297
16370
  },
16298
16371
  {
16299
16372
  version: 19,
16300
16373
  name: "knowledge-structure",
16301
- up: up24,
16374
+ up: up25,
16302
16375
  artifacts: {
16303
16376
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16304
16377
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16307,7 +16380,7 @@ var MIGRATIONS = [
16307
16380
  {
16308
16381
  version: 20,
16309
16382
  name: "session-structural-columns",
16310
- up: up25,
16383
+ up: up26,
16311
16384
  artifacts: {
16312
16385
  columns: [
16313
16386
  { table: "session_memories", column: "entity_slot" },
@@ -16320,7 +16393,7 @@ var MIGRATIONS = [
16320
16393
  {
16321
16394
  version: 21,
16322
16395
  name: "checkpoint-structural",
16323
- up: up26,
16396
+ up: up27,
16324
16397
  artifacts: {
16325
16398
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16326
16399
  }
@@ -16328,7 +16401,7 @@ var MIGRATIONS = [
16328
16401
  {
16329
16402
  version: 22,
16330
16403
  name: "entity-pinning",
16331
- up: up27,
16404
+ up: up28,
16332
16405
  artifacts: {
16333
16406
  columns: [
16334
16407
  { table: "entities", column: "pinned" },
@@ -16339,17 +16412,17 @@ var MIGRATIONS = [
16339
16412
  {
16340
16413
  version: 23,
16341
16414
  name: "retired-scorer-gap",
16342
- up: up28
16415
+ up: up29
16343
16416
  },
16344
16417
  {
16345
16418
  version: 24,
16346
16419
  name: "retired-scorer-gap",
16347
- up: up29
16420
+ up: up30
16348
16421
  },
16349
16422
  {
16350
16423
  version: 25,
16351
16424
  name: "agent-feedback",
16352
- up: up30,
16425
+ up: up31,
16353
16426
  artifacts: {
16354
16427
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16355
16428
  }
@@ -16357,32 +16430,32 @@ var MIGRATIONS = [
16357
16430
  {
16358
16431
  version: 26,
16359
16432
  name: "retired-scorer-gap",
16360
- up: up31
16433
+ up: up32
16361
16434
  },
16362
16435
  {
16363
16436
  version: 27,
16364
16437
  name: "backfill-canonical-names",
16365
- up: up32
16438
+ up: up33
16366
16439
  },
16367
16440
  {
16368
16441
  version: 28,
16369
16442
  name: "lossless-retention",
16370
- up: up33
16443
+ up: up34
16371
16444
  },
16372
16445
  {
16373
16446
  version: 29,
16374
16447
  name: "session-summary-dag",
16375
- up: up34
16448
+ up: up35
16376
16449
  },
16377
16450
  {
16378
16451
  version: 30,
16379
16452
  name: "nullable-memory-job-memory-id",
16380
- up: up35
16453
+ up: up36
16381
16454
  },
16382
16455
  {
16383
16456
  version: 31,
16384
16457
  name: "dependency-reason",
16385
- up: up36,
16458
+ up: up37,
16386
16459
  artifacts: {
16387
16460
  columns: [
16388
16461
  { table: "entity_dependencies", column: "reason" },
@@ -16393,7 +16466,7 @@ var MIGRATIONS = [
16393
16466
  {
16394
16467
  version: 32,
16395
16468
  name: "embeddings-vector-column",
16396
- up: up37,
16469
+ up: up38,
16397
16470
  artifacts: {
16398
16471
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16399
16472
  }
@@ -16401,7 +16474,7 @@ var MIGRATIONS = [
16401
16474
  {
16402
16475
  version: 33,
16403
16476
  name: "scope",
16404
- up: up38,
16477
+ up: up39,
16405
16478
  artifacts: {
16406
16479
  columns: [{ table: "memories", column: "scope" }]
16407
16480
  }
@@ -16409,17 +16482,17 @@ var MIGRATIONS = [
16409
16482
  {
16410
16483
  version: 34,
16411
16484
  name: "scope-aware-dedup",
16412
- up: up39
16485
+ up: up40
16413
16486
  },
16414
16487
  {
16415
16488
  version: 35,
16416
16489
  name: "entity-fts",
16417
- up: up40
16490
+ up: up41
16418
16491
  },
16419
16492
  {
16420
16493
  version: 36,
16421
16494
  name: "dependency-confidence",
16422
- up: up41,
16495
+ up: up42,
16423
16496
  artifacts: {
16424
16497
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16425
16498
  }
@@ -16427,7 +16500,7 @@ var MIGRATIONS = [
16427
16500
  {
16428
16501
  version: 37,
16429
16502
  name: "entity-communities",
16430
- up: up42,
16503
+ up: up43,
16431
16504
  artifacts: {
16432
16505
  tables: ["entity_communities"],
16433
16506
  columns: [{ table: "entities", column: "community_id" }]
@@ -16436,24 +16509,24 @@ var MIGRATIONS = [
16436
16509
  {
16437
16510
  version: 38,
16438
16511
  name: "memory-hints",
16439
- up: up43,
16512
+ up: up44,
16440
16513
  artifacts: { tables: ["memory_hints"] }
16441
16514
  },
16442
16515
  {
16443
16516
  version: 39,
16444
16517
  name: "dedup-entity-dependencies",
16445
- up: up44
16518
+ up: up45
16446
16519
  },
16447
16520
  {
16448
16521
  version: 40,
16449
16522
  name: "session-transcripts",
16450
- up: up45,
16523
+ up: up46,
16451
16524
  artifacts: { tables: ["session_transcripts"] }
16452
16525
  },
16453
16526
  {
16454
16527
  version: 41,
16455
16528
  name: "path-feedback",
16456
- up: up46,
16529
+ up: up47,
16457
16530
  artifacts: {
16458
16531
  tables: [
16459
16532
  "path_feedback_events",
@@ -16468,7 +16541,7 @@ var MIGRATIONS = [
16468
16541
  {
16469
16542
  version: 42,
16470
16543
  name: "session-memories-agent-id",
16471
- up: up47,
16544
+ up: up48,
16472
16545
  artifacts: {
16473
16546
  columns: [{ table: "session_memories", column: "agent_id" }]
16474
16547
  }
@@ -16476,7 +16549,7 @@ var MIGRATIONS = [
16476
16549
  {
16477
16550
  version: 43,
16478
16551
  name: "agents-table",
16479
- up: up48,
16552
+ up: up49,
16480
16553
  artifacts: {
16481
16554
  tables: ["agents"],
16482
16555
  columns: [
@@ -16488,7 +16561,7 @@ var MIGRATIONS = [
16488
16561
  {
16489
16562
  version: 44,
16490
16563
  name: "memory-md-temporal-head",
16491
- up: up49,
16564
+ up: up50,
16492
16565
  artifacts: {
16493
16566
  columns: [
16494
16567
  { table: "session_summaries", column: "source_type" },
@@ -16500,7 +16573,7 @@ var MIGRATIONS = [
16500
16573
  {
16501
16574
  version: 45,
16502
16575
  name: "lossless-working-memory-hardening",
16503
- up: up50,
16576
+ up: up51,
16504
16577
  artifacts: {
16505
16578
  tables: ["session_transcripts_fts", "memory_md_heads"],
16506
16579
  columns: [
@@ -16513,17 +16586,17 @@ var MIGRATIONS = [
16513
16586
  {
16514
16587
  version: 46,
16515
16588
  name: "session-summary-uniqueness",
16516
- up: up51
16589
+ up: up52
16517
16590
  },
16518
16591
  {
16519
16592
  version: 47,
16520
16593
  name: "agent-scoped-temporal-uniqueness",
16521
- up: up52
16594
+ up: up53
16522
16595
  },
16523
16596
  {
16524
16597
  version: 48,
16525
16598
  name: "thread-heads",
16526
- up: up53,
16599
+ up: up54,
16527
16600
  artifacts: {
16528
16601
  tables: ["memory_thread_heads"]
16529
16602
  }
@@ -16531,7 +16604,7 @@ var MIGRATIONS = [
16531
16604
  {
16532
16605
  version: 49,
16533
16606
  name: "session-extract-cursors",
16534
- up: up54,
16607
+ up: up55,
16535
16608
  artifacts: {
16536
16609
  tables: ["session_extract_cursors"]
16537
16610
  }
@@ -16539,7 +16612,7 @@ var MIGRATIONS = [
16539
16612
  {
16540
16613
  version: 50,
16541
16614
  name: "related-to-audit",
16542
- up: up55,
16615
+ up: up56,
16543
16616
  artifacts: {
16544
16617
  tables: ["entity_dependency_history"]
16545
16618
  }
@@ -16547,7 +16620,7 @@ var MIGRATIONS = [
16547
16620
  {
16548
16621
  version: 51,
16549
16622
  name: "memory-md-rolling-window-lineage",
16550
- up: up56,
16623
+ up: up57,
16551
16624
  artifacts: {
16552
16625
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16553
16626
  columns: [
@@ -16562,12 +16635,12 @@ var MIGRATIONS = [
16562
16635
  {
16563
16636
  version: 52,
16564
16637
  name: "mcp-invocations",
16565
- up: up57
16638
+ up: up58
16566
16639
  },
16567
16640
  {
16568
16641
  version: 53,
16569
16642
  name: "skill-invocations",
16570
- up: up58,
16643
+ up: up59,
16571
16644
  artifacts: {
16572
16645
  tables: ["skill_invocations"]
16573
16646
  }
@@ -16575,7 +16648,7 @@ var MIGRATIONS = [
16575
16648
  {
16576
16649
  version: 54,
16577
16650
  name: "task-agent-scope",
16578
- up: up59,
16651
+ up: up60,
16579
16652
  artifacts: {
16580
16653
  tables: ["task_scope_hints"]
16581
16654
  }
@@ -16583,7 +16656,7 @@ var MIGRATIONS = [
16583
16656
  {
16584
16657
  version: 55,
16585
16658
  name: "dreaming-state",
16586
- up: up60,
16659
+ up: up61,
16587
16660
  artifacts: {
16588
16661
  tables: ["dreaming_state", "dreaming_passes"]
16589
16662
  }
@@ -16591,22 +16664,22 @@ var MIGRATIONS = [
16591
16664
  {
16592
16665
  version: 56,
16593
16666
  name: "agent-scoped-content-hash",
16594
- up: up61
16667
+ up: up62
16595
16668
  },
16596
16669
  {
16597
16670
  version: 57,
16598
16671
  name: "memories-fts-tokenizer-repair",
16599
- up: up62
16672
+ up: up63
16600
16673
  },
16601
16674
  {
16602
16675
  version: 58,
16603
16676
  name: "knowledge-graph-indices",
16604
- up: up63
16677
+ up: up64
16605
16678
  },
16606
16679
  {
16607
16680
  version: 59,
16608
16681
  name: "entity-attribute-claim-key",
16609
- up: up64,
16682
+ up: up65,
16610
16683
  artifacts: {
16611
16684
  columns: [{ table: "entity_attributes", column: "claim_key" }]
16612
16685
  }
@@ -16614,7 +16687,7 @@ var MIGRATIONS = [
16614
16687
  {
16615
16688
  version: 60,
16616
16689
  name: "entity-attribute-group-key",
16617
- up: up65,
16690
+ up: up66,
16618
16691
  artifacts: {
16619
16692
  columns: [{ table: "entity_attributes", column: "group_key" }]
16620
16693
  }
@@ -16622,7 +16695,7 @@ var MIGRATIONS = [
16622
16695
  {
16623
16696
  version: 61,
16624
16697
  name: "memory-artifact-source-mtime",
16625
- up: up66,
16698
+ up: up67,
16626
16699
  artifacts: {
16627
16700
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
16628
16701
  }
@@ -16630,7 +16703,7 @@ var MIGRATIONS = [
16630
16703
  {
16631
16704
  version: 62,
16632
16705
  name: "memory-artifact-soft-delete",
16633
- up: up67,
16706
+ up: up68,
16634
16707
  artifacts: {
16635
16708
  columns: [
16636
16709
  { table: "memory_artifacts", column: "is_deleted" },
@@ -16641,12 +16714,12 @@ var MIGRATIONS = [
16641
16714
  {
16642
16715
  version: 63,
16643
16716
  name: "content-only-memories-fts-update",
16644
- up: up68
16717
+ up: up69
16645
16718
  },
16646
16719
  {
16647
16720
  version: 64,
16648
16721
  name: "source-graph-provenance",
16649
- up: up69,
16722
+ up: up70,
16650
16723
  artifacts: {
16651
16724
  columns: [
16652
16725
  { table: "entities", column: "source_path" },
@@ -16659,7 +16732,7 @@ var MIGRATIONS = [
16659
16732
  {
16660
16733
  version: 65,
16661
16734
  name: "source-embedding-agent-scope",
16662
- up: up70,
16735
+ up: up71,
16663
16736
  artifacts: {
16664
16737
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
16665
16738
  }
@@ -16667,7 +16740,7 @@ var MIGRATIONS = [
16667
16740
  {
16668
16741
  version: 66,
16669
16742
  name: "memory-search-telemetry",
16670
- up: up71,
16743
+ up: up72,
16671
16744
  artifacts: {
16672
16745
  tables: ["memory_search_telemetry"]
16673
16746
  }
@@ -16675,7 +16748,7 @@ var MIGRATIONS = [
16675
16748
  {
16676
16749
  version: 67,
16677
16750
  name: "ontology-proposals",
16678
- up: up72,
16751
+ up: up73,
16679
16752
  artifacts: {
16680
16753
  tables: ["ontology_proposals"],
16681
16754
  columns: [
@@ -16689,7 +16762,7 @@ var MIGRATIONS = [
16689
16762
  {
16690
16763
  version: 68,
16691
16764
  name: "daily-reflections",
16692
- up: up73,
16765
+ up: up74,
16693
16766
  artifacts: {
16694
16767
  tables: ["daily_reflections"]
16695
16768
  }
@@ -16697,7 +16770,7 @@ var MIGRATIONS = [
16697
16770
  {
16698
16771
  version: 69,
16699
16772
  name: "daily-reflections-multiple-insights",
16700
- up: up74,
16773
+ up: up75,
16701
16774
  artifacts: {
16702
16775
  tables: ["daily_reflections"]
16703
16776
  }
@@ -16705,7 +16778,7 @@ var MIGRATIONS = [
16705
16778
  {
16706
16779
  version: 70,
16707
16780
  name: "ontology-control-plane-state",
16708
- up: up75,
16781
+ up: up76,
16709
16782
  artifacts: {
16710
16783
  columns: [
16711
16784
  { table: "entities", column: "status" },
@@ -16720,7 +16793,7 @@ var MIGRATIONS = [
16720
16793
  {
16721
16794
  version: 71,
16722
16795
  name: "epistemic-assertions",
16723
- up: up76,
16796
+ up: up77,
16724
16797
  artifacts: {
16725
16798
  tables: ["epistemic_assertions"]
16726
16799
  }
@@ -16728,7 +16801,7 @@ var MIGRATIONS = [
16728
16801
  {
16729
16802
  version: 72,
16730
16803
  name: "agent-scoped-idempotency-key",
16731
- up: up77,
16804
+ up: up78,
16732
16805
  artifacts: {
16733
16806
  columns: [
16734
16807
  { table: "memories", column: "idempotency_key" },
@@ -16739,7 +16812,7 @@ var MIGRATIONS = [
16739
16812
  {
16740
16813
  version: 73,
16741
16814
  name: "recall-context-dedupe",
16742
- up: up78,
16815
+ up: up79,
16743
16816
  artifacts: {
16744
16817
  tables: ["session_context_epochs", "session_recall_events"]
16745
16818
  }
@@ -16747,7 +16820,7 @@ var MIGRATIONS = [
16747
16820
  {
16748
16821
  version: 74,
16749
16822
  name: "aggregate-memory-links",
16750
- up: up79,
16823
+ up: up80,
16751
16824
  artifacts: {
16752
16825
  tables: ["aggregate_memory_sources"]
16753
16826
  }
@@ -16755,7 +16828,7 @@ var MIGRATIONS = [
16755
16828
  {
16756
16829
  version: 75,
16757
16830
  name: "memory-artifact-source-provenance",
16758
- up: up80,
16831
+ up: up81,
16759
16832
  artifacts: {
16760
16833
  columns: [
16761
16834
  { table: "memory_artifacts", column: "source_id" },
@@ -16769,7 +16842,7 @@ var MIGRATIONS = [
16769
16842
  {
16770
16843
  version: 76,
16771
16844
  name: "temporal-edges",
16772
- up: up81,
16845
+ up: up82,
16773
16846
  artifacts: {
16774
16847
  tables: ["temporal_edges"]
16775
16848
  }
@@ -16777,7 +16850,7 @@ var MIGRATIONS = [
16777
16850
  {
16778
16851
  version: 77,
16779
16852
  name: "entity-aliases",
16780
- up: up82,
16853
+ up: up83,
16781
16854
  artifacts: {
16782
16855
  tables: ["entity_aliases"]
16783
16856
  }
@@ -16785,7 +16858,7 @@ var MIGRATIONS = [
16785
16858
  {
16786
16859
  version: 78,
16787
16860
  name: "api-keys",
16788
- up: up83,
16861
+ up: up84,
16789
16862
  artifacts: {
16790
16863
  tables: ["api_keys"]
16791
16864
  }
@@ -16793,7 +16866,7 @@ var MIGRATIONS = [
16793
16866
  {
16794
16867
  version: 79,
16795
16868
  name: "transcript-capture-jobs",
16796
- up: up84,
16869
+ up: up85,
16797
16870
  artifacts: {
16798
16871
  tables: ["transcript_capture_jobs"]
16799
16872
  }
@@ -16801,7 +16874,7 @@ var MIGRATIONS = [
16801
16874
  {
16802
16875
  version: 80,
16803
16876
  name: "document-scope-columns",
16804
- up: up85,
16877
+ up: up86,
16805
16878
  artifacts: {
16806
16879
  columns: [
16807
16880
  { table: "documents", column: "agent_id" },
@@ -16812,7 +16885,7 @@ var MIGRATIONS = [
16812
16885
  {
16813
16886
  version: 81,
16814
16887
  name: "aggregate-evidence-sources",
16815
- up: up86,
16888
+ up: up87,
16816
16889
  artifacts: {
16817
16890
  tables: ["aggregate_evidence_sources"]
16818
16891
  }
@@ -16820,7 +16893,7 @@ var MIGRATIONS = [
16820
16893
  {
16821
16894
  version: 82,
16822
16895
  name: "skill-invocations-harness",
16823
- up: up87,
16896
+ up: up88,
16824
16897
  artifacts: {
16825
16898
  columns: [
16826
16899
  { table: "skill_invocations", column: "harness" },
@@ -16831,7 +16904,7 @@ var MIGRATIONS = [
16831
16904
  {
16832
16905
  version: 83,
16833
16906
  name: "memory-lifecycle-repair",
16834
- up: up88,
16907
+ up: up89,
16835
16908
  artifacts: {
16836
16909
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
16837
16910
  columns: [
@@ -16846,7 +16919,7 @@ var MIGRATIONS = [
16846
16919
  {
16847
16920
  version: 84,
16848
16921
  name: "legacy-markdown-import-state",
16849
- up: up89,
16922
+ up: up90,
16850
16923
  artifacts: {
16851
16924
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
16852
16925
  }
@@ -16854,7 +16927,7 @@ var MIGRATIONS = [
16854
16927
  {
16855
16928
  version: 85,
16856
16929
  name: "backfill-relations-to-dependencies",
16857
- up: up90,
16930
+ up: up91,
16858
16931
  artifacts: {
16859
16932
  tables: ["entity_dependencies"]
16860
16933
  }
@@ -16862,7 +16935,7 @@ var MIGRATIONS = [
16862
16935
  {
16863
16936
  version: 86,
16864
16937
  name: "summary-jobs-content-hash",
16865
- up: up91,
16938
+ up: up92,
16866
16939
  artifacts: {
16867
16940
  columns: [{ table: "summary_jobs", column: "content_hash" }]
16868
16941
  }
@@ -16870,7 +16943,7 @@ var MIGRATIONS = [
16870
16943
  {
16871
16944
  version: 87,
16872
16945
  name: "summary-jobs-boundary-reason",
16873
- up: up92,
16946
+ up: up93,
16874
16947
  artifacts: {
16875
16948
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
16876
16949
  }
@@ -16878,7 +16951,7 @@ var MIGRATIONS = [
16878
16951
  {
16879
16952
  version: 88,
16880
16953
  name: "transcript-recovery-files",
16881
- up: up93,
16954
+ up: up94,
16882
16955
  artifacts: {
16883
16956
  tables: ["transcript_recovery_files"]
16884
16957
  }
@@ -16886,7 +16959,7 @@ var MIGRATIONS = [
16886
16959
  {
16887
16960
  version: 89,
16888
16961
  name: "job-cancellations",
16889
- up: up94,
16962
+ up: up95,
16890
16963
  artifacts: {
16891
16964
  tables: ["job_cancellations"]
16892
16965
  }
@@ -16894,7 +16967,7 @@ var MIGRATIONS = [
16894
16967
  {
16895
16968
  version: 90,
16896
16969
  name: "job-archive",
16897
- up: up95,
16970
+ up: up96,
16898
16971
  artifacts: {
16899
16972
  tables: ["job_archive"]
16900
16973
  }
@@ -16902,25 +16975,25 @@ var MIGRATIONS = [
16902
16975
  {
16903
16976
  version: 91,
16904
16977
  name: "embedding-index-generations",
16905
- up: up96,
16978
+ up: up97,
16906
16979
  artifacts: { tables: ["embedding_index_state"] }
16907
16980
  },
16908
16981
  {
16909
16982
  version: 92,
16910
16983
  name: "embedding-staging-store",
16911
- up: up97,
16984
+ up: up98,
16912
16985
  artifacts: { tables: ["embeddings_staging"] }
16913
16986
  },
16914
16987
  {
16915
16988
  version: 93,
16916
16989
  name: "dreaming-evidence-cursor",
16917
- up: up98,
16990
+ up: up99,
16918
16991
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
16919
16992
  },
16920
16993
  {
16921
16994
  version: 94,
16922
16995
  name: "memory-kind",
16923
- up: up99,
16996
+ up: up100,
16924
16997
  artifacts: {
16925
16998
  columns: [
16926
16999
  { table: "memories", column: "memory_kind" },
@@ -16931,35 +17004,35 @@ var MIGRATIONS = [
16931
17004
  {
16932
17005
  version: 95,
16933
17006
  name: "compaction-recall-projections",
16934
- up: up100
17007
+ up: up101
16935
17008
  },
16936
17009
  {
16937
17010
  version: 96,
16938
17011
  name: "retire-legacy-ingestion",
16939
- up: up101
17012
+ up: up102
16940
17013
  },
16941
17014
  {
16942
17015
  version: 97,
16943
17016
  name: "dreaming-failure-backoff",
16944
- up: up102,
17017
+ up: up103,
16945
17018
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
16946
17019
  },
16947
17020
  {
16948
17021
  version: 98,
16949
17022
  name: "dreaming-evidence-exclusions",
16950
- up: up103,
17023
+ up: up104,
16951
17024
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
16952
17025
  },
16953
17026
  {
16954
17027
  version: 99,
16955
17028
  name: "dreaming-tool-calls",
16956
- up: up104,
17029
+ up: up105,
16957
17030
  artifacts: { tables: ["dreaming_tool_calls"] }
16958
17031
  },
16959
17032
  {
16960
17033
  version: 100,
16961
17034
  name: "dreaming-runbook",
16962
- up: up105,
17035
+ up: up106,
16963
17036
  artifacts: {
16964
17037
  columns: [
16965
17038
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -16970,23 +17043,23 @@ var MIGRATIONS = [
16970
17043
  {
16971
17044
  version: 101,
16972
17045
  name: "dreaming-attention",
16973
- up: up106,
17046
+ up: up107,
16974
17047
  artifacts: { tables: ["dreaming_attention"] }
16975
17048
  },
16976
17049
  {
16977
17050
  version: 102,
16978
17051
  name: "attribute-semantic-memories",
16979
- up: up107
17052
+ up: up108
16980
17053
  },
16981
17054
  {
16982
17055
  version: 103,
16983
17056
  name: "semantic-memory-kind",
16984
- up: up108
17057
+ up: up109
16985
17058
  },
16986
17059
  {
16987
17060
  version: 104,
16988
17061
  name: "derived-memory-provenance",
16989
- up: up109,
17062
+ up: up110,
16990
17063
  artifacts: {
16991
17064
  tables: ["derived_memory_sources"],
16992
17065
  columns: [{ table: "memories", column: "stale_at" }]
@@ -16995,12 +17068,12 @@ var MIGRATIONS = [
16995
17068
  {
16996
17069
  version: 105,
16997
17070
  name: "agent-scoped-entity-name",
16998
- up: up110
17071
+ up: up111
16999
17072
  },
17000
17073
  {
17001
17074
  version: 106,
17002
17075
  name: "memory-review-after",
17003
- up: up111,
17076
+ up: up112,
17004
17077
  artifacts: {
17005
17078
  columns: [{ table: "memories", column: "review_after" }]
17006
17079
  }
@@ -17008,7 +17081,7 @@ var MIGRATIONS = [
17008
17081
  {
17009
17082
  version: 107,
17010
17083
  name: "dreaming-pass-usage",
17011
- up: up112,
17084
+ up: up113,
17012
17085
  artifacts: {
17013
17086
  columns: [
17014
17087
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17022,7 +17095,7 @@ var MIGRATIONS = [
17022
17095
  {
17023
17096
  version: 108,
17024
17097
  name: "embedding-usage",
17025
- up: up113,
17098
+ up: up114,
17026
17099
  artifacts: {
17027
17100
  tables: ["embedding_usage"]
17028
17101
  }
@@ -17030,7 +17103,7 @@ var MIGRATIONS = [
17030
17103
  {
17031
17104
  version: 109,
17032
17105
  name: "telemetry-install",
17033
- up: up114,
17106
+ up: up115,
17034
17107
  artifacts: {
17035
17108
  tables: ["telemetry_install"]
17036
17109
  }
@@ -17038,12 +17111,12 @@ var MIGRATIONS = [
17038
17111
  {
17039
17112
  version: 110,
17040
17113
  name: "memory-mention-join-index",
17041
- up: up115
17114
+ up: up116
17042
17115
  },
17043
17116
  {
17044
17117
  version: 111,
17045
17118
  name: "telemetry-first-use",
17046
- up: up116,
17119
+ up: up117,
17047
17120
  artifacts: {
17048
17121
  columns: [
17049
17122
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17054,7 +17127,7 @@ var MIGRATIONS = [
17054
17127
  {
17055
17128
  version: 112,
17056
17129
  name: "telemetry-queue-ownership",
17057
- up: up117,
17130
+ up: up118,
17058
17131
  artifacts: {
17059
17132
  columns: [
17060
17133
  { table: "telemetry_events", column: "source" },
@@ -17066,7 +17139,7 @@ var MIGRATIONS = [
17066
17139
  {
17067
17140
  version: 113,
17068
17141
  name: "session-claims",
17069
- up: up118,
17142
+ up: up119,
17070
17143
  artifacts: {
17071
17144
  tables: ["session_claims"],
17072
17145
  columns: [
@@ -17080,12 +17153,12 @@ var MIGRATIONS = [
17080
17153
  {
17081
17154
  version: 114,
17082
17155
  name: "memory-traversal-hydration-index",
17083
- up: up119
17156
+ up: up120
17084
17157
  },
17085
17158
  {
17086
17159
  version: 115,
17087
17160
  name: "cross-agent-message-notifications",
17088
- up: up120,
17161
+ up: up121,
17089
17162
  artifacts: {
17090
17163
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17091
17164
  }
@@ -17093,7 +17166,7 @@ var MIGRATIONS = [
17093
17166
  {
17094
17167
  version: 116,
17095
17168
  name: "acp-delivery-reconciliation",
17096
- up: up121,
17169
+ up: up122,
17097
17170
  artifacts: {
17098
17171
  columns: [
17099
17172
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17107,7 +17180,7 @@ var MIGRATIONS = [
17107
17180
  {
17108
17181
  version: 117,
17109
17182
  name: "retire-summary-worker",
17110
- up: up122,
17183
+ up: up123,
17111
17184
  artifacts: {
17112
17185
  columns: [
17113
17186
  { table: "session_transcripts", column: "completed_at" },
@@ -17118,24 +17191,24 @@ var MIGRATIONS = [
17118
17191
  {
17119
17192
  version: 118,
17120
17193
  name: "queue-pressure-indices",
17121
- up: up123
17194
+ up: up124
17122
17195
  },
17123
17196
  {
17124
17197
  version: 119,
17125
17198
  name: "telemetry-version-observation",
17126
- up: up124,
17199
+ up: up125,
17127
17200
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17128
17201
  },
17129
17202
  {
17130
17203
  version: 120,
17131
17204
  name: "source-lifecycle-telemetry",
17132
- up: up125,
17205
+ up: up126,
17133
17206
  artifacts: { tables: ["source_lifecycle_state"] }
17134
17207
  },
17135
17208
  {
17136
17209
  version: 121,
17137
17210
  name: "telemetry-delivery-health",
17138
- up: up126,
17211
+ up: up127,
17139
17212
  artifacts: {
17140
17213
  tables: ["telemetry_delivery_state"],
17141
17214
  columns: [
@@ -17149,7 +17222,7 @@ var MIGRATIONS = [
17149
17222
  {
17150
17223
  version: 122,
17151
17224
  name: "dreaming-evidence-retry",
17152
- up: up127,
17225
+ up: up128,
17153
17226
  artifacts: {
17154
17227
  columns: [
17155
17228
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17162,13 +17235,13 @@ var MIGRATIONS = [
17162
17235
  {
17163
17236
  version: 123,
17164
17237
  name: "embedding-index-failures",
17165
- up: up128,
17238
+ up: up129,
17166
17239
  artifacts: { tables: ["embedding_index_failures"] }
17167
17240
  },
17168
17241
  {
17169
17242
  version: 124,
17170
17243
  name: "import-derived-lifecycle",
17171
- up: up129,
17244
+ up: up130,
17172
17245
  artifacts: {
17173
17246
  tables: ["imported_source_lifecycle"]
17174
17247
  }
@@ -17176,76 +17249,76 @@ var MIGRATIONS = [
17176
17249
  {
17177
17250
  version: 125,
17178
17251
  name: "memory-content-safety",
17179
- up: up130
17252
+ up: up131
17180
17253
  },
17181
17254
  {
17182
17255
  version: 126,
17183
17256
  name: "dreaming-surprisal-attention",
17184
- up: up131,
17257
+ up: up132,
17185
17258
  artifacts: { tables: ["dreaming_attention"] }
17186
17259
  },
17187
17260
  {
17188
17261
  version: 127,
17189
17262
  name: "ontology-contradictions",
17190
- up: up132,
17263
+ up: up133,
17191
17264
  artifacts: { tables: ["ontology_contradictions"] }
17192
17265
  },
17193
17266
  {
17194
17267
  version: 128,
17195
17268
  name: "bounded-queue-diagnostics",
17196
- up: up133
17269
+ up: up134
17197
17270
  },
17198
17271
  {
17199
17272
  version: 129,
17200
17273
  name: "retire-structural-jobs",
17201
- up: up134
17274
+ up: up135
17202
17275
  },
17203
17276
  {
17204
17277
  version: 130,
17205
17278
  name: "embedding-repair-state",
17206
- up: up135,
17279
+ up: up136,
17207
17280
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17208
17281
  },
17209
17282
  {
17210
17283
  version: 131,
17211
17284
  name: "dreaming-evidence-consumption",
17212
- up: up136,
17285
+ up: up137,
17213
17286
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17214
17287
  },
17215
17288
  {
17216
17289
  version: 132,
17217
17290
  name: "observer-scoped-epistemic-assertions",
17218
- up: up137,
17291
+ up: up138,
17219
17292
  artifacts: { tables: ["epistemic_assertions"] }
17220
17293
  },
17221
17294
  {
17222
17295
  version: 133,
17223
17296
  name: "dreaming-memory-head",
17224
- up: up138,
17297
+ up: up139,
17225
17298
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17226
17299
  },
17227
17300
  {
17228
17301
  version: 134,
17229
17302
  name: "scope-memory-head-entries",
17230
- up: up139,
17303
+ up: up140,
17231
17304
  artifacts: { tables: ["memory_head_entries"] }
17232
17305
  },
17233
17306
  {
17234
17307
  version: 135,
17235
17308
  name: "memory-head-publication",
17236
- up: up140,
17309
+ up: up141,
17237
17310
  artifacts: { tables: ["memory_head_publications"] }
17238
17311
  },
17239
17312
  {
17240
17313
  version: 136,
17241
17314
  name: "memory-head-revisions",
17242
- up: up141,
17315
+ up: up142,
17243
17316
  artifacts: { tables: ["memory_head_revisions"] }
17244
17317
  },
17245
17318
  {
17246
17319
  version: 137,
17247
17320
  name: "dreaming-head-manifest",
17248
- up: up142,
17321
+ up: up143,
17249
17322
  artifacts: {
17250
17323
  columns: [
17251
17324
  { table: "dreaming_passes", column: "head_revision" },
@@ -17256,7 +17329,7 @@ var MIGRATIONS = [
17256
17329
  {
17257
17330
  version: 138,
17258
17331
  name: "bounded-status-projections",
17259
- up: up143,
17332
+ up: up144,
17260
17333
  artifacts: {
17261
17334
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17262
17335
  }
@@ -17264,31 +17337,31 @@ var MIGRATIONS = [
17264
17337
  {
17265
17338
  version: 139,
17266
17339
  name: "native-source-sync-state",
17267
- up: up144,
17340
+ up: up145,
17268
17341
  artifacts: { tables: ["native_source_sync_state"] }
17269
17342
  },
17270
17343
  {
17271
17344
  version: 140,
17272
17345
  name: "transcript-recovery-frontier",
17273
- up: up145,
17346
+ up: up146,
17274
17347
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17275
17348
  },
17276
17349
  {
17277
17350
  version: 141,
17278
17351
  name: "source-sync-checkpoints",
17279
- up: up146,
17352
+ up: up147,
17280
17353
  artifacts: { tables: ["source_sync_checkpoints"] }
17281
17354
  },
17282
17355
  {
17283
17356
  version: 142,
17284
17357
  name: "source-sync-frontier",
17285
- up: up147,
17358
+ up: up148,
17286
17359
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17287
17360
  },
17288
17361
  {
17289
17362
  version: 143,
17290
17363
  name: "embedding-index-progress",
17291
- up: up148,
17364
+ up: up149,
17292
17365
  artifacts: {
17293
17366
  columns: [
17294
17367
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17304,19 +17377,19 @@ var MIGRATIONS = [
17304
17377
  {
17305
17378
  version: 144,
17306
17379
  name: "memory-job-lease-token",
17307
- up: up149,
17380
+ up: up150,
17308
17381
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17309
17382
  },
17310
17383
  {
17311
17384
  version: 145,
17312
17385
  name: "dreaming-evidence-reviews",
17313
- up: up150,
17386
+ up: up151,
17314
17387
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17315
17388
  },
17316
17389
  {
17317
17390
  version: 146,
17318
17391
  name: "source-transcript-import",
17319
- up: up151,
17392
+ up: up152,
17320
17393
  artifacts: {
17321
17394
  tables: [
17322
17395
  "source_import_jobs",
@@ -17335,19 +17408,19 @@ var MIGRATIONS = [
17335
17408
  {
17336
17409
  version: 147,
17337
17410
  name: "source-import-replay-file-slots",
17338
- up: up152,
17411
+ up: up153,
17339
17412
  artifacts: { tables: ["source_import_files"] }
17340
17413
  },
17341
17414
  {
17342
17415
  version: 148,
17343
17416
  name: "source-import-attempt-provenance",
17344
- up: up153,
17417
+ up: up154,
17345
17418
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17346
17419
  },
17347
17420
  {
17348
17421
  version: 149,
17349
17422
  name: "transcript-import-state-machine",
17350
- up: up154,
17423
+ up: up155,
17351
17424
  artifacts: {
17352
17425
  columns: [
17353
17426
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17359,7 +17432,7 @@ var MIGRATIONS = [
17359
17432
  {
17360
17433
  version: 150,
17361
17434
  name: "memory-head-freshness",
17362
- up: up155,
17435
+ up: up156,
17363
17436
  artifacts: {
17364
17437
  columns: [
17365
17438
  { table: "memory_md_heads", column: "is_current" },
@@ -17370,7 +17443,7 @@ var MIGRATIONS = [
17370
17443
  {
17371
17444
  version: 151,
17372
17445
  name: "transcript-import-bytes",
17373
- up,
17446
+ up: up2,
17374
17447
  artifacts: {
17375
17448
  tables: [
17376
17449
  "source_import_chunks",
@@ -17399,19 +17472,19 @@ var MIGRATIONS = [
17399
17472
  {
17400
17473
  version: 152,
17401
17474
  name: "memory-artifact-sha-index",
17402
- up: up2,
17475
+ up: up3,
17403
17476
  artifacts: { indexes: ["idx_memory_artifacts_agent_sha"] }
17404
17477
  },
17405
17478
  {
17406
17479
  version: 153,
17407
17480
  name: "vector-repair-checkpoints",
17408
- up: up156,
17481
+ up: up157,
17409
17482
  artifacts: { tables: ["vector_repair_checkpoints"] }
17410
17483
  },
17411
17484
  {
17412
17485
  version: 154,
17413
17486
  name: "transcript-capture-source-identity",
17414
- up: up3,
17487
+ up: up4,
17415
17488
  artifacts: {
17416
17489
  columns: [
17417
17490
  { table: "transcript_capture_jobs", column: "source_identity" },
@@ -17426,19 +17499,19 @@ var MIGRATIONS = [
17426
17499
  {
17427
17500
  version: 155,
17428
17501
  name: "source-sync-failures",
17429
- up: up4,
17502
+ up: up5,
17430
17503
  artifacts: { tables: ["source_sync_failures"], indexes: ["idx_source_sync_failures_active"] }
17431
17504
  },
17432
17505
  {
17433
17506
  version: 156,
17434
17507
  name: "embedding-repair-checkpoints",
17435
- up: up157,
17508
+ up: up158,
17436
17509
  artifacts: { tables: ["embedding_repair_checkpoints"] }
17437
17510
  },
17438
17511
  {
17439
17512
  version: 157,
17440
17513
  name: "embedding-repair-progress",
17441
- up: up158,
17514
+ up: up159,
17442
17515
  artifacts: {
17443
17516
  tables: ["embedding_repair_progress"],
17444
17517
  columns: [{ table: "embedding_repair_checkpoints", column: "profile_fingerprint" }]
@@ -17447,18 +17520,18 @@ var MIGRATIONS = [
17447
17520
  {
17448
17521
  version: 158,
17449
17522
  name: "dreaming-candidate-scan-index",
17450
- up: up159,
17523
+ up: up160,
17451
17524
  artifacts: { indexes: ["idx_memories_agent_kind"] }
17452
17525
  },
17453
17526
  {
17454
17527
  version: 159,
17455
17528
  name: "retire-obsolete-invocation-ledger",
17456
- up: up5
17529
+ up: up6
17457
17530
  },
17458
17531
  {
17459
17532
  version: 160,
17460
17533
  name: "import-admission-ledger",
17461
- up: up160,
17534
+ up: up161,
17462
17535
  artifacts: {
17463
17536
  tables: ["import_admission_ledger", "import_admission_events"],
17464
17537
  indexes: ["idx_import_admission_status", "idx_import_admission_events_key"],
@@ -17470,24 +17543,24 @@ var MIGRATIONS = [
17470
17543
  {
17471
17544
  version: 161,
17472
17545
  name: "entity-prune-keyset-index",
17473
- up: up161,
17546
+ up: up162,
17474
17547
  artifacts: { indexes: ["idx_entities_agent_updated_id"] }
17475
17548
  },
17476
17549
  {
17477
17550
  version: 162,
17478
17551
  name: "generic-entity-prune-scan-generation",
17479
- up: up162,
17552
+ up: up163,
17480
17553
  artifacts: { tables: ["generic_entity_prune_scan_state"] }
17481
17554
  },
17482
17555
  {
17483
17556
  version: 163,
17484
17557
  name: "retire-memory-content-safety",
17485
- up: up163
17558
+ up: up164
17486
17559
  },
17487
17560
  {
17488
17561
  version: 164,
17489
17562
  name: "claim-event-time",
17490
- up: up164,
17563
+ up: up165,
17491
17564
  artifacts: {
17492
17565
  columns: ["occurred_start", "occurred_end", "valid_from", "valid_until", "time_precision"].map((column) => ({
17493
17566
  table: "entity_attributes",
@@ -17498,7 +17571,7 @@ var MIGRATIONS = [
17498
17571
  {
17499
17572
  version: 165,
17500
17573
  name: "dreaming-history",
17501
- up: up165,
17574
+ up: up166,
17502
17575
  artifacts: {
17503
17576
  tables: ["dreaming_history_nodes"],
17504
17577
  indexes: ["idx_dreaming_history_nodes_pass"],
@@ -17508,23 +17581,23 @@ var MIGRATIONS = [
17508
17581
  {
17509
17582
  version: 166,
17510
17583
  name: "dreaming-pass-peak-context",
17511
- up: up166,
17584
+ up: up167,
17512
17585
  artifacts: { columns: [{ table: "dreaming_passes", column: "tokens_peak_context" }] }
17513
17586
  },
17514
17587
  {
17515
17588
  version: 167,
17516
17589
  name: "memories-fts-porter",
17517
- up: up167
17590
+ up: up168
17518
17591
  },
17519
17592
  {
17520
17593
  version: 168,
17521
17594
  name: "retire-source-paragraph-claims",
17522
- up: up168
17595
+ up: up169
17523
17596
  },
17524
17597
  {
17525
17598
  version: 169,
17526
17599
  name: "dreaming-evidence-review-cursor",
17527
- up: up169,
17600
+ up: up170,
17528
17601
  artifacts: {
17529
17602
  columns: [
17530
17603
  { table: "dreaming_evidence_consumption", column: "cursor_basis" },
@@ -17535,7 +17608,7 @@ var MIGRATIONS = [
17535
17608
  {
17536
17609
  version: 170,
17537
17610
  name: "dependency-history-compaction-state",
17538
- up: up170,
17611
+ up: up171,
17539
17612
  artifacts: {
17540
17613
  tables: ["dependency_history_compaction_state"]
17541
17614
  }
@@ -17543,7 +17616,7 @@ var MIGRATIONS = [
17543
17616
  {
17544
17617
  version: 171,
17545
17618
  name: "agent-wake-and-message-board",
17546
- up: up171,
17619
+ up: up172,
17547
17620
  artifacts: {
17548
17621
  columns: [
17549
17622
  { table: "cross_agent_message_wakes", column: "session_key" },
@@ -17567,7 +17640,7 @@ var MIGRATIONS = [
17567
17640
  {
17568
17641
  version: 172,
17569
17642
  name: "dreaming-pass-policy",
17570
- up: up172,
17643
+ up: up173,
17571
17644
  artifacts: {
17572
17645
  tables: ["dreaming_policies"],
17573
17646
  columns: [
@@ -17579,8 +17652,35 @@ var MIGRATIONS = [
17579
17652
  {
17580
17653
  version: 173,
17581
17654
  name: "memory-artifact-native-path-index",
17582
- up: up173,
17655
+ up: up174,
17583
17656
  artifacts: { indexes: ["idx_memory_artifacts_native_paths"] }
17657
+ },
17658
+ {
17659
+ version: 174,
17660
+ name: "session-transcript-deletions",
17661
+ up,
17662
+ artifacts: {
17663
+ tables: [
17664
+ "session_transcript_deletions",
17665
+ "session_transcript_deleted_prefixes",
17666
+ "session_transcript_deleted_positions",
17667
+ "session_transcript_deleted_sources",
17668
+ "session_transcript_delete_files"
17669
+ ],
17670
+ indexes: [
17671
+ "idx_session_delete_files_pending",
17672
+ "idx_session_delete_source_lookup",
17673
+ "idx_memories_session_delete_source",
17674
+ "idx_capture_jobs_session_delete",
17675
+ "idx_import_records_session_delete"
17676
+ ],
17677
+ columns: [
17678
+ { table: "source_import_records", column: "redacted_bytes" },
17679
+ { table: "session_transcript_deletions", column: "pending_start" },
17680
+ { table: "session_transcript_deletions", column: "lifecycle_intent_seq" },
17681
+ { table: "session_transcript_deleted_prefixes", column: "origin" }
17682
+ ]
17683
+ }
17584
17684
  }
17585
17685
  ];
17586
17686
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -18188,6 +18288,16 @@ function stripSignetBlock(content) {
18188
18288
  function escapeRegex(str) {
18189
18289
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18190
18290
  }
18291
+ var ROUTING_OPENROUTER_QUANTIZATIONS = new Set([
18292
+ "fp32",
18293
+ "fp16",
18294
+ "bf16",
18295
+ "fp8",
18296
+ "fp6",
18297
+ "int8",
18298
+ "int4",
18299
+ "fp4"
18300
+ ]);
18191
18301
  var LOCAL_THINKING_EXECUTORS = new Set(["openai-compatible", "llama-cpp", "ollama"]);
18192
18302
 
18193
18303
  // src/launcher.ts