@signetai/connector-kimi 0.221.8 → 0.221.10

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
@@ -11302,6 +11302,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
11302
11302
  "checkpoint",
11303
11303
  "dreaming"
11304
11304
  ];
11305
+ function up(db) {
11306
+ const hasColumn = (table, column) => {
11307
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
11308
+ try {
11309
+ return statement.get(column) != null;
11310
+ } finally {
11311
+ statement.finalize?.();
11312
+ }
11313
+ };
11314
+ for (const [column, definition] of [
11315
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
11316
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
11317
+ ["upload_size", "INTEGER"],
11318
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
11319
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
11320
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
11321
+ ["original_path", "TEXT"],
11322
+ [
11323
+ "storage_state",
11324
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
11325
+ ]
11326
+ ]) {
11327
+ if (!hasColumn("source_import_files", column))
11328
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
11329
+ }
11330
+ if (!hasColumn("source_import_jobs", "retry_count"))
11331
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
11332
+ if (!hasColumn("source_import_jobs", "cleanup_state"))
11333
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
11334
+ if (!hasColumn("source_import_jobs", "retry_cursor"))
11335
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
11336
+ if (!hasColumn("source_import_jobs", "retry_requested"))
11337
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
11338
+ db.exec(`
11339
+ 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);
11340
+ 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;
11341
+ 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;
11342
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
11343
+ 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));
11344
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
11345
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
11346
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
11347
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
11348
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
11349
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
11350
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
11351
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
11352
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
11353
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
11354
+ ) WITHOUT ROWID;
11355
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
11356
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
11357
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
11358
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
11359
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
11360
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
11361
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
11362
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
11363
+ `);
11364
+ }
11305
11365
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11306
11366
  var FTS_STATE_TABLE = "memories_fts_state";
11307
11367
  function normalizeSql(sql) {
@@ -11417,7 +11477,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11417
11477
  return true;
11418
11478
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
11419
11479
  }
