@signetai/connector-openclaw 0.221.7 → 0.221.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +810 -608
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -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;
@@ -31393,6 +31494,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
31393
31494
  "checkpoint",
31394
31495
  "dreaming"
31395
31496
  ];
31497
+ function up152(db) {
31498
+ const hasColumn26 = (table, column) => {
31499
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
31500
+ try {
31501
+ return statement.get(column) != null;
31502
+ } finally {
31503
+ statement.finalize?.();
31504
+ }
31505
+ };
31506
+ for (const [column, definition] of [
31507
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
31508
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
31509
+ ["upload_size", "INTEGER"],
31510
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
31511
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
31512
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
31513
+ ["original_path", "TEXT"],
31514
+ [
31515
+ "storage_state",
31516
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
31517
+ ]
31518
+ ]) {
31519
+ if (!hasColumn26("source_import_files", column))
31520
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
31521
+ }
31522
+ if (!hasColumn26("source_import_jobs", "retry_count"))
31523
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
31524
+ if (!hasColumn26("source_import_jobs", "cleanup_state"))
31525
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
31526
+ if (!hasColumn26("source_import_jobs", "retry_cursor"))
31527
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
31528
+ if (!hasColumn26("source_import_jobs", "retry_requested"))
31529
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
31530
+ db.exec(`
31531
+ 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);
31532
+ 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;
31533
+ 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;
31534
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
31535
+ 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));
31536
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
31537
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
31538
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
31539
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
31540
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
31541
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
31542
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
31543
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
31544
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
31545
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
31546
+ ) WITHOUT ROWID;
31547
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
31548
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
31549
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
31550
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
31551
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
31552
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
31553
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
31554
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
31555
+ `);
31556
+ }
31396
31557
  var MEMORIES_FTS_TOKENIZER2 = "unicode61";
31397
31558
  var FTS_STATE_TABLE2 = "memories_fts_state";
31398
31559
  function normalizeSql2(sql) {
@@ -31508,7 +31669,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
31508
31669
  return true;
31509
31670
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
31510
31671
  }
