@signetai/connector-forge 0.221.8 → 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;
@@ -29682,6 +29783,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
29682
29783
  "checkpoint",
29683
29784
  "dreaming"
29684
29785
  ];
29786
+ function up152(db) {
29787
+ const hasColumn26 = (table, column) => {
29788
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
29789
+ try {
29790
+ return statement.get(column) != null;
29791
+ } finally {
29792
+ statement.finalize?.();
29793
+ }
29794
+ };
29795
+ for (const [column, definition] of [
29796
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
29797
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
29798
+ ["upload_size", "INTEGER"],
29799
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
29800
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
29801
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
29802
+ ["original_path", "TEXT"],
29803
+ [
29804
+ "storage_state",
29805
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
29806
+ ]
29807
+ ]) {
29808
+ if (!hasColumn26("source_import_files", column))
29809
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
29810
+ }
29811
+ if (!hasColumn26("source_import_jobs", "retry_count"))
29812
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
29813
+ if (!hasColumn26("source_import_jobs", "cleanup_state"))
29814
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
29815
+ if (!hasColumn26("source_import_jobs", "retry_cursor"))
29816
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
29817
+ if (!hasColumn26("source_import_jobs", "retry_requested"))
29818
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
29819
+ db.exec(`
29820
+ 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);
29821
+ 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;
29822
+ 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;
29823
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
29824
+ 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));
29825
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
29826
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
29827
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
29828
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
29829
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
29830
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
29831
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
29832
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
29833
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
29834
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
29835
+ ) WITHOUT ROWID;
29836
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
29837
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
29838
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
29839
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
29840
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
29841
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
29842
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
29843
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
29844
+ `);
29845
+ }
29685
29846
  var MEMORIES_FTS_TOKENIZER2 = "unicode61";
29686
29847
  var FTS_STATE_TABLE2 = "memories_fts_state";
29687
29848
  function normalizeSql2(sql) {
@@ -29797,7 +29958,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
29797
29958
  return true;
29798
29959
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
29799
29960
  }
