@signetai/connector-gemini 0.221.7 → 0.221.9

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 (2) hide show
  1. package/dist/index.js +810 -608
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -11329,6 +11329,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
11329
11329
  "checkpoint",
11330
11330
  "dreaming"
11331
11331
  ];
11332
+ function up(db) {
11333
+ const hasColumn = (table, column) => {
11334
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
11335
+ try {
11336
+ return statement.get(column) != null;
11337
+ } finally {
11338
+ statement.finalize?.();
11339
+ }
11340
+ };
11341
+ for (const [column, definition] of [
11342
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
11343
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
11344
+ ["upload_size", "INTEGER"],
11345
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
11346
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
11347
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
11348
+ ["original_path", "TEXT"],
11349
+ [
11350
+ "storage_state",
11351
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
11352
+ ]
11353
+ ]) {
11354
+ if (!hasColumn("source_import_files", column))
11355
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
11356
+ }
11357
+ if (!hasColumn("source_import_jobs", "retry_count"))
11358
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
11359
+ if (!hasColumn("source_import_jobs", "cleanup_state"))
11360
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
11361
+ if (!hasColumn("source_import_jobs", "retry_cursor"))
11362
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
11363
+ if (!hasColumn("source_import_jobs", "retry_requested"))
11364
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
11365
+ db.exec(`
11366
+ CREATE TABLE IF NOT EXISTS source_import_migrations (agent_id TEXT PRIMARY KEY, state TEXT NOT NULL DEFAULT 'pending', cursor TEXT NOT NULL DEFAULT '', error TEXT);
11367
+ CREATE TABLE IF NOT EXISTS source_import_migration_counts (agent_id TEXT NOT NULL, job_id TEXT NOT NULL, total INTEGER NOT NULL DEFAULT 0, imported INTEGER NOT NULL DEFAULT 0, duplicate INTEGER NOT NULL DEFAULT 0, rejected INTEGER NOT NULL DEFAULT 0, pending INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(agent_id,job_id)) WITHOUT ROWID;
11368
+ CREATE TABLE IF NOT EXISTS source_import_migration_streams (agent_id TEXT NOT NULL, stem TEXT NOT NULL, PRIMARY KEY(agent_id,stem)) WITHOUT ROWID;
11369
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
11370
+ CREATE TABLE IF NOT EXISTS source_import_capacity (id INTEGER PRIMARY KEY CHECK (id = 1), reserved_bytes INTEGER NOT NULL DEFAULT 0 CHECK (reserved_bytes >= 0));
11371
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
11372
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
11373
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
11374
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
11375
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
11376
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
11377
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
11378
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
11379
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
11380
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
11381
+ ) WITHOUT ROWID;
11382
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
11383
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
11384
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
11385
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
11386
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
11387
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
11388
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
11389
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
11390
+ `);
11391
+ }
11332
11392
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11333
11393
  var FTS_STATE_TABLE = "memories_fts_state";
11334
11394
  function normalizeSql(sql) {
@@ -11444,7 +11504,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11444
11504
  return true;
11445
11505
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
11446
11506
  }