11420
- function up(db) {
11480
+ function up2(db) {
11421
11481
  db.exec(`
11422
11482
  CREATE TABLE IF NOT EXISTS schema_migrations (
11423
11483
  version INTEGER PRIMARY KEY,
@@ -11515,7 +11575,7 @@ function addColumnIfMissing(db, table, column, definition) {
11515
11575
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11516
11576
  }
11517
11577
  }
11518
- function up2(db) {
11578
+ function up3(db) {
11519
11579
  addColumnIfMissing(db, "memories", "content_hash", "TEXT");
11520
11580
  addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
11521
11581
  addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -11633,7 +11693,7 @@ function addColumnIfMissing2(db, table, column, definition) {
11633
11693
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11634
11694
  return true;
11635
11695
  }
11636
- function up3(db) {
11696
+ function up4(db) {
11637
11697
  addColumnIfMissing2(db, "memories", "why", "TEXT");
11638
11698
  addColumnIfMissing2(db, "memories", "project", "TEXT");
11639
11699
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -11670,7 +11730,7 @@ function addColumnIfMissing3(db, table, column, definition) {
11670
11730
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11671
11731
  }
11672
11732
  }
11673
- function up4(db) {
11733
+ function up5(db) {
11674
11734
  addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
11675
11735
  addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
11676
11736
  addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
@@ -11703,7 +11763,7 @@ function addColumnIfMissing4(db, table, column, definition) {
11703
11763
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11704
11764
  }
11705
11765
  }
11706
- function up5(db) {
11766
+ function up6(db) {
11707
11767
  addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
11708
11768
  addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
11709
11769
  addColumnIfMissing4(db, "entities", "embedding", "BLOB");
@@ -11720,7 +11780,7 @@ function hasColumn4(db, table, column) {
11720
11780
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11721
11781
  return rows.some((r2) => r2.name === column);
11722
11782
  }
11723
- function up6(db) {
11783
+ function up7(db) {
11724
11784
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11725
11785
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11726
11786
  }
@@ -11735,7 +11795,7 @@ function hasColumn5(db, table, column) {
11735
11795
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11736
11796
  return rows.some((r2) => r2.name === column);
11737
11797
  }
11738
- function up7(db) {
11798
+ function up8(db) {
11739
11799
  db.exec(`
11740
11800
  CREATE TABLE IF NOT EXISTS documents (
11741
11801
  id TEXT PRIMARY KEY,
@@ -11792,7 +11852,7 @@ function up7(db) {
11792
11852
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11793
11853
  }
11794
11854
  }
11795
- function up8(db) {
11855
+ function up9(db) {
11796
11856
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11797
11857
  if (tables.length === 0)
11798
11858
  return;
@@ -11809,7 +11869,7 @@ function up8(db) {
11809
11869
  ON embeddings(content_hash)
11810
11870
  `);
11811
11871
  }
11812
- function up9(db) {
11872
+ function up10(db) {
11813
11873
  db.exec(`
11814
11874
  CREATE TABLE IF NOT EXISTS summary_jobs (
11815
11875
  id TEXT PRIMARY KEY,
@@ -11829,7 +11889,7 @@ function up9(db) {
11829
11889
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11830
11890
  ON summary_jobs(status)`);
11831
11891
  }
11832
- function up10(db) {
11892
+ function up11(db) {
11833
11893
  db.exec(`
11834
11894
  CREATE TABLE IF NOT EXISTS umap_cache (
11835
11895
  id INTEGER PRIMARY KEY,
@@ -11840,7 +11900,7 @@ function up10(db) {
11840
11900
  )
11841
11901
  `);
11842
11902
  }
11843
- function up11(db) {
11903
+ function up12(db) {
11844
11904
  db.exec(`
11845
11905
  CREATE TABLE IF NOT EXISTS session_scores (
11846
11906
  id TEXT PRIMARY KEY,
@@ -11860,7 +11920,7 @@ function up11(db) {
11860
11920
  ON session_scores(session_key);
11861
11921
  `);
11862
11922
  }
11863
- function up12(db) {
11923
+ function up13(db) {
11864
11924
  db.exec(`
11865
11925
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11866
11926
  id TEXT PRIMARY KEY,
@@ -11901,7 +11961,7 @@ function addColumnIfMissing5(db, table, column, definition) {
11901
11961
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11902
11962
  }
11903
11963
  }
11904
- function up13(db) {
11964
+ function up14(db) {
11905
11965
  db.exec(`
11906
11966
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11907
11967
  id TEXT PRIMARY KEY,
@@ -11927,7 +11987,7 @@ function up13(db) {
11927
11987
  addColumnIfMissing5(db, "memories", "source_path", "TEXT");
11928
11988
  addColumnIfMissing5(db, "memories", "source_section", "TEXT");
11929
11989
  }
11930
- function up14(db) {
11990
+ function up15(db) {
11931
11991
  db.exec(`
11932
11992
  CREATE TABLE IF NOT EXISTS telemetry_events (
11933
11993
  id TEXT PRIMARY KEY,
@@ -11952,7 +12012,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11952
12012
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11953
12013
  }
11954
12014
  }
11955
- function up15(db) {
12015
+ function up16(db) {
11956
12016
  db.exec(`
11957
12017
  CREATE TABLE IF NOT EXISTS session_memories (
11958
12018
  id TEXT PRIMARY KEY,
@@ -11979,7 +12039,7 @@ function up15(db) {
11979
12039
  addColumnIfMissing6(db, "session_scores", "confidence", "REAL");
11980
12040
  addColumnIfMissing6(db, "session_scores", "continuity_reasoning", "TEXT");
11981
12041
  }
11982
- function up16(db) {
12042
+ function up17(db) {
11983
12043
  db.exec(`
11984
12044
  CREATE TABLE IF NOT EXISTS session_checkpoints (
11985
12045
  id TEXT PRIMARY KEY,
@@ -12001,7 +12061,7 @@ function up16(db) {
12001
12061
  ON session_checkpoints(project_normalized, created_at DESC);
12002
12062
  `);
12003
12063
  }
12004
- function up17(db) {
12064
+ function up18(db) {
12005
12065
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12006
12066
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12007
12067
  if (!colNames.has("skill_name")) {
@@ -12012,7 +12072,7 @@ function up17(db) {
12012
12072
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
12013
12073
  }
12014
12074
  }
12015
- function up18(db) {
12075
+ function up19(db) {
12016
12076
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12017
12077
  if (existing)
12018
12078
  return;
@@ -12044,7 +12104,7 @@ function up18(db) {
12044
12104
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
12045
12105
  `);
12046
12106
  }
12047
- function up19(db) {
12107
+ function up20(db) {
12048
12108
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12049
12109
  const entityColNames = new Set(entityCols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12050
12110
  if (!entityColNames.has("agent_id")) {
@@ -12129,13 +12189,13 @@ function addColumnIfMissing7(db, table, column, definition) {
12129
12189
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12130
12190
  }
12131
12191
  }
12132
- function up20(db) {
12192
+ function up21(db) {
12133
12193
  addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12134
12194
  addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12135
12195
  addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12136
12196
  addColumnIfMissing7(db, "session_memories", "structural_density", "INTEGER");
12137
12197
  }
12138
- function up21(db) {
12198
+ function up22(db) {
12139
12199
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12140
12200
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12141
12201
  if (!columnNames.has("focal_entity_ids")) {
@@ -12160,25 +12220,25 @@ function addColumnIfMissing8(db, table, column, definition) {
12160
12220
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12161
12221
  }
12162
12222
  }
12163
- function up22(db) {
12223
+ function up23(db) {
12164
12224
  addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12165
12225
  addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12166
12226
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12167
12227
  }
12168
- function up23(_db) {}
12169
12228
  function up24(_db) {}
12229
+ function up25(_db) {}
12170
12230
  function addColumnIfMissing9(db, table, column, definition) {
12171
12231
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12172
12232
  if (!cols.some((c2) => c2.name === column)) {
12173
12233
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12174
12234
  }
12175
12235
  }
12176
- function up25(db) {
12236
+ function up26(db) {
12177
12237
  addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12178
12238
  addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12179
12239
  }
12180
- function up26(_db) {}
12181
- function up27(db) {
12240
+ function up27(_db) {}
12241
+ function up28(db) {
12182
12242
  db.exec(`
12183
12243
  UPDATE entities
12184
12244
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12187,7 +12247,7 @@ function up27(db) {
12187
12247
  WHERE canonical_name IS NULL
12188
12248
  `);
12189
12249
  }
12190
- function up28(db) {
12250
+ function up29(db) {
12191
12251
  db.exec(`
12192
12252
  CREATE TABLE IF NOT EXISTS memories_cold (
12193
12253
  archive_id TEXT PRIMARY KEY,
@@ -12224,7 +12284,7 @@ function up28(db) {
12224
12284
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
12225
12285
  `);
12226
12286
  }
12227
- function up29(db) {
12287
+ function up30(db) {
12228
12288
  db.exec(`
12229
12289
  CREATE TABLE IF NOT EXISTS session_summaries (
12230
12290
  id TEXT PRIMARY KEY,
@@ -12269,7 +12329,7 @@ function up29(db) {
12269
12329
  WHERE session_key IS NOT NULL;
12270
12330
  `);
12271
12331
  }
12272
- function up30(db) {
12332
+ function up31(db) {
12273
12333
  db.exec(`
12274
12334
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12275
12335
  id TEXT PRIMARY KEY,
@@ -12314,7 +12374,7 @@ function up30(db) {
12314
12374
  ON memory_jobs(failed_at);
12315
12375
  `);
12316
12376
  }
12317
- function up31(db) {
12377
+ function up32(db) {
12318
12378
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12319
12379
  if (!depCols.some((c2) => c2.name === "reason")) {
12320
12380
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12324,7 +12384,7 @@ function up31(db) {
12324
12384
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
12325
12385
  }
12326
12386
  }
12327
- function up32(db) {
12387
+ function up33(db) {
12328
12388
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12329
12389
  if (cols.length === 0)
12330
12390
  return;
@@ -12332,14 +12392,14 @@ function up32(db) {
12332
12392
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
12333
12393
  }
12334
12394
  }
12335
- function up33(db) {
12395
+ function up34(db) {
12336
12396
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12337
12397
  if (!cols.some((c2) => c2.name === "scope")) {
12338
12398
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
12339
12399
  }
12340
12400
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
12341
12401
  }
12342
- function up34(db) {
12402
+ function up35(db) {
12343
12403
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12344
12404
  db.exec(`
12345
12405
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12347,7 +12407,7 @@ function up34(db) {
12347
12407
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12348
12408
  `);
12349
12409
  }
12350
- function up35(db) {
12410
+ function up36(db) {
12351
12411
  db.exec(`
12352
12412
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12353
12413
  name, canonical_name,
@@ -12379,13 +12439,13 @@ function up35(db) {
12379
12439
  END
12380
12440
  `);
12381
12441
  }
12382
- function up36(db) {
12442
+ function up37(db) {
12383
12443
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12384
12444
  if (!cols.some((c2) => c2.name === "confidence")) {
12385
12445
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
12386
12446
  }
12387
12447
  }
12388
- function up37(db) {
12448
+ function up38(db) {
12389
12449
  db.exec(`
12390
12450
  CREATE TABLE IF NOT EXISTS entity_communities (
12391
12451
  id TEXT PRIMARY KEY,
@@ -12403,7 +12463,7 @@ function up37(db) {
12403
12463
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
12404
12464
  }
12405
12465
  }
12406
- function up38(db) {
12466
+ function up39(db) {
12407
12467
  db.exec(`
12408
12468
  CREATE TABLE IF NOT EXISTS memory_hints (
12409
12469
  id TEXT PRIMARY KEY,
@@ -12443,7 +12503,7 @@ function up38(db) {
12443
12503
  END
12444
12504
  `);
12445
12505
  }
12446
- function up39(db) {
12506
+ function up40(db) {
12447
12507
  db.exec(`
12448
12508
  DELETE FROM entity_dependencies
12449
12509
  WHERE id NOT IN (
@@ -12461,7 +12521,7 @@ function up39(db) {
12461
12521
  )
12462
12522
  `);
12463
12523
  }
12464
- function up40(db) {
12524
+ function up41(db) {
12465
12525
  db.exec(`
12466
12526
  CREATE TABLE IF NOT EXISTS session_transcripts (
12467
12527
  session_key TEXT PRIMARY KEY,
@@ -12484,7 +12544,7 @@ function addColumnIfMissing10(db, table, column, definition) {
12484
12544
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12485
12545
  }
12486
12546
  }
12487
- function up41(db) {
12547
+ function up42(db) {
12488
12548
  addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
12489
12549
  db.exec(`
12490
12550
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -12559,7 +12619,7 @@ function addColumnIfMissing11(db, table, column, definition) {
12559
12619
  return;
12560
12620
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12561
12621
  }
12562
- function up42(db) {
12622
+ function up43(db) {
12563
12623
  addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
12564
12624
  addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
12565
12625
  addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12647,7 +12707,7 @@ function addColumnIfMissing12(db, table, column, definition) {
12647
12707
  return;
12648
12708
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12649
12709
  }
12650
- function up43(db) {
12710
+ function up44(db) {
12651
12711
  db.exec(`
12652
12712
  CREATE TABLE IF NOT EXISTS agents (
12653
12713
  id TEXT PRIMARY KEY,
@@ -12676,7 +12736,7 @@ function addColumnIfMissing13(db, table, column, definition) {
12676
12736
  return;
12677
12737
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12678
12738
  }
12679
- function up44(db) {
12739
+ function up45(db) {
12680
12740
  addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
12681
12741
  addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
12682
12742
  addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
@@ -12702,7 +12762,7 @@ function addColumnIfMissing14(db, table, column, definition) {
12702
12762
  return;
12703
12763
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12704
12764
  }
12705
- function up45(db) {
12765
+ function up46(db) {
12706
12766
  addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
12707
12767
  addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12708
12768
  addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -12773,7 +12833,7 @@ function up45(db) {
12773
12833
  ON memory_md_heads(lease_expires_at);
12774
12834
  `);
12775
12835
  }
12776
- function up46(db) {
12836
+ function up47(db) {
12777
12837
  db.exec(`
12778
12838
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12779
12839
 
@@ -12834,7 +12894,7 @@ function up46(db) {
12834
12894
  AND COALESCE(source_type, 'summary') = 'summary';
12835
12895
  `);
12836
12896
  }
12837
- function up47(db) {
12897
+ function up48(db) {
12838
12898
  db.exec(`
12839
12899
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12840
12900
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -12932,7 +12992,7 @@ function up47(db) {
12932
12992
  AND COALESCE(source_type, 'summary') = 'summary';
12933
12993
  `);
12934
12994
  }
12935
- function up48(db) {
12995
+ function up49(db) {
12936
12996
  db.exec(`
12937
12997
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
12938
12998
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13050,7 +13110,7 @@ function up48(db) {
13050
13110
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
13051
13111
  `);
13052
13112
  }
13053
- function up49(db) {
13113
+ function up50(db) {
13054
13114
  db.exec(`
13055
13115
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13056
13116
  session_key TEXT NOT NULL,
@@ -13067,7 +13127,7 @@ function hasTable(db, name) {
13067
13127
  WHERE type = 'table' AND name = ?
13068
13128
  LIMIT 1`).get(name) !== undefined;
13069
13129
  }
13070
- function up50(db) {
13130
+ function up51(db) {
13071
13131
  db.exec(`
13072
13132
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13073
13133
  id TEXT PRIMARY KEY,
@@ -13237,7 +13297,7 @@ function addColumnIfMissing15(db, table, column, definition) {
13237
13297
  return;
13238
13298
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13239
13299
  }
13240
- function up51(db) {
13300
+ function up52(db) {
13241
13301
  addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13242
13302
  addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13243
13303
  addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
@@ -13329,7 +13389,7 @@ function up51(db) {
13329
13389
  VALUES ('rebuild');
13330
13390
  `);
13331
13391
  }
13332
- function up52(db) {
13392
+ function up53(db) {
13333
13393
  db.exec(`
13334
13394
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13335
13395
  id TEXT PRIMARY KEY,
@@ -13346,7 +13406,7 @@ function up52(db) {
13346
13406
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13347
13407
  `);
13348
13408
  }
13349
- function up53(db) {
13409
+ function up54(db) {
13350
13410
  db.exec(`
13351
13411
  CREATE TABLE IF NOT EXISTS skill_invocations (
13352
13412
  id TEXT PRIMARY KEY,
@@ -13362,7 +13422,7 @@ function up53(db) {
13362
13422
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
13363
13423
  `);
13364
13424
  }
13365
- function up54(db) {
13425
+ function up55(db) {
13366
13426
  db.exec(`
13367
13427
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13368
13428
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13393,7 +13453,7 @@ function up54(db) {
13393
13453
  ON task_scope_hints(agent_id, updated_at);
13394
13454
  `);
13395
13455
  }
13396
- function up55(db) {
13456
+ function up56(db) {
13397
13457
  db.exec(`
13398
13458
  CREATE TABLE IF NOT EXISTS dreaming_state (
13399
13459
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13436,7 +13496,7 @@ function ensureMemoriesScopeColumns(db) {
13436
13496
  if (!names.has("scope"))
13437
13497
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13438
13498
  }
13439
- function up56(db) {
13499
+ function up57(db) {
13440
13500
  ensureMemoriesScopeColumns(db);
13441
13501
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13442
13502
  db.exec(`
@@ -13449,20 +13509,20 @@ function up56(db) {
13449
13509
  WHERE content_hash IS NOT NULL AND is_deleted = 0
13450
13510
  `);
13451
13511
  }
13452
- function up57(db) {
13512
+ function up58(db) {
13453
13513
  const sql = readMemoriesFtsSql(db);
13454
13514
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13455
13515
  return;
13456
13516
  recreateMemoriesFts(db);
13457
13517
  }
13458
- function up58(db) {
13518
+ function up59(db) {
13459
13519
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13460
13520
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13461
13521
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
13462
13522
  ON entities(entity_type, mentions)
13463
13523
  WHERE entity_type = 'extracted'`);
13464
13524
  }
13465
- function up59(db) {
13525
+ function up60(db) {
13466
13526
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13467
13527
  if (!cols.some((col) => col.name === "claim_key")) {
13468
13528
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13471,7 +13531,7 @@ function up59(db) {
13471
13531
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
13472
13532
  WHERE claim_key IS NOT NULL`);
13473
13533
  }
13474
- function up60(db) {
13534
+ function up61(db) {
13475
13535
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13476
13536
  if (!cols.some((col) => col.name === "group_key")) {
13477
13537
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13483,13 +13543,13 @@ function up60(db) {
13483
13543
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
13484
13544
  WHERE claim_key IS NOT NULL`);
13485
13545
  }
13486
- function up61(db) {
13546
+ function up62(db) {
13487
13547
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13488
13548
  if (cols.some((col) => col.name === "source_mtime_ms"))
13489
13549
  return;
13490
13550
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
13491
13551
  }
13492
- function up62(db) {
13552
+ function up63(db) {
13493
13553
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13494
13554
  const names = new Set(cols.map((col) => col.name));
13495
13555
  if (!names.has("is_deleted")) {
@@ -13503,7 +13563,7 @@ function up62(db) {
13503
13563
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
13504
13564
  `);
13505
13565
  }
13506
- function up63(db) {
13566
+ function up64(db) {
13507
13567
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13508
13568
  db.exec(`
13509
13569
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13521,7 +13581,7 @@ function addColumnIfMissing16(db, table, column, definition) {
13521
13581
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13522
13582
  }
13523
13583
  }
13524
- function up64(db) {
13584
+ function up65(db) {
13525
13585
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13526
13586
  addColumnIfMissing16(db, table, "source_id", "TEXT");
13527
13587
  addColumnIfMissing16(db, table, "source_kind", "TEXT");
@@ -13541,7 +13601,7 @@ function hasColumn7(db, table, column) {
13541
13601
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13542
13602
  return rows.some((row) => row.name === column);
13543
13603
  }
13544
- function up65(db) {
13604
+ function up66(db) {
13545
13605
  if (!hasTable2(db, "embeddings"))
13546
13606
  return;
13547
13607
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13549,7 +13609,7 @@ function up65(db) {
13549
13609
  }
13550
13610
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
13551
13611
  }
13552
- function up66(db) {
13612
+ function up67(db) {
13553
13613
  db.exec(`
13554
13614
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13555
13615
  id TEXT PRIMARY KEY,
@@ -13590,7 +13650,7 @@ function addColumnIfMissing17(db, table, column, definition) {
13590
13650
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13591
13651
  }
13592
13652
  }
13593
- function up67(db) {
13653
+ function up68(db) {
13594
13654
  db.exec(`
13595
13655
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13596
13656
  id TEXT PRIMARY KEY,
@@ -13633,7 +13693,7 @@ function up67(db) {
13633
13693
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
13634
13694
  }
13635
13695
  }
13636
- function up68(db) {
13696
+ function up69(db) {
13637
13697
  db.exec(`
13638
13698
  CREATE TABLE IF NOT EXISTS daily_reflections (
13639
13699
  id TEXT PRIMARY KEY,
@@ -13660,7 +13720,7 @@ function up68(db) {
13660
13720
  WHERE content_key IS NOT NULL;
13661
13721
  `);
13662
13722
  }
13663
- function up69(db) {
13723
+ function up70(db) {
13664
13724
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13665
13725
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
13666
13726
  if (!colNames.has("content_key")) {
@@ -13697,7 +13757,7 @@ function backfillVersionRoots(db) {
13697
13757
  WHERE version_root_id IS NULL
13698
13758
  `);
13699
13759
  }
13700
- function up70(db) {
13760
+ function up71(db) {
13701
13761
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13702
13762
  addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13703
13763
  addColumnIfMissing18(db, table, "archived_at", "TEXT");
@@ -13732,7 +13792,7 @@ function up70(db) {
13732
13792
  ON entity_aspects(agent_id, proposal_id);
13733
13793
  `);
13734
13794
  }
13735
- function up71(db) {
13795
+ function up72(db) {
13736
13796
  db.exec(`
13737
13797
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13738
13798
  id TEXT PRIMARY KEY,
@@ -13788,7 +13848,7 @@ function ensureMemoriesScopeColumns2(db) {
13788
13848
  if (!names.has("runtime_path"))
13789
13849
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13790
13850
  }
13791
- function up72(db) {
13851
+ function up73(db) {
13792
13852
  ensureMemoriesScopeColumns2(db);
13793
13853
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13794
13854
  db.exec(`
@@ -13802,7 +13862,7 @@ function up72(db) {
13802
13862
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
13803
13863
  `);
13804
13864
  }
13805
- function up73(db) {
13865
+ function up74(db) {
13806
13866
  db.exec(`
13807
13867
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13808
13868
  session_key TEXT NOT NULL,
@@ -13837,7 +13897,7 @@ function up73(db) {
13837
13897
  ON session_recall_events(item_kind, item_id, created_at DESC);
13838
13898
  `);
13839
13899
  }
13840
- function up74(db) {
13900
+ function up75(db) {
13841
13901
  db.exec(`
13842
13902
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13843
13903
  aggregate_memory_id TEXT NOT NULL,
@@ -13856,7 +13916,7 @@ function addColumnIfMissing19(db, table, column, definition) {
13856
13916
  return;
13857
13917
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13858
13918
  }
13859
- function up75(db) {
13919
+ function up76(db) {
13860
13920
  addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
13861
13921
  addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
13862
13922
  addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -13869,7 +13929,7 @@ function up75(db) {
13869
13929
  ON memory_artifacts(agent_id, source_id, source_root);
13870
13930
  `);
13871
13931
  }
13872
- function up76(db) {
13932
+ function up77(db) {
13873
13933
  db.exec(`
13874
13934
  CREATE TABLE IF NOT EXISTS temporal_edges (
13875
13935
  id TEXT PRIMARY KEY,
@@ -13892,7 +13952,7 @@ function up76(db) {
13892
13952
  ON temporal_edges(agent_id, subject_type, subject_id);
13893
13953
  `);
13894
13954
  }
13895
- function up77(db) {
13955
+ function up78(db) {
13896
13956
  db.exec(`
13897
13957
  CREATE TABLE IF NOT EXISTS entity_aliases (
13898
13958
  id TEXT PRIMARY KEY,
@@ -13916,7 +13976,7 @@ function up77(db) {
13916
13976
  ON entity_aliases(agent_id, canonical_alias, status);
13917
13977
  `);
13918
13978
  }
13919
- function up78(db) {
13979
+ function up79(db) {
13920
13980
  db.exec(`
13921
13981
  CREATE TABLE IF NOT EXISTS api_keys (
13922
13982
  id TEXT PRIMARY KEY,
@@ -13944,7 +14004,7 @@ function up78(db) {
13944
14004
  ON api_keys(connector, harness);
13945
14005
  `);
13946
14006
  }
13947
- function up79(db) {
14007
+ function up80(db) {
13948
14008
  db.exec(`
13949
14009
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
13950
14010
  id TEXT PRIMARY KEY,
@@ -13979,7 +14039,7 @@ function hasColumn10(db, table, column) {
13979
14039
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13980
14040
  return rows.some((row) => row.name === column);
13981
14041
  }
13982
- function up80(db) {
14042
+ function up81(db) {
13983
14043
  if (!hasColumn10(db, "documents", "agent_id")) {
13984
14044
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
13985
14045
  }
@@ -14065,7 +14125,7 @@ function up80(db) {
14065
14125
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
14066
14126
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
14067
14127
  }
14068
- function up81(db) {
14128
+ function up82(db) {
14069
14129
  db.exec(`
14070
14130
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14071
14131
  aggregate_memory_id TEXT NOT NULL,
@@ -14087,7 +14147,7 @@ function hasColumn11(db, table, column) {
14087
14147
  return rows.some((row) => row.name === column);
14088
14148
  }
14089
14149
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14090
- function up82(db) {
14150
+ function up83(db) {
14091
14151
  for (const column of COLUMNS) {
14092
14152
  if (!hasColumn11(db, "skill_invocations", column)) {
14093
14153
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14168,7 +14228,7 @@ function documentScopeColumnsPreservingExisting(db) {
14168
14228
  `);
14169
14229
  }
14170
14230
  try {
14171
- up80(db);
14231
+ up81(db);
14172
14232
  if (preserveAgentId) {
14173
14233
  db.exec(`
14174
14234
  UPDATE documents
@@ -14188,12 +14248,12 @@ function documentScopeColumnsPreservingExisting(db) {
14188
14248
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14189
14249
  }
14190
14250
  }
14191
- function up83(db) {
14192
- up79(db);
14251
+ function up84(db) {
14252
+ up80(db);
14193
14253
  if (hasTable3(db, "documents")) {
14194
14254
  documentScopeColumnsPreservingExisting(db);
14195
14255
  }
14196
- up81(db);
14256
+ up82(db);
14197
14257
  addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14198
14258
  addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14199
14259
  addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
@@ -14250,7 +14310,7 @@ function up83(db) {
14250
14310
  AND ${sourceAgentId} = ${targetAgentId}
14251
14311
  `);
14252
14312
  }
14253
- function up84(db) {
14313
+ function up85(db) {
14254
14314
  db.exec(`
14255
14315
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14256
14316
  path TEXT PRIMARY KEY,
@@ -14280,7 +14340,7 @@ function up84(db) {
14280
14340
  ON legacy_markdown_chunks(memory_id);
14281
14341
  `);
14282
14342
  }
14283
- function up85(db) {
14343
+ function up86(db) {
14284
14344
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14285
14345
  const tableNames = new Set(tables.map((r2) => String(r2.name)));
14286
14346
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14339,7 +14399,7 @@ function addColumnIfMissing21(db, table, column, definition) {
14339
14399
  return;
14340
14400
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14341
14401
  }
14342
- function up86(db) {
14402
+ function up87(db) {
14343
14403
  addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
14344
14404
  db.exec(`
14345
14405
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -14352,14 +14412,14 @@ function addColumnIfMissing22(db, table, column, definition) {
14352
14412
  return;
14353
14413
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14354
14414
  }
14355
- function up87(db) {
14415
+ function up88(db) {
14356
14416
  addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
14357
14417
  db.exec(`
14358
14418
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
14359
14419
  ON summary_jobs(agent_id, session_key, boundary_reason)
14360
14420
  `);
14361
14421
  }
14362
- function up88(db) {
14422
+ function up89(db) {
14363
14423
  db.exec(`
14364
14424
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14365
14425
  agent_id TEXT NOT NULL,
@@ -14377,7 +14437,7 @@ function up88(db) {
14377
14437
  ON transcript_capture_jobs(agent_id, session_id, status);
14378
14438
  `);
14379
14439
  }
14380
- function up89(db) {
14440
+ function up90(db) {
14381
14441
  db.exec(`
14382
14442
  CREATE TABLE IF NOT EXISTS job_cancellations (
14383
14443
  id TEXT PRIMARY KEY,
@@ -14405,7 +14465,7 @@ function indexExists(db, table, indexName) {
14405
14465
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14406
14466
  return rows.some((row) => row.name === indexName);
14407
14467
  }
14408
- function up90(db) {
14468
+ function up91(db) {
14409
14469
  db.exec(`
14410
14470
  CREATE TABLE IF NOT EXISTS job_archive (
14411
14471
  id TEXT PRIMARY KEY,
@@ -14432,7 +14492,7 @@ function indexExists2(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 up91(db) {
14495
+ function up92(db) {
14436
14496
  db.exec(`
14437
14497
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14438
14498
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14445,7 +14505,7 @@ function up91(db) {
14445
14505
  )
14446
14506
  `);
14447
14507
  }
14448
- function up92(db) {
14508
+ function up93(db) {
14449
14509
  db.exec(`
14450
14510
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14451
14511
  id TEXT PRIMARY KEY,
@@ -14464,7 +14524,7 @@ function up92(db) {
14464
14524
  ON embeddings_staging(agent_id, source_type, source_id);
14465
14525
  `);
14466
14526
  }
14467
- function up93(db) {
14527
+ function up94(db) {
14468
14528
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14469
14529
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14470
14530
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14475,7 +14535,7 @@ function hasColumn13(db, table, column) {
14475
14535
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14476
14536
  return rows.some((r2) => r2.name === column);
14477
14537
  }
14478
- function up94(db) {
14538
+ function up95(db) {
14479
14539
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14480
14540
  if (tables.length === 0)
14481
14541
  return;
@@ -14500,23 +14560,23 @@ function up94(db) {
14500
14560
  function hasColumn14(db, table, column) {
14501
14561
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14502
14562
  }
14503
- function up95(db) {
14563
+ function up96(db) {
14504
14564
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14505
14565
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14506
14566
  return;
14507
14567
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
14508
14568
  }
14509
- function up96(db) {
14569
+ function up97(db) {
14510
14570
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14511
14571
  }
14512
- function up97(db) {
14572
+ function up98(db) {
14513
14573
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14514
14574
  if (!columns.some((column) => column.name === "last_failure_at")) {
14515
14575
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
14516
14576
  }
14517
14577
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
14518
14578
  }
14519
- function up98(db) {
14579
+ function up99(db) {
14520
14580
  db.exec(`
14521
14581
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14522
14582
  agent_id TEXT NOT NULL,
@@ -14533,7 +14593,7 @@ function up98(db) {
14533
14593
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
14534
14594
  `);
14535
14595
  }
14536
- function up99(db) {
14596
+ function up100(db) {
14537
14597
  db.exec(`
14538
14598
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14539
14599
  id TEXT PRIMARY KEY,
@@ -14553,7 +14613,7 @@ function up99(db) {
14553
14613
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
14554
14614
  `);
14555
14615
  }
14556
- function up100(db) {
14616
+ function up101(db) {
14557
14617
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14558
14618
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14559
14619
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14562,7 +14622,7 @@ function up100(db) {
14562
14622
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
14563
14623
  }
14564
14624
  }
14565
- function up101(db) {
14625
+ function up102(db) {
14566
14626
  db.exec(`
14567
14627
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14568
14628
  id TEXT PRIMARY KEY,
@@ -14584,7 +14644,7 @@ function up101(db) {
14584
14644
  function hasColumn15(db, table, column) {
14585
14645
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14586
14646
  }
14587
- function up102(db) {
14647
+ function up103(db) {
14588
14648
  const requiredMemoryColumns = [
14589
14649
  "content_hash",
14590
14650
  "normalized_content",
@@ -14635,7 +14695,7 @@ function up102(db) {
14635
14695
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
14636
14696
  `);
14637
14697
  }
14638
- function up103(db) {
14698
+ function up104(db) {
14639
14699
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14640
14700
  if (tables.length !== 2)
14641
14701
  return;
@@ -14658,7 +14718,7 @@ function tableExists(db, table) {
14658
14718
  function hasColumn16(db, table, column) {
14659
14719
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14660
14720
  }
14661
- function up104(db) {
14721
+ function up105(db) {
14662
14722
  db.exec(`
14663
14723
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14664
14724
  derived_memory_id TEXT NOT NULL,
@@ -14701,7 +14761,7 @@ function up104(db) {
14701
14761
  `);
14702
14762
  }
14703
14763
  }
14704
- function up105(db) {
14764
+ function up106(db) {
14705
14765
  db.exec(`
14706
14766
  DROP TRIGGER IF EXISTS entities_fts_ai;
14707
14767
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -14790,7 +14850,7 @@ function up105(db) {
14790
14850
  function hasColumn17(db, table, column) {
14791
14851
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14792
14852
  }
14793
- function up106(db) {
14853
+ function up107(db) {
14794
14854
  if (!hasColumn17(db, "memories", "review_after")) {
14795
14855
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
14796
14856
  }
@@ -14806,14 +14866,14 @@ var TOKEN_COLUMNS = [
14806
14866
  ["tokens_cache_write", "INTEGER"],
14807
14867
  ["tokens_cost", "REAL"]
14808
14868
  ];
14809
- function up107(db) {
14869
+ function up108(db) {
14810
14870
  for (const [column, type] of TOKEN_COLUMNS) {
14811
14871
  if (!hasColumn18(db, "dreaming_passes", column)) {
14812
14872
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14813
14873
  }
14814
14874
  }
14815
14875
  }
14816
- function up108(db) {
14876
+ function up109(db) {
14817
14877
  db.exec(`
14818
14878
  CREATE TABLE IF NOT EXISTS embedding_usage (
14819
14879
  day TEXT NOT NULL,
@@ -14826,7 +14886,7 @@ function up108(db) {
14826
14886
  );
14827
14887
  `);
14828
14888
  }
14829
- function up109(db) {
14889
+ function up110(db) {
14830
14890
  db.exec(`
14831
14891
  CREATE TABLE IF NOT EXISTS telemetry_install (
14832
14892
  id TEXT PRIMARY KEY,
@@ -14834,7 +14894,7 @@ function up109(db) {
14834
14894
  );
14835
14895
  `);
14836
14896
  }
14837
- function up110(db) {
14897
+ function up111(db) {
14838
14898
  db.exec(`
14839
14899
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14840
14900
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14845,7 +14905,7 @@ function hasColumn19(db, table, column) {
14845
14905
  return rows.some((row) => row.name === column);
14846
14906
  }
14847
14907
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14848
- function up111(db) {
14908
+ function up112(db) {
14849
14909
  for (const column of COLUMNS2) {
14850
14910
  if (!hasColumn19(db, "telemetry_install", column)) {
14851
14911
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14861,7 +14921,7 @@ function addColumnIfMissing23(db, column, definition) {
14861
14921
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14862
14922
  }
14863
14923
  }
14864
- function up112(db) {
14924
+ function up113(db) {
14865
14925
  addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14866
14926
  addColumnIfMissing23(db, "claim_token", "TEXT");
14867
14927
  addColumnIfMissing23(db, "claimed_at", "TEXT");
@@ -14870,7 +14930,7 @@ function up112(db) {
14870
14930
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14871
14931
  `);
14872
14932
  }
14873
- function up113(db) {
14933
+ function up114(db) {
14874
14934
  db.exec(`
14875
14935
  CREATE TABLE IF NOT EXISTS session_claims (
14876
14936
  session_key TEXT NOT NULL,
@@ -14891,7 +14951,7 @@ function up113(db) {
14891
14951
  ON session_claims(agent_id, state, expires_at);
14892
14952
  `);
14893
14953
  }
14894
- function up114(db) {
14954
+ function up115(db) {
14895
14955
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
14896
14956
  if (table == null)
14897
14957
  return;
@@ -14900,7 +14960,7 @@ function up114(db) {
14900
14960
  ON entity_attributes(memory_id, agent_id, status, importance);
14901
14961
  `);
14902
14962
  }
14903
- function up115(db) {
14963
+ function up116(db) {
14904
14964
  db.exec(`
14905
14965
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
14906
14966
  id TEXT PRIMARY KEY,
@@ -14957,7 +15017,7 @@ function addColumnIfMissing24(db, column, definition) {
14957
15017
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
14958
15018
  }
14959
15019
  }
14960
- function up116(db) {
15020
+ function up117(db) {
14961
15021
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
14962
15022
  if (table == null)
14963
15023
  return;
@@ -15158,7 +15218,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15158
15218
  insert.run(...values);
15159
15219
  }
15160
15220
  }
15161
- function up117(db) {
15221
+ function up118(db) {
15162
15222
  if (!hasTable4(db, "session_transcripts"))
15163
15223
  return;
15164
15224
  addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
@@ -15211,7 +15271,7 @@ function up117(db) {
15211
15271
  ON session_transcripts(agent_id, content_hash);
15212
15272
  `);
15213
15273
  }
15214
- function up118(db) {
15274
+ function up119(db) {
15215
15275
  db.exec(`
15216
15276
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15217
15277
  ON memory_jobs(status)
@@ -15230,12 +15290,12 @@ function up118(db) {
15230
15290
  function hasColumn22(db, table, column) {
15231
15291
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15232
15292
  }
15233
- function up119(db) {
15293
+ function up120(db) {
15234
15294
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15235
15295
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15236
15296
  }
15237
15297
  }
15238
- function up120(db) {
15298
+ function up121(db) {
15239
15299
  db.exec(`
15240
15300
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15241
15301
  agent_id TEXT NOT NULL,
@@ -15264,7 +15324,7 @@ function addColumnIfMissing26(db, column, definition) {
15264
15324
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15265
15325
  }
15266
15326
  }
15267
- function up121(db) {
15327
+ function up122(db) {
15268
15328
  addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15269
15329
  addColumnIfMissing26(db, "last_attempt_at", "TEXT");
15270
15330
  addColumnIfMissing26(db, "sent_at", "TEXT");
@@ -15285,7 +15345,7 @@ function up121(db) {
15285
15345
  VALUES (1, CURRENT_TIMESTAMP);
15286
15346
  `);
15287
15347
  }
15288
- function up122(db) {
15348
+ function up123(db) {
15289
15349
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15290
15350
  const names = new Set(columns.map((column) => column.name));
15291
15351
  if (!names.has("failure_class")) {
@@ -15302,7 +15362,7 @@ function up122(db) {
15302
15362
  }
15303
15363
  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)");
15304
15364
  }
15305
- function up123(db) {
15365
+ function up124(db) {
15306
15366
  db.exec(`
15307
15367
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15308
15368
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15326,7 +15386,7 @@ function up123(db) {
15326
15386
  ON embedding_index_failures(source_type, source_id);
15327
15387
  `);
15328
15388
  }
15329
- function up124(db) {
15389
+ function up125(db) {
15330
15390
  db.exec(`
15331
15391
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15332
15392
  id TEXT PRIMARY KEY,
@@ -15376,7 +15436,7 @@ function backfillTable(db, params) {
15376
15436
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15377
15437
  backfill(db, rows, params.sourceKind, params.scannedAt);
15378
15438
  }
15379
- function up125(db) {
15439
+ function up126(db) {
15380
15440
  db.exec(`
15381
15441
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15382
15442
  agent_id TEXT NOT NULL,
@@ -15433,7 +15493,7 @@ function up125(db) {
15433
15493
  scannedAt
15434
15494
  });
15435
15495
  }
15436
- function up126(db) {
15496
+ function up127(db) {
15437
15497
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15438
15498
  if (!table)
15439
15499
  return;
@@ -15467,7 +15527,7 @@ function up126(db) {
15467
15527
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
15468
15528
  `);
15469
15529
  }
15470
- function up127(db) {
15530
+ function up128(db) {
15471
15531
  db.exec(`
15472
15532
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15473
15533
  id TEXT PRIMARY KEY,
@@ -15523,7 +15583,7 @@ function up127(db) {
15523
15583
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
15524
15584
  `);
15525
15585
  }
15526
- function up128(db) {
15586
+ function up129(db) {
15527
15587
  db.exec(`
15528
15588
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15529
15589
  ON memory_jobs(status, created_at)
@@ -15538,7 +15598,7 @@ function up128(db) {
15538
15598
  function tableExists3(db, table) {
15539
15599
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15540
15600
  }
15541
- function up129(db) {
15601
+ function up130(db) {
15542
15602
  if (!tableExists3(db, "memory_jobs"))
15543
15603
  return;
15544
15604
  if (!tableExists3(db, "job_cancellations")) {
@@ -15587,7 +15647,7 @@ function up129(db) {
15587
15647
  AND status IN ('pending', 'leased');
15588
15648
  `);
15589
15649
  }
15590
- function up130(db) {
15650
+ function up131(db) {
15591
15651
  db.exec(`
15592
15652
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15593
15653
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15627,7 +15687,7 @@ function up130(db) {
15627
15687
  END;
15628
15688
  `);
15629
15689
  }
15630
- function up131(db) {
15690
+ function up132(db) {
15631
15691
  db.exec(`
15632
15692
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15633
15693
  agent_id TEXT NOT NULL,
@@ -15650,13 +15710,13 @@ function up131(db) {
15650
15710
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
15651
15711
  `);
15652
15712
  }
15653
- function up132(db) {
15713
+ function up133(db) {
15654
15714
  db.exec(`
15655
15715
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15656
15716
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
15657
15717
  `);
15658
15718
  }
15659
- function up133(db) {
15719
+ function up134(db) {
15660
15720
  db.exec(`
15661
15721
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15662
15722
  id TEXT PRIMARY KEY,
@@ -15708,7 +15768,7 @@ function up133(db) {
15708
15768
  if (!names.has("format_version"))
15709
15769
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
15710
15770
  }
15711
- function up134(db) {
15771
+ function up135(db) {
15712
15772
  db.exec(`
15713
15773
  CREATE TABLE memory_head_entries_v134 (
15714
15774
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15726,7 +15786,7 @@ function up134(db) {
15726
15786
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
15727
15787
  `);
15728
15788
  }
15729
- function up135(db) {
15789
+ function up136(db) {
15730
15790
  db.exec(`
15731
15791
  CREATE TABLE IF NOT EXISTS memory_head_publications (
15732
15792
  agent_id TEXT NOT NULL,
@@ -15742,7 +15802,7 @@ function up135(db) {
15742
15802
  ON memory_head_publications(agent_id, status, revision DESC);
15743
15803
  `);
15744
15804
  }
15745
- function up136(db) {
15805
+ function up137(db) {
15746
15806
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r2) => r2.name));
15747
15807
  for (const [name, type] of [
15748
15808
  ["entry_id", "TEXT"],
@@ -15756,7 +15816,7 @@ function up136(db) {
15756
15816
  }
15757
15817
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
15758
15818
  }
15759
- function up137(db) {
15819
+ function up138(db) {
15760
15820
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r2) => r2.name));
15761
15821
  for (const [name, type] of [
15762
15822
  ["head_revision", "INTEGER"],
@@ -15778,7 +15838,7 @@ function addColumnIfMissing27(db, table, column, definition) {
15778
15838
  if (!hasColumn25(db, table, column))
15779
15839
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15780
15840
  }
15781
- function up138(db) {
15841
+ function up139(db) {
15782
15842
  addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
15783
15843
  db.exec(`
15784
15844
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16083,7 +16143,7 @@ function up138(db) {
16083
16143
  GROUP BY j.agent_id;
16084
16144
  `);
16085
16145
  }
16086
- function up139(db) {
16146
+ function up140(db) {
16087
16147
  db.exec(`
16088
16148
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16089
16149
  agent_id TEXT NOT NULL,
@@ -16099,7 +16159,7 @@ function up139(db) {
16099
16159
  ON native_source_sync_state(agent_id, status);
16100
16160
  `);
16101
16161
  }
16102
- function up140(db) {
16162
+ function up141(db) {
16103
16163
  db.exec(`
16104
16164
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16105
16165
  agent_id TEXT NOT NULL,
@@ -16111,7 +16171,7 @@ function up140(db) {
16111
16171
  );
16112
16172
  `);
16113
16173
  }
16114
- function up141(db) {
16174
+ function up142(db) {
16115
16175
  db.exec(`
16116
16176
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16117
16177
  agent_id TEXT NOT NULL,
@@ -16125,13 +16185,13 @@ function up141(db) {
16125
16185
  );
16126
16186
  `);
16127
16187
  }
16128
- function up142(db) {
16188
+ function up143(db) {
16129
16189
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16130
16190
  if (!columns.some((column) => column.name === "frontier")) {
16131
16191
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
16132
16192
  }
16133
16193
  }
16134
- function up143(db) {
16194
+ function up144(db) {
16135
16195
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16136
16196
  const additions = [
16137
16197
  ["migration_phase", "TEXT"],
@@ -16166,13 +16226,13 @@ function up143(db) {
16166
16226
  `);
16167
16227
  }
16168
16228
  }
16169
- function up144(db) {
16229
+ function up145(db) {
16170
16230
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16171
16231
  if (!columns.has("lease_token")) {
16172
16232
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
16173
16233
  }
16174
16234
  }
16175
- function up145(db) {
16235
+ function up146(db) {
16176
16236
  db.exec(`
16177
16237
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16178
16238
  agent_id TEXT NOT NULL,
@@ -16190,7 +16250,7 @@ function up145(db) {
16190
16250
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
16191
16251
  `);
16192
16252
  }
16193
- function up146(db) {
16253
+ function up147(db) {
16194
16254
  db.exec(`
16195
16255
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16196
16256
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16245,24 +16305,36 @@ function up146(db) {
16245
16305
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
16246
16306
  `);
16247
16307
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
16248
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
16308
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
16309
+ let exists;
16310
+ try {
16311
+ exists = statement.get(column);
16312
+ } finally {
16313
+ statement.finalize?.();
16314
+ }
16249
16315
  if (exists == null)
16250
16316
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
16251
16317
  }
16252
16318
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
16253
16319
  }
16254
- function up147(db) {
16320
+ function up148(db) {
16255
16321
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16256
16322
  }
16257
- function up148(db) {
16323
+ function up149(db) {
16258
16324
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16259
16325
  if (!columns.some((column) => column.name === "source_id")) {
16260
16326
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
16261
16327
  }
16262
16328
  }
16263
- function up149(db) {
16329
+ function up150(db) {
16264
16330
  const addColumn = (table, column, definition) => {
16265
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
16331
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16332
+ let exists;
16333
+ try {
16334
+ exists = statement.get(table, column);
16335
+ } finally {
16336
+ statement.finalize?.();
16337
+ }
16266
16338
  if (exists == null)
16267
16339
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16268
16340
  };
@@ -16275,7 +16347,7 @@ function addColumnIfMissing28(db, table, column, definition) {
16275
16347
  if (!columns.some((row) => row.name === column))
16276
16348
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16277
16349
  }
16278
- function up150(db) {
16350
+ function up151(db) {
16279
16351
  addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16280
16352
  addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
16281
16353
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -16429,13 +16501,13 @@ var MIGRATIONS = [
16429
16501
  {
16430
16502
  version: 1,
16431
16503
  name: "baseline",
16432
- up,
16504
+ up: up2,
16433
16505
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16434
16506
  },
16435
16507
  {
16436
16508
  version: 2,
16437
16509
  name: "pipeline-v2",
16438
- up: up2,
16510
+ up: up3,
16439
16511
  artifacts: {
16440
16512
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16441
16513
  }
@@ -16443,12 +16515,12 @@ var MIGRATIONS = [
16443
16515
  {
16444
16516
  version: 3,
16445
16517
  name: "unique-content-hash",
16446
- up: up3
16518
+ up: up4
16447
16519
  },
16448
16520
  {
16449
16521
  version: 4,
16450
16522
  name: "history-actor-and-retention",
16451
- up: up4,
16523
+ up: up5,
16452
16524
  artifacts: {
16453
16525
  columns: [{ table: "memory_history", column: "actor_type" }]
16454
16526
  }
@@ -16456,7 +16528,7 @@ var MIGRATIONS = [
16456
16528
  {
16457
16529
  version: 5,
16458
16530
  name: "graph-extended",
16459
- up: up5,
16531
+ up: up6,
16460
16532
  artifacts: {
16461
16533
  columns: [{ table: "entities", column: "canonical_name" }]
16462
16534
  }
@@ -16464,7 +16536,7 @@ var MIGRATIONS = [
16464
16536
  {
16465
16537
  version: 6,
16466
16538
  name: "idempotency-key",
16467
- up: up6,
16539
+ up: up7,
16468
16540
  artifacts: {
16469
16541
  columns: [{ table: "memories", column: "idempotency_key" }]
16470
16542
  }
@@ -16472,42 +16544,42 @@ var MIGRATIONS = [
16472
16544
  {
16473
16545
  version: 7,
16474
16546
  name: "documents-and-connectors",
16475
- up: up7,
16547
+ up: up8,
16476
16548
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16477
16549
  },
16478
16550
  {
16479
16551
  version: 8,
16480
16552
  name: "embeddings-unique-hash",
16481
- up: up8
16553
+ up: up9
16482
16554
  },
16483
16555
  {
16484
16556
  version: 9,
16485
16557
  name: "summary-jobs",
16486
- up: up9,
16558
+ up: up10,
16487
16559
  artifacts: { tables: ["summary_jobs"] }
16488
16560
  },
16489
16561
  {
16490
16562
  version: 10,
16491
16563
  name: "umap-cache",
16492
- up: up10,
16564
+ up: up11,
16493
16565
  artifacts: { tables: ["umap_cache"] }
16494
16566
  },
16495
16567
  {
16496
16568
  version: 11,
16497
16569
  name: "session-scores",
16498
- up: up11,
16570
+ up: up12,
16499
16571
  artifacts: { tables: ["session_scores"] }
16500
16572
  },
16501
16573
  {
16502
16574
  version: 12,
16503
16575
  name: "scheduled-tasks",
16504
- up: up12,
16576
+ up: up13,
16505
16577
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16506
16578
  },
16507
16579
  {
16508
16580
  version: 13,
16509
16581
  name: "ingestion-tracking",
16510
- up: up13,
16582
+ up: up14,
16511
16583
  artifacts: {
16512
16584
  columns: [
16513
16585
  { table: "memories", column: "source_path" },
@@ -16518,13 +16590,13 @@ var MIGRATIONS = [
16518
16590
  {
16519
16591
  version: 14,
16520
16592
  name: "telemetry",
16521
- up: up14,
16593
+ up: up15,
16522
16594
  artifacts: { tables: ["telemetry_events"] }
16523
16595
  },
16524
16596
  {
16525
16597
  version: 15,
16526
16598
  name: "session-memories",
16527
- up: up15,
16599
+ up: up16,
16528
16600
  artifacts: {
16529
16601
  tables: ["session_memories"],
16530
16602
  columns: [
@@ -16536,13 +16608,13 @@ var MIGRATIONS = [
16536
16608
  {
16537
16609
  version: 16,
16538
16610
  name: "session-checkpoints",
16539
- up: up16,
16611
+ up: up17,
16540
16612
  artifacts: { tables: ["session_checkpoints"] }
16541
16613
  },
16542
16614
  {
16543
16615
  version: 17,
16544
16616
  name: "task-skills",
16545
- up: up17,
16617
+ up: up18,
16546
16618
  artifacts: {
16547
16619
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16548
16620
  }
@@ -16550,13 +16622,13 @@ var MIGRATIONS = [
16550
16622
  {
16551
16623
  version: 18,
16552
16624
  name: "skill-meta",
16553
- up: up18,
16625
+ up: up19,
16554
16626
  artifacts: { tables: ["skill_meta"] }
16555
16627
  },
16556
16628
  {
16557
16629
  version: 19,
16558
16630
  name: "knowledge-structure",
16559
- up: up19,
16631
+ up: up20,
16560
16632
  artifacts: {
16561
16633
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16562
16634
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16565,7 +16637,7 @@ var MIGRATIONS = [
16565
16637
  {
16566
16638
  version: 20,
16567
16639
  name: "session-structural-columns",
16568
- up: up20,
16640
+ up: up21,
16569
16641
  artifacts: {
16570
16642
  columns: [
16571
16643
  { table: "session_memories", column: "entity_slot" },
@@ -16578,7 +16650,7 @@ var MIGRATIONS = [
16578
16650
  {
16579
16651
  version: 21,
16580
16652
  name: "checkpoint-structural",
16581
- up: up21,
16653
+ up: up22,
16582
16654
  artifacts: {
16583
16655
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16584
16656
  }
@@ -16586,7 +16658,7 @@ var MIGRATIONS = [
16586
16658
  {
16587
16659
  version: 22,
16588
16660
  name: "entity-pinning",
16589
- up: up22,
16661
+ up: up23,
16590
16662
  artifacts: {
16591
16663
  columns: [
16592
16664
  { table: "entities", column: "pinned" },
@@ -16597,17 +16669,17 @@ var MIGRATIONS = [
16597
16669
  {
16598
16670
  version: 23,
16599
16671
  name: "retired-scorer-gap",
16600
- up: up23
16672
+ up: up24
16601
16673
  },
16602
16674
  {
16603
16675
  version: 24,
16604
16676
  name: "retired-scorer-gap",
16605
- up: up24
16677
+ up: up25
16606
16678
  },
16607
16679
  {
16608
16680
  version: 25,
16609
16681
  name: "agent-feedback",
16610
- up: up25,
16682
+ up: up26,
16611
16683
  artifacts: {
16612
16684
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16613
16685
  }
@@ -16615,32 +16687,32 @@ var MIGRATIONS = [
16615
16687
  {
16616
16688
  version: 26,
16617
16689
  name: "retired-scorer-gap",
16618
- up: up26
16690
+ up: up27
16619
16691
  },
16620
16692
  {
16621
16693
  version: 27,
16622
16694
  name: "backfill-canonical-names",
16623
- up: up27
16695
+ up: up28
16624
16696
  },
16625
16697
  {
16626
16698
  version: 28,
16627
16699
  name: "lossless-retention",
16628
- up: up28
16700
+ up: up29
16629
16701
  },
16630
16702
  {
16631
16703
  version: 29,
16632
16704
  name: "session-summary-dag",
16633
- up: up29
16705
+ up: up30
16634
16706
  },
16635
16707
  {
16636
16708
  version: 30,
16637
16709
  name: "nullable-memory-job-memory-id",
16638
- up: up30
16710
+ up: up31
16639
16711
  },
16640
16712
  {
16641
16713
  version: 31,
16642
16714
  name: "dependency-reason",
16643
- up: up31,
16715
+ up: up32,
16644
16716
  artifacts: {
16645
16717
  columns: [
16646
16718
  { table: "entity_dependencies", column: "reason" },
@@ -16651,7 +16723,7 @@ var MIGRATIONS = [
16651
16723
  {
16652
16724
  version: 32,
16653
16725
  name: "embeddings-vector-column",
16654
- up: up32,
16726
+ up: up33,
16655
16727
  artifacts: {
16656
16728
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16657
16729
  }
@@ -16659,7 +16731,7 @@ var MIGRATIONS = [
16659
16731
  {
16660
16732
  version: 33,
16661
16733
  name: "scope",
16662
- up: up33,
16734
+ up: up34,
16663
16735
  artifacts: {
16664
16736
  columns: [{ table: "memories", column: "scope" }]
16665
16737
  }
@@ -16667,17 +16739,17 @@ var MIGRATIONS = [
16667
16739
  {
16668
16740
  version: 34,
16669
16741
  name: "scope-aware-dedup",
16670
- up: up34
16742
+ up: up35
16671
16743
  },
16672
16744
  {
16673
16745
  version: 35,
16674
16746
  name: "entity-fts",
16675
- up: up35
16747
+ up: up36
16676
16748
  },
16677
16749
  {
16678
16750
  version: 36,
16679
16751
  name: "dependency-confidence",
16680
- up: up36,
16752
+ up: up37,
16681
16753
  artifacts: {
16682
16754
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16683
16755
  }
@@ -16685,7 +16757,7 @@ var MIGRATIONS = [
16685
16757
  {
16686
16758
  version: 37,
16687
16759
  name: "entity-communities",
16688
- up: up37,
16760
+ up: up38,
16689
16761
  artifacts: {
16690
16762
  tables: ["entity_communities"],
16691
16763
  columns: [{ table: "entities", column: "community_id" }]
@@ -16694,24 +16766,24 @@ var MIGRATIONS = [
16694
16766
  {
16695
16767
  version: 38,
16696
16768
  name: "memory-hints",
16697
- up: up38,
16769
+ up: up39,
16698
16770
  artifacts: { tables: ["memory_hints"] }
16699
16771
  },
16700
16772
  {
16701
16773
  version: 39,
16702
16774
  name: "dedup-entity-dependencies",
16703
- up: up39
16775
+ up: up40
16704
16776
  },
16705
16777
  {
16706
16778
  version: 40,
16707
16779
  name: "session-transcripts",
16708
- up: up40,
16780
+ up: up41,
16709
16781
  artifacts: { tables: ["session_transcripts"] }
16710
16782
  },
16711
16783
  {
16712
16784
  version: 41,
16713
16785
  name: "path-feedback",
16714
- up: up41,
16786
+ up: up42,
16715
16787
  artifacts: {
16716
16788
  tables: [
16717
16789
  "path_feedback_events",
@@ -16726,7 +16798,7 @@ var MIGRATIONS = [
16726
16798
  {
16727
16799
  version: 42,
16728
16800
  name: "session-memories-agent-id",
16729
- up: up42,
16801
+ up: up43,
16730
16802
  artifacts: {
16731
16803
  columns: [{ table: "session_memories", column: "agent_id" }]
16732
16804
  }
@@ -16734,7 +16806,7 @@ var MIGRATIONS = [
16734
16806
  {
16735
16807
  version: 43,
16736
16808
  name: "agents-table",
16737
- up: up43,
16809
+ up: up44,
16738
16810
  artifacts: {
16739
16811
  tables: ["agents"],
16740
16812
  columns: [
@@ -16746,7 +16818,7 @@ var MIGRATIONS = [
16746
16818
  {
16747
16819
  version: 44,
16748
16820
  name: "memory-md-temporal-head",
16749
- up: up44,
16821
+ up: up45,
16750
16822
  artifacts: {
16751
16823
  columns: [
16752
16824
  { table: "session_summaries", column: "source_type" },
@@ -16758,7 +16830,7 @@ var MIGRATIONS = [
16758
16830
  {
16759
16831
  version: 45,
16760
16832
  name: "lossless-working-memory-hardening",
16761
- up: up45,
16833
+ up: up46,
16762
16834
  artifacts: {
16763
16835
  tables: ["session_transcripts_fts", "memory_md_heads"],
16764
16836
  columns: [
@@ -16771,17 +16843,17 @@ var MIGRATIONS = [
16771
16843
  {
16772
16844
  version: 46,
16773
16845
  name: "session-summary-uniqueness",
16774
- up: up46
16846
+ up: up47
16775
16847
  },
16776
16848
  {
16777
16849
  version: 47,
16778
16850
  name: "agent-scoped-temporal-uniqueness",
16779
- up: up47
16851
+ up: up48
16780
16852
  },
16781
16853
  {
16782
16854
  version: 48,
16783
16855
  name: "thread-heads",
16784
- up: up48,
16856
+ up: up49,
16785
16857
  artifacts: {
16786
16858
  tables: ["memory_thread_heads"]
16787
16859
  }
@@ -16789,7 +16861,7 @@ var MIGRATIONS = [
16789
16861
  {
16790
16862
  version: 49,
16791
16863
  name: "session-extract-cursors",
16792
- up: up49,
16864
+ up: up50,
16793
16865
  artifacts: {
16794
16866
  tables: ["session_extract_cursors"]
16795
16867
  }
@@ -16797,7 +16869,7 @@ var MIGRATIONS = [
16797
16869
  {
16798
16870
  version: 50,
16799
16871
  name: "related-to-audit",
16800
- up: up50,
16872
+ up: up51,
16801
16873
  artifacts: {
16802
16874
  tables: ["entity_dependency_history"]
16803
16875
  }
@@ -16805,7 +16877,7 @@ var MIGRATIONS = [
16805
16877
  {
16806
16878
  version: 51,
16807
16879
  name: "memory-md-rolling-window-lineage",
16808
- up: up51,
16880
+ up: up52,
16809
16881
  artifacts: {
16810
16882
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16811
16883
  columns: [
@@ -16820,7 +16892,7 @@ var MIGRATIONS = [
16820
16892
  {
16821
16893
  version: 52,
16822
16894
  name: "mcp-invocations",
16823
- up: up52,
16895
+ up: up53,
16824
16896
  artifacts: {
16825
16897
  tables: ["mcp_invocations"]
16826
16898
  }
@@ -16828,7 +16900,7 @@ var MIGRATIONS = [
16828
16900
  {
16829
16901
  version: 53,
16830
16902
  name: "skill-invocations",
16831
- up: up53,
16903
+ up: up54,
16832
16904
  artifacts: {
16833
16905
  tables: ["skill_invocations"]
16834
16906
  }
@@ -16836,7 +16908,7 @@ var MIGRATIONS = [
16836
16908
  {
16837
16909
  version: 54,
16838
16910
  name: "task-agent-scope",
16839
- up: up54,
16911
+ up: up55,
16840
16912
  artifacts: {
16841
16913
  tables: ["task_scope_hints"]
16842
16914
  }
@@ -16844,7 +16916,7 @@ var MIGRATIONS = [
16844
16916
  {
16845
16917
  version: 55,
16846
16918
  name: "dreaming-state",
16847
- up: up55,
16919
+ up: up56,
16848
16920
  artifacts: {
16849
16921
  tables: ["dreaming_state", "dreaming_passes"]
16850
16922
  }
@@ -16852,22 +16924,22 @@ var MIGRATIONS = [
16852
16924
  {
16853
16925
  version: 56,
16854
16926
  name: "agent-scoped-content-hash",
16855
- up: up56
16927
+ up: up57
16856
16928
  },
16857
16929
  {
16858
16930
  version: 57,
16859
16931
  name: "memories-fts-tokenizer-repair",
16860
- up: up57
16932
+ up: up58
16861
16933
  },
16862
16934
  {
16863
16935
  version: 58,
16864
16936
  name: "knowledge-graph-indices",
16865
- up: up58
16937
+ up: up59
16866
16938
  },
16867
16939
  {
16868
16940
  version: 59,
16869
16941
  name: "entity-attribute-claim-key",
16870
- up: up59,
16942
+ up: up60,
16871
16943
  artifacts: {
16872
16944
  columns: [{ table: "entity_attributes", column: "claim_key" }]
16873
16945
  }
@@ -16875,7 +16947,7 @@ var MIGRATIONS = [
16875
16947
  {
16876
16948
  version: 60,
16877
16949
  name: "entity-attribute-group-key",
16878
- up: up60,
16950
+ up: up61,
16879
16951
  artifacts: {
16880
16952
  columns: [{ table: "entity_attributes", column: "group_key" }]
16881
16953
  }
@@ -16883,7 +16955,7 @@ var MIGRATIONS = [
16883
16955
  {
16884
16956
  version: 61,
16885
16957
  name: "memory-artifact-source-mtime",
16886
- up: up61,
16958
+ up: up62,
16887
16959
  artifacts: {
16888
16960
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
16889
16961
  }
@@ -16891,7 +16963,7 @@ var MIGRATIONS = [
16891
16963
  {
16892
16964
  version: 62,
16893
16965
  name: "memory-artifact-soft-delete",
16894
- up: up62,
16966
+ up: up63,
16895
16967
  artifacts: {
16896
16968
  columns: [
16897
16969
  { table: "memory_artifacts", column: "is_deleted" },
@@ -16902,12 +16974,12 @@ var MIGRATIONS = [
16902
16974
  {
16903
16975
  version: 63,
16904
16976
  name: "content-only-memories-fts-update",
16905
- up: up63
16977
+ up: up64
16906
16978
  },
16907
16979
  {
16908
16980
  version: 64,
16909
16981
  name: "source-graph-provenance",
16910
- up: up64,
16982
+ up: up65,
16911
16983
  artifacts: {
16912
16984
  columns: [
16913
16985
  { table: "entities", column: "source_path" },
@@ -16920,7 +16992,7 @@ var MIGRATIONS = [
16920
16992
  {
16921
16993
  version: 65,
16922
16994
  name: "source-embedding-agent-scope",
16923
- up: up65,
16995
+ up: up66,
16924
16996
  artifacts: {
16925
16997
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
16926
16998
  }
@@ -16928,7 +17000,7 @@ var MIGRATIONS = [
16928
17000
  {
16929
17001
  version: 66,
16930
17002
  name: "memory-search-telemetry",
16931
- up: up66,
17003
+ up: up67,
16932
17004
  artifacts: {
16933
17005
  tables: ["memory_search_telemetry"]
16934
17006
  }
@@ -16936,7 +17008,7 @@ var MIGRATIONS = [
16936
17008
  {
16937
17009
  version: 67,
16938
17010
  name: "ontology-proposals",
16939
- up: up67,
17011
+ up: up68,
16940
17012
  artifacts: {
16941
17013
  tables: ["ontology_proposals"],
16942
17014
  columns: [
@@ -16950,7 +17022,7 @@ var MIGRATIONS = [
16950
17022
  {
16951
17023
  version: 68,
16952
17024
  name: "daily-reflections",
16953
- up: up68,
17025
+ up: up69,
16954
17026
  artifacts: {
16955
17027
  tables: ["daily_reflections"]
16956
17028
  }
@@ -16958,7 +17030,7 @@ var MIGRATIONS = [
16958
17030
  {
16959
17031
  version: 69,
16960
17032
  name: "daily-reflections-multiple-insights",
16961
- up: up69,
17033
+ up: up70,
16962
17034
  artifacts: {
16963
17035
  tables: ["daily_reflections"]
16964
17036
  }
@@ -16966,7 +17038,7 @@ var MIGRATIONS = [
16966
17038
  {
16967
17039
  version: 70,
16968
17040
  name: "ontology-control-plane-state",
16969
- up: up70,
17041
+ up: up71,
16970
17042
  artifacts: {
16971
17043
  columns: [
16972
17044
  { table: "entities", column: "status" },
@@ -16981,7 +17053,7 @@ var MIGRATIONS = [
16981
17053
  {
16982
17054
  version: 71,
16983
17055
  name: "epistemic-assertions",
16984
- up: up71,
17056
+ up: up72,
16985
17057
  artifacts: {
16986
17058
  tables: ["epistemic_assertions"]
16987
17059
  }
@@ -16989,7 +17061,7 @@ var MIGRATIONS = [
16989
17061
  {
16990
17062
  version: 72,
16991
17063
  name: "agent-scoped-idempotency-key",
16992
- up: up72,
17064
+ up: up73,
16993
17065
  artifacts: {
16994
17066
  columns: [
16995
17067
  { table: "memories", column: "idempotency_key" },
@@ -17000,7 +17072,7 @@ var MIGRATIONS = [
17000
17072
  {
17001
17073
  version: 73,
17002
17074
  name: "recall-context-dedupe",
17003
- up: up73,
17075
+ up: up74,
17004
17076
  artifacts: {
17005
17077
  tables: ["session_context_epochs", "session_recall_events"]
17006
17078
  }
@@ -17008,7 +17080,7 @@ var MIGRATIONS = [
17008
17080
  {
17009
17081
  version: 74,
17010
17082
  name: "aggregate-memory-links",
17011
- up: up74,
17083
+ up: up75,
17012
17084
  artifacts: {
17013
17085
  tables: ["aggregate_memory_sources"]
17014
17086
  }
@@ -17016,7 +17088,7 @@ var MIGRATIONS = [
17016
17088
  {
17017
17089
  version: 75,
17018
17090
  name: "memory-artifact-source-provenance",
17019
- up: up75,
17091
+ up: up76,
17020
17092
  artifacts: {
17021
17093
  columns: [
17022
17094
  { table: "memory_artifacts", column: "source_id" },
@@ -17030,7 +17102,7 @@ var MIGRATIONS = [
17030
17102
  {
17031
17103
  version: 76,
17032
17104
  name: "temporal-edges",
17033
- up: up76,
17105
+ up: up77,
17034
17106
  artifacts: {
17035
17107
  tables: ["temporal_edges"]
17036
17108
  }
@@ -17038,7 +17110,7 @@ var MIGRATIONS = [
17038
17110
  {
17039
17111
  version: 77,
17040
17112
  name: "entity-aliases",
17041
- up: up77,
17113
+ up: up78,
17042
17114
  artifacts: {
17043
17115
  tables: ["entity_aliases"]
17044
17116
  }
@@ -17046,7 +17118,7 @@ var MIGRATIONS = [
17046
17118
  {
17047
17119
  version: 78,
17048
17120
  name: "api-keys",
17049
- up: up78,
17121
+ up: up79,
17050
17122
  artifacts: {
17051
17123
  tables: ["api_keys"]
17052
17124
  }
@@ -17054,7 +17126,7 @@ var MIGRATIONS = [
17054
17126
  {
17055
17127
  version: 79,
17056
17128
  name: "transcript-capture-jobs",
17057
- up: up79,
17129
+ up: up80,
17058
17130
  artifacts: {
17059
17131
  tables: ["transcript_capture_jobs"]
17060
17132
  }
@@ -17062,7 +17134,7 @@ var MIGRATIONS = [
17062
17134
  {
17063
17135
  version: 80,
17064
17136
  name: "document-scope-columns",
17065
- up: up80,
17137
+ up: up81,
17066
17138
  artifacts: {
17067
17139
  columns: [
17068
17140
  { table: "documents", column: "agent_id" },
@@ -17073,7 +17145,7 @@ var MIGRATIONS = [
17073
17145
  {
17074
17146
  version: 81,
17075
17147
  name: "aggregate-evidence-sources",
17076
- up: up81,
17148
+ up: up82,
17077
17149
  artifacts: {
17078
17150
  tables: ["aggregate_evidence_sources"]
17079
17151
  }
@@ -17081,7 +17153,7 @@ var MIGRATIONS = [
17081
17153
  {
17082
17154
  version: 82,
17083
17155
  name: "skill-invocations-harness",
17084
- up: up82,
17156
+ up: up83,
17085
17157
  artifacts: {
17086
17158
  columns: [
17087
17159
  { table: "skill_invocations", column: "harness" },
@@ -17092,7 +17164,7 @@ var MIGRATIONS = [
17092
17164
  {
17093
17165
  version: 83,
17094
17166
  name: "memory-lifecycle-repair",
17095
- up: up83,
17167
+ up: up84,
17096
17168
  artifacts: {
17097
17169
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17098
17170
  columns: [
@@ -17107,7 +17179,7 @@ var MIGRATIONS = [
17107
17179
  {
17108
17180
  version: 84,
17109
17181
  name: "legacy-markdown-import-state",
17110
- up: up84,
17182
+ up: up85,
17111
17183
  artifacts: {
17112
17184
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17113
17185
  }
@@ -17115,7 +17187,7 @@ var MIGRATIONS = [
17115
17187
  {
17116
17188
  version: 85,
17117
17189
  name: "backfill-relations-to-dependencies",
17118
- up: up85,
17190
+ up: up86,
17119
17191
  artifacts: {
17120
17192
  tables: ["entity_dependencies"]
17121
17193
  }
@@ -17123,7 +17195,7 @@ var MIGRATIONS = [
17123
17195
  {
17124
17196
  version: 86,
17125
17197
  name: "summary-jobs-content-hash",
17126
- up: up86,
17198
+ up: up87,
17127
17199
  artifacts: {
17128
17200
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17129
17201
  }
@@ -17131,7 +17203,7 @@ var MIGRATIONS = [
17131
17203
  {
17132
17204
  version: 87,
17133
17205
  name: "summary-jobs-boundary-reason",
17134
- up: up87,
17206
+ up: up88,
17135
17207
  artifacts: {
17136
17208
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17137
17209
  }
@@ -17139,7 +17211,7 @@ var MIGRATIONS = [
17139
17211
  {
17140
17212
  version: 88,
17141
17213
  name: "transcript-recovery-files",
17142
- up: up88,
17214
+ up: up89,
17143
17215
  artifacts: {
17144
17216
  tables: ["transcript_recovery_files"]
17145
17217
  }
@@ -17147,7 +17219,7 @@ var MIGRATIONS = [
17147
17219
  {
17148
17220
  version: 89,
17149
17221
  name: "job-cancellations",
17150
- up: up89,
17222
+ up: up90,
17151
17223
  artifacts: {
17152
17224
  tables: ["job_cancellations"]
17153
17225
  }
@@ -17155,7 +17227,7 @@ var MIGRATIONS = [
17155
17227
  {
17156
17228
  version: 90,
17157
17229
  name: "job-archive",
17158
- up: up90,
17230
+ up: up91,
17159
17231
  artifacts: {
17160
17232
  tables: ["job_archive"]
17161
17233
  }
@@ -17163,25 +17235,25 @@ var MIGRATIONS = [
17163
17235
  {
17164
17236
  version: 91,
17165
17237
  name: "embedding-index-generations",
17166
- up: up91,
17238
+ up: up92,
17167
17239
  artifacts: { tables: ["embedding_index_state"] }
17168
17240
  },
17169
17241
  {
17170
17242
  version: 92,
17171
17243
  name: "embedding-staging-store",
17172
- up: up92,
17244
+ up: up93,
17173
17245
  artifacts: { tables: ["embeddings_staging"] }
17174
17246
  },
17175
17247
  {
17176
17248
  version: 93,
17177
17249
  name: "dreaming-evidence-cursor",
17178
- up: up93,
17250
+ up: up94,
17179
17251
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17180
17252
  },
17181
17253
  {
17182
17254
  version: 94,
17183
17255
  name: "memory-kind",
17184
- up: up94,
17256
+ up: up95,
17185
17257
  artifacts: {
17186
17258
  columns: [
17187
17259
  { table: "memories", column: "memory_kind" },
@@ -17192,35 +17264,35 @@ var MIGRATIONS = [
17192
17264
  {
17193
17265
  version: 95,
17194
17266
  name: "compaction-recall-projections",
17195
- up: up95
17267
+ up: up96
17196
17268
  },
17197
17269
  {
17198
17270
  version: 96,
17199
17271
  name: "retire-legacy-ingestion",
17200
- up: up96
17272
+ up: up97
17201
17273
  },
17202
17274
  {
17203
17275
  version: 97,
17204
17276
  name: "dreaming-failure-backoff",
17205
- up: up97,
17277
+ up: up98,
17206
17278
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17207
17279
  },
17208
17280
  {
17209
17281
  version: 98,
17210
17282
  name: "dreaming-evidence-exclusions",
17211
- up: up98,
17283
+ up: up99,
17212
17284
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17213
17285
  },
17214
17286
  {
17215
17287
  version: 99,
17216
17288
  name: "dreaming-tool-calls",
17217
- up: up99,
17289
+ up: up100,
17218
17290
  artifacts: { tables: ["dreaming_tool_calls"] }
17219
17291
  },
17220
17292
  {
17221
17293
  version: 100,
17222
17294
  name: "dreaming-runbook",
17223
- up: up100,
17295
+ up: up101,
17224
17296
  artifacts: {
17225
17297
  columns: [
17226
17298
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17231,23 +17303,23 @@ var MIGRATIONS = [
17231
17303
  {
17232
17304
  version: 101,
17233
17305
  name: "dreaming-attention",
17234
- up: up101,
17306
+ up: up102,
17235
17307
  artifacts: { tables: ["dreaming_attention"] }
17236
17308
  },
17237
17309
  {
17238
17310
  version: 102,
17239
17311
  name: "attribute-semantic-memories",
17240
- up: up102
17312
+ up: up103
17241
17313
  },
17242
17314
  {
17243
17315
  version: 103,
17244
17316
  name: "semantic-memory-kind",
17245
- up: up103
17317
+ up: up104
17246
17318
  },
17247
17319
  {
17248
17320
  version: 104,
17249
17321
  name: "derived-memory-provenance",
17250
- up: up104,
17322
+ up: up105,
17251
17323
  artifacts: {
17252
17324
  tables: ["derived_memory_sources"],
17253
17325
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17256,12 +17328,12 @@ var MIGRATIONS = [
17256
17328
  {
17257
17329
  version: 105,
17258
17330
  name: "agent-scoped-entity-name",
17259
- up: up105
17331
+ up: up106
17260
17332
  },
17261
17333
  {
17262
17334
  version: 106,
17263
17335
  name: "memory-review-after",
17264
- up: up106,
17336
+ up: up107,
17265
17337
  artifacts: {
17266
17338
  columns: [{ table: "memories", column: "review_after" }]
17267
17339
  }
@@ -17269,7 +17341,7 @@ var MIGRATIONS = [
17269
17341
  {
17270
17342
  version: 107,
17271
17343
  name: "dreaming-pass-usage",
17272
- up: up107,
17344
+ up: up108,
17273
17345
  artifacts: {
17274
17346
  columns: [
17275
17347
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17283,7 +17355,7 @@ var MIGRATIONS = [
17283
17355
  {
17284
17356
  version: 108,
17285
17357
  name: "embedding-usage",
17286
- up: up108,
17358
+ up: up109,
17287
17359
  artifacts: {
17288
17360
  tables: ["embedding_usage"]
17289
17361
  }
@@ -17291,7 +17363,7 @@ var MIGRATIONS = [
17291
17363
  {
17292
17364
  version: 109,
17293
17365
  name: "telemetry-install",
17294
- up: up109,
17366
+ up: up110,
17295
17367
  artifacts: {
17296
17368
  tables: ["telemetry_install"]
17297
17369
  }
@@ -17299,12 +17371,12 @@ var MIGRATIONS = [
17299
17371
  {
17300
17372
  version: 110,
17301
17373
  name: "memory-mention-join-index",
17302
- up: up110
17374
+ up: up111
17303
17375
  },
17304
17376
  {
17305
17377
  version: 111,
17306
17378
  name: "telemetry-first-use",
17307
- up: up111,
17379
+ up: up112,
17308
17380
  artifacts: {
17309
17381
  columns: [
17310
17382
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17315,7 +17387,7 @@ var MIGRATIONS = [
17315
17387
  {
17316
17388
  version: 112,
17317
17389
  name: "telemetry-queue-ownership",
17318
- up: up112,
17390
+ up: up113,
17319
17391
  artifacts: {
17320
17392
  columns: [
17321
17393
  { table: "telemetry_events", column: "source" },
@@ -17327,7 +17399,7 @@ var MIGRATIONS = [
17327
17399
  {
17328
17400
  version: 113,
17329
17401
  name: "session-claims",
17330
- up: up113,
17402
+ up: up114,
17331
17403
  artifacts: {
17332
17404
  tables: ["session_claims"],
17333
17405
  columns: [
@@ -17341,12 +17413,12 @@ var MIGRATIONS = [
17341
17413
  {
17342
17414
  version: 114,
17343
17415
  name: "memory-traversal-hydration-index",
17344
- up: up114
17416
+ up: up115
17345
17417
  },
17346
17418
  {
17347
17419
  version: 115,
17348
17420
  name: "cross-agent-message-notifications",
17349
- up: up115,
17421
+ up: up116,
17350
17422
  artifacts: {
17351
17423
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17352
17424
  }
@@ -17354,7 +17426,7 @@ var MIGRATIONS = [
17354
17426
  {
17355
17427
  version: 116,
17356
17428
  name: "acp-delivery-reconciliation",
17357
- up: up116,
17429
+ up: up117,
17358
17430
  artifacts: {
17359
17431
  columns: [
17360
17432
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17368,7 +17440,7 @@ var MIGRATIONS = [
17368
17440
  {
17369
17441
  version: 117,
17370
17442
  name: "retire-summary-worker",
17371
- up: up117,
17443
+ up: up118,
17372
17444
  artifacts: {
17373
17445
  columns: [
17374
17446
  { table: "session_transcripts", column: "completed_at" },
@@ -17379,24 +17451,24 @@ var MIGRATIONS = [
17379
17451
  {
17380
17452
  version: 118,
17381
17453
  name: "queue-pressure-indices",
17382
- up: up118
17454
+ up: up119
17383
17455
  },
17384
17456
  {
17385
17457
  version: 119,
17386
17458
  name: "telemetry-version-observation",
17387
- up: up119,
17459
+ up: up120,
17388
17460
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17389
17461
  },
17390
17462
  {
17391
17463
  version: 120,
17392
17464
  name: "source-lifecycle-telemetry",
17393
- up: up120,
17465
+ up: up121,
17394
17466
  artifacts: { tables: ["source_lifecycle_state"] }
17395
17467
  },
17396
17468
  {
17397
17469
  version: 121,
17398
17470
  name: "telemetry-delivery-health",
17399
- up: up121,
17471
+ up: up122,
17400
17472
  artifacts: {
17401
17473
  tables: ["telemetry_delivery_state"],
17402
17474
  columns: [
@@ -17410,7 +17482,7 @@ var MIGRATIONS = [
17410
17482
  {
17411
17483
  version: 122,
17412
17484
  name: "dreaming-evidence-retry",
17413
- up: up122,
17485
+ up: up123,
17414
17486
  artifacts: {
17415
17487
  columns: [
17416
17488
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17423,13 +17495,13 @@ var MIGRATIONS = [
17423
17495
  {
17424
17496
  version: 123,
17425
17497
  name: "embedding-index-failures",
17426
- up: up123,
17498
+ up: up124,
17427
17499
  artifacts: { tables: ["embedding_index_failures"] }
17428
17500
  },
17429
17501
  {
17430
17502
  version: 124,
17431
17503
  name: "import-derived-lifecycle",
17432
- up: up124,
17504
+ up: up125,
17433
17505
  artifacts: {
17434
17506
  tables: ["imported_source_lifecycle"]
17435
17507
  }
@@ -17437,77 +17509,77 @@ var MIGRATIONS = [
17437
17509
  {
17438
17510
  version: 125,
17439
17511
  name: "memory-content-safety",
17440
- up: up125,
17512
+ up: up126,
17441
17513
  artifacts: { tables: ["memory_content_safety"] }
17442
17514
  },
17443
17515
  {
17444
17516
  version: 126,
17445
17517
  name: "dreaming-surprisal-attention",
17446
- up: up126,
17518
+ up: up127,
17447
17519
  artifacts: { tables: ["dreaming_attention"] }
17448
17520
  },
17449
17521
  {
17450
17522
  version: 127,
17451
17523
  name: "ontology-contradictions",
17452
- up: up127,
17524
+ up: up128,
17453
17525
  artifacts: { tables: ["ontology_contradictions"] }
17454
17526
  },
17455
17527
  {
17456
17528
  version: 128,
17457
17529
  name: "bounded-queue-diagnostics",
17458
- up: up128
17530
+ up: up129
17459
17531
  },
17460
17532
  {
17461
17533
  version: 129,
17462
17534
  name: "retire-structural-jobs",
17463
- up: up129
17535
+ up: up130
17464
17536
  },
17465
17537
  {
17466
17538
  version: 130,
17467
17539
  name: "embedding-repair-state",
17468
- up: up130,
17540
+ up: up131,
17469
17541
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17470
17542
  },
17471
17543
  {
17472
17544
  version: 131,
17473
17545
  name: "dreaming-evidence-consumption",
17474
- up: up131,
17546
+ up: up132,
17475
17547
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17476
17548
  },
17477
17549
  {
17478
17550
  version: 132,
17479
17551
  name: "observer-scoped-epistemic-assertions",
17480
- up: up132,
17552
+ up: up133,
17481
17553
  artifacts: { tables: ["epistemic_assertions"] }
17482
17554
  },
17483
17555
  {
17484
17556
  version: 133,
17485
17557
  name: "dreaming-memory-head",
17486
- up: up133,
17558
+ up: up134,
17487
17559
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17488
17560
  },
17489
17561
  {
17490
17562
  version: 134,
17491
17563
  name: "scope-memory-head-entries",
17492
- up: up134,
17564
+ up: up135,
17493
17565
  artifacts: { tables: ["memory_head_entries"] }
17494
17566
  },
17495
17567
  {
17496
17568
  version: 135,
17497
17569
  name: "memory-head-publication",
17498
- up: up135,
17570
+ up: up136,
17499
17571
  artifacts: { tables: ["memory_head_publications"] }
17500
17572
  },
17501
17573
  {
17502
17574
  version: 136,
17503
17575
  name: "memory-head-revisions",
17504
- up: up136,
17576
+ up: up137,
17505
17577
  artifacts: { tables: ["memory_head_revisions"] }
17506
17578
  },
17507
17579
  {
17508
17580
  version: 137,
17509
17581
  name: "dreaming-head-manifest",
17510
- up: up137,
17582
+ up: up138,
17511
17583
  artifacts: {
17512
17584
  columns: [
17513
17585
  { table: "dreaming_passes", column: "head_revision" },
@@ -17518,7 +17590,7 @@ var MIGRATIONS = [
17518
17590
  {
17519
17591
  version: 138,
17520
17592
  name: "bounded-status-projections",
17521
- up: up138,
17593
+ up: up139,
17522
17594
  artifacts: {
17523
17595
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17524
17596
  }
@@ -17526,31 +17598,31 @@ var MIGRATIONS = [
17526
17598
  {
17527
17599
  version: 139,
17528
17600
  name: "native-source-sync-state",
17529
- up: up139,
17601
+ up: up140,
17530
17602
  artifacts: { tables: ["native_source_sync_state"] }
17531
17603
  },
17532
17604
  {
17533
17605
  version: 140,
17534
17606
  name: "transcript-recovery-frontier",
17535
- up: up140,
17607
+ up: up141,
17536
17608
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17537
17609
  },
17538
17610
  {
17539
17611
  version: 141,
17540
17612
  name: "source-sync-checkpoints",
17541
- up: up141,
17613
+ up: up142,
17542
17614
  artifacts: { tables: ["source_sync_checkpoints"] }
17543
17615
  },
17544
17616
  {
17545
17617
  version: 142,
17546
17618
  name: "source-sync-frontier",
17547
- up: up142,
17619
+ up: up143,
17548
17620
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17549
17621
  },
17550
17622
  {
17551
17623
  version: 143,
17552
17624
  name: "embedding-index-progress",
17553
- up: up143,
17625
+ up: up144,
17554
17626
  artifacts: {
17555
17627
  columns: [
17556
17628
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17566,19 +17638,19 @@ var MIGRATIONS = [
17566
17638
  {
17567
17639
  version: 144,
17568
17640
  name: "memory-job-lease-token",
17569
- up: up144,
17641
+ up: up145,
17570
17642
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17571
17643
  },
17572
17644
  {
17573
17645
  version: 145,
17574
17646
  name: "dreaming-evidence-reviews",
17575
- up: up145,
17647
+ up: up146,
17576
17648
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17577
17649
  },
17578
17650
  {
17579
17651
  version: 146,
17580
17652
  name: "source-transcript-import",
17581
- up: up146,
17653
+ up: up147,
17582
17654
  artifacts: {
17583
17655
  tables: [
17584
17656
  "source_import_jobs",
@@ -17597,19 +17669,19 @@ var MIGRATIONS = [
17597
17669
  {
17598
17670
  version: 147,
17599
17671
  name: "source-import-replay-file-slots",
17600
- up: up147,
17672
+ up: up148,
17601
17673
  artifacts: { tables: ["source_import_files"] }
17602
17674
  },
17603
17675
  {
17604
17676
  version: 148,
17605
17677
  name: "source-import-attempt-provenance",
17606
- up: up148,
17678
+ up: up149,
17607
17679
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17608
17680
  },
17609
17681
  {
17610
17682
  version: 149,
17611
17683
  name: "transcript-import-state-machine",
17612
- up: up149,
17684
+ up: up150,
17613
17685
  artifacts: {
17614
17686
  columns: [
17615
17687
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17621,13 +17693,42 @@ var MIGRATIONS = [
17621
17693
  {
17622
17694
  version: 150,
17623
17695
  name: "memory-head-freshness",
17624
- up: up150,
17696
+ up: up151,
17625
17697
  artifacts: {
17626
17698
  columns: [
17627
17699
  { table: "memory_md_heads", column: "is_current" },
17628
17700
  { table: "dreaming_passes", column: "head_base_revision" }
17629
17701
  ]
17630
17702
  }
17703
+ },
17704
+ {
17705
+ version: 151,
17706
+ name: "transcript-import-bytes",
17707
+ up,
17708
+ artifacts: {
17709
+ tables: [
17710
+ "source_import_chunks",
17711
+ "source_import_capacity",
17712
+ "source_import_migrations",
17713
+ "source_import_migration_streams",
17714
+ "source_import_migration_counts"
17715
+ ],
17716
+ columns: [
17717
+ { table: "source_import_files", column: "storage_state" },
17718
+ { table: "source_import_files", column: "upload_generation" },
17719
+ { table: "source_import_files", column: "upload_offset" },
17720
+ { table: "source_import_files", column: "upload_size" },
17721
+ { table: "source_import_files", column: "upload_digest" },
17722
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
17723
+ table: "source_import_files",
17724
+ column
17725
+ })),
17726
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
17727
+ table: "source_import_jobs",
17728
+ column
17729
+ }))
17730
+ ]
17731
+ }
17631
17732
  }
17632
17733
  ];
17633
17734
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -29397,6 +29498,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
29397
29498
  "checkpoint",
29398
29499
  "dreaming"
29399
29500
  ];
29501
+ function up152(db) {
29502
+ const hasColumn26 = (table, column) => {
29503
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
29504
+ try {
29505
+ return statement.get(column) != null;
29506
+ } finally {
29507
+ statement.finalize?.();
29508
+ }
29509
+ };
29510
+ for (const [column, definition] of [
29511
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
29512
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
29513
+ ["upload_size", "INTEGER"],
29514
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
29515
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
29516
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
29517
+ ["original_path", "TEXT"],
29518
+ [
29519
+ "storage_state",
29520
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
29521
+ ]
29522
+ ]) {
29523
+ if (!hasColumn26("source_import_files", column))
29524
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
29525
+ }
29526
+ if (!hasColumn26("source_import_jobs", "retry_count"))
29527
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
29528
+ if (!hasColumn26("source_import_jobs", "cleanup_state"))
29529
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
29530
+ if (!hasColumn26("source_import_jobs", "retry_cursor"))
29531
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
29532
+ if (!hasColumn26("source_import_jobs", "retry_requested"))
29533
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
29534
+ db.exec(`
29535
+ 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);
29536
+ 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;
29537
+ 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;
29538
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
29539
+ 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));
29540
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
29541
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
29542
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
29543
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
29544
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
29545
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
29546
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
29547
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
29548
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
29549
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
29550
+ ) WITHOUT ROWID;
29551
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
29552
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
29553
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
29554
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
29555
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
29556
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
29557
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
29558
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
29559
+ `);
29560
+ }
29400
29561
  var MEMORIES_FTS_TOKENIZER2 = "unicode61";
29401
29562
  var FTS_STATE_TABLE2 = "memories_fts_state";
29402
29563
  function normalizeSql2(sql) {
@@ -29512,7 +29673,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
29512
29673
  return true;
29513
29674
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
29514
29675
  }
29515
- function up151(db) {
29676
+ function up210(db) {
29516
29677
  db.exec(`
29517
29678
  CREATE TABLE IF NOT EXISTS schema_migrations (
29518
29679
  version INTEGER PRIMARY KEY,
@@ -29610,7 +29771,7 @@ function addColumnIfMissing29(db, table, column, definition) {
29610
29771
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29611
29772
  }
29612
29773
  }
29613
- function up210(db) {
29774
+ function up310(db) {
29614
29775
  addColumnIfMissing29(db, "memories", "content_hash", "TEXT");
29615
29776
  addColumnIfMissing29(db, "memories", "normalized_content", "TEXT");
29616
29777
  addColumnIfMissing29(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -29728,7 +29889,7 @@ function addColumnIfMissing210(db, table, column, definition) {
29728
29889
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29729
29890
  return true;
29730
29891
  }
29731
- function up310(db) {
29892
+ function up410(db) {
29732
29893
  addColumnIfMissing210(db, "memories", "why", "TEXT");
29733
29894
  addColumnIfMissing210(db, "memories", "project", "TEXT");
29734
29895
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -29765,7 +29926,7 @@ function addColumnIfMissing32(db, table, column, definition) {
29765
29926
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29766
29927
  }
29767
29928
  }
29768
- function up410(db) {
29929
+ function up510(db) {
29769
29930
  addColumnIfMissing32(db, "memory_history", "actor_type", "TEXT");
29770
29931
  addColumnIfMissing32(db, "memory_history", "session_id", "TEXT");
29771
29932
  addColumnIfMissing32(db, "memory_history", "request_id", "TEXT");
@@ -29798,7 +29959,7 @@ function addColumnIfMissing42(db, table, column, definition) {
29798
29959
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29799
29960
  }
29800
29961
  }
29801
- function up510(db) {
29962
+ function up610(db) {
29802
29963
  addColumnIfMissing42(db, "entities", "canonical_name", "TEXT");
29803
29964
  addColumnIfMissing42(db, "entities", "mentions", "INTEGER DEFAULT 0");
29804
29965
  addColumnIfMissing42(db, "entities", "embedding", "BLOB");
@@ -29815,7 +29976,7 @@ function hasColumn42(db, table, column) {
29815
29976
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
29816
29977
  return rows.some((r3) => r3.name === column);
29817
29978
  }
29818
- function up610(db) {
29979
+ function up710(db) {
29819
29980
  if (!hasColumn42(db, "memories", "idempotency_key")) {
29820
29981
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
29821
29982
  }
@@ -29830,7 +29991,7 @@ function hasColumn52(db, table, column) {
29830
29991
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
29831
29992
  return rows.some((r3) => r3.name === column);
29832
29993
  }
29833
- function up710(db) {
29994
+ function up810(db) {
29834
29995
  db.exec(`
29835
29996
  CREATE TABLE IF NOT EXISTS documents (
29836
29997
  id TEXT PRIMARY KEY,
@@ -29887,7 +30048,7 @@ function up710(db) {
29887
30048
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
29888
30049
  }
29889
30050
  }
29890
- function up810(db) {
30051
+ function up910(db) {
29891
30052
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
29892
30053
  if (tables.length === 0)
29893
30054
  return;
@@ -29904,7 +30065,7 @@ function up810(db) {
29904
30065
  ON embeddings(content_hash)
29905
30066
  `);
29906
30067
  }
29907
- function up910(db) {
30068
+ function up1010(db) {
29908
30069
  db.exec(`
29909
30070
  CREATE TABLE IF NOT EXISTS summary_jobs (
29910
30071
  id TEXT PRIMARY KEY,
@@ -29924,7 +30085,7 @@ function up910(db) {
29924
30085
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
29925
30086
  ON summary_jobs(status)`);
29926
30087
  }
29927
- function up1010(db) {
30088
+ function up1110(db) {
29928
30089
  db.exec(`
29929
30090
  CREATE TABLE IF NOT EXISTS umap_cache (
29930
30091
  id INTEGER PRIMARY KEY,
@@ -29935,7 +30096,7 @@ function up1010(db) {
29935
30096
  )
29936
30097
  `);
29937
30098
  }
29938
- function up1110(db) {
30099
+ function up1210(db) {
29939
30100
  db.exec(`
29940
30101
  CREATE TABLE IF NOT EXISTS session_scores (
29941
30102
  id TEXT PRIMARY KEY,
@@ -29955,7 +30116,7 @@ function up1110(db) {
29955
30116
  ON session_scores(session_key);
29956
30117
  `);
29957
30118
  }
29958
- function up1210(db) {
30119
+ function up1310(db) {
29959
30120
  db.exec(`
29960
30121
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
29961
30122
  id TEXT PRIMARY KEY,
@@ -29996,7 +30157,7 @@ function addColumnIfMissing52(db, table, column, definition) {
29996
30157
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29997
30158
  }
29998
30159
  }
29999
- function up1310(db) {
30160
+ function up1410(db) {
30000
30161
  db.exec(`
30001
30162
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
30002
30163
  id TEXT PRIMARY KEY,
@@ -30022,7 +30183,7 @@ function up1310(db) {
30022
30183
  addColumnIfMissing52(db, "memories", "source_path", "TEXT");
30023
30184
  addColumnIfMissing52(db, "memories", "source_section", "TEXT");
30024
30185
  }
30025
- function up1410(db) {
30186
+ function up153(db) {
30026
30187
  db.exec(`
30027
30188
  CREATE TABLE IF NOT EXISTS telemetry_events (
30028
30189
  id TEXT PRIMARY KEY,
@@ -30047,7 +30208,7 @@ function addColumnIfMissing62(db, table, column, definition) {
30047
30208
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30048
30209
  }
30049
30210
  }
30050
- function up152(db) {
30211
+ function up162(db) {
30051
30212
  db.exec(`
30052
30213
  CREATE TABLE IF NOT EXISTS session_memories (
30053
30214
  id TEXT PRIMARY KEY,
@@ -30074,7 +30235,7 @@ function up152(db) {
30074
30235
  addColumnIfMissing62(db, "session_scores", "confidence", "REAL");
30075
30236
  addColumnIfMissing62(db, "session_scores", "continuity_reasoning", "TEXT");
30076
30237
  }
30077
- function up162(db) {
30238
+ function up172(db) {
30078
30239
  db.exec(`
30079
30240
  CREATE TABLE IF NOT EXISTS session_checkpoints (
30080
30241
  id TEXT PRIMARY KEY,
@@ -30096,7 +30257,7 @@ function up162(db) {
30096
30257
  ON session_checkpoints(project_normalized, created_at DESC);
30097
30258
  `);
30098
30259
  }
30099
- function up172(db) {
30260
+ function up182(db) {
30100
30261
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
30101
30262
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
30102
30263
  if (!colNames.has("skill_name")) {
@@ -30107,7 +30268,7 @@ function up172(db) {
30107
30268
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
30108
30269
  }
30109
30270
  }
30110
- function up182(db) {
30271
+ function up192(db) {
30111
30272
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
30112
30273
  if (existing)
30113
30274
  return;
@@ -30139,7 +30300,7 @@ function up182(db) {
30139
30300
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
30140
30301
  `);
30141
30302
  }
30142
- function up192(db) {
30303
+ function up202(db) {
30143
30304
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
30144
30305
  const entityColNames = new Set(entityCols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
30145
30306
  if (!entityColNames.has("agent_id")) {
@@ -30224,13 +30385,13 @@ function addColumnIfMissing72(db, table, column, definition) {
30224
30385
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30225
30386
  }
30226
30387
  }
30227
- function up202(db) {
30388
+ function up212(db) {
30228
30389
  addColumnIfMissing72(db, "session_memories", "entity_slot", "INTEGER");
30229
30390
  addColumnIfMissing72(db, "session_memories", "aspect_slot", "INTEGER");
30230
30391
  addColumnIfMissing72(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
30231
30392
  addColumnIfMissing72(db, "session_memories", "structural_density", "INTEGER");
30232
30393
  }
30233
- function up212(db) {
30394
+ function up222(db) {
30234
30395
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
30235
30396
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
30236
30397
  if (!columnNames.has("focal_entity_ids")) {
@@ -30255,25 +30416,25 @@ function addColumnIfMissing82(db, table, column, definition) {
30255
30416
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30256
30417
  }
30257
30418
  }
30258
- function up222(db) {
30419
+ function up232(db) {
30259
30420
  addColumnIfMissing82(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
30260
30421
  addColumnIfMissing82(db, "entities", "pinned_at", "TEXT");
30261
30422
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
30262
30423
  }
30263
- function up232(_db) {}
30264
30424
  function up242(_db) {}
30425
+ function up252(_db) {}
30265
30426
  function addColumnIfMissing92(db, table, column, definition) {
30266
30427
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
30267
30428
  if (!cols.some((c3) => c3.name === column)) {
30268
30429
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30269
30430
  }
30270
30431
  }
30271
- function up252(db) {
30432
+ function up262(db) {
30272
30433
  addColumnIfMissing92(db, "session_memories", "agent_relevance_score", "REAL");
30273
30434
  addColumnIfMissing92(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
30274
30435
  }
30275
- function up262(_db) {}
30276
- function up272(db) {
30436
+ function up272(_db) {}
30437
+ function up282(db) {
30277
30438
  db.exec(`
30278
30439
  UPDATE entities
30279
30440
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -30282,7 +30443,7 @@ function up272(db) {
30282
30443
  WHERE canonical_name IS NULL
30283
30444
  `);
30284
30445
  }
30285
- function up282(db) {
30446
+ function up292(db) {
30286
30447
  db.exec(`
30287
30448
  CREATE TABLE IF NOT EXISTS memories_cold (
30288
30449
  archive_id TEXT PRIMARY KEY,
@@ -30319,7 +30480,7 @@ function up282(db) {
30319
30480
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
30320
30481
  `);
30321
30482
  }
30322
- function up292(db) {
30483
+ function up302(db) {
30323
30484
  db.exec(`
30324
30485
  CREATE TABLE IF NOT EXISTS session_summaries (
30325
30486
  id TEXT PRIMARY KEY,
@@ -30364,7 +30525,7 @@ function up292(db) {
30364
30525
  WHERE session_key IS NOT NULL;
30365
30526
  `);
30366
30527
  }
30367
- function up302(db) {
30528
+ function up312(db) {
30368
30529
  db.exec(`
30369
30530
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
30370
30531
  id TEXT PRIMARY KEY,
@@ -30409,7 +30570,7 @@ function up302(db) {
30409
30570
  ON memory_jobs(failed_at);
30410
30571
  `);
30411
30572
  }
30412
- function up312(db) {
30573
+ function up322(db) {
30413
30574
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30414
30575
  if (!depCols.some((c3) => c3.name === "reason")) {
30415
30576
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -30419,7 +30580,7 @@ function up312(db) {
30419
30580
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
30420
30581
  }
30421
30582
  }
30422
- function up322(db) {
30583
+ function up332(db) {
30423
30584
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
30424
30585
  if (cols.length === 0)
30425
30586
  return;
@@ -30427,14 +30588,14 @@ function up322(db) {
30427
30588
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
30428
30589
  }
30429
30590
  }
30430
- function up332(db) {
30591
+ function up342(db) {
30431
30592
  const cols = db.prepare("PRAGMA table_info(memories)").all();
30432
30593
  if (!cols.some((c3) => c3.name === "scope")) {
30433
30594
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
30434
30595
  }
30435
30596
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
30436
30597
  }
30437
- function up342(db) {
30598
+ function up352(db) {
30438
30599
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
30439
30600
  db.exec(`
30440
30601
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -30442,7 +30603,7 @@ function up342(db) {
30442
30603
  WHERE content_hash IS NOT NULL AND is_deleted = 0
30443
30604
  `);
30444
30605
  }
30445
- function up352(db) {
30606
+ function up362(db) {
30446
30607
  db.exec(`
30447
30608
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
30448
30609
  name, canonical_name,
@@ -30474,13 +30635,13 @@ function up352(db) {
30474
30635
  END
30475
30636
  `);
30476
30637
  }
30477
- function up362(db) {
30638
+ function up372(db) {
30478
30639
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30479
30640
  if (!cols.some((c3) => c3.name === "confidence")) {
30480
30641
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
30481
30642
  }
30482
30643
  }
30483
- function up372(db) {
30644
+ function up382(db) {
30484
30645
  db.exec(`
30485
30646
  CREATE TABLE IF NOT EXISTS entity_communities (
30486
30647
  id TEXT PRIMARY KEY,
@@ -30498,7 +30659,7 @@ function up372(db) {
30498
30659
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
30499
30660
  }
30500
30661
  }
30501
- function up382(db) {
30662
+ function up392(db) {
30502
30663
  db.exec(`
30503
30664
  CREATE TABLE IF NOT EXISTS memory_hints (
30504
30665
  id TEXT PRIMARY KEY,
@@ -30538,7 +30699,7 @@ function up382(db) {
30538
30699
  END
30539
30700
  `);
30540
30701
  }
30541
- function up392(db) {
30702
+ function up402(db) {
30542
30703
  db.exec(`
30543
30704
  DELETE FROM entity_dependencies
30544
30705
  WHERE id NOT IN (
@@ -30556,7 +30717,7 @@ function up392(db) {
30556
30717
  )
30557
30718
  `);
30558
30719
  }
30559
- function up402(db) {
30720
+ function up412(db) {
30560
30721
  db.exec(`
30561
30722
  CREATE TABLE IF NOT EXISTS session_transcripts (
30562
30723
  session_key TEXT PRIMARY KEY,
@@ -30579,7 +30740,7 @@ function addColumnIfMissing102(db, table, column, definition) {
30579
30740
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30580
30741
  }
30581
30742
  }
30582
- function up412(db) {
30743
+ function up422(db) {
30583
30744
  addColumnIfMissing102(db, "session_memories", "path_json", "TEXT");
30584
30745
  db.exec(`
30585
30746
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -30654,7 +30815,7 @@ function addColumnIfMissing112(db, table, column, definition) {
30654
30815
  return;
30655
30816
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30656
30817
  }
30657
- function up422(db) {
30818
+ function up432(db) {
30658
30819
  addColumnIfMissing112(db, "session_memories", "entity_slot", "INTEGER");
30659
30820
  addColumnIfMissing112(db, "session_memories", "aspect_slot", "INTEGER");
30660
30821
  addColumnIfMissing112(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -30742,7 +30903,7 @@ function addColumnIfMissing122(db, table, column, definition) {
30742
30903
  return;
30743
30904
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30744
30905
  }
30745
- function up432(db) {
30906
+ function up442(db) {
30746
30907
  db.exec(`
30747
30908
  CREATE TABLE IF NOT EXISTS agents (
30748
30909
  id TEXT PRIMARY KEY,
@@ -30771,7 +30932,7 @@ function addColumnIfMissing132(db, table, column, definition) {
30771
30932
  return;
30772
30933
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30773
30934
  }
30774
- function up442(db) {
30935
+ function up452(db) {
30775
30936
  addColumnIfMissing132(db, "session_summaries", "source_type", "TEXT");
30776
30937
  addColumnIfMissing132(db, "session_summaries", "source_ref", "TEXT");
30777
30938
  addColumnIfMissing132(db, "session_summaries", "meta_json", "TEXT");
@@ -30797,7 +30958,7 @@ function addColumnIfMissing142(db, table, column, definition) {
30797
30958
  return;
30798
30959
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30799
30960
  }
30800
- function up452(db) {
30961
+ function up462(db) {
30801
30962
  addColumnIfMissing142(db, "session_transcripts", "updated_at", "TEXT");
30802
30963
  addColumnIfMissing142(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
30803
30964
  addColumnIfMissing142(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -30868,7 +31029,7 @@ function up452(db) {
30868
31029
  ON memory_md_heads(lease_expires_at);
30869
31030
  `);
30870
31031
  }
30871
- function up462(db) {
31032
+ function up472(db) {
30872
31033
  db.exec(`
30873
31034
  DROP INDEX IF EXISTS idx_summaries_session_depth;
30874
31035
 
@@ -30929,7 +31090,7 @@ function up462(db) {
30929
31090
  AND COALESCE(source_type, 'summary') = 'summary';
30930
31091
  `);
30931
31092
  }
30932
- function up472(db) {
31093
+ function up482(db) {
30933
31094
  db.exec(`
30934
31095
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
30935
31096
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -31027,7 +31188,7 @@ function up472(db) {
31027
31188
  AND COALESCE(source_type, 'summary') = 'summary';
31028
31189
  `);
31029
31190
  }
31030
- function up482(db) {
31191
+ function up492(db) {
31031
31192
  db.exec(`
31032
31193
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
31033
31194
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -31145,7 +31306,7 @@ function up482(db) {
31145
31306
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
31146
31307
  `);
31147
31308
  }
31148
- function up492(db) {
31309
+ function up502(db) {
31149
31310
  db.exec(`
31150
31311
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
31151
31312
  session_key TEXT NOT NULL,
@@ -31162,7 +31323,7 @@ function hasTable5(db, name) {
31162
31323
  WHERE type = 'table' AND name = ?
31163
31324
  LIMIT 1`).get(name) !== undefined;
31164
31325
  }
31165
- function up502(db) {
31326
+ function up512(db) {
31166
31327
  db.exec(`
31167
31328
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
31168
31329
  id TEXT PRIMARY KEY,
@@ -31332,7 +31493,7 @@ function addColumnIfMissing152(db, table, column, definition) {
31332
31493
  return;
31333
31494
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31334
31495
  }
31335
- function up512(db) {
31496
+ function up522(db) {
31336
31497
  addColumnIfMissing152(db, "summary_jobs", "session_id", "TEXT");
31337
31498
  addColumnIfMissing152(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
31338
31499
  addColumnIfMissing152(db, "summary_jobs", "captured_at", "TEXT");
@@ -31424,7 +31585,7 @@ function up512(db) {
31424
31585
  VALUES ('rebuild');
31425
31586
  `);
31426
31587
  }
31427
- function up522(db) {
31588
+ function up532(db) {
31428
31589
  db.exec(`
31429
31590
  CREATE TABLE IF NOT EXISTS mcp_invocations (
31430
31591
  id TEXT PRIMARY KEY,
@@ -31441,7 +31602,7 @@ function up522(db) {
31441
31602
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
31442
31603
  `);
31443
31604
  }
31444
- function up532(db) {
31605
+ function up542(db) {
31445
31606
  db.exec(`
31446
31607
  CREATE TABLE IF NOT EXISTS skill_invocations (
31447
31608
  id TEXT PRIMARY KEY,
@@ -31457,7 +31618,7 @@ function up532(db) {
31457
31618
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
31458
31619
  `);
31459
31620
  }
31460
- function up542(db) {
31621
+ function up552(db) {
31461
31622
  db.exec(`
31462
31623
  CREATE TABLE IF NOT EXISTS task_scope_hints (
31463
31624
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -31488,7 +31649,7 @@ function up542(db) {
31488
31649
  ON task_scope_hints(agent_id, updated_at);
31489
31650
  `);
31490
31651
  }
31491
- function up552(db) {
31652
+ function up562(db) {
31492
31653
  db.exec(`
31493
31654
  CREATE TABLE IF NOT EXISTS dreaming_state (
31494
31655
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -31531,7 +31692,7 @@ function ensureMemoriesScopeColumns3(db) {
31531
31692
  if (!names.has("scope"))
31532
31693
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
31533
31694
  }
31534
- function up562(db) {
31695
+ function up572(db) {
31535
31696
  ensureMemoriesScopeColumns3(db);
31536
31697
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
31537
31698
  db.exec(`
@@ -31544,20 +31705,20 @@ function up562(db) {
31544
31705
  WHERE content_hash IS NOT NULL AND is_deleted = 0
31545
31706
  `);
31546
31707
  }
31547
- function up572(db) {
31708
+ function up582(db) {
31548
31709
  const sql = readMemoriesFtsSql2(db);
31549
31710
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
31550
31711
  return;
31551
31712
  recreateMemoriesFts2(db);
31552
31713
  }
31553
- function up582(db) {
31714
+ function up592(db) {
31554
31715
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
31555
31716
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
31556
31717
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
31557
31718
  ON entities(entity_type, mentions)
31558
31719
  WHERE entity_type = 'extracted'`);
31559
31720
  }
31560
- function up592(db) {
31721
+ function up602(db) {
31561
31722
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31562
31723
  if (!cols.some((col) => col.name === "claim_key")) {
31563
31724
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -31566,7 +31727,7 @@ function up592(db) {
31566
31727
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
31567
31728
  WHERE claim_key IS NOT NULL`);
31568
31729
  }
31569
- function up602(db) {
31730
+ function up612(db) {
31570
31731
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31571
31732
  if (!cols.some((col) => col.name === "group_key")) {
31572
31733
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -31578,13 +31739,13 @@ function up602(db) {
31578
31739
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
31579
31740
  WHERE claim_key IS NOT NULL`);
31580
31741
  }
31581
- function up612(db) {
31742
+ function up622(db) {
31582
31743
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31583
31744
  if (cols.some((col) => col.name === "source_mtime_ms"))
31584
31745
  return;
31585
31746
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
31586
31747
  }
31587
- function up622(db) {
31748
+ function up632(db) {
31588
31749
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31589
31750
  const names = new Set(cols.map((col) => col.name));
31590
31751
  if (!names.has("is_deleted")) {
@@ -31598,7 +31759,7 @@ function up622(db) {
31598
31759
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
31599
31760
  `);
31600
31761
  }
31601
- function up632(db) {
31762
+ function up642(db) {
31602
31763
  db.exec("DROP TRIGGER IF EXISTS memories_au");
31603
31764
  db.exec(`
31604
31765
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -31616,7 +31777,7 @@ function addColumnIfMissing162(db, table, column, definition) {
31616
31777
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31617
31778
  }
31618
31779
  }
31619
- function up642(db) {
31780
+ function up652(db) {
31620
31781
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
31621
31782
  addColumnIfMissing162(db, table, "source_id", "TEXT");
31622
31783
  addColumnIfMissing162(db, table, "source_kind", "TEXT");
@@ -31636,7 +31797,7 @@ function hasColumn72(db, table, column) {
31636
31797
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31637
31798
  return rows.some((row) => row.name === column);
31638
31799
  }
31639
- function up652(db) {
31800
+ function up662(db) {
31640
31801
  if (!hasTable22(db, "embeddings"))
31641
31802
  return;
31642
31803
  if (!hasColumn72(db, "embeddings", "agent_id")) {
@@ -31644,7 +31805,7 @@ function up652(db) {
31644
31805
  }
31645
31806
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
31646
31807
  }
31647
- function up662(db) {
31808
+ function up672(db) {
31648
31809
  db.exec(`
31649
31810
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
31650
31811
  id TEXT PRIMARY KEY,
@@ -31685,7 +31846,7 @@ function addColumnIfMissing172(db, table, column, definition) {
31685
31846
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31686
31847
  }
31687
31848
  }
31688
- function up672(db) {
31849
+ function up682(db) {
31689
31850
  db.exec(`
31690
31851
  CREATE TABLE IF NOT EXISTS ontology_proposals (
31691
31852
  id TEXT PRIMARY KEY,
@@ -31728,7 +31889,7 @@ function up672(db) {
31728
31889
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
31729
31890
  }
31730
31891
  }
31731
- function up682(db) {
31892
+ function up692(db) {
31732
31893
  db.exec(`
31733
31894
  CREATE TABLE IF NOT EXISTS daily_reflections (
31734
31895
  id TEXT PRIMARY KEY,
@@ -31755,7 +31916,7 @@ function up682(db) {
31755
31916
  WHERE content_key IS NOT NULL;
31756
31917
  `);
31757
31918
  }
31758
- function up692(db) {
31919
+ function up702(db) {
31759
31920
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
31760
31921
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
31761
31922
  if (!colNames.has("content_key")) {
@@ -31792,7 +31953,7 @@ function backfillVersionRoots2(db) {
31792
31953
  WHERE version_root_id IS NULL
31793
31954
  `);
31794
31955
  }
31795
- function up702(db) {
31956
+ function up712(db) {
31796
31957
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
31797
31958
  addColumnIfMissing182(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
31798
31959
  addColumnIfMissing182(db, table, "archived_at", "TEXT");
@@ -31827,7 +31988,7 @@ function up702(db) {
31827
31988
  ON entity_aspects(agent_id, proposal_id);
31828
31989
  `);
31829
31990
  }
31830
- function up712(db) {
31991
+ function up722(db) {
31831
31992
  db.exec(`
31832
31993
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
31833
31994
  id TEXT PRIMARY KEY,
@@ -31883,7 +32044,7 @@ function ensureMemoriesScopeColumns22(db) {
31883
32044
  if (!names.has("runtime_path"))
31884
32045
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
31885
32046
  }
31886
- function up722(db) {
32047
+ function up732(db) {
31887
32048
  ensureMemoriesScopeColumns22(db);
31888
32049
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
31889
32050
  db.exec(`
@@ -31897,7 +32058,7 @@ function up722(db) {
31897
32058
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
31898
32059
  `);
31899
32060
  }
31900
- function up732(db) {
32061
+ function up742(db) {
31901
32062
  db.exec(`
31902
32063
  CREATE TABLE IF NOT EXISTS session_context_epochs (
31903
32064
  session_key TEXT NOT NULL,
@@ -31932,7 +32093,7 @@ function up732(db) {
31932
32093
  ON session_recall_events(item_kind, item_id, created_at DESC);
31933
32094
  `);
31934
32095
  }
31935
- function up742(db) {
32096
+ function up752(db) {
31936
32097
  db.exec(`
31937
32098
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
31938
32099
  aggregate_memory_id TEXT NOT NULL,
@@ -31951,7 +32112,7 @@ function addColumnIfMissing192(db, table, column, definition) {
31951
32112
  return;
31952
32113
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31953
32114
  }
31954
- function up752(db) {
32115
+ function up762(db) {
31955
32116
  addColumnIfMissing192(db, "memory_artifacts", "source_id", "TEXT");
31956
32117
  addColumnIfMissing192(db, "memory_artifacts", "source_root", "TEXT");
31957
32118
  addColumnIfMissing192(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -31964,7 +32125,7 @@ function up752(db) {
31964
32125
  ON memory_artifacts(agent_id, source_id, source_root);
31965
32126
  `);
31966
32127
  }
31967
- function up762(db) {
32128
+ function up772(db) {
31968
32129
  db.exec(`
31969
32130
  CREATE TABLE IF NOT EXISTS temporal_edges (
31970
32131
  id TEXT PRIMARY KEY,
@@ -31987,7 +32148,7 @@ function up762(db) {
31987
32148
  ON temporal_edges(agent_id, subject_type, subject_id);
31988
32149
  `);
31989
32150
  }
31990
- function up772(db) {
32151
+ function up782(db) {
31991
32152
  db.exec(`
31992
32153
  CREATE TABLE IF NOT EXISTS entity_aliases (
31993
32154
  id TEXT PRIMARY KEY,
@@ -32011,7 +32172,7 @@ function up772(db) {
32011
32172
  ON entity_aliases(agent_id, canonical_alias, status);
32012
32173
  `);
32013
32174
  }
32014
- function up782(db) {
32175
+ function up792(db) {
32015
32176
  db.exec(`
32016
32177
  CREATE TABLE IF NOT EXISTS api_keys (
32017
32178
  id TEXT PRIMARY KEY,
@@ -32039,7 +32200,7 @@ function up782(db) {
32039
32200
  ON api_keys(connector, harness);
32040
32201
  `);
32041
32202
  }
32042
- function up792(db) {
32203
+ function up802(db) {
32043
32204
  db.exec(`
32044
32205
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
32045
32206
  id TEXT PRIMARY KEY,
@@ -32074,7 +32235,7 @@ function hasColumn102(db, table, column) {
32074
32235
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32075
32236
  return rows.some((row) => row.name === column);
32076
32237
  }
32077
- function up802(db) {
32238
+ function up812(db) {
32078
32239
  if (!hasColumn102(db, "documents", "agent_id")) {
32079
32240
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
32080
32241
  }
@@ -32160,7 +32321,7 @@ function up802(db) {
32160
32321
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
32161
32322
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
32162
32323
  }
32163
- function up812(db) {
32324
+ function up822(db) {
32164
32325
  db.exec(`
32165
32326
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
32166
32327
  aggregate_memory_id TEXT NOT NULL,
@@ -32182,7 +32343,7 @@ function hasColumn112(db, table, column) {
32182
32343
  return rows.some((row) => row.name === column);
32183
32344
  }
32184
32345
  var COLUMNS3 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
32185
- function up822(db) {
32346
+ function up832(db) {
32186
32347
  for (const column of COLUMNS3) {
32187
32348
  if (!hasColumn112(db, "skill_invocations", column)) {
32188
32349
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -32263,7 +32424,7 @@ function documentScopeColumnsPreservingExisting2(db) {
32263
32424
  `);
32264
32425
  }
32265
32426
  try {
32266
- up802(db);
32427
+ up812(db);
32267
32428
  if (preserveAgentId) {
32268
32429
  db.exec(`
32269
32430
  UPDATE documents
@@ -32283,12 +32444,12 @@ function documentScopeColumnsPreservingExisting2(db) {
32283
32444
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
32284
32445
  }
32285
32446
  }
32286
- function up832(db) {
32287
- up792(db);
32447
+ function up842(db) {
32448
+ up802(db);
32288
32449
  if (hasTable32(db, "documents")) {
32289
32450
  documentScopeColumnsPreservingExisting2(db);
32290
32451
  }
32291
- up812(db);
32452
+ up822(db);
32292
32453
  addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
32293
32454
  addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
32294
32455
  addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
@@ -32345,7 +32506,7 @@ function up832(db) {
32345
32506
  AND ${sourceAgentId} = ${targetAgentId}
32346
32507
  `);
32347
32508
  }
32348
- function up842(db) {
32509
+ function up852(db) {
32349
32510
  db.exec(`
32350
32511
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
32351
32512
  path TEXT PRIMARY KEY,
@@ -32375,7 +32536,7 @@ function up842(db) {
32375
32536
  ON legacy_markdown_chunks(memory_id);
32376
32537
  `);
32377
32538
  }
32378
- function up852(db) {
32539
+ function up862(db) {
32379
32540
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
32380
32541
  const tableNames = new Set(tables.map((r3) => String(r3.name)));
32381
32542
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -32434,7 +32595,7 @@ function addColumnIfMissing212(db, table, column, definition) {
32434
32595
  return;
32435
32596
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32436
32597
  }
32437
- function up862(db) {
32598
+ function up872(db) {
32438
32599
  addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
32439
32600
  db.exec(`
32440
32601
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -32447,14 +32608,14 @@ function addColumnIfMissing222(db, table, column, definition) {
32447
32608
  return;
32448
32609
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32449
32610
  }
32450
- function up872(db) {
32611
+ function up882(db) {
32451
32612
  addColumnIfMissing222(db, "summary_jobs", "boundary_reason", "TEXT");
32452
32613
  db.exec(`
32453
32614
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
32454
32615
  ON summary_jobs(agent_id, session_key, boundary_reason)
32455
32616
  `);
32456
32617
  }
32457
- function up882(db) {
32618
+ function up892(db) {
32458
32619
  db.exec(`
32459
32620
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
32460
32621
  agent_id TEXT NOT NULL,
@@ -32472,7 +32633,7 @@ function up882(db) {
32472
32633
  ON transcript_capture_jobs(agent_id, session_id, status);
32473
32634
  `);
32474
32635
  }
32475
- function up892(db) {
32636
+ function up902(db) {
32476
32637
  db.exec(`
32477
32638
  CREATE TABLE IF NOT EXISTS job_cancellations (
32478
32639
  id TEXT PRIMARY KEY,
@@ -32500,7 +32661,7 @@ function indexExists3(db, table, indexName) {
32500
32661
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32501
32662
  return rows.some((row) => row.name === indexName);
32502
32663
  }
32503
- function up902(db) {
32664
+ function up912(db) {
32504
32665
  db.exec(`
32505
32666
  CREATE TABLE IF NOT EXISTS job_archive (
32506
32667
  id TEXT PRIMARY KEY,
@@ -32527,7 +32688,7 @@ function indexExists22(db, table, indexName) {
32527
32688
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32528
32689
  return rows.some((row) => row.name === indexName);
32529
32690
  }
32530
- function up912(db) {
32691
+ function up922(db) {
32531
32692
  db.exec(`
32532
32693
  CREATE TABLE IF NOT EXISTS embedding_index_state (
32533
32694
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -32540,7 +32701,7 @@ function up912(db) {
32540
32701
  )
32541
32702
  `);
32542
32703
  }
32543
- function up922(db) {
32704
+ function up932(db) {
32544
32705
  db.exec(`
32545
32706
  CREATE TABLE IF NOT EXISTS embeddings_staging (
32546
32707
  id TEXT PRIMARY KEY,
@@ -32559,7 +32720,7 @@ function up922(db) {
32559
32720
  ON embeddings_staging(agent_id, source_type, source_id);
32560
32721
  `);
32561
32722
  }
32562
- function up932(db) {
32723
+ function up942(db) {
32563
32724
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32564
32725
  if (!columns.some((column) => column.name === "evidence_cursor")) {
32565
32726
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -32570,7 +32731,7 @@ function hasColumn132(db, table, column) {
32570
32731
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32571
32732
  return rows.some((r3) => r3.name === column);
32572
32733
  }
32573
- function up942(db) {
32734
+ function up952(db) {
32574
32735
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
32575
32736
  if (tables.length === 0)
32576
32737
  return;
@@ -32595,23 +32756,23 @@ function up942(db) {
32595
32756
  function hasColumn142(db, table, column) {
32596
32757
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32597
32758
  }
32598
- function up952(db) {
32759
+ function up962(db) {
32599
32760
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
32600
32761
  if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
32601
32762
  return;
32602
32763
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
32603
32764
  }
32604
- function up962(db) {
32765
+ function up972(db) {
32605
32766
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
32606
32767
  }
32607
- function up972(db) {
32768
+ function up982(db) {
32608
32769
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32609
32770
  if (!columns.some((column) => column.name === "last_failure_at")) {
32610
32771
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
32611
32772
  }
32612
32773
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
32613
32774
  }
32614
- function up982(db) {
32775
+ function up992(db) {
32615
32776
  db.exec(`
32616
32777
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
32617
32778
  agent_id TEXT NOT NULL,
@@ -32628,7 +32789,7 @@ function up982(db) {
32628
32789
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
32629
32790
  `);
32630
32791
  }
32631
- function up992(db) {
32792
+ function up1002(db) {
32632
32793
  db.exec(`
32633
32794
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
32634
32795
  id TEXT PRIMARY KEY,
@@ -32648,7 +32809,7 @@ function up992(db) {
32648
32809
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
32649
32810
  `);
32650
32811
  }
32651
- function up1002(db) {
32812
+ function up1012(db) {
32652
32813
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
32653
32814
  if (!columns.some((column) => column.name === "evidence_window_json")) {
32654
32815
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -32657,7 +32818,7 @@ function up1002(db) {
32657
32818
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
32658
32819
  }
32659
32820
  }
32660
- function up1012(db) {
32821
+ function up1022(db) {
32661
32822
  db.exec(`
32662
32823
  CREATE TABLE IF NOT EXISTS dreaming_attention (
32663
32824
  id TEXT PRIMARY KEY,
@@ -32679,7 +32840,7 @@ function up1012(db) {
32679
32840
  function hasColumn152(db, table, column) {
32680
32841
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32681
32842
  }
32682
- function up1022(db) {
32843
+ function up1032(db) {
32683
32844
  const requiredMemoryColumns = [
32684
32845
  "content_hash",
32685
32846
  "normalized_content",
@@ -32730,7 +32891,7 @@ function up1022(db) {
32730
32891
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
32731
32892
  `);
32732
32893
  }
32733
- function up1032(db) {
32894
+ function up1042(db) {
32734
32895
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
32735
32896
  if (tables.length !== 2)
32736
32897
  return;
@@ -32753,7 +32914,7 @@ function tableExists4(db, table) {
32753
32914
  function hasColumn162(db, table, column) {
32754
32915
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32755
32916
  }
32756
- function up1042(db) {
32917
+ function up1052(db) {
32757
32918
  db.exec(`
32758
32919
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
32759
32920
  derived_memory_id TEXT NOT NULL,
@@ -32796,7 +32957,7 @@ function up1042(db) {
32796
32957
  `);
32797
32958
  }
32798
32959
  }
32799
- function up1052(db) {
32960
+ function up1062(db) {
32800
32961
  db.exec(`
32801
32962
  DROP TRIGGER IF EXISTS entities_fts_ai;
32802
32963
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -32885,7 +33046,7 @@ function up1052(db) {
32885
33046
  function hasColumn172(db, table, column) {
32886
33047
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32887
33048
  }
32888
- function up1062(db) {
33049
+ function up1072(db) {
32889
33050
  if (!hasColumn172(db, "memories", "review_after")) {
32890
33051
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
32891
33052
  }
@@ -32901,14 +33062,14 @@ var TOKEN_COLUMNS2 = [
32901
33062
  ["tokens_cache_write", "INTEGER"],
32902
33063
  ["tokens_cost", "REAL"]
32903
33064
  ];
32904
- function up1072(db) {
33065
+ function up1082(db) {
32905
33066
  for (const [column, type] of TOKEN_COLUMNS2) {
32906
33067
  if (!hasColumn182(db, "dreaming_passes", column)) {
32907
33068
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
32908
33069
  }
32909
33070
  }
32910
33071
  }
32911
- function up1082(db) {
33072
+ function up1092(db) {
32912
33073
  db.exec(`
32913
33074
  CREATE TABLE IF NOT EXISTS embedding_usage (
32914
33075
  day TEXT NOT NULL,
@@ -32921,7 +33082,7 @@ function up1082(db) {
32921
33082
  );
32922
33083
  `);
32923
33084
  }
32924
- function up1092(db) {
33085
+ function up1102(db) {
32925
33086
  db.exec(`
32926
33087
  CREATE TABLE IF NOT EXISTS telemetry_install (
32927
33088
  id TEXT PRIMARY KEY,
@@ -32929,7 +33090,7 @@ function up1092(db) {
32929
33090
  );
32930
33091
  `);
32931
33092
  }
32932
- function up1102(db) {
33093
+ function up1112(db) {
32933
33094
  db.exec(`
32934
33095
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
32935
33096
  ON memory_entity_mentions(entity_id, memory_id);
@@ -32940,7 +33101,7 @@ function hasColumn192(db, table, column) {
32940
33101
  return rows.some((row) => row.name === column);
32941
33102
  }
32942
33103
  var COLUMNS22 = ["first_remember_at", "first_recall_at"];
32943
- function up1112(db) {
33104
+ function up1122(db) {
32944
33105
  for (const column of COLUMNS22) {
32945
33106
  if (!hasColumn192(db, "telemetry_install", column)) {
32946
33107
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -32956,7 +33117,7 @@ function addColumnIfMissing232(db, column, definition) {
32956
33117
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
32957
33118
  }
32958
33119
  }
32959
- function up1122(db) {
33120
+ function up1132(db) {
32960
33121
  addColumnIfMissing232(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
32961
33122
  addColumnIfMissing232(db, "claim_token", "TEXT");
32962
33123
  addColumnIfMissing232(db, "claimed_at", "TEXT");
@@ -32965,7 +33126,7 @@ function up1122(db) {
32965
33126
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
32966
33127
  `);
32967
33128
  }
32968
- function up1132(db) {
33129
+ function up1142(db) {
32969
33130
  db.exec(`
32970
33131
  CREATE TABLE IF NOT EXISTS session_claims (
32971
33132
  session_key TEXT NOT NULL,
@@ -32986,7 +33147,7 @@ function up1132(db) {
32986
33147
  ON session_claims(agent_id, state, expires_at);
32987
33148
  `);
32988
33149
  }
32989
- function up1142(db) {
33150
+ function up1152(db) {
32990
33151
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
32991
33152
  if (table == null)
32992
33153
  return;
@@ -32995,7 +33156,7 @@ function up1142(db) {
32995
33156
  ON entity_attributes(memory_id, agent_id, status, importance);
32996
33157
  `);
32997
33158
  }
32998
- function up1152(db) {
33159
+ function up1162(db) {
32999
33160
  db.exec(`
33000
33161
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
33001
33162
  id TEXT PRIMARY KEY,
@@ -33052,7 +33213,7 @@ function addColumnIfMissing242(db, column, definition) {
33052
33213
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
33053
33214
  }
33054
33215
  }
33055
- function up1162(db) {
33216
+ function up1172(db) {
33056
33217
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
33057
33218
  if (table == null)
33058
33219
  return;
@@ -33253,7 +33414,7 @@ function backfillTranscriptsFromSummaryJobs2(db) {
33253
33414
  insert.run(...values);
33254
33415
  }
33255
33416
  }
33256
- function up1172(db) {
33417
+ function up1182(db) {
33257
33418
  if (!hasTable42(db, "session_transcripts"))
33258
33419
  return;
33259
33420
  addColumnIfMissing252(db, "session_transcripts", "completed_at", "TEXT");
@@ -33306,7 +33467,7 @@ function up1172(db) {
33306
33467
  ON session_transcripts(agent_id, content_hash);
33307
33468
  `);
33308
33469
  }
33309
- function up1182(db) {
33470
+ function up1192(db) {
33310
33471
  db.exec(`
33311
33472
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
33312
33473
  ON memory_jobs(status)
@@ -33325,12 +33486,12 @@ function up1182(db) {
33325
33486
  function hasColumn222(db, table, column) {
33326
33487
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33327
33488
  }
33328
- function up1192(db) {
33489
+ function up1202(db) {
33329
33490
  if (!hasColumn222(db, "telemetry_install", "last_seen_version")) {
33330
33491
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
33331
33492
  }
33332
33493
  }
33333
- function up1202(db) {
33494
+ function up1212(db) {
33334
33495
  db.exec(`
33335
33496
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
33336
33497
  agent_id TEXT NOT NULL,
@@ -33359,7 +33520,7 @@ function addColumnIfMissing262(db, column, definition) {
33359
33520
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33360
33521
  }
33361
33522
  }
33362
- function up1212(db) {
33523
+ function up1222(db) {
33363
33524
  addColumnIfMissing262(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
33364
33525
  addColumnIfMissing262(db, "last_attempt_at", "TEXT");
33365
33526
  addColumnIfMissing262(db, "sent_at", "TEXT");
@@ -33380,7 +33541,7 @@ function up1212(db) {
33380
33541
  VALUES (1, CURRENT_TIMESTAMP);
33381
33542
  `);
33382
33543
  }
33383
- function up1222(db) {
33544
+ function up1232(db) {
33384
33545
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
33385
33546
  const names = new Set(columns.map((column) => column.name));
33386
33547
  if (!names.has("failure_class")) {
@@ -33397,7 +33558,7 @@ function up1222(db) {
33397
33558
  }
33398
33559
  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)");
33399
33560
  }
33400
- function up1232(db) {
33561
+ function up1242(db) {
33401
33562
  db.exec(`
33402
33563
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
33403
33564
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -33421,7 +33582,7 @@ function up1232(db) {
33421
33582
  ON embedding_index_failures(source_type, source_id);
33422
33583
  `);
33423
33584
  }
33424
- function up1242(db) {
33585
+ function up1252(db) {
33425
33586
  db.exec(`
33426
33587
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
33427
33588
  id TEXT PRIMARY KEY,
@@ -33471,7 +33632,7 @@ function backfillTable2(db, params) {
33471
33632
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
33472
33633
  backfill2(db, rows, params.sourceKind, params.scannedAt);
33473
33634
  }
33474
- function up1252(db) {
33635
+ function up1262(db) {
33475
33636
  db.exec(`
33476
33637
  CREATE TABLE IF NOT EXISTS memory_content_safety (
33477
33638
  agent_id TEXT NOT NULL,
@@ -33528,7 +33689,7 @@ function up1252(db) {
33528
33689
  scannedAt
33529
33690
  });
33530
33691
  }
33531
- function up1262(db) {
33692
+ function up1272(db) {
33532
33693
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
33533
33694
  if (!table)
33534
33695
  return;
@@ -33562,7 +33723,7 @@ function up1262(db) {
33562
33723
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
33563
33724
  `);
33564
33725
  }
33565
- function up1272(db) {
33726
+ function up1282(db) {
33566
33727
  db.exec(`
33567
33728
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
33568
33729
  id TEXT PRIMARY KEY,
@@ -33618,7 +33779,7 @@ function up1272(db) {
33618
33779
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
33619
33780
  `);
33620
33781
  }
33621
- function up1282(db) {
33782
+ function up1292(db) {
33622
33783
  db.exec(`
33623
33784
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
33624
33785
  ON memory_jobs(status, created_at)
@@ -33633,7 +33794,7 @@ function up1282(db) {
33633
33794
  function tableExists32(db, table) {
33634
33795
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
33635
33796
  }
33636
- function up1292(db) {
33797
+ function up1302(db) {
33637
33798
  if (!tableExists32(db, "memory_jobs"))
33638
33799
  return;
33639
33800
  if (!tableExists32(db, "job_cancellations")) {
@@ -33682,7 +33843,7 @@ function up1292(db) {
33682
33843
  AND status IN ('pending', 'leased');
33683
33844
  `);
33684
33845
  }
33685
- function up1302(db) {
33846
+ function up1312(db) {
33686
33847
  db.exec(`
33687
33848
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
33688
33849
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -33722,7 +33883,7 @@ function up1302(db) {
33722
33883
  END;
33723
33884
  `);
33724
33885
  }
33725
- function up1312(db) {
33886
+ function up1322(db) {
33726
33887
  db.exec(`
33727
33888
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
33728
33889
  agent_id TEXT NOT NULL,
@@ -33745,13 +33906,13 @@ function up1312(db) {
33745
33906
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
33746
33907
  `);
33747
33908
  }
33748
- function up1322(db) {
33909
+ function up1332(db) {
33749
33910
  db.exec(`
33750
33911
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
33751
33912
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
33752
33913
  `);
33753
33914
  }
33754
- function up1332(db) {
33915
+ function up1342(db) {
33755
33916
  db.exec(`
33756
33917
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
33757
33918
  id TEXT PRIMARY KEY,
@@ -33803,7 +33964,7 @@ function up1332(db) {
33803
33964
  if (!names.has("format_version"))
33804
33965
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
33805
33966
  }
33806
- function up1342(db) {
33967
+ function up1352(db) {
33807
33968
  db.exec(`
33808
33969
  CREATE TABLE memory_head_entries_v134 (
33809
33970
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -33821,7 +33982,7 @@ function up1342(db) {
33821
33982
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
33822
33983
  `);
33823
33984
  }
33824
- function up1352(db) {
33985
+ function up1362(db) {
33825
33986
  db.exec(`
33826
33987
  CREATE TABLE IF NOT EXISTS memory_head_publications (
33827
33988
  agent_id TEXT NOT NULL,
@@ -33837,7 +33998,7 @@ function up1352(db) {
33837
33998
  ON memory_head_publications(agent_id, status, revision DESC);
33838
33999
  `);
33839
34000
  }
33840
- function up1362(db) {
34001
+ function up1372(db) {
33841
34002
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r3) => r3.name));
33842
34003
  for (const [name, type] of [
33843
34004
  ["entry_id", "TEXT"],
@@ -33851,7 +34012,7 @@ function up1362(db) {
33851
34012
  }
33852
34013
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
33853
34014
  }
33854
- function up1372(db) {
34015
+ function up1382(db) {
33855
34016
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r3) => r3.name));
33856
34017
  for (const [name, type] of [
33857
34018
  ["head_revision", "INTEGER"],
@@ -33873,7 +34034,7 @@ function addColumnIfMissing272(db, table, column, definition) {
33873
34034
  if (!hasColumn252(db, table, column))
33874
34035
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33875
34036
  }
33876
- function up1382(db) {
34037
+ function up1392(db) {
33877
34038
  addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
33878
34039
  db.exec(`
33879
34040
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -34178,7 +34339,7 @@ function up1382(db) {
34178
34339
  GROUP BY j.agent_id;
34179
34340
  `);
34180
34341
  }
34181
- function up1392(db) {
34342
+ function up1402(db) {
34182
34343
  db.exec(`
34183
34344
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
34184
34345
  agent_id TEXT NOT NULL,
@@ -34194,7 +34355,7 @@ function up1392(db) {
34194
34355
  ON native_source_sync_state(agent_id, status);
34195
34356
  `);
34196
34357
  }
34197
- function up1402(db) {
34358
+ function up1412(db) {
34198
34359
  db.exec(`
34199
34360
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
34200
34361
  agent_id TEXT NOT NULL,
@@ -34206,7 +34367,7 @@ function up1402(db) {
34206
34367
  );
34207
34368
  `);
34208
34369
  }
34209
- function up1412(db) {
34370
+ function up1422(db) {
34210
34371
  db.exec(`
34211
34372
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
34212
34373
  agent_id TEXT NOT NULL,
@@ -34220,13 +34381,13 @@ function up1412(db) {
34220
34381
  );
34221
34382
  `);
34222
34383
  }
34223
- function up1422(db) {
34384
+ function up1432(db) {
34224
34385
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
34225
34386
  if (!columns.some((column) => column.name === "frontier")) {
34226
34387
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
34227
34388
  }
34228
34389
  }
34229
- function up1432(db) {
34390
+ function up1442(db) {
34230
34391
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34231
34392
  const additions = [
34232
34393
  ["migration_phase", "TEXT"],
@@ -34261,13 +34422,13 @@ function up1432(db) {
34261
34422
  `);
34262
34423
  }
34263
34424
  }
34264
- function up1442(db) {
34425
+ function up1452(db) {
34265
34426
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34266
34427
  if (!columns.has("lease_token")) {
34267
34428
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
34268
34429
  }
34269
34430
  }
34270
- function up1452(db) {
34431
+ function up1462(db) {
34271
34432
  db.exec(`
34272
34433
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
34273
34434
  agent_id TEXT NOT NULL,
@@ -34285,7 +34446,7 @@ function up1452(db) {
34285
34446
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
34286
34447
  `);
34287
34448
  }
34288
- function up1462(db) {
34449
+ function up1472(db) {
34289
34450
  db.exec(`
34290
34451
  CREATE TABLE IF NOT EXISTS source_import_jobs (
34291
34452
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -34340,24 +34501,36 @@ function up1462(db) {
34340
34501
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
34341
34502
  `);
34342
34503
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
34343
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
34504
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
34505
+ let exists;
34506
+ try {
34507
+ exists = statement.get(column);
34508
+ } finally {
34509
+ statement.finalize?.();
34510
+ }
34344
34511
  if (exists == null)
34345
34512
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
34346
34513
  }
34347
34514
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
34348
34515
  }
34349
- function up1472(db) {
34516
+ function up1482(db) {
34350
34517
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
34351
34518
  }
34352
- function up1482(db) {
34519
+ function up1492(db) {
34353
34520
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
34354
34521
  if (!columns.some((column) => column.name === "source_id")) {
34355
34522
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
34356
34523
  }
34357
34524
  }
34358
- function up1492(db) {
34525
+ function up1502(db) {
34359
34526
  const addColumn = (table, column, definition) => {
34360
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
34527
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
34528
+ let exists;
34529
+ try {
34530
+ exists = statement.get(table, column);
34531
+ } finally {
34532
+ statement.finalize?.();
34533
+ }
34361
34534
  if (exists == null)
34362
34535
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34363
34536
  };
@@ -34370,7 +34543,7 @@ function addColumnIfMissing282(db, table, column, definition) {
34370
34543
  if (!columns.some((row) => row.name === column))
34371
34544
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34372
34545
  }
34373
- function up1502(db) {
34546
+ function up1512(db) {
34374
34547
  addColumnIfMissing282(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
34375
34548
  addColumnIfMissing282(db, "dreaming_passes", "head_base_revision", "INTEGER");
34376
34549
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -34524,13 +34697,13 @@ var MIGRATIONS2 = [
34524
34697
  {
34525
34698
  version: 1,
34526
34699
  name: "baseline",
34527
- up: up151,
34700
+ up: up210,
34528
34701
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
34529
34702
  },
34530
34703
  {
34531
34704
  version: 2,
34532
34705
  name: "pipeline-v2",
34533
- up: up210,
34706
+ up: up310,
34534
34707
  artifacts: {
34535
34708
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
34536
34709
  }
@@ -34538,12 +34711,12 @@ var MIGRATIONS2 = [
34538
34711
  {
34539
34712
  version: 3,
34540
34713
  name: "unique-content-hash",
34541
- up: up310
34714
+ up: up410
34542
34715
  },
34543
34716
  {
34544
34717
  version: 4,
34545
34718
  name: "history-actor-and-retention",
34546
- up: up410,
34719
+ up: up510,
34547
34720
  artifacts: {
34548
34721
  columns: [{ table: "memory_history", column: "actor_type" }]
34549
34722
  }
@@ -34551,7 +34724,7 @@ var MIGRATIONS2 = [
34551
34724
  {
34552
34725
  version: 5,
34553
34726
  name: "graph-extended",
34554
- up: up510,
34727
+ up: up610,
34555
34728
  artifacts: {
34556
34729
  columns: [{ table: "entities", column: "canonical_name" }]
34557
34730
  }
@@ -34559,7 +34732,7 @@ var MIGRATIONS2 = [
34559
34732
  {
34560
34733
  version: 6,
34561
34734
  name: "idempotency-key",
34562
- up: up610,
34735
+ up: up710,
34563
34736
  artifacts: {
34564
34737
  columns: [{ table: "memories", column: "idempotency_key" }]
34565
34738
  }
@@ -34567,42 +34740,42 @@ var MIGRATIONS2 = [
34567
34740
  {
34568
34741
  version: 7,
34569
34742
  name: "documents-and-connectors",
34570
- up: up710,
34743
+ up: up810,
34571
34744
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
34572
34745
  },
34573
34746
  {
34574
34747
  version: 8,
34575
34748
  name: "embeddings-unique-hash",
34576
- up: up810
34749
+ up: up910
34577
34750
  },
34578
34751
  {
34579
34752
  version: 9,
34580
34753
  name: "summary-jobs",
34581
- up: up910,
34754
+ up: up1010,
34582
34755
  artifacts: { tables: ["summary_jobs"] }
34583
34756
  },
34584
34757
  {
34585
34758
  version: 10,
34586
34759
  name: "umap-cache",
34587
- up: up1010,
34760
+ up: up1110,
34588
34761
  artifacts: { tables: ["umap_cache"] }
34589
34762
  },
34590
34763
  {
34591
34764
  version: 11,
34592
34765
  name: "session-scores",
34593
- up: up1110,
34766
+ up: up1210,
34594
34767
  artifacts: { tables: ["session_scores"] }
34595
34768
  },
34596
34769
  {
34597
34770
  version: 12,
34598
34771
  name: "scheduled-tasks",
34599
- up: up1210,
34772
+ up: up1310,
34600
34773
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
34601
34774
  },
34602
34775
  {
34603
34776
  version: 13,
34604
34777
  name: "ingestion-tracking",
34605
- up: up1310,
34778
+ up: up1410,
34606
34779
  artifacts: {
34607
34780
  columns: [
34608
34781
  { table: "memories", column: "source_path" },
@@ -34613,13 +34786,13 @@ var MIGRATIONS2 = [
34613
34786
  {
34614
34787
  version: 14,
34615
34788
  name: "telemetry",
34616
- up: up1410,
34789
+ up: up153,
34617
34790
  artifacts: { tables: ["telemetry_events"] }
34618
34791
  },
34619
34792
  {
34620
34793
  version: 15,
34621
34794
  name: "session-memories",
34622
- up: up152,
34795
+ up: up162,
34623
34796
  artifacts: {
34624
34797
  tables: ["session_memories"],
34625
34798
  columns: [
@@ -34631,13 +34804,13 @@ var MIGRATIONS2 = [
34631
34804
  {
34632
34805
  version: 16,
34633
34806
  name: "session-checkpoints",
34634
- up: up162,
34807
+ up: up172,
34635
34808
  artifacts: { tables: ["session_checkpoints"] }
34636
34809
  },
34637
34810
  {
34638
34811
  version: 17,
34639
34812
  name: "task-skills",
34640
- up: up172,
34813
+ up: up182,
34641
34814
  artifacts: {
34642
34815
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
34643
34816
  }
@@ -34645,13 +34818,13 @@ var MIGRATIONS2 = [
34645
34818
  {
34646
34819
  version: 18,
34647
34820
  name: "skill-meta",
34648
- up: up182,
34821
+ up: up192,
34649
34822
  artifacts: { tables: ["skill_meta"] }
34650
34823
  },
34651
34824
  {
34652
34825
  version: 19,
34653
34826
  name: "knowledge-structure",
34654
- up: up192,
34827
+ up: up202,
34655
34828
  artifacts: {
34656
34829
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
34657
34830
  columns: [{ table: "entities", column: "agent_id" }]
@@ -34660,7 +34833,7 @@ var MIGRATIONS2 = [
34660
34833
  {
34661
34834
  version: 20,
34662
34835
  name: "session-structural-columns",
34663
- up: up202,
34836
+ up: up212,
34664
34837
  artifacts: {
34665
34838
  columns: [
34666
34839
  { table: "session_memories", column: "entity_slot" },
@@ -34673,7 +34846,7 @@ var MIGRATIONS2 = [
34673
34846
  {
34674
34847
  version: 21,
34675
34848
  name: "checkpoint-structural",
34676
- up: up212,
34849
+ up: up222,
34677
34850
  artifacts: {
34678
34851
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
34679
34852
  }
@@ -34681,7 +34854,7 @@ var MIGRATIONS2 = [
34681
34854
  {
34682
34855
  version: 22,
34683
34856
  name: "entity-pinning",
34684
- up: up222,
34857
+ up: up232,
34685
34858
  artifacts: {
34686
34859
  columns: [
34687
34860
  { table: "entities", column: "pinned" },
@@ -34692,17 +34865,17 @@ var MIGRATIONS2 = [
34692
34865
  {
34693
34866
  version: 23,
34694
34867
  name: "retired-scorer-gap",
34695
- up: up232
34868
+ up: up242
34696
34869
  },
34697
34870
  {
34698
34871
  version: 24,
34699
34872
  name: "retired-scorer-gap",
34700
- up: up242
34873
+ up: up252
34701
34874
  },
34702
34875
  {
34703
34876
  version: 25,
34704
34877
  name: "agent-feedback",
34705
- up: up252,
34878
+ up: up262,
34706
34879
  artifacts: {
34707
34880
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
34708
34881
  }
@@ -34710,32 +34883,32 @@ var MIGRATIONS2 = [
34710
34883
  {
34711
34884
  version: 26,
34712
34885
  name: "retired-scorer-gap",
34713
- up: up262
34886
+ up: up272
34714
34887
  },
34715
34888
  {
34716
34889
  version: 27,
34717
34890
  name: "backfill-canonical-names",
34718
- up: up272
34891
+ up: up282
34719
34892
  },
34720
34893
  {
34721
34894
  version: 28,
34722
34895
  name: "lossless-retention",
34723
- up: up282
34896
+ up: up292
34724
34897
  },
34725
34898
  {
34726
34899
  version: 29,
34727
34900
  name: "session-summary-dag",
34728
- up: up292
34901
+ up: up302
34729
34902
  },
34730
34903
  {
34731
34904
  version: 30,
34732
34905
  name: "nullable-memory-job-memory-id",
34733
- up: up302
34906
+ up: up312
34734
34907
  },
34735
34908
  {
34736
34909
  version: 31,
34737
34910
  name: "dependency-reason",
34738
- up: up312,
34911
+ up: up322,
34739
34912
  artifacts: {
34740
34913
  columns: [
34741
34914
  { table: "entity_dependencies", column: "reason" },
@@ -34746,7 +34919,7 @@ var MIGRATIONS2 = [
34746
34919
  {
34747
34920
  version: 32,
34748
34921
  name: "embeddings-vector-column",
34749
- up: up322,
34922
+ up: up332,
34750
34923
  artifacts: {
34751
34924
  columns: [{ table: "embeddings", column: "vector", optional: true }]
34752
34925
  }
@@ -34754,7 +34927,7 @@ var MIGRATIONS2 = [
34754
34927
  {
34755
34928
  version: 33,
34756
34929
  name: "scope",
34757
- up: up332,
34930
+ up: up342,
34758
34931
  artifacts: {
34759
34932
  columns: [{ table: "memories", column: "scope" }]
34760
34933
  }
@@ -34762,17 +34935,17 @@ var MIGRATIONS2 = [
34762
34935
  {
34763
34936
  version: 34,
34764
34937
  name: "scope-aware-dedup",
34765
- up: up342
34938
+ up: up352
34766
34939
  },
34767
34940
  {
34768
34941
  version: 35,
34769
34942
  name: "entity-fts",
34770
- up: up352
34943
+ up: up362
34771
34944
  },
34772
34945
  {
34773
34946
  version: 36,
34774
34947
  name: "dependency-confidence",
34775
- up: up362,
34948
+ up: up372,
34776
34949
  artifacts: {
34777
34950
  columns: [{ table: "entity_dependencies", column: "confidence" }]
34778
34951
  }
@@ -34780,7 +34953,7 @@ var MIGRATIONS2 = [
34780
34953
  {
34781
34954
  version: 37,
34782
34955
  name: "entity-communities",
34783
- up: up372,
34956
+ up: up382,
34784
34957
  artifacts: {
34785
34958
  tables: ["entity_communities"],
34786
34959
  columns: [{ table: "entities", column: "community_id" }]
@@ -34789,24 +34962,24 @@ var MIGRATIONS2 = [
34789
34962
  {
34790
34963
  version: 38,
34791
34964
  name: "memory-hints",
34792
- up: up382,
34965
+ up: up392,
34793
34966
  artifacts: { tables: ["memory_hints"] }
34794
34967
  },
34795
34968
  {
34796
34969
  version: 39,
34797
34970
  name: "dedup-entity-dependencies",
34798
- up: up392
34971
+ up: up402
34799
34972
  },
34800
34973
  {
34801
34974
  version: 40,
34802
34975
  name: "session-transcripts",
34803
- up: up402,
34976
+ up: up412,
34804
34977
  artifacts: { tables: ["session_transcripts"] }
34805
34978
  },
34806
34979
  {
34807
34980
  version: 41,
34808
34981
  name: "path-feedback",
34809
- up: up412,
34982
+ up: up422,
34810
34983
  artifacts: {
34811
34984
  tables: [
34812
34985
  "path_feedback_events",
@@ -34821,7 +34994,7 @@ var MIGRATIONS2 = [
34821
34994
  {
34822
34995
  version: 42,
34823
34996
  name: "session-memories-agent-id",
34824
- up: up422,
34997
+ up: up432,
34825
34998
  artifacts: {
34826
34999
  columns: [{ table: "session_memories", column: "agent_id" }]
34827
35000
  }
@@ -34829,7 +35002,7 @@ var MIGRATIONS2 = [
34829
35002
  {
34830
35003
  version: 43,
34831
35004
  name: "agents-table",
34832
- up: up432,
35005
+ up: up442,
34833
35006
  artifacts: {
34834
35007
  tables: ["agents"],
34835
35008
  columns: [
@@ -34841,7 +35014,7 @@ var MIGRATIONS2 = [
34841
35014
  {
34842
35015
  version: 44,
34843
35016
  name: "memory-md-temporal-head",
34844
- up: up442,
35017
+ up: up452,
34845
35018
  artifacts: {
34846
35019
  columns: [
34847
35020
  { table: "session_summaries", column: "source_type" },
@@ -34853,7 +35026,7 @@ var MIGRATIONS2 = [
34853
35026
  {
34854
35027
  version: 45,
34855
35028
  name: "lossless-working-memory-hardening",
34856
- up: up452,
35029
+ up: up462,
34857
35030
  artifacts: {
34858
35031
  tables: ["session_transcripts_fts", "memory_md_heads"],
34859
35032
  columns: [
@@ -34866,17 +35039,17 @@ var MIGRATIONS2 = [
34866
35039
  {
34867
35040
  version: 46,
34868
35041
  name: "session-summary-uniqueness",
34869
- up: up462
35042
+ up: up472
34870
35043
  },
34871
35044
  {
34872
35045
  version: 47,
34873
35046
  name: "agent-scoped-temporal-uniqueness",
34874
- up: up472
35047
+ up: up482
34875
35048
  },
34876
35049
  {
34877
35050
  version: 48,
34878
35051
  name: "thread-heads",
34879
- up: up482,
35052
+ up: up492,
34880
35053
  artifacts: {
34881
35054
  tables: ["memory_thread_heads"]
34882
35055
  }
@@ -34884,7 +35057,7 @@ var MIGRATIONS2 = [
34884
35057
  {
34885
35058
  version: 49,
34886
35059
  name: "session-extract-cursors",
34887
- up: up492,
35060
+ up: up502,
34888
35061
  artifacts: {
34889
35062
  tables: ["session_extract_cursors"]
34890
35063
  }
@@ -34892,7 +35065,7 @@ var MIGRATIONS2 = [
34892
35065
  {
34893
35066
  version: 50,
34894
35067
  name: "related-to-audit",
34895
- up: up502,
35068
+ up: up512,
34896
35069
  artifacts: {
34897
35070
  tables: ["entity_dependency_history"]
34898
35071
  }
@@ -34900,7 +35073,7 @@ var MIGRATIONS2 = [
34900
35073
  {
34901
35074
  version: 51,
34902
35075
  name: "memory-md-rolling-window-lineage",
34903
- up: up512,
35076
+ up: up522,
34904
35077
  artifacts: {
34905
35078
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
34906
35079
  columns: [
@@ -34915,7 +35088,7 @@ var MIGRATIONS2 = [
34915
35088
  {
34916
35089
  version: 52,
34917
35090
  name: "mcp-invocations",
34918
- up: up522,
35091
+ up: up532,
34919
35092
  artifacts: {
34920
35093
  tables: ["mcp_invocations"]
34921
35094
  }
@@ -34923,7 +35096,7 @@ var MIGRATIONS2 = [
34923
35096
  {
34924
35097
  version: 53,
34925
35098
  name: "skill-invocations",
34926
- up: up532,
35099
+ up: up542,
34927
35100
  artifacts: {
34928
35101
  tables: ["skill_invocations"]
34929
35102
  }
@@ -34931,7 +35104,7 @@ var MIGRATIONS2 = [
34931
35104
  {
34932
35105
  version: 54,
34933
35106
  name: "task-agent-scope",
34934
- up: up542,
35107
+ up: up552,
34935
35108
  artifacts: {
34936
35109
  tables: ["task_scope_hints"]
34937
35110
  }
@@ -34939,7 +35112,7 @@ var MIGRATIONS2 = [
34939
35112
  {
34940
35113
  version: 55,
34941
35114
  name: "dreaming-state",
34942
- up: up552,
35115
+ up: up562,
34943
35116
  artifacts: {
34944
35117
  tables: ["dreaming_state", "dreaming_passes"]
34945
35118
  }
@@ -34947,22 +35120,22 @@ var MIGRATIONS2 = [
34947
35120
  {
34948
35121
  version: 56,
34949
35122
  name: "agent-scoped-content-hash",
34950
- up: up562
35123
+ up: up572
34951
35124
  },
34952
35125
  {
34953
35126
  version: 57,
34954
35127
  name: "memories-fts-tokenizer-repair",
34955
- up: up572
35128
+ up: up582
34956
35129
  },
34957
35130
  {
34958
35131
  version: 58,
34959
35132
  name: "knowledge-graph-indices",
34960
- up: up582
35133
+ up: up592
34961
35134
  },
34962
35135
  {
34963
35136
  version: 59,
34964
35137
  name: "entity-attribute-claim-key",
34965
- up: up592,
35138
+ up: up602,
34966
35139
  artifacts: {
34967
35140
  columns: [{ table: "entity_attributes", column: "claim_key" }]
34968
35141
  }
@@ -34970,7 +35143,7 @@ var MIGRATIONS2 = [
34970
35143
  {
34971
35144
  version: 60,
34972
35145
  name: "entity-attribute-group-key",
34973
- up: up602,
35146
+ up: up612,
34974
35147
  artifacts: {
34975
35148
  columns: [{ table: "entity_attributes", column: "group_key" }]
34976
35149
  }
@@ -34978,7 +35151,7 @@ var MIGRATIONS2 = [
34978
35151
  {
34979
35152
  version: 61,
34980
35153
  name: "memory-artifact-source-mtime",
34981
- up: up612,
35154
+ up: up622,
34982
35155
  artifacts: {
34983
35156
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
34984
35157
  }
@@ -34986,7 +35159,7 @@ var MIGRATIONS2 = [
34986
35159
  {
34987
35160
  version: 62,
34988
35161
  name: "memory-artifact-soft-delete",
34989
- up: up622,
35162
+ up: up632,
34990
35163
  artifacts: {
34991
35164
  columns: [
34992
35165
  { table: "memory_artifacts", column: "is_deleted" },
@@ -34997,12 +35170,12 @@ var MIGRATIONS2 = [
34997
35170
  {
34998
35171
  version: 63,
34999
35172
  name: "content-only-memories-fts-update",
35000
- up: up632
35173
+ up: up642
35001
35174
  },
35002
35175
  {
35003
35176
  version: 64,
35004
35177
  name: "source-graph-provenance",
35005
- up: up642,
35178
+ up: up652,
35006
35179
  artifacts: {
35007
35180
  columns: [
35008
35181
  { table: "entities", column: "source_path" },
@@ -35015,7 +35188,7 @@ var MIGRATIONS2 = [
35015
35188
  {
35016
35189
  version: 65,
35017
35190
  name: "source-embedding-agent-scope",
35018
- up: up652,
35191
+ up: up662,
35019
35192
  artifacts: {
35020
35193
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
35021
35194
  }
@@ -35023,7 +35196,7 @@ var MIGRATIONS2 = [
35023
35196
  {
35024
35197
  version: 66,
35025
35198
  name: "memory-search-telemetry",
35026
- up: up662,
35199
+ up: up672,
35027
35200
  artifacts: {
35028
35201
  tables: ["memory_search_telemetry"]
35029
35202
  }
@@ -35031,7 +35204,7 @@ var MIGRATIONS2 = [
35031
35204
  {
35032
35205
  version: 67,
35033
35206
  name: "ontology-proposals",
35034
- up: up672,
35207
+ up: up682,
35035
35208
  artifacts: {
35036
35209
  tables: ["ontology_proposals"],
35037
35210
  columns: [
@@ -35045,7 +35218,7 @@ var MIGRATIONS2 = [
35045
35218
  {
35046
35219
  version: 68,
35047
35220
  name: "daily-reflections",
35048
- up: up682,
35221
+ up: up692,
35049
35222
  artifacts: {
35050
35223
  tables: ["daily_reflections"]
35051
35224
  }
@@ -35053,7 +35226,7 @@ var MIGRATIONS2 = [
35053
35226
  {
35054
35227
  version: 69,
35055
35228
  name: "daily-reflections-multiple-insights",
35056
- up: up692,
35229
+ up: up702,
35057
35230
  artifacts: {
35058
35231
  tables: ["daily_reflections"]
35059
35232
  }
@@ -35061,7 +35234,7 @@ var MIGRATIONS2 = [
35061
35234
  {
35062
35235
  version: 70,
35063
35236
  name: "ontology-control-plane-state",
35064
- up: up702,
35237
+ up: up712,
35065
35238
  artifacts: {
35066
35239
  columns: [
35067
35240
  { table: "entities", column: "status" },
@@ -35076,7 +35249,7 @@ var MIGRATIONS2 = [
35076
35249
  {
35077
35250
  version: 71,
35078
35251
  name: "epistemic-assertions",
35079
- up: up712,
35252
+ up: up722,
35080
35253
  artifacts: {
35081
35254
  tables: ["epistemic_assertions"]
35082
35255
  }
@@ -35084,7 +35257,7 @@ var MIGRATIONS2 = [
35084
35257
  {
35085
35258
  version: 72,
35086
35259
  name: "agent-scoped-idempotency-key",
35087
- up: up722,
35260
+ up: up732,
35088
35261
  artifacts: {
35089
35262
  columns: [
35090
35263
  { table: "memories", column: "idempotency_key" },
@@ -35095,7 +35268,7 @@ var MIGRATIONS2 = [
35095
35268
  {
35096
35269
  version: 73,
35097
35270
  name: "recall-context-dedupe",
35098
- up: up732,
35271
+ up: up742,
35099
35272
  artifacts: {
35100
35273
  tables: ["session_context_epochs", "session_recall_events"]
35101
35274
  }
@@ -35103,7 +35276,7 @@ var MIGRATIONS2 = [
35103
35276
  {
35104
35277
  version: 74,
35105
35278
  name: "aggregate-memory-links",
35106
- up: up742,
35279
+ up: up752,
35107
35280
  artifacts: {
35108
35281
  tables: ["aggregate_memory_sources"]
35109
35282
  }
@@ -35111,7 +35284,7 @@ var MIGRATIONS2 = [
35111
35284
  {
35112
35285
  version: 75,
35113
35286
  name: "memory-artifact-source-provenance",
35114
- up: up752,
35287
+ up: up762,
35115
35288
  artifacts: {
35116
35289
  columns: [
35117
35290
  { table: "memory_artifacts", column: "source_id" },
@@ -35125,7 +35298,7 @@ var MIGRATIONS2 = [
35125
35298
  {
35126
35299
  version: 76,
35127
35300
  name: "temporal-edges",
35128
- up: up762,
35301
+ up: up772,
35129
35302
  artifacts: {
35130
35303
  tables: ["temporal_edges"]
35131
35304
  }
@@ -35133,7 +35306,7 @@ var MIGRATIONS2 = [
35133
35306
  {
35134
35307
  version: 77,
35135
35308
  name: "entity-aliases",
35136
- up: up772,
35309
+ up: up782,
35137
35310
  artifacts: {
35138
35311
  tables: ["entity_aliases"]
35139
35312
  }
@@ -35141,7 +35314,7 @@ var MIGRATIONS2 = [
35141
35314
  {
35142
35315
  version: 78,
35143
35316
  name: "api-keys",
35144
- up: up782,
35317
+ up: up792,
35145
35318
  artifacts: {
35146
35319
  tables: ["api_keys"]
35147
35320
  }
@@ -35149,7 +35322,7 @@ var MIGRATIONS2 = [
35149
35322
  {
35150
35323
  version: 79,
35151
35324
  name: "transcript-capture-jobs",
35152
- up: up792,
35325
+ up: up802,
35153
35326
  artifacts: {
35154
35327
  tables: ["transcript_capture_jobs"]
35155
35328
  }
@@ -35157,7 +35330,7 @@ var MIGRATIONS2 = [
35157
35330
  {
35158
35331
  version: 80,
35159
35332
  name: "document-scope-columns",
35160
- up: up802,
35333
+ up: up812,
35161
35334
  artifacts: {
35162
35335
  columns: [
35163
35336
  { table: "documents", column: "agent_id" },
@@ -35168,7 +35341,7 @@ var MIGRATIONS2 = [
35168
35341
  {
35169
35342
  version: 81,
35170
35343
  name: "aggregate-evidence-sources",
35171
- up: up812,
35344
+ up: up822,
35172
35345
  artifacts: {
35173
35346
  tables: ["aggregate_evidence_sources"]
35174
35347
  }
@@ -35176,7 +35349,7 @@ var MIGRATIONS2 = [
35176
35349
  {
35177
35350
  version: 82,
35178
35351
  name: "skill-invocations-harness",
35179
- up: up822,
35352
+ up: up832,
35180
35353
  artifacts: {
35181
35354
  columns: [
35182
35355
  { table: "skill_invocations", column: "harness" },
@@ -35187,7 +35360,7 @@ var MIGRATIONS2 = [
35187
35360
  {
35188
35361
  version: 83,
35189
35362
  name: "memory-lifecycle-repair",
35190
- up: up832,
35363
+ up: up842,
35191
35364
  artifacts: {
35192
35365
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
35193
35366
  columns: [
@@ -35202,7 +35375,7 @@ var MIGRATIONS2 = [
35202
35375
  {
35203
35376
  version: 84,
35204
35377
  name: "legacy-markdown-import-state",
35205
- up: up842,
35378
+ up: up852,
35206
35379
  artifacts: {
35207
35380
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
35208
35381
  }
@@ -35210,7 +35383,7 @@ var MIGRATIONS2 = [
35210
35383
  {
35211
35384
  version: 85,
35212
35385
  name: "backfill-relations-to-dependencies",
35213
- up: up852,
35386
+ up: up862,
35214
35387
  artifacts: {
35215
35388
  tables: ["entity_dependencies"]
35216
35389
  }
@@ -35218,7 +35391,7 @@ var MIGRATIONS2 = [
35218
35391
  {
35219
35392
  version: 86,
35220
35393
  name: "summary-jobs-content-hash",
35221
- up: up862,
35394
+ up: up872,
35222
35395
  artifacts: {
35223
35396
  columns: [{ table: "summary_jobs", column: "content_hash" }]
35224
35397
  }
@@ -35226,7 +35399,7 @@ var MIGRATIONS2 = [
35226
35399
  {
35227
35400
  version: 87,
35228
35401
  name: "summary-jobs-boundary-reason",
35229
- up: up872,
35402
+ up: up882,
35230
35403
  artifacts: {
35231
35404
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
35232
35405
  }
@@ -35234,7 +35407,7 @@ var MIGRATIONS2 = [
35234
35407
  {
35235
35408
  version: 88,
35236
35409
  name: "transcript-recovery-files",
35237
- up: up882,
35410
+ up: up892,
35238
35411
  artifacts: {
35239
35412
  tables: ["transcript_recovery_files"]
35240
35413
  }
@@ -35242,7 +35415,7 @@ var MIGRATIONS2 = [
35242
35415
  {
35243
35416
  version: 89,
35244
35417
  name: "job-cancellations",
35245
- up: up892,
35418
+ up: up902,
35246
35419
  artifacts: {
35247
35420
  tables: ["job_cancellations"]
35248
35421
  }
@@ -35250,7 +35423,7 @@ var MIGRATIONS2 = [
35250
35423
  {
35251
35424
  version: 90,
35252
35425
  name: "job-archive",
35253
- up: up902,
35426
+ up: up912,
35254
35427
  artifacts: {
35255
35428
  tables: ["job_archive"]
35256
35429
  }
@@ -35258,25 +35431,25 @@ var MIGRATIONS2 = [
35258
35431
  {
35259
35432
  version: 91,
35260
35433
  name: "embedding-index-generations",
35261
- up: up912,
35434
+ up: up922,
35262
35435
  artifacts: { tables: ["embedding_index_state"] }
35263
35436
  },
35264
35437
  {
35265
35438
  version: 92,
35266
35439
  name: "embedding-staging-store",
35267
- up: up922,
35440
+ up: up932,
35268
35441
  artifacts: { tables: ["embeddings_staging"] }
35269
35442
  },
35270
35443
  {
35271
35444
  version: 93,
35272
35445
  name: "dreaming-evidence-cursor",
35273
- up: up932,
35446
+ up: up942,
35274
35447
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
35275
35448
  },
35276
35449
  {
35277
35450
  version: 94,
35278
35451
  name: "memory-kind",
35279
- up: up942,
35452
+ up: up952,
35280
35453
  artifacts: {
35281
35454
  columns: [
35282
35455
  { table: "memories", column: "memory_kind" },
@@ -35287,35 +35460,35 @@ var MIGRATIONS2 = [
35287
35460
  {
35288
35461
  version: 95,
35289
35462
  name: "compaction-recall-projections",
35290
- up: up952
35463
+ up: up962
35291
35464
  },
35292
35465
  {
35293
35466
  version: 96,
35294
35467
  name: "retire-legacy-ingestion",
35295
- up: up962
35468
+ up: up972
35296
35469
  },
35297
35470
  {
35298
35471
  version: 97,
35299
35472
  name: "dreaming-failure-backoff",
35300
- up: up972,
35473
+ up: up982,
35301
35474
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
35302
35475
  },
35303
35476
  {
35304
35477
  version: 98,
35305
35478
  name: "dreaming-evidence-exclusions",
35306
- up: up982,
35479
+ up: up992,
35307
35480
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
35308
35481
  },
35309
35482
  {
35310
35483
  version: 99,
35311
35484
  name: "dreaming-tool-calls",
35312
- up: up992,
35485
+ up: up1002,
35313
35486
  artifacts: { tables: ["dreaming_tool_calls"] }
35314
35487
  },
35315
35488
  {
35316
35489
  version: 100,
35317
35490
  name: "dreaming-runbook",
35318
- up: up1002,
35491
+ up: up1012,
35319
35492
  artifacts: {
35320
35493
  columns: [
35321
35494
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -35326,23 +35499,23 @@ var MIGRATIONS2 = [
35326
35499
  {
35327
35500
  version: 101,
35328
35501
  name: "dreaming-attention",
35329
- up: up1012,
35502
+ up: up1022,
35330
35503
  artifacts: { tables: ["dreaming_attention"] }
35331
35504
  },
35332
35505
  {
35333
35506
  version: 102,
35334
35507
  name: "attribute-semantic-memories",
35335
- up: up1022
35508
+ up: up1032
35336
35509
  },
35337
35510
  {
35338
35511
  version: 103,
35339
35512
  name: "semantic-memory-kind",
35340
- up: up1032
35513
+ up: up1042
35341
35514
  },
35342
35515
  {
35343
35516
  version: 104,
35344
35517
  name: "derived-memory-provenance",
35345
- up: up1042,
35518
+ up: up1052,
35346
35519
  artifacts: {
35347
35520
  tables: ["derived_memory_sources"],
35348
35521
  columns: [{ table: "memories", column: "stale_at" }]
@@ -35351,12 +35524,12 @@ var MIGRATIONS2 = [
35351
35524
  {
35352
35525
  version: 105,
35353
35526
  name: "agent-scoped-entity-name",
35354
- up: up1052
35527
+ up: up1062
35355
35528
  },
35356
35529
  {
35357
35530
  version: 106,
35358
35531
  name: "memory-review-after",
35359
- up: up1062,
35532
+ up: up1072,
35360
35533
  artifacts: {
35361
35534
  columns: [{ table: "memories", column: "review_after" }]
35362
35535
  }
@@ -35364,7 +35537,7 @@ var MIGRATIONS2 = [
35364
35537
  {
35365
35538
  version: 107,
35366
35539
  name: "dreaming-pass-usage",
35367
- up: up1072,
35540
+ up: up1082,
35368
35541
  artifacts: {
35369
35542
  columns: [
35370
35543
  { table: "dreaming_passes", column: "tokens_input" },
@@ -35378,7 +35551,7 @@ var MIGRATIONS2 = [
35378
35551
  {
35379
35552
  version: 108,
35380
35553
  name: "embedding-usage",
35381
- up: up1082,
35554
+ up: up1092,
35382
35555
  artifacts: {
35383
35556
  tables: ["embedding_usage"]
35384
35557
  }
@@ -35386,7 +35559,7 @@ var MIGRATIONS2 = [
35386
35559
  {
35387
35560
  version: 109,
35388
35561
  name: "telemetry-install",
35389
- up: up1092,
35562
+ up: up1102,
35390
35563
  artifacts: {
35391
35564
  tables: ["telemetry_install"]
35392
35565
  }
@@ -35394,12 +35567,12 @@ var MIGRATIONS2 = [
35394
35567
  {
35395
35568
  version: 110,
35396
35569
  name: "memory-mention-join-index",
35397
- up: up1102
35570
+ up: up1112
35398
35571
  },
35399
35572
  {
35400
35573
  version: 111,
35401
35574
  name: "telemetry-first-use",
35402
- up: up1112,
35575
+ up: up1122,
35403
35576
  artifacts: {
35404
35577
  columns: [
35405
35578
  { table: "telemetry_install", column: "first_remember_at" },
@@ -35410,7 +35583,7 @@ var MIGRATIONS2 = [
35410
35583
  {
35411
35584
  version: 112,
35412
35585
  name: "telemetry-queue-ownership",
35413
- up: up1122,
35586
+ up: up1132,
35414
35587
  artifacts: {
35415
35588
  columns: [
35416
35589
  { table: "telemetry_events", column: "source" },
@@ -35422,7 +35595,7 @@ var MIGRATIONS2 = [
35422
35595
  {
35423
35596
  version: 113,
35424
35597
  name: "session-claims",
35425
- up: up1132,
35598
+ up: up1142,
35426
35599
  artifacts: {
35427
35600
  tables: ["session_claims"],
35428
35601
  columns: [
@@ -35436,12 +35609,12 @@ var MIGRATIONS2 = [
35436
35609
  {
35437
35610
  version: 114,
35438
35611
  name: "memory-traversal-hydration-index",
35439
- up: up1142
35612
+ up: up1152
35440
35613
  },
35441
35614
  {
35442
35615
  version: 115,
35443
35616
  name: "cross-agent-message-notifications",
35444
- up: up1152,
35617
+ up: up1162,
35445
35618
  artifacts: {
35446
35619
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
35447
35620
  }
@@ -35449,7 +35622,7 @@ var MIGRATIONS2 = [
35449
35622
  {
35450
35623
  version: 116,
35451
35624
  name: "acp-delivery-reconciliation",
35452
- up: up1162,
35625
+ up: up1172,
35453
35626
  artifacts: {
35454
35627
  columns: [
35455
35628
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -35463,7 +35636,7 @@ var MIGRATIONS2 = [
35463
35636
  {
35464
35637
  version: 117,
35465
35638
  name: "retire-summary-worker",
35466
- up: up1172,
35639
+ up: up1182,
35467
35640
  artifacts: {
35468
35641
  columns: [
35469
35642
  { table: "session_transcripts", column: "completed_at" },
@@ -35474,24 +35647,24 @@ var MIGRATIONS2 = [
35474
35647
  {
35475
35648
  version: 118,
35476
35649
  name: "queue-pressure-indices",
35477
- up: up1182
35650
+ up: up1192
35478
35651
  },
35479
35652
  {
35480
35653
  version: 119,
35481
35654
  name: "telemetry-version-observation",
35482
- up: up1192,
35655
+ up: up1202,
35483
35656
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
35484
35657
  },
35485
35658
  {
35486
35659
  version: 120,
35487
35660
  name: "source-lifecycle-telemetry",
35488
- up: up1202,
35661
+ up: up1212,
35489
35662
  artifacts: { tables: ["source_lifecycle_state"] }
35490
35663
  },
35491
35664
  {
35492
35665
  version: 121,
35493
35666
  name: "telemetry-delivery-health",
35494
- up: up1212,
35667
+ up: up1222,
35495
35668
  artifacts: {
35496
35669
  tables: ["telemetry_delivery_state"],
35497
35670
  columns: [
@@ -35505,7 +35678,7 @@ var MIGRATIONS2 = [
35505
35678
  {
35506
35679
  version: 122,
35507
35680
  name: "dreaming-evidence-retry",
35508
- up: up1222,
35681
+ up: up1232,
35509
35682
  artifacts: {
35510
35683
  columns: [
35511
35684
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -35518,13 +35691,13 @@ var MIGRATIONS2 = [
35518
35691
  {
35519
35692
  version: 123,
35520
35693
  name: "embedding-index-failures",
35521
- up: up1232,
35694
+ up: up1242,
35522
35695
  artifacts: { tables: ["embedding_index_failures"] }
35523
35696
  },
35524
35697
  {
35525
35698
  version: 124,
35526
35699
  name: "import-derived-lifecycle",
35527
- up: up1242,
35700
+ up: up1252,
35528
35701
  artifacts: {
35529
35702
  tables: ["imported_source_lifecycle"]
35530
35703
  }
@@ -35532,77 +35705,77 @@ var MIGRATIONS2 = [
35532
35705
  {
35533
35706
  version: 125,
35534
35707
  name: "memory-content-safety",
35535
- up: up1252,
35708
+ up: up1262,
35536
35709
  artifacts: { tables: ["memory_content_safety"] }
35537
35710
  },
35538
35711
  {
35539
35712
  version: 126,
35540
35713
  name: "dreaming-surprisal-attention",
35541
- up: up1262,
35714
+ up: up1272,
35542
35715
  artifacts: { tables: ["dreaming_attention"] }
35543
35716
  },
35544
35717
  {
35545
35718
  version: 127,
35546
35719
  name: "ontology-contradictions",
35547
- up: up1272,
35720
+ up: up1282,
35548
35721
  artifacts: { tables: ["ontology_contradictions"] }
35549
35722
  },
35550
35723
  {
35551
35724
  version: 128,
35552
35725
  name: "bounded-queue-diagnostics",
35553
- up: up1282
35726
+ up: up1292
35554
35727
  },
35555
35728
  {
35556
35729
  version: 129,
35557
35730
  name: "retire-structural-jobs",
35558
- up: up1292
35731
+ up: up1302
35559
35732
  },
35560
35733
  {
35561
35734
  version: 130,
35562
35735
  name: "embedding-repair-state",
35563
- up: up1302,
35736
+ up: up1312,
35564
35737
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
35565
35738
  },
35566
35739
  {
35567
35740
  version: 131,
35568
35741
  name: "dreaming-evidence-consumption",
35569
- up: up1312,
35742
+ up: up1322,
35570
35743
  artifacts: { tables: ["dreaming_evidence_consumption"] }
35571
35744
  },
35572
35745
  {
35573
35746
  version: 132,
35574
35747
  name: "observer-scoped-epistemic-assertions",
35575
- up: up1322,
35748
+ up: up1332,
35576
35749
  artifacts: { tables: ["epistemic_assertions"] }
35577
35750
  },
35578
35751
  {
35579
35752
  version: 133,
35580
35753
  name: "dreaming-memory-head",
35581
- up: up1332,
35754
+ up: up1342,
35582
35755
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
35583
35756
  },
35584
35757
  {
35585
35758
  version: 134,
35586
35759
  name: "scope-memory-head-entries",
35587
- up: up1342,
35760
+ up: up1352,
35588
35761
  artifacts: { tables: ["memory_head_entries"] }
35589
35762
  },
35590
35763
  {
35591
35764
  version: 135,
35592
35765
  name: "memory-head-publication",
35593
- up: up1352,
35766
+ up: up1362,
35594
35767
  artifacts: { tables: ["memory_head_publications"] }
35595
35768
  },
35596
35769
  {
35597
35770
  version: 136,
35598
35771
  name: "memory-head-revisions",
35599
- up: up1362,
35772
+ up: up1372,
35600
35773
  artifacts: { tables: ["memory_head_revisions"] }
35601
35774
  },
35602
35775
  {
35603
35776
  version: 137,
35604
35777
  name: "dreaming-head-manifest",
35605
- up: up1372,
35778
+ up: up1382,
35606
35779
  artifacts: {
35607
35780
  columns: [
35608
35781
  { table: "dreaming_passes", column: "head_revision" },
@@ -35613,7 +35786,7 @@ var MIGRATIONS2 = [
35613
35786
  {
35614
35787
  version: 138,
35615
35788
  name: "bounded-status-projections",
35616
- up: up1382,
35789
+ up: up1392,
35617
35790
  artifacts: {
35618
35791
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
35619
35792
  }
@@ -35621,31 +35794,31 @@ var MIGRATIONS2 = [
35621
35794
  {
35622
35795
  version: 139,
35623
35796
  name: "native-source-sync-state",
35624
- up: up1392,
35797
+ up: up1402,
35625
35798
  artifacts: { tables: ["native_source_sync_state"] }
35626
35799
  },
35627
35800
  {
35628
35801
  version: 140,
35629
35802
  name: "transcript-recovery-frontier",
35630
- up: up1402,
35803
+ up: up1412,
35631
35804
  artifacts: { tables: ["transcript_recovery_frontiers"] }
35632
35805
  },
35633
35806
  {
35634
35807
  version: 141,
35635
35808
  name: "source-sync-checkpoints",
35636
- up: up1412,
35809
+ up: up1422,
35637
35810
  artifacts: { tables: ["source_sync_checkpoints"] }
35638
35811
  },
35639
35812
  {
35640
35813
  version: 142,
35641
35814
  name: "source-sync-frontier",
35642
- up: up1422,
35815
+ up: up1432,
35643
35816
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
35644
35817
  },
35645
35818
  {
35646
35819
  version: 143,
35647
35820
  name: "embedding-index-progress",
35648
- up: up1432,
35821
+ up: up1442,
35649
35822
  artifacts: {
35650
35823
  columns: [
35651
35824
  { table: "embedding_index_state", column: "migration_phase" },
@@ -35661,19 +35834,19 @@ var MIGRATIONS2 = [
35661
35834
  {
35662
35835
  version: 144,
35663
35836
  name: "memory-job-lease-token",
35664
- up: up1442,
35837
+ up: up1452,
35665
35838
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
35666
35839
  },
35667
35840
  {
35668
35841
  version: 145,
35669
35842
  name: "dreaming-evidence-reviews",
35670
- up: up1452,
35843
+ up: up1462,
35671
35844
  artifacts: { tables: ["dreaming_evidence_reviews"] }
35672
35845
  },
35673
35846
  {
35674
35847
  version: 146,
35675
35848
  name: "source-transcript-import",
35676
- up: up1462,
35849
+ up: up1472,
35677
35850
  artifacts: {
35678
35851
  tables: [
35679
35852
  "source_import_jobs",
@@ -35692,19 +35865,19 @@ var MIGRATIONS2 = [
35692
35865
  {
35693
35866
  version: 147,
35694
35867
  name: "source-import-replay-file-slots",
35695
- up: up1472,
35868
+ up: up1482,
35696
35869
  artifacts: { tables: ["source_import_files"] }
35697
35870
  },
35698
35871
  {
35699
35872
  version: 148,
35700
35873
  name: "source-import-attempt-provenance",
35701
- up: up1482,
35874
+ up: up1492,
35702
35875
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
35703
35876
  },
35704
35877
  {
35705
35878
  version: 149,
35706
35879
  name: "transcript-import-state-machine",
35707
- up: up1492,
35880
+ up: up1502,
35708
35881
  artifacts: {
35709
35882
  columns: [
35710
35883
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -35716,13 +35889,42 @@ var MIGRATIONS2 = [
35716
35889
  {
35717
35890
  version: 150,
35718
35891
  name: "memory-head-freshness",
35719
- up: up1502,
35892
+ up: up1512,
35720
35893
  artifacts: {
35721
35894
  columns: [
35722
35895
  { table: "memory_md_heads", column: "is_current" },
35723
35896
  { table: "dreaming_passes", column: "head_base_revision" }
35724
35897
  ]
35725
35898
  }
35899
+ },
35900
+ {
35901
+ version: 151,
35902
+ name: "transcript-import-bytes",
35903
+ up: up152,
35904
+ artifacts: {
35905
+ tables: [
35906
+ "source_import_chunks",
35907
+ "source_import_capacity",
35908
+ "source_import_migrations",
35909
+ "source_import_migration_streams",
35910
+ "source_import_migration_counts"
35911
+ ],
35912
+ columns: [
35913
+ { table: "source_import_files", column: "storage_state" },
35914
+ { table: "source_import_files", column: "upload_generation" },
35915
+ { table: "source_import_files", column: "upload_offset" },
35916
+ { table: "source_import_files", column: "upload_size" },
35917
+ { table: "source_import_files", column: "upload_digest" },
35918
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
35919
+ table: "source_import_files",
35920
+ column
35921
+ })),
35922
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
35923
+ table: "source_import_jobs",
35924
+ column
35925
+ }))
35926
+ ]
35927
+ }
35726
35928
  }
35727
35929
  ];
35728
35930
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;