29800
- function up151(db) {
29961
+ function up210(db) {
29801
29962
  db.exec(`
29802
29963
  CREATE TABLE IF NOT EXISTS schema_migrations (
29803
29964
  version INTEGER PRIMARY KEY,
@@ -29895,7 +30056,7 @@ function addColumnIfMissing29(db, table, column, definition) {
29895
30056
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29896
30057
  }
29897
30058
  }
29898
- function up210(db) {
30059
+ function up310(db) {
29899
30060
  addColumnIfMissing29(db, "memories", "content_hash", "TEXT");
29900
30061
  addColumnIfMissing29(db, "memories", "normalized_content", "TEXT");
29901
30062
  addColumnIfMissing29(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -30013,7 +30174,7 @@ function addColumnIfMissing210(db, table, column, definition) {
30013
30174
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30014
30175
  return true;
30015
30176
  }
30016
- function up310(db) {
30177
+ function up410(db) {
30017
30178
  addColumnIfMissing210(db, "memories", "why", "TEXT");
30018
30179
  addColumnIfMissing210(db, "memories", "project", "TEXT");
30019
30180
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -30050,7 +30211,7 @@ function addColumnIfMissing32(db, table, column, definition) {
30050
30211
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30051
30212
  }
30052
30213
  }
30053
- function up410(db) {
30214
+ function up510(db) {
30054
30215
  addColumnIfMissing32(db, "memory_history", "actor_type", "TEXT");
30055
30216
  addColumnIfMissing32(db, "memory_history", "session_id", "TEXT");
30056
30217
  addColumnIfMissing32(db, "memory_history", "request_id", "TEXT");
@@ -30083,7 +30244,7 @@ function addColumnIfMissing42(db, table, column, definition) {
30083
30244
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30084
30245
  }
30085
30246
  }
30086
- function up510(db) {
30247
+ function up610(db) {
30087
30248
  addColumnIfMissing42(db, "entities", "canonical_name", "TEXT");
30088
30249
  addColumnIfMissing42(db, "entities", "mentions", "INTEGER DEFAULT 0");
30089
30250
  addColumnIfMissing42(db, "entities", "embedding", "BLOB");
@@ -30100,7 +30261,7 @@ function hasColumn42(db, table, column) {
30100
30261
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
30101
30262
  return rows.some((r3) => r3.name === column);
30102
30263
  }
30103
- function up610(db) {
30264
+ function up710(db) {
30104
30265
  if (!hasColumn42(db, "memories", "idempotency_key")) {
30105
30266
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
30106
30267
  }
@@ -30115,7 +30276,7 @@ function hasColumn52(db, table, column) {
30115
30276
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
30116
30277
  return rows.some((r3) => r3.name === column);
30117
30278
  }
30118
- function up710(db) {
30279
+ function up810(db) {
30119
30280
  db.exec(`
30120
30281
  CREATE TABLE IF NOT EXISTS documents (
30121
30282
  id TEXT PRIMARY KEY,
@@ -30172,7 +30333,7 @@ function up710(db) {
30172
30333
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
30173
30334
  }
30174
30335
  }
30175
- function up810(db) {
30336
+ function up910(db) {
30176
30337
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
30177
30338
  if (tables.length === 0)
30178
30339
  return;
@@ -30189,7 +30350,7 @@ function up810(db) {
30189
30350
  ON embeddings(content_hash)
30190
30351
  `);
30191
30352
  }
30192
- function up910(db) {
30353
+ function up1010(db) {
30193
30354
  db.exec(`
30194
30355
  CREATE TABLE IF NOT EXISTS summary_jobs (
30195
30356
  id TEXT PRIMARY KEY,
@@ -30209,7 +30370,7 @@ function up910(db) {
30209
30370
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
30210
30371
  ON summary_jobs(status)`);
30211
30372
  }
30212
- function up1010(db) {
30373
+ function up1110(db) {
30213
30374
  db.exec(`
30214
30375
  CREATE TABLE IF NOT EXISTS umap_cache (
30215
30376
  id INTEGER PRIMARY KEY,
@@ -30220,7 +30381,7 @@ function up1010(db) {
30220
30381
  )
30221
30382
  `);
30222
30383
  }
30223
- function up1110(db) {
30384
+ function up1210(db) {
30224
30385
  db.exec(`
30225
30386
  CREATE TABLE IF NOT EXISTS session_scores (
30226
30387
  id TEXT PRIMARY KEY,
@@ -30240,7 +30401,7 @@ function up1110(db) {
30240
30401
  ON session_scores(session_key);
30241
30402
  `);
30242
30403
  }
30243
- function up1210(db) {
30404
+ function up1310(db) {
30244
30405
  db.exec(`
30245
30406
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
30246
30407
  id TEXT PRIMARY KEY,
@@ -30281,7 +30442,7 @@ function addColumnIfMissing52(db, table, column, definition) {
30281
30442
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30282
30443
  }
30283
30444
  }
30284
- function up1310(db) {
30445
+ function up1410(db) {
30285
30446
  db.exec(`
30286
30447
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
30287
30448
  id TEXT PRIMARY KEY,
@@ -30307,7 +30468,7 @@ function up1310(db) {
30307
30468
  addColumnIfMissing52(db, "memories", "source_path", "TEXT");
30308
30469
  addColumnIfMissing52(db, "memories", "source_section", "TEXT");
30309
30470
  }
30310
- function up1410(db) {
30471
+ function up153(db) {
30311
30472
  db.exec(`
30312
30473
  CREATE TABLE IF NOT EXISTS telemetry_events (
30313
30474
  id TEXT PRIMARY KEY,
@@ -30332,7 +30493,7 @@ function addColumnIfMissing62(db, table, column, definition) {
30332
30493
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30333
30494
  }
30334
30495
  }
30335
- function up152(db) {
30496
+ function up162(db) {
30336
30497
  db.exec(`
30337
30498
  CREATE TABLE IF NOT EXISTS session_memories (
30338
30499
  id TEXT PRIMARY KEY,
@@ -30359,7 +30520,7 @@ function up152(db) {
30359
30520
  addColumnIfMissing62(db, "session_scores", "confidence", "REAL");
30360
30521
  addColumnIfMissing62(db, "session_scores", "continuity_reasoning", "TEXT");
30361
30522
  }
30362
- function up162(db) {
30523
+ function up172(db) {
30363
30524
  db.exec(`
30364
30525
  CREATE TABLE IF NOT EXISTS session_checkpoints (
30365
30526
  id TEXT PRIMARY KEY,
@@ -30381,7 +30542,7 @@ function up162(db) {
30381
30542
  ON session_checkpoints(project_normalized, created_at DESC);
30382
30543
  `);
30383
30544
  }
30384
- function up172(db) {
30545
+ function up182(db) {
30385
30546
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
30386
30547
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
30387
30548
  if (!colNames.has("skill_name")) {
@@ -30392,7 +30553,7 @@ function up172(db) {
30392
30553
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
30393
30554
  }
30394
30555
  }
30395
- function up182(db) {
30556
+ function up192(db) {
30396
30557
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
30397
30558
  if (existing)
30398
30559
  return;
@@ -30424,7 +30585,7 @@ function up182(db) {
30424
30585
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
30425
30586
  `);
30426
30587
  }
30427
- function up192(db) {
30588
+ function up202(db) {
30428
30589
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
30429
30590
  const entityColNames = new Set(entityCols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
30430
30591
  if (!entityColNames.has("agent_id")) {
@@ -30509,13 +30670,13 @@ function addColumnIfMissing72(db, table, column, definition) {
30509
30670
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30510
30671
  }
30511
30672
  }
30512
- function up202(db) {
30673
+ function up212(db) {
30513
30674
  addColumnIfMissing72(db, "session_memories", "entity_slot", "INTEGER");
30514
30675
  addColumnIfMissing72(db, "session_memories", "aspect_slot", "INTEGER");
30515
30676
  addColumnIfMissing72(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
30516
30677
  addColumnIfMissing72(db, "session_memories", "structural_density", "INTEGER");
30517
30678
  }
30518
- function up212(db) {
30679
+ function up222(db) {
30519
30680
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
30520
30681
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
30521
30682
  if (!columnNames.has("focal_entity_ids")) {
@@ -30540,25 +30701,25 @@ function addColumnIfMissing82(db, table, column, definition) {
30540
30701
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30541
30702
  }
30542
30703
  }
30543
- function up222(db) {
30704
+ function up232(db) {
30544
30705
  addColumnIfMissing82(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
30545
30706
  addColumnIfMissing82(db, "entities", "pinned_at", "TEXT");
30546
30707
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
30547
30708
  }
30548
- function up232(_db) {}
30549
30709
  function up242(_db) {}
30710
+ function up252(_db) {}
30550
30711
  function addColumnIfMissing92(db, table, column, definition) {
30551
30712
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
30552
30713
  if (!cols.some((c3) => c3.name === column)) {
30553
30714
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30554
30715
  }
30555
30716
  }
30556
- function up252(db) {
30717
+ function up262(db) {
30557
30718
  addColumnIfMissing92(db, "session_memories", "agent_relevance_score", "REAL");
30558
30719
  addColumnIfMissing92(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
30559
30720
  }
30560
- function up262(_db) {}
30561
- function up272(db) {
30721
+ function up272(_db) {}
30722
+ function up282(db) {
30562
30723
  db.exec(`
30563
30724
  UPDATE entities
30564
30725
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -30567,7 +30728,7 @@ function up272(db) {
30567
30728
  WHERE canonical_name IS NULL
30568
30729
  `);
30569
30730
  }
30570
- function up282(db) {
30731
+ function up292(db) {
30571
30732
  db.exec(`
30572
30733
  CREATE TABLE IF NOT EXISTS memories_cold (
30573
30734
  archive_id TEXT PRIMARY KEY,
@@ -30604,7 +30765,7 @@ function up282(db) {
30604
30765
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
30605
30766
  `);
30606
30767
  }
30607
- function up292(db) {
30768
+ function up302(db) {
30608
30769
  db.exec(`
30609
30770
  CREATE TABLE IF NOT EXISTS session_summaries (
30610
30771
  id TEXT PRIMARY KEY,
@@ -30649,7 +30810,7 @@ function up292(db) {
30649
30810
  WHERE session_key IS NOT NULL;
30650
30811
  `);
30651
30812
  }
30652
- function up302(db) {
30813
+ function up312(db) {
30653
30814
  db.exec(`
30654
30815
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
30655
30816
  id TEXT PRIMARY KEY,
@@ -30694,7 +30855,7 @@ function up302(db) {
30694
30855
  ON memory_jobs(failed_at);
30695
30856
  `);
30696
30857
  }
30697
- function up312(db) {
30858
+ function up322(db) {
30698
30859
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30699
30860
  if (!depCols.some((c3) => c3.name === "reason")) {
30700
30861
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -30704,7 +30865,7 @@ function up312(db) {
30704
30865
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
30705
30866
  }
30706
30867
  }
30707
- function up322(db) {
30868
+ function up332(db) {
30708
30869
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
30709
30870
  if (cols.length === 0)
30710
30871
  return;
@@ -30712,14 +30873,14 @@ function up322(db) {
30712
30873
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
30713
30874
  }
30714
30875
  }
30715
- function up332(db) {
30876
+ function up342(db) {
30716
30877
  const cols = db.prepare("PRAGMA table_info(memories)").all();
30717
30878
  if (!cols.some((c3) => c3.name === "scope")) {
30718
30879
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
30719
30880
  }
30720
30881
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
30721
30882
  }
30722
- function up342(db) {
30883
+ function up352(db) {
30723
30884
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
30724
30885
  db.exec(`
30725
30886
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -30727,7 +30888,7 @@ function up342(db) {
30727
30888
  WHERE content_hash IS NOT NULL AND is_deleted = 0
30728
30889
  `);
30729
30890
  }
30730
- function up352(db) {
30891
+ function up362(db) {
30731
30892
  db.exec(`
30732
30893
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
30733
30894
  name, canonical_name,
@@ -30759,13 +30920,13 @@ function up352(db) {
30759
30920
  END
30760
30921
  `);
30761
30922
  }
30762
- function up362(db) {
30923
+ function up372(db) {
30763
30924
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30764
30925
  if (!cols.some((c3) => c3.name === "confidence")) {
30765
30926
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
30766
30927
  }
30767
30928
  }
30768
- function up372(db) {
30929
+ function up382(db) {
30769
30930
  db.exec(`
30770
30931
  CREATE TABLE IF NOT EXISTS entity_communities (
30771
30932
  id TEXT PRIMARY KEY,
@@ -30783,7 +30944,7 @@ function up372(db) {
30783
30944
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
30784
30945
  }
30785
30946
  }
30786
- function up382(db) {
30947
+ function up392(db) {
30787
30948
  db.exec(`
30788
30949
  CREATE TABLE IF NOT EXISTS memory_hints (
30789
30950
  id TEXT PRIMARY KEY,
@@ -30823,7 +30984,7 @@ function up382(db) {
30823
30984
  END
30824
30985
  `);
30825
30986
  }
30826
- function up392(db) {
30987
+ function up402(db) {
30827
30988
  db.exec(`
30828
30989
  DELETE FROM entity_dependencies
30829
30990
  WHERE id NOT IN (
@@ -30841,7 +31002,7 @@ function up392(db) {
30841
31002
  )
30842
31003
  `);
30843
31004
  }
30844
- function up402(db) {
31005
+ function up412(db) {
30845
31006
  db.exec(`
30846
31007
  CREATE TABLE IF NOT EXISTS session_transcripts (
30847
31008
  session_key TEXT PRIMARY KEY,
@@ -30864,7 +31025,7 @@ function addColumnIfMissing102(db, table, column, definition) {
30864
31025
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30865
31026
  }
30866
31027
  }
30867
- function up412(db) {
31028
+ function up422(db) {
30868
31029
  addColumnIfMissing102(db, "session_memories", "path_json", "TEXT");
30869
31030
  db.exec(`
30870
31031
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -30939,7 +31100,7 @@ function addColumnIfMissing112(db, table, column, definition) {
30939
31100
  return;
30940
31101
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30941
31102
  }
30942
- function up422(db) {
31103
+ function up432(db) {
30943
31104
  addColumnIfMissing112(db, "session_memories", "entity_slot", "INTEGER");
30944
31105
  addColumnIfMissing112(db, "session_memories", "aspect_slot", "INTEGER");
30945
31106
  addColumnIfMissing112(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -31027,7 +31188,7 @@ function addColumnIfMissing122(db, table, column, definition) {
31027
31188
  return;
31028
31189
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31029
31190
  }
31030
- function up432(db) {
31191
+ function up442(db) {
31031
31192
  db.exec(`
31032
31193
  CREATE TABLE IF NOT EXISTS agents (
31033
31194
  id TEXT PRIMARY KEY,
@@ -31056,7 +31217,7 @@ function addColumnIfMissing132(db, table, column, definition) {
31056
31217
  return;
31057
31218
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31058
31219
  }
31059
- function up442(db) {
31220
+ function up452(db) {
31060
31221
  addColumnIfMissing132(db, "session_summaries", "source_type", "TEXT");
31061
31222
  addColumnIfMissing132(db, "session_summaries", "source_ref", "TEXT");
31062
31223
  addColumnIfMissing132(db, "session_summaries", "meta_json", "TEXT");
@@ -31082,7 +31243,7 @@ function addColumnIfMissing142(db, table, column, definition) {
31082
31243
  return;
31083
31244
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31084
31245
  }
31085
- function up452(db) {
31246
+ function up462(db) {
31086
31247
  addColumnIfMissing142(db, "session_transcripts", "updated_at", "TEXT");
31087
31248
  addColumnIfMissing142(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
31088
31249
  addColumnIfMissing142(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -31153,7 +31314,7 @@ function up452(db) {
31153
31314
  ON memory_md_heads(lease_expires_at);
31154
31315
  `);
31155
31316
  }
31156
- function up462(db) {
31317
+ function up472(db) {
31157
31318
  db.exec(`
31158
31319
  DROP INDEX IF EXISTS idx_summaries_session_depth;
31159
31320
 
@@ -31214,7 +31375,7 @@ function up462(db) {
31214
31375
  AND COALESCE(source_type, 'summary') = 'summary';
31215
31376
  `);
31216
31377
  }
31217
- function up472(db) {
31378
+ function up482(db) {
31218
31379
  db.exec(`
31219
31380
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
31220
31381
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -31312,7 +31473,7 @@ function up472(db) {
31312
31473
  AND COALESCE(source_type, 'summary') = 'summary';
31313
31474
  `);
31314
31475
  }
31315
- function up482(db) {
31476
+ function up492(db) {
31316
31477
  db.exec(`
31317
31478
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
31318
31479
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -31430,7 +31591,7 @@ function up482(db) {
31430
31591
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
31431
31592
  `);
31432
31593
  }
31433
- function up492(db) {
31594
+ function up502(db) {
31434
31595
  db.exec(`
31435
31596
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
31436
31597
  session_key TEXT NOT NULL,
@@ -31447,7 +31608,7 @@ function hasTable5(db, name) {
31447
31608
  WHERE type = 'table' AND name = ?
31448
31609
  LIMIT 1`).get(name) !== undefined;
31449
31610
  }
31450
- function up502(db) {
31611
+ function up512(db) {
31451
31612
  db.exec(`
31452
31613
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
31453
31614
  id TEXT PRIMARY KEY,
@@ -31617,7 +31778,7 @@ function addColumnIfMissing152(db, table, column, definition) {
31617
31778
  return;
31618
31779
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31619
31780
  }
31620
- function up512(db) {
31781
+ function up522(db) {
31621
31782
  addColumnIfMissing152(db, "summary_jobs", "session_id", "TEXT");
31622
31783
  addColumnIfMissing152(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
31623
31784
  addColumnIfMissing152(db, "summary_jobs", "captured_at", "TEXT");
@@ -31709,7 +31870,7 @@ function up512(db) {
31709
31870
  VALUES ('rebuild');
31710
31871
  `);
31711
31872
  }
31712
- function up522(db) {
31873
+ function up532(db) {
31713
31874
  db.exec(`
31714
31875
  CREATE TABLE IF NOT EXISTS mcp_invocations (
31715
31876
  id TEXT PRIMARY KEY,
@@ -31726,7 +31887,7 @@ function up522(db) {
31726
31887
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
31727
31888
  `);
31728
31889
  }
31729
- function up532(db) {
31890
+ function up542(db) {
31730
31891
  db.exec(`
31731
31892
  CREATE TABLE IF NOT EXISTS skill_invocations (
31732
31893
  id TEXT PRIMARY KEY,
@@ -31742,7 +31903,7 @@ function up532(db) {
31742
31903
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
31743
31904
  `);
31744
31905
  }
31745
- function up542(db) {
31906
+ function up552(db) {
31746
31907
  db.exec(`
31747
31908
  CREATE TABLE IF NOT EXISTS task_scope_hints (
31748
31909
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -31773,7 +31934,7 @@ function up542(db) {
31773
31934
  ON task_scope_hints(agent_id, updated_at);
31774
31935
  `);
31775
31936
  }
31776
- function up552(db) {
31937
+ function up562(db) {
31777
31938
  db.exec(`
31778
31939
  CREATE TABLE IF NOT EXISTS dreaming_state (
31779
31940
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -31816,7 +31977,7 @@ function ensureMemoriesScopeColumns3(db) {
31816
31977
  if (!names.has("scope"))
31817
31978
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
31818
31979
  }
31819
- function up562(db) {
31980
+ function up572(db) {
31820
31981
  ensureMemoriesScopeColumns3(db);
31821
31982
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
31822
31983
  db.exec(`
@@ -31829,20 +31990,20 @@ function up562(db) {
31829
31990
  WHERE content_hash IS NOT NULL AND is_deleted = 0
31830
31991
  `);
31831
31992
  }
31832
- function up572(db) {
31993
+ function up582(db) {
31833
31994
  const sql = readMemoriesFtsSql2(db);
31834
31995
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
31835
31996
  return;
31836
31997
  recreateMemoriesFts2(db);
31837
31998
  }
31838
- function up582(db) {
31999
+ function up592(db) {
31839
32000
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
31840
32001
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
31841
32002
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
31842
32003
  ON entities(entity_type, mentions)
31843
32004
  WHERE entity_type = 'extracted'`);
31844
32005
  }
31845
- function up592(db) {
32006
+ function up602(db) {
31846
32007
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31847
32008
  if (!cols.some((col) => col.name === "claim_key")) {
31848
32009
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -31851,7 +32012,7 @@ function up592(db) {
31851
32012
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
31852
32013
  WHERE claim_key IS NOT NULL`);
31853
32014
  }
31854
- function up602(db) {
32015
+ function up612(db) {
31855
32016
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31856
32017
  if (!cols.some((col) => col.name === "group_key")) {
31857
32018
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -31863,13 +32024,13 @@ function up602(db) {
31863
32024
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
31864
32025
  WHERE claim_key IS NOT NULL`);
31865
32026
  }
31866
- function up612(db) {
32027
+ function up622(db) {
31867
32028
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31868
32029
  if (cols.some((col) => col.name === "source_mtime_ms"))
31869
32030
  return;
31870
32031
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
31871
32032
  }
31872
- function up622(db) {
32033
+ function up632(db) {
31873
32034
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31874
32035
  const names = new Set(cols.map((col) => col.name));
31875
32036
  if (!names.has("is_deleted")) {
@@ -31883,7 +32044,7 @@ function up622(db) {
31883
32044
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
31884
32045
  `);
31885
32046
  }
31886
- function up632(db) {
32047
+ function up642(db) {
31887
32048
  db.exec("DROP TRIGGER IF EXISTS memories_au");
31888
32049
  db.exec(`
31889
32050
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -31901,7 +32062,7 @@ function addColumnIfMissing162(db, table, column, definition) {
31901
32062
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31902
32063
  }
31903
32064
  }
31904
- function up642(db) {
32065
+ function up652(db) {
31905
32066
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
31906
32067
  addColumnIfMissing162(db, table, "source_id", "TEXT");
31907
32068
  addColumnIfMissing162(db, table, "source_kind", "TEXT");
@@ -31921,7 +32082,7 @@ function hasColumn72(db, table, column) {
31921
32082
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31922
32083
  return rows.some((row) => row.name === column);
31923
32084
  }
31924
- function up652(db) {
32085
+ function up662(db) {
31925
32086
  if (!hasTable22(db, "embeddings"))
31926
32087
  return;
31927
32088
  if (!hasColumn72(db, "embeddings", "agent_id")) {
@@ -31929,7 +32090,7 @@ function up652(db) {
31929
32090
  }
31930
32091
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
31931
32092
  }
31932
- function up662(db) {
32093
+ function up672(db) {
31933
32094
  db.exec(`
31934
32095
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
31935
32096
  id TEXT PRIMARY KEY,
@@ -31970,7 +32131,7 @@ function addColumnIfMissing172(db, table, column, definition) {
31970
32131
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31971
32132
  }
31972
32133
  }
31973
- function up672(db) {
32134
+ function up682(db) {
31974
32135
  db.exec(`
31975
32136
  CREATE TABLE IF NOT EXISTS ontology_proposals (
31976
32137
  id TEXT PRIMARY KEY,
@@ -32013,7 +32174,7 @@ function up672(db) {
32013
32174
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
32014
32175
  }
32015
32176
  }
32016
- function up682(db) {
32177
+ function up692(db) {
32017
32178
  db.exec(`
32018
32179
  CREATE TABLE IF NOT EXISTS daily_reflections (
32019
32180
  id TEXT PRIMARY KEY,
@@ -32040,7 +32201,7 @@ function up682(db) {
32040
32201
  WHERE content_key IS NOT NULL;
32041
32202
  `);
32042
32203
  }
32043
- function up692(db) {
32204
+ function up702(db) {
32044
32205
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
32045
32206
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
32046
32207
  if (!colNames.has("content_key")) {
@@ -32077,7 +32238,7 @@ function backfillVersionRoots2(db) {
32077
32238
  WHERE version_root_id IS NULL
32078
32239
  `);
32079
32240
  }
32080
- function up702(db) {
32241
+ function up712(db) {
32081
32242
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
32082
32243
  addColumnIfMissing182(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
32083
32244
  addColumnIfMissing182(db, table, "archived_at", "TEXT");
@@ -32112,7 +32273,7 @@ function up702(db) {
32112
32273
  ON entity_aspects(agent_id, proposal_id);
32113
32274
  `);
32114
32275
  }
32115
- function up712(db) {
32276
+ function up722(db) {
32116
32277
  db.exec(`
32117
32278
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
32118
32279
  id TEXT PRIMARY KEY,
@@ -32168,7 +32329,7 @@ function ensureMemoriesScopeColumns22(db) {
32168
32329
  if (!names.has("runtime_path"))
32169
32330
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
32170
32331
  }
32171
- function up722(db) {
32332
+ function up732(db) {
32172
32333
  ensureMemoriesScopeColumns22(db);
32173
32334
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
32174
32335
  db.exec(`
@@ -32182,7 +32343,7 @@ function up722(db) {
32182
32343
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
32183
32344
  `);
32184
32345
  }
32185
- function up732(db) {
32346
+ function up742(db) {
32186
32347
  db.exec(`
32187
32348
  CREATE TABLE IF NOT EXISTS session_context_epochs (
32188
32349
  session_key TEXT NOT NULL,
@@ -32217,7 +32378,7 @@ function up732(db) {
32217
32378
  ON session_recall_events(item_kind, item_id, created_at DESC);
32218
32379
  `);
32219
32380
  }
32220
- function up742(db) {
32381
+ function up752(db) {
32221
32382
  db.exec(`
32222
32383
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
32223
32384
  aggregate_memory_id TEXT NOT NULL,
@@ -32236,7 +32397,7 @@ function addColumnIfMissing192(db, table, column, definition) {
32236
32397
  return;
32237
32398
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32238
32399
  }
32239
- function up752(db) {
32400
+ function up762(db) {
32240
32401
  addColumnIfMissing192(db, "memory_artifacts", "source_id", "TEXT");
32241
32402
  addColumnIfMissing192(db, "memory_artifacts", "source_root", "TEXT");
32242
32403
  addColumnIfMissing192(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -32249,7 +32410,7 @@ function up752(db) {
32249
32410
  ON memory_artifacts(agent_id, source_id, source_root);
32250
32411
  `);
32251
32412
  }
32252
- function up762(db) {
32413
+ function up772(db) {
32253
32414
  db.exec(`
32254
32415
  CREATE TABLE IF NOT EXISTS temporal_edges (
32255
32416
  id TEXT PRIMARY KEY,
@@ -32272,7 +32433,7 @@ function up762(db) {
32272
32433
  ON temporal_edges(agent_id, subject_type, subject_id);
32273
32434
  `);
32274
32435
  }
32275
- function up772(db) {
32436
+ function up782(db) {
32276
32437
  db.exec(`
32277
32438
  CREATE TABLE IF NOT EXISTS entity_aliases (
32278
32439
  id TEXT PRIMARY KEY,
@@ -32296,7 +32457,7 @@ function up772(db) {
32296
32457
  ON entity_aliases(agent_id, canonical_alias, status);
32297
32458
  `);
32298
32459
  }
32299
- function up782(db) {
32460
+ function up792(db) {
32300
32461
  db.exec(`
32301
32462
  CREATE TABLE IF NOT EXISTS api_keys (
32302
32463
  id TEXT PRIMARY KEY,
@@ -32324,7 +32485,7 @@ function up782(db) {
32324
32485
  ON api_keys(connector, harness);
32325
32486
  `);
32326
32487
  }
32327
- function up792(db) {
32488
+ function up802(db) {
32328
32489
  db.exec(`
32329
32490
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
32330
32491
  id TEXT PRIMARY KEY,
@@ -32359,7 +32520,7 @@ function hasColumn102(db, table, column) {
32359
32520
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32360
32521
  return rows.some((row) => row.name === column);
32361
32522
  }
32362
- function up802(db) {
32523
+ function up812(db) {
32363
32524
  if (!hasColumn102(db, "documents", "agent_id")) {
32364
32525
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
32365
32526
  }
@@ -32445,7 +32606,7 @@ function up802(db) {
32445
32606
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
32446
32607
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
32447
32608
  }
32448
- function up812(db) {
32609
+ function up822(db) {
32449
32610
  db.exec(`
32450
32611
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
32451
32612
  aggregate_memory_id TEXT NOT NULL,
@@ -32467,7 +32628,7 @@ function hasColumn112(db, table, column) {
32467
32628
  return rows.some((row) => row.name === column);
32468
32629
  }
32469
32630
  var COLUMNS3 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
32470
- function up822(db) {
32631
+ function up832(db) {
32471
32632
  for (const column of COLUMNS3) {
32472
32633
  if (!hasColumn112(db, "skill_invocations", column)) {
32473
32634
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -32548,7 +32709,7 @@ function documentScopeColumnsPreservingExisting2(db) {
32548
32709
  `);
32549
32710
  }
32550
32711
  try {
32551
- up802(db);
32712
+ up812(db);
32552
32713
  if (preserveAgentId) {
32553
32714
  db.exec(`
32554
32715
  UPDATE documents
@@ -32568,12 +32729,12 @@ function documentScopeColumnsPreservingExisting2(db) {
32568
32729
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
32569
32730
  }
32570
32731
  }
32571
- function up832(db) {
32572
- up792(db);
32732
+ function up842(db) {
32733
+ up802(db);
32573
32734
  if (hasTable32(db, "documents")) {
32574
32735
  documentScopeColumnsPreservingExisting2(db);
32575
32736
  }
32576
- up812(db);
32737
+ up822(db);
32577
32738
  addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
32578
32739
  addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
32579
32740
  addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
@@ -32630,7 +32791,7 @@ function up832(db) {
32630
32791
  AND ${sourceAgentId} = ${targetAgentId}
32631
32792
  `);
32632
32793
  }
32633
- function up842(db) {
32794
+ function up852(db) {
32634
32795
  db.exec(`
32635
32796
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
32636
32797
  path TEXT PRIMARY KEY,
@@ -32660,7 +32821,7 @@ function up842(db) {
32660
32821
  ON legacy_markdown_chunks(memory_id);
32661
32822
  `);
32662
32823
  }
32663
- function up852(db) {
32824
+ function up862(db) {
32664
32825
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
32665
32826
  const tableNames = new Set(tables.map((r3) => String(r3.name)));
32666
32827
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -32719,7 +32880,7 @@ function addColumnIfMissing212(db, table, column, definition) {
32719
32880
  return;
32720
32881
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32721
32882
  }
32722
- function up862(db) {
32883
+ function up872(db) {
32723
32884
  addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
32724
32885
  db.exec(`
32725
32886
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -32732,14 +32893,14 @@ function addColumnIfMissing222(db, table, column, definition) {
32732
32893
  return;
32733
32894
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32734
32895
  }
32735
- function up872(db) {
32896
+ function up882(db) {
32736
32897
  addColumnIfMissing222(db, "summary_jobs", "boundary_reason", "TEXT");
32737
32898
  db.exec(`
32738
32899
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
32739
32900
  ON summary_jobs(agent_id, session_key, boundary_reason)
32740
32901
  `);
32741
32902
  }
32742
- function up882(db) {
32903
+ function up892(db) {
32743
32904
  db.exec(`
32744
32905
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
32745
32906
  agent_id TEXT NOT NULL,
@@ -32757,7 +32918,7 @@ function up882(db) {
32757
32918
  ON transcript_capture_jobs(agent_id, session_id, status);
32758
32919
  `);
32759
32920
  }
32760
- function up892(db) {
32921
+ function up902(db) {
32761
32922
  db.exec(`
32762
32923
  CREATE TABLE IF NOT EXISTS job_cancellations (
32763
32924
  id TEXT PRIMARY KEY,
@@ -32785,7 +32946,7 @@ function indexExists3(db, table, indexName) {
32785
32946
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32786
32947
  return rows.some((row) => row.name === indexName);
32787
32948
  }
32788
- function up902(db) {
32949
+ function up912(db) {
32789
32950
  db.exec(`
32790
32951
  CREATE TABLE IF NOT EXISTS job_archive (
32791
32952
  id TEXT PRIMARY KEY,
@@ -32812,7 +32973,7 @@ function indexExists22(db, table, indexName) {
32812
32973
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32813
32974
  return rows.some((row) => row.name === indexName);
32814
32975
  }
32815
- function up912(db) {
32976
+ function up922(db) {
32816
32977
  db.exec(`
32817
32978
  CREATE TABLE IF NOT EXISTS embedding_index_state (
32818
32979
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -32825,7 +32986,7 @@ function up912(db) {
32825
32986
  )
32826
32987
  `);
32827
32988
  }
32828
- function up922(db) {
32989
+ function up932(db) {
32829
32990
  db.exec(`
32830
32991
  CREATE TABLE IF NOT EXISTS embeddings_staging (
32831
32992
  id TEXT PRIMARY KEY,
@@ -32844,7 +33005,7 @@ function up922(db) {
32844
33005
  ON embeddings_staging(agent_id, source_type, source_id);
32845
33006
  `);
32846
33007
  }
32847
- function up932(db) {
33008
+ function up942(db) {
32848
33009
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32849
33010
  if (!columns.some((column) => column.name === "evidence_cursor")) {
32850
33011
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -32855,7 +33016,7 @@ function hasColumn132(db, table, column) {
32855
33016
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32856
33017
  return rows.some((r3) => r3.name === column);
32857
33018
  }
32858
- function up942(db) {
33019
+ function up952(db) {
32859
33020
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
32860
33021
  if (tables.length === 0)
32861
33022
  return;
@@ -32880,23 +33041,23 @@ function up942(db) {
32880
33041
  function hasColumn142(db, table, column) {
32881
33042
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32882
33043
  }
32883
- function up952(db) {
33044
+ function up962(db) {
32884
33045
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
32885
33046
  if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
32886
33047
  return;
32887
33048
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
32888
33049
  }
32889
- function up962(db) {
33050
+ function up972(db) {
32890
33051
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
32891
33052
  }
32892
- function up972(db) {
33053
+ function up982(db) {
32893
33054
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32894
33055
  if (!columns.some((column) => column.name === "last_failure_at")) {
32895
33056
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
32896
33057
  }
32897
33058
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
32898
33059
  }
32899
- function up982(db) {
33060
+ function up992(db) {
32900
33061
  db.exec(`
32901
33062
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
32902
33063
  agent_id TEXT NOT NULL,
@@ -32913,7 +33074,7 @@ function up982(db) {
32913
33074
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
32914
33075
  `);
32915
33076
  }
32916
- function up992(db) {
33077
+ function up1002(db) {
32917
33078
  db.exec(`
32918
33079
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
32919
33080
  id TEXT PRIMARY KEY,
@@ -32933,7 +33094,7 @@ function up992(db) {
32933
33094
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
32934
33095
  `);
32935
33096
  }
32936
- function up1002(db) {
33097
+ function up1012(db) {
32937
33098
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
32938
33099
  if (!columns.some((column) => column.name === "evidence_window_json")) {
32939
33100
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -32942,7 +33103,7 @@ function up1002(db) {
32942
33103
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
32943
33104
  }
32944
33105
  }
32945
- function up1012(db) {
33106
+ function up1022(db) {
32946
33107
  db.exec(`
32947
33108
  CREATE TABLE IF NOT EXISTS dreaming_attention (
32948
33109
  id TEXT PRIMARY KEY,
@@ -32964,7 +33125,7 @@ function up1012(db) {
32964
33125
  function hasColumn152(db, table, column) {
32965
33126
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32966
33127
  }
32967
- function up1022(db) {
33128
+ function up1032(db) {
32968
33129
  const requiredMemoryColumns = [
32969
33130
  "content_hash",
32970
33131
  "normalized_content",
@@ -33015,7 +33176,7 @@ function up1022(db) {
33015
33176
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
33016
33177
  `);
33017
33178
  }
33018
- function up1032(db) {
33179
+ function up1042(db) {
33019
33180
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
33020
33181
  if (tables.length !== 2)
33021
33182
  return;
@@ -33038,7 +33199,7 @@ function tableExists4(db, table) {
33038
33199
  function hasColumn162(db, table, column) {
33039
33200
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33040
33201
  }
33041
- function up1042(db) {
33202
+ function up1052(db) {
33042
33203
  db.exec(`
33043
33204
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
33044
33205
  derived_memory_id TEXT NOT NULL,
@@ -33081,7 +33242,7 @@ function up1042(db) {
33081
33242
  `);
33082
33243
  }
33083
33244
  }
33084
- function up1052(db) {
33245
+ function up1062(db) {
33085
33246
  db.exec(`
33086
33247
  DROP TRIGGER IF EXISTS entities_fts_ai;
33087
33248
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -33170,7 +33331,7 @@ function up1052(db) {
33170
33331
  function hasColumn172(db, table, column) {
33171
33332
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33172
33333
  }
33173
- function up1062(db) {
33334
+ function up1072(db) {
33174
33335
  if (!hasColumn172(db, "memories", "review_after")) {
33175
33336
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
33176
33337
  }
@@ -33186,14 +33347,14 @@ var TOKEN_COLUMNS2 = [
33186
33347
  ["tokens_cache_write", "INTEGER"],
33187
33348
  ["tokens_cost", "REAL"]
33188
33349
  ];
33189
- function up1072(db) {
33350
+ function up1082(db) {
33190
33351
  for (const [column, type] of TOKEN_COLUMNS2) {
33191
33352
  if (!hasColumn182(db, "dreaming_passes", column)) {
33192
33353
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
33193
33354
  }
33194
33355
  }
33195
33356
  }
33196
- function up1082(db) {
33357
+ function up1092(db) {
33197
33358
  db.exec(`
33198
33359
  CREATE TABLE IF NOT EXISTS embedding_usage (
33199
33360
  day TEXT NOT NULL,
@@ -33206,7 +33367,7 @@ function up1082(db) {
33206
33367
  );
33207
33368
  `);
33208
33369
  }
33209
- function up1092(db) {
33370
+ function up1102(db) {
33210
33371
  db.exec(`
33211
33372
  CREATE TABLE IF NOT EXISTS telemetry_install (
33212
33373
  id TEXT PRIMARY KEY,
@@ -33214,7 +33375,7 @@ function up1092(db) {
33214
33375
  );
33215
33376
  `);
33216
33377
  }
33217
- function up1102(db) {
33378
+ function up1112(db) {
33218
33379
  db.exec(`
33219
33380
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
33220
33381
  ON memory_entity_mentions(entity_id, memory_id);
@@ -33225,7 +33386,7 @@ function hasColumn192(db, table, column) {
33225
33386
  return rows.some((row) => row.name === column);
33226
33387
  }
33227
33388
  var COLUMNS22 = ["first_remember_at", "first_recall_at"];
33228
- function up1112(db) {
33389
+ function up1122(db) {
33229
33390
  for (const column of COLUMNS22) {
33230
33391
  if (!hasColumn192(db, "telemetry_install", column)) {
33231
33392
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -33241,7 +33402,7 @@ function addColumnIfMissing232(db, column, definition) {
33241
33402
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33242
33403
  }
33243
33404
  }
33244
- function up1122(db) {
33405
+ function up1132(db) {
33245
33406
  addColumnIfMissing232(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
33246
33407
  addColumnIfMissing232(db, "claim_token", "TEXT");
33247
33408
  addColumnIfMissing232(db, "claimed_at", "TEXT");
@@ -33250,7 +33411,7 @@ function up1122(db) {
33250
33411
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
33251
33412
  `);
33252
33413
  }
33253
- function up1132(db) {
33414
+ function up1142(db) {
33254
33415
  db.exec(`
33255
33416
  CREATE TABLE IF NOT EXISTS session_claims (
33256
33417
  session_key TEXT NOT NULL,
@@ -33271,7 +33432,7 @@ function up1132(db) {
33271
33432
  ON session_claims(agent_id, state, expires_at);
33272
33433
  `);
33273
33434
  }
33274
- function up1142(db) {
33435
+ function up1152(db) {
33275
33436
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
33276
33437
  if (table == null)
33277
33438
  return;
@@ -33280,7 +33441,7 @@ function up1142(db) {
33280
33441
  ON entity_attributes(memory_id, agent_id, status, importance);
33281
33442
  `);
33282
33443
  }
33283
- function up1152(db) {
33444
+ function up1162(db) {
33284
33445
  db.exec(`
33285
33446
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
33286
33447
  id TEXT PRIMARY KEY,
@@ -33337,7 +33498,7 @@ function addColumnIfMissing242(db, column, definition) {
33337
33498
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
33338
33499
  }
33339
33500
  }
33340
- function up1162(db) {
33501
+ function up1172(db) {
33341
33502
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
33342
33503
  if (table == null)
33343
33504
  return;
@@ -33538,7 +33699,7 @@ function backfillTranscriptsFromSummaryJobs2(db) {
33538
33699
  insert.run(...values);
33539
33700
  }
33540
33701
  }
33541
- function up1172(db) {
33702
+ function up1182(db) {
33542
33703
  if (!hasTable42(db, "session_transcripts"))
33543
33704
  return;
33544
33705
  addColumnIfMissing252(db, "session_transcripts", "completed_at", "TEXT");
@@ -33591,7 +33752,7 @@ function up1172(db) {
33591
33752
  ON session_transcripts(agent_id, content_hash);
33592
33753
  `);
33593
33754
  }
33594
- function up1182(db) {
33755
+ function up1192(db) {
33595
33756
  db.exec(`
33596
33757
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
33597
33758
  ON memory_jobs(status)
@@ -33610,12 +33771,12 @@ function up1182(db) {
33610
33771
  function hasColumn222(db, table, column) {
33611
33772
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33612
33773
  }
33613
- function up1192(db) {
33774
+ function up1202(db) {
33614
33775
  if (!hasColumn222(db, "telemetry_install", "last_seen_version")) {
33615
33776
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
33616
33777
  }
33617
33778
  }
33618
- function up1202(db) {
33779
+ function up1212(db) {
33619
33780
  db.exec(`
33620
33781
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
33621
33782
  agent_id TEXT NOT NULL,
@@ -33644,7 +33805,7 @@ function addColumnIfMissing262(db, column, definition) {
33644
33805
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33645
33806
  }
33646
33807
  }
33647
- function up1212(db) {
33808
+ function up1222(db) {
33648
33809
  addColumnIfMissing262(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
33649
33810
  addColumnIfMissing262(db, "last_attempt_at", "TEXT");
33650
33811
  addColumnIfMissing262(db, "sent_at", "TEXT");
@@ -33665,7 +33826,7 @@ function up1212(db) {
33665
33826
  VALUES (1, CURRENT_TIMESTAMP);
33666
33827
  `);
33667
33828
  }
33668
- function up1222(db) {
33829
+ function up1232(db) {
33669
33830
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
33670
33831
  const names = new Set(columns.map((column) => column.name));
33671
33832
  if (!names.has("failure_class")) {
@@ -33682,7 +33843,7 @@ function up1222(db) {
33682
33843
  }
33683
33844
  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)");
33684
33845
  }
33685
- function up1232(db) {
33846
+ function up1242(db) {
33686
33847
  db.exec(`
33687
33848
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
33688
33849
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -33706,7 +33867,7 @@ function up1232(db) {
33706
33867
  ON embedding_index_failures(source_type, source_id);
33707
33868
  `);
33708
33869
  }
33709
- function up1242(db) {
33870
+ function up1252(db) {
33710
33871
  db.exec(`
33711
33872
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
33712
33873
  id TEXT PRIMARY KEY,
@@ -33756,7 +33917,7 @@ function backfillTable2(db, params) {
33756
33917
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
33757
33918
  backfill2(db, rows, params.sourceKind, params.scannedAt);
33758
33919
  }
33759
- function up1252(db) {
33920
+ function up1262(db) {
33760
33921
  db.exec(`
33761
33922
  CREATE TABLE IF NOT EXISTS memory_content_safety (
33762
33923
  agent_id TEXT NOT NULL,
@@ -33813,7 +33974,7 @@ function up1252(db) {
33813
33974
  scannedAt
33814
33975
  });
33815
33976
  }
33816
- function up1262(db) {
33977
+ function up1272(db) {
33817
33978
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
33818
33979
  if (!table)
33819
33980
  return;
@@ -33847,7 +34008,7 @@ function up1262(db) {
33847
34008
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
33848
34009
  `);
33849
34010
  }
33850
- function up1272(db) {
34011
+ function up1282(db) {
33851
34012
  db.exec(`
33852
34013
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
33853
34014
  id TEXT PRIMARY KEY,
@@ -33903,7 +34064,7 @@ function up1272(db) {
33903
34064
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
33904
34065
  `);
33905
34066
  }
33906
- function up1282(db) {
34067
+ function up1292(db) {
33907
34068
  db.exec(`
33908
34069
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
33909
34070
  ON memory_jobs(status, created_at)
@@ -33918,7 +34079,7 @@ function up1282(db) {
33918
34079
  function tableExists32(db, table) {
33919
34080
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
33920
34081
  }
33921
- function up1292(db) {
34082
+ function up1302(db) {
33922
34083
  if (!tableExists32(db, "memory_jobs"))
33923
34084
  return;
33924
34085
  if (!tableExists32(db, "job_cancellations")) {
@@ -33967,7 +34128,7 @@ function up1292(db) {
33967
34128
  AND status IN ('pending', 'leased');
33968
34129
  `);
33969
34130
  }
33970
- function up1302(db) {
34131
+ function up1312(db) {
33971
34132
  db.exec(`
33972
34133
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
33973
34134
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -34007,7 +34168,7 @@ function up1302(db) {
34007
34168
  END;
34008
34169
  `);
34009
34170
  }
34010
- function up1312(db) {
34171
+ function up1322(db) {
34011
34172
  db.exec(`
34012
34173
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
34013
34174
  agent_id TEXT NOT NULL,
@@ -34030,13 +34191,13 @@ function up1312(db) {
34030
34191
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
34031
34192
  `);
34032
34193
  }
34033
- function up1322(db) {
34194
+ function up1332(db) {
34034
34195
  db.exec(`
34035
34196
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
34036
34197
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
34037
34198
  `);
34038
34199
  }
34039
- function up1332(db) {
34200
+ function up1342(db) {
34040
34201
  db.exec(`
34041
34202
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
34042
34203
  id TEXT PRIMARY KEY,
@@ -34088,7 +34249,7 @@ function up1332(db) {
34088
34249
  if (!names.has("format_version"))
34089
34250
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
34090
34251
  }
34091
- function up1342(db) {
34252
+ function up1352(db) {
34092
34253
  db.exec(`
34093
34254
  CREATE TABLE memory_head_entries_v134 (
34094
34255
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -34106,7 +34267,7 @@ function up1342(db) {
34106
34267
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
34107
34268
  `);
34108
34269
  }
34109
- function up1352(db) {
34270
+ function up1362(db) {
34110
34271
  db.exec(`
34111
34272
  CREATE TABLE IF NOT EXISTS memory_head_publications (
34112
34273
  agent_id TEXT NOT NULL,
@@ -34122,7 +34283,7 @@ function up1352(db) {
34122
34283
  ON memory_head_publications(agent_id, status, revision DESC);
34123
34284
  `);
34124
34285
  }
34125
- function up1362(db) {
34286
+ function up1372(db) {
34126
34287
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r3) => r3.name));
34127
34288
  for (const [name, type] of [
34128
34289
  ["entry_id", "TEXT"],
@@ -34136,7 +34297,7 @@ function up1362(db) {
34136
34297
  }
34137
34298
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
34138
34299
  }
34139
- function up1372(db) {
34300
+ function up1382(db) {
34140
34301
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r3) => r3.name));
34141
34302
  for (const [name, type] of [
34142
34303
  ["head_revision", "INTEGER"],
@@ -34158,7 +34319,7 @@ function addColumnIfMissing272(db, table, column, definition) {
34158
34319
  if (!hasColumn252(db, table, column))
34159
34320
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34160
34321
  }
34161
- function up1382(db) {
34322
+ function up1392(db) {
34162
34323
  addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
34163
34324
  db.exec(`
34164
34325
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -34463,7 +34624,7 @@ function up1382(db) {
34463
34624
  GROUP BY j.agent_id;
34464
34625
  `);
34465
34626
  }
34466
- function up1392(db) {
34627
+ function up1402(db) {
34467
34628
  db.exec(`
34468
34629
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
34469
34630
  agent_id TEXT NOT NULL,
@@ -34479,7 +34640,7 @@ function up1392(db) {
34479
34640
  ON native_source_sync_state(agent_id, status);
34480
34641
  `);
34481
34642
  }
34482
- function up1402(db) {
34643
+ function up1412(db) {
34483
34644
  db.exec(`
34484
34645
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
34485
34646
  agent_id TEXT NOT NULL,
@@ -34491,7 +34652,7 @@ function up1402(db) {
34491
34652
  );
34492
34653
  `);
34493
34654
  }
34494
- function up1412(db) {
34655
+ function up1422(db) {
34495
34656
  db.exec(`
34496
34657
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
34497
34658
  agent_id TEXT NOT NULL,
@@ -34505,13 +34666,13 @@ function up1412(db) {
34505
34666
  );
34506
34667
  `);
34507
34668
  }
34508
- function up1422(db) {
34669
+ function up1432(db) {
34509
34670
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
34510
34671
  if (!columns.some((column) => column.name === "frontier")) {
34511
34672
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
34512
34673
  }
34513
34674
  }
34514
- function up1432(db) {
34675
+ function up1442(db) {
34515
34676
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34516
34677
  const additions = [
34517
34678
  ["migration_phase", "TEXT"],
@@ -34546,13 +34707,13 @@ function up1432(db) {
34546
34707
  `);
34547
34708
  }
34548
34709
  }
34549
- function up1442(db) {
34710
+ function up1452(db) {
34550
34711
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34551
34712
  if (!columns.has("lease_token")) {
34552
34713
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
34553
34714
  }
34554
34715
  }
34555
- function up1452(db) {
34716
+ function up1462(db) {
34556
34717
  db.exec(`
34557
34718
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
34558
34719
  agent_id TEXT NOT NULL,
@@ -34570,7 +34731,7 @@ function up1452(db) {
34570
34731
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
34571
34732
  `);
34572
34733
  }
34573
- function up1462(db) {
34734
+ function up1472(db) {
34574
34735
  db.exec(`
34575
34736
  CREATE TABLE IF NOT EXISTS source_import_jobs (
34576
34737
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -34625,24 +34786,36 @@ function up1462(db) {
34625
34786
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
34626
34787
  `);
34627
34788
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
34628
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
34789
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
34790
+ let exists;
34791
+ try {
34792
+ exists = statement.get(column);
34793
+ } finally {
34794
+ statement.finalize?.();
34795
+ }
34629
34796
  if (exists == null)
34630
34797
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
34631
34798
  }
34632
34799
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
34633
34800
  }
34634
- function up1472(db) {
34801
+ function up1482(db) {
34635
34802
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
34636
34803
  }
34637
- function up1482(db) {
34804
+ function up1492(db) {
34638
34805
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
34639
34806
  if (!columns.some((column) => column.name === "source_id")) {
34640
34807
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
34641
34808
  }
34642
34809
  }
34643
- function up1492(db) {
34810
+ function up1502(db) {
34644
34811
  const addColumn = (table, column, definition) => {
34645
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
34812
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
34813
+ let exists;
34814
+ try {
34815
+ exists = statement.get(table, column);
34816
+ } finally {
34817
+ statement.finalize?.();
34818
+ }
34646
34819
  if (exists == null)
34647
34820
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34648
34821
  };
@@ -34655,7 +34828,7 @@ function addColumnIfMissing282(db, table, column, definition) {
34655
34828
  if (!columns.some((row) => row.name === column))
34656
34829
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34657
34830
  }
34658
- function up1502(db) {
34831
+ function up1512(db) {
34659
34832
  addColumnIfMissing282(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
34660
34833
  addColumnIfMissing282(db, "dreaming_passes", "head_base_revision", "INTEGER");
34661
34834
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -34809,13 +34982,13 @@ var MIGRATIONS2 = [
34809
34982
  {
34810
34983
  version: 1,
34811
34984
  name: "baseline",
34812
- up: up151,
34985
+ up: up210,
34813
34986
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
34814
34987
  },
34815
34988
  {
34816
34989
  version: 2,
34817
34990
  name: "pipeline-v2",
34818
- up: up210,
34991
+ up: up310,
34819
34992
  artifacts: {
34820
34993
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
34821
34994
  }
@@ -34823,12 +34996,12 @@ var MIGRATIONS2 = [
34823
34996
  {
34824
34997
  version: 3,
34825
34998
  name: "unique-content-hash",
34826
- up: up310
34999
+ up: up410
34827
35000
  },
34828
35001
  {
34829
35002
  version: 4,
34830
35003
  name: "history-actor-and-retention",
34831
- up: up410,
35004
+ up: up510,
34832
35005
  artifacts: {
34833
35006
  columns: [{ table: "memory_history", column: "actor_type" }]
34834
35007
  }
@@ -34836,7 +35009,7 @@ var MIGRATIONS2 = [
34836
35009
  {
34837
35010
  version: 5,
34838
35011
  name: "graph-extended",
34839
- up: up510,
35012
+ up: up610,
34840
35013
  artifacts: {
34841
35014
  columns: [{ table: "entities", column: "canonical_name" }]
34842
35015
  }
@@ -34844,7 +35017,7 @@ var MIGRATIONS2 = [
34844
35017
  {
34845
35018
  version: 6,
34846
35019
  name: "idempotency-key",
34847
- up: up610,
35020
+ up: up710,
34848
35021
  artifacts: {
34849
35022
  columns: [{ table: "memories", column: "idempotency_key" }]
34850
35023
  }
@@ -34852,42 +35025,42 @@ var MIGRATIONS2 = [
34852
35025
  {
34853
35026
  version: 7,
34854
35027
  name: "documents-and-connectors",
34855
- up: up710,
35028
+ up: up810,
34856
35029
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
34857
35030
  },
34858
35031
  {
34859
35032
  version: 8,
34860
35033
  name: "embeddings-unique-hash",
34861
- up: up810
35034
+ up: up910
34862
35035
  },
34863
35036
  {
34864
35037
  version: 9,
34865
35038
  name: "summary-jobs",
34866
- up: up910,
35039
+ up: up1010,
34867
35040
  artifacts: { tables: ["summary_jobs"] }
34868
35041
  },
34869
35042
  {
34870
35043
  version: 10,
34871
35044
  name: "umap-cache",
34872
- up: up1010,
35045
+ up: up1110,
34873
35046
  artifacts: { tables: ["umap_cache"] }
34874
35047
  },
34875
35048
  {
34876
35049
  version: 11,
34877
35050
  name: "session-scores",
34878
- up: up1110,
35051
+ up: up1210,
34879
35052
  artifacts: { tables: ["session_scores"] }
34880
35053
  },
34881
35054
  {
34882
35055
  version: 12,
34883
35056
  name: "scheduled-tasks",
34884
- up: up1210,
35057
+ up: up1310,
34885
35058
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
34886
35059
  },
34887
35060
  {
34888
35061
  version: 13,
34889
35062
  name: "ingestion-tracking",
34890
- up: up1310,
35063
+ up: up1410,
34891
35064
  artifacts: {
34892
35065
  columns: [
34893
35066
  { table: "memories", column: "source_path" },
@@ -34898,13 +35071,13 @@ var MIGRATIONS2 = [
34898
35071
  {
34899
35072
  version: 14,
34900
35073
  name: "telemetry",
34901
- up: up1410,
35074
+ up: up153,
34902
35075
  artifacts: { tables: ["telemetry_events"] }
34903
35076
  },
34904
35077
  {
34905
35078
  version: 15,
34906
35079
  name: "session-memories",
34907
- up: up152,
35080
+ up: up162,
34908
35081
  artifacts: {
34909
35082
  tables: ["session_memories"],
34910
35083
  columns: [
@@ -34916,13 +35089,13 @@ var MIGRATIONS2 = [
34916
35089
  {
34917
35090
  version: 16,
34918
35091
  name: "session-checkpoints",
34919
- up: up162,
35092
+ up: up172,
34920
35093
  artifacts: { tables: ["session_checkpoints"] }
34921
35094
  },
34922
35095
  {
34923
35096
  version: 17,
34924
35097
  name: "task-skills",
34925
- up: up172,
35098
+ up: up182,
34926
35099
  artifacts: {
34927
35100
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
34928
35101
  }
@@ -34930,13 +35103,13 @@ var MIGRATIONS2 = [
34930
35103
  {
34931
35104
  version: 18,
34932
35105
  name: "skill-meta",
34933
- up: up182,
35106
+ up: up192,
34934
35107
  artifacts: { tables: ["skill_meta"] }
34935
35108
  },
34936
35109
  {
34937
35110
  version: 19,
34938
35111
  name: "knowledge-structure",
34939
- up: up192,
35112
+ up: up202,
34940
35113
  artifacts: {
34941
35114
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
34942
35115
  columns: [{ table: "entities", column: "agent_id" }]
@@ -34945,7 +35118,7 @@ var MIGRATIONS2 = [
34945
35118
  {
34946
35119
  version: 20,
34947
35120
  name: "session-structural-columns",
34948
- up: up202,
35121
+ up: up212,
34949
35122
  artifacts: {
34950
35123
  columns: [
34951
35124
  { table: "session_memories", column: "entity_slot" },
@@ -34958,7 +35131,7 @@ var MIGRATIONS2 = [
34958
35131
  {
34959
35132
  version: 21,
34960
35133
  name: "checkpoint-structural",
34961
- up: up212,
35134
+ up: up222,
34962
35135
  artifacts: {
34963
35136
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
34964
35137
  }
@@ -34966,7 +35139,7 @@ var MIGRATIONS2 = [
34966
35139
  {
34967
35140
  version: 22,
34968
35141
  name: "entity-pinning",
34969
- up: up222,
35142
+ up: up232,
34970
35143
  artifacts: {
34971
35144
  columns: [
34972
35145
  { table: "entities", column: "pinned" },
@@ -34977,17 +35150,17 @@ var MIGRATIONS2 = [
34977
35150
  {
34978
35151
  version: 23,
34979
35152
  name: "retired-scorer-gap",
34980
- up: up232
35153
+ up: up242
34981
35154
  },
34982
35155
  {
34983
35156
  version: 24,
34984
35157
  name: "retired-scorer-gap",
34985
- up: up242
35158
+ up: up252
34986
35159
  },
34987
35160
  {
34988
35161
  version: 25,
34989
35162
  name: "agent-feedback",
34990
- up: up252,
35163
+ up: up262,
34991
35164
  artifacts: {
34992
35165
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
34993
35166
  }
@@ -34995,32 +35168,32 @@ var MIGRATIONS2 = [
34995
35168
  {
34996
35169
  version: 26,
34997
35170
  name: "retired-scorer-gap",
34998
- up: up262
35171
+ up: up272
34999
35172
  },
35000
35173
  {
35001
35174
  version: 27,
35002
35175
  name: "backfill-canonical-names",
35003
- up: up272
35176
+ up: up282
35004
35177
  },
35005
35178
  {
35006
35179
  version: 28,
35007
35180
  name: "lossless-retention",
35008
- up: up282
35181
+ up: up292
35009
35182
  },
35010
35183
  {
35011
35184
  version: 29,
35012
35185
  name: "session-summary-dag",
35013
- up: up292
35186
+ up: up302
35014
35187
  },
35015
35188
  {
35016
35189
  version: 30,
35017
35190
  name: "nullable-memory-job-memory-id",
35018
- up: up302
35191
+ up: up312
35019
35192
  },
35020
35193
  {
35021
35194
  version: 31,
35022
35195
  name: "dependency-reason",
35023
- up: up312,
35196
+ up: up322,
35024
35197
  artifacts: {
35025
35198
  columns: [
35026
35199
  { table: "entity_dependencies", column: "reason" },
@@ -35031,7 +35204,7 @@ var MIGRATIONS2 = [
35031
35204
  {
35032
35205
  version: 32,
35033
35206
  name: "embeddings-vector-column",
35034
- up: up322,
35207
+ up: up332,
35035
35208
  artifacts: {
35036
35209
  columns: [{ table: "embeddings", column: "vector", optional: true }]
35037
35210
  }
@@ -35039,7 +35212,7 @@ var MIGRATIONS2 = [
35039
35212
  {
35040
35213
  version: 33,
35041
35214
  name: "scope",
35042
- up: up332,
35215
+ up: up342,
35043
35216
  artifacts: {
35044
35217
  columns: [{ table: "memories", column: "scope" }]
35045
35218
  }
@@ -35047,17 +35220,17 @@ var MIGRATIONS2 = [
35047
35220
  {
35048
35221
  version: 34,
35049
35222
  name: "scope-aware-dedup",
35050
- up: up342
35223
+ up: up352
35051
35224
  },
35052
35225
  {
35053
35226
  version: 35,
35054
35227
  name: "entity-fts",
35055
- up: up352
35228
+ up: up362
35056
35229
  },
35057
35230
  {
35058
35231
  version: 36,
35059
35232
  name: "dependency-confidence",
35060
- up: up362,
35233
+ up: up372,
35061
35234
  artifacts: {
35062
35235
  columns: [{ table: "entity_dependencies", column: "confidence" }]
35063
35236
  }
@@ -35065,7 +35238,7 @@ var MIGRATIONS2 = [
35065
35238
  {
35066
35239
  version: 37,
35067
35240
  name: "entity-communities",
35068
- up: up372,
35241
+ up: up382,
35069
35242
  artifacts: {
35070
35243
  tables: ["entity_communities"],
35071
35244
  columns: [{ table: "entities", column: "community_id" }]
@@ -35074,24 +35247,24 @@ var MIGRATIONS2 = [
35074
35247
  {
35075
35248
  version: 38,
35076
35249
  name: "memory-hints",
35077
- up: up382,
35250
+ up: up392,
35078
35251
  artifacts: { tables: ["memory_hints"] }
35079
35252
  },
35080
35253
  {
35081
35254
  version: 39,
35082
35255
  name: "dedup-entity-dependencies",
35083
- up: up392
35256
+ up: up402
35084
35257
  },
35085
35258
  {
35086
35259
  version: 40,
35087
35260
  name: "session-transcripts",
35088
- up: up402,
35261
+ up: up412,
35089
35262
  artifacts: { tables: ["session_transcripts"] }
35090
35263
  },
35091
35264
  {
35092
35265
  version: 41,
35093
35266
  name: "path-feedback",
35094
- up: up412,
35267
+ up: up422,
35095
35268
  artifacts: {
35096
35269
  tables: [
35097
35270
  "path_feedback_events",
@@ -35106,7 +35279,7 @@ var MIGRATIONS2 = [
35106
35279
  {
35107
35280
  version: 42,
35108
35281
  name: "session-memories-agent-id",
35109
- up: up422,
35282
+ up: up432,
35110
35283
  artifacts: {
35111
35284
  columns: [{ table: "session_memories", column: "agent_id" }]
35112
35285
  }
@@ -35114,7 +35287,7 @@ var MIGRATIONS2 = [
35114
35287
  {
35115
35288
  version: 43,
35116
35289
  name: "agents-table",
35117
- up: up432,
35290
+ up: up442,
35118
35291
  artifacts: {
35119
35292
  tables: ["agents"],
35120
35293
  columns: [
@@ -35126,7 +35299,7 @@ var MIGRATIONS2 = [
35126
35299
  {
35127
35300
  version: 44,
35128
35301
  name: "memory-md-temporal-head",
35129
- up: up442,
35302
+ up: up452,
35130
35303
  artifacts: {
35131
35304
  columns: [
35132
35305
  { table: "session_summaries", column: "source_type" },
@@ -35138,7 +35311,7 @@ var MIGRATIONS2 = [
35138
35311
  {
35139
35312
  version: 45,
35140
35313
  name: "lossless-working-memory-hardening",
35141
- up: up452,
35314
+ up: up462,
35142
35315
  artifacts: {
35143
35316
  tables: ["session_transcripts_fts", "memory_md_heads"],
35144
35317
  columns: [
@@ -35151,17 +35324,17 @@ var MIGRATIONS2 = [
35151
35324
  {
35152
35325
  version: 46,
35153
35326
  name: "session-summary-uniqueness",
35154
- up: up462
35327
+ up: up472
35155
35328
  },
35156
35329
  {
35157
35330
  version: 47,
35158
35331
  name: "agent-scoped-temporal-uniqueness",
35159
- up: up472
35332
+ up: up482
35160
35333
  },
35161
35334
  {
35162
35335
  version: 48,
35163
35336
  name: "thread-heads",
35164
- up: up482,
35337
+ up: up492,
35165
35338
  artifacts: {
35166
35339
  tables: ["memory_thread_heads"]
35167
35340
  }
@@ -35169,7 +35342,7 @@ var MIGRATIONS2 = [
35169
35342
  {
35170
35343
  version: 49,
35171
35344
  name: "session-extract-cursors",
35172
- up: up492,
35345
+ up: up502,
35173
35346
  artifacts: {
35174
35347
  tables: ["session_extract_cursors"]
35175
35348
  }
@@ -35177,7 +35350,7 @@ var MIGRATIONS2 = [
35177
35350
  {
35178
35351
  version: 50,
35179
35352
  name: "related-to-audit",
35180
- up: up502,
35353
+ up: up512,
35181
35354
  artifacts: {
35182
35355
  tables: ["entity_dependency_history"]
35183
35356
  }
@@ -35185,7 +35358,7 @@ var MIGRATIONS2 = [
35185
35358
  {
35186
35359
  version: 51,
35187
35360
  name: "memory-md-rolling-window-lineage",
35188
- up: up512,
35361
+ up: up522,
35189
35362
  artifacts: {
35190
35363
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
35191
35364
  columns: [
@@ -35200,7 +35373,7 @@ var MIGRATIONS2 = [
35200
35373
  {
35201
35374
  version: 52,
35202
35375
  name: "mcp-invocations",
35203
- up: up522,
35376
+ up: up532,
35204
35377
  artifacts: {
35205
35378
  tables: ["mcp_invocations"]
35206
35379
  }
@@ -35208,7 +35381,7 @@ var MIGRATIONS2 = [
35208
35381
  {
35209
35382
  version: 53,
35210
35383
  name: "skill-invocations",
35211
- up: up532,
35384
+ up: up542,
35212
35385
  artifacts: {
35213
35386
  tables: ["skill_invocations"]
35214
35387
  }
@@ -35216,7 +35389,7 @@ var MIGRATIONS2 = [
35216
35389
  {
35217
35390
  version: 54,
35218
35391
  name: "task-agent-scope",
35219
- up: up542,
35392
+ up: up552,
35220
35393
  artifacts: {
35221
35394
  tables: ["task_scope_hints"]
35222
35395
  }
@@ -35224,7 +35397,7 @@ var MIGRATIONS2 = [
35224
35397
  {
35225
35398
  version: 55,
35226
35399
  name: "dreaming-state",
35227
- up: up552,
35400
+ up: up562,
35228
35401
  artifacts: {
35229
35402
  tables: ["dreaming_state", "dreaming_passes"]
35230
35403
  }
@@ -35232,22 +35405,22 @@ var MIGRATIONS2 = [
35232
35405
  {
35233
35406
  version: 56,
35234
35407
  name: "agent-scoped-content-hash",
35235
- up: up562
35408
+ up: up572
35236
35409
  },
35237
35410
  {
35238
35411
  version: 57,
35239
35412
  name: "memories-fts-tokenizer-repair",
35240
- up: up572
35413
+ up: up582
35241
35414
  },
35242
35415
  {
35243
35416
  version: 58,
35244
35417
  name: "knowledge-graph-indices",
35245
- up: up582
35418
+ up: up592
35246
35419
  },
35247
35420
  {
35248
35421
  version: 59,
35249
35422
  name: "entity-attribute-claim-key",
35250
- up: up592,
35423
+ up: up602,
35251
35424
  artifacts: {
35252
35425
  columns: [{ table: "entity_attributes", column: "claim_key" }]
35253
35426
  }
@@ -35255,7 +35428,7 @@ var MIGRATIONS2 = [
35255
35428
  {
35256
35429
  version: 60,
35257
35430
  name: "entity-attribute-group-key",
35258
- up: up602,
35431
+ up: up612,
35259
35432
  artifacts: {
35260
35433
  columns: [{ table: "entity_attributes", column: "group_key" }]
35261
35434
  }
@@ -35263,7 +35436,7 @@ var MIGRATIONS2 = [
35263
35436
  {
35264
35437
  version: 61,
35265
35438
  name: "memory-artifact-source-mtime",
35266
- up: up612,
35439
+ up: up622,
35267
35440
  artifacts: {
35268
35441
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
35269
35442
  }
@@ -35271,7 +35444,7 @@ var MIGRATIONS2 = [
35271
35444
  {
35272
35445
  version: 62,
35273
35446
  name: "memory-artifact-soft-delete",
35274
- up: up622,
35447
+ up: up632,
35275
35448
  artifacts: {
35276
35449
  columns: [
35277
35450
  { table: "memory_artifacts", column: "is_deleted" },
@@ -35282,12 +35455,12 @@ var MIGRATIONS2 = [
35282
35455
  {
35283
35456
  version: 63,
35284
35457
  name: "content-only-memories-fts-update",
35285
- up: up632
35458
+ up: up642
35286
35459
  },
35287
35460
  {
35288
35461
  version: 64,
35289
35462
  name: "source-graph-provenance",
35290
- up: up642,
35463
+ up: up652,
35291
35464
  artifacts: {
35292
35465
  columns: [
35293
35466
  { table: "entities", column: "source_path" },
@@ -35300,7 +35473,7 @@ var MIGRATIONS2 = [
35300
35473
  {
35301
35474
  version: 65,
35302
35475
  name: "source-embedding-agent-scope",
35303
- up: up652,
35476
+ up: up662,
35304
35477
  artifacts: {
35305
35478
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
35306
35479
  }
@@ -35308,7 +35481,7 @@ var MIGRATIONS2 = [
35308
35481
  {
35309
35482
  version: 66,
35310
35483
  name: "memory-search-telemetry",
35311
- up: up662,
35484
+ up: up672,
35312
35485
  artifacts: {
35313
35486
  tables: ["memory_search_telemetry"]
35314
35487
  }
@@ -35316,7 +35489,7 @@ var MIGRATIONS2 = [
35316
35489
  {
35317
35490
  version: 67,
35318
35491
  name: "ontology-proposals",
35319
- up: up672,
35492
+ up: up682,
35320
35493
  artifacts: {
35321
35494
  tables: ["ontology_proposals"],
35322
35495
  columns: [
@@ -35330,7 +35503,7 @@ var MIGRATIONS2 = [
35330
35503
  {
35331
35504
  version: 68,
35332
35505
  name: "daily-reflections",
35333
- up: up682,
35506
+ up: up692,
35334
35507
  artifacts: {
35335
35508
  tables: ["daily_reflections"]
35336
35509
  }
@@ -35338,7 +35511,7 @@ var MIGRATIONS2 = [
35338
35511
  {
35339
35512
  version: 69,
35340
35513
  name: "daily-reflections-multiple-insights",
35341
- up: up692,
35514
+ up: up702,
35342
35515
  artifacts: {
35343
35516
  tables: ["daily_reflections"]
35344
35517
  }
@@ -35346,7 +35519,7 @@ var MIGRATIONS2 = [
35346
35519
  {
35347
35520
  version: 70,
35348
35521
  name: "ontology-control-plane-state",
35349
- up: up702,
35522
+ up: up712,
35350
35523
  artifacts: {
35351
35524
  columns: [
35352
35525
  { table: "entities", column: "status" },
@@ -35361,7 +35534,7 @@ var MIGRATIONS2 = [
35361
35534
  {
35362
35535
  version: 71,
35363
35536
  name: "epistemic-assertions",
35364
- up: up712,
35537
+ up: up722,
35365
35538
  artifacts: {
35366
35539
  tables: ["epistemic_assertions"]
35367
35540
  }
@@ -35369,7 +35542,7 @@ var MIGRATIONS2 = [
35369
35542
  {
35370
35543
  version: 72,
35371
35544
  name: "agent-scoped-idempotency-key",
35372
- up: up722,
35545
+ up: up732,
35373
35546
  artifacts: {
35374
35547
  columns: [
35375
35548
  { table: "memories", column: "idempotency_key" },
@@ -35380,7 +35553,7 @@ var MIGRATIONS2 = [
35380
35553
  {
35381
35554
  version: 73,
35382
35555
  name: "recall-context-dedupe",
35383
- up: up732,
35556
+ up: up742,
35384
35557
  artifacts: {
35385
35558
  tables: ["session_context_epochs", "session_recall_events"]
35386
35559
  }
@@ -35388,7 +35561,7 @@ var MIGRATIONS2 = [
35388
35561
  {
35389
35562
  version: 74,
35390
35563
  name: "aggregate-memory-links",
35391
- up: up742,
35564
+ up: up752,
35392
35565
  artifacts: {
35393
35566
  tables: ["aggregate_memory_sources"]
35394
35567
  }
@@ -35396,7 +35569,7 @@ var MIGRATIONS2 = [
35396
35569
  {
35397
35570
  version: 75,
35398
35571
  name: "memory-artifact-source-provenance",
35399
- up: up752,
35572
+ up: up762,
35400
35573
  artifacts: {
35401
35574
  columns: [
35402
35575
  { table: "memory_artifacts", column: "source_id" },
@@ -35410,7 +35583,7 @@ var MIGRATIONS2 = [
35410
35583
  {
35411
35584
  version: 76,
35412
35585
  name: "temporal-edges",
35413
- up: up762,
35586
+ up: up772,
35414
35587
  artifacts: {
35415
35588
  tables: ["temporal_edges"]
35416
35589
  }
@@ -35418,7 +35591,7 @@ var MIGRATIONS2 = [
35418
35591
  {
35419
35592
  version: 77,
35420
35593
  name: "entity-aliases",
35421
- up: up772,
35594
+ up: up782,
35422
35595
  artifacts: {
35423
35596
  tables: ["entity_aliases"]
35424
35597
  }
@@ -35426,7 +35599,7 @@ var MIGRATIONS2 = [
35426
35599
  {
35427
35600
  version: 78,
35428
35601
  name: "api-keys",
35429
- up: up782,
35602
+ up: up792,
35430
35603
  artifacts: {
35431
35604
  tables: ["api_keys"]
35432
35605
  }
@@ -35434,7 +35607,7 @@ var MIGRATIONS2 = [
35434
35607
  {
35435
35608
  version: 79,
35436
35609
  name: "transcript-capture-jobs",
35437
- up: up792,
35610
+ up: up802,
35438
35611
  artifacts: {
35439
35612
  tables: ["transcript_capture_jobs"]
35440
35613
  }
@@ -35442,7 +35615,7 @@ var MIGRATIONS2 = [
35442
35615
  {
35443
35616
  version: 80,
35444
35617
  name: "document-scope-columns",
35445
- up: up802,
35618
+ up: up812,
35446
35619
  artifacts: {
35447
35620
  columns: [
35448
35621
  { table: "documents", column: "agent_id" },
@@ -35453,7 +35626,7 @@ var MIGRATIONS2 = [
35453
35626
  {
35454
35627
  version: 81,
35455
35628
  name: "aggregate-evidence-sources",
35456
- up: up812,
35629
+ up: up822,
35457
35630
  artifacts: {
35458
35631
  tables: ["aggregate_evidence_sources"]
35459
35632
  }
@@ -35461,7 +35634,7 @@ var MIGRATIONS2 = [
35461
35634
  {
35462
35635
  version: 82,
35463
35636
  name: "skill-invocations-harness",
35464
- up: up822,
35637
+ up: up832,
35465
35638
  artifacts: {
35466
35639
  columns: [
35467
35640
  { table: "skill_invocations", column: "harness" },
@@ -35472,7 +35645,7 @@ var MIGRATIONS2 = [
35472
35645
  {
35473
35646
  version: 83,
35474
35647
  name: "memory-lifecycle-repair",
35475
- up: up832,
35648
+ up: up842,
35476
35649
  artifacts: {
35477
35650
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
35478
35651
  columns: [
@@ -35487,7 +35660,7 @@ var MIGRATIONS2 = [
35487
35660
  {
35488
35661
  version: 84,
35489
35662
  name: "legacy-markdown-import-state",
35490
- up: up842,
35663
+ up: up852,
35491
35664
  artifacts: {
35492
35665
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
35493
35666
  }
@@ -35495,7 +35668,7 @@ var MIGRATIONS2 = [
35495
35668
  {
35496
35669
  version: 85,
35497
35670
  name: "backfill-relations-to-dependencies",
35498
- up: up852,
35671
+ up: up862,
35499
35672
  artifacts: {
35500
35673
  tables: ["entity_dependencies"]
35501
35674
  }
@@ -35503,7 +35676,7 @@ var MIGRATIONS2 = [
35503
35676
  {
35504
35677
  version: 86,
35505
35678
  name: "summary-jobs-content-hash",
35506
- up: up862,
35679
+ up: up872,
35507
35680
  artifacts: {
35508
35681
  columns: [{ table: "summary_jobs", column: "content_hash" }]
35509
35682
  }
@@ -35511,7 +35684,7 @@ var MIGRATIONS2 = [
35511
35684
  {
35512
35685
  version: 87,
35513
35686
  name: "summary-jobs-boundary-reason",
35514
- up: up872,
35687
+ up: up882,
35515
35688
  artifacts: {
35516
35689
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
35517
35690
  }
@@ -35519,7 +35692,7 @@ var MIGRATIONS2 = [
35519
35692
  {
35520
35693
  version: 88,
35521
35694
  name: "transcript-recovery-files",
35522
- up: up882,
35695
+ up: up892,
35523
35696
  artifacts: {
35524
35697
  tables: ["transcript_recovery_files"]
35525
35698
  }
@@ -35527,7 +35700,7 @@ var MIGRATIONS2 = [
35527
35700
  {
35528
35701
  version: 89,
35529
35702
  name: "job-cancellations",
35530
- up: up892,
35703
+ up: up902,
35531
35704
  artifacts: {
35532
35705
  tables: ["job_cancellations"]
35533
35706
  }
@@ -35535,7 +35708,7 @@ var MIGRATIONS2 = [
35535
35708
  {
35536
35709
  version: 90,
35537
35710
  name: "job-archive",
35538
- up: up902,
35711
+ up: up912,
35539
35712
  artifacts: {
35540
35713
  tables: ["job_archive"]
35541
35714
  }
@@ -35543,25 +35716,25 @@ var MIGRATIONS2 = [
35543
35716
  {
35544
35717
  version: 91,
35545
35718
  name: "embedding-index-generations",
35546
- up: up912,
35719
+ up: up922,
35547
35720
  artifacts: { tables: ["embedding_index_state"] }
35548
35721
  },
35549
35722
  {
35550
35723
  version: 92,
35551
35724
  name: "embedding-staging-store",
35552
- up: up922,
35725
+ up: up932,
35553
35726
  artifacts: { tables: ["embeddings_staging"] }
35554
35727
  },
35555
35728
  {
35556
35729
  version: 93,
35557
35730
  name: "dreaming-evidence-cursor",
35558
- up: up932,
35731
+ up: up942,
35559
35732
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
35560
35733
  },
35561
35734
  {
35562
35735
  version: 94,
35563
35736
  name: "memory-kind",
35564
- up: up942,
35737
+ up: up952,
35565
35738
  artifacts: {
35566
35739
  columns: [
35567
35740
  { table: "memories", column: "memory_kind" },
@@ -35572,35 +35745,35 @@ var MIGRATIONS2 = [
35572
35745
  {
35573
35746
  version: 95,
35574
35747
  name: "compaction-recall-projections",
35575
- up: up952
35748
+ up: up962
35576
35749
  },
35577
35750
  {
35578
35751
  version: 96,
35579
35752
  name: "retire-legacy-ingestion",
35580
- up: up962
35753
+ up: up972
35581
35754
  },
35582
35755
  {
35583
35756
  version: 97,
35584
35757
  name: "dreaming-failure-backoff",
35585
- up: up972,
35758
+ up: up982,
35586
35759
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
35587
35760
  },
35588
35761
  {
35589
35762
  version: 98,
35590
35763
  name: "dreaming-evidence-exclusions",
35591
- up: up982,
35764
+ up: up992,
35592
35765
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
35593
35766
  },
35594
35767
  {
35595
35768
  version: 99,
35596
35769
  name: "dreaming-tool-calls",
35597
- up: up992,
35770
+ up: up1002,
35598
35771
  artifacts: { tables: ["dreaming_tool_calls"] }
35599
35772
  },
35600
35773
  {
35601
35774
  version: 100,
35602
35775
  name: "dreaming-runbook",
35603
- up: up1002,
35776
+ up: up1012,
35604
35777
  artifacts: {
35605
35778
  columns: [
35606
35779
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -35611,23 +35784,23 @@ var MIGRATIONS2 = [
35611
35784
  {
35612
35785
  version: 101,
35613
35786
  name: "dreaming-attention",
35614
- up: up1012,
35787
+ up: up1022,
35615
35788
  artifacts: { tables: ["dreaming_attention"] }
35616
35789
  },
35617
35790
  {
35618
35791
  version: 102,
35619
35792
  name: "attribute-semantic-memories",
35620
- up: up1022
35793
+ up: up1032
35621
35794
  },
35622
35795
  {
35623
35796
  version: 103,
35624
35797
  name: "semantic-memory-kind",
35625
- up: up1032
35798
+ up: up1042
35626
35799
  },
35627
35800
  {
35628
35801
  version: 104,
35629
35802
  name: "derived-memory-provenance",
35630
- up: up1042,
35803
+ up: up1052,
35631
35804
  artifacts: {
35632
35805
  tables: ["derived_memory_sources"],
35633
35806
  columns: [{ table: "memories", column: "stale_at" }]
@@ -35636,12 +35809,12 @@ var MIGRATIONS2 = [
35636
35809
  {
35637
35810
  version: 105,
35638
35811
  name: "agent-scoped-entity-name",
35639
- up: up1052
35812
+ up: up1062
35640
35813
  },
35641
35814
  {
35642
35815
  version: 106,
35643
35816
  name: "memory-review-after",
35644
- up: up1062,
35817
+ up: up1072,
35645
35818
  artifacts: {
35646
35819
  columns: [{ table: "memories", column: "review_after" }]
35647
35820
  }
@@ -35649,7 +35822,7 @@ var MIGRATIONS2 = [
35649
35822
  {
35650
35823
  version: 107,
35651
35824
  name: "dreaming-pass-usage",
35652
- up: up1072,
35825
+ up: up1082,
35653
35826
  artifacts: {
35654
35827
  columns: [
35655
35828
  { table: "dreaming_passes", column: "tokens_input" },
@@ -35663,7 +35836,7 @@ var MIGRATIONS2 = [
35663
35836
  {
35664
35837
  version: 108,
35665
35838
  name: "embedding-usage",
35666
- up: up1082,
35839
+ up: up1092,
35667
35840
  artifacts: {
35668
35841
  tables: ["embedding_usage"]
35669
35842
  }
@@ -35671,7 +35844,7 @@ var MIGRATIONS2 = [
35671
35844
  {
35672
35845
  version: 109,
35673
35846
  name: "telemetry-install",
35674
- up: up1092,
35847
+ up: up1102,
35675
35848
  artifacts: {
35676
35849
  tables: ["telemetry_install"]
35677
35850
  }
@@ -35679,12 +35852,12 @@ var MIGRATIONS2 = [
35679
35852
  {
35680
35853
  version: 110,
35681
35854
  name: "memory-mention-join-index",
35682
- up: up1102
35855
+ up: up1112
35683
35856
  },
35684
35857
  {
35685
35858
  version: 111,
35686
35859
  name: "telemetry-first-use",
35687
- up: up1112,
35860
+ up: up1122,
35688
35861
  artifacts: {
35689
35862
  columns: [
35690
35863
  { table: "telemetry_install", column: "first_remember_at" },
@@ -35695,7 +35868,7 @@ var MIGRATIONS2 = [
35695
35868
  {
35696
35869
  version: 112,
35697
35870
  name: "telemetry-queue-ownership",
35698
- up: up1122,
35871
+ up: up1132,
35699
35872
  artifacts: {
35700
35873
  columns: [
35701
35874
  { table: "telemetry_events", column: "source" },
@@ -35707,7 +35880,7 @@ var MIGRATIONS2 = [
35707
35880
  {
35708
35881
  version: 113,
35709
35882
  name: "session-claims",
35710
- up: up1132,
35883
+ up: up1142,
35711
35884
  artifacts: {
35712
35885
  tables: ["session_claims"],
35713
35886
  columns: [
@@ -35721,12 +35894,12 @@ var MIGRATIONS2 = [
35721
35894
  {
35722
35895
  version: 114,
35723
35896
  name: "memory-traversal-hydration-index",
35724
- up: up1142
35897
+ up: up1152
35725
35898
  },
35726
35899
  {
35727
35900
  version: 115,
35728
35901
  name: "cross-agent-message-notifications",
35729
- up: up1152,
35902
+ up: up1162,
35730
35903
  artifacts: {
35731
35904
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
35732
35905
  }
@@ -35734,7 +35907,7 @@ var MIGRATIONS2 = [
35734
35907
  {
35735
35908
  version: 116,
35736
35909
  name: "acp-delivery-reconciliation",
35737
- up: up1162,
35910
+ up: up1172,
35738
35911
  artifacts: {
35739
35912
  columns: [
35740
35913
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -35748,7 +35921,7 @@ var MIGRATIONS2 = [
35748
35921
  {
35749
35922
  version: 117,
35750
35923
  name: "retire-summary-worker",
35751
- up: up1172,
35924
+ up: up1182,
35752
35925
  artifacts: {
35753
35926
  columns: [
35754
35927
  { table: "session_transcripts", column: "completed_at" },
@@ -35759,24 +35932,24 @@ var MIGRATIONS2 = [
35759
35932
  {
35760
35933
  version: 118,
35761
35934
  name: "queue-pressure-indices",
35762
- up: up1182
35935
+ up: up1192
35763
35936
  },
35764
35937
  {
35765
35938
  version: 119,
35766
35939
  name: "telemetry-version-observation",
35767
- up: up1192,
35940
+ up: up1202,
35768
35941
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
35769
35942
  },
35770
35943
  {
35771
35944
  version: 120,
35772
35945
  name: "source-lifecycle-telemetry",
35773
- up: up1202,
35946
+ up: up1212,
35774
35947
  artifacts: { tables: ["source_lifecycle_state"] }
35775
35948
  },
35776
35949
  {
35777
35950
  version: 121,
35778
35951
  name: "telemetry-delivery-health",
35779
- up: up1212,
35952
+ up: up1222,
35780
35953
  artifacts: {
35781
35954
  tables: ["telemetry_delivery_state"],
35782
35955
  columns: [
@@ -35790,7 +35963,7 @@ var MIGRATIONS2 = [
35790
35963
  {
35791
35964
  version: 122,
35792
35965
  name: "dreaming-evidence-retry",
35793
- up: up1222,
35966
+ up: up1232,
35794
35967
  artifacts: {
35795
35968
  columns: [
35796
35969
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -35803,13 +35976,13 @@ var MIGRATIONS2 = [
35803
35976
  {
35804
35977
  version: 123,
35805
35978
  name: "embedding-index-failures",
35806
- up: up1232,
35979
+ up: up1242,
35807
35980
  artifacts: { tables: ["embedding_index_failures"] }
35808
35981
  },
35809
35982
  {
35810
35983
  version: 124,
35811
35984
  name: "import-derived-lifecycle",
35812
- up: up1242,
35985
+ up: up1252,
35813
35986
  artifacts: {
35814
35987
  tables: ["imported_source_lifecycle"]
35815
35988
  }
@@ -35817,77 +35990,77 @@ var MIGRATIONS2 = [
35817
35990
  {
35818
35991
  version: 125,
35819
35992
  name: "memory-content-safety",
35820
- up: up1252,
35993
+ up: up1262,
35821
35994
  artifacts: { tables: ["memory_content_safety"] }
35822
35995
  },
35823
35996
  {
35824
35997
  version: 126,
35825
35998
  name: "dreaming-surprisal-attention",
35826
- up: up1262,
35999
+ up: up1272,
35827
36000
  artifacts: { tables: ["dreaming_attention"] }
35828
36001
  },
35829
36002
  {
35830
36003
  version: 127,
35831
36004
  name: "ontology-contradictions",
35832
- up: up1272,
36005
+ up: up1282,
35833
36006
  artifacts: { tables: ["ontology_contradictions"] }
35834
36007
  },
35835
36008
  {
35836
36009
  version: 128,
35837
36010
  name: "bounded-queue-diagnostics",
35838
- up: up1282
36011
+ up: up1292
35839
36012
  },
35840
36013
  {
35841
36014
  version: 129,
35842
36015
  name: "retire-structural-jobs",
35843
- up: up1292
36016
+ up: up1302
35844
36017
  },
35845
36018
  {
35846
36019
  version: 130,
35847
36020
  name: "embedding-repair-state",
35848
- up: up1302,
36021
+ up: up1312,
35849
36022
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
35850
36023
  },
35851
36024
  {
35852
36025
  version: 131,
35853
36026
  name: "dreaming-evidence-consumption",
35854
- up: up1312,
36027
+ up: up1322,
35855
36028
  artifacts: { tables: ["dreaming_evidence_consumption"] }
35856
36029
  },
35857
36030
  {
35858
36031
  version: 132,
35859
36032
  name: "observer-scoped-epistemic-assertions",
35860
- up: up1322,
36033
+ up: up1332,
35861
36034
  artifacts: { tables: ["epistemic_assertions"] }
35862
36035
  },
35863
36036
  {
35864
36037
  version: 133,
35865
36038
  name: "dreaming-memory-head",
35866
- up: up1332,
36039
+ up: up1342,
35867
36040
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
35868
36041
  },
35869
36042
  {
35870
36043
  version: 134,
35871
36044
  name: "scope-memory-head-entries",
35872
- up: up1342,
36045
+ up: up1352,
35873
36046
  artifacts: { tables: ["memory_head_entries"] }
35874
36047
  },
35875
36048
  {
35876
36049
  version: 135,
35877
36050
  name: "memory-head-publication",
35878
- up: up1352,
36051
+ up: up1362,
35879
36052
  artifacts: { tables: ["memory_head_publications"] }
35880
36053
  },
35881
36054
  {
35882
36055
  version: 136,
35883
36056
  name: "memory-head-revisions",
35884
- up: up1362,
36057
+ up: up1372,
35885
36058
  artifacts: { tables: ["memory_head_revisions"] }
35886
36059
  },
35887
36060
  {
35888
36061
  version: 137,
35889
36062
  name: "dreaming-head-manifest",
35890
- up: up1372,
36063
+ up: up1382,
35891
36064
  artifacts: {
35892
36065
  columns: [
35893
36066
  { table: "dreaming_passes", column: "head_revision" },
@@ -35898,7 +36071,7 @@ var MIGRATIONS2 = [
35898
36071
  {
35899
36072
  version: 138,
35900
36073
  name: "bounded-status-projections",
35901
- up: up1382,
36074
+ up: up1392,
35902
36075
  artifacts: {
35903
36076
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
35904
36077
  }
@@ -35906,31 +36079,31 @@ var MIGRATIONS2 = [
35906
36079
  {
35907
36080
  version: 139,
35908
36081
  name: "native-source-sync-state",
35909
- up: up1392,
36082
+ up: up1402,
35910
36083
  artifacts: { tables: ["native_source_sync_state"] }
35911
36084
  },
35912
36085
  {
35913
36086
  version: 140,
35914
36087
  name: "transcript-recovery-frontier",
35915
- up: up1402,
36088
+ up: up1412,
35916
36089
  artifacts: { tables: ["transcript_recovery_frontiers"] }
35917
36090
  },
35918
36091
  {
35919
36092
  version: 141,
35920
36093
  name: "source-sync-checkpoints",
35921
- up: up1412,
36094
+ up: up1422,
35922
36095
  artifacts: { tables: ["source_sync_checkpoints"] }
35923
36096
  },
35924
36097
  {
35925
36098
  version: 142,
35926
36099
  name: "source-sync-frontier",
35927
- up: up1422,
36100
+ up: up1432,
35928
36101
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
35929
36102
  },
35930
36103
  {
35931
36104
  version: 143,
35932
36105
  name: "embedding-index-progress",
35933
- up: up1432,
36106
+ up: up1442,
35934
36107
  artifacts: {
35935
36108
  columns: [
35936
36109
  { table: "embedding_index_state", column: "migration_phase" },
@@ -35946,19 +36119,19 @@ var MIGRATIONS2 = [
35946
36119
  {
35947
36120
  version: 144,
35948
36121
  name: "memory-job-lease-token",
35949
- up: up1442,
36122
+ up: up1452,
35950
36123
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
35951
36124
  },
35952
36125
  {
35953
36126
  version: 145,
35954
36127
  name: "dreaming-evidence-reviews",
35955
- up: up1452,
36128
+ up: up1462,
35956
36129
  artifacts: { tables: ["dreaming_evidence_reviews"] }
35957
36130
  },
35958
36131
  {
35959
36132
  version: 146,
35960
36133
  name: "source-transcript-import",
35961
- up: up1462,
36134
+ up: up1472,
35962
36135
  artifacts: {
35963
36136
  tables: [
35964
36137
  "source_import_jobs",
@@ -35977,19 +36150,19 @@ var MIGRATIONS2 = [
35977
36150
  {
35978
36151
  version: 147,
35979
36152
  name: "source-import-replay-file-slots",
35980
- up: up1472,
36153
+ up: up1482,
35981
36154
  artifacts: { tables: ["source_import_files"] }
35982
36155
  },
35983
36156
  {
35984
36157
  version: 148,
35985
36158
  name: "source-import-attempt-provenance",
35986
- up: up1482,
36159
+ up: up1492,
35987
36160
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
35988
36161
  },
35989
36162
  {
35990
36163
  version: 149,
35991
36164
  name: "transcript-import-state-machine",
35992
- up: up1492,
36165
+ up: up1502,
35993
36166
  artifacts: {
35994
36167
  columns: [
35995
36168
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -36001,13 +36174,42 @@ var MIGRATIONS2 = [
36001
36174
  {
36002
36175
  version: 150,
36003
36176
  name: "memory-head-freshness",
36004
- up: up1502,
36177
+ up: up1512,
36005
36178
  artifacts: {
36006
36179
  columns: [
36007
36180
  { table: "memory_md_heads", column: "is_current" },
36008
36181
  { table: "dreaming_passes", column: "head_base_revision" }
36009
36182
  ]
36010
36183
  }
36184
+ },
36185
+ {
36186
+ version: 151,
36187
+ name: "transcript-import-bytes",
36188
+ up: up152,
36189
+ artifacts: {
36190
+ tables: [
36191
+ "source_import_chunks",
36192
+ "source_import_capacity",
36193
+ "source_import_migrations",
36194
+ "source_import_migration_streams",
36195
+ "source_import_migration_counts"
36196
+ ],
36197
+ columns: [
36198
+ { table: "source_import_files", column: "storage_state" },
36199
+ { table: "source_import_files", column: "upload_generation" },
36200
+ { table: "source_import_files", column: "upload_offset" },
36201
+ { table: "source_import_files", column: "upload_size" },
36202
+ { table: "source_import_files", column: "upload_digest" },
36203
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
36204
+ table: "source_import_files",
36205
+ column
36206
+ })),
36207
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
36208
+ table: "source_import_jobs",
36209
+ column
36210
+ }))
36211
+ ]
36212
+ }
36011
36213
  }
36012
36214
  ];
36013
36215
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;