31511
- function up151(db) {
31672
+ function up210(db) {
31512
31673
  db.exec(`
31513
31674
  CREATE TABLE IF NOT EXISTS schema_migrations (
31514
31675
  version INTEGER PRIMARY KEY,
@@ -31606,7 +31767,7 @@ function addColumnIfMissing29(db, table, column, definition) {
31606
31767
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31607
31768
  }
31608
31769
  }
31609
- function up210(db) {
31770
+ function up310(db) {
31610
31771
  addColumnIfMissing29(db, "memories", "content_hash", "TEXT");
31611
31772
  addColumnIfMissing29(db, "memories", "normalized_content", "TEXT");
31612
31773
  addColumnIfMissing29(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -31724,7 +31885,7 @@ function addColumnIfMissing210(db, table, column, definition) {
31724
31885
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31725
31886
  return true;
31726
31887
  }
31727
- function up310(db) {
31888
+ function up410(db) {
31728
31889
  addColumnIfMissing210(db, "memories", "why", "TEXT");
31729
31890
  addColumnIfMissing210(db, "memories", "project", "TEXT");
31730
31891
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -31761,7 +31922,7 @@ function addColumnIfMissing32(db, table, column, definition) {
31761
31922
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31762
31923
  }
31763
31924
  }
31764
- function up410(db) {
31925
+ function up510(db) {
31765
31926
  addColumnIfMissing32(db, "memory_history", "actor_type", "TEXT");
31766
31927
  addColumnIfMissing32(db, "memory_history", "session_id", "TEXT");
31767
31928
  addColumnIfMissing32(db, "memory_history", "request_id", "TEXT");
@@ -31794,7 +31955,7 @@ function addColumnIfMissing42(db, table, column, definition) {
31794
31955
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31795
31956
  }
31796
31957
  }
31797
- function up510(db) {
31958
+ function up610(db) {
31798
31959
  addColumnIfMissing42(db, "entities", "canonical_name", "TEXT");
31799
31960
  addColumnIfMissing42(db, "entities", "mentions", "INTEGER DEFAULT 0");
31800
31961
  addColumnIfMissing42(db, "entities", "embedding", "BLOB");
@@ -31811,7 +31972,7 @@ function hasColumn42(db, table, column) {
31811
31972
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31812
31973
  return rows.some((r3) => r3.name === column);
31813
31974
  }
31814
- function up610(db) {
31975
+ function up710(db) {
31815
31976
  if (!hasColumn42(db, "memories", "idempotency_key")) {
31816
31977
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
31817
31978
  }
@@ -31826,7 +31987,7 @@ function hasColumn52(db, table, column) {
31826
31987
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31827
31988
  return rows.some((r3) => r3.name === column);
31828
31989
  }
31829
- function up710(db) {
31990
+ function up810(db) {
31830
31991
  db.exec(`
31831
31992
  CREATE TABLE IF NOT EXISTS documents (
31832
31993
  id TEXT PRIMARY KEY,
@@ -31883,7 +32044,7 @@ function up710(db) {
31883
32044
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
31884
32045
  }
31885
32046
  }
31886
- function up810(db) {
32047
+ function up910(db) {
31887
32048
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
31888
32049
  if (tables.length === 0)
31889
32050
  return;
@@ -31900,7 +32061,7 @@ function up810(db) {
31900
32061
  ON embeddings(content_hash)
31901
32062
  `);
31902
32063
  }
31903
- function up910(db) {
32064
+ function up1010(db) {
31904
32065
  db.exec(`
31905
32066
  CREATE TABLE IF NOT EXISTS summary_jobs (
31906
32067
  id TEXT PRIMARY KEY,
@@ -31920,7 +32081,7 @@ function up910(db) {
31920
32081
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
31921
32082
  ON summary_jobs(status)`);
31922
32083
  }
31923
- function up1010(db) {
32084
+ function up1110(db) {
31924
32085
  db.exec(`
31925
32086
  CREATE TABLE IF NOT EXISTS umap_cache (
31926
32087
  id INTEGER PRIMARY KEY,
@@ -31931,7 +32092,7 @@ function up1010(db) {
31931
32092
  )
31932
32093
  `);
31933
32094
  }
31934
- function up1110(db) {
32095
+ function up1210(db) {
31935
32096
  db.exec(`
31936
32097
  CREATE TABLE IF NOT EXISTS session_scores (
31937
32098
  id TEXT PRIMARY KEY,
@@ -31951,7 +32112,7 @@ function up1110(db) {
31951
32112
  ON session_scores(session_key);
31952
32113
  `);
31953
32114
  }
31954
- function up1210(db) {
32115
+ function up1310(db) {
31955
32116
  db.exec(`
31956
32117
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
31957
32118
  id TEXT PRIMARY KEY,
@@ -31992,7 +32153,7 @@ function addColumnIfMissing52(db, table, column, definition) {
31992
32153
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31993
32154
  }
31994
32155
  }
31995
- function up1310(db) {
32156
+ function up1410(db) {
31996
32157
  db.exec(`
31997
32158
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
31998
32159
  id TEXT PRIMARY KEY,
@@ -32018,7 +32179,7 @@ function up1310(db) {
32018
32179
  addColumnIfMissing52(db, "memories", "source_path", "TEXT");
32019
32180
  addColumnIfMissing52(db, "memories", "source_section", "TEXT");
32020
32181
  }
32021
- function up1410(db) {
32182
+ function up153(db) {
32022
32183
  db.exec(`
32023
32184
  CREATE TABLE IF NOT EXISTS telemetry_events (
32024
32185
  id TEXT PRIMARY KEY,
@@ -32043,7 +32204,7 @@ function addColumnIfMissing62(db, table, column, definition) {
32043
32204
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32044
32205
  }
32045
32206
  }
32046
- function up152(db) {
32207
+ function up162(db) {
32047
32208
  db.exec(`
32048
32209
  CREATE TABLE IF NOT EXISTS session_memories (
32049
32210
  id TEXT PRIMARY KEY,
@@ -32070,7 +32231,7 @@ function up152(db) {
32070
32231
  addColumnIfMissing62(db, "session_scores", "confidence", "REAL");
32071
32232
  addColumnIfMissing62(db, "session_scores", "continuity_reasoning", "TEXT");
32072
32233
  }
32073
- function up162(db) {
32234
+ function up172(db) {
32074
32235
  db.exec(`
32075
32236
  CREATE TABLE IF NOT EXISTS session_checkpoints (
32076
32237
  id TEXT PRIMARY KEY,
@@ -32092,7 +32253,7 @@ function up162(db) {
32092
32253
  ON session_checkpoints(project_normalized, created_at DESC);
32093
32254
  `);
32094
32255
  }
32095
- function up172(db) {
32256
+ function up182(db) {
32096
32257
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
32097
32258
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
32098
32259
  if (!colNames.has("skill_name")) {
@@ -32103,7 +32264,7 @@ function up172(db) {
32103
32264
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
32104
32265
  }
32105
32266
  }
32106
- function up182(db) {
32267
+ function up192(db) {
32107
32268
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
32108
32269
  if (existing)
32109
32270
  return;
@@ -32135,7 +32296,7 @@ function up182(db) {
32135
32296
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
32136
32297
  `);
32137
32298
  }
32138
- function up192(db) {
32299
+ function up202(db) {
32139
32300
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
32140
32301
  const entityColNames = new Set(entityCols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
32141
32302
  if (!entityColNames.has("agent_id")) {
@@ -32220,13 +32381,13 @@ function addColumnIfMissing72(db, table, column, definition) {
32220
32381
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32221
32382
  }
32222
32383
  }
32223
- function up202(db) {
32384
+ function up212(db) {
32224
32385
  addColumnIfMissing72(db, "session_memories", "entity_slot", "INTEGER");
32225
32386
  addColumnIfMissing72(db, "session_memories", "aspect_slot", "INTEGER");
32226
32387
  addColumnIfMissing72(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
32227
32388
  addColumnIfMissing72(db, "session_memories", "structural_density", "INTEGER");
32228
32389
  }
32229
- function up212(db) {
32390
+ function up222(db) {
32230
32391
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
32231
32392
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
32232
32393
  if (!columnNames.has("focal_entity_ids")) {
@@ -32251,25 +32412,25 @@ function addColumnIfMissing82(db, table, column, definition) {
32251
32412
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32252
32413
  }
32253
32414
  }
32254
- function up222(db) {
32415
+ function up232(db) {
32255
32416
  addColumnIfMissing82(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
32256
32417
  addColumnIfMissing82(db, "entities", "pinned_at", "TEXT");
32257
32418
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
32258
32419
  }
32259
- function up232(_db) {}
32260
32420
  function up242(_db) {}
32421
+ function up252(_db) {}
32261
32422
  function addColumnIfMissing92(db, table, column, definition) {
32262
32423
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
32263
32424
  if (!cols.some((c3) => c3.name === column)) {
32264
32425
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32265
32426
  }
32266
32427
  }
32267
- function up252(db) {
32428
+ function up262(db) {
32268
32429
  addColumnIfMissing92(db, "session_memories", "agent_relevance_score", "REAL");
32269
32430
  addColumnIfMissing92(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
32270
32431
  }
32271
- function up262(_db) {}
32272
- function up272(db) {
32432
+ function up272(_db) {}
32433
+ function up282(db) {
32273
32434
  db.exec(`
32274
32435
  UPDATE entities
32275
32436
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -32278,7 +32439,7 @@ function up272(db) {
32278
32439
  WHERE canonical_name IS NULL
32279
32440
  `);
32280
32441
  }
32281
- function up282(db) {
32442
+ function up292(db) {
32282
32443
  db.exec(`
32283
32444
  CREATE TABLE IF NOT EXISTS memories_cold (
32284
32445
  archive_id TEXT PRIMARY KEY,
@@ -32315,7 +32476,7 @@ function up282(db) {
32315
32476
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
32316
32477
  `);
32317
32478
  }
32318
- function up292(db) {
32479
+ function up302(db) {
32319
32480
  db.exec(`
32320
32481
  CREATE TABLE IF NOT EXISTS session_summaries (
32321
32482
  id TEXT PRIMARY KEY,
@@ -32360,7 +32521,7 @@ function up292(db) {
32360
32521
  WHERE session_key IS NOT NULL;
32361
32522
  `);
32362
32523
  }
32363
- function up302(db) {
32524
+ function up312(db) {
32364
32525
  db.exec(`
32365
32526
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
32366
32527
  id TEXT PRIMARY KEY,
@@ -32405,7 +32566,7 @@ function up302(db) {
32405
32566
  ON memory_jobs(failed_at);
32406
32567
  `);
32407
32568
  }
32408
- function up312(db) {
32569
+ function up322(db) {
32409
32570
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
32410
32571
  if (!depCols.some((c3) => c3.name === "reason")) {
32411
32572
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -32415,7 +32576,7 @@ function up312(db) {
32415
32576
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
32416
32577
  }
32417
32578
  }
32418
- function up322(db) {
32579
+ function up332(db) {
32419
32580
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
32420
32581
  if (cols.length === 0)
32421
32582
  return;
@@ -32423,14 +32584,14 @@ function up322(db) {
32423
32584
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
32424
32585
  }
32425
32586
  }
32426
- function up332(db) {
32587
+ function up342(db) {
32427
32588
  const cols = db.prepare("PRAGMA table_info(memories)").all();
32428
32589
  if (!cols.some((c3) => c3.name === "scope")) {
32429
32590
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
32430
32591
  }
32431
32592
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
32432
32593
  }
32433
- function up342(db) {
32594
+ function up352(db) {
32434
32595
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
32435
32596
  db.exec(`
32436
32597
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -32438,7 +32599,7 @@ function up342(db) {
32438
32599
  WHERE content_hash IS NOT NULL AND is_deleted = 0
32439
32600
  `);
32440
32601
  }
32441
- function up352(db) {
32602
+ function up362(db) {
32442
32603
  db.exec(`
32443
32604
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
32444
32605
  name, canonical_name,
@@ -32470,13 +32631,13 @@ function up352(db) {
32470
32631
  END
32471
32632
  `);
32472
32633
  }
32473
- function up362(db) {
32634
+ function up372(db) {
32474
32635
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
32475
32636
  if (!cols.some((c3) => c3.name === "confidence")) {
32476
32637
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
32477
32638
  }
32478
32639
  }
32479
- function up372(db) {
32640
+ function up382(db) {
32480
32641
  db.exec(`
32481
32642
  CREATE TABLE IF NOT EXISTS entity_communities (
32482
32643
  id TEXT PRIMARY KEY,
@@ -32494,7 +32655,7 @@ function up372(db) {
32494
32655
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
32495
32656
  }
32496
32657
  }
32497
- function up382(db) {
32658
+ function up392(db) {
32498
32659
  db.exec(`
32499
32660
  CREATE TABLE IF NOT EXISTS memory_hints (
32500
32661
  id TEXT PRIMARY KEY,
@@ -32534,7 +32695,7 @@ function up382(db) {
32534
32695
  END
32535
32696
  `);
32536
32697
  }
32537
- function up392(db) {
32698
+ function up402(db) {
32538
32699
  db.exec(`
32539
32700
  DELETE FROM entity_dependencies
32540
32701
  WHERE id NOT IN (
@@ -32552,7 +32713,7 @@ function up392(db) {
32552
32713
  )
32553
32714
  `);
32554
32715
  }
32555
- function up402(db) {
32716
+ function up412(db) {
32556
32717
  db.exec(`
32557
32718
  CREATE TABLE IF NOT EXISTS session_transcripts (
32558
32719
  session_key TEXT PRIMARY KEY,
@@ -32575,7 +32736,7 @@ function addColumnIfMissing102(db, table, column, definition) {
32575
32736
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32576
32737
  }
32577
32738
  }
32578
- function up412(db) {
32739
+ function up422(db) {
32579
32740
  addColumnIfMissing102(db, "session_memories", "path_json", "TEXT");
32580
32741
  db.exec(`
32581
32742
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -32650,7 +32811,7 @@ function addColumnIfMissing112(db, table, column, definition) {
32650
32811
  return;
32651
32812
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32652
32813
  }
32653
- function up422(db) {
32814
+ function up432(db) {
32654
32815
  addColumnIfMissing112(db, "session_memories", "entity_slot", "INTEGER");
32655
32816
  addColumnIfMissing112(db, "session_memories", "aspect_slot", "INTEGER");
32656
32817
  addColumnIfMissing112(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -32738,7 +32899,7 @@ function addColumnIfMissing122(db, table, column, definition) {
32738
32899
  return;
32739
32900
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32740
32901
  }
32741
- function up432(db) {
32902
+ function up442(db) {
32742
32903
  db.exec(`
32743
32904
  CREATE TABLE IF NOT EXISTS agents (
32744
32905
  id TEXT PRIMARY KEY,
@@ -32767,7 +32928,7 @@ function addColumnIfMissing132(db, table, column, definition) {
32767
32928
  return;
32768
32929
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32769
32930
  }
32770
- function up442(db) {
32931
+ function up452(db) {
32771
32932
  addColumnIfMissing132(db, "session_summaries", "source_type", "TEXT");
32772
32933
  addColumnIfMissing132(db, "session_summaries", "source_ref", "TEXT");
32773
32934
  addColumnIfMissing132(db, "session_summaries", "meta_json", "TEXT");
@@ -32793,7 +32954,7 @@ function addColumnIfMissing142(db, table, column, definition) {
32793
32954
  return;
32794
32955
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32795
32956
  }
32796
- function up452(db) {
32957
+ function up462(db) {
32797
32958
  addColumnIfMissing142(db, "session_transcripts", "updated_at", "TEXT");
32798
32959
  addColumnIfMissing142(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
32799
32960
  addColumnIfMissing142(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -32864,7 +33025,7 @@ function up452(db) {
32864
33025
  ON memory_md_heads(lease_expires_at);
32865
33026
  `);
32866
33027
  }
32867
- function up462(db) {
33028
+ function up472(db) {
32868
33029
  db.exec(`
32869
33030
  DROP INDEX IF EXISTS idx_summaries_session_depth;
32870
33031
 
@@ -32925,7 +33086,7 @@ function up462(db) {
32925
33086
  AND COALESCE(source_type, 'summary') = 'summary';
32926
33087
  `);
32927
33088
  }
32928
- function up472(db) {
33089
+ function up482(db) {
32929
33090
  db.exec(`
32930
33091
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
32931
33092
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -33023,7 +33184,7 @@ function up472(db) {
33023
33184
  AND COALESCE(source_type, 'summary') = 'summary';
33024
33185
  `);
33025
33186
  }
33026
- function up482(db) {
33187
+ function up492(db) {
33027
33188
  db.exec(`
33028
33189
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
33029
33190
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -33141,7 +33302,7 @@ function up482(db) {
33141
33302
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
33142
33303
  `);
33143
33304
  }
33144
- function up492(db) {
33305
+ function up502(db) {
33145
33306
  db.exec(`
33146
33307
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
33147
33308
  session_key TEXT NOT NULL,
@@ -33158,7 +33319,7 @@ function hasTable5(db, name) {
33158
33319
  WHERE type = 'table' AND name = ?
33159
33320
  LIMIT 1`).get(name) !== undefined;
33160
33321
  }
33161
- function up502(db) {
33322
+ function up512(db) {
33162
33323
  db.exec(`
33163
33324
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
33164
33325
  id TEXT PRIMARY KEY,
@@ -33328,7 +33489,7 @@ function addColumnIfMissing152(db, table, column, definition) {
33328
33489
  return;
33329
33490
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33330
33491
  }
33331
- function up512(db) {
33492
+ function up522(db) {
33332
33493
  addColumnIfMissing152(db, "summary_jobs", "session_id", "TEXT");
33333
33494
  addColumnIfMissing152(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
33334
33495
  addColumnIfMissing152(db, "summary_jobs", "captured_at", "TEXT");
@@ -33420,7 +33581,7 @@ function up512(db) {
33420
33581
  VALUES ('rebuild');
33421
33582
  `);
33422
33583
  }
33423
- function up522(db) {
33584
+ function up532(db) {
33424
33585
  db.exec(`
33425
33586
  CREATE TABLE IF NOT EXISTS mcp_invocations (
33426
33587
  id TEXT PRIMARY KEY,
@@ -33437,7 +33598,7 @@ function up522(db) {
33437
33598
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
33438
33599
  `);
33439
33600
  }
33440
- function up532(db) {
33601
+ function up542(db) {
33441
33602
  db.exec(`
33442
33603
  CREATE TABLE IF NOT EXISTS skill_invocations (
33443
33604
  id TEXT PRIMARY KEY,
@@ -33453,7 +33614,7 @@ function up532(db) {
33453
33614
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
33454
33615
  `);
33455
33616
  }
33456
- function up542(db) {
33617
+ function up552(db) {
33457
33618
  db.exec(`
33458
33619
  CREATE TABLE IF NOT EXISTS task_scope_hints (
33459
33620
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -33484,7 +33645,7 @@ function up542(db) {
33484
33645
  ON task_scope_hints(agent_id, updated_at);
33485
33646
  `);
33486
33647
  }
33487
- function up552(db) {
33648
+ function up562(db) {
33488
33649
  db.exec(`
33489
33650
  CREATE TABLE IF NOT EXISTS dreaming_state (
33490
33651
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -33527,7 +33688,7 @@ function ensureMemoriesScopeColumns3(db) {
33527
33688
  if (!names.has("scope"))
33528
33689
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
33529
33690
  }
33530
- function up562(db) {
33691
+ function up572(db) {
33531
33692
  ensureMemoriesScopeColumns3(db);
33532
33693
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
33533
33694
  db.exec(`
@@ -33540,20 +33701,20 @@ function up562(db) {
33540
33701
  WHERE content_hash IS NOT NULL AND is_deleted = 0
33541
33702
  `);
33542
33703
  }
33543
- function up572(db) {
33704
+ function up582(db) {
33544
33705
  const sql = readMemoriesFtsSql2(db);
33545
33706
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
33546
33707
  return;
33547
33708
  recreateMemoriesFts2(db);
33548
33709
  }
33549
- function up582(db) {
33710
+ function up592(db) {
33550
33711
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
33551
33712
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
33552
33713
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
33553
33714
  ON entities(entity_type, mentions)
33554
33715
  WHERE entity_type = 'extracted'`);
33555
33716
  }
33556
- function up592(db) {
33717
+ function up602(db) {
33557
33718
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
33558
33719
  if (!cols.some((col) => col.name === "claim_key")) {
33559
33720
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -33562,7 +33723,7 @@ function up592(db) {
33562
33723
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
33563
33724
  WHERE claim_key IS NOT NULL`);
33564
33725
  }
33565
- function up602(db) {
33726
+ function up612(db) {
33566
33727
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
33567
33728
  if (!cols.some((col) => col.name === "group_key")) {
33568
33729
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -33574,13 +33735,13 @@ function up602(db) {
33574
33735
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
33575
33736
  WHERE claim_key IS NOT NULL`);
33576
33737
  }
33577
- function up612(db) {
33738
+ function up622(db) {
33578
33739
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
33579
33740
  if (cols.some((col) => col.name === "source_mtime_ms"))
33580
33741
  return;
33581
33742
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
33582
33743
  }
33583
- function up622(db) {
33744
+ function up632(db) {
33584
33745
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
33585
33746
  const names = new Set(cols.map((col) => col.name));
33586
33747
  if (!names.has("is_deleted")) {
@@ -33594,7 +33755,7 @@ function up622(db) {
33594
33755
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
33595
33756
  `);
33596
33757
  }
33597
- function up632(db) {
33758
+ function up642(db) {
33598
33759
  db.exec("DROP TRIGGER IF EXISTS memories_au");
33599
33760
  db.exec(`
33600
33761
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -33612,7 +33773,7 @@ function addColumnIfMissing162(db, table, column, definition) {
33612
33773
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33613
33774
  }
33614
33775
  }
33615
- function up642(db) {
33776
+ function up652(db) {
33616
33777
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
33617
33778
  addColumnIfMissing162(db, table, "source_id", "TEXT");
33618
33779
  addColumnIfMissing162(db, table, "source_kind", "TEXT");
@@ -33632,7 +33793,7 @@ function hasColumn72(db, table, column) {
33632
33793
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
33633
33794
  return rows.some((row) => row.name === column);
33634
33795
  }
33635
- function up652(db) {
33796
+ function up662(db) {
33636
33797
  if (!hasTable22(db, "embeddings"))
33637
33798
  return;
33638
33799
  if (!hasColumn72(db, "embeddings", "agent_id")) {
@@ -33640,7 +33801,7 @@ function up652(db) {
33640
33801
  }
33641
33802
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
33642
33803
  }
33643
- function up662(db) {
33804
+ function up672(db) {
33644
33805
  db.exec(`
33645
33806
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
33646
33807
  id TEXT PRIMARY KEY,
@@ -33681,7 +33842,7 @@ function addColumnIfMissing172(db, table, column, definition) {
33681
33842
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33682
33843
  }
33683
33844
  }
33684
- function up672(db) {
33845
+ function up682(db) {
33685
33846
  db.exec(`
33686
33847
  CREATE TABLE IF NOT EXISTS ontology_proposals (
33687
33848
  id TEXT PRIMARY KEY,
@@ -33724,7 +33885,7 @@ function up672(db) {
33724
33885
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
33725
33886
  }
33726
33887
  }
33727
- function up682(db) {
33888
+ function up692(db) {
33728
33889
  db.exec(`
33729
33890
  CREATE TABLE IF NOT EXISTS daily_reflections (
33730
33891
  id TEXT PRIMARY KEY,
@@ -33751,7 +33912,7 @@ function up682(db) {
33751
33912
  WHERE content_key IS NOT NULL;
33752
33913
  `);
33753
33914
  }
33754
- function up692(db) {
33915
+ function up702(db) {
33755
33916
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
33756
33917
  const colNames = new Set(cols.flatMap((c3) => typeof c3.name === "string" ? [c3.name] : []));
33757
33918
  if (!colNames.has("content_key")) {
@@ -33788,7 +33949,7 @@ function backfillVersionRoots2(db) {
33788
33949
  WHERE version_root_id IS NULL
33789
33950
  `);
33790
33951
  }
33791
- function up702(db) {
33952
+ function up712(db) {
33792
33953
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
33793
33954
  addColumnIfMissing182(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
33794
33955
  addColumnIfMissing182(db, table, "archived_at", "TEXT");
@@ -33823,7 +33984,7 @@ function up702(db) {
33823
33984
  ON entity_aspects(agent_id, proposal_id);
33824
33985
  `);
33825
33986
  }
33826
- function up712(db) {
33987
+ function up722(db) {
33827
33988
  db.exec(`
33828
33989
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
33829
33990
  id TEXT PRIMARY KEY,
@@ -33879,7 +34040,7 @@ function ensureMemoriesScopeColumns22(db) {
33879
34040
  if (!names.has("runtime_path"))
33880
34041
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
33881
34042
  }
33882
- function up722(db) {
34043
+ function up732(db) {
33883
34044
  ensureMemoriesScopeColumns22(db);
33884
34045
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
33885
34046
  db.exec(`
@@ -33893,7 +34054,7 @@ function up722(db) {
33893
34054
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
33894
34055
  `);
33895
34056
  }
33896
- function up732(db) {
34057
+ function up742(db) {
33897
34058
  db.exec(`
33898
34059
  CREATE TABLE IF NOT EXISTS session_context_epochs (
33899
34060
  session_key TEXT NOT NULL,
@@ -33928,7 +34089,7 @@ function up732(db) {
33928
34089
  ON session_recall_events(item_kind, item_id, created_at DESC);
33929
34090
  `);
33930
34091
  }
33931
- function up742(db) {
34092
+ function up752(db) {
33932
34093
  db.exec(`
33933
34094
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
33934
34095
  aggregate_memory_id TEXT NOT NULL,
@@ -33947,7 +34108,7 @@ function addColumnIfMissing192(db, table, column, definition) {
33947
34108
  return;
33948
34109
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33949
34110
  }
33950
- function up752(db) {
34111
+ function up762(db) {
33951
34112
  addColumnIfMissing192(db, "memory_artifacts", "source_id", "TEXT");
33952
34113
  addColumnIfMissing192(db, "memory_artifacts", "source_root", "TEXT");
33953
34114
  addColumnIfMissing192(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -33960,7 +34121,7 @@ function up752(db) {
33960
34121
  ON memory_artifacts(agent_id, source_id, source_root);
33961
34122
  `);
33962
34123
  }
33963
- function up762(db) {
34124
+ function up772(db) {
33964
34125
  db.exec(`
33965
34126
  CREATE TABLE IF NOT EXISTS temporal_edges (
33966
34127
  id TEXT PRIMARY KEY,
@@ -33983,7 +34144,7 @@ function up762(db) {
33983
34144
  ON temporal_edges(agent_id, subject_type, subject_id);
33984
34145
  `);
33985
34146
  }
33986
- function up772(db) {
34147
+ function up782(db) {
33987
34148
  db.exec(`
33988
34149
  CREATE TABLE IF NOT EXISTS entity_aliases (
33989
34150
  id TEXT PRIMARY KEY,
@@ -34007,7 +34168,7 @@ function up772(db) {
34007
34168
  ON entity_aliases(agent_id, canonical_alias, status);
34008
34169
  `);
34009
34170
  }
34010
- function up782(db) {
34171
+ function up792(db) {
34011
34172
  db.exec(`
34012
34173
  CREATE TABLE IF NOT EXISTS api_keys (
34013
34174
  id TEXT PRIMARY KEY,
@@ -34035,7 +34196,7 @@ function up782(db) {
34035
34196
  ON api_keys(connector, harness);
34036
34197
  `);
34037
34198
  }
34038
- function up792(db) {
34199
+ function up802(db) {
34039
34200
  db.exec(`
34040
34201
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
34041
34202
  id TEXT PRIMARY KEY,
@@ -34070,7 +34231,7 @@ function hasColumn102(db, table, column) {
34070
34231
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
34071
34232
  return rows.some((row) => row.name === column);
34072
34233
  }
34073
- function up802(db) {
34234
+ function up812(db) {
34074
34235
  if (!hasColumn102(db, "documents", "agent_id")) {
34075
34236
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
34076
34237
  }
@@ -34156,7 +34317,7 @@ function up802(db) {
34156
34317
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
34157
34318
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
34158
34319
  }
34159
- function up812(db) {
34320
+ function up822(db) {
34160
34321
  db.exec(`
34161
34322
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
34162
34323
  aggregate_memory_id TEXT NOT NULL,
@@ -34178,7 +34339,7 @@ function hasColumn112(db, table, column) {
34178
34339
  return rows.some((row) => row.name === column);
34179
34340
  }
34180
34341
  var COLUMNS3 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
34181
- function up822(db) {
34342
+ function up832(db) {
34182
34343
  for (const column of COLUMNS3) {
34183
34344
  if (!hasColumn112(db, "skill_invocations", column)) {
34184
34345
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -34259,7 +34420,7 @@ function documentScopeColumnsPreservingExisting2(db) {
34259
34420
  `);
34260
34421
  }
34261
34422
  try {
34262
- up802(db);
34423
+ up812(db);
34263
34424
  if (preserveAgentId) {
34264
34425
  db.exec(`
34265
34426
  UPDATE documents
@@ -34279,12 +34440,12 @@ function documentScopeColumnsPreservingExisting2(db) {
34279
34440
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
34280
34441
  }
34281
34442
  }
34282
- function up832(db) {
34283
- up792(db);
34443
+ function up842(db) {
34444
+ up802(db);
34284
34445
  if (hasTable32(db, "documents")) {
34285
34446
  documentScopeColumnsPreservingExisting2(db);
34286
34447
  }
34287
- up812(db);
34448
+ up822(db);
34288
34449
  addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
34289
34450
  addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
34290
34451
  addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
@@ -34341,7 +34502,7 @@ function up832(db) {
34341
34502
  AND ${sourceAgentId} = ${targetAgentId}
34342
34503
  `);
34343
34504
  }
34344
- function up842(db) {
34505
+ function up852(db) {
34345
34506
  db.exec(`
34346
34507
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
34347
34508
  path TEXT PRIMARY KEY,
@@ -34371,7 +34532,7 @@ function up842(db) {
34371
34532
  ON legacy_markdown_chunks(memory_id);
34372
34533
  `);
34373
34534
  }
34374
- function up852(db) {
34535
+ function up862(db) {
34375
34536
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
34376
34537
  const tableNames = new Set(tables.map((r3) => String(r3.name)));
34377
34538
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -34430,7 +34591,7 @@ function addColumnIfMissing212(db, table, column, definition) {
34430
34591
  return;
34431
34592
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34432
34593
  }
34433
- function up862(db) {
34594
+ function up872(db) {
34434
34595
  addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
34435
34596
  db.exec(`
34436
34597
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -34443,14 +34604,14 @@ function addColumnIfMissing222(db, table, column, definition) {
34443
34604
  return;
34444
34605
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34445
34606
  }
34446
- function up872(db) {
34607
+ function up882(db) {
34447
34608
  addColumnIfMissing222(db, "summary_jobs", "boundary_reason", "TEXT");
34448
34609
  db.exec(`
34449
34610
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
34450
34611
  ON summary_jobs(agent_id, session_key, boundary_reason)
34451
34612
  `);
34452
34613
  }
34453
- function up882(db) {
34614
+ function up892(db) {
34454
34615
  db.exec(`
34455
34616
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
34456
34617
  agent_id TEXT NOT NULL,
@@ -34468,7 +34629,7 @@ function up882(db) {
34468
34629
  ON transcript_capture_jobs(agent_id, session_id, status);
34469
34630
  `);
34470
34631
  }
34471
- function up892(db) {
34632
+ function up902(db) {
34472
34633
  db.exec(`
34473
34634
  CREATE TABLE IF NOT EXISTS job_cancellations (
34474
34635
  id TEXT PRIMARY KEY,
@@ -34496,7 +34657,7 @@ function indexExists3(db, table, indexName) {
34496
34657
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
34497
34658
  return rows.some((row) => row.name === indexName);
34498
34659
  }
34499
- function up902(db) {
34660
+ function up912(db) {
34500
34661
  db.exec(`
34501
34662
  CREATE TABLE IF NOT EXISTS job_archive (
34502
34663
  id TEXT PRIMARY KEY,
@@ -34523,7 +34684,7 @@ function indexExists22(db, table, indexName) {
34523
34684
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
34524
34685
  return rows.some((row) => row.name === indexName);
34525
34686
  }
34526
- function up912(db) {
34687
+ function up922(db) {
34527
34688
  db.exec(`
34528
34689
  CREATE TABLE IF NOT EXISTS embedding_index_state (
34529
34690
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -34536,7 +34697,7 @@ function up912(db) {
34536
34697
  )
34537
34698
  `);
34538
34699
  }
34539
- function up922(db) {
34700
+ function up932(db) {
34540
34701
  db.exec(`
34541
34702
  CREATE TABLE IF NOT EXISTS embeddings_staging (
34542
34703
  id TEXT PRIMARY KEY,
@@ -34555,7 +34716,7 @@ function up922(db) {
34555
34716
  ON embeddings_staging(agent_id, source_type, source_id);
34556
34717
  `);
34557
34718
  }
34558
- function up932(db) {
34719
+ function up942(db) {
34559
34720
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
34560
34721
  if (!columns.some((column) => column.name === "evidence_cursor")) {
34561
34722
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -34566,7 +34727,7 @@ function hasColumn132(db, table, column) {
34566
34727
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
34567
34728
  return rows.some((r3) => r3.name === column);
34568
34729
  }
34569
- function up942(db) {
34730
+ function up952(db) {
34570
34731
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
34571
34732
  if (tables.length === 0)
34572
34733
  return;
@@ -34591,23 +34752,23 @@ function up942(db) {
34591
34752
  function hasColumn142(db, table, column) {
34592
34753
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
34593
34754
  }
34594
- function up952(db) {
34755
+ function up962(db) {
34595
34756
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
34596
34757
  if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
34597
34758
  return;
34598
34759
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
34599
34760
  }
34600
- function up962(db) {
34761
+ function up972(db) {
34601
34762
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
34602
34763
  }
34603
- function up972(db) {
34764
+ function up982(db) {
34604
34765
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
34605
34766
  if (!columns.some((column) => column.name === "last_failure_at")) {
34606
34767
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
34607
34768
  }
34608
34769
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
34609
34770
  }
34610
- function up982(db) {
34771
+ function up992(db) {
34611
34772
  db.exec(`
34612
34773
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
34613
34774
  agent_id TEXT NOT NULL,
@@ -34624,7 +34785,7 @@ function up982(db) {
34624
34785
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
34625
34786
  `);
34626
34787
  }
34627
- function up992(db) {
34788
+ function up1002(db) {
34628
34789
  db.exec(`
34629
34790
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
34630
34791
  id TEXT PRIMARY KEY,
@@ -34644,7 +34805,7 @@ function up992(db) {
34644
34805
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
34645
34806
  `);
34646
34807
  }
34647
- function up1002(db) {
34808
+ function up1012(db) {
34648
34809
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
34649
34810
  if (!columns.some((column) => column.name === "evidence_window_json")) {
34650
34811
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -34653,7 +34814,7 @@ function up1002(db) {
34653
34814
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
34654
34815
  }
34655
34816
  }
34656
- function up1012(db) {
34817
+ function up1022(db) {
34657
34818
  db.exec(`
34658
34819
  CREATE TABLE IF NOT EXISTS dreaming_attention (
34659
34820
  id TEXT PRIMARY KEY,
@@ -34675,7 +34836,7 @@ function up1012(db) {
34675
34836
  function hasColumn152(db, table, column) {
34676
34837
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
34677
34838
  }
34678
- function up1022(db) {
34839
+ function up1032(db) {
34679
34840
  const requiredMemoryColumns = [
34680
34841
  "content_hash",
34681
34842
  "normalized_content",
@@ -34726,7 +34887,7 @@ function up1022(db) {
34726
34887
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
34727
34888
  `);
34728
34889
  }
34729
- function up1032(db) {
34890
+ function up1042(db) {
34730
34891
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
34731
34892
  if (tables.length !== 2)
34732
34893
  return;
@@ -34749,7 +34910,7 @@ function tableExists4(db, table) {
34749
34910
  function hasColumn162(db, table, column) {
34750
34911
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
34751
34912
  }
34752
- function up1042(db) {
34913
+ function up1052(db) {
34753
34914
  db.exec(`
34754
34915
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
34755
34916
  derived_memory_id TEXT NOT NULL,
@@ -34792,7 +34953,7 @@ function up1042(db) {
34792
34953
  `);
34793
34954
  }
34794
34955
  }
34795
- function up1052(db) {
34956
+ function up1062(db) {
34796
34957
  db.exec(`
34797
34958
  DROP TRIGGER IF EXISTS entities_fts_ai;
34798
34959
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -34881,7 +35042,7 @@ function up1052(db) {
34881
35042
  function hasColumn172(db, table, column) {
34882
35043
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
34883
35044
  }
34884
- function up1062(db) {
35045
+ function up1072(db) {
34885
35046
  if (!hasColumn172(db, "memories", "review_after")) {
34886
35047
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
34887
35048
  }
@@ -34897,14 +35058,14 @@ var TOKEN_COLUMNS2 = [
34897
35058
  ["tokens_cache_write", "INTEGER"],
34898
35059
  ["tokens_cost", "REAL"]
34899
35060
  ];
34900
- function up1072(db) {
35061
+ function up1082(db) {
34901
35062
  for (const [column, type] of TOKEN_COLUMNS2) {
34902
35063
  if (!hasColumn182(db, "dreaming_passes", column)) {
34903
35064
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
34904
35065
  }
34905
35066
  }
34906
35067
  }
34907
- function up1082(db) {
35068
+ function up1092(db) {
34908
35069
  db.exec(`
34909
35070
  CREATE TABLE IF NOT EXISTS embedding_usage (
34910
35071
  day TEXT NOT NULL,
@@ -34917,7 +35078,7 @@ function up1082(db) {
34917
35078
  );
34918
35079
  `);
34919
35080
  }
34920
- function up1092(db) {
35081
+ function up1102(db) {
34921
35082
  db.exec(`
34922
35083
  CREATE TABLE IF NOT EXISTS telemetry_install (
34923
35084
  id TEXT PRIMARY KEY,
@@ -34925,7 +35086,7 @@ function up1092(db) {
34925
35086
  );
34926
35087
  `);
34927
35088
  }
34928
- function up1102(db) {
35089
+ function up1112(db) {
34929
35090
  db.exec(`
34930
35091
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
34931
35092
  ON memory_entity_mentions(entity_id, memory_id);
@@ -34936,7 +35097,7 @@ function hasColumn192(db, table, column) {
34936
35097
  return rows.some((row) => row.name === column);
34937
35098
  }
34938
35099
  var COLUMNS22 = ["first_remember_at", "first_recall_at"];
34939
- function up1112(db) {
35100
+ function up1122(db) {
34940
35101
  for (const column of COLUMNS22) {
34941
35102
  if (!hasColumn192(db, "telemetry_install", column)) {
34942
35103
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -34952,7 +35113,7 @@ function addColumnIfMissing232(db, column, definition) {
34952
35113
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
34953
35114
  }
34954
35115
  }
34955
- function up1122(db) {
35116
+ function up1132(db) {
34956
35117
  addColumnIfMissing232(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
34957
35118
  addColumnIfMissing232(db, "claim_token", "TEXT");
34958
35119
  addColumnIfMissing232(db, "claimed_at", "TEXT");
@@ -34961,7 +35122,7 @@ function up1122(db) {
34961
35122
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
34962
35123
  `);
34963
35124
  }
34964
- function up1132(db) {
35125
+ function up1142(db) {
34965
35126
  db.exec(`
34966
35127
  CREATE TABLE IF NOT EXISTS session_claims (
34967
35128
  session_key TEXT NOT NULL,
@@ -34982,7 +35143,7 @@ function up1132(db) {
34982
35143
  ON session_claims(agent_id, state, expires_at);
34983
35144
  `);
34984
35145
  }
34985
- function up1142(db) {
35146
+ function up1152(db) {
34986
35147
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
34987
35148
  if (table == null)
34988
35149
  return;
@@ -34991,7 +35152,7 @@ function up1142(db) {
34991
35152
  ON entity_attributes(memory_id, agent_id, status, importance);
34992
35153
  `);
34993
35154
  }
34994
- function up1152(db) {
35155
+ function up1162(db) {
34995
35156
  db.exec(`
34996
35157
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
34997
35158
  id TEXT PRIMARY KEY,
@@ -35048,7 +35209,7 @@ function addColumnIfMissing242(db, column, definition) {
35048
35209
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
35049
35210
  }
35050
35211
  }
35051
- function up1162(db) {
35212
+ function up1172(db) {
35052
35213
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
35053
35214
  if (table == null)
35054
35215
  return;
@@ -35249,7 +35410,7 @@ function backfillTranscriptsFromSummaryJobs2(db) {
35249
35410
  insert.run(...values);
35250
35411
  }
35251
35412
  }
35252
- function up1172(db) {
35413
+ function up1182(db) {
35253
35414
  if (!hasTable42(db, "session_transcripts"))
35254
35415
  return;
35255
35416
  addColumnIfMissing252(db, "session_transcripts", "completed_at", "TEXT");
@@ -35302,7 +35463,7 @@ function up1172(db) {
35302
35463
  ON session_transcripts(agent_id, content_hash);
35303
35464
  `);
35304
35465
  }
35305
- function up1182(db) {
35466
+ function up1192(db) {
35306
35467
  db.exec(`
35307
35468
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
35308
35469
  ON memory_jobs(status)
@@ -35321,12 +35482,12 @@ function up1182(db) {
35321
35482
  function hasColumn222(db, table, column) {
35322
35483
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
35323
35484
  }
35324
- function up1192(db) {
35485
+ function up1202(db) {
35325
35486
  if (!hasColumn222(db, "telemetry_install", "last_seen_version")) {
35326
35487
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
35327
35488
  }
35328
35489
  }
35329
- function up1202(db) {
35490
+ function up1212(db) {
35330
35491
  db.exec(`
35331
35492
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
35332
35493
  agent_id TEXT NOT NULL,
@@ -35355,7 +35516,7 @@ function addColumnIfMissing262(db, column, definition) {
35355
35516
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
35356
35517
  }
35357
35518
  }
35358
- function up1212(db) {
35519
+ function up1222(db) {
35359
35520
  addColumnIfMissing262(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
35360
35521
  addColumnIfMissing262(db, "last_attempt_at", "TEXT");
35361
35522
  addColumnIfMissing262(db, "sent_at", "TEXT");
@@ -35376,7 +35537,7 @@ function up1212(db) {
35376
35537
  VALUES (1, CURRENT_TIMESTAMP);
35377
35538
  `);
35378
35539
  }
35379
- function up1222(db) {
35540
+ function up1232(db) {
35380
35541
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
35381
35542
  const names = new Set(columns.map((column) => column.name));
35382
35543
  if (!names.has("failure_class")) {
@@ -35393,7 +35554,7 @@ function up1222(db) {
35393
35554
  }
35394
35555
  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)");
35395
35556
  }
35396
- function up1232(db) {
35557
+ function up1242(db) {
35397
35558
  db.exec(`
35398
35559
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
35399
35560
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -35417,7 +35578,7 @@ function up1232(db) {
35417
35578
  ON embedding_index_failures(source_type, source_id);
35418
35579
  `);
35419
35580
  }
35420
- function up1242(db) {
35581
+ function up1252(db) {
35421
35582
  db.exec(`
35422
35583
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
35423
35584
  id TEXT PRIMARY KEY,
@@ -35467,7 +35628,7 @@ function backfillTable2(db, params) {
35467
35628
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
35468
35629
  backfill2(db, rows, params.sourceKind, params.scannedAt);
35469
35630
  }
35470
- function up1252(db) {
35631
+ function up1262(db) {
35471
35632
  db.exec(`
35472
35633
  CREATE TABLE IF NOT EXISTS memory_content_safety (
35473
35634
  agent_id TEXT NOT NULL,
@@ -35524,7 +35685,7 @@ function up1252(db) {
35524
35685
  scannedAt
35525
35686
  });
35526
35687
  }
35527
- function up1262(db) {
35688
+ function up1272(db) {
35528
35689
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
35529
35690
  if (!table)
35530
35691
  return;
@@ -35558,7 +35719,7 @@ function up1262(db) {
35558
35719
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
35559
35720
  `);
35560
35721
  }
35561
- function up1272(db) {
35722
+ function up1282(db) {
35562
35723
  db.exec(`
35563
35724
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
35564
35725
  id TEXT PRIMARY KEY,
@@ -35614,7 +35775,7 @@ function up1272(db) {
35614
35775
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
35615
35776
  `);
35616
35777
  }
35617
- function up1282(db) {
35778
+ function up1292(db) {
35618
35779
  db.exec(`
35619
35780
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
35620
35781
  ON memory_jobs(status, created_at)
@@ -35629,7 +35790,7 @@ function up1282(db) {
35629
35790
  function tableExists32(db, table) {
35630
35791
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
35631
35792
  }
35632
- function up1292(db) {
35793
+ function up1302(db) {
35633
35794
  if (!tableExists32(db, "memory_jobs"))
35634
35795
  return;
35635
35796
  if (!tableExists32(db, "job_cancellations")) {
@@ -35678,7 +35839,7 @@ function up1292(db) {
35678
35839
  AND status IN ('pending', 'leased');
35679
35840
  `);
35680
35841
  }
35681
- function up1302(db) {
35842
+ function up1312(db) {
35682
35843
  db.exec(`
35683
35844
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
35684
35845
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -35718,7 +35879,7 @@ function up1302(db) {
35718
35879
  END;
35719
35880
  `);
35720
35881
  }
35721
- function up1312(db) {
35882
+ function up1322(db) {
35722
35883
  db.exec(`
35723
35884
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
35724
35885
  agent_id TEXT NOT NULL,
@@ -35741,13 +35902,13 @@ function up1312(db) {
35741
35902
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
35742
35903
  `);
35743
35904
  }
35744
- function up1322(db) {
35905
+ function up1332(db) {
35745
35906
  db.exec(`
35746
35907
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
35747
35908
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
35748
35909
  `);
35749
35910
  }
35750
- function up1332(db) {
35911
+ function up1342(db) {
35751
35912
  db.exec(`
35752
35913
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
35753
35914
  id TEXT PRIMARY KEY,
@@ -35799,7 +35960,7 @@ function up1332(db) {
35799
35960
  if (!names.has("format_version"))
35800
35961
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
35801
35962
  }
35802
- function up1342(db) {
35963
+ function up1352(db) {
35803
35964
  db.exec(`
35804
35965
  CREATE TABLE memory_head_entries_v134 (
35805
35966
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -35817,7 +35978,7 @@ function up1342(db) {
35817
35978
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
35818
35979
  `);
35819
35980
  }
35820
- function up1352(db) {
35981
+ function up1362(db) {
35821
35982
  db.exec(`
35822
35983
  CREATE TABLE IF NOT EXISTS memory_head_publications (
35823
35984
  agent_id TEXT NOT NULL,
@@ -35833,7 +35994,7 @@ function up1352(db) {
35833
35994
  ON memory_head_publications(agent_id, status, revision DESC);
35834
35995
  `);
35835
35996
  }
35836
- function up1362(db) {
35997
+ function up1372(db) {
35837
35998
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r3) => r3.name));
35838
35999
  for (const [name, type] of [
35839
36000
  ["entry_id", "TEXT"],
@@ -35847,7 +36008,7 @@ function up1362(db) {
35847
36008
  }
35848
36009
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
35849
36010
  }
35850
- function up1372(db) {
36011
+ function up1382(db) {
35851
36012
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r3) => r3.name));
35852
36013
  for (const [name, type] of [
35853
36014
  ["head_revision", "INTEGER"],
@@ -35869,7 +36030,7 @@ function addColumnIfMissing272(db, table, column, definition) {
35869
36030
  if (!hasColumn252(db, table, column))
35870
36031
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
35871
36032
  }
35872
- function up1382(db) {
36033
+ function up1392(db) {
35873
36034
  addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
35874
36035
  db.exec(`
35875
36036
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -36174,7 +36335,7 @@ function up1382(db) {
36174
36335
  GROUP BY j.agent_id;
36175
36336
  `);
36176
36337
  }
36177
- function up1392(db) {
36338
+ function up1402(db) {
36178
36339
  db.exec(`
36179
36340
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
36180
36341
  agent_id TEXT NOT NULL,
@@ -36190,7 +36351,7 @@ function up1392(db) {
36190
36351
  ON native_source_sync_state(agent_id, status);
36191
36352
  `);
36192
36353
  }
36193
- function up1402(db) {
36354
+ function up1412(db) {
36194
36355
  db.exec(`
36195
36356
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
36196
36357
  agent_id TEXT NOT NULL,
@@ -36202,7 +36363,7 @@ function up1402(db) {
36202
36363
  );
36203
36364
  `);
36204
36365
  }
36205
- function up1412(db) {
36366
+ function up1422(db) {
36206
36367
  db.exec(`
36207
36368
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
36208
36369
  agent_id TEXT NOT NULL,
@@ -36216,13 +36377,13 @@ function up1412(db) {
36216
36377
  );
36217
36378
  `);
36218
36379
  }
36219
- function up1422(db) {
36380
+ function up1432(db) {
36220
36381
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
36221
36382
  if (!columns.some((column) => column.name === "frontier")) {
36222
36383
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
36223
36384
  }
36224
36385
  }
36225
- function up1432(db) {
36386
+ function up1442(db) {
36226
36387
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
36227
36388
  const additions = [
36228
36389
  ["migration_phase", "TEXT"],
@@ -36257,13 +36418,13 @@ function up1432(db) {
36257
36418
  `);
36258
36419
  }
36259
36420
  }
36260
- function up1442(db) {
36421
+ function up1452(db) {
36261
36422
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
36262
36423
  if (!columns.has("lease_token")) {
36263
36424
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
36264
36425
  }
36265
36426
  }
36266
- function up1452(db) {
36427
+ function up1462(db) {
36267
36428
  db.exec(`
36268
36429
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
36269
36430
  agent_id TEXT NOT NULL,
@@ -36281,7 +36442,7 @@ function up1452(db) {
36281
36442
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
36282
36443
  `);
36283
36444
  }
36284
- function up1462(db) {
36445
+ function up1472(db) {
36285
36446
  db.exec(`
36286
36447
  CREATE TABLE IF NOT EXISTS source_import_jobs (
36287
36448
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -36336,24 +36497,36 @@ function up1462(db) {
36336
36497
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
36337
36498
  `);
36338
36499
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
36339
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
36500
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
36501
+ let exists;
36502
+ try {
36503
+ exists = statement.get(column);
36504
+ } finally {
36505
+ statement.finalize?.();
36506
+ }
36340
36507
  if (exists == null)
36341
36508
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
36342
36509
  }
36343
36510
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
36344
36511
  }
36345
- function up1472(db) {
36512
+ function up1482(db) {
36346
36513
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
36347
36514
  }
36348
- function up1482(db) {
36515
+ function up1492(db) {
36349
36516
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
36350
36517
  if (!columns.some((column) => column.name === "source_id")) {
36351
36518
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
36352
36519
  }
36353
36520
  }
36354
- function up1492(db) {
36521
+ function up1502(db) {
36355
36522
  const addColumn = (table, column, definition) => {
36356
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
36523
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
36524
+ let exists;
36525
+ try {
36526
+ exists = statement.get(table, column);
36527
+ } finally {
36528
+ statement.finalize?.();
36529
+ }
36357
36530
  if (exists == null)
36358
36531
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
36359
36532
  };
@@ -36366,7 +36539,7 @@ function addColumnIfMissing282(db, table, column, definition) {
36366
36539
  if (!columns.some((row) => row.name === column))
36367
36540
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
36368
36541
  }
36369
- function up1502(db) {
36542
+ function up1512(db) {
36370
36543
  addColumnIfMissing282(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
36371
36544
  addColumnIfMissing282(db, "dreaming_passes", "head_base_revision", "INTEGER");
36372
36545
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -36520,13 +36693,13 @@ var MIGRATIONS2 = [
36520
36693
  {
36521
36694
  version: 1,
36522
36695
  name: "baseline",
36523
- up: up151,
36696
+ up: up210,
36524
36697
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
36525
36698
  },
36526
36699
  {
36527
36700
  version: 2,
36528
36701
  name: "pipeline-v2",
36529
- up: up210,
36702
+ up: up310,
36530
36703
  artifacts: {
36531
36704
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
36532
36705
  }
@@ -36534,12 +36707,12 @@ var MIGRATIONS2 = [
36534
36707
  {
36535
36708
  version: 3,
36536
36709
  name: "unique-content-hash",
36537
- up: up310
36710
+ up: up410
36538
36711
  },
36539
36712
  {
36540
36713
  version: 4,
36541
36714
  name: "history-actor-and-retention",
36542
- up: up410,
36715
+ up: up510,
36543
36716
  artifacts: {
36544
36717
  columns: [{ table: "memory_history", column: "actor_type" }]
36545
36718
  }
@@ -36547,7 +36720,7 @@ var MIGRATIONS2 = [
36547
36720
  {
36548
36721
  version: 5,
36549
36722
  name: "graph-extended",
36550
- up: up510,
36723
+ up: up610,
36551
36724
  artifacts: {
36552
36725
  columns: [{ table: "entities", column: "canonical_name" }]
36553
36726
  }
@@ -36555,7 +36728,7 @@ var MIGRATIONS2 = [
36555
36728
  {
36556
36729
  version: 6,
36557
36730
  name: "idempotency-key",
36558
- up: up610,
36731
+ up: up710,
36559
36732
  artifacts: {
36560
36733
  columns: [{ table: "memories", column: "idempotency_key" }]
36561
36734
  }
@@ -36563,42 +36736,42 @@ var MIGRATIONS2 = [
36563
36736
  {
36564
36737
  version: 7,
36565
36738
  name: "documents-and-connectors",
36566
- up: up710,
36739
+ up: up810,
36567
36740
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
36568
36741
  },
36569
36742
  {
36570
36743
  version: 8,
36571
36744
  name: "embeddings-unique-hash",
36572
- up: up810
36745
+ up: up910
36573
36746
  },
36574
36747
  {
36575
36748
  version: 9,
36576
36749
  name: "summary-jobs",
36577
- up: up910,
36750
+ up: up1010,
36578
36751
  artifacts: { tables: ["summary_jobs"] }
36579
36752
  },
36580
36753
  {
36581
36754
  version: 10,
36582
36755
  name: "umap-cache",
36583
- up: up1010,
36756
+ up: up1110,
36584
36757
  artifacts: { tables: ["umap_cache"] }
36585
36758
  },
36586
36759
  {
36587
36760
  version: 11,
36588
36761
  name: "session-scores",
36589
- up: up1110,
36762
+ up: up1210,
36590
36763
  artifacts: { tables: ["session_scores"] }
36591
36764
  },
36592
36765
  {
36593
36766
  version: 12,
36594
36767
  name: "scheduled-tasks",
36595
- up: up1210,
36768
+ up: up1310,
36596
36769
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
36597
36770
  },
36598
36771
  {
36599
36772
  version: 13,
36600
36773
  name: "ingestion-tracking",
36601
- up: up1310,
36774
+ up: up1410,
36602
36775
  artifacts: {
36603
36776
  columns: [
36604
36777
  { table: "memories", column: "source_path" },
@@ -36609,13 +36782,13 @@ var MIGRATIONS2 = [
36609
36782
  {
36610
36783
  version: 14,
36611
36784
  name: "telemetry",
36612
- up: up1410,
36785
+ up: up153,
36613
36786
  artifacts: { tables: ["telemetry_events"] }
36614
36787
  },
36615
36788
  {
36616
36789
  version: 15,
36617
36790
  name: "session-memories",
36618
- up: up152,
36791
+ up: up162,
36619
36792
  artifacts: {
36620
36793
  tables: ["session_memories"],
36621
36794
  columns: [
@@ -36627,13 +36800,13 @@ var MIGRATIONS2 = [
36627
36800
  {
36628
36801
  version: 16,
36629
36802
  name: "session-checkpoints",
36630
- up: up162,
36803
+ up: up172,
36631
36804
  artifacts: { tables: ["session_checkpoints"] }
36632
36805
  },
36633
36806
  {
36634
36807
  version: 17,
36635
36808
  name: "task-skills",
36636
- up: up172,
36809
+ up: up182,
36637
36810
  artifacts: {
36638
36811
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
36639
36812
  }
@@ -36641,13 +36814,13 @@ var MIGRATIONS2 = [
36641
36814
  {
36642
36815
  version: 18,
36643
36816
  name: "skill-meta",
36644
- up: up182,
36817
+ up: up192,
36645
36818
  artifacts: { tables: ["skill_meta"] }
36646
36819
  },
36647
36820
  {
36648
36821
  version: 19,
36649
36822
  name: "knowledge-structure",
36650
- up: up192,
36823
+ up: up202,
36651
36824
  artifacts: {
36652
36825
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
36653
36826
  columns: [{ table: "entities", column: "agent_id" }]
@@ -36656,7 +36829,7 @@ var MIGRATIONS2 = [
36656
36829
  {
36657
36830
  version: 20,
36658
36831
  name: "session-structural-columns",
36659
- up: up202,
36832
+ up: up212,
36660
36833
  artifacts: {
36661
36834
  columns: [
36662
36835
  { table: "session_memories", column: "entity_slot" },
@@ -36669,7 +36842,7 @@ var MIGRATIONS2 = [
36669
36842
  {
36670
36843
  version: 21,
36671
36844
  name: "checkpoint-structural",
36672
- up: up212,
36845
+ up: up222,
36673
36846
  artifacts: {
36674
36847
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
36675
36848
  }
@@ -36677,7 +36850,7 @@ var MIGRATIONS2 = [
36677
36850
  {
36678
36851
  version: 22,
36679
36852
  name: "entity-pinning",
36680
- up: up222,
36853
+ up: up232,
36681
36854
  artifacts: {
36682
36855
  columns: [
36683
36856
  { table: "entities", column: "pinned" },
@@ -36688,17 +36861,17 @@ var MIGRATIONS2 = [
36688
36861
  {
36689
36862
  version: 23,
36690
36863
  name: "retired-scorer-gap",
36691
- up: up232
36864
+ up: up242
36692
36865
  },
36693
36866
  {
36694
36867
  version: 24,
36695
36868
  name: "retired-scorer-gap",
36696
- up: up242
36869
+ up: up252
36697
36870
  },
36698
36871
  {
36699
36872
  version: 25,
36700
36873
  name: "agent-feedback",
36701
- up: up252,
36874
+ up: up262,
36702
36875
  artifacts: {
36703
36876
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
36704
36877
  }
@@ -36706,32 +36879,32 @@ var MIGRATIONS2 = [
36706
36879
  {
36707
36880
  version: 26,
36708
36881
  name: "retired-scorer-gap",
36709
- up: up262
36882
+ up: up272
36710
36883
  },
36711
36884
  {
36712
36885
  version: 27,
36713
36886
  name: "backfill-canonical-names",
36714
- up: up272
36887
+ up: up282
36715
36888
  },
36716
36889
  {
36717
36890
  version: 28,
36718
36891
  name: "lossless-retention",
36719
- up: up282
36892
+ up: up292
36720
36893
  },
36721
36894
  {
36722
36895
  version: 29,
36723
36896
  name: "session-summary-dag",
36724
- up: up292
36897
+ up: up302
36725
36898
  },
36726
36899
  {
36727
36900
  version: 30,
36728
36901
  name: "nullable-memory-job-memory-id",
36729
- up: up302
36902
+ up: up312
36730
36903
  },
36731
36904
  {
36732
36905
  version: 31,
36733
36906
  name: "dependency-reason",
36734
- up: up312,
36907
+ up: up322,
36735
36908
  artifacts: {
36736
36909
  columns: [
36737
36910
  { table: "entity_dependencies", column: "reason" },
@@ -36742,7 +36915,7 @@ var MIGRATIONS2 = [
36742
36915
  {
36743
36916
  version: 32,
36744
36917
  name: "embeddings-vector-column",
36745
- up: up322,
36918
+ up: up332,
36746
36919
  artifacts: {
36747
36920
  columns: [{ table: "embeddings", column: "vector", optional: true }]
36748
36921
  }
@@ -36750,7 +36923,7 @@ var MIGRATIONS2 = [
36750
36923
  {
36751
36924
  version: 33,
36752
36925
  name: "scope",
36753
- up: up332,
36926
+ up: up342,
36754
36927
  artifacts: {
36755
36928
  columns: [{ table: "memories", column: "scope" }]
36756
36929
  }
@@ -36758,17 +36931,17 @@ var MIGRATIONS2 = [
36758
36931
  {
36759
36932
  version: 34,
36760
36933
  name: "scope-aware-dedup",
36761
- up: up342
36934
+ up: up352
36762
36935
  },
36763
36936
  {
36764
36937
  version: 35,
36765
36938
  name: "entity-fts",
36766
- up: up352
36939
+ up: up362
36767
36940
  },
36768
36941
  {
36769
36942
  version: 36,
36770
36943
  name: "dependency-confidence",
36771
- up: up362,
36944
+ up: up372,
36772
36945
  artifacts: {
36773
36946
  columns: [{ table: "entity_dependencies", column: "confidence" }]
36774
36947
  }
@@ -36776,7 +36949,7 @@ var MIGRATIONS2 = [
36776
36949
  {
36777
36950
  version: 37,
36778
36951
  name: "entity-communities",
36779
- up: up372,
36952
+ up: up382,
36780
36953
  artifacts: {
36781
36954
  tables: ["entity_communities"],
36782
36955
  columns: [{ table: "entities", column: "community_id" }]
@@ -36785,24 +36958,24 @@ var MIGRATIONS2 = [
36785
36958
  {
36786
36959
  version: 38,
36787
36960
  name: "memory-hints",
36788
- up: up382,
36961
+ up: up392,
36789
36962
  artifacts: { tables: ["memory_hints"] }
36790
36963
  },
36791
36964
  {
36792
36965
  version: 39,
36793
36966
  name: "dedup-entity-dependencies",
36794
- up: up392
36967
+ up: up402
36795
36968
  },
36796
36969
  {
36797
36970
  version: 40,
36798
36971
  name: "session-transcripts",
36799
- up: up402,
36972
+ up: up412,
36800
36973
  artifacts: { tables: ["session_transcripts"] }
36801
36974
  },
36802
36975
  {
36803
36976
  version: 41,
36804
36977
  name: "path-feedback",
36805
- up: up412,
36978
+ up: up422,
36806
36979
  artifacts: {
36807
36980
  tables: [
36808
36981
  "path_feedback_events",
@@ -36817,7 +36990,7 @@ var MIGRATIONS2 = [
36817
36990
  {
36818
36991
  version: 42,
36819
36992
  name: "session-memories-agent-id",
36820
- up: up422,
36993
+ up: up432,
36821
36994
  artifacts: {
36822
36995
  columns: [{ table: "session_memories", column: "agent_id" }]
36823
36996
  }
@@ -36825,7 +36998,7 @@ var MIGRATIONS2 = [
36825
36998
  {
36826
36999
  version: 43,
36827
37000
  name: "agents-table",
36828
- up: up432,
37001
+ up: up442,
36829
37002
  artifacts: {
36830
37003
  tables: ["agents"],
36831
37004
  columns: [
@@ -36837,7 +37010,7 @@ var MIGRATIONS2 = [
36837
37010
  {
36838
37011
  version: 44,
36839
37012
  name: "memory-md-temporal-head",
36840
- up: up442,
37013
+ up: up452,
36841
37014
  artifacts: {
36842
37015
  columns: [
36843
37016
  { table: "session_summaries", column: "source_type" },
@@ -36849,7 +37022,7 @@ var MIGRATIONS2 = [
36849
37022
  {
36850
37023
  version: 45,
36851
37024
  name: "lossless-working-memory-hardening",
36852
- up: up452,
37025
+ up: up462,
36853
37026
  artifacts: {
36854
37027
  tables: ["session_transcripts_fts", "memory_md_heads"],
36855
37028
  columns: [
@@ -36862,17 +37035,17 @@ var MIGRATIONS2 = [
36862
37035
  {
36863
37036
  version: 46,
36864
37037
  name: "session-summary-uniqueness",
36865
- up: up462
37038
+ up: up472
36866
37039
  },
36867
37040
  {
36868
37041
  version: 47,
36869
37042
  name: "agent-scoped-temporal-uniqueness",
36870
- up: up472
37043
+ up: up482
36871
37044
  },
36872
37045
  {
36873
37046
  version: 48,
36874
37047
  name: "thread-heads",
36875
- up: up482,
37048
+ up: up492,
36876
37049
  artifacts: {
36877
37050
  tables: ["memory_thread_heads"]
36878
37051
  }
@@ -36880,7 +37053,7 @@ var MIGRATIONS2 = [
36880
37053
  {
36881
37054
  version: 49,
36882
37055
  name: "session-extract-cursors",
36883
- up: up492,
37056
+ up: up502,
36884
37057
  artifacts: {
36885
37058
  tables: ["session_extract_cursors"]
36886
37059
  }
@@ -36888,7 +37061,7 @@ var MIGRATIONS2 = [
36888
37061
  {
36889
37062
  version: 50,
36890
37063
  name: "related-to-audit",
36891
- up: up502,
37064
+ up: up512,
36892
37065
  artifacts: {
36893
37066
  tables: ["entity_dependency_history"]
36894
37067
  }
@@ -36896,7 +37069,7 @@ var MIGRATIONS2 = [
36896
37069
  {
36897
37070
  version: 51,
36898
37071
  name: "memory-md-rolling-window-lineage",
36899
- up: up512,
37072
+ up: up522,
36900
37073
  artifacts: {
36901
37074
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
36902
37075
  columns: [
@@ -36911,7 +37084,7 @@ var MIGRATIONS2 = [
36911
37084
  {
36912
37085
  version: 52,
36913
37086
  name: "mcp-invocations",
36914
- up: up522,
37087
+ up: up532,
36915
37088
  artifacts: {
36916
37089
  tables: ["mcp_invocations"]
36917
37090
  }
@@ -36919,7 +37092,7 @@ var MIGRATIONS2 = [
36919
37092
  {
36920
37093
  version: 53,
36921
37094
  name: "skill-invocations",
36922
- up: up532,
37095
+ up: up542,
36923
37096
  artifacts: {
36924
37097
  tables: ["skill_invocations"]
36925
37098
  }
@@ -36927,7 +37100,7 @@ var MIGRATIONS2 = [
36927
37100
  {
36928
37101
  version: 54,
36929
37102
  name: "task-agent-scope",
36930
- up: up542,
37103
+ up: up552,
36931
37104
  artifacts: {
36932
37105
  tables: ["task_scope_hints"]
36933
37106
  }
@@ -36935,7 +37108,7 @@ var MIGRATIONS2 = [
36935
37108
  {
36936
37109
  version: 55,
36937
37110
  name: "dreaming-state",
36938
- up: up552,
37111
+ up: up562,
36939
37112
  artifacts: {
36940
37113
  tables: ["dreaming_state", "dreaming_passes"]
36941
37114
  }
@@ -36943,22 +37116,22 @@ var MIGRATIONS2 = [
36943
37116
  {
36944
37117
  version: 56,
36945
37118
  name: "agent-scoped-content-hash",
36946
- up: up562
37119
+ up: up572
36947
37120
  },
36948
37121
  {
36949
37122
  version: 57,
36950
37123
  name: "memories-fts-tokenizer-repair",
36951
- up: up572
37124
+ up: up582
36952
37125
  },
36953
37126
  {
36954
37127
  version: 58,
36955
37128
  name: "knowledge-graph-indices",
36956
- up: up582
37129
+ up: up592
36957
37130
  },
36958
37131
  {
36959
37132
  version: 59,
36960
37133
  name: "entity-attribute-claim-key",
36961
- up: up592,
37134
+ up: up602,
36962
37135
  artifacts: {
36963
37136
  columns: [{ table: "entity_attributes", column: "claim_key" }]
36964
37137
  }
@@ -36966,7 +37139,7 @@ var MIGRATIONS2 = [
36966
37139
  {
36967
37140
  version: 60,
36968
37141
  name: "entity-attribute-group-key",
36969
- up: up602,
37142
+ up: up612,
36970
37143
  artifacts: {
36971
37144
  columns: [{ table: "entity_attributes", column: "group_key" }]
36972
37145
  }
@@ -36974,7 +37147,7 @@ var MIGRATIONS2 = [
36974
37147
  {
36975
37148
  version: 61,
36976
37149
  name: "memory-artifact-source-mtime",
36977
- up: up612,
37150
+ up: up622,
36978
37151
  artifacts: {
36979
37152
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
36980
37153
  }
@@ -36982,7 +37155,7 @@ var MIGRATIONS2 = [
36982
37155
  {
36983
37156
  version: 62,
36984
37157
  name: "memory-artifact-soft-delete",
36985
- up: up622,
37158
+ up: up632,
36986
37159
  artifacts: {
36987
37160
  columns: [
36988
37161
  { table: "memory_artifacts", column: "is_deleted" },
@@ -36993,12 +37166,12 @@ var MIGRATIONS2 = [
36993
37166
  {
36994
37167
  version: 63,
36995
37168
  name: "content-only-memories-fts-update",
36996
- up: up632
37169
+ up: up642
36997
37170
  },
36998
37171
  {
36999
37172
  version: 64,
37000
37173
  name: "source-graph-provenance",
37001
- up: up642,
37174
+ up: up652,
37002
37175
  artifacts: {
37003
37176
  columns: [
37004
37177
  { table: "entities", column: "source_path" },
@@ -37011,7 +37184,7 @@ var MIGRATIONS2 = [
37011
37184
  {
37012
37185
  version: 65,
37013
37186
  name: "source-embedding-agent-scope",
37014
- up: up652,
37187
+ up: up662,
37015
37188
  artifacts: {
37016
37189
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
37017
37190
  }
@@ -37019,7 +37192,7 @@ var MIGRATIONS2 = [
37019
37192
  {
37020
37193
  version: 66,
37021
37194
  name: "memory-search-telemetry",
37022
- up: up662,
37195
+ up: up672,
37023
37196
  artifacts: {
37024
37197
  tables: ["memory_search_telemetry"]
37025
37198
  }
@@ -37027,7 +37200,7 @@ var MIGRATIONS2 = [
37027
37200
  {
37028
37201
  version: 67,
37029
37202
  name: "ontology-proposals",
37030
- up: up672,
37203
+ up: up682,
37031
37204
  artifacts: {
37032
37205
  tables: ["ontology_proposals"],
37033
37206
  columns: [
@@ -37041,7 +37214,7 @@ var MIGRATIONS2 = [
37041
37214
  {
37042
37215
  version: 68,
37043
37216
  name: "daily-reflections",
37044
- up: up682,
37217
+ up: up692,
37045
37218
  artifacts: {
37046
37219
  tables: ["daily_reflections"]
37047
37220
  }
@@ -37049,7 +37222,7 @@ var MIGRATIONS2 = [
37049
37222
  {
37050
37223
  version: 69,
37051
37224
  name: "daily-reflections-multiple-insights",
37052
- up: up692,
37225
+ up: up702,
37053
37226
  artifacts: {
37054
37227
  tables: ["daily_reflections"]
37055
37228
  }
@@ -37057,7 +37230,7 @@ var MIGRATIONS2 = [
37057
37230
  {
37058
37231
  version: 70,
37059
37232
  name: "ontology-control-plane-state",
37060
- up: up702,
37233
+ up: up712,
37061
37234
  artifacts: {
37062
37235
  columns: [
37063
37236
  { table: "entities", column: "status" },
@@ -37072,7 +37245,7 @@ var MIGRATIONS2 = [
37072
37245
  {
37073
37246
  version: 71,
37074
37247
  name: "epistemic-assertions",
37075
- up: up712,
37248
+ up: up722,
37076
37249
  artifacts: {
37077
37250
  tables: ["epistemic_assertions"]
37078
37251
  }
@@ -37080,7 +37253,7 @@ var MIGRATIONS2 = [
37080
37253
  {
37081
37254
  version: 72,
37082
37255
  name: "agent-scoped-idempotency-key",
37083
- up: up722,
37256
+ up: up732,
37084
37257
  artifacts: {
37085
37258
  columns: [
37086
37259
  { table: "memories", column: "idempotency_key" },
@@ -37091,7 +37264,7 @@ var MIGRATIONS2 = [
37091
37264
  {
37092
37265
  version: 73,
37093
37266
  name: "recall-context-dedupe",
37094
- up: up732,
37267
+ up: up742,
37095
37268
  artifacts: {
37096
37269
  tables: ["session_context_epochs", "session_recall_events"]
37097
37270
  }
@@ -37099,7 +37272,7 @@ var MIGRATIONS2 = [
37099
37272
  {
37100
37273
  version: 74,
37101
37274
  name: "aggregate-memory-links",
37102
- up: up742,
37275
+ up: up752,
37103
37276
  artifacts: {
37104
37277
  tables: ["aggregate_memory_sources"]
37105
37278
  }
@@ -37107,7 +37280,7 @@ var MIGRATIONS2 = [
37107
37280
  {
37108
37281
  version: 75,
37109
37282
  name: "memory-artifact-source-provenance",
37110
- up: up752,
37283
+ up: up762,
37111
37284
  artifacts: {
37112
37285
  columns: [
37113
37286
  { table: "memory_artifacts", column: "source_id" },
@@ -37121,7 +37294,7 @@ var MIGRATIONS2 = [
37121
37294
  {
37122
37295
  version: 76,
37123
37296
  name: "temporal-edges",
37124
- up: up762,
37297
+ up: up772,
37125
37298
  artifacts: {
37126
37299
  tables: ["temporal_edges"]
37127
37300
  }
@@ -37129,7 +37302,7 @@ var MIGRATIONS2 = [
37129
37302
  {
37130
37303
  version: 77,
37131
37304
  name: "entity-aliases",
37132
- up: up772,
37305
+ up: up782,
37133
37306
  artifacts: {
37134
37307
  tables: ["entity_aliases"]
37135
37308
  }
@@ -37137,7 +37310,7 @@ var MIGRATIONS2 = [
37137
37310
  {
37138
37311
  version: 78,
37139
37312
  name: "api-keys",
37140
- up: up782,
37313
+ up: up792,
37141
37314
  artifacts: {
37142
37315
  tables: ["api_keys"]
37143
37316
  }
@@ -37145,7 +37318,7 @@ var MIGRATIONS2 = [
37145
37318
  {
37146
37319
  version: 79,
37147
37320
  name: "transcript-capture-jobs",
37148
- up: up792,
37321
+ up: up802,
37149
37322
  artifacts: {
37150
37323
  tables: ["transcript_capture_jobs"]
37151
37324
  }
@@ -37153,7 +37326,7 @@ var MIGRATIONS2 = [
37153
37326
  {
37154
37327
  version: 80,
37155
37328
  name: "document-scope-columns",
37156
- up: up802,
37329
+ up: up812,
37157
37330
  artifacts: {
37158
37331
  columns: [
37159
37332
  { table: "documents", column: "agent_id" },
@@ -37164,7 +37337,7 @@ var MIGRATIONS2 = [
37164
37337
  {
37165
37338
  version: 81,
37166
37339
  name: "aggregate-evidence-sources",
37167
- up: up812,
37340
+ up: up822,
37168
37341
  artifacts: {
37169
37342
  tables: ["aggregate_evidence_sources"]
37170
37343
  }
@@ -37172,7 +37345,7 @@ var MIGRATIONS2 = [
37172
37345
  {
37173
37346
  version: 82,
37174
37347
  name: "skill-invocations-harness",
37175
- up: up822,
37348
+ up: up832,
37176
37349
  artifacts: {
37177
37350
  columns: [
37178
37351
  { table: "skill_invocations", column: "harness" },
@@ -37183,7 +37356,7 @@ var MIGRATIONS2 = [
37183
37356
  {
37184
37357
  version: 83,
37185
37358
  name: "memory-lifecycle-repair",
37186
- up: up832,
37359
+ up: up842,
37187
37360
  artifacts: {
37188
37361
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
37189
37362
  columns: [
@@ -37198,7 +37371,7 @@ var MIGRATIONS2 = [
37198
37371
  {
37199
37372
  version: 84,
37200
37373
  name: "legacy-markdown-import-state",
37201
- up: up842,
37374
+ up: up852,
37202
37375
  artifacts: {
37203
37376
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
37204
37377
  }
@@ -37206,7 +37379,7 @@ var MIGRATIONS2 = [
37206
37379
  {
37207
37380
  version: 85,
37208
37381
  name: "backfill-relations-to-dependencies",
37209
- up: up852,
37382
+ up: up862,
37210
37383
  artifacts: {
37211
37384
  tables: ["entity_dependencies"]
37212
37385
  }
@@ -37214,7 +37387,7 @@ var MIGRATIONS2 = [
37214
37387
  {
37215
37388
  version: 86,
37216
37389
  name: "summary-jobs-content-hash",
37217
- up: up862,
37390
+ up: up872,
37218
37391
  artifacts: {
37219
37392
  columns: [{ table: "summary_jobs", column: "content_hash" }]
37220
37393
  }
@@ -37222,7 +37395,7 @@ var MIGRATIONS2 = [
37222
37395
  {
37223
37396
  version: 87,
37224
37397
  name: "summary-jobs-boundary-reason",
37225
- up: up872,
37398
+ up: up882,
37226
37399
  artifacts: {
37227
37400
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
37228
37401
  }
@@ -37230,7 +37403,7 @@ var MIGRATIONS2 = [
37230
37403
  {
37231
37404
  version: 88,
37232
37405
  name: "transcript-recovery-files",
37233
- up: up882,
37406
+ up: up892,
37234
37407
  artifacts: {
37235
37408
  tables: ["transcript_recovery_files"]
37236
37409
  }
@@ -37238,7 +37411,7 @@ var MIGRATIONS2 = [
37238
37411
  {
37239
37412
  version: 89,
37240
37413
  name: "job-cancellations",
37241
- up: up892,
37414
+ up: up902,
37242
37415
  artifacts: {
37243
37416
  tables: ["job_cancellations"]
37244
37417
  }
@@ -37246,7 +37419,7 @@ var MIGRATIONS2 = [
37246
37419
  {
37247
37420
  version: 90,
37248
37421
  name: "job-archive",
37249
- up: up902,
37422
+ up: up912,
37250
37423
  artifacts: {
37251
37424
  tables: ["job_archive"]
37252
37425
  }
@@ -37254,25 +37427,25 @@ var MIGRATIONS2 = [
37254
37427
  {
37255
37428
  version: 91,
37256
37429
  name: "embedding-index-generations",
37257
- up: up912,
37430
+ up: up922,
37258
37431
  artifacts: { tables: ["embedding_index_state"] }
37259
37432
  },
37260
37433
  {
37261
37434
  version: 92,
37262
37435
  name: "embedding-staging-store",
37263
- up: up922,
37436
+ up: up932,
37264
37437
  artifacts: { tables: ["embeddings_staging"] }
37265
37438
  },
37266
37439
  {
37267
37440
  version: 93,
37268
37441
  name: "dreaming-evidence-cursor",
37269
- up: up932,
37442
+ up: up942,
37270
37443
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
37271
37444
  },
37272
37445
  {
37273
37446
  version: 94,
37274
37447
  name: "memory-kind",
37275
- up: up942,
37448
+ up: up952,
37276
37449
  artifacts: {
37277
37450
  columns: [
37278
37451
  { table: "memories", column: "memory_kind" },
@@ -37283,35 +37456,35 @@ var MIGRATIONS2 = [
37283
37456
  {
37284
37457
  version: 95,
37285
37458
  name: "compaction-recall-projections",
37286
- up: up952
37459
+ up: up962
37287
37460
  },
37288
37461
  {
37289
37462
  version: 96,
37290
37463
  name: "retire-legacy-ingestion",
37291
- up: up962
37464
+ up: up972
37292
37465
  },
37293
37466
  {
37294
37467
  version: 97,
37295
37468
  name: "dreaming-failure-backoff",
37296
- up: up972,
37469
+ up: up982,
37297
37470
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
37298
37471
  },
37299
37472
  {
37300
37473
  version: 98,
37301
37474
  name: "dreaming-evidence-exclusions",
37302
- up: up982,
37475
+ up: up992,
37303
37476
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
37304
37477
  },
37305
37478
  {
37306
37479
  version: 99,
37307
37480
  name: "dreaming-tool-calls",
37308
- up: up992,
37481
+ up: up1002,
37309
37482
  artifacts: { tables: ["dreaming_tool_calls"] }
37310
37483
  },
37311
37484
  {
37312
37485
  version: 100,
37313
37486
  name: "dreaming-runbook",
37314
- up: up1002,
37487
+ up: up1012,
37315
37488
  artifacts: {
37316
37489
  columns: [
37317
37490
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -37322,23 +37495,23 @@ var MIGRATIONS2 = [
37322
37495
  {
37323
37496
  version: 101,
37324
37497
  name: "dreaming-attention",
37325
- up: up1012,
37498
+ up: up1022,
37326
37499
  artifacts: { tables: ["dreaming_attention"] }
37327
37500
  },
37328
37501
  {
37329
37502
  version: 102,
37330
37503
  name: "attribute-semantic-memories",
37331
- up: up1022
37504
+ up: up1032
37332
37505
  },
37333
37506
  {
37334
37507
  version: 103,
37335
37508
  name: "semantic-memory-kind",
37336
- up: up1032
37509
+ up: up1042
37337
37510
  },
37338
37511
  {
37339
37512
  version: 104,
37340
37513
  name: "derived-memory-provenance",
37341
- up: up1042,
37514
+ up: up1052,
37342
37515
  artifacts: {
37343
37516
  tables: ["derived_memory_sources"],
37344
37517
  columns: [{ table: "memories", column: "stale_at" }]
@@ -37347,12 +37520,12 @@ var MIGRATIONS2 = [
37347
37520
  {
37348
37521
  version: 105,
37349
37522
  name: "agent-scoped-entity-name",
37350
- up: up1052
37523
+ up: up1062
37351
37524
  },
37352
37525
  {
37353
37526
  version: 106,
37354
37527
  name: "memory-review-after",
37355
- up: up1062,
37528
+ up: up1072,
37356
37529
  artifacts: {
37357
37530
  columns: [{ table: "memories", column: "review_after" }]
37358
37531
  }
@@ -37360,7 +37533,7 @@ var MIGRATIONS2 = [
37360
37533
  {
37361
37534
  version: 107,
37362
37535
  name: "dreaming-pass-usage",
37363
- up: up1072,
37536
+ up: up1082,
37364
37537
  artifacts: {
37365
37538
  columns: [
37366
37539
  { table: "dreaming_passes", column: "tokens_input" },
@@ -37374,7 +37547,7 @@ var MIGRATIONS2 = [
37374
37547
  {
37375
37548
  version: 108,
37376
37549
  name: "embedding-usage",
37377
- up: up1082,
37550
+ up: up1092,
37378
37551
  artifacts: {
37379
37552
  tables: ["embedding_usage"]
37380
37553
  }
@@ -37382,7 +37555,7 @@ var MIGRATIONS2 = [
37382
37555
  {
37383
37556
  version: 109,
37384
37557
  name: "telemetry-install",
37385
- up: up1092,
37558
+ up: up1102,
37386
37559
  artifacts: {
37387
37560
  tables: ["telemetry_install"]
37388
37561
  }
@@ -37390,12 +37563,12 @@ var MIGRATIONS2 = [
37390
37563
  {
37391
37564
  version: 110,
37392
37565
  name: "memory-mention-join-index",
37393
- up: up1102
37566
+ up: up1112
37394
37567
  },
37395
37568
  {
37396
37569
  version: 111,
37397
37570
  name: "telemetry-first-use",
37398
- up: up1112,
37571
+ up: up1122,
37399
37572
  artifacts: {
37400
37573
  columns: [
37401
37574
  { table: "telemetry_install", column: "first_remember_at" },
@@ -37406,7 +37579,7 @@ var MIGRATIONS2 = [
37406
37579
  {
37407
37580
  version: 112,
37408
37581
  name: "telemetry-queue-ownership",
37409
- up: up1122,
37582
+ up: up1132,
37410
37583
  artifacts: {
37411
37584
  columns: [
37412
37585
  { table: "telemetry_events", column: "source" },
@@ -37418,7 +37591,7 @@ var MIGRATIONS2 = [
37418
37591
  {
37419
37592
  version: 113,
37420
37593
  name: "session-claims",
37421
- up: up1132,
37594
+ up: up1142,
37422
37595
  artifacts: {
37423
37596
  tables: ["session_claims"],
37424
37597
  columns: [
@@ -37432,12 +37605,12 @@ var MIGRATIONS2 = [
37432
37605
  {
37433
37606
  version: 114,
37434
37607
  name: "memory-traversal-hydration-index",
37435
- up: up1142
37608
+ up: up1152
37436
37609
  },
37437
37610
  {
37438
37611
  version: 115,
37439
37612
  name: "cross-agent-message-notifications",
37440
- up: up1152,
37613
+ up: up1162,
37441
37614
  artifacts: {
37442
37615
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
37443
37616
  }
@@ -37445,7 +37618,7 @@ var MIGRATIONS2 = [
37445
37618
  {
37446
37619
  version: 116,
37447
37620
  name: "acp-delivery-reconciliation",
37448
- up: up1162,
37621
+ up: up1172,
37449
37622
  artifacts: {
37450
37623
  columns: [
37451
37624
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -37459,7 +37632,7 @@ var MIGRATIONS2 = [
37459
37632
  {
37460
37633
  version: 117,
37461
37634
  name: "retire-summary-worker",
37462
- up: up1172,
37635
+ up: up1182,
37463
37636
  artifacts: {
37464
37637
  columns: [
37465
37638
  { table: "session_transcripts", column: "completed_at" },
@@ -37470,24 +37643,24 @@ var MIGRATIONS2 = [
37470
37643
  {
37471
37644
  version: 118,
37472
37645
  name: "queue-pressure-indices",
37473
- up: up1182
37646
+ up: up1192
37474
37647
  },
37475
37648
  {
37476
37649
  version: 119,
37477
37650
  name: "telemetry-version-observation",
37478
- up: up1192,
37651
+ up: up1202,
37479
37652
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
37480
37653
  },
37481
37654
  {
37482
37655
  version: 120,
37483
37656
  name: "source-lifecycle-telemetry",
37484
- up: up1202,
37657
+ up: up1212,
37485
37658
  artifacts: { tables: ["source_lifecycle_state"] }
37486
37659
  },
37487
37660
  {
37488
37661
  version: 121,
37489
37662
  name: "telemetry-delivery-health",
37490
- up: up1212,
37663
+ up: up1222,
37491
37664
  artifacts: {
37492
37665
  tables: ["telemetry_delivery_state"],
37493
37666
  columns: [
@@ -37501,7 +37674,7 @@ var MIGRATIONS2 = [
37501
37674
  {
37502
37675
  version: 122,
37503
37676
  name: "dreaming-evidence-retry",
37504
- up: up1222,
37677
+ up: up1232,
37505
37678
  artifacts: {
37506
37679
  columns: [
37507
37680
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -37514,13 +37687,13 @@ var MIGRATIONS2 = [
37514
37687
  {
37515
37688
  version: 123,
37516
37689
  name: "embedding-index-failures",
37517
- up: up1232,
37690
+ up: up1242,
37518
37691
  artifacts: { tables: ["embedding_index_failures"] }
37519
37692
  },
37520
37693
  {
37521
37694
  version: 124,
37522
37695
  name: "import-derived-lifecycle",
37523
- up: up1242,
37696
+ up: up1252,
37524
37697
  artifacts: {
37525
37698
  tables: ["imported_source_lifecycle"]
37526
37699
  }
@@ -37528,77 +37701,77 @@ var MIGRATIONS2 = [
37528
37701
  {
37529
37702
  version: 125,
37530
37703
  name: "memory-content-safety",
37531
- up: up1252,
37704
+ up: up1262,
37532
37705
  artifacts: { tables: ["memory_content_safety"] }
37533
37706
  },
37534
37707
  {
37535
37708
  version: 126,
37536
37709
  name: "dreaming-surprisal-attention",
37537
- up: up1262,
37710
+ up: up1272,
37538
37711
  artifacts: { tables: ["dreaming_attention"] }
37539
37712
  },
37540
37713
  {
37541
37714
  version: 127,
37542
37715
  name: "ontology-contradictions",
37543
- up: up1272,
37716
+ up: up1282,
37544
37717
  artifacts: { tables: ["ontology_contradictions"] }
37545
37718
  },
37546
37719
  {
37547
37720
  version: 128,
37548
37721
  name: "bounded-queue-diagnostics",
37549
- up: up1282
37722
+ up: up1292
37550
37723
  },
37551
37724
  {
37552
37725
  version: 129,
37553
37726
  name: "retire-structural-jobs",
37554
- up: up1292
37727
+ up: up1302
37555
37728
  },
37556
37729
  {
37557
37730
  version: 130,
37558
37731
  name: "embedding-repair-state",
37559
- up: up1302,
37732
+ up: up1312,
37560
37733
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
37561
37734
  },
37562
37735
  {
37563
37736
  version: 131,
37564
37737
  name: "dreaming-evidence-consumption",
37565
- up: up1312,
37738
+ up: up1322,
37566
37739
  artifacts: { tables: ["dreaming_evidence_consumption"] }
37567
37740
  },
37568
37741
  {
37569
37742
  version: 132,
37570
37743
  name: "observer-scoped-epistemic-assertions",
37571
- up: up1322,
37744
+ up: up1332,
37572
37745
  artifacts: { tables: ["epistemic_assertions"] }
37573
37746
  },
37574
37747
  {
37575
37748
  version: 133,
37576
37749
  name: "dreaming-memory-head",
37577
- up: up1332,
37750
+ up: up1342,
37578
37751
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
37579
37752
  },
37580
37753
  {
37581
37754
  version: 134,
37582
37755
  name: "scope-memory-head-entries",
37583
- up: up1342,
37756
+ up: up1352,
37584
37757
  artifacts: { tables: ["memory_head_entries"] }
37585
37758
  },
37586
37759
  {
37587
37760
  version: 135,
37588
37761
  name: "memory-head-publication",
37589
- up: up1352,
37762
+ up: up1362,
37590
37763
  artifacts: { tables: ["memory_head_publications"] }
37591
37764
  },
37592
37765
  {
37593
37766
  version: 136,
37594
37767
  name: "memory-head-revisions",
37595
- up: up1362,
37768
+ up: up1372,
37596
37769
  artifacts: { tables: ["memory_head_revisions"] }
37597
37770
  },
37598
37771
  {
37599
37772
  version: 137,
37600
37773
  name: "dreaming-head-manifest",
37601
- up: up1372,
37774
+ up: up1382,
37602
37775
  artifacts: {
37603
37776
  columns: [
37604
37777
  { table: "dreaming_passes", column: "head_revision" },
@@ -37609,7 +37782,7 @@ var MIGRATIONS2 = [
37609
37782
  {
37610
37783
  version: 138,
37611
37784
  name: "bounded-status-projections",
37612
- up: up1382,
37785
+ up: up1392,
37613
37786
  artifacts: {
37614
37787
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
37615
37788
  }
@@ -37617,31 +37790,31 @@ var MIGRATIONS2 = [
37617
37790
  {
37618
37791
  version: 139,
37619
37792
  name: "native-source-sync-state",
37620
- up: up1392,
37793
+ up: up1402,
37621
37794
  artifacts: { tables: ["native_source_sync_state"] }
37622
37795
  },
37623
37796
  {
37624
37797
  version: 140,
37625
37798
  name: "transcript-recovery-frontier",
37626
- up: up1402,
37799
+ up: up1412,
37627
37800
  artifacts: { tables: ["transcript_recovery_frontiers"] }
37628
37801
  },
37629
37802
  {
37630
37803
  version: 141,
37631
37804
  name: "source-sync-checkpoints",
37632
- up: up1412,
37805
+ up: up1422,
37633
37806
  artifacts: { tables: ["source_sync_checkpoints"] }
37634
37807
  },
37635
37808
  {
37636
37809
  version: 142,
37637
37810
  name: "source-sync-frontier",
37638
- up: up1422,
37811
+ up: up1432,
37639
37812
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
37640
37813
  },
37641
37814
  {
37642
37815
  version: 143,
37643
37816
  name: "embedding-index-progress",
37644
- up: up1432,
37817
+ up: up1442,
37645
37818
  artifacts: {
37646
37819
  columns: [
37647
37820
  { table: "embedding_index_state", column: "migration_phase" },
@@ -37657,19 +37830,19 @@ var MIGRATIONS2 = [
37657
37830
  {
37658
37831
  version: 144,
37659
37832
  name: "memory-job-lease-token",
37660
- up: up1442,
37833
+ up: up1452,
37661
37834
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
37662
37835
  },
37663
37836
  {
37664
37837
  version: 145,
37665
37838
  name: "dreaming-evidence-reviews",
37666
- up: up1452,
37839
+ up: up1462,
37667
37840
  artifacts: { tables: ["dreaming_evidence_reviews"] }
37668
37841
  },
37669
37842
  {
37670
37843
  version: 146,
37671
37844
  name: "source-transcript-import",
37672
- up: up1462,
37845
+ up: up1472,
37673
37846
  artifacts: {
37674
37847
  tables: [
37675
37848
  "source_import_jobs",
@@ -37688,19 +37861,19 @@ var MIGRATIONS2 = [
37688
37861
  {
37689
37862
  version: 147,
37690
37863
  name: "source-import-replay-file-slots",
37691
- up: up1472,
37864
+ up: up1482,
37692
37865
  artifacts: { tables: ["source_import_files"] }
37693
37866
  },
37694
37867
  {
37695
37868
  version: 148,
37696
37869
  name: "source-import-attempt-provenance",
37697
- up: up1482,
37870
+ up: up1492,
37698
37871
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
37699
37872
  },
37700
37873
  {
37701
37874
  version: 149,
37702
37875
  name: "transcript-import-state-machine",
37703
- up: up1492,
37876
+ up: up1502,
37704
37877
  artifacts: {
37705
37878
  columns: [
37706
37879
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -37712,13 +37885,42 @@ var MIGRATIONS2 = [
37712
37885
  {
37713
37886
  version: 150,
37714
37887
  name: "memory-head-freshness",
37715
- up: up1502,
37888
+ up: up1512,
37716
37889
  artifacts: {
37717
37890
  columns: [
37718
37891
  { table: "memory_md_heads", column: "is_current" },
37719
37892
  { table: "dreaming_passes", column: "head_base_revision" }
37720
37893
  ]
37721
37894
  }
37895
+ },
37896
+ {
37897
+ version: 151,
37898
+ name: "transcript-import-bytes",
37899
+ up: up152,
37900
+ artifacts: {
37901
+ tables: [
37902
+ "source_import_chunks",
37903
+ "source_import_capacity",
37904
+ "source_import_migrations",
37905
+ "source_import_migration_streams",
37906
+ "source_import_migration_counts"
37907
+ ],
37908
+ columns: [
37909
+ { table: "source_import_files", column: "storage_state" },
37910
+ { table: "source_import_files", column: "upload_generation" },
37911
+ { table: "source_import_files", column: "upload_offset" },
37912
+ { table: "source_import_files", column: "upload_size" },
37913
+ { table: "source_import_files", column: "upload_digest" },
37914
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
37915
+ table: "source_import_files",
37916
+ column
37917
+ })),
37918
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
37919
+ table: "source_import_jobs",
37920
+ column
37921
+ }))
37922
+ ]
37923
+ }
37722
37924
  }
37723
37925
  ];
37724
37926
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;