11447
- function up(db) {
11507
+ function up2(db) {
11448
11508
  db.exec(`
11449
11509
  CREATE TABLE IF NOT EXISTS schema_migrations (
11450
11510
  version INTEGER PRIMARY KEY,
@@ -11542,7 +11602,7 @@ function addColumnIfMissing(db, table, column, definition) {
11542
11602
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11543
11603
  }
11544
11604
  }
11545
- function up2(db) {
11605
+ function up3(db) {
11546
11606
  addColumnIfMissing(db, "memories", "content_hash", "TEXT");
11547
11607
  addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
11548
11608
  addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -11660,7 +11720,7 @@ function addColumnIfMissing2(db, table, column, definition) {
11660
11720
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11661
11721
  return true;
11662
11722
  }
11663
- function up3(db) {
11723
+ function up4(db) {
11664
11724
  addColumnIfMissing2(db, "memories", "why", "TEXT");
11665
11725
  addColumnIfMissing2(db, "memories", "project", "TEXT");
11666
11726
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -11697,7 +11757,7 @@ function addColumnIfMissing3(db, table, column, definition) {
11697
11757
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11698
11758
  }
11699
11759
  }
11700
- function up4(db) {
11760
+ function up5(db) {
11701
11761
  addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
11702
11762
  addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
11703
11763
  addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
@@ -11730,7 +11790,7 @@ function addColumnIfMissing4(db, table, column, definition) {
11730
11790
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11731
11791
  }
11732
11792
  }
11733
- function up5(db) {
11793
+ function up6(db) {
11734
11794
  addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
11735
11795
  addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
11736
11796
  addColumnIfMissing4(db, "entities", "embedding", "BLOB");
@@ -11747,7 +11807,7 @@ function hasColumn4(db, table, column) {
11747
11807
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11748
11808
  return rows.some((r2) => r2.name === column);
11749
11809
  }
11750
- function up6(db) {
11810
+ function up7(db) {
11751
11811
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11752
11812
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11753
11813
  }
@@ -11762,7 +11822,7 @@ function hasColumn5(db, table, column) {
11762
11822
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11763
11823
  return rows.some((r2) => r2.name === column);
11764
11824
  }
11765
- function up7(db) {
11825
+ function up8(db) {
11766
11826
  db.exec(`
11767
11827
  CREATE TABLE IF NOT EXISTS documents (
11768
11828
  id TEXT PRIMARY KEY,
@@ -11819,7 +11879,7 @@ function up7(db) {
11819
11879
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11820
11880
  }
11821
11881
  }
11822
- function up8(db) {
11882
+ function up9(db) {
11823
11883
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11824
11884
  if (tables.length === 0)
11825
11885
  return;
@@ -11836,7 +11896,7 @@ function up8(db) {
11836
11896
  ON embeddings(content_hash)
11837
11897
  `);
11838
11898
  }
11839
- function up9(db) {
11899
+ function up10(db) {
11840
11900
  db.exec(`
11841
11901
  CREATE TABLE IF NOT EXISTS summary_jobs (
11842
11902
  id TEXT PRIMARY KEY,
@@ -11856,7 +11916,7 @@ function up9(db) {
11856
11916
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11857
11917
  ON summary_jobs(status)`);
11858
11918
  }
11859
- function up10(db) {
11919
+ function up11(db) {
11860
11920
  db.exec(`
11861
11921
  CREATE TABLE IF NOT EXISTS umap_cache (
11862
11922
  id INTEGER PRIMARY KEY,
@@ -11867,7 +11927,7 @@ function up10(db) {
11867
11927
  )
11868
11928
  `);
11869
11929
  }
11870
- function up11(db) {
11930
+ function up12(db) {
11871
11931
  db.exec(`
11872
11932
  CREATE TABLE IF NOT EXISTS session_scores (
11873
11933
  id TEXT PRIMARY KEY,
@@ -11887,7 +11947,7 @@ function up11(db) {
11887
11947
  ON session_scores(session_key);
11888
11948
  `);
11889
11949
  }
11890
- function up12(db) {
11950
+ function up13(db) {
11891
11951
  db.exec(`
11892
11952
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11893
11953
  id TEXT PRIMARY KEY,
@@ -11928,7 +11988,7 @@ function addColumnIfMissing5(db, table, column, definition) {
11928
11988
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11929
11989
  }
11930
11990
  }
11931
- function up13(db) {
11991
+ function up14(db) {
11932
11992
  db.exec(`
11933
11993
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11934
11994
  id TEXT PRIMARY KEY,
@@ -11954,7 +12014,7 @@ function up13(db) {
11954
12014
  addColumnIfMissing5(db, "memories", "source_path", "TEXT");
11955
12015
  addColumnIfMissing5(db, "memories", "source_section", "TEXT");
11956
12016
  }
11957
- function up14(db) {
12017
+ function up15(db) {
11958
12018
  db.exec(`
11959
12019
  CREATE TABLE IF NOT EXISTS telemetry_events (
11960
12020
  id TEXT PRIMARY KEY,
@@ -11979,7 +12039,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11979
12039
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11980
12040
  }
11981
12041
  }
11982
- function up15(db) {
12042
+ function up16(db) {
11983
12043
  db.exec(`
11984
12044
  CREATE TABLE IF NOT EXISTS session_memories (
11985
12045
  id TEXT PRIMARY KEY,
@@ -12006,7 +12066,7 @@ function up15(db) {
12006
12066
  addColumnIfMissing6(db, "session_scores", "confidence", "REAL");
12007
12067
  addColumnIfMissing6(db, "session_scores", "continuity_reasoning", "TEXT");
12008
12068
  }
12009
- function up16(db) {
12069
+ function up17(db) {
12010
12070
  db.exec(`
12011
12071
  CREATE TABLE IF NOT EXISTS session_checkpoints (
12012
12072
  id TEXT PRIMARY KEY,
@@ -12028,7 +12088,7 @@ function up16(db) {
12028
12088
  ON session_checkpoints(project_normalized, created_at DESC);
12029
12089
  `);
12030
12090
  }
12031
- function up17(db) {
12091
+ function up18(db) {
12032
12092
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12033
12093
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12034
12094
  if (!colNames.has("skill_name")) {
@@ -12039,7 +12099,7 @@ function up17(db) {
12039
12099
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
12040
12100
  }
12041
12101
  }
12042
- function up18(db) {
12102
+ function up19(db) {
12043
12103
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12044
12104
  if (existing)
12045
12105
  return;
@@ -12071,7 +12131,7 @@ function up18(db) {
12071
12131
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
12072
12132
  `);
12073
12133
  }
12074
- function up19(db) {
12134
+ function up20(db) {
12075
12135
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12076
12136
  const entityColNames = new Set(entityCols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12077
12137
  if (!entityColNames.has("agent_id")) {
@@ -12156,13 +12216,13 @@ function addColumnIfMissing7(db, table, column, definition) {
12156
12216
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12157
12217
  }
12158
12218
  }
12159
- function up20(db) {
12219
+ function up21(db) {
12160
12220
  addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12161
12221
  addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12162
12222
  addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12163
12223
  addColumnIfMissing7(db, "session_memories", "structural_density", "INTEGER");
12164
12224
  }
12165
- function up21(db) {
12225
+ function up22(db) {
12166
12226
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12167
12227
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12168
12228
  if (!columnNames.has("focal_entity_ids")) {
@@ -12187,25 +12247,25 @@ function addColumnIfMissing8(db, table, column, definition) {
12187
12247
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12188
12248
  }
12189
12249
  }
12190
- function up22(db) {
12250
+ function up23(db) {
12191
12251
  addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12192
12252
  addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12193
12253
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12194
12254
  }
12195
- function up23(_db) {}
12196
12255
  function up24(_db) {}
12256
+ function up25(_db) {}
12197
12257
  function addColumnIfMissing9(db, table, column, definition) {
12198
12258
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12199
12259
  if (!cols.some((c2) => c2.name === column)) {
12200
12260
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12201
12261
  }
12202
12262
  }
12203
- function up25(db) {
12263
+ function up26(db) {
12204
12264
  addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12205
12265
  addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12206
12266
  }
12207
- function up26(_db) {}
12208
- function up27(db) {
12267
+ function up27(_db) {}
12268
+ function up28(db) {
12209
12269
  db.exec(`
12210
12270
  UPDATE entities
12211
12271
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12214,7 +12274,7 @@ function up27(db) {
12214
12274
  WHERE canonical_name IS NULL
12215
12275
  `);
12216
12276
  }
12217
- function up28(db) {
12277
+ function up29(db) {
12218
12278
  db.exec(`
12219
12279
  CREATE TABLE IF NOT EXISTS memories_cold (
12220
12280
  archive_id TEXT PRIMARY KEY,
@@ -12251,7 +12311,7 @@ function up28(db) {
12251
12311
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
12252
12312
  `);
12253
12313
  }
12254
- function up29(db) {
12314
+ function up30(db) {
12255
12315
  db.exec(`
12256
12316
  CREATE TABLE IF NOT EXISTS session_summaries (
12257
12317
  id TEXT PRIMARY KEY,
@@ -12296,7 +12356,7 @@ function up29(db) {
12296
12356
  WHERE session_key IS NOT NULL;
12297
12357
  `);
12298
12358
  }
12299
- function up30(db) {
12359
+ function up31(db) {
12300
12360
  db.exec(`
12301
12361
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12302
12362
  id TEXT PRIMARY KEY,
@@ -12341,7 +12401,7 @@ function up30(db) {
12341
12401
  ON memory_jobs(failed_at);
12342
12402
  `);
12343
12403
  }
12344
- function up31(db) {
12404
+ function up32(db) {
12345
12405
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12346
12406
  if (!depCols.some((c2) => c2.name === "reason")) {
12347
12407
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12351,7 +12411,7 @@ function up31(db) {
12351
12411
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
12352
12412
  }
12353
12413
  }
12354
- function up32(db) {
12414
+ function up33(db) {
12355
12415
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12356
12416
  if (cols.length === 0)
12357
12417
  return;
@@ -12359,14 +12419,14 @@ function up32(db) {
12359
12419
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
12360
12420
  }
12361
12421
  }
12362
- function up33(db) {
12422
+ function up34(db) {
12363
12423
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12364
12424
  if (!cols.some((c2) => c2.name === "scope")) {
12365
12425
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
12366
12426
  }
12367
12427
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
12368
12428
  }
12369
- function up34(db) {
12429
+ function up35(db) {
12370
12430
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12371
12431
  db.exec(`
12372
12432
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12374,7 +12434,7 @@ function up34(db) {
12374
12434
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12375
12435
  `);
12376
12436
  }
12377
- function up35(db) {
12437
+ function up36(db) {
12378
12438
  db.exec(`
12379
12439
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12380
12440
  name, canonical_name,
@@ -12406,13 +12466,13 @@ function up35(db) {
12406
12466
  END
12407
12467
  `);
12408
12468
  }
12409
- function up36(db) {
12469
+ function up37(db) {
12410
12470
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12411
12471
  if (!cols.some((c2) => c2.name === "confidence")) {
12412
12472
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
12413
12473
  }
12414
12474
  }
12415
- function up37(db) {
12475
+ function up38(db) {
12416
12476
  db.exec(`
12417
12477
  CREATE TABLE IF NOT EXISTS entity_communities (
12418
12478
  id TEXT PRIMARY KEY,
@@ -12430,7 +12490,7 @@ function up37(db) {
12430
12490
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
12431
12491
  }
12432
12492
  }
12433
- function up38(db) {
12493
+ function up39(db) {
12434
12494
  db.exec(`
12435
12495
  CREATE TABLE IF NOT EXISTS memory_hints (
12436
12496
  id TEXT PRIMARY KEY,
@@ -12470,7 +12530,7 @@ function up38(db) {
12470
12530
  END
12471
12531
  `);
12472
12532
  }
12473
- function up39(db) {
12533
+ function up40(db) {
12474
12534
  db.exec(`
12475
12535
  DELETE FROM entity_dependencies
12476
12536
  WHERE id NOT IN (
@@ -12488,7 +12548,7 @@ function up39(db) {
12488
12548
  )
12489
12549
  `);
12490
12550
  }
12491
- function up40(db) {
12551
+ function up41(db) {
12492
12552
  db.exec(`
12493
12553
  CREATE TABLE IF NOT EXISTS session_transcripts (
12494
12554
  session_key TEXT PRIMARY KEY,
@@ -12511,7 +12571,7 @@ function addColumnIfMissing10(db, table, column, definition) {
12511
12571
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12512
12572
  }
12513
12573
  }
12514
- function up41(db) {
12574
+ function up42(db) {
12515
12575
  addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
12516
12576
  db.exec(`
12517
12577
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -12586,7 +12646,7 @@ function addColumnIfMissing11(db, table, column, definition) {
12586
12646
  return;
12587
12647
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12588
12648
  }
12589
- function up42(db) {
12649
+ function up43(db) {
12590
12650
  addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
12591
12651
  addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
12592
12652
  addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12674,7 +12734,7 @@ function addColumnIfMissing12(db, table, column, definition) {
12674
12734
  return;
12675
12735
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12676
12736
  }
12677
- function up43(db) {
12737
+ function up44(db) {
12678
12738
  db.exec(`
12679
12739
  CREATE TABLE IF NOT EXISTS agents (
12680
12740
  id TEXT PRIMARY KEY,
@@ -12703,7 +12763,7 @@ function addColumnIfMissing13(db, table, column, definition) {
12703
12763
  return;
12704
12764
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12705
12765
  }
12706
- function up44(db) {
12766
+ function up45(db) {
12707
12767
  addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
12708
12768
  addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
12709
12769
  addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
@@ -12729,7 +12789,7 @@ function addColumnIfMissing14(db, table, column, definition) {
12729
12789
  return;
12730
12790
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12731
12791
  }
12732
- function up45(db) {
12792
+ function up46(db) {
12733
12793
  addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
12734
12794
  addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12735
12795
  addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -12800,7 +12860,7 @@ function up45(db) {
12800
12860
  ON memory_md_heads(lease_expires_at);
12801
12861
  `);
12802
12862
  }
12803
- function up46(db) {
12863
+ function up47(db) {
12804
12864
  db.exec(`
12805
12865
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12806
12866
 
@@ -12861,7 +12921,7 @@ function up46(db) {
12861
12921
  AND COALESCE(source_type, 'summary') = 'summary';
12862
12922
  `);
12863
12923
  }
12864
- function up47(db) {
12924
+ function up48(db) {
12865
12925
  db.exec(`
12866
12926
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12867
12927
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -12959,7 +13019,7 @@ function up47(db) {
12959
13019
  AND COALESCE(source_type, 'summary') = 'summary';
12960
13020
  `);
12961
13021
  }
12962
- function up48(db) {
13022
+ function up49(db) {
12963
13023
  db.exec(`
12964
13024
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
12965
13025
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13077,7 +13137,7 @@ function up48(db) {
13077
13137
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
13078
13138
  `);
13079
13139
  }
13080
- function up49(db) {
13140
+ function up50(db) {
13081
13141
  db.exec(`
13082
13142
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13083
13143
  session_key TEXT NOT NULL,
@@ -13094,7 +13154,7 @@ function hasTable(db, name) {
13094
13154
  WHERE type = 'table' AND name = ?
13095
13155
  LIMIT 1`).get(name) !== undefined;
13096
13156
  }
13097
- function up50(db) {
13157
+ function up51(db) {
13098
13158
  db.exec(`
13099
13159
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13100
13160
  id TEXT PRIMARY KEY,
@@ -13264,7 +13324,7 @@ function addColumnIfMissing15(db, table, column, definition) {
13264
13324
  return;
13265
13325
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13266
13326
  }
13267
- function up51(db) {
13327
+ function up52(db) {
13268
13328
  addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13269
13329
  addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13270
13330
  addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
@@ -13356,7 +13416,7 @@ function up51(db) {
13356
13416
  VALUES ('rebuild');
13357
13417
  `);
13358
13418
  }
13359
- function up52(db) {
13419
+ function up53(db) {
13360
13420
  db.exec(`
13361
13421
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13362
13422
  id TEXT PRIMARY KEY,
@@ -13373,7 +13433,7 @@ function up52(db) {
13373
13433
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13374
13434
  `);
13375
13435
  }
13376
- function up53(db) {
13436
+ function up54(db) {
13377
13437
  db.exec(`
13378
13438
  CREATE TABLE IF NOT EXISTS skill_invocations (
13379
13439
  id TEXT PRIMARY KEY,
@@ -13389,7 +13449,7 @@ function up53(db) {
13389
13449
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
13390
13450
  `);
13391
13451
  }
13392
- function up54(db) {
13452
+ function up55(db) {
13393
13453
  db.exec(`
13394
13454
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13395
13455
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13420,7 +13480,7 @@ function up54(db) {
13420
13480
  ON task_scope_hints(agent_id, updated_at);
13421
13481
  `);
13422
13482
  }
13423
- function up55(db) {
13483
+ function up56(db) {
13424
13484
  db.exec(`
13425
13485
  CREATE TABLE IF NOT EXISTS dreaming_state (
13426
13486
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13463,7 +13523,7 @@ function ensureMemoriesScopeColumns(db) {
13463
13523
  if (!names.has("scope"))
13464
13524
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13465
13525
  }
13466
- function up56(db) {
13526
+ function up57(db) {
13467
13527
  ensureMemoriesScopeColumns(db);
13468
13528
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13469
13529
  db.exec(`
@@ -13476,20 +13536,20 @@ function up56(db) {
13476
13536
  WHERE content_hash IS NOT NULL AND is_deleted = 0
13477
13537
  `);
13478
13538
  }
13479
- function up57(db) {
13539
+ function up58(db) {
13480
13540
  const sql = readMemoriesFtsSql(db);
13481
13541
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13482
13542
  return;
13483
13543
  recreateMemoriesFts(db);
13484
13544
  }
13485
- function up58(db) {
13545
+ function up59(db) {
13486
13546
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13487
13547
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13488
13548
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
13489
13549
  ON entities(entity_type, mentions)
13490
13550
  WHERE entity_type = 'extracted'`);
13491
13551
  }
13492
- function up59(db) {
13552
+ function up60(db) {
13493
13553
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13494
13554
  if (!cols.some((col) => col.name === "claim_key")) {
13495
13555
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13498,7 +13558,7 @@ function up59(db) {
13498
13558
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
13499
13559
  WHERE claim_key IS NOT NULL`);
13500
13560
  }
13501
- function up60(db) {
13561
+ function up61(db) {
13502
13562
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13503
13563
  if (!cols.some((col) => col.name === "group_key")) {
13504
13564
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13510,13 +13570,13 @@ function up60(db) {
13510
13570
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
13511
13571
  WHERE claim_key IS NOT NULL`);
13512
13572
  }
13513
- function up61(db) {
13573
+ function up62(db) {
13514
13574
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13515
13575
  if (cols.some((col) => col.name === "source_mtime_ms"))
13516
13576
  return;
13517
13577
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
13518
13578
  }
13519
- function up62(db) {
13579
+ function up63(db) {
13520
13580
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13521
13581
  const names = new Set(cols.map((col) => col.name));
13522
13582
  if (!names.has("is_deleted")) {
@@ -13530,7 +13590,7 @@ function up62(db) {
13530
13590
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
13531
13591
  `);
13532
13592
  }
13533
- function up63(db) {
13593
+ function up64(db) {
13534
13594
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13535
13595
  db.exec(`
13536
13596
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13548,7 +13608,7 @@ function addColumnIfMissing16(db, table, column, definition) {
13548
13608
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13549
13609
  }
13550
13610
  }
13551
- function up64(db) {
13611
+ function up65(db) {
13552
13612
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13553
13613
  addColumnIfMissing16(db, table, "source_id", "TEXT");
13554
13614
  addColumnIfMissing16(db, table, "source_kind", "TEXT");
@@ -13568,7 +13628,7 @@ function hasColumn7(db, table, column) {
13568
13628
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13569
13629
  return rows.some((row) => row.name === column);
13570
13630
  }
13571
- function up65(db) {
13631
+ function up66(db) {
13572
13632
  if (!hasTable2(db, "embeddings"))
13573
13633
  return;
13574
13634
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13576,7 +13636,7 @@ function up65(db) {
13576
13636
  }
13577
13637
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
13578
13638
  }
13579
- function up66(db) {
13639
+ function up67(db) {
13580
13640
  db.exec(`
13581
13641
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13582
13642
  id TEXT PRIMARY KEY,
@@ -13617,7 +13677,7 @@ function addColumnIfMissing17(db, table, column, definition) {
13617
13677
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13618
13678
  }
13619
13679
  }
13620
- function up67(db) {
13680
+ function up68(db) {
13621
13681
  db.exec(`
13622
13682
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13623
13683
  id TEXT PRIMARY KEY,
@@ -13660,7 +13720,7 @@ function up67(db) {
13660
13720
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
13661
13721
  }
13662
13722
  }
13663
- function up68(db) {
13723
+ function up69(db) {
13664
13724
  db.exec(`
13665
13725
  CREATE TABLE IF NOT EXISTS daily_reflections (
13666
13726
  id TEXT PRIMARY KEY,
@@ -13687,7 +13747,7 @@ function up68(db) {
13687
13747
  WHERE content_key IS NOT NULL;
13688
13748
  `);
13689
13749
  }
13690
- function up69(db) {
13750
+ function up70(db) {
13691
13751
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13692
13752
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
13693
13753
  if (!colNames.has("content_key")) {
@@ -13724,7 +13784,7 @@ function backfillVersionRoots(db) {
13724
13784
  WHERE version_root_id IS NULL
13725
13785
  `);
13726
13786
  }
13727
- function up70(db) {
13787
+ function up71(db) {
13728
13788
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13729
13789
  addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13730
13790
  addColumnIfMissing18(db, table, "archived_at", "TEXT");
@@ -13759,7 +13819,7 @@ function up70(db) {
13759
13819
  ON entity_aspects(agent_id, proposal_id);
13760
13820
  `);
13761
13821
  }
13762
- function up71(db) {
13822
+ function up72(db) {
13763
13823
  db.exec(`
13764
13824
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13765
13825
  id TEXT PRIMARY KEY,
@@ -13815,7 +13875,7 @@ function ensureMemoriesScopeColumns2(db) {
13815
13875
  if (!names.has("runtime_path"))
13816
13876
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13817
13877
  }
13818
- function up72(db) {
13878
+ function up73(db) {
13819
13879
  ensureMemoriesScopeColumns2(db);
13820
13880
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13821
13881
  db.exec(`
@@ -13829,7 +13889,7 @@ function up72(db) {
13829
13889
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
13830
13890
  `);
13831
13891
  }
13832
- function up73(db) {
13892
+ function up74(db) {
13833
13893
  db.exec(`
13834
13894
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13835
13895
  session_key TEXT NOT NULL,
@@ -13864,7 +13924,7 @@ function up73(db) {
13864
13924
  ON session_recall_events(item_kind, item_id, created_at DESC);
13865
13925
  `);
13866
13926
  }
13867
- function up74(db) {
13927
+ function up75(db) {
13868
13928
  db.exec(`
13869
13929
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13870
13930
  aggregate_memory_id TEXT NOT NULL,
@@ -13883,7 +13943,7 @@ function addColumnIfMissing19(db, table, column, definition) {
13883
13943
  return;
13884
13944
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13885
13945
  }
13886
- function up75(db) {
13946
+ function up76(db) {
13887
13947
  addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
13888
13948
  addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
13889
13949
  addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -13896,7 +13956,7 @@ function up75(db) {
13896
13956
  ON memory_artifacts(agent_id, source_id, source_root);
13897
13957
  `);
13898
13958
  }
13899
- function up76(db) {
13959
+ function up77(db) {
13900
13960
  db.exec(`
13901
13961
  CREATE TABLE IF NOT EXISTS temporal_edges (
13902
13962
  id TEXT PRIMARY KEY,
@@ -13919,7 +13979,7 @@ function up76(db) {
13919
13979
  ON temporal_edges(agent_id, subject_type, subject_id);
13920
13980
  `);
13921
13981
  }
13922
- function up77(db) {
13982
+ function up78(db) {
13923
13983
  db.exec(`
13924
13984
  CREATE TABLE IF NOT EXISTS entity_aliases (
13925
13985
  id TEXT PRIMARY KEY,
@@ -13943,7 +14003,7 @@ function up77(db) {
13943
14003
  ON entity_aliases(agent_id, canonical_alias, status);
13944
14004
  `);
13945
14005
  }
13946
- function up78(db) {
14006
+ function up79(db) {
13947
14007
  db.exec(`
13948
14008
  CREATE TABLE IF NOT EXISTS api_keys (
13949
14009
  id TEXT PRIMARY KEY,
@@ -13971,7 +14031,7 @@ function up78(db) {
13971
14031
  ON api_keys(connector, harness);
13972
14032
  `);
13973
14033
  }
13974
- function up79(db) {
14034
+ function up80(db) {
13975
14035
  db.exec(`
13976
14036
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
13977
14037
  id TEXT PRIMARY KEY,
@@ -14006,7 +14066,7 @@ function hasColumn10(db, table, column) {
14006
14066
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14007
14067
  return rows.some((row) => row.name === column);
14008
14068
  }
14009
- function up80(db) {
14069
+ function up81(db) {
14010
14070
  if (!hasColumn10(db, "documents", "agent_id")) {
14011
14071
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
14012
14072
  }
@@ -14092,7 +14152,7 @@ function up80(db) {
14092
14152
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
14093
14153
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
14094
14154
  }
14095
- function up81(db) {
14155
+ function up82(db) {
14096
14156
  db.exec(`
14097
14157
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14098
14158
  aggregate_memory_id TEXT NOT NULL,
@@ -14114,7 +14174,7 @@ function hasColumn11(db, table, column) {
14114
14174
  return rows.some((row) => row.name === column);
14115
14175
  }
14116
14176
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14117
- function up82(db) {
14177
+ function up83(db) {
14118
14178
  for (const column of COLUMNS) {
14119
14179
  if (!hasColumn11(db, "skill_invocations", column)) {
14120
14180
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14195,7 +14255,7 @@ function documentScopeColumnsPreservingExisting(db) {
14195
14255
  `);
14196
14256
  }
14197
14257
  try {
14198
- up80(db);
14258
+ up81(db);
14199
14259
  if (preserveAgentId) {
14200
14260
  db.exec(`
14201
14261
  UPDATE documents
@@ -14215,12 +14275,12 @@ function documentScopeColumnsPreservingExisting(db) {
14215
14275
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14216
14276
  }
14217
14277
  }
14218
- function up83(db) {
14219
- up79(db);
14278
+ function up84(db) {
14279
+ up80(db);
14220
14280
  if (hasTable3(db, "documents")) {
14221
14281
  documentScopeColumnsPreservingExisting(db);
14222
14282
  }
14223
- up81(db);
14283
+ up82(db);
14224
14284
  addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14225
14285
  addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14226
14286
  addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
@@ -14277,7 +14337,7 @@ function up83(db) {
14277
14337
  AND ${sourceAgentId} = ${targetAgentId}
14278
14338
  `);
14279
14339
  }
14280
- function up84(db) {
14340
+ function up85(db) {
14281
14341
  db.exec(`
14282
14342
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14283
14343
  path TEXT PRIMARY KEY,
@@ -14307,7 +14367,7 @@ function up84(db) {
14307
14367
  ON legacy_markdown_chunks(memory_id);
14308
14368
  `);
14309
14369
  }
14310
- function up85(db) {
14370
+ function up86(db) {
14311
14371
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14312
14372
  const tableNames = new Set(tables.map((r2) => String(r2.name)));
14313
14373
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14366,7 +14426,7 @@ function addColumnIfMissing21(db, table, column, definition) {
14366
14426
  return;
14367
14427
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14368
14428
  }
14369
- function up86(db) {
14429
+ function up87(db) {
14370
14430
  addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
14371
14431
  db.exec(`
14372
14432
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -14379,14 +14439,14 @@ function addColumnIfMissing22(db, table, column, definition) {
14379
14439
  return;
14380
14440
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14381
14441
  }
14382
- function up87(db) {
14442
+ function up88(db) {
14383
14443
  addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
14384
14444
  db.exec(`
14385
14445
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
14386
14446
  ON summary_jobs(agent_id, session_key, boundary_reason)
14387
14447
  `);
14388
14448
  }
14389
- function up88(db) {
14449
+ function up89(db) {
14390
14450
  db.exec(`
14391
14451
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14392
14452
  agent_id TEXT NOT NULL,
@@ -14404,7 +14464,7 @@ function up88(db) {
14404
14464
  ON transcript_capture_jobs(agent_id, session_id, status);
14405
14465
  `);
14406
14466
  }
14407
- function up89(db) {
14467
+ function up90(db) {
14408
14468
  db.exec(`
14409
14469
  CREATE TABLE IF NOT EXISTS job_cancellations (
14410
14470
  id TEXT PRIMARY KEY,
@@ -14432,7 +14492,7 @@ function indexExists(db, table, indexName) {
14432
14492
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14433
14493
  return rows.some((row) => row.name === indexName);
14434
14494
  }
14435
- function up90(db) {
14495
+ function up91(db) {
14436
14496
  db.exec(`
14437
14497
  CREATE TABLE IF NOT EXISTS job_archive (
14438
14498
  id TEXT PRIMARY KEY,
@@ -14459,7 +14519,7 @@ function indexExists2(db, table, indexName) {
14459
14519
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14460
14520
  return rows.some((row) => row.name === indexName);
14461
14521
  }
14462
- function up91(db) {
14522
+ function up92(db) {
14463
14523
  db.exec(`
14464
14524
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14465
14525
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14472,7 +14532,7 @@ function up91(db) {
14472
14532
  )
14473
14533
  `);
14474
14534
  }
14475
- function up92(db) {
14535
+ function up93(db) {
14476
14536
  db.exec(`
14477
14537
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14478
14538
  id TEXT PRIMARY KEY,
@@ -14491,7 +14551,7 @@ function up92(db) {
14491
14551
  ON embeddings_staging(agent_id, source_type, source_id);
14492
14552
  `);
14493
14553
  }
14494
- function up93(db) {
14554
+ function up94(db) {
14495
14555
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14496
14556
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14497
14557
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14502,7 +14562,7 @@ function hasColumn13(db, table, column) {
14502
14562
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14503
14563
  return rows.some((r2) => r2.name === column);
14504
14564
  }
14505
- function up94(db) {
14565
+ function up95(db) {
14506
14566
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14507
14567
  if (tables.length === 0)
14508
14568
  return;
@@ -14527,23 +14587,23 @@ function up94(db) {
14527
14587
  function hasColumn14(db, table, column) {
14528
14588
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14529
14589
  }
14530
- function up95(db) {
14590
+ function up96(db) {
14531
14591
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14532
14592
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14533
14593
  return;
14534
14594
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
14535
14595
  }
14536
- function up96(db) {
14596
+ function up97(db) {
14537
14597
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14538
14598
  }
14539
- function up97(db) {
14599
+ function up98(db) {
14540
14600
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14541
14601
  if (!columns.some((column) => column.name === "last_failure_at")) {
14542
14602
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
14543
14603
  }
14544
14604
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
14545
14605
  }
14546
- function up98(db) {
14606
+ function up99(db) {
14547
14607
  db.exec(`
14548
14608
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14549
14609
  agent_id TEXT NOT NULL,
@@ -14560,7 +14620,7 @@ function up98(db) {
14560
14620
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
14561
14621
  `);
14562
14622
  }
14563
- function up99(db) {
14623
+ function up100(db) {
14564
14624
  db.exec(`
14565
14625
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14566
14626
  id TEXT PRIMARY KEY,
@@ -14580,7 +14640,7 @@ function up99(db) {
14580
14640
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
14581
14641
  `);
14582
14642
  }
14583
- function up100(db) {
14643
+ function up101(db) {
14584
14644
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14585
14645
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14586
14646
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14589,7 +14649,7 @@ function up100(db) {
14589
14649
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
14590
14650
  }
14591
14651
  }
14592
- function up101(db) {
14652
+ function up102(db) {
14593
14653
  db.exec(`
14594
14654
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14595
14655
  id TEXT PRIMARY KEY,
@@ -14611,7 +14671,7 @@ function up101(db) {
14611
14671
  function hasColumn15(db, table, column) {
14612
14672
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14613
14673
  }
14614
- function up102(db) {
14674
+ function up103(db) {
14615
14675
  const requiredMemoryColumns = [
14616
14676
  "content_hash",
14617
14677
  "normalized_content",
@@ -14662,7 +14722,7 @@ function up102(db) {
14662
14722
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
14663
14723
  `);
14664
14724
  }
14665
- function up103(db) {
14725
+ function up104(db) {
14666
14726
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14667
14727
  if (tables.length !== 2)
14668
14728
  return;
@@ -14685,7 +14745,7 @@ function tableExists(db, table) {
14685
14745
  function hasColumn16(db, table, column) {
14686
14746
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14687
14747
  }
14688
- function up104(db) {
14748
+ function up105(db) {
14689
14749
  db.exec(`
14690
14750
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14691
14751
  derived_memory_id TEXT NOT NULL,
@@ -14728,7 +14788,7 @@ function up104(db) {
14728
14788
  `);
14729
14789
  }
14730
14790
  }
14731
- function up105(db) {
14791
+ function up106(db) {
14732
14792
  db.exec(`
14733
14793
  DROP TRIGGER IF EXISTS entities_fts_ai;
14734
14794
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -14817,7 +14877,7 @@ function up105(db) {
14817
14877
  function hasColumn17(db, table, column) {
14818
14878
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14819
14879
  }
14820
- function up106(db) {
14880
+ function up107(db) {
14821
14881
  if (!hasColumn17(db, "memories", "review_after")) {
14822
14882
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
14823
14883
  }
@@ -14833,14 +14893,14 @@ var TOKEN_COLUMNS = [
14833
14893
  ["tokens_cache_write", "INTEGER"],
14834
14894
  ["tokens_cost", "REAL"]
14835
14895
  ];
14836
- function up107(db) {
14896
+ function up108(db) {
14837
14897
  for (const [column, type] of TOKEN_COLUMNS) {
14838
14898
  if (!hasColumn18(db, "dreaming_passes", column)) {
14839
14899
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14840
14900
  }
14841
14901
  }
14842
14902
  }
14843
- function up108(db) {
14903
+ function up109(db) {
14844
14904
  db.exec(`
14845
14905
  CREATE TABLE IF NOT EXISTS embedding_usage (
14846
14906
  day TEXT NOT NULL,
@@ -14853,7 +14913,7 @@ function up108(db) {
14853
14913
  );
14854
14914
  `);
14855
14915
  }
14856
- function up109(db) {
14916
+ function up110(db) {
14857
14917
  db.exec(`
14858
14918
  CREATE TABLE IF NOT EXISTS telemetry_install (
14859
14919
  id TEXT PRIMARY KEY,
@@ -14861,7 +14921,7 @@ function up109(db) {
14861
14921
  );
14862
14922
  `);
14863
14923
  }
14864
- function up110(db) {
14924
+ function up111(db) {
14865
14925
  db.exec(`
14866
14926
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14867
14927
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14872,7 +14932,7 @@ function hasColumn19(db, table, column) {
14872
14932
  return rows.some((row) => row.name === column);
14873
14933
  }
14874
14934
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14875
- function up111(db) {
14935
+ function up112(db) {
14876
14936
  for (const column of COLUMNS2) {
14877
14937
  if (!hasColumn19(db, "telemetry_install", column)) {
14878
14938
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14888,7 +14948,7 @@ function addColumnIfMissing23(db, column, definition) {
14888
14948
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14889
14949
  }
14890
14950
  }
14891
- function up112(db) {
14951
+ function up113(db) {
14892
14952
  addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14893
14953
  addColumnIfMissing23(db, "claim_token", "TEXT");
14894
14954
  addColumnIfMissing23(db, "claimed_at", "TEXT");
@@ -14897,7 +14957,7 @@ function up112(db) {
14897
14957
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14898
14958
  `);
14899
14959
  }
14900
- function up113(db) {
14960
+ function up114(db) {
14901
14961
  db.exec(`
14902
14962
  CREATE TABLE IF NOT EXISTS session_claims (
14903
14963
  session_key TEXT NOT NULL,
@@ -14918,7 +14978,7 @@ function up113(db) {
14918
14978
  ON session_claims(agent_id, state, expires_at);
14919
14979
  `);
14920
14980
  }
14921
- function up114(db) {
14981
+ function up115(db) {
14922
14982
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
14923
14983
  if (table == null)
14924
14984
  return;
@@ -14927,7 +14987,7 @@ function up114(db) {
14927
14987
  ON entity_attributes(memory_id, agent_id, status, importance);
14928
14988
  `);
14929
14989
  }
14930
- function up115(db) {
14990
+ function up116(db) {
14931
14991
  db.exec(`
14932
14992
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
14933
14993
  id TEXT PRIMARY KEY,
@@ -14984,7 +15044,7 @@ function addColumnIfMissing24(db, column, definition) {
14984
15044
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
14985
15045
  }
14986
15046
  }
14987
- function up116(db) {
15047
+ function up117(db) {
14988
15048
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
14989
15049
  if (table == null)
14990
15050
  return;
@@ -15185,7 +15245,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15185
15245
  insert.run(...values);
15186
15246
  }
15187
15247
  }
15188
- function up117(db) {
15248
+ function up118(db) {
15189
15249
  if (!hasTable4(db, "session_transcripts"))
15190
15250
  return;
15191
15251
  addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
@@ -15238,7 +15298,7 @@ function up117(db) {
15238
15298
  ON session_transcripts(agent_id, content_hash);
15239
15299
  `);
15240
15300
  }
15241
- function up118(db) {
15301
+ function up119(db) {
15242
15302
  db.exec(`
15243
15303
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15244
15304
  ON memory_jobs(status)
@@ -15257,12 +15317,12 @@ function up118(db) {
15257
15317
  function hasColumn22(db, table, column) {
15258
15318
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15259
15319
  }
15260
- function up119(db) {
15320
+ function up120(db) {
15261
15321
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15262
15322
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15263
15323
  }
15264
15324
  }
15265
- function up120(db) {
15325
+ function up121(db) {
15266
15326
  db.exec(`
15267
15327
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15268
15328
  agent_id TEXT NOT NULL,
@@ -15291,7 +15351,7 @@ function addColumnIfMissing26(db, column, definition) {
15291
15351
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15292
15352
  }
15293
15353
  }
15294
- function up121(db) {
15354
+ function up122(db) {
15295
15355
  addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15296
15356
  addColumnIfMissing26(db, "last_attempt_at", "TEXT");
15297
15357
  addColumnIfMissing26(db, "sent_at", "TEXT");
@@ -15312,7 +15372,7 @@ function up121(db) {
15312
15372
  VALUES (1, CURRENT_TIMESTAMP);
15313
15373
  `);
15314
15374
  }
15315
- function up122(db) {
15375
+ function up123(db) {
15316
15376
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15317
15377
  const names = new Set(columns.map((column) => column.name));
15318
15378
  if (!names.has("failure_class")) {
@@ -15329,7 +15389,7 @@ function up122(db) {
15329
15389
  }
15330
15390
  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)");
15331
15391
  }
15332
- function up123(db) {
15392
+ function up124(db) {
15333
15393
  db.exec(`
15334
15394
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15335
15395
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15353,7 +15413,7 @@ function up123(db) {
15353
15413
  ON embedding_index_failures(source_type, source_id);
15354
15414
  `);
15355
15415
  }
15356
- function up124(db) {
15416
+ function up125(db) {
15357
15417
  db.exec(`
15358
15418
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15359
15419
  id TEXT PRIMARY KEY,
@@ -15403,7 +15463,7 @@ function backfillTable(db, params) {
15403
15463
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15404
15464
  backfill(db, rows, params.sourceKind, params.scannedAt);
15405
15465
  }
15406
- function up125(db) {
15466
+ function up126(db) {
15407
15467
  db.exec(`
15408
15468
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15409
15469
  agent_id TEXT NOT NULL,
@@ -15460,7 +15520,7 @@ function up125(db) {
15460
15520
  scannedAt
15461
15521
  });
15462
15522
  }
15463
- function up126(db) {
15523
+ function up127(db) {
15464
15524
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15465
15525
  if (!table)
15466
15526
  return;
@@ -15494,7 +15554,7 @@ function up126(db) {
15494
15554
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
15495
15555
  `);
15496
15556
  }
15497
- function up127(db) {
15557
+ function up128(db) {
15498
15558
  db.exec(`
15499
15559
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15500
15560
  id TEXT PRIMARY KEY,
@@ -15550,7 +15610,7 @@ function up127(db) {
15550
15610
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
15551
15611
  `);
15552
15612
  }
15553
- function up128(db) {
15613
+ function up129(db) {
15554
15614
  db.exec(`
15555
15615
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15556
15616
  ON memory_jobs(status, created_at)
@@ -15565,7 +15625,7 @@ function up128(db) {
15565
15625
  function tableExists3(db, table) {
15566
15626
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15567
15627
  }
15568
- function up129(db) {
15628
+ function up130(db) {
15569
15629
  if (!tableExists3(db, "memory_jobs"))
15570
15630
  return;
15571
15631
  if (!tableExists3(db, "job_cancellations")) {
@@ -15614,7 +15674,7 @@ function up129(db) {
15614
15674
  AND status IN ('pending', 'leased');
15615
15675
  `);
15616
15676
  }
15617
- function up130(db) {
15677
+ function up131(db) {
15618
15678
  db.exec(`
15619
15679
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15620
15680
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15654,7 +15714,7 @@ function up130(db) {
15654
15714
  END;
15655
15715
  `);
15656
15716
  }
15657
- function up131(db) {
15717
+ function up132(db) {
15658
15718
  db.exec(`
15659
15719
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15660
15720
  agent_id TEXT NOT NULL,
@@ -15677,13 +15737,13 @@ function up131(db) {
15677
15737
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
15678
15738
  `);
15679
15739
  }
15680
- function up132(db) {
15740
+ function up133(db) {
15681
15741
  db.exec(`
15682
15742
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15683
15743
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
15684
15744
  `);
15685
15745
  }
15686
- function up133(db) {
15746
+ function up134(db) {
15687
15747
  db.exec(`
15688
15748
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15689
15749
  id TEXT PRIMARY KEY,
@@ -15735,7 +15795,7 @@ function up133(db) {
15735
15795
  if (!names.has("format_version"))
15736
15796
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
15737
15797
  }
15738
- function up134(db) {
15798
+ function up135(db) {
15739
15799
  db.exec(`
15740
15800
  CREATE TABLE memory_head_entries_v134 (
15741
15801
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15753,7 +15813,7 @@ function up134(db) {
15753
15813
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
15754
15814
  `);
15755
15815
  }
15756
- function up135(db) {
15816
+ function up136(db) {
15757
15817
  db.exec(`
15758
15818
  CREATE TABLE IF NOT EXISTS memory_head_publications (
15759
15819
  agent_id TEXT NOT NULL,
@@ -15769,7 +15829,7 @@ function up135(db) {
15769
15829
  ON memory_head_publications(agent_id, status, revision DESC);
15770
15830
  `);
15771
15831
  }
15772
- function up136(db) {
15832
+ function up137(db) {
15773
15833
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r2) => r2.name));
15774
15834
  for (const [name, type] of [
15775
15835
  ["entry_id", "TEXT"],
@@ -15783,7 +15843,7 @@ function up136(db) {
15783
15843
  }
15784
15844
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
15785
15845
  }
15786
- function up137(db) {
15846
+ function up138(db) {
15787
15847
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r2) => r2.name));
15788
15848
  for (const [name, type] of [
15789
15849
  ["head_revision", "INTEGER"],
@@ -15805,7 +15865,7 @@ function addColumnIfMissing27(db, table, column, definition) {
15805
15865
  if (!hasColumn25(db, table, column))
15806
15866
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15807
15867
  }
15808
- function up138(db) {
15868
+ function up139(db) {
15809
15869
  addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
15810
15870
  db.exec(`
15811
15871
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16110,7 +16170,7 @@ function up138(db) {
16110
16170
  GROUP BY j.agent_id;
16111
16171
  `);
16112
16172
  }
16113
- function up139(db) {
16173
+ function up140(db) {
16114
16174
  db.exec(`
16115
16175
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16116
16176
  agent_id TEXT NOT NULL,
@@ -16126,7 +16186,7 @@ function up139(db) {
16126
16186
  ON native_source_sync_state(agent_id, status);
16127
16187
  `);
16128
16188
  }
16129
- function up140(db) {
16189
+ function up141(db) {
16130
16190
  db.exec(`
16131
16191
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16132
16192
  agent_id TEXT NOT NULL,
@@ -16138,7 +16198,7 @@ function up140(db) {
16138
16198
  );
16139
16199
  `);
16140
16200
  }
16141
- function up141(db) {
16201
+ function up142(db) {
16142
16202
  db.exec(`
16143
16203
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16144
16204
  agent_id TEXT NOT NULL,
@@ -16152,13 +16212,13 @@ function up141(db) {
16152
16212
  );
16153
16213
  `);
16154
16214
  }
16155
- function up142(db) {
16215
+ function up143(db) {
16156
16216
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16157
16217
  if (!columns.some((column) => column.name === "frontier")) {
16158
16218
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
16159
16219
  }
16160
16220
  }
16161
- function up143(db) {
16221
+ function up144(db) {
16162
16222
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16163
16223
  const additions = [
16164
16224
  ["migration_phase", "TEXT"],
@@ -16193,13 +16253,13 @@ function up143(db) {
16193
16253
  `);
16194
16254
  }
16195
16255
  }
16196
- function up144(db) {
16256
+ function up145(db) {
16197
16257
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16198
16258
  if (!columns.has("lease_token")) {
16199
16259
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
16200
16260
  }
16201
16261
  }
16202
- function up145(db) {
16262
+ function up146(db) {
16203
16263
  db.exec(`
16204
16264
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16205
16265
  agent_id TEXT NOT NULL,
@@ -16217,7 +16277,7 @@ function up145(db) {
16217
16277
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
16218
16278
  `);
16219
16279
  }
16220
- function up146(db) {
16280
+ function up147(db) {
16221
16281
  db.exec(`
16222
16282
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16223
16283
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16272,24 +16332,36 @@ function up146(db) {
16272
16332
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
16273
16333
  `);
16274
16334
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
16275
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
16335
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
16336
+ let exists;
16337
+ try {
16338
+ exists = statement.get(column);
16339
+ } finally {
16340
+ statement.finalize?.();
16341
+ }
16276
16342
  if (exists == null)
16277
16343
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
16278
16344
  }
16279
16345
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
16280
16346
  }
16281
- function up147(db) {
16347
+ function up148(db) {
16282
16348
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16283
16349
  }
16284
- function up148(db) {
16350
+ function up149(db) {
16285
16351
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16286
16352
  if (!columns.some((column) => column.name === "source_id")) {
16287
16353
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
16288
16354
  }
16289
16355
  }
16290
- function up149(db) {
16356
+ function up150(db) {
16291
16357
  const addColumn = (table, column, definition) => {
16292
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
16358
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16359
+ let exists;
16360
+ try {
16361
+ exists = statement.get(table, column);
16362
+ } finally {
16363
+ statement.finalize?.();
16364
+ }
16293
16365
  if (exists == null)
16294
16366
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16295
16367
  };
@@ -16302,7 +16374,7 @@ function addColumnIfMissing28(db, table, column, definition) {
16302
16374
  if (!columns.some((row) => row.name === column))
16303
16375
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16304
16376
  }
16305
- function up150(db) {
16377
+ function up151(db) {
16306
16378
  addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16307
16379
  addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
16308
16380
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -16456,13 +16528,13 @@ var MIGRATIONS = [
16456
16528
  {
16457
16529
  version: 1,
16458
16530
  name: "baseline",
16459
- up,
16531
+ up: up2,
16460
16532
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16461
16533
  },
16462
16534
  {
16463
16535
  version: 2,
16464
16536
  name: "pipeline-v2",
16465
- up: up2,
16537
+ up: up3,
16466
16538
  artifacts: {
16467
16539
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16468
16540
  }
@@ -16470,12 +16542,12 @@ var MIGRATIONS = [
16470
16542
  {
16471
16543
  version: 3,
16472
16544
  name: "unique-content-hash",
16473
- up: up3
16545
+ up: up4
16474
16546
  },
16475
16547
  {
16476
16548
  version: 4,
16477
16549
  name: "history-actor-and-retention",
16478
- up: up4,
16550
+ up: up5,
16479
16551
  artifacts: {
16480
16552
  columns: [{ table: "memory_history", column: "actor_type" }]
16481
16553
  }
@@ -16483,7 +16555,7 @@ var MIGRATIONS = [
16483
16555
  {
16484
16556
  version: 5,
16485
16557
  name: "graph-extended",
16486
- up: up5,
16558
+ up: up6,
16487
16559
  artifacts: {
16488
16560
  columns: [{ table: "entities", column: "canonical_name" }]
16489
16561
  }
@@ -16491,7 +16563,7 @@ var MIGRATIONS = [
16491
16563
  {
16492
16564
  version: 6,
16493
16565
  name: "idempotency-key",
16494
- up: up6,
16566
+ up: up7,
16495
16567
  artifacts: {
16496
16568
  columns: [{ table: "memories", column: "idempotency_key" }]
16497
16569
  }
@@ -16499,42 +16571,42 @@ var MIGRATIONS = [
16499
16571
  {
16500
16572
  version: 7,
16501
16573
  name: "documents-and-connectors",
16502
- up: up7,
16574
+ up: up8,
16503
16575
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16504
16576
  },
16505
16577
  {
16506
16578
  version: 8,
16507
16579
  name: "embeddings-unique-hash",
16508
- up: up8
16580
+ up: up9
16509
16581
  },
16510
16582
  {
16511
16583
  version: 9,
16512
16584
  name: "summary-jobs",
16513
- up: up9,
16585
+ up: up10,
16514
16586
  artifacts: { tables: ["summary_jobs"] }
16515
16587
  },
16516
16588
  {
16517
16589
  version: 10,
16518
16590
  name: "umap-cache",
16519
- up: up10,
16591
+ up: up11,
16520
16592
  artifacts: { tables: ["umap_cache"] }
16521
16593
  },
16522
16594
  {
16523
16595
  version: 11,
16524
16596
  name: "session-scores",
16525
- up: up11,
16597
+ up: up12,
16526
16598
  artifacts: { tables: ["session_scores"] }
16527
16599
  },
16528
16600
  {
16529
16601
  version: 12,
16530
16602
  name: "scheduled-tasks",
16531
- up: up12,
16603
+ up: up13,
16532
16604
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16533
16605
  },
16534
16606
  {
16535
16607
  version: 13,
16536
16608
  name: "ingestion-tracking",
16537
- up: up13,
16609
+ up: up14,
16538
16610
  artifacts: {
16539
16611
  columns: [
16540
16612
  { table: "memories", column: "source_path" },
@@ -16545,13 +16617,13 @@ var MIGRATIONS = [
16545
16617
  {
16546
16618
  version: 14,
16547
16619
  name: "telemetry",
16548
- up: up14,
16620
+ up: up15,
16549
16621
  artifacts: { tables: ["telemetry_events"] }
16550
16622
  },
16551
16623
  {
16552
16624
  version: 15,
16553
16625
  name: "session-memories",
16554
- up: up15,
16626
+ up: up16,
16555
16627
  artifacts: {
16556
16628
  tables: ["session_memories"],
16557
16629
  columns: [
@@ -16563,13 +16635,13 @@ var MIGRATIONS = [
16563
16635
  {
16564
16636
  version: 16,
16565
16637
  name: "session-checkpoints",
16566
- up: up16,
16638
+ up: up17,
16567
16639
  artifacts: { tables: ["session_checkpoints"] }
16568
16640
  },
16569
16641
  {
16570
16642
  version: 17,
16571
16643
  name: "task-skills",
16572
- up: up17,
16644
+ up: up18,
16573
16645
  artifacts: {
16574
16646
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16575
16647
  }
@@ -16577,13 +16649,13 @@ var MIGRATIONS = [
16577
16649
  {
16578
16650
  version: 18,
16579
16651
  name: "skill-meta",
16580
- up: up18,
16652
+ up: up19,
16581
16653
  artifacts: { tables: ["skill_meta"] }
16582
16654
  },
16583
16655
  {
16584
16656
  version: 19,
16585
16657
  name: "knowledge-structure",
16586
- up: up19,
16658
+ up: up20,
16587
16659
  artifacts: {
16588
16660
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16589
16661
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16592,7 +16664,7 @@ var MIGRATIONS = [
16592
16664
  {
16593
16665
  version: 20,
16594
16666
  name: "session-structural-columns",
16595
- up: up20,
16667
+ up: up21,
16596
16668
  artifacts: {
16597
16669
  columns: [
16598
16670
  { table: "session_memories", column: "entity_slot" },
@@ -16605,7 +16677,7 @@ var MIGRATIONS = [
16605
16677
  {
16606
16678
  version: 21,
16607
16679
  name: "checkpoint-structural",
16608
- up: up21,
16680
+ up: up22,
16609
16681
  artifacts: {
16610
16682
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16611
16683
  }
@@ -16613,7 +16685,7 @@ var MIGRATIONS = [
16613
16685
  {
16614
16686
  version: 22,
16615
16687
  name: "entity-pinning",
16616
- up: up22,
16688
+ up: up23,
16617
16689
  artifacts: {
16618
16690
  columns: [
16619
16691
  { table: "entities", column: "pinned" },
@@ -16624,17 +16696,17 @@ var MIGRATIONS = [
16624
16696
  {
16625
16697
  version: 23,
16626
16698
  name: "retired-scorer-gap",
16627
- up: up23
16699
+ up: up24
16628
16700
  },
16629
16701
  {
16630
16702
  version: 24,
16631
16703
  name: "retired-scorer-gap",
16632
- up: up24
16704
+ up: up25
16633
16705
  },
16634
16706
  {
16635
16707
  version: 25,
16636
16708
  name: "agent-feedback",
16637
- up: up25,
16709
+ up: up26,
16638
16710
  artifacts: {
16639
16711
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16640
16712
  }
@@ -16642,32 +16714,32 @@ var MIGRATIONS = [
16642
16714
  {
16643
16715
  version: 26,
16644
16716
  name: "retired-scorer-gap",
16645
- up: up26
16717
+ up: up27
16646
16718
  },
16647
16719
  {
16648
16720
  version: 27,
16649
16721
  name: "backfill-canonical-names",
16650
- up: up27
16722
+ up: up28
16651
16723
  },
16652
16724
  {
16653
16725
  version: 28,
16654
16726
  name: "lossless-retention",
16655
- up: up28
16727
+ up: up29
16656
16728
  },
16657
16729
  {
16658
16730
  version: 29,
16659
16731
  name: "session-summary-dag",
16660
- up: up29
16732
+ up: up30
16661
16733
  },
16662
16734
  {
16663
16735
  version: 30,
16664
16736
  name: "nullable-memory-job-memory-id",
16665
- up: up30
16737
+ up: up31
16666
16738
  },
16667
16739
  {
16668
16740
  version: 31,
16669
16741
  name: "dependency-reason",
16670
- up: up31,
16742
+ up: up32,
16671
16743
  artifacts: {
16672
16744
  columns: [
16673
16745
  { table: "entity_dependencies", column: "reason" },
@@ -16678,7 +16750,7 @@ var MIGRATIONS = [
16678
16750
  {
16679
16751
  version: 32,
16680
16752
  name: "embeddings-vector-column",
16681
- up: up32,
16753
+ up: up33,
16682
16754
  artifacts: {
16683
16755
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16684
16756
  }
@@ -16686,7 +16758,7 @@ var MIGRATIONS = [
16686
16758
  {
16687
16759
  version: 33,
16688
16760
  name: "scope",
16689
- up: up33,
16761
+ up: up34,
16690
16762
  artifacts: {
16691
16763
  columns: [{ table: "memories", column: "scope" }]
16692
16764
  }
@@ -16694,17 +16766,17 @@ var MIGRATIONS = [
16694
16766
  {
16695
16767
  version: 34,
16696
16768
  name: "scope-aware-dedup",
16697
- up: up34
16769
+ up: up35
16698
16770
  },
16699
16771
  {
16700
16772
  version: 35,
16701
16773
  name: "entity-fts",
16702
- up: up35
16774
+ up: up36
16703
16775
  },
16704
16776
  {
16705
16777
  version: 36,
16706
16778
  name: "dependency-confidence",
16707
- up: up36,
16779
+ up: up37,
16708
16780
  artifacts: {
16709
16781
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16710
16782
  }
@@ -16712,7 +16784,7 @@ var MIGRATIONS = [
16712
16784
  {
16713
16785
  version: 37,
16714
16786
  name: "entity-communities",
16715
- up: up37,
16787
+ up: up38,
16716
16788
  artifacts: {
16717
16789
  tables: ["entity_communities"],
16718
16790
  columns: [{ table: "entities", column: "community_id" }]
@@ -16721,24 +16793,24 @@ var MIGRATIONS = [
16721
16793
  {
16722
16794
  version: 38,
16723
16795
  name: "memory-hints",
16724
- up: up38,
16796
+ up: up39,
16725
16797
  artifacts: { tables: ["memory_hints"] }
16726
16798
  },
16727
16799
  {
16728
16800
  version: 39,
16729
16801
  name: "dedup-entity-dependencies",
16730
- up: up39
16802
+ up: up40
16731
16803
  },
16732
16804
  {
16733
16805
  version: 40,
16734
16806
  name: "session-transcripts",
16735
- up: up40,
16807
+ up: up41,
16736
16808
  artifacts: { tables: ["session_transcripts"] }
16737
16809
  },
16738
16810
  {
16739
16811
  version: 41,
16740
16812
  name: "path-feedback",
16741
- up: up41,
16813
+ up: up42,
16742
16814
  artifacts: {
16743
16815
  tables: [
16744
16816
  "path_feedback_events",
@@ -16753,7 +16825,7 @@ var MIGRATIONS = [
16753
16825
  {
16754
16826
  version: 42,
16755
16827
  name: "session-memories-agent-id",
16756
- up: up42,
16828
+ up: up43,
16757
16829
  artifacts: {
16758
16830
  columns: [{ table: "session_memories", column: "agent_id" }]
16759
16831
  }
@@ -16761,7 +16833,7 @@ var MIGRATIONS = [
16761
16833
  {
16762
16834
  version: 43,
16763
16835
  name: "agents-table",
16764
- up: up43,
16836
+ up: up44,
16765
16837
  artifacts: {
16766
16838
  tables: ["agents"],
16767
16839
  columns: [
@@ -16773,7 +16845,7 @@ var MIGRATIONS = [
16773
16845
  {
16774
16846
  version: 44,
16775
16847
  name: "memory-md-temporal-head",
16776
- up: up44,
16848
+ up: up45,
16777
16849
  artifacts: {
16778
16850
  columns: [
16779
16851
  { table: "session_summaries", column: "source_type" },
@@ -16785,7 +16857,7 @@ var MIGRATIONS = [
16785
16857
  {
16786
16858
  version: 45,
16787
16859
  name: "lossless-working-memory-hardening",
16788
- up: up45,
16860
+ up: up46,
16789
16861
  artifacts: {
16790
16862
  tables: ["session_transcripts_fts", "memory_md_heads"],
16791
16863
  columns: [
@@ -16798,17 +16870,17 @@ var MIGRATIONS = [
16798
16870
  {
16799
16871
  version: 46,
16800
16872
  name: "session-summary-uniqueness",
16801
- up: up46
16873
+ up: up47
16802
16874
  },
16803
16875
  {
16804
16876
  version: 47,
16805
16877
  name: "agent-scoped-temporal-uniqueness",
16806
- up: up47
16878
+ up: up48
16807
16879
  },
16808
16880
  {
16809
16881
  version: 48,
16810
16882
  name: "thread-heads",
16811
- up: up48,
16883
+ up: up49,
16812
16884
  artifacts: {
16813
16885
  tables: ["memory_thread_heads"]
16814
16886
  }
@@ -16816,7 +16888,7 @@ var MIGRATIONS = [
16816
16888
  {
16817
16889
  version: 49,
16818
16890
  name: "session-extract-cursors",
16819
- up: up49,
16891
+ up: up50,
16820
16892
  artifacts: {
16821
16893
  tables: ["session_extract_cursors"]
16822
16894
  }
@@ -16824,7 +16896,7 @@ var MIGRATIONS = [
16824
16896
  {
16825
16897
  version: 50,
16826
16898
  name: "related-to-audit",
16827
- up: up50,
16899
+ up: up51,
16828
16900
  artifacts: {
16829
16901
  tables: ["entity_dependency_history"]
16830
16902
  }
@@ -16832,7 +16904,7 @@ var MIGRATIONS = [
16832
16904
  {
16833
16905
  version: 51,
16834
16906
  name: "memory-md-rolling-window-lineage",
16835
- up: up51,
16907
+ up: up52,
16836
16908
  artifacts: {
16837
16909
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16838
16910
  columns: [
@@ -16847,7 +16919,7 @@ var MIGRATIONS = [
16847
16919
  {
16848
16920
  version: 52,
16849
16921
  name: "mcp-invocations",
16850
- up: up52,
16922
+ up: up53,
16851
16923
  artifacts: {
16852
16924
  tables: ["mcp_invocations"]
16853
16925
  }
@@ -16855,7 +16927,7 @@ var MIGRATIONS = [
16855
16927
  {
16856
16928
  version: 53,
16857
16929
  name: "skill-invocations",
16858
- up: up53,
16930
+ up: up54,
16859
16931
  artifacts: {
16860
16932
  tables: ["skill_invocations"]
16861
16933
  }
@@ -16863,7 +16935,7 @@ var MIGRATIONS = [
16863
16935
  {
16864
16936
  version: 54,
16865
16937
  name: "task-agent-scope",
16866
- up: up54,
16938
+ up: up55,
16867
16939
  artifacts: {
16868
16940
  tables: ["task_scope_hints"]
16869
16941
  }
@@ -16871,7 +16943,7 @@ var MIGRATIONS = [
16871
16943
  {
16872
16944
  version: 55,
16873
16945
  name: "dreaming-state",
16874
- up: up55,
16946
+ up: up56,
16875
16947
  artifacts: {
16876
16948
  tables: ["dreaming_state", "dreaming_passes"]
16877
16949
  }
@@ -16879,22 +16951,22 @@ var MIGRATIONS = [
16879
16951
  {
16880
16952
  version: 56,
16881
16953
  name: "agent-scoped-content-hash",
16882
- up: up56
16954
+ up: up57
16883
16955
  },
16884
16956
  {
16885
16957
  version: 57,
16886
16958
  name: "memories-fts-tokenizer-repair",
16887
- up: up57
16959
+ up: up58
16888
16960
  },
16889
16961
  {
16890
16962
  version: 58,
16891
16963
  name: "knowledge-graph-indices",
16892
- up: up58
16964
+ up: up59
16893
16965
  },
16894
16966
  {
16895
16967
  version: 59,
16896
16968
  name: "entity-attribute-claim-key",
16897
- up: up59,
16969
+ up: up60,
16898
16970
  artifacts: {
16899
16971
  columns: [{ table: "entity_attributes", column: "claim_key" }]
16900
16972
  }
@@ -16902,7 +16974,7 @@ var MIGRATIONS = [
16902
16974
  {
16903
16975
  version: 60,
16904
16976
  name: "entity-attribute-group-key",
16905
- up: up60,
16977
+ up: up61,
16906
16978
  artifacts: {
16907
16979
  columns: [{ table: "entity_attributes", column: "group_key" }]
16908
16980
  }
@@ -16910,7 +16982,7 @@ var MIGRATIONS = [
16910
16982
  {
16911
16983
  version: 61,
16912
16984
  name: "memory-artifact-source-mtime",
16913
- up: up61,
16985
+ up: up62,
16914
16986
  artifacts: {
16915
16987
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
16916
16988
  }
@@ -16918,7 +16990,7 @@ var MIGRATIONS = [
16918
16990
  {
16919
16991
  version: 62,
16920
16992
  name: "memory-artifact-soft-delete",
16921
- up: up62,
16993
+ up: up63,
16922
16994
  artifacts: {
16923
16995
  columns: [
16924
16996
  { table: "memory_artifacts", column: "is_deleted" },
@@ -16929,12 +17001,12 @@ var MIGRATIONS = [
16929
17001
  {
16930
17002
  version: 63,
16931
17003
  name: "content-only-memories-fts-update",
16932
- up: up63
17004
+ up: up64
16933
17005
  },
16934
17006
  {
16935
17007
  version: 64,
16936
17008
  name: "source-graph-provenance",
16937
- up: up64,
17009
+ up: up65,
16938
17010
  artifacts: {
16939
17011
  columns: [
16940
17012
  { table: "entities", column: "source_path" },
@@ -16947,7 +17019,7 @@ var MIGRATIONS = [
16947
17019
  {
16948
17020
  version: 65,
16949
17021
  name: "source-embedding-agent-scope",
16950
- up: up65,
17022
+ up: up66,
16951
17023
  artifacts: {
16952
17024
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
16953
17025
  }
@@ -16955,7 +17027,7 @@ var MIGRATIONS = [
16955
17027
  {
16956
17028
  version: 66,
16957
17029
  name: "memory-search-telemetry",
16958
- up: up66,
17030
+ up: up67,
16959
17031
  artifacts: {
16960
17032
  tables: ["memory_search_telemetry"]
16961
17033
  }
@@ -16963,7 +17035,7 @@ var MIGRATIONS = [
16963
17035
  {
16964
17036
  version: 67,
16965
17037
  name: "ontology-proposals",
16966
- up: up67,
17038
+ up: up68,
16967
17039
  artifacts: {
16968
17040
  tables: ["ontology_proposals"],
16969
17041
  columns: [
@@ -16977,7 +17049,7 @@ var MIGRATIONS = [
16977
17049
  {
16978
17050
  version: 68,
16979
17051
  name: "daily-reflections",
16980
- up: up68,
17052
+ up: up69,
16981
17053
  artifacts: {
16982
17054
  tables: ["daily_reflections"]
16983
17055
  }
@@ -16985,7 +17057,7 @@ var MIGRATIONS = [
16985
17057
  {
16986
17058
  version: 69,
16987
17059
  name: "daily-reflections-multiple-insights",
16988
- up: up69,
17060
+ up: up70,
16989
17061
  artifacts: {
16990
17062
  tables: ["daily_reflections"]
16991
17063
  }
@@ -16993,7 +17065,7 @@ var MIGRATIONS = [
16993
17065
  {
16994
17066
  version: 70,
16995
17067
  name: "ontology-control-plane-state",
16996
- up: up70,
17068
+ up: up71,
16997
17069
  artifacts: {
16998
17070
  columns: [
16999
17071
  { table: "entities", column: "status" },
@@ -17008,7 +17080,7 @@ var MIGRATIONS = [
17008
17080
  {
17009
17081
  version: 71,
17010
17082
  name: "epistemic-assertions",
17011
- up: up71,
17083
+ up: up72,
17012
17084
  artifacts: {
17013
17085
  tables: ["epistemic_assertions"]
17014
17086
  }
@@ -17016,7 +17088,7 @@ var MIGRATIONS = [
17016
17088
  {
17017
17089
  version: 72,
17018
17090
  name: "agent-scoped-idempotency-key",
17019
- up: up72,
17091
+ up: up73,
17020
17092
  artifacts: {
17021
17093
  columns: [
17022
17094
  { table: "memories", column: "idempotency_key" },
@@ -17027,7 +17099,7 @@ var MIGRATIONS = [
17027
17099
  {
17028
17100
  version: 73,
17029
17101
  name: "recall-context-dedupe",
17030
- up: up73,
17102
+ up: up74,
17031
17103
  artifacts: {
17032
17104
  tables: ["session_context_epochs", "session_recall_events"]
17033
17105
  }
@@ -17035,7 +17107,7 @@ var MIGRATIONS = [
17035
17107
  {
17036
17108
  version: 74,
17037
17109
  name: "aggregate-memory-links",
17038
- up: up74,
17110
+ up: up75,
17039
17111
  artifacts: {
17040
17112
  tables: ["aggregate_memory_sources"]
17041
17113
  }
@@ -17043,7 +17115,7 @@ var MIGRATIONS = [
17043
17115
  {
17044
17116
  version: 75,
17045
17117
  name: "memory-artifact-source-provenance",
17046
- up: up75,
17118
+ up: up76,
17047
17119
  artifacts: {
17048
17120
  columns: [
17049
17121
  { table: "memory_artifacts", column: "source_id" },
@@ -17057,7 +17129,7 @@ var MIGRATIONS = [
17057
17129
  {
17058
17130
  version: 76,
17059
17131
  name: "temporal-edges",
17060
- up: up76,
17132
+ up: up77,
17061
17133
  artifacts: {
17062
17134
  tables: ["temporal_edges"]
17063
17135
  }
@@ -17065,7 +17137,7 @@ var MIGRATIONS = [
17065
17137
  {
17066
17138
  version: 77,
17067
17139
  name: "entity-aliases",
17068
- up: up77,
17140
+ up: up78,
17069
17141
  artifacts: {
17070
17142
  tables: ["entity_aliases"]
17071
17143
  }
@@ -17073,7 +17145,7 @@ var MIGRATIONS = [
17073
17145
  {
17074
17146
  version: 78,
17075
17147
  name: "api-keys",
17076
- up: up78,
17148
+ up: up79,
17077
17149
  artifacts: {
17078
17150
  tables: ["api_keys"]
17079
17151
  }
@@ -17081,7 +17153,7 @@ var MIGRATIONS = [
17081
17153
  {
17082
17154
  version: 79,
17083
17155
  name: "transcript-capture-jobs",
17084
- up: up79,
17156
+ up: up80,
17085
17157
  artifacts: {
17086
17158
  tables: ["transcript_capture_jobs"]
17087
17159
  }
@@ -17089,7 +17161,7 @@ var MIGRATIONS = [
17089
17161
  {
17090
17162
  version: 80,
17091
17163
  name: "document-scope-columns",
17092
- up: up80,
17164
+ up: up81,
17093
17165
  artifacts: {
17094
17166
  columns: [
17095
17167
  { table: "documents", column: "agent_id" },
@@ -17100,7 +17172,7 @@ var MIGRATIONS = [
17100
17172
  {
17101
17173
  version: 81,
17102
17174
  name: "aggregate-evidence-sources",
17103
- up: up81,
17175
+ up: up82,
17104
17176
  artifacts: {
17105
17177
  tables: ["aggregate_evidence_sources"]
17106
17178
  }
@@ -17108,7 +17180,7 @@ var MIGRATIONS = [
17108
17180
  {
17109
17181
  version: 82,
17110
17182
  name: "skill-invocations-harness",
17111
- up: up82,
17183
+ up: up83,
17112
17184
  artifacts: {
17113
17185
  columns: [
17114
17186
  { table: "skill_invocations", column: "harness" },
@@ -17119,7 +17191,7 @@ var MIGRATIONS = [
17119
17191
  {
17120
17192
  version: 83,
17121
17193
  name: "memory-lifecycle-repair",
17122
- up: up83,
17194
+ up: up84,
17123
17195
  artifacts: {
17124
17196
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17125
17197
  columns: [
@@ -17134,7 +17206,7 @@ var MIGRATIONS = [
17134
17206
  {
17135
17207
  version: 84,
17136
17208
  name: "legacy-markdown-import-state",
17137
- up: up84,
17209
+ up: up85,
17138
17210
  artifacts: {
17139
17211
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17140
17212
  }
@@ -17142,7 +17214,7 @@ var MIGRATIONS = [
17142
17214
  {
17143
17215
  version: 85,
17144
17216
  name: "backfill-relations-to-dependencies",
17145
- up: up85,
17217
+ up: up86,
17146
17218
  artifacts: {
17147
17219
  tables: ["entity_dependencies"]
17148
17220
  }
@@ -17150,7 +17222,7 @@ var MIGRATIONS = [
17150
17222
  {
17151
17223
  version: 86,
17152
17224
  name: "summary-jobs-content-hash",
17153
- up: up86,
17225
+ up: up87,
17154
17226
  artifacts: {
17155
17227
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17156
17228
  }
@@ -17158,7 +17230,7 @@ var MIGRATIONS = [
17158
17230
  {
17159
17231
  version: 87,
17160
17232
  name: "summary-jobs-boundary-reason",
17161
- up: up87,
17233
+ up: up88,
17162
17234
  artifacts: {
17163
17235
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17164
17236
  }
@@ -17166,7 +17238,7 @@ var MIGRATIONS = [
17166
17238
  {
17167
17239
  version: 88,
17168
17240
  name: "transcript-recovery-files",
17169
- up: up88,
17241
+ up: up89,
17170
17242
  artifacts: {
17171
17243
  tables: ["transcript_recovery_files"]
17172
17244
  }
@@ -17174,7 +17246,7 @@ var MIGRATIONS = [
17174
17246
  {
17175
17247
  version: 89,
17176
17248
  name: "job-cancellations",
17177
- up: up89,
17249
+ up: up90,
17178
17250
  artifacts: {
17179
17251
  tables: ["job_cancellations"]
17180
17252
  }
@@ -17182,7 +17254,7 @@ var MIGRATIONS = [
17182
17254
  {
17183
17255
  version: 90,
17184
17256
  name: "job-archive",
17185
- up: up90,
17257
+ up: up91,
17186
17258
  artifacts: {
17187
17259
  tables: ["job_archive"]
17188
17260
  }
@@ -17190,25 +17262,25 @@ var MIGRATIONS = [
17190
17262
  {
17191
17263
  version: 91,
17192
17264
  name: "embedding-index-generations",
17193
- up: up91,
17265
+ up: up92,
17194
17266
  artifacts: { tables: ["embedding_index_state"] }
17195
17267
  },
17196
17268
  {
17197
17269
  version: 92,
17198
17270
  name: "embedding-staging-store",
17199
- up: up92,
17271
+ up: up93,
17200
17272
  artifacts: { tables: ["embeddings_staging"] }
17201
17273
  },
17202
17274
  {
17203
17275
  version: 93,
17204
17276
  name: "dreaming-evidence-cursor",
17205
- up: up93,
17277
+ up: up94,
17206
17278
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17207
17279
  },
17208
17280
  {
17209
17281
  version: 94,
17210
17282
  name: "memory-kind",
17211
- up: up94,
17283
+ up: up95,
17212
17284
  artifacts: {
17213
17285
  columns: [
17214
17286
  { table: "memories", column: "memory_kind" },
@@ -17219,35 +17291,35 @@ var MIGRATIONS = [
17219
17291
  {
17220
17292
  version: 95,
17221
17293
  name: "compaction-recall-projections",
17222
- up: up95
17294
+ up: up96
17223
17295
  },
17224
17296
  {
17225
17297
  version: 96,
17226
17298
  name: "retire-legacy-ingestion",
17227
- up: up96
17299
+ up: up97
17228
17300
  },
17229
17301
  {
17230
17302
  version: 97,
17231
17303
  name: "dreaming-failure-backoff",
17232
- up: up97,
17304
+ up: up98,
17233
17305
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17234
17306
  },
17235
17307
  {
17236
17308
  version: 98,
17237
17309
  name: "dreaming-evidence-exclusions",
17238
- up: up98,
17310
+ up: up99,
17239
17311
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17240
17312
  },
17241
17313
  {
17242
17314
  version: 99,
17243
17315
  name: "dreaming-tool-calls",
17244
- up: up99,
17316
+ up: up100,
17245
17317
  artifacts: { tables: ["dreaming_tool_calls"] }
17246
17318
  },
17247
17319
  {
17248
17320
  version: 100,
17249
17321
  name: "dreaming-runbook",
17250
- up: up100,
17322
+ up: up101,
17251
17323
  artifacts: {
17252
17324
  columns: [
17253
17325
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17258,23 +17330,23 @@ var MIGRATIONS = [
17258
17330
  {
17259
17331
  version: 101,
17260
17332
  name: "dreaming-attention",
17261
- up: up101,
17333
+ up: up102,
17262
17334
  artifacts: { tables: ["dreaming_attention"] }
17263
17335
  },
17264
17336
  {
17265
17337
  version: 102,
17266
17338
  name: "attribute-semantic-memories",
17267
- up: up102
17339
+ up: up103
17268
17340
  },
17269
17341
  {
17270
17342
  version: 103,
17271
17343
  name: "semantic-memory-kind",
17272
- up: up103
17344
+ up: up104
17273
17345
  },
17274
17346
  {
17275
17347
  version: 104,
17276
17348
  name: "derived-memory-provenance",
17277
- up: up104,
17349
+ up: up105,
17278
17350
  artifacts: {
17279
17351
  tables: ["derived_memory_sources"],
17280
17352
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17283,12 +17355,12 @@ var MIGRATIONS = [
17283
17355
  {
17284
17356
  version: 105,
17285
17357
  name: "agent-scoped-entity-name",
17286
- up: up105
17358
+ up: up106
17287
17359
  },
17288
17360
  {
17289
17361
  version: 106,
17290
17362
  name: "memory-review-after",
17291
- up: up106,
17363
+ up: up107,
17292
17364
  artifacts: {
17293
17365
  columns: [{ table: "memories", column: "review_after" }]
17294
17366
  }
@@ -17296,7 +17368,7 @@ var MIGRATIONS = [
17296
17368
  {
17297
17369
  version: 107,
17298
17370
  name: "dreaming-pass-usage",
17299
- up: up107,
17371
+ up: up108,
17300
17372
  artifacts: {
17301
17373
  columns: [
17302
17374
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17310,7 +17382,7 @@ var MIGRATIONS = [
17310
17382
  {
17311
17383
  version: 108,
17312
17384
  name: "embedding-usage",
17313
- up: up108,
17385
+ up: up109,
17314
17386
  artifacts: {
17315
17387
  tables: ["embedding_usage"]
17316
17388
  }
@@ -17318,7 +17390,7 @@ var MIGRATIONS = [
17318
17390
  {
17319
17391
  version: 109,
17320
17392
  name: "telemetry-install",
17321
- up: up109,
17393
+ up: up110,
17322
17394
  artifacts: {
17323
17395
  tables: ["telemetry_install"]
17324
17396
  }
@@ -17326,12 +17398,12 @@ var MIGRATIONS = [
17326
17398
  {
17327
17399
  version: 110,
17328
17400
  name: "memory-mention-join-index",
17329
- up: up110
17401
+ up: up111
17330
17402
  },
17331
17403
  {
17332
17404
  version: 111,
17333
17405
  name: "telemetry-first-use",
17334
- up: up111,
17406
+ up: up112,
17335
17407
  artifacts: {
17336
17408
  columns: [
17337
17409
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17342,7 +17414,7 @@ var MIGRATIONS = [
17342
17414
  {
17343
17415
  version: 112,
17344
17416
  name: "telemetry-queue-ownership",
17345
- up: up112,
17417
+ up: up113,
17346
17418
  artifacts: {
17347
17419
  columns: [
17348
17420
  { table: "telemetry_events", column: "source" },
@@ -17354,7 +17426,7 @@ var MIGRATIONS = [
17354
17426
  {
17355
17427
  version: 113,
17356
17428
  name: "session-claims",
17357
- up: up113,
17429
+ up: up114,
17358
17430
  artifacts: {
17359
17431
  tables: ["session_claims"],
17360
17432
  columns: [
@@ -17368,12 +17440,12 @@ var MIGRATIONS = [
17368
17440
  {
17369
17441
  version: 114,
17370
17442
  name: "memory-traversal-hydration-index",
17371
- up: up114
17443
+ up: up115
17372
17444
  },
17373
17445
  {
17374
17446
  version: 115,
17375
17447
  name: "cross-agent-message-notifications",
17376
- up: up115,
17448
+ up: up116,
17377
17449
  artifacts: {
17378
17450
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17379
17451
  }
@@ -17381,7 +17453,7 @@ var MIGRATIONS = [
17381
17453
  {
17382
17454
  version: 116,
17383
17455
  name: "acp-delivery-reconciliation",
17384
- up: up116,
17456
+ up: up117,
17385
17457
  artifacts: {
17386
17458
  columns: [
17387
17459
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17395,7 +17467,7 @@ var MIGRATIONS = [
17395
17467
  {
17396
17468
  version: 117,
17397
17469
  name: "retire-summary-worker",
17398
- up: up117,
17470
+ up: up118,
17399
17471
  artifacts: {
17400
17472
  columns: [
17401
17473
  { table: "session_transcripts", column: "completed_at" },
@@ -17406,24 +17478,24 @@ var MIGRATIONS = [
17406
17478
  {
17407
17479
  version: 118,
17408
17480
  name: "queue-pressure-indices",
17409
- up: up118
17481
+ up: up119
17410
17482
  },
17411
17483
  {
17412
17484
  version: 119,
17413
17485
  name: "telemetry-version-observation",
17414
- up: up119,
17486
+ up: up120,
17415
17487
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17416
17488
  },
17417
17489
  {
17418
17490
  version: 120,
17419
17491
  name: "source-lifecycle-telemetry",
17420
- up: up120,
17492
+ up: up121,
17421
17493
  artifacts: { tables: ["source_lifecycle_state"] }
17422
17494
  },
17423
17495
  {
17424
17496
  version: 121,
17425
17497
  name: "telemetry-delivery-health",
17426
- up: up121,
17498
+ up: up122,
17427
17499
  artifacts: {
17428
17500
  tables: ["telemetry_delivery_state"],
17429
17501
  columns: [
@@ -17437,7 +17509,7 @@ var MIGRATIONS = [
17437
17509
  {
17438
17510
  version: 122,
17439
17511
  name: "dreaming-evidence-retry",
17440
- up: up122,
17512
+ up: up123,
17441
17513
  artifacts: {
17442
17514
  columns: [
17443
17515
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17450,13 +17522,13 @@ var MIGRATIONS = [
17450
17522
  {
17451
17523
  version: 123,
17452
17524
  name: "embedding-index-failures",
17453
- up: up123,
17525
+ up: up124,
17454
17526
  artifacts: { tables: ["embedding_index_failures"] }
17455
17527
  },
17456
17528
  {
17457
17529
  version: 124,
17458
17530
  name: "import-derived-lifecycle",
17459
- up: up124,
17531
+ up: up125,
17460
17532
  artifacts: {
17461
17533
  tables: ["imported_source_lifecycle"]
17462
17534
  }
@@ -17464,77 +17536,77 @@ var MIGRATIONS = [
17464
17536
  {
17465
17537
  version: 125,
17466
17538
  name: "memory-content-safety",
17467
- up: up125,
17539
+ up: up126,
17468
17540
  artifacts: { tables: ["memory_content_safety"] }
17469
17541
  },
17470
17542
  {
17471
17543
  version: 126,
17472
17544
  name: "dreaming-surprisal-attention",
17473
- up: up126,
17545
+ up: up127,
17474
17546
  artifacts: { tables: ["dreaming_attention"] }
17475
17547
  },
17476
17548
  {
17477
17549
  version: 127,
17478
17550
  name: "ontology-contradictions",
17479
- up: up127,
17551
+ up: up128,
17480
17552
  artifacts: { tables: ["ontology_contradictions"] }
17481
17553
  },
17482
17554
  {
17483
17555
  version: 128,
17484
17556
  name: "bounded-queue-diagnostics",
17485
- up: up128
17557
+ up: up129
17486
17558
  },
17487
17559
  {
17488
17560
  version: 129,
17489
17561
  name: "retire-structural-jobs",
17490
- up: up129
17562
+ up: up130
17491
17563
  },
17492
17564
  {
17493
17565
  version: 130,
17494
17566
  name: "embedding-repair-state",
17495
- up: up130,
17567
+ up: up131,
17496
17568
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17497
17569
  },
17498
17570
  {
17499
17571
  version: 131,
17500
17572
  name: "dreaming-evidence-consumption",
17501
- up: up131,
17573
+ up: up132,
17502
17574
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17503
17575
  },
17504
17576
  {
17505
17577
  version: 132,
17506
17578
  name: "observer-scoped-epistemic-assertions",
17507
- up: up132,
17579
+ up: up133,
17508
17580
  artifacts: { tables: ["epistemic_assertions"] }
17509
17581
  },
17510
17582
  {
17511
17583
  version: 133,
17512
17584
  name: "dreaming-memory-head",
17513
- up: up133,
17585
+ up: up134,
17514
17586
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17515
17587
  },
17516
17588
  {
17517
17589
  version: 134,
17518
17590
  name: "scope-memory-head-entries",
17519
- up: up134,
17591
+ up: up135,
17520
17592
  artifacts: { tables: ["memory_head_entries"] }
17521
17593
  },
17522
17594
  {
17523
17595
  version: 135,
17524
17596
  name: "memory-head-publication",
17525
- up: up135,
17597
+ up: up136,
17526
17598
  artifacts: { tables: ["memory_head_publications"] }
17527
17599
  },
17528
17600
  {
17529
17601
  version: 136,
17530
17602
  name: "memory-head-revisions",
17531
- up: up136,
17603
+ up: up137,
17532
17604
  artifacts: { tables: ["memory_head_revisions"] }
17533
17605
  },
17534
17606
  {
17535
17607
  version: 137,
17536
17608
  name: "dreaming-head-manifest",
17537
- up: up137,
17609
+ up: up138,
17538
17610
  artifacts: {
17539
17611
  columns: [
17540
17612
  { table: "dreaming_passes", column: "head_revision" },
@@ -17545,7 +17617,7 @@ var MIGRATIONS = [
17545
17617
  {
17546
17618
  version: 138,
17547
17619
  name: "bounded-status-projections",
17548
- up: up138,
17620
+ up: up139,
17549
17621
  artifacts: {
17550
17622
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17551
17623
  }
@@ -17553,31 +17625,31 @@ var MIGRATIONS = [
17553
17625
  {
17554
17626
  version: 139,
17555
17627
  name: "native-source-sync-state",
17556
- up: up139,
17628
+ up: up140,
17557
17629
  artifacts: { tables: ["native_source_sync_state"] }
17558
17630
  },
17559
17631
  {
17560
17632
  version: 140,
17561
17633
  name: "transcript-recovery-frontier",
17562
- up: up140,
17634
+ up: up141,
17563
17635
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17564
17636
  },
17565
17637
  {
17566
17638
  version: 141,
17567
17639
  name: "source-sync-checkpoints",
17568
- up: up141,
17640
+ up: up142,
17569
17641
  artifacts: { tables: ["source_sync_checkpoints"] }
17570
17642
  },
17571
17643
  {
17572
17644
  version: 142,
17573
17645
  name: "source-sync-frontier",
17574
- up: up142,
17646
+ up: up143,
17575
17647
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17576
17648
  },
17577
17649
  {
17578
17650
  version: 143,
17579
17651
  name: "embedding-index-progress",
17580
- up: up143,
17652
+ up: up144,
17581
17653
  artifacts: {
17582
17654
  columns: [
17583
17655
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17593,19 +17665,19 @@ var MIGRATIONS = [
17593
17665
  {
17594
17666
  version: 144,
17595
17667
  name: "memory-job-lease-token",
17596
- up: up144,
17668
+ up: up145,
17597
17669
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17598
17670
  },
17599
17671
  {
17600
17672
  version: 145,
17601
17673
  name: "dreaming-evidence-reviews",
17602
- up: up145,
17674
+ up: up146,
17603
17675
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17604
17676
  },
17605
17677
  {
17606
17678
  version: 146,
17607
17679
  name: "source-transcript-import",
17608
- up: up146,
17680
+ up: up147,
17609
17681
  artifacts: {
17610
17682
  tables: [
17611
17683
  "source_import_jobs",
@@ -17624,19 +17696,19 @@ var MIGRATIONS = [
17624
17696
  {
17625
17697
  version: 147,
17626
17698
  name: "source-import-replay-file-slots",
17627
- up: up147,
17699
+ up: up148,
17628
17700
  artifacts: { tables: ["source_import_files"] }
17629
17701
  },
17630
17702
  {
17631
17703
  version: 148,
17632
17704
  name: "source-import-attempt-provenance",
17633
- up: up148,
17705
+ up: up149,
17634
17706
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17635
17707
  },
17636
17708
  {
17637
17709
  version: 149,
17638
17710
  name: "transcript-import-state-machine",
17639
- up: up149,
17711
+ up: up150,
17640
17712
  artifacts: {
17641
17713
  columns: [
17642
17714
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17648,13 +17720,42 @@ var MIGRATIONS = [
17648
17720
  {
17649
17721
  version: 150,
17650
17722
  name: "memory-head-freshness",
17651
- up: up150,
17723
+ up: up151,
17652
17724
  artifacts: {
17653
17725
  columns: [
17654
17726
  { table: "memory_md_heads", column: "is_current" },
17655
17727
  { table: "dreaming_passes", column: "head_base_revision" }
17656
17728
  ]
17657
17729
  }
17730
+ },
17731
+ {
17732
+ version: 151,
17733
+ name: "transcript-import-bytes",
17734
+ up,
17735
+ artifacts: {
17736
+ tables: [
17737
+ "source_import_chunks",
17738
+ "source_import_capacity",
17739
+ "source_import_migrations",
17740
+ "source_import_migration_streams",
17741
+ "source_import_migration_counts"
17742
+ ],
17743
+ columns: [
17744
+ { table: "source_import_files", column: "storage_state" },
17745
+ { table: "source_import_files", column: "upload_generation" },
17746
+ { table: "source_import_files", column: "upload_offset" },
17747
+ { table: "source_import_files", column: "upload_size" },
17748
+ { table: "source_import_files", column: "upload_digest" },
17749
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
17750
+ table: "source_import_files",
17751
+ column
17752
+ })),
17753
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
17754
+ table: "source_import_jobs",
17755
+ column
17756
+ }))
17757
+ ]
17758
+ }
17658
17759
  }
17659
17760
  ];
17660
17761
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -29553,6 +29654,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
29553
29654
  "checkpoint",
29554
29655
  "dreaming"
29555
29656
  ];
29657
+ function up152(db) {
29658
+ const hasColumn26 = (table, column) => {
29659
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
29660
+ try {
29661
+ return statement.get(column) != null;
29662
+ } finally {
29663
+ statement.finalize?.();
29664
+ }
29665
+ };
29666
+ for (const [column, definition] of [
29667
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
29668
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
29669
+ ["upload_size", "INTEGER"],
29670
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
29671
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
29672
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
29673
+ ["original_path", "TEXT"],
29674
+ [
29675
+ "storage_state",
29676
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
29677
+ ]
29678
+ ]) {
29679
+ if (!hasColumn26("source_import_files", column))
29680
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
29681
+ }
29682
+ if (!hasColumn26("source_import_jobs", "retry_count"))
29683
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
29684
+ if (!hasColumn26("source_import_jobs", "cleanup_state"))
29685
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
29686
+ if (!hasColumn26("source_import_jobs", "retry_cursor"))
29687
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
29688
+ if (!hasColumn26("source_import_jobs", "retry_requested"))
29689
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
29690
+ db.exec(`
29691
+ CREATE TABLE IF NOT EXISTS source_import_migrations (agent_id TEXT PRIMARY KEY, state TEXT NOT NULL DEFAULT 'pending', cursor TEXT NOT NULL DEFAULT '', error TEXT);
29692
+ CREATE TABLE IF NOT EXISTS source_import_migration_counts (agent_id TEXT NOT NULL, job_id TEXT NOT NULL, total INTEGER NOT NULL DEFAULT 0, imported INTEGER NOT NULL DEFAULT 0, duplicate INTEGER NOT NULL DEFAULT 0, rejected INTEGER NOT NULL DEFAULT 0, pending INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(agent_id,job_id)) WITHOUT ROWID;
29693
+ CREATE TABLE IF NOT EXISTS source_import_migration_streams (agent_id TEXT NOT NULL, stem TEXT NOT NULL, PRIMARY KEY(agent_id,stem)) WITHOUT ROWID;
29694
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
29695
+ CREATE TABLE IF NOT EXISTS source_import_capacity (id INTEGER PRIMARY KEY CHECK (id = 1), reserved_bytes INTEGER NOT NULL DEFAULT 0 CHECK (reserved_bytes >= 0));
29696
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
29697
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
29698
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
29699
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
29700
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
29701
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
29702
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
29703
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
29704
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
29705
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
29706
+ ) WITHOUT ROWID;
29707
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
29708
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
29709
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
29710
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
29711
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
29712
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
29713
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
29714
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
29715
+ `);
29716
+ }
29556
29717
  var MEMORIES_FTS_TOKENIZER2 = "unicode61";
29557
29718
  var FTS_STATE_TABLE2 = "memories_fts_state";
29558
29719
  function normalizeSql2(sql) {
@@ -29668,7 +29829,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
29668
29829
  return true;
29669
29830
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
29670
29831
  }
29671
- function up151(db) {
29832
+ function up210(db) {
29672
29833
  db.exec(`
29673
29834
  CREATE TABLE IF NOT EXISTS schema_migrations (
29674
29835
  version INTEGER PRIMARY KEY,
@@ -29766,7 +29927,7 @@ function addColumnIfMissing29(db, table, column, definition) {
29766
29927
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29767
29928
  }
29768
29929
  }
29769
- function up210(db) {
29930
+ function up310(db) {
29770
29931
  addColumnIfMissing29(db, "memories", "content_hash", "TEXT");
29771
29932
  addColumnIfMissing29(db, "memories", "normalized_content", "TEXT");
29772
29933
  addColumnIfMissing29(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -29884,7 +30045,7 @@ function addColumnIfMissing210(db, table, column, definition) {
29884
30045
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29885
30046
  return true;
29886
30047
  }
29887
- function up310(db) {
30048
+ function up410(db) {
29888
30049
  addColumnIfMissing210(db, "memories", "why", "TEXT");
29889
30050
  addColumnIfMissing210(db, "memories", "project", "TEXT");
29890
30051
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -29921,7 +30082,7 @@ function addColumnIfMissing32(db, table, column, definition) {
29921
30082
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29922
30083
  }
29923
30084
  }
29924
- function up410(db) {
30085
+ function up510(db) {
29925
30086
  addColumnIfMissing32(db, "memory_history", "actor_type", "TEXT");
29926
30087
  addColumnIfMissing32(db, "memory_history", "session_id", "TEXT");
29927
30088
  addColumnIfMissing32(db, "memory_history", "request_id", "TEXT");
@@ -29954,7 +30115,7 @@ function addColumnIfMissing42(db, table, column, definition) {
29954
30115
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29955
30116
  }
29956
30117
  }
29957
- function up510(db) {
30118
+ function up610(db) {
29958
30119
  addColumnIfMissing42(db, "entities", "canonical_name", "TEXT");
29959
30120
  addColumnIfMissing42(db, "entities", "mentions", "INTEGER DEFAULT 0");
29960
30121
  addColumnIfMissing42(db, "entities", "embedding", "BLOB");
@@ -29971,7 +30132,7 @@ function hasColumn42(db, table, column) {
29971
30132
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
29972
30133
  return rows.some((r3) => r3.name === column);
29973
30134
  }
29974
- function up610(db) {
30135
+ function up710(db) {
29975
30136
  if (!hasColumn42(db, "memories", "idempotency_key")) {
29976
30137
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
29977
30138
  }
@@ -29986,7 +30147,7 @@ function hasColumn52(db, table, column) {
29986
30147
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
29987
30148
  return rows.some((r3) => r3.name === column);
29988
30149
  }
29989
- function up710(db) {
30150
+ function up810(db) {
29990
30151
  db.exec(`
29991
30152
  CREATE TABLE IF NOT EXISTS documents (
29992
30153
  id TEXT PRIMARY KEY,
@@ -30043,7 +30204,7 @@ function up710(db) {
30043
30204
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
30044
30205
  }
30045
30206
  }
30046
- function up810(db) {
30207
+ function up910(db) {
30047
30208
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
30048
30209
  if (tables.length === 0)
30049
30210
  return;
@@ -30060,7 +30221,7 @@ function up810(db) {
30060
30221
  ON embeddings(content_hash)
30061
30222
  `);
30062
30223
  }
30063
- function up910(db) {
30224
+ function up1010(db) {
30064
30225
  db.exec(`
30065
30226
  CREATE TABLE IF NOT EXISTS summary_jobs (
30066
30227
  id TEXT PRIMARY KEY,
@@ -30080,7 +30241,7 @@ function up910(db) {
30080
30241
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
30081
30242
  ON summary_jobs(status)`);
30082
30243
  }
30083
- function up1010(db) {
30244
+ function up1110(db) {
30084
30245
  db.exec(`
30085
30246
  CREATE TABLE IF NOT EXISTS umap_cache (
30086
30247
  id INTEGER PRIMARY KEY,
@@ -30091,7 +30252,7 @@ function up1010(db) {
30091
30252
  )
30092
30253
  `);
30093
30254
  }
30094
- function up1110(db) {
30255
+ function up1210(db) {
30095
30256
  db.exec(`
30096
30257
  CREATE TABLE IF NOT EXISTS session_scores (
30097
30258
  id TEXT PRIMARY KEY,
@@ -30111,7 +30272,7 @@ function up1110(db) {
30111
30272
  ON session_scores(session_key);
30112
30273
  `);
30113
30274
  }
30114
- function up1210(db) {
30275
+ function up1310(db) {
30115
30276
  db.exec(`
30116
30277
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
30117
30278
  id TEXT PRIMARY KEY,
@@ -30152,7 +30313,7 @@ function addColumnIfMissing52(db, table, column, definition) {
30152
30313
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30153
30314
  }
30154
30315
  }
30155
- function up1310(db) {
30316
+ function up1410(db) {
30156
30317
  db.exec(`
30157
30318
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
30158
30319
  id TEXT PRIMARY KEY,
@@ -30178,7 +30339,7 @@ function up1310(db) {
30178
30339
  addColumnIfMissing52(db, "memories", "source_path", "TEXT");
30179
30340
  addColumnIfMissing52(db, "memories", "source_section", "TEXT");
30180
30341
  }
30181
- function up1410(db) {
30342
+ function up153(db) {
30182
30343
  db.exec(`
30183
30344
  CREATE TABLE IF NOT EXISTS telemetry_events (
30184
30345
  id TEXT PRIMARY KEY,
@@ -30203,7 +30364,7 @@ function addColumnIfMissing62(db, table, column, definition) {
30203
30364
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30204
30365
  }
30205
30366
  }
30206
- function up152(db) {
30367
+ function up162(db) {
30207
30368
  db.exec(`
30208
30369
  CREATE TABLE IF NOT EXISTS session_memories (
30209
30370
  id TEXT PRIMARY KEY,
@@ -30230,7 +30391,7 @@ function up152(db) {
30230
30391
  addColumnIfMissing62(db, "session_scores", "confidence", "REAL");
30231
30392
  addColumnIfMissing62(db, "session_scores", "continuity_reasoning", "TEXT");
30232
30393
  }
30233
- function up162(db) {
30394
+ function up172(db) {
30234
30395
  db.exec(`
30235
30396
  CREATE TABLE IF NOT EXISTS session_checkpoints (
30236
30397
  id TEXT PRIMARY KEY,
@@ -30252,7 +30413,7 @@ function up162(db) {
30252
30413
  ON session_checkpoints(project_normalized, created_at DESC);
30253
30414
  `);
30254
30415
  }
30255
- function up172(db) {
30416
+ function up182(db) {
30256
30417
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
30257
30418
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
30258
30419
  if (!colNames.has("skill_name")) {
@@ -30263,7 +30424,7 @@ function up172(db) {
30263
30424
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
30264
30425
  }
30265
30426
  }
30266
- function up182(db) {
30427
+ function up192(db) {
30267
30428
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
30268
30429
  if (existing)
30269
30430
  return;
@@ -30295,7 +30456,7 @@ function up182(db) {
30295
30456
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
30296
30457
  `);
30297
30458
  }
30298
- function up192(db) {
30459
+ function up202(db) {
30299
30460
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
30300
30461
  const entityColNames = new Set(entityCols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
30301
30462
  if (!entityColNames.has("agent_id")) {
@@ -30380,13 +30541,13 @@ function addColumnIfMissing72(db, table, column, definition) {
30380
30541
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30381
30542
  }
30382
30543
  }
30383
- function up202(db) {
30544
+ function up212(db) {
30384
30545
  addColumnIfMissing72(db, "session_memories", "entity_slot", "INTEGER");
30385
30546
  addColumnIfMissing72(db, "session_memories", "aspect_slot", "INTEGER");
30386
30547
  addColumnIfMissing72(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
30387
30548
  addColumnIfMissing72(db, "session_memories", "structural_density", "INTEGER");
30388
30549
  }
30389
- function up212(db) {
30550
+ function up222(db) {
30390
30551
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
30391
30552
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
30392
30553
  if (!columnNames.has("focal_entity_ids")) {
@@ -30411,25 +30572,25 @@ function addColumnIfMissing82(db, table, column, definition) {
30411
30572
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30412
30573
  }
30413
30574
  }
30414
- function up222(db) {
30575
+ function up232(db) {
30415
30576
  addColumnIfMissing82(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
30416
30577
  addColumnIfMissing82(db, "entities", "pinned_at", "TEXT");
30417
30578
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
30418
30579
  }
30419
- function up232(_db) {}
30420
30580
  function up242(_db) {}
30581
+ function up252(_db) {}
30421
30582
  function addColumnIfMissing92(db, table, column, definition) {
30422
30583
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
30423
30584
  if (!cols.some((c3) => c3.name === column)) {
30424
30585
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30425
30586
  }
30426
30587
  }
30427
- function up252(db) {
30588
+ function up262(db) {
30428
30589
  addColumnIfMissing92(db, "session_memories", "agent_relevance_score", "REAL");
30429
30590
  addColumnIfMissing92(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
30430
30591
  }
30431
- function up262(_db) {}
30432
- function up272(db) {
30592
+ function up272(_db) {}
30593
+ function up282(db) {
30433
30594
  db.exec(`
30434
30595
  UPDATE entities
30435
30596
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -30438,7 +30599,7 @@ function up272(db) {
30438
30599
  WHERE canonical_name IS NULL
30439
30600
  `);
30440
30601
  }
30441
- function up282(db) {
30602
+ function up292(db) {
30442
30603
  db.exec(`
30443
30604
  CREATE TABLE IF NOT EXISTS memories_cold (
30444
30605
  archive_id TEXT PRIMARY KEY,
@@ -30475,7 +30636,7 @@ function up282(db) {
30475
30636
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
30476
30637
  `);
30477
30638
  }
30478
- function up292(db) {
30639
+ function up302(db) {
30479
30640
  db.exec(`
30480
30641
  CREATE TABLE IF NOT EXISTS session_summaries (
30481
30642
  id TEXT PRIMARY KEY,
@@ -30520,7 +30681,7 @@ function up292(db) {
30520
30681
  WHERE session_key IS NOT NULL;
30521
30682
  `);
30522
30683
  }
30523
- function up302(db) {
30684
+ function up312(db) {
30524
30685
  db.exec(`
30525
30686
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
30526
30687
  id TEXT PRIMARY KEY,
@@ -30565,7 +30726,7 @@ function up302(db) {
30565
30726
  ON memory_jobs(failed_at);
30566
30727
  `);
30567
30728
  }
30568
- function up312(db) {
30729
+ function up322(db) {
30569
30730
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30570
30731
  if (!depCols.some((c3) => c3.name === "reason")) {
30571
30732
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -30575,7 +30736,7 @@ function up312(db) {
30575
30736
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
30576
30737
  }
30577
30738
  }
30578
- function up322(db) {
30739
+ function up332(db) {
30579
30740
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
30580
30741
  if (cols.length === 0)
30581
30742
  return;
@@ -30583,14 +30744,14 @@ function up322(db) {
30583
30744
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
30584
30745
  }
30585
30746
  }
30586
- function up332(db) {
30747
+ function up342(db) {
30587
30748
  const cols = db.prepare("PRAGMA table_info(memories)").all();
30588
30749
  if (!cols.some((c3) => c3.name === "scope")) {
30589
30750
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
30590
30751
  }
30591
30752
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
30592
30753
  }
30593
- function up342(db) {
30754
+ function up352(db) {
30594
30755
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
30595
30756
  db.exec(`
30596
30757
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -30598,7 +30759,7 @@ function up342(db) {
30598
30759
  WHERE content_hash IS NOT NULL AND is_deleted = 0
30599
30760
  `);
30600
30761
  }
30601
- function up352(db) {
30762
+ function up362(db) {
30602
30763
  db.exec(`
30603
30764
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
30604
30765
  name, canonical_name,
@@ -30630,13 +30791,13 @@ function up352(db) {
30630
30791
  END
30631
30792
  `);
30632
30793
  }
30633
- function up362(db) {
30794
+ function up372(db) {
30634
30795
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30635
30796
  if (!cols.some((c3) => c3.name === "confidence")) {
30636
30797
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
30637
30798
  }
30638
30799
  }
30639
- function up372(db) {
30800
+ function up382(db) {
30640
30801
  db.exec(`
30641
30802
  CREATE TABLE IF NOT EXISTS entity_communities (
30642
30803
  id TEXT PRIMARY KEY,
@@ -30654,7 +30815,7 @@ function up372(db) {
30654
30815
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
30655
30816
  }
30656
30817
  }
30657
- function up382(db) {
30818
+ function up392(db) {
30658
30819
  db.exec(`
30659
30820
  CREATE TABLE IF NOT EXISTS memory_hints (
30660
30821
  id TEXT PRIMARY KEY,
@@ -30694,7 +30855,7 @@ function up382(db) {
30694
30855
  END
30695
30856
  `);
30696
30857
  }
30697
- function up392(db) {
30858
+ function up402(db) {
30698
30859
  db.exec(`
30699
30860
  DELETE FROM entity_dependencies
30700
30861
  WHERE id NOT IN (
@@ -30712,7 +30873,7 @@ function up392(db) {
30712
30873
  )
30713
30874
  `);
30714
30875
  }
30715
- function up402(db) {
30876
+ function up412(db) {
30716
30877
  db.exec(`
30717
30878
  CREATE TABLE IF NOT EXISTS session_transcripts (
30718
30879
  session_key TEXT PRIMARY KEY,
@@ -30735,7 +30896,7 @@ function addColumnIfMissing102(db, table, column, definition) {
30735
30896
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30736
30897
  }
30737
30898
  }
30738
- function up412(db) {
30899
+ function up422(db) {
30739
30900
  addColumnIfMissing102(db, "session_memories", "path_json", "TEXT");
30740
30901
  db.exec(`
30741
30902
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -30810,7 +30971,7 @@ function addColumnIfMissing112(db, table, column, definition) {
30810
30971
  return;
30811
30972
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30812
30973
  }
30813
- function up422(db) {
30974
+ function up432(db) {
30814
30975
  addColumnIfMissing112(db, "session_memories", "entity_slot", "INTEGER");
30815
30976
  addColumnIfMissing112(db, "session_memories", "aspect_slot", "INTEGER");
30816
30977
  addColumnIfMissing112(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -30898,7 +31059,7 @@ function addColumnIfMissing122(db, table, column, definition) {
30898
31059
  return;
30899
31060
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30900
31061
  }
30901
- function up432(db) {
31062
+ function up442(db) {
30902
31063
  db.exec(`
30903
31064
  CREATE TABLE IF NOT EXISTS agents (
30904
31065
  id TEXT PRIMARY KEY,
@@ -30927,7 +31088,7 @@ function addColumnIfMissing132(db, table, column, definition) {
30927
31088
  return;
30928
31089
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30929
31090
  }
30930
- function up442(db) {
31091
+ function up452(db) {
30931
31092
  addColumnIfMissing132(db, "session_summaries", "source_type", "TEXT");
30932
31093
  addColumnIfMissing132(db, "session_summaries", "source_ref", "TEXT");
30933
31094
  addColumnIfMissing132(db, "session_summaries", "meta_json", "TEXT");
@@ -30953,7 +31114,7 @@ function addColumnIfMissing142(db, table, column, definition) {
30953
31114
  return;
30954
31115
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30955
31116
  }
30956
- function up452(db) {
31117
+ function up462(db) {
30957
31118
  addColumnIfMissing142(db, "session_transcripts", "updated_at", "TEXT");
30958
31119
  addColumnIfMissing142(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
30959
31120
  addColumnIfMissing142(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -31024,7 +31185,7 @@ function up452(db) {
31024
31185
  ON memory_md_heads(lease_expires_at);
31025
31186
  `);
31026
31187
  }
31027
- function up462(db) {
31188
+ function up472(db) {
31028
31189
  db.exec(`
31029
31190
  DROP INDEX IF EXISTS idx_summaries_session_depth;
31030
31191
 
@@ -31085,7 +31246,7 @@ function up462(db) {
31085
31246
  AND COALESCE(source_type, 'summary') = 'summary';
31086
31247
  `);
31087
31248
  }
31088
- function up472(db) {
31249
+ function up482(db) {
31089
31250
  db.exec(`
31090
31251
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
31091
31252
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -31183,7 +31344,7 @@ function up472(db) {
31183
31344
  AND COALESCE(source_type, 'summary') = 'summary';
31184
31345
  `);
31185
31346
  }
31186
- function up482(db) {
31347
+ function up492(db) {
31187
31348
  db.exec(`
31188
31349
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
31189
31350
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -31301,7 +31462,7 @@ function up482(db) {
31301
31462
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
31302
31463
  `);
31303
31464
  }
31304
- function up492(db) {
31465
+ function up502(db) {
31305
31466
  db.exec(`
31306
31467
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
31307
31468
  session_key TEXT NOT NULL,
@@ -31318,7 +31479,7 @@ function hasTable5(db, name) {
31318
31479
  WHERE type = 'table' AND name = ?
31319
31480
  LIMIT 1`).get(name) !== undefined;
31320
31481
  }
31321
- function up502(db) {
31482
+ function up512(db) {
31322
31483
  db.exec(`
31323
31484
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
31324
31485
  id TEXT PRIMARY KEY,
@@ -31488,7 +31649,7 @@ function addColumnIfMissing152(db, table, column, definition) {
31488
31649
  return;
31489
31650
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31490
31651
  }
31491
- function up512(db) {
31652
+ function up522(db) {
31492
31653
  addColumnIfMissing152(db, "summary_jobs", "session_id", "TEXT");
31493
31654
  addColumnIfMissing152(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
31494
31655
  addColumnIfMissing152(db, "summary_jobs", "captured_at", "TEXT");
@@ -31580,7 +31741,7 @@ function up512(db) {
31580
31741
  VALUES ('rebuild');
31581
31742
  `);
31582
31743
  }
31583
- function up522(db) {
31744
+ function up532(db) {
31584
31745
  db.exec(`
31585
31746
  CREATE TABLE IF NOT EXISTS mcp_invocations (
31586
31747
  id TEXT PRIMARY KEY,
@@ -31597,7 +31758,7 @@ function up522(db) {
31597
31758
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
31598
31759
  `);
31599
31760
  }
31600
- function up532(db) {
31761
+ function up542(db) {
31601
31762
  db.exec(`
31602
31763
  CREATE TABLE IF NOT EXISTS skill_invocations (
31603
31764
  id TEXT PRIMARY KEY,
@@ -31613,7 +31774,7 @@ function up532(db) {
31613
31774
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
31614
31775
  `);
31615
31776
  }
31616
- function up542(db) {
31777
+ function up552(db) {
31617
31778
  db.exec(`
31618
31779
  CREATE TABLE IF NOT EXISTS task_scope_hints (
31619
31780
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -31644,7 +31805,7 @@ function up542(db) {
31644
31805
  ON task_scope_hints(agent_id, updated_at);
31645
31806
  `);
31646
31807
  }
31647
- function up552(db) {
31808
+ function up562(db) {
31648
31809
  db.exec(`
31649
31810
  CREATE TABLE IF NOT EXISTS dreaming_state (
31650
31811
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -31687,7 +31848,7 @@ function ensureMemoriesScopeColumns3(db) {
31687
31848
  if (!names.has("scope"))
31688
31849
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
31689
31850
  }
31690
- function up562(db) {
31851
+ function up572(db) {
31691
31852
  ensureMemoriesScopeColumns3(db);
31692
31853
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
31693
31854
  db.exec(`
@@ -31700,20 +31861,20 @@ function up562(db) {
31700
31861
  WHERE content_hash IS NOT NULL AND is_deleted = 0
31701
31862
  `);
31702
31863
  }
31703
- function up572(db) {
31864
+ function up582(db) {
31704
31865
  const sql = readMemoriesFtsSql2(db);
31705
31866
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
31706
31867
  return;
31707
31868
  recreateMemoriesFts2(db);
31708
31869
  }
31709
- function up582(db) {
31870
+ function up592(db) {
31710
31871
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
31711
31872
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
31712
31873
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
31713
31874
  ON entities(entity_type, mentions)
31714
31875
  WHERE entity_type = 'extracted'`);
31715
31876
  }
31716
- function up592(db) {
31877
+ function up602(db) {
31717
31878
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31718
31879
  if (!cols.some((col) => col.name === "claim_key")) {
31719
31880
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -31722,7 +31883,7 @@ function up592(db) {
31722
31883
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
31723
31884
  WHERE claim_key IS NOT NULL`);
31724
31885
  }
31725
- function up602(db) {
31886
+ function up612(db) {
31726
31887
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31727
31888
  if (!cols.some((col) => col.name === "group_key")) {
31728
31889
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -31734,13 +31895,13 @@ function up602(db) {
31734
31895
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
31735
31896
  WHERE claim_key IS NOT NULL`);
31736
31897
  }
31737
- function up612(db) {
31898
+ function up622(db) {
31738
31899
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31739
31900
  if (cols.some((col) => col.name === "source_mtime_ms"))
31740
31901
  return;
31741
31902
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
31742
31903
  }
31743
- function up622(db) {
31904
+ function up632(db) {
31744
31905
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31745
31906
  const names = new Set(cols.map((col) => col.name));
31746
31907
  if (!names.has("is_deleted")) {
@@ -31754,7 +31915,7 @@ function up622(db) {
31754
31915
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
31755
31916
  `);
31756
31917
  }
31757
- function up632(db) {
31918
+ function up642(db) {
31758
31919
  db.exec("DROP TRIGGER IF EXISTS memories_au");
31759
31920
  db.exec(`
31760
31921
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -31772,7 +31933,7 @@ function addColumnIfMissing162(db, table, column, definition) {
31772
31933
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31773
31934
  }
31774
31935
  }
31775
- function up642(db) {
31936
+ function up652(db) {
31776
31937
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
31777
31938
  addColumnIfMissing162(db, table, "source_id", "TEXT");
31778
31939
  addColumnIfMissing162(db, table, "source_kind", "TEXT");
@@ -31792,7 +31953,7 @@ function hasColumn72(db, table, column) {
31792
31953
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31793
31954
  return rows.some((row) => row.name === column);
31794
31955
  }
31795
- function up652(db) {
31956
+ function up662(db) {
31796
31957
  if (!hasTable22(db, "embeddings"))
31797
31958
  return;
31798
31959
  if (!hasColumn72(db, "embeddings", "agent_id")) {
@@ -31800,7 +31961,7 @@ function up652(db) {
31800
31961
  }
31801
31962
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
31802
31963
  }
31803
- function up662(db) {
31964
+ function up672(db) {
31804
31965
  db.exec(`
31805
31966
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
31806
31967
  id TEXT PRIMARY KEY,
@@ -31841,7 +32002,7 @@ function addColumnIfMissing172(db, table, column, definition) {
31841
32002
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31842
32003
  }
31843
32004
  }
31844
- function up672(db) {
32005
+ function up682(db) {
31845
32006
  db.exec(`
31846
32007
  CREATE TABLE IF NOT EXISTS ontology_proposals (
31847
32008
  id TEXT PRIMARY KEY,
@@ -31884,7 +32045,7 @@ function up672(db) {
31884
32045
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
31885
32046
  }
31886
32047
  }
31887
- function up682(db) {
32048
+ function up692(db) {
31888
32049
  db.exec(`
31889
32050
  CREATE TABLE IF NOT EXISTS daily_reflections (
31890
32051
  id TEXT PRIMARY KEY,
@@ -31911,7 +32072,7 @@ function up682(db) {
31911
32072
  WHERE content_key IS NOT NULL;
31912
32073
  `);
31913
32074
  }
31914
- function up692(db) {
32075
+ function up702(db) {
31915
32076
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
31916
32077
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
31917
32078
  if (!colNames.has("content_key")) {
@@ -31948,7 +32109,7 @@ function backfillVersionRoots2(db) {
31948
32109
  WHERE version_root_id IS NULL
31949
32110
  `);
31950
32111
  }
31951
- function up702(db) {
32112
+ function up712(db) {
31952
32113
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
31953
32114
  addColumnIfMissing182(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
31954
32115
  addColumnIfMissing182(db, table, "archived_at", "TEXT");
@@ -31983,7 +32144,7 @@ function up702(db) {
31983
32144
  ON entity_aspects(agent_id, proposal_id);
31984
32145
  `);
31985
32146
  }
31986
- function up712(db) {
32147
+ function up722(db) {
31987
32148
  db.exec(`
31988
32149
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
31989
32150
  id TEXT PRIMARY KEY,
@@ -32039,7 +32200,7 @@ function ensureMemoriesScopeColumns22(db) {
32039
32200
  if (!names.has("runtime_path"))
32040
32201
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
32041
32202
  }
32042
- function up722(db) {
32203
+ function up732(db) {
32043
32204
  ensureMemoriesScopeColumns22(db);
32044
32205
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
32045
32206
  db.exec(`
@@ -32053,7 +32214,7 @@ function up722(db) {
32053
32214
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
32054
32215
  `);
32055
32216
  }
32056
- function up732(db) {
32217
+ function up742(db) {
32057
32218
  db.exec(`
32058
32219
  CREATE TABLE IF NOT EXISTS session_context_epochs (
32059
32220
  session_key TEXT NOT NULL,
@@ -32088,7 +32249,7 @@ function up732(db) {
32088
32249
  ON session_recall_events(item_kind, item_id, created_at DESC);
32089
32250
  `);
32090
32251
  }
32091
- function up742(db) {
32252
+ function up752(db) {
32092
32253
  db.exec(`
32093
32254
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
32094
32255
  aggregate_memory_id TEXT NOT NULL,
@@ -32107,7 +32268,7 @@ function addColumnIfMissing192(db, table, column, definition) {
32107
32268
  return;
32108
32269
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32109
32270
  }
32110
- function up752(db) {
32271
+ function up762(db) {
32111
32272
  addColumnIfMissing192(db, "memory_artifacts", "source_id", "TEXT");
32112
32273
  addColumnIfMissing192(db, "memory_artifacts", "source_root", "TEXT");
32113
32274
  addColumnIfMissing192(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -32120,7 +32281,7 @@ function up752(db) {
32120
32281
  ON memory_artifacts(agent_id, source_id, source_root);
32121
32282
  `);
32122
32283
  }
32123
- function up762(db) {
32284
+ function up772(db) {
32124
32285
  db.exec(`
32125
32286
  CREATE TABLE IF NOT EXISTS temporal_edges (
32126
32287
  id TEXT PRIMARY KEY,
@@ -32143,7 +32304,7 @@ function up762(db) {
32143
32304
  ON temporal_edges(agent_id, subject_type, subject_id);
32144
32305
  `);
32145
32306
  }
32146
- function up772(db) {
32307
+ function up782(db) {
32147
32308
  db.exec(`
32148
32309
  CREATE TABLE IF NOT EXISTS entity_aliases (
32149
32310
  id TEXT PRIMARY KEY,
@@ -32167,7 +32328,7 @@ function up772(db) {
32167
32328
  ON entity_aliases(agent_id, canonical_alias, status);
32168
32329
  `);
32169
32330
  }
32170
- function up782(db) {
32331
+ function up792(db) {
32171
32332
  db.exec(`
32172
32333
  CREATE TABLE IF NOT EXISTS api_keys (
32173
32334
  id TEXT PRIMARY KEY,
@@ -32195,7 +32356,7 @@ function up782(db) {
32195
32356
  ON api_keys(connector, harness);
32196
32357
  `);
32197
32358
  }
32198
- function up792(db) {
32359
+ function up802(db) {
32199
32360
  db.exec(`
32200
32361
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
32201
32362
  id TEXT PRIMARY KEY,
@@ -32230,7 +32391,7 @@ function hasColumn102(db, table, column) {
32230
32391
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32231
32392
  return rows.some((row) => row.name === column);
32232
32393
  }
32233
- function up802(db) {
32394
+ function up812(db) {
32234
32395
  if (!hasColumn102(db, "documents", "agent_id")) {
32235
32396
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
32236
32397
  }
@@ -32316,7 +32477,7 @@ function up802(db) {
32316
32477
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
32317
32478
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
32318
32479
  }
32319
- function up812(db) {
32480
+ function up822(db) {
32320
32481
  db.exec(`
32321
32482
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
32322
32483
  aggregate_memory_id TEXT NOT NULL,
@@ -32338,7 +32499,7 @@ function hasColumn112(db, table, column) {
32338
32499
  return rows.some((row) => row.name === column);
32339
32500
  }
32340
32501
  var COLUMNS3 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
32341
- function up822(db) {
32502
+ function up832(db) {
32342
32503
  for (const column of COLUMNS3) {
32343
32504
  if (!hasColumn112(db, "skill_invocations", column)) {
32344
32505
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -32419,7 +32580,7 @@ function documentScopeColumnsPreservingExisting2(db) {
32419
32580
  `);
32420
32581
  }
32421
32582
  try {
32422
- up802(db);
32583
+ up812(db);
32423
32584
  if (preserveAgentId) {
32424
32585
  db.exec(`
32425
32586
  UPDATE documents
@@ -32439,12 +32600,12 @@ function documentScopeColumnsPreservingExisting2(db) {
32439
32600
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
32440
32601
  }
32441
32602
  }
32442
- function up832(db) {
32443
- up792(db);
32603
+ function up842(db) {
32604
+ up802(db);
32444
32605
  if (hasTable32(db, "documents")) {
32445
32606
  documentScopeColumnsPreservingExisting2(db);
32446
32607
  }
32447
- up812(db);
32608
+ up822(db);
32448
32609
  addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
32449
32610
  addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
32450
32611
  addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
@@ -32501,7 +32662,7 @@ function up832(db) {
32501
32662
  AND ${sourceAgentId} = ${targetAgentId}
32502
32663
  `);
32503
32664
  }
32504
- function up842(db) {
32665
+ function up852(db) {
32505
32666
  db.exec(`
32506
32667
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
32507
32668
  path TEXT PRIMARY KEY,
@@ -32531,7 +32692,7 @@ function up842(db) {
32531
32692
  ON legacy_markdown_chunks(memory_id);
32532
32693
  `);
32533
32694
  }
32534
- function up852(db) {
32695
+ function up862(db) {
32535
32696
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
32536
32697
  const tableNames = new Set(tables.map((r3) => String(r3.name)));
32537
32698
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -32590,7 +32751,7 @@ function addColumnIfMissing212(db, table, column, definition) {
32590
32751
  return;
32591
32752
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32592
32753
  }
32593
- function up862(db) {
32754
+ function up872(db) {
32594
32755
  addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
32595
32756
  db.exec(`
32596
32757
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -32603,14 +32764,14 @@ function addColumnIfMissing222(db, table, column, definition) {
32603
32764
  return;
32604
32765
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32605
32766
  }
32606
- function up872(db) {
32767
+ function up882(db) {
32607
32768
  addColumnIfMissing222(db, "summary_jobs", "boundary_reason", "TEXT");
32608
32769
  db.exec(`
32609
32770
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
32610
32771
  ON summary_jobs(agent_id, session_key, boundary_reason)
32611
32772
  `);
32612
32773
  }
32613
- function up882(db) {
32774
+ function up892(db) {
32614
32775
  db.exec(`
32615
32776
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
32616
32777
  agent_id TEXT NOT NULL,
@@ -32628,7 +32789,7 @@ function up882(db) {
32628
32789
  ON transcript_capture_jobs(agent_id, session_id, status);
32629
32790
  `);
32630
32791
  }
32631
- function up892(db) {
32792
+ function up902(db) {
32632
32793
  db.exec(`
32633
32794
  CREATE TABLE IF NOT EXISTS job_cancellations (
32634
32795
  id TEXT PRIMARY KEY,
@@ -32656,7 +32817,7 @@ function indexExists3(db, table, indexName) {
32656
32817
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32657
32818
  return rows.some((row) => row.name === indexName);
32658
32819
  }
32659
- function up902(db) {
32820
+ function up912(db) {
32660
32821
  db.exec(`
32661
32822
  CREATE TABLE IF NOT EXISTS job_archive (
32662
32823
  id TEXT PRIMARY KEY,
@@ -32683,7 +32844,7 @@ function indexExists22(db, table, indexName) {
32683
32844
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32684
32845
  return rows.some((row) => row.name === indexName);
32685
32846
  }
32686
- function up912(db) {
32847
+ function up922(db) {
32687
32848
  db.exec(`
32688
32849
  CREATE TABLE IF NOT EXISTS embedding_index_state (
32689
32850
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -32696,7 +32857,7 @@ function up912(db) {
32696
32857
  )
32697
32858
  `);
32698
32859
  }
32699
- function up922(db) {
32860
+ function up932(db) {
32700
32861
  db.exec(`
32701
32862
  CREATE TABLE IF NOT EXISTS embeddings_staging (
32702
32863
  id TEXT PRIMARY KEY,
@@ -32715,7 +32876,7 @@ function up922(db) {
32715
32876
  ON embeddings_staging(agent_id, source_type, source_id);
32716
32877
  `);
32717
32878
  }
32718
- function up932(db) {
32879
+ function up942(db) {
32719
32880
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32720
32881
  if (!columns.some((column) => column.name === "evidence_cursor")) {
32721
32882
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -32726,7 +32887,7 @@ function hasColumn132(db, table, column) {
32726
32887
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32727
32888
  return rows.some((r3) => r3.name === column);
32728
32889
  }
32729
- function up942(db) {
32890
+ function up952(db) {
32730
32891
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
32731
32892
  if (tables.length === 0)
32732
32893
  return;
@@ -32751,23 +32912,23 @@ function up942(db) {
32751
32912
  function hasColumn142(db, table, column) {
32752
32913
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32753
32914
  }
32754
- function up952(db) {
32915
+ function up962(db) {
32755
32916
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
32756
32917
  if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
32757
32918
  return;
32758
32919
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
32759
32920
  }
32760
- function up962(db) {
32921
+ function up972(db) {
32761
32922
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
32762
32923
  }
32763
- function up972(db) {
32924
+ function up982(db) {
32764
32925
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32765
32926
  if (!columns.some((column) => column.name === "last_failure_at")) {
32766
32927
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
32767
32928
  }
32768
32929
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
32769
32930
  }
32770
- function up982(db) {
32931
+ function up992(db) {
32771
32932
  db.exec(`
32772
32933
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
32773
32934
  agent_id TEXT NOT NULL,
@@ -32784,7 +32945,7 @@ function up982(db) {
32784
32945
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
32785
32946
  `);
32786
32947
  }
32787
- function up992(db) {
32948
+ function up1002(db) {
32788
32949
  db.exec(`
32789
32950
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
32790
32951
  id TEXT PRIMARY KEY,
@@ -32804,7 +32965,7 @@ function up992(db) {
32804
32965
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
32805
32966
  `);
32806
32967
  }
32807
- function up1002(db) {
32968
+ function up1012(db) {
32808
32969
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
32809
32970
  if (!columns.some((column) => column.name === "evidence_window_json")) {
32810
32971
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -32813,7 +32974,7 @@ function up1002(db) {
32813
32974
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
32814
32975
  }
32815
32976
  }
32816
- function up1012(db) {
32977
+ function up1022(db) {
32817
32978
  db.exec(`
32818
32979
  CREATE TABLE IF NOT EXISTS dreaming_attention (
32819
32980
  id TEXT PRIMARY KEY,
@@ -32835,7 +32996,7 @@ function up1012(db) {
32835
32996
  function hasColumn152(db, table, column) {
32836
32997
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32837
32998
  }
32838
- function up1022(db) {
32999
+ function up1032(db) {
32839
33000
  const requiredMemoryColumns = [
32840
33001
  "content_hash",
32841
33002
  "normalized_content",
@@ -32886,7 +33047,7 @@ function up1022(db) {
32886
33047
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
32887
33048
  `);
32888
33049
  }
32889
- function up1032(db) {
33050
+ function up1042(db) {
32890
33051
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
32891
33052
  if (tables.length !== 2)
32892
33053
  return;
@@ -32909,7 +33070,7 @@ function tableExists4(db, table) {
32909
33070
  function hasColumn162(db, table, column) {
32910
33071
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32911
33072
  }
32912
- function up1042(db) {
33073
+ function up1052(db) {
32913
33074
  db.exec(`
32914
33075
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
32915
33076
  derived_memory_id TEXT NOT NULL,
@@ -32952,7 +33113,7 @@ function up1042(db) {
32952
33113
  `);
32953
33114
  }
32954
33115
  }
32955
- function up1052(db) {
33116
+ function up1062(db) {
32956
33117
  db.exec(`
32957
33118
  DROP TRIGGER IF EXISTS entities_fts_ai;
32958
33119
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -33041,7 +33202,7 @@ function up1052(db) {
33041
33202
  function hasColumn172(db, table, column) {
33042
33203
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33043
33204
  }
33044
- function up1062(db) {
33205
+ function up1072(db) {
33045
33206
  if (!hasColumn172(db, "memories", "review_after")) {
33046
33207
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
33047
33208
  }
@@ -33057,14 +33218,14 @@ var TOKEN_COLUMNS2 = [
33057
33218
  ["tokens_cache_write", "INTEGER"],
33058
33219
  ["tokens_cost", "REAL"]
33059
33220
  ];
33060
- function up1072(db) {
33221
+ function up1082(db) {
33061
33222
  for (const [column, type] of TOKEN_COLUMNS2) {
33062
33223
  if (!hasColumn182(db, "dreaming_passes", column)) {
33063
33224
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
33064
33225
  }
33065
33226
  }
33066
33227
  }
33067
- function up1082(db) {
33228
+ function up1092(db) {
33068
33229
  db.exec(`
33069
33230
  CREATE TABLE IF NOT EXISTS embedding_usage (
33070
33231
  day TEXT NOT NULL,
@@ -33077,7 +33238,7 @@ function up1082(db) {
33077
33238
  );
33078
33239
  `);
33079
33240
  }
33080
- function up1092(db) {
33241
+ function up1102(db) {
33081
33242
  db.exec(`
33082
33243
  CREATE TABLE IF NOT EXISTS telemetry_install (
33083
33244
  id TEXT PRIMARY KEY,
@@ -33085,7 +33246,7 @@ function up1092(db) {
33085
33246
  );
33086
33247
  `);
33087
33248
  }
33088
- function up1102(db) {
33249
+ function up1112(db) {
33089
33250
  db.exec(`
33090
33251
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
33091
33252
  ON memory_entity_mentions(entity_id, memory_id);
@@ -33096,7 +33257,7 @@ function hasColumn192(db, table, column) {
33096
33257
  return rows.some((row) => row.name === column);
33097
33258
  }
33098
33259
  var COLUMNS22 = ["first_remember_at", "first_recall_at"];
33099
- function up1112(db) {
33260
+ function up1122(db) {
33100
33261
  for (const column of COLUMNS22) {
33101
33262
  if (!hasColumn192(db, "telemetry_install", column)) {
33102
33263
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -33112,7 +33273,7 @@ function addColumnIfMissing232(db, column, definition) {
33112
33273
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33113
33274
  }
33114
33275
  }
33115
- function up1122(db) {
33276
+ function up1132(db) {
33116
33277
  addColumnIfMissing232(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
33117
33278
  addColumnIfMissing232(db, "claim_token", "TEXT");
33118
33279
  addColumnIfMissing232(db, "claimed_at", "TEXT");
@@ -33121,7 +33282,7 @@ function up1122(db) {
33121
33282
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
33122
33283
  `);
33123
33284
  }
33124
- function up1132(db) {
33285
+ function up1142(db) {
33125
33286
  db.exec(`
33126
33287
  CREATE TABLE IF NOT EXISTS session_claims (
33127
33288
  session_key TEXT NOT NULL,
@@ -33142,7 +33303,7 @@ function up1132(db) {
33142
33303
  ON session_claims(agent_id, state, expires_at);
33143
33304
  `);
33144
33305
  }
33145
- function up1142(db) {
33306
+ function up1152(db) {
33146
33307
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
33147
33308
  if (table == null)
33148
33309
  return;
@@ -33151,7 +33312,7 @@ function up1142(db) {
33151
33312
  ON entity_attributes(memory_id, agent_id, status, importance);
33152
33313
  `);
33153
33314
  }
33154
- function up1152(db) {
33315
+ function up1162(db) {
33155
33316
  db.exec(`
33156
33317
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
33157
33318
  id TEXT PRIMARY KEY,
@@ -33208,7 +33369,7 @@ function addColumnIfMissing242(db, column, definition) {
33208
33369
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
33209
33370
  }
33210
33371
  }
33211
- function up1162(db) {
33372
+ function up1172(db) {
33212
33373
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
33213
33374
  if (table == null)
33214
33375
  return;
@@ -33409,7 +33570,7 @@ function backfillTranscriptsFromSummaryJobs2(db) {
33409
33570
  insert.run(...values);
33410
33571
  }
33411
33572
  }
33412
- function up1172(db) {
33573
+ function up1182(db) {
33413
33574
  if (!hasTable42(db, "session_transcripts"))
33414
33575
  return;
33415
33576
  addColumnIfMissing252(db, "session_transcripts", "completed_at", "TEXT");
@@ -33462,7 +33623,7 @@ function up1172(db) {
33462
33623
  ON session_transcripts(agent_id, content_hash);
33463
33624
  `);
33464
33625
  }
33465
- function up1182(db) {
33626
+ function up1192(db) {
33466
33627
  db.exec(`
33467
33628
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
33468
33629
  ON memory_jobs(status)
@@ -33481,12 +33642,12 @@ function up1182(db) {
33481
33642
  function hasColumn222(db, table, column) {
33482
33643
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33483
33644
  }
33484
- function up1192(db) {
33645
+ function up1202(db) {
33485
33646
  if (!hasColumn222(db, "telemetry_install", "last_seen_version")) {
33486
33647
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
33487
33648
  }
33488
33649
  }
33489
- function up1202(db) {
33650
+ function up1212(db) {
33490
33651
  db.exec(`
33491
33652
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
33492
33653
  agent_id TEXT NOT NULL,
@@ -33515,7 +33676,7 @@ function addColumnIfMissing262(db, column, definition) {
33515
33676
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33516
33677
  }
33517
33678
  }
33518
- function up1212(db) {
33679
+ function up1222(db) {
33519
33680
  addColumnIfMissing262(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
33520
33681
  addColumnIfMissing262(db, "last_attempt_at", "TEXT");
33521
33682
  addColumnIfMissing262(db, "sent_at", "TEXT");
@@ -33536,7 +33697,7 @@ function up1212(db) {
33536
33697
  VALUES (1, CURRENT_TIMESTAMP);
33537
33698
  `);
33538
33699
  }
33539
- function up1222(db) {
33700
+ function up1232(db) {
33540
33701
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
33541
33702
  const names = new Set(columns.map((column) => column.name));
33542
33703
  if (!names.has("failure_class")) {
@@ -33553,7 +33714,7 @@ function up1222(db) {
33553
33714
  }
33554
33715
  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)");
33555
33716
  }
33556
- function up1232(db) {
33717
+ function up1242(db) {
33557
33718
  db.exec(`
33558
33719
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
33559
33720
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -33577,7 +33738,7 @@ function up1232(db) {
33577
33738
  ON embedding_index_failures(source_type, source_id);
33578
33739
  `);
33579
33740
  }
33580
- function up1242(db) {
33741
+ function up1252(db) {
33581
33742
  db.exec(`
33582
33743
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
33583
33744
  id TEXT PRIMARY KEY,
@@ -33627,7 +33788,7 @@ function backfillTable2(db, params) {
33627
33788
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
33628
33789
  backfill2(db, rows, params.sourceKind, params.scannedAt);
33629
33790
  }
33630
- function up1252(db) {
33791
+ function up1262(db) {
33631
33792
  db.exec(`
33632
33793
  CREATE TABLE IF NOT EXISTS memory_content_safety (
33633
33794
  agent_id TEXT NOT NULL,
@@ -33684,7 +33845,7 @@ function up1252(db) {
33684
33845
  scannedAt
33685
33846
  });
33686
33847
  }
33687
- function up1262(db) {
33848
+ function up1272(db) {
33688
33849
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
33689
33850
  if (!table)
33690
33851
  return;
@@ -33718,7 +33879,7 @@ function up1262(db) {
33718
33879
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
33719
33880
  `);
33720
33881
  }
33721
- function up1272(db) {
33882
+ function up1282(db) {
33722
33883
  db.exec(`
33723
33884
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
33724
33885
  id TEXT PRIMARY KEY,
@@ -33774,7 +33935,7 @@ function up1272(db) {
33774
33935
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
33775
33936
  `);
33776
33937
  }
33777
- function up1282(db) {
33938
+ function up1292(db) {
33778
33939
  db.exec(`
33779
33940
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
33780
33941
  ON memory_jobs(status, created_at)
@@ -33789,7 +33950,7 @@ function up1282(db) {
33789
33950
  function tableExists32(db, table) {
33790
33951
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
33791
33952
  }
33792
- function up1292(db) {
33953
+ function up1302(db) {
33793
33954
  if (!tableExists32(db, "memory_jobs"))
33794
33955
  return;
33795
33956
  if (!tableExists32(db, "job_cancellations")) {
@@ -33838,7 +33999,7 @@ function up1292(db) {
33838
33999
  AND status IN ('pending', 'leased');
33839
34000
  `);
33840
34001
  }
33841
- function up1302(db) {
34002
+ function up1312(db) {
33842
34003
  db.exec(`
33843
34004
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
33844
34005
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -33878,7 +34039,7 @@ function up1302(db) {
33878
34039
  END;
33879
34040
  `);
33880
34041
  }
33881
- function up1312(db) {
34042
+ function up1322(db) {
33882
34043
  db.exec(`
33883
34044
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
33884
34045
  agent_id TEXT NOT NULL,
@@ -33901,13 +34062,13 @@ function up1312(db) {
33901
34062
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
33902
34063
  `);
33903
34064
  }
33904
- function up1322(db) {
34065
+ function up1332(db) {
33905
34066
  db.exec(`
33906
34067
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
33907
34068
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
33908
34069
  `);
33909
34070
  }
33910
- function up1332(db) {
34071
+ function up1342(db) {
33911
34072
  db.exec(`
33912
34073
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
33913
34074
  id TEXT PRIMARY KEY,
@@ -33959,7 +34120,7 @@ function up1332(db) {
33959
34120
  if (!names.has("format_version"))
33960
34121
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
33961
34122
  }
33962
- function up1342(db) {
34123
+ function up1352(db) {
33963
34124
  db.exec(`
33964
34125
  CREATE TABLE memory_head_entries_v134 (
33965
34126
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -33977,7 +34138,7 @@ function up1342(db) {
33977
34138
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
33978
34139
  `);
33979
34140
  }
33980
- function up1352(db) {
34141
+ function up1362(db) {
33981
34142
  db.exec(`
33982
34143
  CREATE TABLE IF NOT EXISTS memory_head_publications (
33983
34144
  agent_id TEXT NOT NULL,
@@ -33993,7 +34154,7 @@ function up1352(db) {
33993
34154
  ON memory_head_publications(agent_id, status, revision DESC);
33994
34155
  `);
33995
34156
  }
33996
- function up1362(db) {
34157
+ function up1372(db) {
33997
34158
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r3) => r3.name));
33998
34159
  for (const [name, type] of [
33999
34160
  ["entry_id", "TEXT"],
@@ -34007,7 +34168,7 @@ function up1362(db) {
34007
34168
  }
34008
34169
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
34009
34170
  }
34010
- function up1372(db) {
34171
+ function up1382(db) {
34011
34172
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r3) => r3.name));
34012
34173
  for (const [name, type] of [
34013
34174
  ["head_revision", "INTEGER"],
@@ -34029,7 +34190,7 @@ function addColumnIfMissing272(db, table, column, definition) {
34029
34190
  if (!hasColumn252(db, table, column))
34030
34191
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34031
34192
  }
34032
- function up1382(db) {
34193
+ function up1392(db) {
34033
34194
  addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
34034
34195
  db.exec(`
34035
34196
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -34334,7 +34495,7 @@ function up1382(db) {
34334
34495
  GROUP BY j.agent_id;
34335
34496
  `);
34336
34497
  }
34337
- function up1392(db) {
34498
+ function up1402(db) {
34338
34499
  db.exec(`
34339
34500
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
34340
34501
  agent_id TEXT NOT NULL,
@@ -34350,7 +34511,7 @@ function up1392(db) {
34350
34511
  ON native_source_sync_state(agent_id, status);
34351
34512
  `);
34352
34513
  }
34353
- function up1402(db) {
34514
+ function up1412(db) {
34354
34515
  db.exec(`
34355
34516
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
34356
34517
  agent_id TEXT NOT NULL,
@@ -34362,7 +34523,7 @@ function up1402(db) {
34362
34523
  );
34363
34524
  `);
34364
34525
  }
34365
- function up1412(db) {
34526
+ function up1422(db) {
34366
34527
  db.exec(`
34367
34528
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
34368
34529
  agent_id TEXT NOT NULL,
@@ -34376,13 +34537,13 @@ function up1412(db) {
34376
34537
  );
34377
34538
  `);
34378
34539
  }
34379
- function up1422(db) {
34540
+ function up1432(db) {
34380
34541
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
34381
34542
  if (!columns.some((column) => column.name === "frontier")) {
34382
34543
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
34383
34544
  }
34384
34545
  }
34385
- function up1432(db) {
34546
+ function up1442(db) {
34386
34547
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34387
34548
  const additions = [
34388
34549
  ["migration_phase", "TEXT"],
@@ -34417,13 +34578,13 @@ function up1432(db) {
34417
34578
  `);
34418
34579
  }
34419
34580
  }
34420
- function up1442(db) {
34581
+ function up1452(db) {
34421
34582
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34422
34583
  if (!columns.has("lease_token")) {
34423
34584
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
34424
34585
  }
34425
34586
  }
34426
- function up1452(db) {
34587
+ function up1462(db) {
34427
34588
  db.exec(`
34428
34589
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
34429
34590
  agent_id TEXT NOT NULL,
@@ -34441,7 +34602,7 @@ function up1452(db) {
34441
34602
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
34442
34603
  `);
34443
34604
  }
34444
- function up1462(db) {
34605
+ function up1472(db) {
34445
34606
  db.exec(`
34446
34607
  CREATE TABLE IF NOT EXISTS source_import_jobs (
34447
34608
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -34496,24 +34657,36 @@ function up1462(db) {
34496
34657
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
34497
34658
  `);
34498
34659
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
34499
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
34660
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
34661
+ let exists;
34662
+ try {
34663
+ exists = statement.get(column);
34664
+ } finally {
34665
+ statement.finalize?.();
34666
+ }
34500
34667
  if (exists == null)
34501
34668
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
34502
34669
  }
34503
34670
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
34504
34671
  }
34505
- function up1472(db) {
34672
+ function up1482(db) {
34506
34673
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
34507
34674
  }
34508
- function up1482(db) {
34675
+ function up1492(db) {
34509
34676
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
34510
34677
  if (!columns.some((column) => column.name === "source_id")) {
34511
34678
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
34512
34679
  }
34513
34680
  }
34514
- function up1492(db) {
34681
+ function up1502(db) {
34515
34682
  const addColumn = (table, column, definition) => {
34516
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
34683
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
34684
+ let exists;
34685
+ try {
34686
+ exists = statement.get(table, column);
34687
+ } finally {
34688
+ statement.finalize?.();
34689
+ }
34517
34690
  if (exists == null)
34518
34691
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34519
34692
  };
@@ -34526,7 +34699,7 @@ function addColumnIfMissing282(db, table, column, definition) {
34526
34699
  if (!columns.some((row) => row.name === column))
34527
34700
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34528
34701
  }
34529
- function up1502(db) {
34702
+ function up1512(db) {
34530
34703
  addColumnIfMissing282(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
34531
34704
  addColumnIfMissing282(db, "dreaming_passes", "head_base_revision", "INTEGER");
34532
34705
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -34680,13 +34853,13 @@ var MIGRATIONS2 = [
34680
34853
  {
34681
34854
  version: 1,
34682
34855
  name: "baseline",
34683
- up: up151,
34856
+ up: up210,
34684
34857
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
34685
34858
  },
34686
34859
  {
34687
34860
  version: 2,
34688
34861
  name: "pipeline-v2",
34689
- up: up210,
34862
+ up: up310,
34690
34863
  artifacts: {
34691
34864
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
34692
34865
  }
@@ -34694,12 +34867,12 @@ var MIGRATIONS2 = [
34694
34867
  {
34695
34868
  version: 3,
34696
34869
  name: "unique-content-hash",
34697
- up: up310
34870
+ up: up410
34698
34871
  },
34699
34872
  {
34700
34873
  version: 4,
34701
34874
  name: "history-actor-and-retention",
34702
- up: up410,
34875
+ up: up510,
34703
34876
  artifacts: {
34704
34877
  columns: [{ table: "memory_history", column: "actor_type" }]
34705
34878
  }
@@ -34707,7 +34880,7 @@ var MIGRATIONS2 = [
34707
34880
  {
34708
34881
  version: 5,
34709
34882
  name: "graph-extended",
34710
- up: up510,
34883
+ up: up610,
34711
34884
  artifacts: {
34712
34885
  columns: [{ table: "entities", column: "canonical_name" }]
34713
34886
  }
@@ -34715,7 +34888,7 @@ var MIGRATIONS2 = [
34715
34888
  {
34716
34889
  version: 6,
34717
34890
  name: "idempotency-key",
34718
- up: up610,
34891
+ up: up710,
34719
34892
  artifacts: {
34720
34893
  columns: [{ table: "memories", column: "idempotency_key" }]
34721
34894
  }
@@ -34723,42 +34896,42 @@ var MIGRATIONS2 = [
34723
34896
  {
34724
34897
  version: 7,
34725
34898
  name: "documents-and-connectors",
34726
- up: up710,
34899
+ up: up810,
34727
34900
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
34728
34901
  },
34729
34902
  {
34730
34903
  version: 8,
34731
34904
  name: "embeddings-unique-hash",
34732
- up: up810
34905
+ up: up910
34733
34906
  },
34734
34907
  {
34735
34908
  version: 9,
34736
34909
  name: "summary-jobs",
34737
- up: up910,
34910
+ up: up1010,
34738
34911
  artifacts: { tables: ["summary_jobs"] }
34739
34912
  },
34740
34913
  {
34741
34914
  version: 10,
34742
34915
  name: "umap-cache",
34743
- up: up1010,
34916
+ up: up1110,
34744
34917
  artifacts: { tables: ["umap_cache"] }
34745
34918
  },
34746
34919
  {
34747
34920
  version: 11,
34748
34921
  name: "session-scores",
34749
- up: up1110,
34922
+ up: up1210,
34750
34923
  artifacts: { tables: ["session_scores"] }
34751
34924
  },
34752
34925
  {
34753
34926
  version: 12,
34754
34927
  name: "scheduled-tasks",
34755
- up: up1210,
34928
+ up: up1310,
34756
34929
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
34757
34930
  },
34758
34931
  {
34759
34932
  version: 13,
34760
34933
  name: "ingestion-tracking",
34761
- up: up1310,
34934
+ up: up1410,
34762
34935
  artifacts: {
34763
34936
  columns: [
34764
34937
  { table: "memories", column: "source_path" },
@@ -34769,13 +34942,13 @@ var MIGRATIONS2 = [
34769
34942
  {
34770
34943
  version: 14,
34771
34944
  name: "telemetry",
34772
- up: up1410,
34945
+ up: up153,
34773
34946
  artifacts: { tables: ["telemetry_events"] }
34774
34947
  },
34775
34948
  {
34776
34949
  version: 15,
34777
34950
  name: "session-memories",
34778
- up: up152,
34951
+ up: up162,
34779
34952
  artifacts: {
34780
34953
  tables: ["session_memories"],
34781
34954
  columns: [
@@ -34787,13 +34960,13 @@ var MIGRATIONS2 = [
34787
34960
  {
34788
34961
  version: 16,
34789
34962
  name: "session-checkpoints",
34790
- up: up162,
34963
+ up: up172,
34791
34964
  artifacts: { tables: ["session_checkpoints"] }
34792
34965
  },
34793
34966
  {
34794
34967
  version: 17,
34795
34968
  name: "task-skills",
34796
- up: up172,
34969
+ up: up182,
34797
34970
  artifacts: {
34798
34971
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
34799
34972
  }
@@ -34801,13 +34974,13 @@ var MIGRATIONS2 = [
34801
34974
  {
34802
34975
  version: 18,
34803
34976
  name: "skill-meta",
34804
- up: up182,
34977
+ up: up192,
34805
34978
  artifacts: { tables: ["skill_meta"] }
34806
34979
  },
34807
34980
  {
34808
34981
  version: 19,
34809
34982
  name: "knowledge-structure",
34810
- up: up192,
34983
+ up: up202,
34811
34984
  artifacts: {
34812
34985
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
34813
34986
  columns: [{ table: "entities", column: "agent_id" }]
@@ -34816,7 +34989,7 @@ var MIGRATIONS2 = [
34816
34989
  {
34817
34990
  version: 20,
34818
34991
  name: "session-structural-columns",
34819
- up: up202,
34992
+ up: up212,
34820
34993
  artifacts: {
34821
34994
  columns: [
34822
34995
  { table: "session_memories", column: "entity_slot" },
@@ -34829,7 +35002,7 @@ var MIGRATIONS2 = [
34829
35002
  {
34830
35003
  version: 21,
34831
35004
  name: "checkpoint-structural",
34832
- up: up212,
35005
+ up: up222,
34833
35006
  artifacts: {
34834
35007
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
34835
35008
  }
@@ -34837,7 +35010,7 @@ var MIGRATIONS2 = [
34837
35010
  {
34838
35011
  version: 22,
34839
35012
  name: "entity-pinning",
34840
- up: up222,
35013
+ up: up232,
34841
35014
  artifacts: {
34842
35015
  columns: [
34843
35016
  { table: "entities", column: "pinned" },
@@ -34848,17 +35021,17 @@ var MIGRATIONS2 = [
34848
35021
  {
34849
35022
  version: 23,
34850
35023
  name: "retired-scorer-gap",
34851
- up: up232
35024
+ up: up242
34852
35025
  },
34853
35026
  {
34854
35027
  version: 24,
34855
35028
  name: "retired-scorer-gap",
34856
- up: up242
35029
+ up: up252
34857
35030
  },
34858
35031
  {
34859
35032
  version: 25,
34860
35033
  name: "agent-feedback",
34861
- up: up252,
35034
+ up: up262,
34862
35035
  artifacts: {
34863
35036
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
34864
35037
  }
@@ -34866,32 +35039,32 @@ var MIGRATIONS2 = [
34866
35039
  {
34867
35040
  version: 26,
34868
35041
  name: "retired-scorer-gap",
34869
- up: up262
35042
+ up: up272
34870
35043
  },
34871
35044
  {
34872
35045
  version: 27,
34873
35046
  name: "backfill-canonical-names",
34874
- up: up272
35047
+ up: up282
34875
35048
  },
34876
35049
  {
34877
35050
  version: 28,
34878
35051
  name: "lossless-retention",
34879
- up: up282
35052
+ up: up292
34880
35053
  },
34881
35054
  {
34882
35055
  version: 29,
34883
35056
  name: "session-summary-dag",
34884
- up: up292
35057
+ up: up302
34885
35058
  },
34886
35059
  {
34887
35060
  version: 30,
34888
35061
  name: "nullable-memory-job-memory-id",
34889
- up: up302
35062
+ up: up312
34890
35063
  },
34891
35064
  {
34892
35065
  version: 31,
34893
35066
  name: "dependency-reason",
34894
- up: up312,
35067
+ up: up322,
34895
35068
  artifacts: {
34896
35069
  columns: [
34897
35070
  { table: "entity_dependencies", column: "reason" },
@@ -34902,7 +35075,7 @@ var MIGRATIONS2 = [
34902
35075
  {
34903
35076
  version: 32,
34904
35077
  name: "embeddings-vector-column",
34905
- up: up322,
35078
+ up: up332,
34906
35079
  artifacts: {
34907
35080
  columns: [{ table: "embeddings", column: "vector", optional: true }]
34908
35081
  }
@@ -34910,7 +35083,7 @@ var MIGRATIONS2 = [
34910
35083
  {
34911
35084
  version: 33,
34912
35085
  name: "scope",
34913
- up: up332,
35086
+ up: up342,
34914
35087
  artifacts: {
34915
35088
  columns: [{ table: "memories", column: "scope" }]
34916
35089
  }
@@ -34918,17 +35091,17 @@ var MIGRATIONS2 = [
34918
35091
  {
34919
35092
  version: 34,
34920
35093
  name: "scope-aware-dedup",
34921
- up: up342
35094
+ up: up352
34922
35095
  },
34923
35096
  {
34924
35097
  version: 35,
34925
35098
  name: "entity-fts",
34926
- up: up352
35099
+ up: up362
34927
35100
  },
34928
35101
  {
34929
35102
  version: 36,
34930
35103
  name: "dependency-confidence",
34931
- up: up362,
35104
+ up: up372,
34932
35105
  artifacts: {
34933
35106
  columns: [{ table: "entity_dependencies", column: "confidence" }]
34934
35107
  }
@@ -34936,7 +35109,7 @@ var MIGRATIONS2 = [
34936
35109
  {
34937
35110
  version: 37,
34938
35111
  name: "entity-communities",
34939
- up: up372,
35112
+ up: up382,
34940
35113
  artifacts: {
34941
35114
  tables: ["entity_communities"],
34942
35115
  columns: [{ table: "entities", column: "community_id" }]
@@ -34945,24 +35118,24 @@ var MIGRATIONS2 = [
34945
35118
  {
34946
35119
  version: 38,
34947
35120
  name: "memory-hints",
34948
- up: up382,
35121
+ up: up392,
34949
35122
  artifacts: { tables: ["memory_hints"] }
34950
35123
  },
34951
35124
  {
34952
35125
  version: 39,
34953
35126
  name: "dedup-entity-dependencies",
34954
- up: up392
35127
+ up: up402
34955
35128
  },
34956
35129
  {
34957
35130
  version: 40,
34958
35131
  name: "session-transcripts",
34959
- up: up402,
35132
+ up: up412,
34960
35133
  artifacts: { tables: ["session_transcripts"] }
34961
35134
  },
34962
35135
  {
34963
35136
  version: 41,
34964
35137
  name: "path-feedback",
34965
- up: up412,
35138
+ up: up422,
34966
35139
  artifacts: {
34967
35140
  tables: [
34968
35141
  "path_feedback_events",
@@ -34977,7 +35150,7 @@ var MIGRATIONS2 = [
34977
35150
  {
34978
35151
  version: 42,
34979
35152
  name: "session-memories-agent-id",
34980
- up: up422,
35153
+ up: up432,
34981
35154
  artifacts: {
34982
35155
  columns: [{ table: "session_memories", column: "agent_id" }]
34983
35156
  }
@@ -34985,7 +35158,7 @@ var MIGRATIONS2 = [
34985
35158
  {
34986
35159
  version: 43,
34987
35160
  name: "agents-table",
34988
- up: up432,
35161
+ up: up442,
34989
35162
  artifacts: {
34990
35163
  tables: ["agents"],
34991
35164
  columns: [
@@ -34997,7 +35170,7 @@ var MIGRATIONS2 = [
34997
35170
  {
34998
35171
  version: 44,
34999
35172
  name: "memory-md-temporal-head",
35000
- up: up442,
35173
+ up: up452,
35001
35174
  artifacts: {
35002
35175
  columns: [
35003
35176
  { table: "session_summaries", column: "source_type" },
@@ -35009,7 +35182,7 @@ var MIGRATIONS2 = [
35009
35182
  {
35010
35183
  version: 45,
35011
35184
  name: "lossless-working-memory-hardening",
35012
- up: up452,
35185
+ up: up462,
35013
35186
  artifacts: {
35014
35187
  tables: ["session_transcripts_fts", "memory_md_heads"],
35015
35188
  columns: [
@@ -35022,17 +35195,17 @@ var MIGRATIONS2 = [
35022
35195
  {
35023
35196
  version: 46,
35024
35197
  name: "session-summary-uniqueness",
35025
- up: up462
35198
+ up: up472
35026
35199
  },
35027
35200
  {
35028
35201
  version: 47,
35029
35202
  name: "agent-scoped-temporal-uniqueness",
35030
- up: up472
35203
+ up: up482
35031
35204
  },
35032
35205
  {
35033
35206
  version: 48,
35034
35207
  name: "thread-heads",
35035
- up: up482,
35208
+ up: up492,
35036
35209
  artifacts: {
35037
35210
  tables: ["memory_thread_heads"]
35038
35211
  }
@@ -35040,7 +35213,7 @@ var MIGRATIONS2 = [
35040
35213
  {
35041
35214
  version: 49,
35042
35215
  name: "session-extract-cursors",
35043
- up: up492,
35216
+ up: up502,
35044
35217
  artifacts: {
35045
35218
  tables: ["session_extract_cursors"]
35046
35219
  }
@@ -35048,7 +35221,7 @@ var MIGRATIONS2 = [
35048
35221
  {
35049
35222
  version: 50,
35050
35223
  name: "related-to-audit",
35051
- up: up502,
35224
+ up: up512,
35052
35225
  artifacts: {
35053
35226
  tables: ["entity_dependency_history"]
35054
35227
  }
@@ -35056,7 +35229,7 @@ var MIGRATIONS2 = [
35056
35229
  {
35057
35230
  version: 51,
35058
35231
  name: "memory-md-rolling-window-lineage",
35059
- up: up512,
35232
+ up: up522,
35060
35233
  artifacts: {
35061
35234
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
35062
35235
  columns: [
@@ -35071,7 +35244,7 @@ var MIGRATIONS2 = [
35071
35244
  {
35072
35245
  version: 52,
35073
35246
  name: "mcp-invocations",
35074
- up: up522,
35247
+ up: up532,
35075
35248
  artifacts: {
35076
35249
  tables: ["mcp_invocations"]
35077
35250
  }
@@ -35079,7 +35252,7 @@ var MIGRATIONS2 = [
35079
35252
  {
35080
35253
  version: 53,
35081
35254
  name: "skill-invocations",
35082
- up: up532,
35255
+ up: up542,
35083
35256
  artifacts: {
35084
35257
  tables: ["skill_invocations"]
35085
35258
  }
@@ -35087,7 +35260,7 @@ var MIGRATIONS2 = [
35087
35260
  {
35088
35261
  version: 54,
35089
35262
  name: "task-agent-scope",
35090
- up: up542,
35263
+ up: up552,
35091
35264
  artifacts: {
35092
35265
  tables: ["task_scope_hints"]
35093
35266
  }
@@ -35095,7 +35268,7 @@ var MIGRATIONS2 = [
35095
35268
  {
35096
35269
  version: 55,
35097
35270
  name: "dreaming-state",
35098
- up: up552,
35271
+ up: up562,
35099
35272
  artifacts: {
35100
35273
  tables: ["dreaming_state", "dreaming_passes"]
35101
35274
  }
@@ -35103,22 +35276,22 @@ var MIGRATIONS2 = [
35103
35276
  {
35104
35277
  version: 56,
35105
35278
  name: "agent-scoped-content-hash",
35106
- up: up562
35279
+ up: up572
35107
35280
  },
35108
35281
  {
35109
35282
  version: 57,
35110
35283
  name: "memories-fts-tokenizer-repair",
35111
- up: up572
35284
+ up: up582
35112
35285
  },
35113
35286
  {
35114
35287
  version: 58,
35115
35288
  name: "knowledge-graph-indices",
35116
- up: up582
35289
+ up: up592
35117
35290
  },
35118
35291
  {
35119
35292
  version: 59,
35120
35293
  name: "entity-attribute-claim-key",
35121
- up: up592,
35294
+ up: up602,
35122
35295
  artifacts: {
35123
35296
  columns: [{ table: "entity_attributes", column: "claim_key" }]
35124
35297
  }
@@ -35126,7 +35299,7 @@ var MIGRATIONS2 = [
35126
35299
  {
35127
35300
  version: 60,
35128
35301
  name: "entity-attribute-group-key",
35129
- up: up602,
35302
+ up: up612,
35130
35303
  artifacts: {
35131
35304
  columns: [{ table: "entity_attributes", column: "group_key" }]
35132
35305
  }
@@ -35134,7 +35307,7 @@ var MIGRATIONS2 = [
35134
35307
  {
35135
35308
  version: 61,
35136
35309
  name: "memory-artifact-source-mtime",
35137
- up: up612,
35310
+ up: up622,
35138
35311
  artifacts: {
35139
35312
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
35140
35313
  }
@@ -35142,7 +35315,7 @@ var MIGRATIONS2 = [
35142
35315
  {
35143
35316
  version: 62,
35144
35317
  name: "memory-artifact-soft-delete",
35145
- up: up622,
35318
+ up: up632,
35146
35319
  artifacts: {
35147
35320
  columns: [
35148
35321
  { table: "memory_artifacts", column: "is_deleted" },
@@ -35153,12 +35326,12 @@ var MIGRATIONS2 = [
35153
35326
  {
35154
35327
  version: 63,
35155
35328
  name: "content-only-memories-fts-update",
35156
- up: up632
35329
+ up: up642
35157
35330
  },
35158
35331
  {
35159
35332
  version: 64,
35160
35333
  name: "source-graph-provenance",
35161
- up: up642,
35334
+ up: up652,
35162
35335
  artifacts: {
35163
35336
  columns: [
35164
35337
  { table: "entities", column: "source_path" },
@@ -35171,7 +35344,7 @@ var MIGRATIONS2 = [
35171
35344
  {
35172
35345
  version: 65,
35173
35346
  name: "source-embedding-agent-scope",
35174
- up: up652,
35347
+ up: up662,
35175
35348
  artifacts: {
35176
35349
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
35177
35350
  }
@@ -35179,7 +35352,7 @@ var MIGRATIONS2 = [
35179
35352
  {
35180
35353
  version: 66,
35181
35354
  name: "memory-search-telemetry",
35182
- up: up662,
35355
+ up: up672,
35183
35356
  artifacts: {
35184
35357
  tables: ["memory_search_telemetry"]
35185
35358
  }
@@ -35187,7 +35360,7 @@ var MIGRATIONS2 = [
35187
35360
  {
35188
35361
  version: 67,
35189
35362
  name: "ontology-proposals",
35190
- up: up672,
35363
+ up: up682,
35191
35364
  artifacts: {
35192
35365
  tables: ["ontology_proposals"],
35193
35366
  columns: [
@@ -35201,7 +35374,7 @@ var MIGRATIONS2 = [
35201
35374
  {
35202
35375
  version: 68,
35203
35376
  name: "daily-reflections",
35204
- up: up682,
35377
+ up: up692,
35205
35378
  artifacts: {
35206
35379
  tables: ["daily_reflections"]
35207
35380
  }
@@ -35209,7 +35382,7 @@ var MIGRATIONS2 = [
35209
35382
  {
35210
35383
  version: 69,
35211
35384
  name: "daily-reflections-multiple-insights",
35212
- up: up692,
35385
+ up: up702,
35213
35386
  artifacts: {
35214
35387
  tables: ["daily_reflections"]
35215
35388
  }
@@ -35217,7 +35390,7 @@ var MIGRATIONS2 = [
35217
35390
  {
35218
35391
  version: 70,
35219
35392
  name: "ontology-control-plane-state",
35220
- up: up702,
35393
+ up: up712,
35221
35394
  artifacts: {
35222
35395
  columns: [
35223
35396
  { table: "entities", column: "status" },
@@ -35232,7 +35405,7 @@ var MIGRATIONS2 = [
35232
35405
  {
35233
35406
  version: 71,
35234
35407
  name: "epistemic-assertions",
35235
- up: up712,
35408
+ up: up722,
35236
35409
  artifacts: {
35237
35410
  tables: ["epistemic_assertions"]
35238
35411
  }
@@ -35240,7 +35413,7 @@ var MIGRATIONS2 = [
35240
35413
  {
35241
35414
  version: 72,
35242
35415
  name: "agent-scoped-idempotency-key",
35243
- up: up722,
35416
+ up: up732,
35244
35417
  artifacts: {
35245
35418
  columns: [
35246
35419
  { table: "memories", column: "idempotency_key" },
@@ -35251,7 +35424,7 @@ var MIGRATIONS2 = [
35251
35424
  {
35252
35425
  version: 73,
35253
35426
  name: "recall-context-dedupe",
35254
- up: up732,
35427
+ up: up742,
35255
35428
  artifacts: {
35256
35429
  tables: ["session_context_epochs", "session_recall_events"]
35257
35430
  }
@@ -35259,7 +35432,7 @@ var MIGRATIONS2 = [
35259
35432
  {
35260
35433
  version: 74,
35261
35434
  name: "aggregate-memory-links",
35262
- up: up742,
35435
+ up: up752,
35263
35436
  artifacts: {
35264
35437
  tables: ["aggregate_memory_sources"]
35265
35438
  }
@@ -35267,7 +35440,7 @@ var MIGRATIONS2 = [
35267
35440
  {
35268
35441
  version: 75,
35269
35442
  name: "memory-artifact-source-provenance",
35270
- up: up752,
35443
+ up: up762,
35271
35444
  artifacts: {
35272
35445
  columns: [
35273
35446
  { table: "memory_artifacts", column: "source_id" },
@@ -35281,7 +35454,7 @@ var MIGRATIONS2 = [
35281
35454
  {
35282
35455
  version: 76,
35283
35456
  name: "temporal-edges",
35284
- up: up762,
35457
+ up: up772,
35285
35458
  artifacts: {
35286
35459
  tables: ["temporal_edges"]
35287
35460
  }
@@ -35289,7 +35462,7 @@ var MIGRATIONS2 = [
35289
35462
  {
35290
35463
  version: 77,
35291
35464
  name: "entity-aliases",
35292
- up: up772,
35465
+ up: up782,
35293
35466
  artifacts: {
35294
35467
  tables: ["entity_aliases"]
35295
35468
  }
@@ -35297,7 +35470,7 @@ var MIGRATIONS2 = [
35297
35470
  {
35298
35471
  version: 78,
35299
35472
  name: "api-keys",
35300
- up: up782,
35473
+ up: up792,
35301
35474
  artifacts: {
35302
35475
  tables: ["api_keys"]
35303
35476
  }
@@ -35305,7 +35478,7 @@ var MIGRATIONS2 = [
35305
35478
  {
35306
35479
  version: 79,
35307
35480
  name: "transcript-capture-jobs",
35308
- up: up792,
35481
+ up: up802,
35309
35482
  artifacts: {
35310
35483
  tables: ["transcript_capture_jobs"]
35311
35484
  }
@@ -35313,7 +35486,7 @@ var MIGRATIONS2 = [
35313
35486
  {
35314
35487
  version: 80,
35315
35488
  name: "document-scope-columns",
35316
- up: up802,
35489
+ up: up812,
35317
35490
  artifacts: {
35318
35491
  columns: [
35319
35492
  { table: "documents", column: "agent_id" },
@@ -35324,7 +35497,7 @@ var MIGRATIONS2 = [
35324
35497
  {
35325
35498
  version: 81,
35326
35499
  name: "aggregate-evidence-sources",
35327
- up: up812,
35500
+ up: up822,
35328
35501
  artifacts: {
35329
35502
  tables: ["aggregate_evidence_sources"]
35330
35503
  }
@@ -35332,7 +35505,7 @@ var MIGRATIONS2 = [
35332
35505
  {
35333
35506
  version: 82,
35334
35507
  name: "skill-invocations-harness",
35335
- up: up822,
35508
+ up: up832,
35336
35509
  artifacts: {
35337
35510
  columns: [
35338
35511
  { table: "skill_invocations", column: "harness" },
@@ -35343,7 +35516,7 @@ var MIGRATIONS2 = [
35343
35516
  {
35344
35517
  version: 83,
35345
35518
  name: "memory-lifecycle-repair",
35346
- up: up832,
35519
+ up: up842,
35347
35520
  artifacts: {
35348
35521
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
35349
35522
  columns: [
@@ -35358,7 +35531,7 @@ var MIGRATIONS2 = [
35358
35531
  {
35359
35532
  version: 84,
35360
35533
  name: "legacy-markdown-import-state",
35361
- up: up842,
35534
+ up: up852,
35362
35535
  artifacts: {
35363
35536
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
35364
35537
  }
@@ -35366,7 +35539,7 @@ var MIGRATIONS2 = [
35366
35539
  {
35367
35540
  version: 85,
35368
35541
  name: "backfill-relations-to-dependencies",
35369
- up: up852,
35542
+ up: up862,
35370
35543
  artifacts: {
35371
35544
  tables: ["entity_dependencies"]
35372
35545
  }
@@ -35374,7 +35547,7 @@ var MIGRATIONS2 = [
35374
35547
  {
35375
35548
  version: 86,
35376
35549
  name: "summary-jobs-content-hash",
35377
- up: up862,
35550
+ up: up872,
35378
35551
  artifacts: {
35379
35552
  columns: [{ table: "summary_jobs", column: "content_hash" }]
35380
35553
  }
@@ -35382,7 +35555,7 @@ var MIGRATIONS2 = [
35382
35555
  {
35383
35556
  version: 87,
35384
35557
  name: "summary-jobs-boundary-reason",
35385
- up: up872,
35558
+ up: up882,
35386
35559
  artifacts: {
35387
35560
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
35388
35561
  }
@@ -35390,7 +35563,7 @@ var MIGRATIONS2 = [
35390
35563
  {
35391
35564
  version: 88,
35392
35565
  name: "transcript-recovery-files",
35393
- up: up882,
35566
+ up: up892,
35394
35567
  artifacts: {
35395
35568
  tables: ["transcript_recovery_files"]
35396
35569
  }
@@ -35398,7 +35571,7 @@ var MIGRATIONS2 = [
35398
35571
  {
35399
35572
  version: 89,
35400
35573
  name: "job-cancellations",
35401
- up: up892,
35574
+ up: up902,
35402
35575
  artifacts: {
35403
35576
  tables: ["job_cancellations"]
35404
35577
  }
@@ -35406,7 +35579,7 @@ var MIGRATIONS2 = [
35406
35579
  {
35407
35580
  version: 90,
35408
35581
  name: "job-archive",
35409
- up: up902,
35582
+ up: up912,
35410
35583
  artifacts: {
35411
35584
  tables: ["job_archive"]
35412
35585
  }
@@ -35414,25 +35587,25 @@ var MIGRATIONS2 = [
35414
35587
  {
35415
35588
  version: 91,
35416
35589
  name: "embedding-index-generations",
35417
- up: up912,
35590
+ up: up922,
35418
35591
  artifacts: { tables: ["embedding_index_state"] }
35419
35592
  },
35420
35593
  {
35421
35594
  version: 92,
35422
35595
  name: "embedding-staging-store",
35423
- up: up922,
35596
+ up: up932,
35424
35597
  artifacts: { tables: ["embeddings_staging"] }
35425
35598
  },
35426
35599
  {
35427
35600
  version: 93,
35428
35601
  name: "dreaming-evidence-cursor",
35429
- up: up932,
35602
+ up: up942,
35430
35603
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
35431
35604
  },
35432
35605
  {
35433
35606
  version: 94,
35434
35607
  name: "memory-kind",
35435
- up: up942,
35608
+ up: up952,
35436
35609
  artifacts: {
35437
35610
  columns: [
35438
35611
  { table: "memories", column: "memory_kind" },
@@ -35443,35 +35616,35 @@ var MIGRATIONS2 = [
35443
35616
  {
35444
35617
  version: 95,
35445
35618
  name: "compaction-recall-projections",
35446
- up: up952
35619
+ up: up962
35447
35620
  },
35448
35621
  {
35449
35622
  version: 96,
35450
35623
  name: "retire-legacy-ingestion",
35451
- up: up962
35624
+ up: up972
35452
35625
  },
35453
35626
  {
35454
35627
  version: 97,
35455
35628
  name: "dreaming-failure-backoff",
35456
- up: up972,
35629
+ up: up982,
35457
35630
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
35458
35631
  },
35459
35632
  {
35460
35633
  version: 98,
35461
35634
  name: "dreaming-evidence-exclusions",
35462
- up: up982,
35635
+ up: up992,
35463
35636
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
35464
35637
  },
35465
35638
  {
35466
35639
  version: 99,
35467
35640
  name: "dreaming-tool-calls",
35468
- up: up992,
35641
+ up: up1002,
35469
35642
  artifacts: { tables: ["dreaming_tool_calls"] }
35470
35643
  },
35471
35644
  {
35472
35645
  version: 100,
35473
35646
  name: "dreaming-runbook",
35474
- up: up1002,
35647
+ up: up1012,
35475
35648
  artifacts: {
35476
35649
  columns: [
35477
35650
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -35482,23 +35655,23 @@ var MIGRATIONS2 = [
35482
35655
  {
35483
35656
  version: 101,
35484
35657
  name: "dreaming-attention",
35485
- up: up1012,
35658
+ up: up1022,
35486
35659
  artifacts: { tables: ["dreaming_attention"] }
35487
35660
  },
35488
35661
  {
35489
35662
  version: 102,
35490
35663
  name: "attribute-semantic-memories",
35491
- up: up1022
35664
+ up: up1032
35492
35665
  },
35493
35666
  {
35494
35667
  version: 103,
35495
35668
  name: "semantic-memory-kind",
35496
- up: up1032
35669
+ up: up1042
35497
35670
  },
35498
35671
  {
35499
35672
  version: 104,
35500
35673
  name: "derived-memory-provenance",
35501
- up: up1042,
35674
+ up: up1052,
35502
35675
  artifacts: {
35503
35676
  tables: ["derived_memory_sources"],
35504
35677
  columns: [{ table: "memories", column: "stale_at" }]
@@ -35507,12 +35680,12 @@ var MIGRATIONS2 = [
35507
35680
  {
35508
35681
  version: 105,
35509
35682
  name: "agent-scoped-entity-name",
35510
- up: up1052
35683
+ up: up1062
35511
35684
  },
35512
35685
  {
35513
35686
  version: 106,
35514
35687
  name: "memory-review-after",
35515
- up: up1062,
35688
+ up: up1072,
35516
35689
  artifacts: {
35517
35690
  columns: [{ table: "memories", column: "review_after" }]
35518
35691
  }
@@ -35520,7 +35693,7 @@ var MIGRATIONS2 = [
35520
35693
  {
35521
35694
  version: 107,
35522
35695
  name: "dreaming-pass-usage",
35523
- up: up1072,
35696
+ up: up1082,
35524
35697
  artifacts: {
35525
35698
  columns: [
35526
35699
  { table: "dreaming_passes", column: "tokens_input" },
@@ -35534,7 +35707,7 @@ var MIGRATIONS2 = [
35534
35707
  {
35535
35708
  version: 108,
35536
35709
  name: "embedding-usage",
35537
- up: up1082,
35710
+ up: up1092,
35538
35711
  artifacts: {
35539
35712
  tables: ["embedding_usage"]
35540
35713
  }
@@ -35542,7 +35715,7 @@ var MIGRATIONS2 = [
35542
35715
  {
35543
35716
  version: 109,
35544
35717
  name: "telemetry-install",
35545
- up: up1092,
35718
+ up: up1102,
35546
35719
  artifacts: {
35547
35720
  tables: ["telemetry_install"]
35548
35721
  }
@@ -35550,12 +35723,12 @@ var MIGRATIONS2 = [
35550
35723
  {
35551
35724
  version: 110,
35552
35725
  name: "memory-mention-join-index",
35553
- up: up1102
35726
+ up: up1112
35554
35727
  },
35555
35728
  {
35556
35729
  version: 111,
35557
35730
  name: "telemetry-first-use",
35558
- up: up1112,
35731
+ up: up1122,
35559
35732
  artifacts: {
35560
35733
  columns: [
35561
35734
  { table: "telemetry_install", column: "first_remember_at" },
@@ -35566,7 +35739,7 @@ var MIGRATIONS2 = [
35566
35739
  {
35567
35740
  version: 112,
35568
35741
  name: "telemetry-queue-ownership",
35569
- up: up1122,
35742
+ up: up1132,
35570
35743
  artifacts: {
35571
35744
  columns: [
35572
35745
  { table: "telemetry_events", column: "source" },
@@ -35578,7 +35751,7 @@ var MIGRATIONS2 = [
35578
35751
  {
35579
35752
  version: 113,
35580
35753
  name: "session-claims",
35581
- up: up1132,
35754
+ up: up1142,
35582
35755
  artifacts: {
35583
35756
  tables: ["session_claims"],
35584
35757
  columns: [
@@ -35592,12 +35765,12 @@ var MIGRATIONS2 = [
35592
35765
  {
35593
35766
  version: 114,
35594
35767
  name: "memory-traversal-hydration-index",
35595
- up: up1142
35768
+ up: up1152
35596
35769
  },
35597
35770
  {
35598
35771
  version: 115,
35599
35772
  name: "cross-agent-message-notifications",
35600
- up: up1152,
35773
+ up: up1162,
35601
35774
  artifacts: {
35602
35775
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
35603
35776
  }
@@ -35605,7 +35778,7 @@ var MIGRATIONS2 = [
35605
35778
  {
35606
35779
  version: 116,
35607
35780
  name: "acp-delivery-reconciliation",
35608
- up: up1162,
35781
+ up: up1172,
35609
35782
  artifacts: {
35610
35783
  columns: [
35611
35784
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -35619,7 +35792,7 @@ var MIGRATIONS2 = [
35619
35792
  {
35620
35793
  version: 117,
35621
35794
  name: "retire-summary-worker",
35622
- up: up1172,
35795
+ up: up1182,
35623
35796
  artifacts: {
35624
35797
  columns: [
35625
35798
  { table: "session_transcripts", column: "completed_at" },
@@ -35630,24 +35803,24 @@ var MIGRATIONS2 = [
35630
35803
  {
35631
35804
  version: 118,
35632
35805
  name: "queue-pressure-indices",
35633
- up: up1182
35806
+ up: up1192
35634
35807
  },
35635
35808
  {
35636
35809
  version: 119,
35637
35810
  name: "telemetry-version-observation",
35638
- up: up1192,
35811
+ up: up1202,
35639
35812
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
35640
35813
  },
35641
35814
  {
35642
35815
  version: 120,
35643
35816
  name: "source-lifecycle-telemetry",
35644
- up: up1202,
35817
+ up: up1212,
35645
35818
  artifacts: { tables: ["source_lifecycle_state"] }
35646
35819
  },
35647
35820
  {
35648
35821
  version: 121,
35649
35822
  name: "telemetry-delivery-health",
35650
- up: up1212,
35823
+ up: up1222,
35651
35824
  artifacts: {
35652
35825
  tables: ["telemetry_delivery_state"],
35653
35826
  columns: [
@@ -35661,7 +35834,7 @@ var MIGRATIONS2 = [
35661
35834
  {
35662
35835
  version: 122,
35663
35836
  name: "dreaming-evidence-retry",
35664
- up: up1222,
35837
+ up: up1232,
35665
35838
  artifacts: {
35666
35839
  columns: [
35667
35840
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -35674,13 +35847,13 @@ var MIGRATIONS2 = [
35674
35847
  {
35675
35848
  version: 123,
35676
35849
  name: "embedding-index-failures",
35677
- up: up1232,
35850
+ up: up1242,
35678
35851
  artifacts: { tables: ["embedding_index_failures"] }
35679
35852
  },
35680
35853
  {
35681
35854
  version: 124,
35682
35855
  name: "import-derived-lifecycle",
35683
- up: up1242,
35856
+ up: up1252,
35684
35857
  artifacts: {
35685
35858
  tables: ["imported_source_lifecycle"]
35686
35859
  }
@@ -35688,77 +35861,77 @@ var MIGRATIONS2 = [
35688
35861
  {
35689
35862
  version: 125,
35690
35863
  name: "memory-content-safety",
35691
- up: up1252,
35864
+ up: up1262,
35692
35865
  artifacts: { tables: ["memory_content_safety"] }
35693
35866
  },
35694
35867
  {
35695
35868
  version: 126,
35696
35869
  name: "dreaming-surprisal-attention",
35697
- up: up1262,
35870
+ up: up1272,
35698
35871
  artifacts: { tables: ["dreaming_attention"] }
35699
35872
  },
35700
35873
  {
35701
35874
  version: 127,
35702
35875
  name: "ontology-contradictions",
35703
- up: up1272,
35876
+ up: up1282,
35704
35877
  artifacts: { tables: ["ontology_contradictions"] }
35705
35878
  },
35706
35879
  {
35707
35880
  version: 128,
35708
35881
  name: "bounded-queue-diagnostics",
35709
- up: up1282
35882
+ up: up1292
35710
35883
  },
35711
35884
  {
35712
35885
  version: 129,
35713
35886
  name: "retire-structural-jobs",
35714
- up: up1292
35887
+ up: up1302
35715
35888
  },
35716
35889
  {
35717
35890
  version: 130,
35718
35891
  name: "embedding-repair-state",
35719
- up: up1302,
35892
+ up: up1312,
35720
35893
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
35721
35894
  },
35722
35895
  {
35723
35896
  version: 131,
35724
35897
  name: "dreaming-evidence-consumption",
35725
- up: up1312,
35898
+ up: up1322,
35726
35899
  artifacts: { tables: ["dreaming_evidence_consumption"] }
35727
35900
  },
35728
35901
  {
35729
35902
  version: 132,
35730
35903
  name: "observer-scoped-epistemic-assertions",
35731
- up: up1322,
35904
+ up: up1332,
35732
35905
  artifacts: { tables: ["epistemic_assertions"] }
35733
35906
  },
35734
35907
  {
35735
35908
  version: 133,
35736
35909
  name: "dreaming-memory-head",
35737
- up: up1332,
35910
+ up: up1342,
35738
35911
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
35739
35912
  },
35740
35913
  {
35741
35914
  version: 134,
35742
35915
  name: "scope-memory-head-entries",
35743
- up: up1342,
35916
+ up: up1352,
35744
35917
  artifacts: { tables: ["memory_head_entries"] }
35745
35918
  },
35746
35919
  {
35747
35920
  version: 135,
35748
35921
  name: "memory-head-publication",
35749
- up: up1352,
35922
+ up: up1362,
35750
35923
  artifacts: { tables: ["memory_head_publications"] }
35751
35924
  },
35752
35925
  {
35753
35926
  version: 136,
35754
35927
  name: "memory-head-revisions",
35755
- up: up1362,
35928
+ up: up1372,
35756
35929
  artifacts: { tables: ["memory_head_revisions"] }
35757
35930
  },
35758
35931
  {
35759
35932
  version: 137,
35760
35933
  name: "dreaming-head-manifest",
35761
- up: up1372,
35934
+ up: up1382,
35762
35935
  artifacts: {
35763
35936
  columns: [
35764
35937
  { table: "dreaming_passes", column: "head_revision" },
@@ -35769,7 +35942,7 @@ var MIGRATIONS2 = [
35769
35942
  {
35770
35943
  version: 138,
35771
35944
  name: "bounded-status-projections",
35772
- up: up1382,
35945
+ up: up1392,
35773
35946
  artifacts: {
35774
35947
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
35775
35948
  }
@@ -35777,31 +35950,31 @@ var MIGRATIONS2 = [
35777
35950
  {
35778
35951
  version: 139,
35779
35952
  name: "native-source-sync-state",
35780
- up: up1392,
35953
+ up: up1402,
35781
35954
  artifacts: { tables: ["native_source_sync_state"] }
35782
35955
  },
35783
35956
  {
35784
35957
  version: 140,
35785
35958
  name: "transcript-recovery-frontier",
35786
- up: up1402,
35959
+ up: up1412,
35787
35960
  artifacts: { tables: ["transcript_recovery_frontiers"] }
35788
35961
  },
35789
35962
  {
35790
35963
  version: 141,
35791
35964
  name: "source-sync-checkpoints",
35792
- up: up1412,
35965
+ up: up1422,
35793
35966
  artifacts: { tables: ["source_sync_checkpoints"] }
35794
35967
  },
35795
35968
  {
35796
35969
  version: 142,
35797
35970
  name: "source-sync-frontier",
35798
- up: up1422,
35971
+ up: up1432,
35799
35972
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
35800
35973
  },
35801
35974
  {
35802
35975
  version: 143,
35803
35976
  name: "embedding-index-progress",
35804
- up: up1432,
35977
+ up: up1442,
35805
35978
  artifacts: {
35806
35979
  columns: [
35807
35980
  { table: "embedding_index_state", column: "migration_phase" },
@@ -35817,19 +35990,19 @@ var MIGRATIONS2 = [
35817
35990
  {
35818
35991
  version: 144,
35819
35992
  name: "memory-job-lease-token",
35820
- up: up1442,
35993
+ up: up1452,
35821
35994
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
35822
35995
  },
35823
35996
  {
35824
35997
  version: 145,
35825
35998
  name: "dreaming-evidence-reviews",
35826
- up: up1452,
35999
+ up: up1462,
35827
36000
  artifacts: { tables: ["dreaming_evidence_reviews"] }
35828
36001
  },
35829
36002
  {
35830
36003
  version: 146,
35831
36004
  name: "source-transcript-import",
35832
- up: up1462,
36005
+ up: up1472,
35833
36006
  artifacts: {
35834
36007
  tables: [
35835
36008
  "source_import_jobs",
@@ -35848,19 +36021,19 @@ var MIGRATIONS2 = [
35848
36021
  {
35849
36022
  version: 147,
35850
36023
  name: "source-import-replay-file-slots",
35851
- up: up1472,
36024
+ up: up1482,
35852
36025
  artifacts: { tables: ["source_import_files"] }
35853
36026
  },
35854
36027
  {
35855
36028
  version: 148,
35856
36029
  name: "source-import-attempt-provenance",
35857
- up: up1482,
36030
+ up: up1492,
35858
36031
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
35859
36032
  },
35860
36033
  {
35861
36034
  version: 149,
35862
36035
  name: "transcript-import-state-machine",
35863
- up: up1492,
36036
+ up: up1502,
35864
36037
  artifacts: {
35865
36038
  columns: [
35866
36039
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -35872,13 +36045,42 @@ var MIGRATIONS2 = [
35872
36045
  {
35873
36046
  version: 150,
35874
36047
  name: "memory-head-freshness",
35875
- up: up1502,
36048
+ up: up1512,
35876
36049
  artifacts: {
35877
36050
  columns: [
35878
36051
  { table: "memory_md_heads", column: "is_current" },
35879
36052
  { table: "dreaming_passes", column: "head_base_revision" }
35880
36053
  ]
35881
36054
  }
36055
+ },
36056
+ {
36057
+ version: 151,
36058
+ name: "transcript-import-bytes",
36059
+ up: up152,
36060
+ artifacts: {
36061
+ tables: [
36062
+ "source_import_chunks",
36063
+ "source_import_capacity",
36064
+ "source_import_migrations",
36065
+ "source_import_migration_streams",
36066
+ "source_import_migration_counts"
36067
+ ],
36068
+ columns: [
36069
+ { table: "source_import_files", column: "storage_state" },
36070
+ { table: "source_import_files", column: "upload_generation" },
36071
+ { table: "source_import_files", column: "upload_offset" },
36072
+ { table: "source_import_files", column: "upload_size" },
36073
+ { table: "source_import_files", column: "upload_digest" },
36074
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
36075
+ table: "source_import_files",
36076
+ column
36077
+ })),
36078
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
36079
+ table: "source_import_jobs",
36080
+ column
36081
+ }))
36082
+ ]
36083
+ }
35882
36084
  }
35883
36085
  ];
35884
36086
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;