@signetai/connector-hermes-agent 0.221.8 → 0.221.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +810 -608
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -11311,6 +11311,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES = [
11311
11311
  "checkpoint",
11312
11312
  "dreaming"
11313
11313
  ];
11314
+ function up(db) {
11315
+ const hasColumn = (table, column) => {
11316
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
11317
+ try {
11318
+ return statement.get(column) != null;
11319
+ } finally {
11320
+ statement.finalize?.();
11321
+ }
11322
+ };
11323
+ for (const [column, definition] of [
11324
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
11325
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
11326
+ ["upload_size", "INTEGER"],
11327
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
11328
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
11329
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
11330
+ ["original_path", "TEXT"],
11331
+ [
11332
+ "storage_state",
11333
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
11334
+ ]
11335
+ ]) {
11336
+ if (!hasColumn("source_import_files", column))
11337
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
11338
+ }
11339
+ if (!hasColumn("source_import_jobs", "retry_count"))
11340
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
11341
+ if (!hasColumn("source_import_jobs", "cleanup_state"))
11342
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
11343
+ if (!hasColumn("source_import_jobs", "retry_cursor"))
11344
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
11345
+ if (!hasColumn("source_import_jobs", "retry_requested"))
11346
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
11347
+ db.exec(`
11348
+ 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);
11349
+ 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;
11350
+ 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;
11351
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
11352
+ 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));
11353
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
11354
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
11355
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
11356
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
11357
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
11358
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
11359
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
11360
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
11361
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
11362
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
11363
+ ) WITHOUT ROWID;
11364
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
11365
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
11366
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
11367
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
11368
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
11369
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
11370
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
11371
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
11372
+ `);
11373
+ }
11314
11374
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11315
11375
  var FTS_STATE_TABLE = "memories_fts_state";
11316
11376
  function normalizeSql(sql) {
@@ -11426,7 +11486,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11426
11486
  return true;
11427
11487
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
11428
11488
  }
11429
- function up(db) {
11489
+ function up2(db) {
11430
11490
  db.exec(`
11431
11491
  CREATE TABLE IF NOT EXISTS schema_migrations (
11432
11492
  version INTEGER PRIMARY KEY,
@@ -11524,7 +11584,7 @@ function addColumnIfMissing(db, table, column, definition) {
11524
11584
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11525
11585
  }
11526
11586
  }
11527
- function up2(db) {
11587
+ function up3(db) {
11528
11588
  addColumnIfMissing(db, "memories", "content_hash", "TEXT");
11529
11589
  addColumnIfMissing(db, "memories", "normalized_content", "TEXT");
11530
11590
  addColumnIfMissing(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -11642,7 +11702,7 @@ function addColumnIfMissing2(db, table, column, definition) {
11642
11702
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11643
11703
  return true;
11644
11704
  }
11645
- function up3(db) {
11705
+ function up4(db) {
11646
11706
  addColumnIfMissing2(db, "memories", "why", "TEXT");
11647
11707
  addColumnIfMissing2(db, "memories", "project", "TEXT");
11648
11708
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -11679,7 +11739,7 @@ function addColumnIfMissing3(db, table, column, definition) {
11679
11739
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11680
11740
  }
11681
11741
  }
11682
- function up4(db) {
11742
+ function up5(db) {
11683
11743
  addColumnIfMissing3(db, "memory_history", "actor_type", "TEXT");
11684
11744
  addColumnIfMissing3(db, "memory_history", "session_id", "TEXT");
11685
11745
  addColumnIfMissing3(db, "memory_history", "request_id", "TEXT");
@@ -11712,7 +11772,7 @@ function addColumnIfMissing4(db, table, column, definition) {
11712
11772
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11713
11773
  }
11714
11774
  }
11715
- function up5(db) {
11775
+ function up6(db) {
11716
11776
  addColumnIfMissing4(db, "entities", "canonical_name", "TEXT");
11717
11777
  addColumnIfMissing4(db, "entities", "mentions", "INTEGER DEFAULT 0");
11718
11778
  addColumnIfMissing4(db, "entities", "embedding", "BLOB");
@@ -11729,7 +11789,7 @@ function hasColumn4(db, table, column) {
11729
11789
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11730
11790
  return rows.some((r2) => r2.name === column);
11731
11791
  }
11732
- function up6(db) {
11792
+ function up7(db) {
11733
11793
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11734
11794
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11735
11795
  }
@@ -11744,7 +11804,7 @@ function hasColumn5(db, table, column) {
11744
11804
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11745
11805
  return rows.some((r2) => r2.name === column);
11746
11806
  }
11747
- function up7(db) {
11807
+ function up8(db) {
11748
11808
  db.exec(`
11749
11809
  CREATE TABLE IF NOT EXISTS documents (
11750
11810
  id TEXT PRIMARY KEY,
@@ -11801,7 +11861,7 @@ function up7(db) {
11801
11861
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
11802
11862
  }
11803
11863
  }
11804
- function up8(db) {
11864
+ function up9(db) {
11805
11865
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11806
11866
  if (tables.length === 0)
11807
11867
  return;
@@ -11818,7 +11878,7 @@ function up8(db) {
11818
11878
  ON embeddings(content_hash)
11819
11879
  `);
11820
11880
  }
11821
- function up9(db) {
11881
+ function up10(db) {
11822
11882
  db.exec(`
11823
11883
  CREATE TABLE IF NOT EXISTS summary_jobs (
11824
11884
  id TEXT PRIMARY KEY,
@@ -11838,7 +11898,7 @@ function up9(db) {
11838
11898
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
11839
11899
  ON summary_jobs(status)`);
11840
11900
  }
11841
- function up10(db) {
11901
+ function up11(db) {
11842
11902
  db.exec(`
11843
11903
  CREATE TABLE IF NOT EXISTS umap_cache (
11844
11904
  id INTEGER PRIMARY KEY,
@@ -11849,7 +11909,7 @@ function up10(db) {
11849
11909
  )
11850
11910
  `);
11851
11911
  }
11852
- function up11(db) {
11912
+ function up12(db) {
11853
11913
  db.exec(`
11854
11914
  CREATE TABLE IF NOT EXISTS session_scores (
11855
11915
  id TEXT PRIMARY KEY,
@@ -11869,7 +11929,7 @@ function up11(db) {
11869
11929
  ON session_scores(session_key);
11870
11930
  `);
11871
11931
  }
11872
- function up12(db) {
11932
+ function up13(db) {
11873
11933
  db.exec(`
11874
11934
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11875
11935
  id TEXT PRIMARY KEY,
@@ -11910,7 +11970,7 @@ function addColumnIfMissing5(db, table, column, definition) {
11910
11970
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11911
11971
  }
11912
11972
  }
11913
- function up13(db) {
11973
+ function up14(db) {
11914
11974
  db.exec(`
11915
11975
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11916
11976
  id TEXT PRIMARY KEY,
@@ -11936,7 +11996,7 @@ function up13(db) {
11936
11996
  addColumnIfMissing5(db, "memories", "source_path", "TEXT");
11937
11997
  addColumnIfMissing5(db, "memories", "source_section", "TEXT");
11938
11998
  }
11939
- function up14(db) {
11999
+ function up15(db) {
11940
12000
  db.exec(`
11941
12001
  CREATE TABLE IF NOT EXISTS telemetry_events (
11942
12002
  id TEXT PRIMARY KEY,
@@ -11961,7 +12021,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11961
12021
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11962
12022
  }
11963
12023
  }
11964
- function up15(db) {
12024
+ function up16(db) {
11965
12025
  db.exec(`
11966
12026
  CREATE TABLE IF NOT EXISTS session_memories (
11967
12027
  id TEXT PRIMARY KEY,
@@ -11988,7 +12048,7 @@ function up15(db) {
11988
12048
  addColumnIfMissing6(db, "session_scores", "confidence", "REAL");
11989
12049
  addColumnIfMissing6(db, "session_scores", "continuity_reasoning", "TEXT");
11990
12050
  }
11991
- function up16(db) {
12051
+ function up17(db) {
11992
12052
  db.exec(`
11993
12053
  CREATE TABLE IF NOT EXISTS session_checkpoints (
11994
12054
  id TEXT PRIMARY KEY,
@@ -12010,7 +12070,7 @@ function up16(db) {
12010
12070
  ON session_checkpoints(project_normalized, created_at DESC);
12011
12071
  `);
12012
12072
  }
12013
- function up17(db) {
12073
+ function up18(db) {
12014
12074
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12015
12075
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12016
12076
  if (!colNames.has("skill_name")) {
@@ -12021,7 +12081,7 @@ function up17(db) {
12021
12081
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
12022
12082
  }
12023
12083
  }
12024
- function up18(db) {
12084
+ function up19(db) {
12025
12085
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12026
12086
  if (existing)
12027
12087
  return;
@@ -12053,7 +12113,7 @@ function up18(db) {
12053
12113
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
12054
12114
  `);
12055
12115
  }
12056
- function up19(db) {
12116
+ function up20(db) {
12057
12117
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12058
12118
  const entityColNames = new Set(entityCols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
12059
12119
  if (!entityColNames.has("agent_id")) {
@@ -12138,13 +12198,13 @@ function addColumnIfMissing7(db, table, column, definition) {
12138
12198
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12139
12199
  }
12140
12200
  }
12141
- function up20(db) {
12201
+ function up21(db) {
12142
12202
  addColumnIfMissing7(db, "session_memories", "entity_slot", "INTEGER");
12143
12203
  addColumnIfMissing7(db, "session_memories", "aspect_slot", "INTEGER");
12144
12204
  addColumnIfMissing7(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
12145
12205
  addColumnIfMissing7(db, "session_memories", "structural_density", "INTEGER");
12146
12206
  }
12147
- function up21(db) {
12207
+ function up22(db) {
12148
12208
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12149
12209
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12150
12210
  if (!columnNames.has("focal_entity_ids")) {
@@ -12169,25 +12229,25 @@ function addColumnIfMissing8(db, table, column, definition) {
12169
12229
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12170
12230
  }
12171
12231
  }
12172
- function up22(db) {
12232
+ function up23(db) {
12173
12233
  addColumnIfMissing8(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12174
12234
  addColumnIfMissing8(db, "entities", "pinned_at", "TEXT");
12175
12235
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12176
12236
  }
12177
- function up23(_db) {}
12178
12237
  function up24(_db) {}
12238
+ function up25(_db) {}
12179
12239
  function addColumnIfMissing9(db, table, column, definition) {
12180
12240
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
12181
12241
  if (!cols.some((c2) => c2.name === column)) {
12182
12242
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12183
12243
  }
12184
12244
  }
12185
- function up25(db) {
12245
+ function up26(db) {
12186
12246
  addColumnIfMissing9(db, "session_memories", "agent_relevance_score", "REAL");
12187
12247
  addColumnIfMissing9(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12188
12248
  }
12189
- function up26(_db) {}
12190
- function up27(db) {
12249
+ function up27(_db) {}
12250
+ function up28(db) {
12191
12251
  db.exec(`
12192
12252
  UPDATE entities
12193
12253
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12196,7 +12256,7 @@ function up27(db) {
12196
12256
  WHERE canonical_name IS NULL
12197
12257
  `);
12198
12258
  }
12199
- function up28(db) {
12259
+ function up29(db) {
12200
12260
  db.exec(`
12201
12261
  CREATE TABLE IF NOT EXISTS memories_cold (
12202
12262
  archive_id TEXT PRIMARY KEY,
@@ -12233,7 +12293,7 @@ function up28(db) {
12233
12293
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
12234
12294
  `);
12235
12295
  }
12236
- function up29(db) {
12296
+ function up30(db) {
12237
12297
  db.exec(`
12238
12298
  CREATE TABLE IF NOT EXISTS session_summaries (
12239
12299
  id TEXT PRIMARY KEY,
@@ -12278,7 +12338,7 @@ function up29(db) {
12278
12338
  WHERE session_key IS NOT NULL;
12279
12339
  `);
12280
12340
  }
12281
- function up30(db) {
12341
+ function up31(db) {
12282
12342
  db.exec(`
12283
12343
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12284
12344
  id TEXT PRIMARY KEY,
@@ -12323,7 +12383,7 @@ function up30(db) {
12323
12383
  ON memory_jobs(failed_at);
12324
12384
  `);
12325
12385
  }
12326
- function up31(db) {
12386
+ function up32(db) {
12327
12387
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12328
12388
  if (!depCols.some((c2) => c2.name === "reason")) {
12329
12389
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12333,7 +12393,7 @@ function up31(db) {
12333
12393
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
12334
12394
  }
12335
12395
  }
12336
- function up32(db) {
12396
+ function up33(db) {
12337
12397
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12338
12398
  if (cols.length === 0)
12339
12399
  return;
@@ -12341,14 +12401,14 @@ function up32(db) {
12341
12401
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
12342
12402
  }
12343
12403
  }
12344
- function up33(db) {
12404
+ function up34(db) {
12345
12405
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12346
12406
  if (!cols.some((c2) => c2.name === "scope")) {
12347
12407
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
12348
12408
  }
12349
12409
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
12350
12410
  }
12351
- function up34(db) {
12411
+ function up35(db) {
12352
12412
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12353
12413
  db.exec(`
12354
12414
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12356,7 +12416,7 @@ function up34(db) {
12356
12416
  WHERE content_hash IS NOT NULL AND is_deleted = 0
12357
12417
  `);
12358
12418
  }
12359
- function up35(db) {
12419
+ function up36(db) {
12360
12420
  db.exec(`
12361
12421
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12362
12422
  name, canonical_name,
@@ -12388,13 +12448,13 @@ function up35(db) {
12388
12448
  END
12389
12449
  `);
12390
12450
  }
12391
- function up36(db) {
12451
+ function up37(db) {
12392
12452
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12393
12453
  if (!cols.some((c2) => c2.name === "confidence")) {
12394
12454
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
12395
12455
  }
12396
12456
  }
12397
- function up37(db) {
12457
+ function up38(db) {
12398
12458
  db.exec(`
12399
12459
  CREATE TABLE IF NOT EXISTS entity_communities (
12400
12460
  id TEXT PRIMARY KEY,
@@ -12412,7 +12472,7 @@ function up37(db) {
12412
12472
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
12413
12473
  }
12414
12474
  }
12415
- function up38(db) {
12475
+ function up39(db) {
12416
12476
  db.exec(`
12417
12477
  CREATE TABLE IF NOT EXISTS memory_hints (
12418
12478
  id TEXT PRIMARY KEY,
@@ -12452,7 +12512,7 @@ function up38(db) {
12452
12512
  END
12453
12513
  `);
12454
12514
  }
12455
- function up39(db) {
12515
+ function up40(db) {
12456
12516
  db.exec(`
12457
12517
  DELETE FROM entity_dependencies
12458
12518
  WHERE id NOT IN (
@@ -12470,7 +12530,7 @@ function up39(db) {
12470
12530
  )
12471
12531
  `);
12472
12532
  }
12473
- function up40(db) {
12533
+ function up41(db) {
12474
12534
  db.exec(`
12475
12535
  CREATE TABLE IF NOT EXISTS session_transcripts (
12476
12536
  session_key TEXT PRIMARY KEY,
@@ -12493,7 +12553,7 @@ function addColumnIfMissing10(db, table, column, definition) {
12493
12553
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12494
12554
  }
12495
12555
  }
12496
- function up41(db) {
12556
+ function up42(db) {
12497
12557
  addColumnIfMissing10(db, "session_memories", "path_json", "TEXT");
12498
12558
  db.exec(`
12499
12559
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -12568,7 +12628,7 @@ function addColumnIfMissing11(db, table, column, definition) {
12568
12628
  return;
12569
12629
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12570
12630
  }
12571
- function up42(db) {
12631
+ function up43(db) {
12572
12632
  addColumnIfMissing11(db, "session_memories", "entity_slot", "INTEGER");
12573
12633
  addColumnIfMissing11(db, "session_memories", "aspect_slot", "INTEGER");
12574
12634
  addColumnIfMissing11(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12656,7 +12716,7 @@ function addColumnIfMissing12(db, table, column, definition) {
12656
12716
  return;
12657
12717
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12658
12718
  }
12659
- function up43(db) {
12719
+ function up44(db) {
12660
12720
  db.exec(`
12661
12721
  CREATE TABLE IF NOT EXISTS agents (
12662
12722
  id TEXT PRIMARY KEY,
@@ -12685,7 +12745,7 @@ function addColumnIfMissing13(db, table, column, definition) {
12685
12745
  return;
12686
12746
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12687
12747
  }
12688
- function up44(db) {
12748
+ function up45(db) {
12689
12749
  addColumnIfMissing13(db, "session_summaries", "source_type", "TEXT");
12690
12750
  addColumnIfMissing13(db, "session_summaries", "source_ref", "TEXT");
12691
12751
  addColumnIfMissing13(db, "session_summaries", "meta_json", "TEXT");
@@ -12711,7 +12771,7 @@ function addColumnIfMissing14(db, table, column, definition) {
12711
12771
  return;
12712
12772
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12713
12773
  }
12714
- function up45(db) {
12774
+ function up46(db) {
12715
12775
  addColumnIfMissing14(db, "session_transcripts", "updated_at", "TEXT");
12716
12776
  addColumnIfMissing14(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12717
12777
  addColumnIfMissing14(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -12782,7 +12842,7 @@ function up45(db) {
12782
12842
  ON memory_md_heads(lease_expires_at);
12783
12843
  `);
12784
12844
  }
12785
- function up46(db) {
12845
+ function up47(db) {
12786
12846
  db.exec(`
12787
12847
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12788
12848
 
@@ -12843,7 +12903,7 @@ function up46(db) {
12843
12903
  AND COALESCE(source_type, 'summary') = 'summary';
12844
12904
  `);
12845
12905
  }
12846
- function up47(db) {
12906
+ function up48(db) {
12847
12907
  db.exec(`
12848
12908
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12849
12909
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -12941,7 +13001,7 @@ function up47(db) {
12941
13001
  AND COALESCE(source_type, 'summary') = 'summary';
12942
13002
  `);
12943
13003
  }
12944
- function up48(db) {
13004
+ function up49(db) {
12945
13005
  db.exec(`
12946
13006
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
12947
13007
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13059,7 +13119,7 @@ function up48(db) {
13059
13119
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
13060
13120
  `);
13061
13121
  }
13062
- function up49(db) {
13122
+ function up50(db) {
13063
13123
  db.exec(`
13064
13124
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13065
13125
  session_key TEXT NOT NULL,
@@ -13076,7 +13136,7 @@ function hasTable(db, name) {
13076
13136
  WHERE type = 'table' AND name = ?
13077
13137
  LIMIT 1`).get(name) !== undefined;
13078
13138
  }
13079
- function up50(db) {
13139
+ function up51(db) {
13080
13140
  db.exec(`
13081
13141
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13082
13142
  id TEXT PRIMARY KEY,
@@ -13246,7 +13306,7 @@ function addColumnIfMissing15(db, table, column, definition) {
13246
13306
  return;
13247
13307
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13248
13308
  }
13249
- function up51(db) {
13309
+ function up52(db) {
13250
13310
  addColumnIfMissing15(db, "summary_jobs", "session_id", "TEXT");
13251
13311
  addColumnIfMissing15(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13252
13312
  addColumnIfMissing15(db, "summary_jobs", "captured_at", "TEXT");
@@ -13338,7 +13398,7 @@ function up51(db) {
13338
13398
  VALUES ('rebuild');
13339
13399
  `);
13340
13400
  }
13341
- function up52(db) {
13401
+ function up53(db) {
13342
13402
  db.exec(`
13343
13403
  CREATE TABLE IF NOT EXISTS mcp_invocations (
13344
13404
  id TEXT PRIMARY KEY,
@@ -13355,7 +13415,7 @@ function up52(db) {
13355
13415
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13356
13416
  `);
13357
13417
  }
13358
- function up53(db) {
13418
+ function up54(db) {
13359
13419
  db.exec(`
13360
13420
  CREATE TABLE IF NOT EXISTS skill_invocations (
13361
13421
  id TEXT PRIMARY KEY,
@@ -13371,7 +13431,7 @@ function up53(db) {
13371
13431
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
13372
13432
  `);
13373
13433
  }
13374
- function up54(db) {
13434
+ function up55(db) {
13375
13435
  db.exec(`
13376
13436
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13377
13437
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13402,7 +13462,7 @@ function up54(db) {
13402
13462
  ON task_scope_hints(agent_id, updated_at);
13403
13463
  `);
13404
13464
  }
13405
- function up55(db) {
13465
+ function up56(db) {
13406
13466
  db.exec(`
13407
13467
  CREATE TABLE IF NOT EXISTS dreaming_state (
13408
13468
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13445,7 +13505,7 @@ function ensureMemoriesScopeColumns(db) {
13445
13505
  if (!names.has("scope"))
13446
13506
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13447
13507
  }
13448
- function up56(db) {
13508
+ function up57(db) {
13449
13509
  ensureMemoriesScopeColumns(db);
13450
13510
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13451
13511
  db.exec(`
@@ -13458,20 +13518,20 @@ function up56(db) {
13458
13518
  WHERE content_hash IS NOT NULL AND is_deleted = 0
13459
13519
  `);
13460
13520
  }
13461
- function up57(db) {
13521
+ function up58(db) {
13462
13522
  const sql = readMemoriesFtsSql(db);
13463
13523
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13464
13524
  return;
13465
13525
  recreateMemoriesFts(db);
13466
13526
  }
13467
- function up58(db) {
13527
+ function up59(db) {
13468
13528
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13469
13529
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13470
13530
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
13471
13531
  ON entities(entity_type, mentions)
13472
13532
  WHERE entity_type = 'extracted'`);
13473
13533
  }
13474
- function up59(db) {
13534
+ function up60(db) {
13475
13535
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13476
13536
  if (!cols.some((col) => col.name === "claim_key")) {
13477
13537
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13480,7 +13540,7 @@ function up59(db) {
13480
13540
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
13481
13541
  WHERE claim_key IS NOT NULL`);
13482
13542
  }
13483
- function up60(db) {
13543
+ function up61(db) {
13484
13544
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13485
13545
  if (!cols.some((col) => col.name === "group_key")) {
13486
13546
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13492,13 +13552,13 @@ function up60(db) {
13492
13552
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
13493
13553
  WHERE claim_key IS NOT NULL`);
13494
13554
  }
13495
- function up61(db) {
13555
+ function up62(db) {
13496
13556
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13497
13557
  if (cols.some((col) => col.name === "source_mtime_ms"))
13498
13558
  return;
13499
13559
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
13500
13560
  }
13501
- function up62(db) {
13561
+ function up63(db) {
13502
13562
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13503
13563
  const names = new Set(cols.map((col) => col.name));
13504
13564
  if (!names.has("is_deleted")) {
@@ -13512,7 +13572,7 @@ function up62(db) {
13512
13572
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
13513
13573
  `);
13514
13574
  }
13515
- function up63(db) {
13575
+ function up64(db) {
13516
13576
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13517
13577
  db.exec(`
13518
13578
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13530,7 +13590,7 @@ function addColumnIfMissing16(db, table, column, definition) {
13530
13590
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13531
13591
  }
13532
13592
  }
13533
- function up64(db) {
13593
+ function up65(db) {
13534
13594
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13535
13595
  addColumnIfMissing16(db, table, "source_id", "TEXT");
13536
13596
  addColumnIfMissing16(db, table, "source_kind", "TEXT");
@@ -13550,7 +13610,7 @@ function hasColumn7(db, table, column) {
13550
13610
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13551
13611
  return rows.some((row) => row.name === column);
13552
13612
  }
13553
- function up65(db) {
13613
+ function up66(db) {
13554
13614
  if (!hasTable2(db, "embeddings"))
13555
13615
  return;
13556
13616
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13558,7 +13618,7 @@ function up65(db) {
13558
13618
  }
13559
13619
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
13560
13620
  }
13561
- function up66(db) {
13621
+ function up67(db) {
13562
13622
  db.exec(`
13563
13623
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13564
13624
  id TEXT PRIMARY KEY,
@@ -13599,7 +13659,7 @@ function addColumnIfMissing17(db, table, column, definition) {
13599
13659
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13600
13660
  }
13601
13661
  }
13602
- function up67(db) {
13662
+ function up68(db) {
13603
13663
  db.exec(`
13604
13664
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13605
13665
  id TEXT PRIMARY KEY,
@@ -13642,7 +13702,7 @@ function up67(db) {
13642
13702
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
13643
13703
  }
13644
13704
  }
13645
- function up68(db) {
13705
+ function up69(db) {
13646
13706
  db.exec(`
13647
13707
  CREATE TABLE IF NOT EXISTS daily_reflections (
13648
13708
  id TEXT PRIMARY KEY,
@@ -13669,7 +13729,7 @@ function up68(db) {
13669
13729
  WHERE content_key IS NOT NULL;
13670
13730
  `);
13671
13731
  }
13672
- function up69(db) {
13732
+ function up70(db) {
13673
13733
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13674
13734
  const colNames = new Set(cols.flatMap((c2) => typeof c2.name === "string" ? [c2.name] : []));
13675
13735
  if (!colNames.has("content_key")) {
@@ -13706,7 +13766,7 @@ function backfillVersionRoots(db) {
13706
13766
  WHERE version_root_id IS NULL
13707
13767
  `);
13708
13768
  }
13709
- function up70(db) {
13769
+ function up71(db) {
13710
13770
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13711
13771
  addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13712
13772
  addColumnIfMissing18(db, table, "archived_at", "TEXT");
@@ -13741,7 +13801,7 @@ function up70(db) {
13741
13801
  ON entity_aspects(agent_id, proposal_id);
13742
13802
  `);
13743
13803
  }
13744
- function up71(db) {
13804
+ function up72(db) {
13745
13805
  db.exec(`
13746
13806
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13747
13807
  id TEXT PRIMARY KEY,
@@ -13797,7 +13857,7 @@ function ensureMemoriesScopeColumns2(db) {
13797
13857
  if (!names.has("runtime_path"))
13798
13858
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13799
13859
  }
13800
- function up72(db) {
13860
+ function up73(db) {
13801
13861
  ensureMemoriesScopeColumns2(db);
13802
13862
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13803
13863
  db.exec(`
@@ -13811,7 +13871,7 @@ function up72(db) {
13811
13871
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
13812
13872
  `);
13813
13873
  }
13814
- function up73(db) {
13874
+ function up74(db) {
13815
13875
  db.exec(`
13816
13876
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13817
13877
  session_key TEXT NOT NULL,
@@ -13846,7 +13906,7 @@ function up73(db) {
13846
13906
  ON session_recall_events(item_kind, item_id, created_at DESC);
13847
13907
  `);
13848
13908
  }
13849
- function up74(db) {
13909
+ function up75(db) {
13850
13910
  db.exec(`
13851
13911
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13852
13912
  aggregate_memory_id TEXT NOT NULL,
@@ -13865,7 +13925,7 @@ function addColumnIfMissing19(db, table, column, definition) {
13865
13925
  return;
13866
13926
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13867
13927
  }
13868
- function up75(db) {
13928
+ function up76(db) {
13869
13929
  addColumnIfMissing19(db, "memory_artifacts", "source_id", "TEXT");
13870
13930
  addColumnIfMissing19(db, "memory_artifacts", "source_root", "TEXT");
13871
13931
  addColumnIfMissing19(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -13878,7 +13938,7 @@ function up75(db) {
13878
13938
  ON memory_artifacts(agent_id, source_id, source_root);
13879
13939
  `);
13880
13940
  }
13881
- function up76(db) {
13941
+ function up77(db) {
13882
13942
  db.exec(`
13883
13943
  CREATE TABLE IF NOT EXISTS temporal_edges (
13884
13944
  id TEXT PRIMARY KEY,
@@ -13901,7 +13961,7 @@ function up76(db) {
13901
13961
  ON temporal_edges(agent_id, subject_type, subject_id);
13902
13962
  `);
13903
13963
  }
13904
- function up77(db) {
13964
+ function up78(db) {
13905
13965
  db.exec(`
13906
13966
  CREATE TABLE IF NOT EXISTS entity_aliases (
13907
13967
  id TEXT PRIMARY KEY,
@@ -13925,7 +13985,7 @@ function up77(db) {
13925
13985
  ON entity_aliases(agent_id, canonical_alias, status);
13926
13986
  `);
13927
13987
  }
13928
- function up78(db) {
13988
+ function up79(db) {
13929
13989
  db.exec(`
13930
13990
  CREATE TABLE IF NOT EXISTS api_keys (
13931
13991
  id TEXT PRIMARY KEY,
@@ -13953,7 +14013,7 @@ function up78(db) {
13953
14013
  ON api_keys(connector, harness);
13954
14014
  `);
13955
14015
  }
13956
- function up79(db) {
14016
+ function up80(db) {
13957
14017
  db.exec(`
13958
14018
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
13959
14019
  id TEXT PRIMARY KEY,
@@ -13988,7 +14048,7 @@ function hasColumn10(db, table, column) {
13988
14048
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13989
14049
  return rows.some((row) => row.name === column);
13990
14050
  }
13991
- function up80(db) {
14051
+ function up81(db) {
13992
14052
  if (!hasColumn10(db, "documents", "agent_id")) {
13993
14053
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
13994
14054
  }
@@ -14074,7 +14134,7 @@ function up80(db) {
14074
14134
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
14075
14135
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
14076
14136
  }
14077
- function up81(db) {
14137
+ function up82(db) {
14078
14138
  db.exec(`
14079
14139
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14080
14140
  aggregate_memory_id TEXT NOT NULL,
@@ -14096,7 +14156,7 @@ function hasColumn11(db, table, column) {
14096
14156
  return rows.some((row) => row.name === column);
14097
14157
  }
14098
14158
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14099
- function up82(db) {
14159
+ function up83(db) {
14100
14160
  for (const column of COLUMNS) {
14101
14161
  if (!hasColumn11(db, "skill_invocations", column)) {
14102
14162
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14177,7 +14237,7 @@ function documentScopeColumnsPreservingExisting(db) {
14177
14237
  `);
14178
14238
  }
14179
14239
  try {
14180
- up80(db);
14240
+ up81(db);
14181
14241
  if (preserveAgentId) {
14182
14242
  db.exec(`
14183
14243
  UPDATE documents
@@ -14197,12 +14257,12 @@ function documentScopeColumnsPreservingExisting(db) {
14197
14257
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14198
14258
  }
14199
14259
  }
14200
- function up83(db) {
14201
- up79(db);
14260
+ function up84(db) {
14261
+ up80(db);
14202
14262
  if (hasTable3(db, "documents")) {
14203
14263
  documentScopeColumnsPreservingExisting(db);
14204
14264
  }
14205
- up81(db);
14265
+ up82(db);
14206
14266
  addColumnIfMissing20(db, "memories", "superseded_by", "TEXT");
14207
14267
  addColumnIfMissing20(db, "memories", "superseded_at", "TEXT");
14208
14268
  addColumnIfMissing20(db, "memories", "superseded_reason", "TEXT");
@@ -14259,7 +14319,7 @@ function up83(db) {
14259
14319
  AND ${sourceAgentId} = ${targetAgentId}
14260
14320
  `);
14261
14321
  }
14262
- function up84(db) {
14322
+ function up85(db) {
14263
14323
  db.exec(`
14264
14324
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14265
14325
  path TEXT PRIMARY KEY,
@@ -14289,7 +14349,7 @@ function up84(db) {
14289
14349
  ON legacy_markdown_chunks(memory_id);
14290
14350
  `);
14291
14351
  }
14292
- function up85(db) {
14352
+ function up86(db) {
14293
14353
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14294
14354
  const tableNames = new Set(tables.map((r2) => String(r2.name)));
14295
14355
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14348,7 +14408,7 @@ function addColumnIfMissing21(db, table, column, definition) {
14348
14408
  return;
14349
14409
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14350
14410
  }
14351
- function up86(db) {
14411
+ function up87(db) {
14352
14412
  addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
14353
14413
  db.exec(`
14354
14414
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -14361,14 +14421,14 @@ function addColumnIfMissing22(db, table, column, definition) {
14361
14421
  return;
14362
14422
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14363
14423
  }
14364
- function up87(db) {
14424
+ function up88(db) {
14365
14425
  addColumnIfMissing22(db, "summary_jobs", "boundary_reason", "TEXT");
14366
14426
  db.exec(`
14367
14427
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
14368
14428
  ON summary_jobs(agent_id, session_key, boundary_reason)
14369
14429
  `);
14370
14430
  }
14371
- function up88(db) {
14431
+ function up89(db) {
14372
14432
  db.exec(`
14373
14433
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14374
14434
  agent_id TEXT NOT NULL,
@@ -14386,7 +14446,7 @@ function up88(db) {
14386
14446
  ON transcript_capture_jobs(agent_id, session_id, status);
14387
14447
  `);
14388
14448
  }
14389
- function up89(db) {
14449
+ function up90(db) {
14390
14450
  db.exec(`
14391
14451
  CREATE TABLE IF NOT EXISTS job_cancellations (
14392
14452
  id TEXT PRIMARY KEY,
@@ -14414,7 +14474,7 @@ function indexExists(db, table, indexName) {
14414
14474
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14415
14475
  return rows.some((row) => row.name === indexName);
14416
14476
  }
14417
- function up90(db) {
14477
+ function up91(db) {
14418
14478
  db.exec(`
14419
14479
  CREATE TABLE IF NOT EXISTS job_archive (
14420
14480
  id TEXT PRIMARY KEY,
@@ -14441,7 +14501,7 @@ function indexExists2(db, table, indexName) {
14441
14501
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
14442
14502
  return rows.some((row) => row.name === indexName);
14443
14503
  }
14444
- function up91(db) {
14504
+ function up92(db) {
14445
14505
  db.exec(`
14446
14506
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14447
14507
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14454,7 +14514,7 @@ function up91(db) {
14454
14514
  )
14455
14515
  `);
14456
14516
  }
14457
- function up92(db) {
14517
+ function up93(db) {
14458
14518
  db.exec(`
14459
14519
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14460
14520
  id TEXT PRIMARY KEY,
@@ -14473,7 +14533,7 @@ function up92(db) {
14473
14533
  ON embeddings_staging(agent_id, source_type, source_id);
14474
14534
  `);
14475
14535
  }
14476
- function up93(db) {
14536
+ function up94(db) {
14477
14537
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14478
14538
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14479
14539
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14484,7 +14544,7 @@ function hasColumn13(db, table, column) {
14484
14544
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14485
14545
  return rows.some((r2) => r2.name === column);
14486
14546
  }
14487
- function up94(db) {
14547
+ function up95(db) {
14488
14548
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14489
14549
  if (tables.length === 0)
14490
14550
  return;
@@ -14509,23 +14569,23 @@ function up94(db) {
14509
14569
  function hasColumn14(db, table, column) {
14510
14570
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14511
14571
  }
14512
- function up95(db) {
14572
+ function up96(db) {
14513
14573
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14514
14574
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14515
14575
  return;
14516
14576
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
14517
14577
  }
14518
- function up96(db) {
14578
+ function up97(db) {
14519
14579
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14520
14580
  }
14521
- function up97(db) {
14581
+ function up98(db) {
14522
14582
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14523
14583
  if (!columns.some((column) => column.name === "last_failure_at")) {
14524
14584
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
14525
14585
  }
14526
14586
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
14527
14587
  }
14528
- function up98(db) {
14588
+ function up99(db) {
14529
14589
  db.exec(`
14530
14590
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14531
14591
  agent_id TEXT NOT NULL,
@@ -14542,7 +14602,7 @@ function up98(db) {
14542
14602
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
14543
14603
  `);
14544
14604
  }
14545
- function up99(db) {
14605
+ function up100(db) {
14546
14606
  db.exec(`
14547
14607
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14548
14608
  id TEXT PRIMARY KEY,
@@ -14562,7 +14622,7 @@ function up99(db) {
14562
14622
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
14563
14623
  `);
14564
14624
  }
14565
- function up100(db) {
14625
+ function up101(db) {
14566
14626
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14567
14627
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14568
14628
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14571,7 +14631,7 @@ function up100(db) {
14571
14631
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
14572
14632
  }
14573
14633
  }
14574
- function up101(db) {
14634
+ function up102(db) {
14575
14635
  db.exec(`
14576
14636
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14577
14637
  id TEXT PRIMARY KEY,
@@ -14593,7 +14653,7 @@ function up101(db) {
14593
14653
  function hasColumn15(db, table, column) {
14594
14654
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14595
14655
  }
14596
- function up102(db) {
14656
+ function up103(db) {
14597
14657
  const requiredMemoryColumns = [
14598
14658
  "content_hash",
14599
14659
  "normalized_content",
@@ -14644,7 +14704,7 @@ function up102(db) {
14644
14704
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
14645
14705
  `);
14646
14706
  }
14647
- function up103(db) {
14707
+ function up104(db) {
14648
14708
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14649
14709
  if (tables.length !== 2)
14650
14710
  return;
@@ -14667,7 +14727,7 @@ function tableExists(db, table) {
14667
14727
  function hasColumn16(db, table, column) {
14668
14728
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14669
14729
  }
14670
- function up104(db) {
14730
+ function up105(db) {
14671
14731
  db.exec(`
14672
14732
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14673
14733
  derived_memory_id TEXT NOT NULL,
@@ -14710,7 +14770,7 @@ function up104(db) {
14710
14770
  `);
14711
14771
  }
14712
14772
  }
14713
- function up105(db) {
14773
+ function up106(db) {
14714
14774
  db.exec(`
14715
14775
  DROP TRIGGER IF EXISTS entities_fts_ai;
14716
14776
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -14799,7 +14859,7 @@ function up105(db) {
14799
14859
  function hasColumn17(db, table, column) {
14800
14860
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14801
14861
  }
14802
- function up106(db) {
14862
+ function up107(db) {
14803
14863
  if (!hasColumn17(db, "memories", "review_after")) {
14804
14864
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
14805
14865
  }
@@ -14815,14 +14875,14 @@ var TOKEN_COLUMNS = [
14815
14875
  ["tokens_cache_write", "INTEGER"],
14816
14876
  ["tokens_cost", "REAL"]
14817
14877
  ];
14818
- function up107(db) {
14878
+ function up108(db) {
14819
14879
  for (const [column, type] of TOKEN_COLUMNS) {
14820
14880
  if (!hasColumn18(db, "dreaming_passes", column)) {
14821
14881
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
14822
14882
  }
14823
14883
  }
14824
14884
  }
14825
- function up108(db) {
14885
+ function up109(db) {
14826
14886
  db.exec(`
14827
14887
  CREATE TABLE IF NOT EXISTS embedding_usage (
14828
14888
  day TEXT NOT NULL,
@@ -14835,7 +14895,7 @@ function up108(db) {
14835
14895
  );
14836
14896
  `);
14837
14897
  }
14838
- function up109(db) {
14898
+ function up110(db) {
14839
14899
  db.exec(`
14840
14900
  CREATE TABLE IF NOT EXISTS telemetry_install (
14841
14901
  id TEXT PRIMARY KEY,
@@ -14843,7 +14903,7 @@ function up109(db) {
14843
14903
  );
14844
14904
  `);
14845
14905
  }
14846
- function up110(db) {
14906
+ function up111(db) {
14847
14907
  db.exec(`
14848
14908
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
14849
14909
  ON memory_entity_mentions(entity_id, memory_id);
@@ -14854,7 +14914,7 @@ function hasColumn19(db, table, column) {
14854
14914
  return rows.some((row) => row.name === column);
14855
14915
  }
14856
14916
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
14857
- function up111(db) {
14917
+ function up112(db) {
14858
14918
  for (const column of COLUMNS2) {
14859
14919
  if (!hasColumn19(db, "telemetry_install", column)) {
14860
14920
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -14870,7 +14930,7 @@ function addColumnIfMissing23(db, column, definition) {
14870
14930
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
14871
14931
  }
14872
14932
  }
14873
- function up112(db) {
14933
+ function up113(db) {
14874
14934
  addColumnIfMissing23(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
14875
14935
  addColumnIfMissing23(db, "claim_token", "TEXT");
14876
14936
  addColumnIfMissing23(db, "claimed_at", "TEXT");
@@ -14879,7 +14939,7 @@ function up112(db) {
14879
14939
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
14880
14940
  `);
14881
14941
  }
14882
- function up113(db) {
14942
+ function up114(db) {
14883
14943
  db.exec(`
14884
14944
  CREATE TABLE IF NOT EXISTS session_claims (
14885
14945
  session_key TEXT NOT NULL,
@@ -14900,7 +14960,7 @@ function up113(db) {
14900
14960
  ON session_claims(agent_id, state, expires_at);
14901
14961
  `);
14902
14962
  }
14903
- function up114(db) {
14963
+ function up115(db) {
14904
14964
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
14905
14965
  if (table == null)
14906
14966
  return;
@@ -14909,7 +14969,7 @@ function up114(db) {
14909
14969
  ON entity_attributes(memory_id, agent_id, status, importance);
14910
14970
  `);
14911
14971
  }
14912
- function up115(db) {
14972
+ function up116(db) {
14913
14973
  db.exec(`
14914
14974
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
14915
14975
  id TEXT PRIMARY KEY,
@@ -14966,7 +15026,7 @@ function addColumnIfMissing24(db, column, definition) {
14966
15026
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
14967
15027
  }
14968
15028
  }
14969
- function up116(db) {
15029
+ function up117(db) {
14970
15030
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
14971
15031
  if (table == null)
14972
15032
  return;
@@ -15167,7 +15227,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15167
15227
  insert.run(...values);
15168
15228
  }
15169
15229
  }
15170
- function up117(db) {
15230
+ function up118(db) {
15171
15231
  if (!hasTable4(db, "session_transcripts"))
15172
15232
  return;
15173
15233
  addColumnIfMissing25(db, "session_transcripts", "completed_at", "TEXT");
@@ -15220,7 +15280,7 @@ function up117(db) {
15220
15280
  ON session_transcripts(agent_id, content_hash);
15221
15281
  `);
15222
15282
  }
15223
- function up118(db) {
15283
+ function up119(db) {
15224
15284
  db.exec(`
15225
15285
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15226
15286
  ON memory_jobs(status)
@@ -15239,12 +15299,12 @@ function up118(db) {
15239
15299
  function hasColumn22(db, table, column) {
15240
15300
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15241
15301
  }
15242
- function up119(db) {
15302
+ function up120(db) {
15243
15303
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15244
15304
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15245
15305
  }
15246
15306
  }
15247
- function up120(db) {
15307
+ function up121(db) {
15248
15308
  db.exec(`
15249
15309
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15250
15310
  agent_id TEXT NOT NULL,
@@ -15273,7 +15333,7 @@ function addColumnIfMissing26(db, column, definition) {
15273
15333
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15274
15334
  }
15275
15335
  }
15276
- function up121(db) {
15336
+ function up122(db) {
15277
15337
  addColumnIfMissing26(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15278
15338
  addColumnIfMissing26(db, "last_attempt_at", "TEXT");
15279
15339
  addColumnIfMissing26(db, "sent_at", "TEXT");
@@ -15294,7 +15354,7 @@ function up121(db) {
15294
15354
  VALUES (1, CURRENT_TIMESTAMP);
15295
15355
  `);
15296
15356
  }
15297
- function up122(db) {
15357
+ function up123(db) {
15298
15358
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15299
15359
  const names = new Set(columns.map((column) => column.name));
15300
15360
  if (!names.has("failure_class")) {
@@ -15311,7 +15371,7 @@ function up122(db) {
15311
15371
  }
15312
15372
  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)");
15313
15373
  }
15314
- function up123(db) {
15374
+ function up124(db) {
15315
15375
  db.exec(`
15316
15376
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15317
15377
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15335,7 +15395,7 @@ function up123(db) {
15335
15395
  ON embedding_index_failures(source_type, source_id);
15336
15396
  `);
15337
15397
  }
15338
- function up124(db) {
15398
+ function up125(db) {
15339
15399
  db.exec(`
15340
15400
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15341
15401
  id TEXT PRIMARY KEY,
@@ -15385,7 +15445,7 @@ function backfillTable(db, params) {
15385
15445
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15386
15446
  backfill(db, rows, params.sourceKind, params.scannedAt);
15387
15447
  }
15388
- function up125(db) {
15448
+ function up126(db) {
15389
15449
  db.exec(`
15390
15450
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15391
15451
  agent_id TEXT NOT NULL,
@@ -15442,7 +15502,7 @@ function up125(db) {
15442
15502
  scannedAt
15443
15503
  });
15444
15504
  }
15445
- function up126(db) {
15505
+ function up127(db) {
15446
15506
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15447
15507
  if (!table)
15448
15508
  return;
@@ -15476,7 +15536,7 @@ function up126(db) {
15476
15536
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
15477
15537
  `);
15478
15538
  }
15479
- function up127(db) {
15539
+ function up128(db) {
15480
15540
  db.exec(`
15481
15541
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15482
15542
  id TEXT PRIMARY KEY,
@@ -15532,7 +15592,7 @@ function up127(db) {
15532
15592
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
15533
15593
  `);
15534
15594
  }
15535
- function up128(db) {
15595
+ function up129(db) {
15536
15596
  db.exec(`
15537
15597
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15538
15598
  ON memory_jobs(status, created_at)
@@ -15547,7 +15607,7 @@ function up128(db) {
15547
15607
  function tableExists3(db, table) {
15548
15608
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15549
15609
  }
15550
- function up129(db) {
15610
+ function up130(db) {
15551
15611
  if (!tableExists3(db, "memory_jobs"))
15552
15612
  return;
15553
15613
  if (!tableExists3(db, "job_cancellations")) {
@@ -15596,7 +15656,7 @@ function up129(db) {
15596
15656
  AND status IN ('pending', 'leased');
15597
15657
  `);
15598
15658
  }
15599
- function up130(db) {
15659
+ function up131(db) {
15600
15660
  db.exec(`
15601
15661
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15602
15662
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15636,7 +15696,7 @@ function up130(db) {
15636
15696
  END;
15637
15697
  `);
15638
15698
  }
15639
- function up131(db) {
15699
+ function up132(db) {
15640
15700
  db.exec(`
15641
15701
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15642
15702
  agent_id TEXT NOT NULL,
@@ -15659,13 +15719,13 @@ function up131(db) {
15659
15719
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
15660
15720
  `);
15661
15721
  }
15662
- function up132(db) {
15722
+ function up133(db) {
15663
15723
  db.exec(`
15664
15724
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15665
15725
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
15666
15726
  `);
15667
15727
  }
15668
- function up133(db) {
15728
+ function up134(db) {
15669
15729
  db.exec(`
15670
15730
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15671
15731
  id TEXT PRIMARY KEY,
@@ -15717,7 +15777,7 @@ function up133(db) {
15717
15777
  if (!names.has("format_version"))
15718
15778
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
15719
15779
  }
15720
- function up134(db) {
15780
+ function up135(db) {
15721
15781
  db.exec(`
15722
15782
  CREATE TABLE memory_head_entries_v134 (
15723
15783
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15735,7 +15795,7 @@ function up134(db) {
15735
15795
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
15736
15796
  `);
15737
15797
  }
15738
- function up135(db) {
15798
+ function up136(db) {
15739
15799
  db.exec(`
15740
15800
  CREATE TABLE IF NOT EXISTS memory_head_publications (
15741
15801
  agent_id TEXT NOT NULL,
@@ -15751,7 +15811,7 @@ function up135(db) {
15751
15811
  ON memory_head_publications(agent_id, status, revision DESC);
15752
15812
  `);
15753
15813
  }
15754
- function up136(db) {
15814
+ function up137(db) {
15755
15815
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r2) => r2.name));
15756
15816
  for (const [name, type] of [
15757
15817
  ["entry_id", "TEXT"],
@@ -15765,7 +15825,7 @@ function up136(db) {
15765
15825
  }
15766
15826
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
15767
15827
  }
15768
- function up137(db) {
15828
+ function up138(db) {
15769
15829
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r2) => r2.name));
15770
15830
  for (const [name, type] of [
15771
15831
  ["head_revision", "INTEGER"],
@@ -15787,7 +15847,7 @@ function addColumnIfMissing27(db, table, column, definition) {
15787
15847
  if (!hasColumn25(db, table, column))
15788
15848
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
15789
15849
  }
15790
- function up138(db) {
15850
+ function up139(db) {
15791
15851
  addColumnIfMissing27(db, "memories", "manual_override", "INTEGER DEFAULT 0");
15792
15852
  db.exec(`
15793
15853
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16092,7 +16152,7 @@ function up138(db) {
16092
16152
  GROUP BY j.agent_id;
16093
16153
  `);
16094
16154
  }
16095
- function up139(db) {
16155
+ function up140(db) {
16096
16156
  db.exec(`
16097
16157
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16098
16158
  agent_id TEXT NOT NULL,
@@ -16108,7 +16168,7 @@ function up139(db) {
16108
16168
  ON native_source_sync_state(agent_id, status);
16109
16169
  `);
16110
16170
  }
16111
- function up140(db) {
16171
+ function up141(db) {
16112
16172
  db.exec(`
16113
16173
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16114
16174
  agent_id TEXT NOT NULL,
@@ -16120,7 +16180,7 @@ function up140(db) {
16120
16180
  );
16121
16181
  `);
16122
16182
  }
16123
- function up141(db) {
16183
+ function up142(db) {
16124
16184
  db.exec(`
16125
16185
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16126
16186
  agent_id TEXT NOT NULL,
@@ -16134,13 +16194,13 @@ function up141(db) {
16134
16194
  );
16135
16195
  `);
16136
16196
  }
16137
- function up142(db) {
16197
+ function up143(db) {
16138
16198
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16139
16199
  if (!columns.some((column) => column.name === "frontier")) {
16140
16200
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
16141
16201
  }
16142
16202
  }
16143
- function up143(db) {
16203
+ function up144(db) {
16144
16204
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16145
16205
  const additions = [
16146
16206
  ["migration_phase", "TEXT"],
@@ -16175,13 +16235,13 @@ function up143(db) {
16175
16235
  `);
16176
16236
  }
16177
16237
  }
16178
- function up144(db) {
16238
+ function up145(db) {
16179
16239
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16180
16240
  if (!columns.has("lease_token")) {
16181
16241
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
16182
16242
  }
16183
16243
  }
16184
- function up145(db) {
16244
+ function up146(db) {
16185
16245
  db.exec(`
16186
16246
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16187
16247
  agent_id TEXT NOT NULL,
@@ -16199,7 +16259,7 @@ function up145(db) {
16199
16259
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
16200
16260
  `);
16201
16261
  }
16202
- function up146(db) {
16262
+ function up147(db) {
16203
16263
  db.exec(`
16204
16264
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16205
16265
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16254,24 +16314,36 @@ function up146(db) {
16254
16314
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
16255
16315
  `);
16256
16316
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
16257
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
16317
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
16318
+ let exists;
16319
+ try {
16320
+ exists = statement.get(column);
16321
+ } finally {
16322
+ statement.finalize?.();
16323
+ }
16258
16324
  if (exists == null)
16259
16325
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
16260
16326
  }
16261
16327
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
16262
16328
  }
16263
- function up147(db) {
16329
+ function up148(db) {
16264
16330
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16265
16331
  }
16266
- function up148(db) {
16332
+ function up149(db) {
16267
16333
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16268
16334
  if (!columns.some((column) => column.name === "source_id")) {
16269
16335
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
16270
16336
  }
16271
16337
  }
16272
- function up149(db) {
16338
+ function up150(db) {
16273
16339
  const addColumn = (table, column, definition) => {
16274
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
16340
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16341
+ let exists;
16342
+ try {
16343
+ exists = statement.get(table, column);
16344
+ } finally {
16345
+ statement.finalize?.();
16346
+ }
16275
16347
  if (exists == null)
16276
16348
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16277
16349
  };
@@ -16284,7 +16356,7 @@ function addColumnIfMissing28(db, table, column, definition) {
16284
16356
  if (!columns.some((row) => row.name === column))
16285
16357
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16286
16358
  }
16287
- function up150(db) {
16359
+ function up151(db) {
16288
16360
  addColumnIfMissing28(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16289
16361
  addColumnIfMissing28(db, "dreaming_passes", "head_base_revision", "INTEGER");
16290
16362
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -16438,13 +16510,13 @@ var MIGRATIONS = [
16438
16510
  {
16439
16511
  version: 1,
16440
16512
  name: "baseline",
16441
- up,
16513
+ up: up2,
16442
16514
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16443
16515
  },
16444
16516
  {
16445
16517
  version: 2,
16446
16518
  name: "pipeline-v2",
16447
- up: up2,
16519
+ up: up3,
16448
16520
  artifacts: {
16449
16521
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16450
16522
  }
@@ -16452,12 +16524,12 @@ var MIGRATIONS = [
16452
16524
  {
16453
16525
  version: 3,
16454
16526
  name: "unique-content-hash",
16455
- up: up3
16527
+ up: up4
16456
16528
  },
16457
16529
  {
16458
16530
  version: 4,
16459
16531
  name: "history-actor-and-retention",
16460
- up: up4,
16532
+ up: up5,
16461
16533
  artifacts: {
16462
16534
  columns: [{ table: "memory_history", column: "actor_type" }]
16463
16535
  }
@@ -16465,7 +16537,7 @@ var MIGRATIONS = [
16465
16537
  {
16466
16538
  version: 5,
16467
16539
  name: "graph-extended",
16468
- up: up5,
16540
+ up: up6,
16469
16541
  artifacts: {
16470
16542
  columns: [{ table: "entities", column: "canonical_name" }]
16471
16543
  }
@@ -16473,7 +16545,7 @@ var MIGRATIONS = [
16473
16545
  {
16474
16546
  version: 6,
16475
16547
  name: "idempotency-key",
16476
- up: up6,
16548
+ up: up7,
16477
16549
  artifacts: {
16478
16550
  columns: [{ table: "memories", column: "idempotency_key" }]
16479
16551
  }
@@ -16481,42 +16553,42 @@ var MIGRATIONS = [
16481
16553
  {
16482
16554
  version: 7,
16483
16555
  name: "documents-and-connectors",
16484
- up: up7,
16556
+ up: up8,
16485
16557
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16486
16558
  },
16487
16559
  {
16488
16560
  version: 8,
16489
16561
  name: "embeddings-unique-hash",
16490
- up: up8
16562
+ up: up9
16491
16563
  },
16492
16564
  {
16493
16565
  version: 9,
16494
16566
  name: "summary-jobs",
16495
- up: up9,
16567
+ up: up10,
16496
16568
  artifacts: { tables: ["summary_jobs"] }
16497
16569
  },
16498
16570
  {
16499
16571
  version: 10,
16500
16572
  name: "umap-cache",
16501
- up: up10,
16573
+ up: up11,
16502
16574
  artifacts: { tables: ["umap_cache"] }
16503
16575
  },
16504
16576
  {
16505
16577
  version: 11,
16506
16578
  name: "session-scores",
16507
- up: up11,
16579
+ up: up12,
16508
16580
  artifacts: { tables: ["session_scores"] }
16509
16581
  },
16510
16582
  {
16511
16583
  version: 12,
16512
16584
  name: "scheduled-tasks",
16513
- up: up12,
16585
+ up: up13,
16514
16586
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16515
16587
  },
16516
16588
  {
16517
16589
  version: 13,
16518
16590
  name: "ingestion-tracking",
16519
- up: up13,
16591
+ up: up14,
16520
16592
  artifacts: {
16521
16593
  columns: [
16522
16594
  { table: "memories", column: "source_path" },
@@ -16527,13 +16599,13 @@ var MIGRATIONS = [
16527
16599
  {
16528
16600
  version: 14,
16529
16601
  name: "telemetry",
16530
- up: up14,
16602
+ up: up15,
16531
16603
  artifacts: { tables: ["telemetry_events"] }
16532
16604
  },
16533
16605
  {
16534
16606
  version: 15,
16535
16607
  name: "session-memories",
16536
- up: up15,
16608
+ up: up16,
16537
16609
  artifacts: {
16538
16610
  tables: ["session_memories"],
16539
16611
  columns: [
@@ -16545,13 +16617,13 @@ var MIGRATIONS = [
16545
16617
  {
16546
16618
  version: 16,
16547
16619
  name: "session-checkpoints",
16548
- up: up16,
16620
+ up: up17,
16549
16621
  artifacts: { tables: ["session_checkpoints"] }
16550
16622
  },
16551
16623
  {
16552
16624
  version: 17,
16553
16625
  name: "task-skills",
16554
- up: up17,
16626
+ up: up18,
16555
16627
  artifacts: {
16556
16628
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16557
16629
  }
@@ -16559,13 +16631,13 @@ var MIGRATIONS = [
16559
16631
  {
16560
16632
  version: 18,
16561
16633
  name: "skill-meta",
16562
- up: up18,
16634
+ up: up19,
16563
16635
  artifacts: { tables: ["skill_meta"] }
16564
16636
  },
16565
16637
  {
16566
16638
  version: 19,
16567
16639
  name: "knowledge-structure",
16568
- up: up19,
16640
+ up: up20,
16569
16641
  artifacts: {
16570
16642
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16571
16643
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16574,7 +16646,7 @@ var MIGRATIONS = [
16574
16646
  {
16575
16647
  version: 20,
16576
16648
  name: "session-structural-columns",
16577
- up: up20,
16649
+ up: up21,
16578
16650
  artifacts: {
16579
16651
  columns: [
16580
16652
  { table: "session_memories", column: "entity_slot" },
@@ -16587,7 +16659,7 @@ var MIGRATIONS = [
16587
16659
  {
16588
16660
  version: 21,
16589
16661
  name: "checkpoint-structural",
16590
- up: up21,
16662
+ up: up22,
16591
16663
  artifacts: {
16592
16664
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16593
16665
  }
@@ -16595,7 +16667,7 @@ var MIGRATIONS = [
16595
16667
  {
16596
16668
  version: 22,
16597
16669
  name: "entity-pinning",
16598
- up: up22,
16670
+ up: up23,
16599
16671
  artifacts: {
16600
16672
  columns: [
16601
16673
  { table: "entities", column: "pinned" },
@@ -16606,17 +16678,17 @@ var MIGRATIONS = [
16606
16678
  {
16607
16679
  version: 23,
16608
16680
  name: "retired-scorer-gap",
16609
- up: up23
16681
+ up: up24
16610
16682
  },
16611
16683
  {
16612
16684
  version: 24,
16613
16685
  name: "retired-scorer-gap",
16614
- up: up24
16686
+ up: up25
16615
16687
  },
16616
16688
  {
16617
16689
  version: 25,
16618
16690
  name: "agent-feedback",
16619
- up: up25,
16691
+ up: up26,
16620
16692
  artifacts: {
16621
16693
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
16622
16694
  }
@@ -16624,32 +16696,32 @@ var MIGRATIONS = [
16624
16696
  {
16625
16697
  version: 26,
16626
16698
  name: "retired-scorer-gap",
16627
- up: up26
16699
+ up: up27
16628
16700
  },
16629
16701
  {
16630
16702
  version: 27,
16631
16703
  name: "backfill-canonical-names",
16632
- up: up27
16704
+ up: up28
16633
16705
  },
16634
16706
  {
16635
16707
  version: 28,
16636
16708
  name: "lossless-retention",
16637
- up: up28
16709
+ up: up29
16638
16710
  },
16639
16711
  {
16640
16712
  version: 29,
16641
16713
  name: "session-summary-dag",
16642
- up: up29
16714
+ up: up30
16643
16715
  },
16644
16716
  {
16645
16717
  version: 30,
16646
16718
  name: "nullable-memory-job-memory-id",
16647
- up: up30
16719
+ up: up31
16648
16720
  },
16649
16721
  {
16650
16722
  version: 31,
16651
16723
  name: "dependency-reason",
16652
- up: up31,
16724
+ up: up32,
16653
16725
  artifacts: {
16654
16726
  columns: [
16655
16727
  { table: "entity_dependencies", column: "reason" },
@@ -16660,7 +16732,7 @@ var MIGRATIONS = [
16660
16732
  {
16661
16733
  version: 32,
16662
16734
  name: "embeddings-vector-column",
16663
- up: up32,
16735
+ up: up33,
16664
16736
  artifacts: {
16665
16737
  columns: [{ table: "embeddings", column: "vector", optional: true }]
16666
16738
  }
@@ -16668,7 +16740,7 @@ var MIGRATIONS = [
16668
16740
  {
16669
16741
  version: 33,
16670
16742
  name: "scope",
16671
- up: up33,
16743
+ up: up34,
16672
16744
  artifacts: {
16673
16745
  columns: [{ table: "memories", column: "scope" }]
16674
16746
  }
@@ -16676,17 +16748,17 @@ var MIGRATIONS = [
16676
16748
  {
16677
16749
  version: 34,
16678
16750
  name: "scope-aware-dedup",
16679
- up: up34
16751
+ up: up35
16680
16752
  },
16681
16753
  {
16682
16754
  version: 35,
16683
16755
  name: "entity-fts",
16684
- up: up35
16756
+ up: up36
16685
16757
  },
16686
16758
  {
16687
16759
  version: 36,
16688
16760
  name: "dependency-confidence",
16689
- up: up36,
16761
+ up: up37,
16690
16762
  artifacts: {
16691
16763
  columns: [{ table: "entity_dependencies", column: "confidence" }]
16692
16764
  }
@@ -16694,7 +16766,7 @@ var MIGRATIONS = [
16694
16766
  {
16695
16767
  version: 37,
16696
16768
  name: "entity-communities",
16697
- up: up37,
16769
+ up: up38,
16698
16770
  artifacts: {
16699
16771
  tables: ["entity_communities"],
16700
16772
  columns: [{ table: "entities", column: "community_id" }]
@@ -16703,24 +16775,24 @@ var MIGRATIONS = [
16703
16775
  {
16704
16776
  version: 38,
16705
16777
  name: "memory-hints",
16706
- up: up38,
16778
+ up: up39,
16707
16779
  artifacts: { tables: ["memory_hints"] }
16708
16780
  },
16709
16781
  {
16710
16782
  version: 39,
16711
16783
  name: "dedup-entity-dependencies",
16712
- up: up39
16784
+ up: up40
16713
16785
  },
16714
16786
  {
16715
16787
  version: 40,
16716
16788
  name: "session-transcripts",
16717
- up: up40,
16789
+ up: up41,
16718
16790
  artifacts: { tables: ["session_transcripts"] }
16719
16791
  },
16720
16792
  {
16721
16793
  version: 41,
16722
16794
  name: "path-feedback",
16723
- up: up41,
16795
+ up: up42,
16724
16796
  artifacts: {
16725
16797
  tables: [
16726
16798
  "path_feedback_events",
@@ -16735,7 +16807,7 @@ var MIGRATIONS = [
16735
16807
  {
16736
16808
  version: 42,
16737
16809
  name: "session-memories-agent-id",
16738
- up: up42,
16810
+ up: up43,
16739
16811
  artifacts: {
16740
16812
  columns: [{ table: "session_memories", column: "agent_id" }]
16741
16813
  }
@@ -16743,7 +16815,7 @@ var MIGRATIONS = [
16743
16815
  {
16744
16816
  version: 43,
16745
16817
  name: "agents-table",
16746
- up: up43,
16818
+ up: up44,
16747
16819
  artifacts: {
16748
16820
  tables: ["agents"],
16749
16821
  columns: [
@@ -16755,7 +16827,7 @@ var MIGRATIONS = [
16755
16827
  {
16756
16828
  version: 44,
16757
16829
  name: "memory-md-temporal-head",
16758
- up: up44,
16830
+ up: up45,
16759
16831
  artifacts: {
16760
16832
  columns: [
16761
16833
  { table: "session_summaries", column: "source_type" },
@@ -16767,7 +16839,7 @@ var MIGRATIONS = [
16767
16839
  {
16768
16840
  version: 45,
16769
16841
  name: "lossless-working-memory-hardening",
16770
- up: up45,
16842
+ up: up46,
16771
16843
  artifacts: {
16772
16844
  tables: ["session_transcripts_fts", "memory_md_heads"],
16773
16845
  columns: [
@@ -16780,17 +16852,17 @@ var MIGRATIONS = [
16780
16852
  {
16781
16853
  version: 46,
16782
16854
  name: "session-summary-uniqueness",
16783
- up: up46
16855
+ up: up47
16784
16856
  },
16785
16857
  {
16786
16858
  version: 47,
16787
16859
  name: "agent-scoped-temporal-uniqueness",
16788
- up: up47
16860
+ up: up48
16789
16861
  },
16790
16862
  {
16791
16863
  version: 48,
16792
16864
  name: "thread-heads",
16793
- up: up48,
16865
+ up: up49,
16794
16866
  artifacts: {
16795
16867
  tables: ["memory_thread_heads"]
16796
16868
  }
@@ -16798,7 +16870,7 @@ var MIGRATIONS = [
16798
16870
  {
16799
16871
  version: 49,
16800
16872
  name: "session-extract-cursors",
16801
- up: up49,
16873
+ up: up50,
16802
16874
  artifacts: {
16803
16875
  tables: ["session_extract_cursors"]
16804
16876
  }
@@ -16806,7 +16878,7 @@ var MIGRATIONS = [
16806
16878
  {
16807
16879
  version: 50,
16808
16880
  name: "related-to-audit",
16809
- up: up50,
16881
+ up: up51,
16810
16882
  artifacts: {
16811
16883
  tables: ["entity_dependency_history"]
16812
16884
  }
@@ -16814,7 +16886,7 @@ var MIGRATIONS = [
16814
16886
  {
16815
16887
  version: 51,
16816
16888
  name: "memory-md-rolling-window-lineage",
16817
- up: up51,
16889
+ up: up52,
16818
16890
  artifacts: {
16819
16891
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
16820
16892
  columns: [
@@ -16829,7 +16901,7 @@ var MIGRATIONS = [
16829
16901
  {
16830
16902
  version: 52,
16831
16903
  name: "mcp-invocations",
16832
- up: up52,
16904
+ up: up53,
16833
16905
  artifacts: {
16834
16906
  tables: ["mcp_invocations"]
16835
16907
  }
@@ -16837,7 +16909,7 @@ var MIGRATIONS = [
16837
16909
  {
16838
16910
  version: 53,
16839
16911
  name: "skill-invocations",
16840
- up: up53,
16912
+ up: up54,
16841
16913
  artifacts: {
16842
16914
  tables: ["skill_invocations"]
16843
16915
  }
@@ -16845,7 +16917,7 @@ var MIGRATIONS = [
16845
16917
  {
16846
16918
  version: 54,
16847
16919
  name: "task-agent-scope",
16848
- up: up54,
16920
+ up: up55,
16849
16921
  artifacts: {
16850
16922
  tables: ["task_scope_hints"]
16851
16923
  }
@@ -16853,7 +16925,7 @@ var MIGRATIONS = [
16853
16925
  {
16854
16926
  version: 55,
16855
16927
  name: "dreaming-state",
16856
- up: up55,
16928
+ up: up56,
16857
16929
  artifacts: {
16858
16930
  tables: ["dreaming_state", "dreaming_passes"]
16859
16931
  }
@@ -16861,22 +16933,22 @@ var MIGRATIONS = [
16861
16933
  {
16862
16934
  version: 56,
16863
16935
  name: "agent-scoped-content-hash",
16864
- up: up56
16936
+ up: up57
16865
16937
  },
16866
16938
  {
16867
16939
  version: 57,
16868
16940
  name: "memories-fts-tokenizer-repair",
16869
- up: up57
16941
+ up: up58
16870
16942
  },
16871
16943
  {
16872
16944
  version: 58,
16873
16945
  name: "knowledge-graph-indices",
16874
- up: up58
16946
+ up: up59
16875
16947
  },
16876
16948
  {
16877
16949
  version: 59,
16878
16950
  name: "entity-attribute-claim-key",
16879
- up: up59,
16951
+ up: up60,
16880
16952
  artifacts: {
16881
16953
  columns: [{ table: "entity_attributes", column: "claim_key" }]
16882
16954
  }
@@ -16884,7 +16956,7 @@ var MIGRATIONS = [
16884
16956
  {
16885
16957
  version: 60,
16886
16958
  name: "entity-attribute-group-key",
16887
- up: up60,
16959
+ up: up61,
16888
16960
  artifacts: {
16889
16961
  columns: [{ table: "entity_attributes", column: "group_key" }]
16890
16962
  }
@@ -16892,7 +16964,7 @@ var MIGRATIONS = [
16892
16964
  {
16893
16965
  version: 61,
16894
16966
  name: "memory-artifact-source-mtime",
16895
- up: up61,
16967
+ up: up62,
16896
16968
  artifacts: {
16897
16969
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
16898
16970
  }
@@ -16900,7 +16972,7 @@ var MIGRATIONS = [
16900
16972
  {
16901
16973
  version: 62,
16902
16974
  name: "memory-artifact-soft-delete",
16903
- up: up62,
16975
+ up: up63,
16904
16976
  artifacts: {
16905
16977
  columns: [
16906
16978
  { table: "memory_artifacts", column: "is_deleted" },
@@ -16911,12 +16983,12 @@ var MIGRATIONS = [
16911
16983
  {
16912
16984
  version: 63,
16913
16985
  name: "content-only-memories-fts-update",
16914
- up: up63
16986
+ up: up64
16915
16987
  },
16916
16988
  {
16917
16989
  version: 64,
16918
16990
  name: "source-graph-provenance",
16919
- up: up64,
16991
+ up: up65,
16920
16992
  artifacts: {
16921
16993
  columns: [
16922
16994
  { table: "entities", column: "source_path" },
@@ -16929,7 +17001,7 @@ var MIGRATIONS = [
16929
17001
  {
16930
17002
  version: 65,
16931
17003
  name: "source-embedding-agent-scope",
16932
- up: up65,
17004
+ up: up66,
16933
17005
  artifacts: {
16934
17006
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
16935
17007
  }
@@ -16937,7 +17009,7 @@ var MIGRATIONS = [
16937
17009
  {
16938
17010
  version: 66,
16939
17011
  name: "memory-search-telemetry",
16940
- up: up66,
17012
+ up: up67,
16941
17013
  artifacts: {
16942
17014
  tables: ["memory_search_telemetry"]
16943
17015
  }
@@ -16945,7 +17017,7 @@ var MIGRATIONS = [
16945
17017
  {
16946
17018
  version: 67,
16947
17019
  name: "ontology-proposals",
16948
- up: up67,
17020
+ up: up68,
16949
17021
  artifacts: {
16950
17022
  tables: ["ontology_proposals"],
16951
17023
  columns: [
@@ -16959,7 +17031,7 @@ var MIGRATIONS = [
16959
17031
  {
16960
17032
  version: 68,
16961
17033
  name: "daily-reflections",
16962
- up: up68,
17034
+ up: up69,
16963
17035
  artifacts: {
16964
17036
  tables: ["daily_reflections"]
16965
17037
  }
@@ -16967,7 +17039,7 @@ var MIGRATIONS = [
16967
17039
  {
16968
17040
  version: 69,
16969
17041
  name: "daily-reflections-multiple-insights",
16970
- up: up69,
17042
+ up: up70,
16971
17043
  artifacts: {
16972
17044
  tables: ["daily_reflections"]
16973
17045
  }
@@ -16975,7 +17047,7 @@ var MIGRATIONS = [
16975
17047
  {
16976
17048
  version: 70,
16977
17049
  name: "ontology-control-plane-state",
16978
- up: up70,
17050
+ up: up71,
16979
17051
  artifacts: {
16980
17052
  columns: [
16981
17053
  { table: "entities", column: "status" },
@@ -16990,7 +17062,7 @@ var MIGRATIONS = [
16990
17062
  {
16991
17063
  version: 71,
16992
17064
  name: "epistemic-assertions",
16993
- up: up71,
17065
+ up: up72,
16994
17066
  artifacts: {
16995
17067
  tables: ["epistemic_assertions"]
16996
17068
  }
@@ -16998,7 +17070,7 @@ var MIGRATIONS = [
16998
17070
  {
16999
17071
  version: 72,
17000
17072
  name: "agent-scoped-idempotency-key",
17001
- up: up72,
17073
+ up: up73,
17002
17074
  artifacts: {
17003
17075
  columns: [
17004
17076
  { table: "memories", column: "idempotency_key" },
@@ -17009,7 +17081,7 @@ var MIGRATIONS = [
17009
17081
  {
17010
17082
  version: 73,
17011
17083
  name: "recall-context-dedupe",
17012
- up: up73,
17084
+ up: up74,
17013
17085
  artifacts: {
17014
17086
  tables: ["session_context_epochs", "session_recall_events"]
17015
17087
  }
@@ -17017,7 +17089,7 @@ var MIGRATIONS = [
17017
17089
  {
17018
17090
  version: 74,
17019
17091
  name: "aggregate-memory-links",
17020
- up: up74,
17092
+ up: up75,
17021
17093
  artifacts: {
17022
17094
  tables: ["aggregate_memory_sources"]
17023
17095
  }
@@ -17025,7 +17097,7 @@ var MIGRATIONS = [
17025
17097
  {
17026
17098
  version: 75,
17027
17099
  name: "memory-artifact-source-provenance",
17028
- up: up75,
17100
+ up: up76,
17029
17101
  artifacts: {
17030
17102
  columns: [
17031
17103
  { table: "memory_artifacts", column: "source_id" },
@@ -17039,7 +17111,7 @@ var MIGRATIONS = [
17039
17111
  {
17040
17112
  version: 76,
17041
17113
  name: "temporal-edges",
17042
- up: up76,
17114
+ up: up77,
17043
17115
  artifacts: {
17044
17116
  tables: ["temporal_edges"]
17045
17117
  }
@@ -17047,7 +17119,7 @@ var MIGRATIONS = [
17047
17119
  {
17048
17120
  version: 77,
17049
17121
  name: "entity-aliases",
17050
- up: up77,
17122
+ up: up78,
17051
17123
  artifacts: {
17052
17124
  tables: ["entity_aliases"]
17053
17125
  }
@@ -17055,7 +17127,7 @@ var MIGRATIONS = [
17055
17127
  {
17056
17128
  version: 78,
17057
17129
  name: "api-keys",
17058
- up: up78,
17130
+ up: up79,
17059
17131
  artifacts: {
17060
17132
  tables: ["api_keys"]
17061
17133
  }
@@ -17063,7 +17135,7 @@ var MIGRATIONS = [
17063
17135
  {
17064
17136
  version: 79,
17065
17137
  name: "transcript-capture-jobs",
17066
- up: up79,
17138
+ up: up80,
17067
17139
  artifacts: {
17068
17140
  tables: ["transcript_capture_jobs"]
17069
17141
  }
@@ -17071,7 +17143,7 @@ var MIGRATIONS = [
17071
17143
  {
17072
17144
  version: 80,
17073
17145
  name: "document-scope-columns",
17074
- up: up80,
17146
+ up: up81,
17075
17147
  artifacts: {
17076
17148
  columns: [
17077
17149
  { table: "documents", column: "agent_id" },
@@ -17082,7 +17154,7 @@ var MIGRATIONS = [
17082
17154
  {
17083
17155
  version: 81,
17084
17156
  name: "aggregate-evidence-sources",
17085
- up: up81,
17157
+ up: up82,
17086
17158
  artifacts: {
17087
17159
  tables: ["aggregate_evidence_sources"]
17088
17160
  }
@@ -17090,7 +17162,7 @@ var MIGRATIONS = [
17090
17162
  {
17091
17163
  version: 82,
17092
17164
  name: "skill-invocations-harness",
17093
- up: up82,
17165
+ up: up83,
17094
17166
  artifacts: {
17095
17167
  columns: [
17096
17168
  { table: "skill_invocations", column: "harness" },
@@ -17101,7 +17173,7 @@ var MIGRATIONS = [
17101
17173
  {
17102
17174
  version: 83,
17103
17175
  name: "memory-lifecycle-repair",
17104
- up: up83,
17176
+ up: up84,
17105
17177
  artifacts: {
17106
17178
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17107
17179
  columns: [
@@ -17116,7 +17188,7 @@ var MIGRATIONS = [
17116
17188
  {
17117
17189
  version: 84,
17118
17190
  name: "legacy-markdown-import-state",
17119
- up: up84,
17191
+ up: up85,
17120
17192
  artifacts: {
17121
17193
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17122
17194
  }
@@ -17124,7 +17196,7 @@ var MIGRATIONS = [
17124
17196
  {
17125
17197
  version: 85,
17126
17198
  name: "backfill-relations-to-dependencies",
17127
- up: up85,
17199
+ up: up86,
17128
17200
  artifacts: {
17129
17201
  tables: ["entity_dependencies"]
17130
17202
  }
@@ -17132,7 +17204,7 @@ var MIGRATIONS = [
17132
17204
  {
17133
17205
  version: 86,
17134
17206
  name: "summary-jobs-content-hash",
17135
- up: up86,
17207
+ up: up87,
17136
17208
  artifacts: {
17137
17209
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17138
17210
  }
@@ -17140,7 +17212,7 @@ var MIGRATIONS = [
17140
17212
  {
17141
17213
  version: 87,
17142
17214
  name: "summary-jobs-boundary-reason",
17143
- up: up87,
17215
+ up: up88,
17144
17216
  artifacts: {
17145
17217
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17146
17218
  }
@@ -17148,7 +17220,7 @@ var MIGRATIONS = [
17148
17220
  {
17149
17221
  version: 88,
17150
17222
  name: "transcript-recovery-files",
17151
- up: up88,
17223
+ up: up89,
17152
17224
  artifacts: {
17153
17225
  tables: ["transcript_recovery_files"]
17154
17226
  }
@@ -17156,7 +17228,7 @@ var MIGRATIONS = [
17156
17228
  {
17157
17229
  version: 89,
17158
17230
  name: "job-cancellations",
17159
- up: up89,
17231
+ up: up90,
17160
17232
  artifacts: {
17161
17233
  tables: ["job_cancellations"]
17162
17234
  }
@@ -17164,7 +17236,7 @@ var MIGRATIONS = [
17164
17236
  {
17165
17237
  version: 90,
17166
17238
  name: "job-archive",
17167
- up: up90,
17239
+ up: up91,
17168
17240
  artifacts: {
17169
17241
  tables: ["job_archive"]
17170
17242
  }
@@ -17172,25 +17244,25 @@ var MIGRATIONS = [
17172
17244
  {
17173
17245
  version: 91,
17174
17246
  name: "embedding-index-generations",
17175
- up: up91,
17247
+ up: up92,
17176
17248
  artifacts: { tables: ["embedding_index_state"] }
17177
17249
  },
17178
17250
  {
17179
17251
  version: 92,
17180
17252
  name: "embedding-staging-store",
17181
- up: up92,
17253
+ up: up93,
17182
17254
  artifacts: { tables: ["embeddings_staging"] }
17183
17255
  },
17184
17256
  {
17185
17257
  version: 93,
17186
17258
  name: "dreaming-evidence-cursor",
17187
- up: up93,
17259
+ up: up94,
17188
17260
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17189
17261
  },
17190
17262
  {
17191
17263
  version: 94,
17192
17264
  name: "memory-kind",
17193
- up: up94,
17265
+ up: up95,
17194
17266
  artifacts: {
17195
17267
  columns: [
17196
17268
  { table: "memories", column: "memory_kind" },
@@ -17201,35 +17273,35 @@ var MIGRATIONS = [
17201
17273
  {
17202
17274
  version: 95,
17203
17275
  name: "compaction-recall-projections",
17204
- up: up95
17276
+ up: up96
17205
17277
  },
17206
17278
  {
17207
17279
  version: 96,
17208
17280
  name: "retire-legacy-ingestion",
17209
- up: up96
17281
+ up: up97
17210
17282
  },
17211
17283
  {
17212
17284
  version: 97,
17213
17285
  name: "dreaming-failure-backoff",
17214
- up: up97,
17286
+ up: up98,
17215
17287
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17216
17288
  },
17217
17289
  {
17218
17290
  version: 98,
17219
17291
  name: "dreaming-evidence-exclusions",
17220
- up: up98,
17292
+ up: up99,
17221
17293
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17222
17294
  },
17223
17295
  {
17224
17296
  version: 99,
17225
17297
  name: "dreaming-tool-calls",
17226
- up: up99,
17298
+ up: up100,
17227
17299
  artifacts: { tables: ["dreaming_tool_calls"] }
17228
17300
  },
17229
17301
  {
17230
17302
  version: 100,
17231
17303
  name: "dreaming-runbook",
17232
- up: up100,
17304
+ up: up101,
17233
17305
  artifacts: {
17234
17306
  columns: [
17235
17307
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17240,23 +17312,23 @@ var MIGRATIONS = [
17240
17312
  {
17241
17313
  version: 101,
17242
17314
  name: "dreaming-attention",
17243
- up: up101,
17315
+ up: up102,
17244
17316
  artifacts: { tables: ["dreaming_attention"] }
17245
17317
  },
17246
17318
  {
17247
17319
  version: 102,
17248
17320
  name: "attribute-semantic-memories",
17249
- up: up102
17321
+ up: up103
17250
17322
  },
17251
17323
  {
17252
17324
  version: 103,
17253
17325
  name: "semantic-memory-kind",
17254
- up: up103
17326
+ up: up104
17255
17327
  },
17256
17328
  {
17257
17329
  version: 104,
17258
17330
  name: "derived-memory-provenance",
17259
- up: up104,
17331
+ up: up105,
17260
17332
  artifacts: {
17261
17333
  tables: ["derived_memory_sources"],
17262
17334
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17265,12 +17337,12 @@ var MIGRATIONS = [
17265
17337
  {
17266
17338
  version: 105,
17267
17339
  name: "agent-scoped-entity-name",
17268
- up: up105
17340
+ up: up106
17269
17341
  },
17270
17342
  {
17271
17343
  version: 106,
17272
17344
  name: "memory-review-after",
17273
- up: up106,
17345
+ up: up107,
17274
17346
  artifacts: {
17275
17347
  columns: [{ table: "memories", column: "review_after" }]
17276
17348
  }
@@ -17278,7 +17350,7 @@ var MIGRATIONS = [
17278
17350
  {
17279
17351
  version: 107,
17280
17352
  name: "dreaming-pass-usage",
17281
- up: up107,
17353
+ up: up108,
17282
17354
  artifacts: {
17283
17355
  columns: [
17284
17356
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17292,7 +17364,7 @@ var MIGRATIONS = [
17292
17364
  {
17293
17365
  version: 108,
17294
17366
  name: "embedding-usage",
17295
- up: up108,
17367
+ up: up109,
17296
17368
  artifacts: {
17297
17369
  tables: ["embedding_usage"]
17298
17370
  }
@@ -17300,7 +17372,7 @@ var MIGRATIONS = [
17300
17372
  {
17301
17373
  version: 109,
17302
17374
  name: "telemetry-install",
17303
- up: up109,
17375
+ up: up110,
17304
17376
  artifacts: {
17305
17377
  tables: ["telemetry_install"]
17306
17378
  }
@@ -17308,12 +17380,12 @@ var MIGRATIONS = [
17308
17380
  {
17309
17381
  version: 110,
17310
17382
  name: "memory-mention-join-index",
17311
- up: up110
17383
+ up: up111
17312
17384
  },
17313
17385
  {
17314
17386
  version: 111,
17315
17387
  name: "telemetry-first-use",
17316
- up: up111,
17388
+ up: up112,
17317
17389
  artifacts: {
17318
17390
  columns: [
17319
17391
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17324,7 +17396,7 @@ var MIGRATIONS = [
17324
17396
  {
17325
17397
  version: 112,
17326
17398
  name: "telemetry-queue-ownership",
17327
- up: up112,
17399
+ up: up113,
17328
17400
  artifacts: {
17329
17401
  columns: [
17330
17402
  { table: "telemetry_events", column: "source" },
@@ -17336,7 +17408,7 @@ var MIGRATIONS = [
17336
17408
  {
17337
17409
  version: 113,
17338
17410
  name: "session-claims",
17339
- up: up113,
17411
+ up: up114,
17340
17412
  artifacts: {
17341
17413
  tables: ["session_claims"],
17342
17414
  columns: [
@@ -17350,12 +17422,12 @@ var MIGRATIONS = [
17350
17422
  {
17351
17423
  version: 114,
17352
17424
  name: "memory-traversal-hydration-index",
17353
- up: up114
17425
+ up: up115
17354
17426
  },
17355
17427
  {
17356
17428
  version: 115,
17357
17429
  name: "cross-agent-message-notifications",
17358
- up: up115,
17430
+ up: up116,
17359
17431
  artifacts: {
17360
17432
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17361
17433
  }
@@ -17363,7 +17435,7 @@ var MIGRATIONS = [
17363
17435
  {
17364
17436
  version: 116,
17365
17437
  name: "acp-delivery-reconciliation",
17366
- up: up116,
17438
+ up: up117,
17367
17439
  artifacts: {
17368
17440
  columns: [
17369
17441
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17377,7 +17449,7 @@ var MIGRATIONS = [
17377
17449
  {
17378
17450
  version: 117,
17379
17451
  name: "retire-summary-worker",
17380
- up: up117,
17452
+ up: up118,
17381
17453
  artifacts: {
17382
17454
  columns: [
17383
17455
  { table: "session_transcripts", column: "completed_at" },
@@ -17388,24 +17460,24 @@ var MIGRATIONS = [
17388
17460
  {
17389
17461
  version: 118,
17390
17462
  name: "queue-pressure-indices",
17391
- up: up118
17463
+ up: up119
17392
17464
  },
17393
17465
  {
17394
17466
  version: 119,
17395
17467
  name: "telemetry-version-observation",
17396
- up: up119,
17468
+ up: up120,
17397
17469
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17398
17470
  },
17399
17471
  {
17400
17472
  version: 120,
17401
17473
  name: "source-lifecycle-telemetry",
17402
- up: up120,
17474
+ up: up121,
17403
17475
  artifacts: { tables: ["source_lifecycle_state"] }
17404
17476
  },
17405
17477
  {
17406
17478
  version: 121,
17407
17479
  name: "telemetry-delivery-health",
17408
- up: up121,
17480
+ up: up122,
17409
17481
  artifacts: {
17410
17482
  tables: ["telemetry_delivery_state"],
17411
17483
  columns: [
@@ -17419,7 +17491,7 @@ var MIGRATIONS = [
17419
17491
  {
17420
17492
  version: 122,
17421
17493
  name: "dreaming-evidence-retry",
17422
- up: up122,
17494
+ up: up123,
17423
17495
  artifacts: {
17424
17496
  columns: [
17425
17497
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17432,13 +17504,13 @@ var MIGRATIONS = [
17432
17504
  {
17433
17505
  version: 123,
17434
17506
  name: "embedding-index-failures",
17435
- up: up123,
17507
+ up: up124,
17436
17508
  artifacts: { tables: ["embedding_index_failures"] }
17437
17509
  },
17438
17510
  {
17439
17511
  version: 124,
17440
17512
  name: "import-derived-lifecycle",
17441
- up: up124,
17513
+ up: up125,
17442
17514
  artifacts: {
17443
17515
  tables: ["imported_source_lifecycle"]
17444
17516
  }
@@ -17446,77 +17518,77 @@ var MIGRATIONS = [
17446
17518
  {
17447
17519
  version: 125,
17448
17520
  name: "memory-content-safety",
17449
- up: up125,
17521
+ up: up126,
17450
17522
  artifacts: { tables: ["memory_content_safety"] }
17451
17523
  },
17452
17524
  {
17453
17525
  version: 126,
17454
17526
  name: "dreaming-surprisal-attention",
17455
- up: up126,
17527
+ up: up127,
17456
17528
  artifacts: { tables: ["dreaming_attention"] }
17457
17529
  },
17458
17530
  {
17459
17531
  version: 127,
17460
17532
  name: "ontology-contradictions",
17461
- up: up127,
17533
+ up: up128,
17462
17534
  artifacts: { tables: ["ontology_contradictions"] }
17463
17535
  },
17464
17536
  {
17465
17537
  version: 128,
17466
17538
  name: "bounded-queue-diagnostics",
17467
- up: up128
17539
+ up: up129
17468
17540
  },
17469
17541
  {
17470
17542
  version: 129,
17471
17543
  name: "retire-structural-jobs",
17472
- up: up129
17544
+ up: up130
17473
17545
  },
17474
17546
  {
17475
17547
  version: 130,
17476
17548
  name: "embedding-repair-state",
17477
- up: up130,
17549
+ up: up131,
17478
17550
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17479
17551
  },
17480
17552
  {
17481
17553
  version: 131,
17482
17554
  name: "dreaming-evidence-consumption",
17483
- up: up131,
17555
+ up: up132,
17484
17556
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17485
17557
  },
17486
17558
  {
17487
17559
  version: 132,
17488
17560
  name: "observer-scoped-epistemic-assertions",
17489
- up: up132,
17561
+ up: up133,
17490
17562
  artifacts: { tables: ["epistemic_assertions"] }
17491
17563
  },
17492
17564
  {
17493
17565
  version: 133,
17494
17566
  name: "dreaming-memory-head",
17495
- up: up133,
17567
+ up: up134,
17496
17568
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17497
17569
  },
17498
17570
  {
17499
17571
  version: 134,
17500
17572
  name: "scope-memory-head-entries",
17501
- up: up134,
17573
+ up: up135,
17502
17574
  artifacts: { tables: ["memory_head_entries"] }
17503
17575
  },
17504
17576
  {
17505
17577
  version: 135,
17506
17578
  name: "memory-head-publication",
17507
- up: up135,
17579
+ up: up136,
17508
17580
  artifacts: { tables: ["memory_head_publications"] }
17509
17581
  },
17510
17582
  {
17511
17583
  version: 136,
17512
17584
  name: "memory-head-revisions",
17513
- up: up136,
17585
+ up: up137,
17514
17586
  artifacts: { tables: ["memory_head_revisions"] }
17515
17587
  },
17516
17588
  {
17517
17589
  version: 137,
17518
17590
  name: "dreaming-head-manifest",
17519
- up: up137,
17591
+ up: up138,
17520
17592
  artifacts: {
17521
17593
  columns: [
17522
17594
  { table: "dreaming_passes", column: "head_revision" },
@@ -17527,7 +17599,7 @@ var MIGRATIONS = [
17527
17599
  {
17528
17600
  version: 138,
17529
17601
  name: "bounded-status-projections",
17530
- up: up138,
17602
+ up: up139,
17531
17603
  artifacts: {
17532
17604
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17533
17605
  }
@@ -17535,31 +17607,31 @@ var MIGRATIONS = [
17535
17607
  {
17536
17608
  version: 139,
17537
17609
  name: "native-source-sync-state",
17538
- up: up139,
17610
+ up: up140,
17539
17611
  artifacts: { tables: ["native_source_sync_state"] }
17540
17612
  },
17541
17613
  {
17542
17614
  version: 140,
17543
17615
  name: "transcript-recovery-frontier",
17544
- up: up140,
17616
+ up: up141,
17545
17617
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17546
17618
  },
17547
17619
  {
17548
17620
  version: 141,
17549
17621
  name: "source-sync-checkpoints",
17550
- up: up141,
17622
+ up: up142,
17551
17623
  artifacts: { tables: ["source_sync_checkpoints"] }
17552
17624
  },
17553
17625
  {
17554
17626
  version: 142,
17555
17627
  name: "source-sync-frontier",
17556
- up: up142,
17628
+ up: up143,
17557
17629
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17558
17630
  },
17559
17631
  {
17560
17632
  version: 143,
17561
17633
  name: "embedding-index-progress",
17562
- up: up143,
17634
+ up: up144,
17563
17635
  artifacts: {
17564
17636
  columns: [
17565
17637
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17575,19 +17647,19 @@ var MIGRATIONS = [
17575
17647
  {
17576
17648
  version: 144,
17577
17649
  name: "memory-job-lease-token",
17578
- up: up144,
17650
+ up: up145,
17579
17651
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17580
17652
  },
17581
17653
  {
17582
17654
  version: 145,
17583
17655
  name: "dreaming-evidence-reviews",
17584
- up: up145,
17656
+ up: up146,
17585
17657
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17586
17658
  },
17587
17659
  {
17588
17660
  version: 146,
17589
17661
  name: "source-transcript-import",
17590
- up: up146,
17662
+ up: up147,
17591
17663
  artifacts: {
17592
17664
  tables: [
17593
17665
  "source_import_jobs",
@@ -17606,19 +17678,19 @@ var MIGRATIONS = [
17606
17678
  {
17607
17679
  version: 147,
17608
17680
  name: "source-import-replay-file-slots",
17609
- up: up147,
17681
+ up: up148,
17610
17682
  artifacts: { tables: ["source_import_files"] }
17611
17683
  },
17612
17684
  {
17613
17685
  version: 148,
17614
17686
  name: "source-import-attempt-provenance",
17615
- up: up148,
17687
+ up: up149,
17616
17688
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17617
17689
  },
17618
17690
  {
17619
17691
  version: 149,
17620
17692
  name: "transcript-import-state-machine",
17621
- up: up149,
17693
+ up: up150,
17622
17694
  artifacts: {
17623
17695
  columns: [
17624
17696
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -17630,13 +17702,42 @@ var MIGRATIONS = [
17630
17702
  {
17631
17703
  version: 150,
17632
17704
  name: "memory-head-freshness",
17633
- up: up150,
17705
+ up: up151,
17634
17706
  artifacts: {
17635
17707
  columns: [
17636
17708
  { table: "memory_md_heads", column: "is_current" },
17637
17709
  { table: "dreaming_passes", column: "head_base_revision" }
17638
17710
  ]
17639
17711
  }
17712
+ },
17713
+ {
17714
+ version: 151,
17715
+ name: "transcript-import-bytes",
17716
+ up,
17717
+ artifacts: {
17718
+ tables: [
17719
+ "source_import_chunks",
17720
+ "source_import_capacity",
17721
+ "source_import_migrations",
17722
+ "source_import_migration_streams",
17723
+ "source_import_migration_counts"
17724
+ ],
17725
+ columns: [
17726
+ { table: "source_import_files", column: "storage_state" },
17727
+ { table: "source_import_files", column: "upload_generation" },
17728
+ { table: "source_import_files", column: "upload_offset" },
17729
+ { table: "source_import_files", column: "upload_size" },
17730
+ { table: "source_import_files", column: "upload_digest" },
17731
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
17732
+ table: "source_import_files",
17733
+ column
17734
+ })),
17735
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
17736
+ table: "source_import_jobs",
17737
+ column
17738
+ }))
17739
+ ]
17740
+ }
17640
17741
  }
17641
17742
  ];
17642
17743
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
@@ -29293,6 +29394,66 @@ var DAEMON_DERIVED_MEMORY_SOURCE_TYPES2 = [
29293
29394
  "checkpoint",
29294
29395
  "dreaming"
29295
29396
  ];
29397
+ function up152(db) {
29398
+ const hasColumn26 = (table, column) => {
29399
+ const statement = db.prepare(`SELECT 1 FROM pragma_table_info('${table}') WHERE name = ?`);
29400
+ try {
29401
+ return statement.get(column) != null;
29402
+ } finally {
29403
+ statement.finalize?.();
29404
+ }
29405
+ };
29406
+ for (const [column, definition] of [
29407
+ ["upload_generation", "INTEGER NOT NULL DEFAULT 0"],
29408
+ ["upload_offset", "INTEGER NOT NULL DEFAULT 0"],
29409
+ ["upload_size", "INTEGER"],
29410
+ ["upload_digest", "TEXT NOT NULL DEFAULT ''"],
29411
+ ["checkpoint_line_number", "INTEGER NOT NULL DEFAULT 0"],
29412
+ ["reserved_bytes", "INTEGER NOT NULL DEFAULT 0"],
29413
+ ["original_path", "TEXT"],
29414
+ [
29415
+ "storage_state",
29416
+ "TEXT NOT NULL DEFAULT 'legacy' CHECK (storage_state IN ('legacy','uploading','sealed','purging','purged'))"
29417
+ ]
29418
+ ]) {
29419
+ if (!hasColumn26("source_import_files", column))
29420
+ db.exec(`ALTER TABLE source_import_files ADD COLUMN ${column} ${definition}`);
29421
+ }
29422
+ if (!hasColumn26("source_import_jobs", "retry_count"))
29423
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_count INTEGER NOT NULL DEFAULT 0");
29424
+ if (!hasColumn26("source_import_jobs", "cleanup_state"))
29425
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN cleanup_state TEXT NOT NULL DEFAULT 'idle'");
29426
+ if (!hasColumn26("source_import_jobs", "retry_cursor"))
29427
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_cursor TEXT NOT NULL DEFAULT ''");
29428
+ if (!hasColumn26("source_import_jobs", "retry_requested"))
29429
+ db.exec("ALTER TABLE source_import_jobs ADD COLUMN retry_requested INTEGER NOT NULL DEFAULT 0");
29430
+ db.exec(`
29431
+ 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);
29432
+ 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;
29433
+ 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;
29434
+ INSERT OR IGNORE INTO source_import_migrations(agent_id) SELECT DISTINCT agent_id FROM source_import_files WHERE storage_state = 'legacy';
29435
+ 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));
29436
+ INSERT OR IGNORE INTO source_import_capacity(id) VALUES (1);
29437
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_update AFTER UPDATE OF reserved_bytes ON source_import_files
29438
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes + NEW.reserved_bytes WHERE id = 1; END;
29439
+ CREATE TRIGGER IF NOT EXISTS source_import_capacity_delete AFTER DELETE ON source_import_files
29440
+ BEGIN UPDATE source_import_capacity SET reserved_bytes = reserved_bytes - OLD.reserved_bytes WHERE id = 1; END;
29441
+ CREATE TABLE IF NOT EXISTS source_import_chunks (
29442
+ file_id TEXT NOT NULL REFERENCES source_import_files(id),
29443
+ agent_id TEXT NOT NULL, generation INTEGER NOT NULL, byte_offset INTEGER NOT NULL,
29444
+ checksum TEXT NOT NULL, content BLOB NOT NULL CHECK (length(content) BETWEEN 1 AND 65536),
29445
+ PRIMARY KEY (agent_id, file_id, generation, byte_offset)
29446
+ ) WITHOUT ROWID;
29447
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_storage ON source_import_files(agent_id, storage_state, id);
29448
+ CREATE INDEX IF NOT EXISTS idx_source_import_cleanup ON source_import_jobs(agent_id,id) WHERE cleanup_state = 'pending';
29449
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_file_pending ON source_import_records(agent_id, file_id, status, ordinal);
29450
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_agent_cursor ON source_import_records(agent_id,id);
29451
+ CREATE INDEX IF NOT EXISTS idx_source_import_records_job_cursor ON source_import_records(job_id,agent_id,status,id);
29452
+ CREATE INDEX IF NOT EXISTS idx_source_import_files_agent_cursor ON source_import_files(agent_id,id);
29453
+ CREATE INDEX IF NOT EXISTS idx_session_transcripts_export ON session_transcripts(agent_id,created_at,session_key);
29454
+ CREATE INDEX IF NOT EXISTS idx_transcript_import_harness ON transcript_import_conversations(agent_id,harness);
29455
+ `);
29456
+ }
29296
29457
  var MEMORIES_FTS_TOKENIZER2 = "unicode61";
29297
29458
  var FTS_STATE_TABLE2 = "memories_fts_state";
29298
29459
  function normalizeSql2(sql) {
@@ -29408,7 +29569,7 @@ function memoriesFtsNeedsTokenizerRepair2(sql) {
29408
29569
  return true;
29409
29570
  return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER2}'`);
29410
29571
  }
29411
- function up151(db) {
29572
+ function up210(db) {
29412
29573
  db.exec(`
29413
29574
  CREATE TABLE IF NOT EXISTS schema_migrations (
29414
29575
  version INTEGER PRIMARY KEY,
@@ -29506,7 +29667,7 @@ function addColumnIfMissing29(db, table, column, definition) {
29506
29667
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29507
29668
  }
29508
29669
  }
29509
- function up210(db) {
29670
+ function up310(db) {
29510
29671
  addColumnIfMissing29(db, "memories", "content_hash", "TEXT");
29511
29672
  addColumnIfMissing29(db, "memories", "normalized_content", "TEXT");
29512
29673
  addColumnIfMissing29(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -29624,7 +29785,7 @@ function addColumnIfMissing210(db, table, column, definition) {
29624
29785
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29625
29786
  return true;
29626
29787
  }
29627
- function up310(db) {
29788
+ function up410(db) {
29628
29789
  addColumnIfMissing210(db, "memories", "why", "TEXT");
29629
29790
  addColumnIfMissing210(db, "memories", "project", "TEXT");
29630
29791
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -29661,7 +29822,7 @@ function addColumnIfMissing32(db, table, column, definition) {
29661
29822
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29662
29823
  }
29663
29824
  }
29664
- function up410(db) {
29825
+ function up510(db) {
29665
29826
  addColumnIfMissing32(db, "memory_history", "actor_type", "TEXT");
29666
29827
  addColumnIfMissing32(db, "memory_history", "session_id", "TEXT");
29667
29828
  addColumnIfMissing32(db, "memory_history", "request_id", "TEXT");
@@ -29694,7 +29855,7 @@ function addColumnIfMissing42(db, table, column, definition) {
29694
29855
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29695
29856
  }
29696
29857
  }
29697
- function up510(db) {
29858
+ function up610(db) {
29698
29859
  addColumnIfMissing42(db, "entities", "canonical_name", "TEXT");
29699
29860
  addColumnIfMissing42(db, "entities", "mentions", "INTEGER DEFAULT 0");
29700
29861
  addColumnIfMissing42(db, "entities", "embedding", "BLOB");
@@ -29711,7 +29872,7 @@ function hasColumn42(db, table, column) {
29711
29872
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
29712
29873
  return rows.some((r22) => r22.name === column);
29713
29874
  }
29714
- function up610(db) {
29875
+ function up710(db) {
29715
29876
  if (!hasColumn42(db, "memories", "idempotency_key")) {
29716
29877
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
29717
29878
  }
@@ -29726,7 +29887,7 @@ function hasColumn52(db, table, column) {
29726
29887
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
29727
29888
  return rows.some((r22) => r22.name === column);
29728
29889
  }
29729
- function up710(db) {
29890
+ function up810(db) {
29730
29891
  db.exec(`
29731
29892
  CREATE TABLE IF NOT EXISTS documents (
29732
29893
  id TEXT PRIMARY KEY,
@@ -29783,7 +29944,7 @@ function up710(db) {
29783
29944
  db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
29784
29945
  }
29785
29946
  }
29786
- function up810(db) {
29947
+ function up910(db) {
29787
29948
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
29788
29949
  if (tables.length === 0)
29789
29950
  return;
@@ -29800,7 +29961,7 @@ function up810(db) {
29800
29961
  ON embeddings(content_hash)
29801
29962
  `);
29802
29963
  }
29803
- function up910(db) {
29964
+ function up1010(db) {
29804
29965
  db.exec(`
29805
29966
  CREATE TABLE IF NOT EXISTS summary_jobs (
29806
29967
  id TEXT PRIMARY KEY,
@@ -29820,7 +29981,7 @@ function up910(db) {
29820
29981
  db.exec(`CREATE INDEX IF NOT EXISTS idx_summary_jobs_status
29821
29982
  ON summary_jobs(status)`);
29822
29983
  }
29823
- function up1010(db) {
29984
+ function up1110(db) {
29824
29985
  db.exec(`
29825
29986
  CREATE TABLE IF NOT EXISTS umap_cache (
29826
29987
  id INTEGER PRIMARY KEY,
@@ -29831,7 +29992,7 @@ function up1010(db) {
29831
29992
  )
29832
29993
  `);
29833
29994
  }
29834
- function up1110(db) {
29995
+ function up1210(db) {
29835
29996
  db.exec(`
29836
29997
  CREATE TABLE IF NOT EXISTS session_scores (
29837
29998
  id TEXT PRIMARY KEY,
@@ -29851,7 +30012,7 @@ function up1110(db) {
29851
30012
  ON session_scores(session_key);
29852
30013
  `);
29853
30014
  }
29854
- function up1210(db) {
30015
+ function up1310(db) {
29855
30016
  db.exec(`
29856
30017
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
29857
30018
  id TEXT PRIMARY KEY,
@@ -29892,7 +30053,7 @@ function addColumnIfMissing52(db, table, column, definition) {
29892
30053
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29893
30054
  }
29894
30055
  }
29895
- function up1310(db) {
30056
+ function up1410(db) {
29896
30057
  db.exec(`
29897
30058
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
29898
30059
  id TEXT PRIMARY KEY,
@@ -29918,7 +30079,7 @@ function up1310(db) {
29918
30079
  addColumnIfMissing52(db, "memories", "source_path", "TEXT");
29919
30080
  addColumnIfMissing52(db, "memories", "source_section", "TEXT");
29920
30081
  }
29921
- function up1410(db) {
30082
+ function up153(db) {
29922
30083
  db.exec(`
29923
30084
  CREATE TABLE IF NOT EXISTS telemetry_events (
29924
30085
  id TEXT PRIMARY KEY,
@@ -29943,7 +30104,7 @@ function addColumnIfMissing62(db, table, column, definition) {
29943
30104
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
29944
30105
  }
29945
30106
  }
29946
- function up152(db) {
30107
+ function up162(db) {
29947
30108
  db.exec(`
29948
30109
  CREATE TABLE IF NOT EXISTS session_memories (
29949
30110
  id TEXT PRIMARY KEY,
@@ -29970,7 +30131,7 @@ function up152(db) {
29970
30131
  addColumnIfMissing62(db, "session_scores", "confidence", "REAL");
29971
30132
  addColumnIfMissing62(db, "session_scores", "continuity_reasoning", "TEXT");
29972
30133
  }
29973
- function up162(db) {
30134
+ function up172(db) {
29974
30135
  db.exec(`
29975
30136
  CREATE TABLE IF NOT EXISTS session_checkpoints (
29976
30137
  id TEXT PRIMARY KEY,
@@ -29992,7 +30153,7 @@ function up162(db) {
29992
30153
  ON session_checkpoints(project_normalized, created_at DESC);
29993
30154
  `);
29994
30155
  }
29995
- function up172(db) {
30156
+ function up182(db) {
29996
30157
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
29997
30158
  const colNames = new Set(cols.flatMap((c22) => typeof c22.name === "string" ? [c22.name] : []));
29998
30159
  if (!colNames.has("skill_name")) {
@@ -30003,7 +30164,7 @@ function up172(db) {
30003
30164
  CHECK (skill_mode IN ('inject', 'slash') OR skill_mode IS NULL)`);
30004
30165
  }
30005
30166
  }
30006
- function up182(db) {
30167
+ function up192(db) {
30007
30168
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
30008
30169
  if (existing)
30009
30170
  return;
@@ -30035,7 +30196,7 @@ function up182(db) {
30035
30196
  CREATE INDEX idx_skill_meta_source ON skill_meta(source);
30036
30197
  `);
30037
30198
  }
30038
- function up192(db) {
30199
+ function up202(db) {
30039
30200
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
30040
30201
  const entityColNames = new Set(entityCols.flatMap((c22) => typeof c22.name === "string" ? [c22.name] : []));
30041
30202
  if (!entityColNames.has("agent_id")) {
@@ -30120,13 +30281,13 @@ function addColumnIfMissing72(db, table, column, definition) {
30120
30281
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30121
30282
  }
30122
30283
  }
30123
- function up202(db) {
30284
+ function up212(db) {
30124
30285
  addColumnIfMissing72(db, "session_memories", "entity_slot", "INTEGER");
30125
30286
  addColumnIfMissing72(db, "session_memories", "aspect_slot", "INTEGER");
30126
30287
  addColumnIfMissing72(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
30127
30288
  addColumnIfMissing72(db, "session_memories", "structural_density", "INTEGER");
30128
30289
  }
30129
- function up212(db) {
30290
+ function up222(db) {
30130
30291
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
30131
30292
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
30132
30293
  if (!columnNames.has("focal_entity_ids")) {
@@ -30151,25 +30312,25 @@ function addColumnIfMissing82(db, table, column, definition) {
30151
30312
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30152
30313
  }
30153
30314
  }
30154
- function up222(db) {
30315
+ function up232(db) {
30155
30316
  addColumnIfMissing82(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
30156
30317
  addColumnIfMissing82(db, "entities", "pinned_at", "TEXT");
30157
30318
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
30158
30319
  }
30159
- function up232(_db) {}
30160
30320
  function up242(_db) {}
30321
+ function up252(_db) {}
30161
30322
  function addColumnIfMissing92(db, table, column, definition) {
30162
30323
  const cols = db.prepare(`PRAGMA table_info(${table})`).all();
30163
30324
  if (!cols.some((c22) => c22.name === column)) {
30164
30325
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30165
30326
  }
30166
30327
  }
30167
- function up252(db) {
30328
+ function up262(db) {
30168
30329
  addColumnIfMissing92(db, "session_memories", "agent_relevance_score", "REAL");
30169
30330
  addColumnIfMissing92(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
30170
30331
  }
30171
- function up262(_db) {}
30172
- function up272(db) {
30332
+ function up272(_db) {}
30333
+ function up282(db) {
30173
30334
  db.exec(`
30174
30335
  UPDATE entities
30175
30336
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -30178,7 +30339,7 @@ function up272(db) {
30178
30339
  WHERE canonical_name IS NULL
30179
30340
  `);
30180
30341
  }
30181
- function up282(db) {
30342
+ function up292(db) {
30182
30343
  db.exec(`
30183
30344
  CREATE TABLE IF NOT EXISTS memories_cold (
30184
30345
  archive_id TEXT PRIMARY KEY,
@@ -30215,7 +30376,7 @@ function up282(db) {
30215
30376
  CREATE INDEX IF NOT EXISTS idx_cold_source ON memories_cold(cold_source_id);
30216
30377
  `);
30217
30378
  }
30218
- function up292(db) {
30379
+ function up302(db) {
30219
30380
  db.exec(`
30220
30381
  CREATE TABLE IF NOT EXISTS session_summaries (
30221
30382
  id TEXT PRIMARY KEY,
@@ -30260,7 +30421,7 @@ function up292(db) {
30260
30421
  WHERE session_key IS NOT NULL;
30261
30422
  `);
30262
30423
  }
30263
- function up302(db) {
30424
+ function up312(db) {
30264
30425
  db.exec(`
30265
30426
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
30266
30427
  id TEXT PRIMARY KEY,
@@ -30305,7 +30466,7 @@ function up302(db) {
30305
30466
  ON memory_jobs(failed_at);
30306
30467
  `);
30307
30468
  }
30308
- function up312(db) {
30469
+ function up322(db) {
30309
30470
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30310
30471
  if (!depCols.some((c22) => c22.name === "reason")) {
30311
30472
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -30315,7 +30476,7 @@ function up312(db) {
30315
30476
  db.exec("ALTER TABLE entities ADD COLUMN last_synthesized_at TEXT");
30316
30477
  }
30317
30478
  }
30318
- function up322(db) {
30479
+ function up332(db) {
30319
30480
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
30320
30481
  if (cols.length === 0)
30321
30482
  return;
@@ -30323,14 +30484,14 @@ function up322(db) {
30323
30484
  db.exec("ALTER TABLE embeddings ADD COLUMN vector BLOB");
30324
30485
  }
30325
30486
  }
30326
- function up332(db) {
30487
+ function up342(db) {
30327
30488
  const cols = db.prepare("PRAGMA table_info(memories)").all();
30328
30489
  if (!cols.some((c22) => c22.name === "scope")) {
30329
30490
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
30330
30491
  }
30331
30492
  db.exec("CREATE INDEX IF NOT EXISTS idx_memories_scope ON memories(scope) WHERE scope IS NOT NULL");
30332
30493
  }
30333
- function up342(db) {
30494
+ function up352(db) {
30334
30495
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
30335
30496
  db.exec(`
30336
30497
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -30338,7 +30499,7 @@ function up342(db) {
30338
30499
  WHERE content_hash IS NOT NULL AND is_deleted = 0
30339
30500
  `);
30340
30501
  }
30341
- function up352(db) {
30502
+ function up362(db) {
30342
30503
  db.exec(`
30343
30504
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
30344
30505
  name, canonical_name,
@@ -30370,13 +30531,13 @@ function up352(db) {
30370
30531
  END
30371
30532
  `);
30372
30533
  }
30373
- function up362(db) {
30534
+ function up372(db) {
30374
30535
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
30375
30536
  if (!cols.some((c22) => c22.name === "confidence")) {
30376
30537
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
30377
30538
  }
30378
30539
  }
30379
- function up372(db) {
30540
+ function up382(db) {
30380
30541
  db.exec(`
30381
30542
  CREATE TABLE IF NOT EXISTS entity_communities (
30382
30543
  id TEXT PRIMARY KEY,
@@ -30394,7 +30555,7 @@ function up372(db) {
30394
30555
  db.exec("ALTER TABLE entities ADD COLUMN community_id TEXT REFERENCES entity_communities(id)");
30395
30556
  }
30396
30557
  }
30397
- function up382(db) {
30558
+ function up392(db) {
30398
30559
  db.exec(`
30399
30560
  CREATE TABLE IF NOT EXISTS memory_hints (
30400
30561
  id TEXT PRIMARY KEY,
@@ -30434,7 +30595,7 @@ function up382(db) {
30434
30595
  END
30435
30596
  `);
30436
30597
  }
30437
- function up392(db) {
30598
+ function up402(db) {
30438
30599
  db.exec(`
30439
30600
  DELETE FROM entity_dependencies
30440
30601
  WHERE id NOT IN (
@@ -30452,7 +30613,7 @@ function up392(db) {
30452
30613
  )
30453
30614
  `);
30454
30615
  }
30455
- function up402(db) {
30616
+ function up412(db) {
30456
30617
  db.exec(`
30457
30618
  CREATE TABLE IF NOT EXISTS session_transcripts (
30458
30619
  session_key TEXT PRIMARY KEY,
@@ -30475,7 +30636,7 @@ function addColumnIfMissing102(db, table, column, definition) {
30475
30636
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30476
30637
  }
30477
30638
  }
30478
- function up412(db) {
30639
+ function up422(db) {
30479
30640
  addColumnIfMissing102(db, "session_memories", "path_json", "TEXT");
30480
30641
  db.exec(`
30481
30642
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -30550,7 +30711,7 @@ function addColumnIfMissing112(db, table, column, definition) {
30550
30711
  return;
30551
30712
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30552
30713
  }
30553
- function up422(db) {
30714
+ function up432(db) {
30554
30715
  addColumnIfMissing112(db, "session_memories", "entity_slot", "INTEGER");
30555
30716
  addColumnIfMissing112(db, "session_memories", "aspect_slot", "INTEGER");
30556
30717
  addColumnIfMissing112(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -30638,7 +30799,7 @@ function addColumnIfMissing122(db, table, column, definition) {
30638
30799
  return;
30639
30800
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30640
30801
  }
30641
- function up432(db) {
30802
+ function up442(db) {
30642
30803
  db.exec(`
30643
30804
  CREATE TABLE IF NOT EXISTS agents (
30644
30805
  id TEXT PRIMARY KEY,
@@ -30667,7 +30828,7 @@ function addColumnIfMissing132(db, table, column, definition) {
30667
30828
  return;
30668
30829
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30669
30830
  }
30670
- function up442(db) {
30831
+ function up452(db) {
30671
30832
  addColumnIfMissing132(db, "session_summaries", "source_type", "TEXT");
30672
30833
  addColumnIfMissing132(db, "session_summaries", "source_ref", "TEXT");
30673
30834
  addColumnIfMissing132(db, "session_summaries", "meta_json", "TEXT");
@@ -30693,7 +30854,7 @@ function addColumnIfMissing142(db, table, column, definition) {
30693
30854
  return;
30694
30855
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
30695
30856
  }
30696
- function up452(db) {
30857
+ function up462(db) {
30697
30858
  addColumnIfMissing142(db, "session_transcripts", "updated_at", "TEXT");
30698
30859
  addColumnIfMissing142(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
30699
30860
  addColumnIfMissing142(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -30764,7 +30925,7 @@ function up452(db) {
30764
30925
  ON memory_md_heads(lease_expires_at);
30765
30926
  `);
30766
30927
  }
30767
- function up462(db) {
30928
+ function up472(db) {
30768
30929
  db.exec(`
30769
30930
  DROP INDEX IF EXISTS idx_summaries_session_depth;
30770
30931
 
@@ -30825,7 +30986,7 @@ function up462(db) {
30825
30986
  AND COALESCE(source_type, 'summary') = 'summary';
30826
30987
  `);
30827
30988
  }
30828
- function up472(db) {
30989
+ function up482(db) {
30829
30990
  db.exec(`
30830
30991
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
30831
30992
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -30923,7 +31084,7 @@ function up472(db) {
30923
31084
  AND COALESCE(source_type, 'summary') = 'summary';
30924
31085
  `);
30925
31086
  }
30926
- function up482(db) {
31087
+ function up492(db) {
30927
31088
  db.exec(`
30928
31089
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
30929
31090
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -31041,7 +31202,7 @@ function up482(db) {
31041
31202
  WHERE excluded.latest_at >= memory_thread_heads.latest_at;
31042
31203
  `);
31043
31204
  }
31044
- function up492(db) {
31205
+ function up502(db) {
31045
31206
  db.exec(`
31046
31207
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
31047
31208
  session_key TEXT NOT NULL,
@@ -31058,7 +31219,7 @@ function hasTable5(db, name) {
31058
31219
  WHERE type = 'table' AND name = ?
31059
31220
  LIMIT 1`).get(name) !== undefined;
31060
31221
  }
31061
- function up502(db) {
31222
+ function up512(db) {
31062
31223
  db.exec(`
31063
31224
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
31064
31225
  id TEXT PRIMARY KEY,
@@ -31228,7 +31389,7 @@ function addColumnIfMissing152(db, table, column, definition) {
31228
31389
  return;
31229
31390
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31230
31391
  }
31231
- function up512(db) {
31392
+ function up522(db) {
31232
31393
  addColumnIfMissing152(db, "summary_jobs", "session_id", "TEXT");
31233
31394
  addColumnIfMissing152(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
31234
31395
  addColumnIfMissing152(db, "summary_jobs", "captured_at", "TEXT");
@@ -31320,7 +31481,7 @@ function up512(db) {
31320
31481
  VALUES ('rebuild');
31321
31482
  `);
31322
31483
  }
31323
- function up522(db) {
31484
+ function up532(db) {
31324
31485
  db.exec(`
31325
31486
  CREATE TABLE IF NOT EXISTS mcp_invocations (
31326
31487
  id TEXT PRIMARY KEY,
@@ -31337,7 +31498,7 @@ function up522(db) {
31337
31498
  CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
31338
31499
  `);
31339
31500
  }
31340
- function up532(db) {
31501
+ function up542(db) {
31341
31502
  db.exec(`
31342
31503
  CREATE TABLE IF NOT EXISTS skill_invocations (
31343
31504
  id TEXT PRIMARY KEY,
@@ -31353,7 +31514,7 @@ function up532(db) {
31353
31514
  CREATE INDEX IF NOT EXISTS idx_skill_inv_agent ON skill_invocations(agent_id, created_at);
31354
31515
  `);
31355
31516
  }
31356
- function up542(db) {
31517
+ function up552(db) {
31357
31518
  db.exec(`
31358
31519
  CREATE TABLE IF NOT EXISTS task_scope_hints (
31359
31520
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -31384,7 +31545,7 @@ function up542(db) {
31384
31545
  ON task_scope_hints(agent_id, updated_at);
31385
31546
  `);
31386
31547
  }
31387
- function up552(db) {
31548
+ function up562(db) {
31388
31549
  db.exec(`
31389
31550
  CREATE TABLE IF NOT EXISTS dreaming_state (
31390
31551
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -31427,7 +31588,7 @@ function ensureMemoriesScopeColumns3(db) {
31427
31588
  if (!names.has("scope"))
31428
31589
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
31429
31590
  }
31430
- function up562(db) {
31591
+ function up572(db) {
31431
31592
  ensureMemoriesScopeColumns3(db);
31432
31593
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
31433
31594
  db.exec(`
@@ -31440,20 +31601,20 @@ function up562(db) {
31440
31601
  WHERE content_hash IS NOT NULL AND is_deleted = 0
31441
31602
  `);
31442
31603
  }
31443
- function up572(db) {
31604
+ function up582(db) {
31444
31605
  const sql = readMemoriesFtsSql2(db);
31445
31606
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair2(sql))
31446
31607
  return;
31447
31608
  recreateMemoriesFts2(db);
31448
31609
  }
31449
- function up582(db) {
31610
+ function up592(db) {
31450
31611
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
31451
31612
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
31452
31613
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
31453
31614
  ON entities(entity_type, mentions)
31454
31615
  WHERE entity_type = 'extracted'`);
31455
31616
  }
31456
- function up592(db) {
31617
+ function up602(db) {
31457
31618
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31458
31619
  if (!cols.some((col) => col.name === "claim_key")) {
31459
31620
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -31462,7 +31623,7 @@ function up592(db) {
31462
31623
  ON entity_attributes(agent_id, aspect_id, claim_key, status)
31463
31624
  WHERE claim_key IS NOT NULL`);
31464
31625
  }
31465
- function up602(db) {
31626
+ function up612(db) {
31466
31627
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
31467
31628
  if (!cols.some((col) => col.name === "group_key")) {
31468
31629
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -31474,13 +31635,13 @@ function up602(db) {
31474
31635
  ON entity_attributes(agent_id, aspect_id, group_key, claim_key, status)
31475
31636
  WHERE claim_key IS NOT NULL`);
31476
31637
  }
31477
- function up612(db) {
31638
+ function up622(db) {
31478
31639
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31479
31640
  if (cols.some((col) => col.name === "source_mtime_ms"))
31480
31641
  return;
31481
31642
  db.exec("ALTER TABLE memory_artifacts ADD COLUMN source_mtime_ms REAL");
31482
31643
  }
31483
- function up622(db) {
31644
+ function up632(db) {
31484
31645
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
31485
31646
  const names = new Set(cols.map((col) => col.name));
31486
31647
  if (!names.has("is_deleted")) {
@@ -31494,7 +31655,7 @@ function up622(db) {
31494
31655
  ON memory_artifacts(agent_id, is_deleted, deleted_at)
31495
31656
  `);
31496
31657
  }
31497
- function up632(db) {
31658
+ function up642(db) {
31498
31659
  db.exec("DROP TRIGGER IF EXISTS memories_au");
31499
31660
  db.exec(`
31500
31661
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -31512,7 +31673,7 @@ function addColumnIfMissing162(db, table, column, definition) {
31512
31673
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31513
31674
  }
31514
31675
  }
31515
- function up642(db) {
31676
+ function up652(db) {
31516
31677
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
31517
31678
  addColumnIfMissing162(db, table, "source_id", "TEXT");
31518
31679
  addColumnIfMissing162(db, table, "source_kind", "TEXT");
@@ -31532,7 +31693,7 @@ function hasColumn72(db, table, column) {
31532
31693
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31533
31694
  return rows.some((row) => row.name === column);
31534
31695
  }
31535
- function up652(db) {
31696
+ function up662(db) {
31536
31697
  if (!hasTable22(db, "embeddings"))
31537
31698
  return;
31538
31699
  if (!hasColumn72(db, "embeddings", "agent_id")) {
@@ -31540,7 +31701,7 @@ function up652(db) {
31540
31701
  }
31541
31702
  db.exec("CREATE INDEX IF NOT EXISTS idx_embeddings_agent_source ON embeddings(agent_id, source_type, source_id)");
31542
31703
  }
31543
- function up662(db) {
31704
+ function up672(db) {
31544
31705
  db.exec(`
31545
31706
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
31546
31707
  id TEXT PRIMARY KEY,
@@ -31581,7 +31742,7 @@ function addColumnIfMissing172(db, table, column, definition) {
31581
31742
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31582
31743
  }
31583
31744
  }
31584
- function up672(db) {
31745
+ function up682(db) {
31585
31746
  db.exec(`
31586
31747
  CREATE TABLE IF NOT EXISTS ontology_proposals (
31587
31748
  id TEXT PRIMARY KEY,
@@ -31624,7 +31785,7 @@ function up672(db) {
31624
31785
  db.exec(`CREATE INDEX IF NOT EXISTS idx_${table}_proposal ON ${table}(agent_id, proposal_id)`);
31625
31786
  }
31626
31787
  }
31627
- function up682(db) {
31788
+ function up692(db) {
31628
31789
  db.exec(`
31629
31790
  CREATE TABLE IF NOT EXISTS daily_reflections (
31630
31791
  id TEXT PRIMARY KEY,
@@ -31651,7 +31812,7 @@ function up682(db) {
31651
31812
  WHERE content_key IS NOT NULL;
31652
31813
  `);
31653
31814
  }
31654
- function up692(db) {
31815
+ function up702(db) {
31655
31816
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
31656
31817
  const colNames = new Set(cols.flatMap((c22) => typeof c22.name === "string" ? [c22.name] : []));
31657
31818
  if (!colNames.has("content_key")) {
@@ -31688,7 +31849,7 @@ function backfillVersionRoots2(db) {
31688
31849
  WHERE version_root_id IS NULL
31689
31850
  `);
31690
31851
  }
31691
- function up702(db) {
31852
+ function up712(db) {
31692
31853
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
31693
31854
  addColumnIfMissing182(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
31694
31855
  addColumnIfMissing182(db, table, "archived_at", "TEXT");
@@ -31723,7 +31884,7 @@ function up702(db) {
31723
31884
  ON entity_aspects(agent_id, proposal_id);
31724
31885
  `);
31725
31886
  }
31726
- function up712(db) {
31887
+ function up722(db) {
31727
31888
  db.exec(`
31728
31889
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
31729
31890
  id TEXT PRIMARY KEY,
@@ -31779,7 +31940,7 @@ function ensureMemoriesScopeColumns22(db) {
31779
31940
  if (!names.has("runtime_path"))
31780
31941
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
31781
31942
  }
31782
- function up722(db) {
31943
+ function up732(db) {
31783
31944
  ensureMemoriesScopeColumns22(db);
31784
31945
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
31785
31946
  db.exec(`
@@ -31793,7 +31954,7 @@ function up722(db) {
31793
31954
  WHERE idempotency_key IS NOT NULL AND is_deleted = 0
31794
31955
  `);
31795
31956
  }
31796
- function up732(db) {
31957
+ function up742(db) {
31797
31958
  db.exec(`
31798
31959
  CREATE TABLE IF NOT EXISTS session_context_epochs (
31799
31960
  session_key TEXT NOT NULL,
@@ -31828,7 +31989,7 @@ function up732(db) {
31828
31989
  ON session_recall_events(item_kind, item_id, created_at DESC);
31829
31990
  `);
31830
31991
  }
31831
- function up742(db) {
31992
+ function up752(db) {
31832
31993
  db.exec(`
31833
31994
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
31834
31995
  aggregate_memory_id TEXT NOT NULL,
@@ -31847,7 +32008,7 @@ function addColumnIfMissing192(db, table, column, definition) {
31847
32008
  return;
31848
32009
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
31849
32010
  }
31850
- function up752(db) {
32011
+ function up762(db) {
31851
32012
  addColumnIfMissing192(db, "memory_artifacts", "source_id", "TEXT");
31852
32013
  addColumnIfMissing192(db, "memory_artifacts", "source_root", "TEXT");
31853
32014
  addColumnIfMissing192(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -31860,7 +32021,7 @@ function up752(db) {
31860
32021
  ON memory_artifacts(agent_id, source_id, source_root);
31861
32022
  `);
31862
32023
  }
31863
- function up762(db) {
32024
+ function up772(db) {
31864
32025
  db.exec(`
31865
32026
  CREATE TABLE IF NOT EXISTS temporal_edges (
31866
32027
  id TEXT PRIMARY KEY,
@@ -31883,7 +32044,7 @@ function up762(db) {
31883
32044
  ON temporal_edges(agent_id, subject_type, subject_id);
31884
32045
  `);
31885
32046
  }
31886
- function up772(db) {
32047
+ function up782(db) {
31887
32048
  db.exec(`
31888
32049
  CREATE TABLE IF NOT EXISTS entity_aliases (
31889
32050
  id TEXT PRIMARY KEY,
@@ -31907,7 +32068,7 @@ function up772(db) {
31907
32068
  ON entity_aliases(agent_id, canonical_alias, status);
31908
32069
  `);
31909
32070
  }
31910
- function up782(db) {
32071
+ function up792(db) {
31911
32072
  db.exec(`
31912
32073
  CREATE TABLE IF NOT EXISTS api_keys (
31913
32074
  id TEXT PRIMARY KEY,
@@ -31935,7 +32096,7 @@ function up782(db) {
31935
32096
  ON api_keys(connector, harness);
31936
32097
  `);
31937
32098
  }
31938
- function up792(db) {
32099
+ function up802(db) {
31939
32100
  db.exec(`
31940
32101
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
31941
32102
  id TEXT PRIMARY KEY,
@@ -31970,7 +32131,7 @@ function hasColumn102(db, table, column) {
31970
32131
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
31971
32132
  return rows.some((row) => row.name === column);
31972
32133
  }
31973
- function up802(db) {
32134
+ function up812(db) {
31974
32135
  if (!hasColumn102(db, "documents", "agent_id")) {
31975
32136
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
31976
32137
  }
@@ -32056,7 +32217,7 @@ function up802(db) {
32056
32217
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_agent_project ON documents(agent_id, project)");
32057
32218
  db.exec("CREATE INDEX IF NOT EXISTS idx_documents_source_scope ON documents(source_url, agent_id, project)");
32058
32219
  }
32059
- function up812(db) {
32220
+ function up822(db) {
32060
32221
  db.exec(`
32061
32222
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
32062
32223
  aggregate_memory_id TEXT NOT NULL,
@@ -32078,7 +32239,7 @@ function hasColumn112(db, table, column) {
32078
32239
  return rows.some((row) => row.name === column);
32079
32240
  }
32080
32241
  var COLUMNS3 = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
32081
- function up822(db) {
32242
+ function up832(db) {
32082
32243
  for (const column of COLUMNS3) {
32083
32244
  if (!hasColumn112(db, "skill_invocations", column)) {
32084
32245
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -32159,7 +32320,7 @@ function documentScopeColumnsPreservingExisting2(db) {
32159
32320
  `);
32160
32321
  }
32161
32322
  try {
32162
- up802(db);
32323
+ up812(db);
32163
32324
  if (preserveAgentId) {
32164
32325
  db.exec(`
32165
32326
  UPDATE documents
@@ -32179,12 +32340,12 @@ function documentScopeColumnsPreservingExisting2(db) {
32179
32340
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
32180
32341
  }
32181
32342
  }
32182
- function up832(db) {
32183
- up792(db);
32343
+ function up842(db) {
32344
+ up802(db);
32184
32345
  if (hasTable32(db, "documents")) {
32185
32346
  documentScopeColumnsPreservingExisting2(db);
32186
32347
  }
32187
- up812(db);
32348
+ up822(db);
32188
32349
  addColumnIfMissing202(db, "memories", "superseded_by", "TEXT");
32189
32350
  addColumnIfMissing202(db, "memories", "superseded_at", "TEXT");
32190
32351
  addColumnIfMissing202(db, "memories", "superseded_reason", "TEXT");
@@ -32241,7 +32402,7 @@ function up832(db) {
32241
32402
  AND ${sourceAgentId} = ${targetAgentId}
32242
32403
  `);
32243
32404
  }
32244
- function up842(db) {
32405
+ function up852(db) {
32245
32406
  db.exec(`
32246
32407
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
32247
32408
  path TEXT PRIMARY KEY,
@@ -32271,7 +32432,7 @@ function up842(db) {
32271
32432
  ON legacy_markdown_chunks(memory_id);
32272
32433
  `);
32273
32434
  }
32274
- function up852(db) {
32435
+ function up862(db) {
32275
32436
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
32276
32437
  const tableNames = new Set(tables.map((r22) => String(r22.name)));
32277
32438
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -32330,7 +32491,7 @@ function addColumnIfMissing212(db, table, column, definition) {
32330
32491
  return;
32331
32492
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32332
32493
  }
32333
- function up862(db) {
32494
+ function up872(db) {
32334
32495
  addColumnIfMissing212(db, "summary_jobs", "content_hash", "TEXT");
32335
32496
  db.exec(`
32336
32497
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -32343,14 +32504,14 @@ function addColumnIfMissing222(db, table, column, definition) {
32343
32504
  return;
32344
32505
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
32345
32506
  }
32346
- function up872(db) {
32507
+ function up882(db) {
32347
32508
  addColumnIfMissing222(db, "summary_jobs", "boundary_reason", "TEXT");
32348
32509
  db.exec(`
32349
32510
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
32350
32511
  ON summary_jobs(agent_id, session_key, boundary_reason)
32351
32512
  `);
32352
32513
  }
32353
- function up882(db) {
32514
+ function up892(db) {
32354
32515
  db.exec(`
32355
32516
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
32356
32517
  agent_id TEXT NOT NULL,
@@ -32368,7 +32529,7 @@ function up882(db) {
32368
32529
  ON transcript_capture_jobs(agent_id, session_id, status);
32369
32530
  `);
32370
32531
  }
32371
- function up892(db) {
32532
+ function up902(db) {
32372
32533
  db.exec(`
32373
32534
  CREATE TABLE IF NOT EXISTS job_cancellations (
32374
32535
  id TEXT PRIMARY KEY,
@@ -32396,7 +32557,7 @@ function indexExists3(db, table, indexName) {
32396
32557
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32397
32558
  return rows.some((row) => row.name === indexName);
32398
32559
  }
32399
- function up902(db) {
32560
+ function up912(db) {
32400
32561
  db.exec(`
32401
32562
  CREATE TABLE IF NOT EXISTS job_archive (
32402
32563
  id TEXT PRIMARY KEY,
@@ -32423,7 +32584,7 @@ function indexExists22(db, table, indexName) {
32423
32584
  const rows = db.prepare(`PRAGMA index_list(${table})`).all();
32424
32585
  return rows.some((row) => row.name === indexName);
32425
32586
  }
32426
- function up912(db) {
32587
+ function up922(db) {
32427
32588
  db.exec(`
32428
32589
  CREATE TABLE IF NOT EXISTS embedding_index_state (
32429
32590
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -32436,7 +32597,7 @@ function up912(db) {
32436
32597
  )
32437
32598
  `);
32438
32599
  }
32439
- function up922(db) {
32600
+ function up932(db) {
32440
32601
  db.exec(`
32441
32602
  CREATE TABLE IF NOT EXISTS embeddings_staging (
32442
32603
  id TEXT PRIMARY KEY,
@@ -32455,7 +32616,7 @@ function up922(db) {
32455
32616
  ON embeddings_staging(agent_id, source_type, source_id);
32456
32617
  `);
32457
32618
  }
32458
- function up932(db) {
32619
+ function up942(db) {
32459
32620
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32460
32621
  if (!columns.some((column) => column.name === "evidence_cursor")) {
32461
32622
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -32466,7 +32627,7 @@ function hasColumn132(db, table, column) {
32466
32627
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
32467
32628
  return rows.some((r22) => r22.name === column);
32468
32629
  }
32469
- function up942(db) {
32630
+ function up952(db) {
32470
32631
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
32471
32632
  if (tables.length === 0)
32472
32633
  return;
@@ -32491,23 +32652,23 @@ function up942(db) {
32491
32652
  function hasColumn142(db, table, column) {
32492
32653
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32493
32654
  }
32494
- function up952(db) {
32655
+ function up962(db) {
32495
32656
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
32496
32657
  if (!hasMemories || !hasColumn142(db, "memories", "memory_kind") || !hasColumn142(db, "memories", "type"))
32497
32658
  return;
32498
32659
  db.exec("UPDATE memories SET memory_kind = NULL WHERE type = 'session_summary'");
32499
32660
  }
32500
- function up962(db) {
32661
+ function up972(db) {
32501
32662
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
32502
32663
  }
32503
- function up972(db) {
32664
+ function up982(db) {
32504
32665
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
32505
32666
  if (!columns.some((column) => column.name === "last_failure_at")) {
32506
32667
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
32507
32668
  }
32508
32669
  db.exec("UPDATE dreaming_state SET last_failure_at = updated_at WHERE consecutive_failures > 0 AND last_failure_at IS NULL");
32509
32670
  }
32510
- function up982(db) {
32671
+ function up992(db) {
32511
32672
  db.exec(`
32512
32673
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
32513
32674
  agent_id TEXT NOT NULL,
@@ -32524,7 +32685,7 @@ function up982(db) {
32524
32685
  ON dreaming_evidence_exclusions (agent_id, resolved_at, requeue_requested_at, excluded_at DESC);
32525
32686
  `);
32526
32687
  }
32527
- function up992(db) {
32688
+ function up1002(db) {
32528
32689
  db.exec(`
32529
32690
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
32530
32691
  id TEXT PRIMARY KEY,
@@ -32544,7 +32705,7 @@ function up992(db) {
32544
32705
  ON dreaming_tool_calls (agent_id, pass_id, sequence ASC);
32545
32706
  `);
32546
32707
  }
32547
- function up1002(db) {
32708
+ function up1012(db) {
32548
32709
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
32549
32710
  if (!columns.some((column) => column.name === "evidence_window_json")) {
32550
32711
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -32553,7 +32714,7 @@ function up1002(db) {
32553
32714
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN runbook_json TEXT");
32554
32715
  }
32555
32716
  }
32556
- function up1012(db) {
32717
+ function up1022(db) {
32557
32718
  db.exec(`
32558
32719
  CREATE TABLE IF NOT EXISTS dreaming_attention (
32559
32720
  id TEXT PRIMARY KEY,
@@ -32575,7 +32736,7 @@ function up1012(db) {
32575
32736
  function hasColumn152(db, table, column) {
32576
32737
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32577
32738
  }
32578
- function up1022(db) {
32739
+ function up1032(db) {
32579
32740
  const requiredMemoryColumns = [
32580
32741
  "content_hash",
32581
32742
  "normalized_content",
@@ -32626,7 +32787,7 @@ function up1022(db) {
32626
32787
  WHERE EXISTS (SELECT 1 FROM memory_entity_mentions WHERE entity_id = entities.id)
32627
32788
  `);
32628
32789
  }
32629
- function up1032(db) {
32790
+ function up1042(db) {
32630
32791
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
32631
32792
  if (tables.length !== 2)
32632
32793
  return;
@@ -32649,7 +32810,7 @@ function tableExists4(db, table) {
32649
32810
  function hasColumn162(db, table, column) {
32650
32811
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32651
32812
  }
32652
- function up1042(db) {
32813
+ function up1052(db) {
32653
32814
  db.exec(`
32654
32815
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
32655
32816
  derived_memory_id TEXT NOT NULL,
@@ -32692,7 +32853,7 @@ function up1042(db) {
32692
32853
  `);
32693
32854
  }
32694
32855
  }
32695
- function up1052(db) {
32856
+ function up1062(db) {
32696
32857
  db.exec(`
32697
32858
  DROP TRIGGER IF EXISTS entities_fts_ai;
32698
32859
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -32781,7 +32942,7 @@ function up1052(db) {
32781
32942
  function hasColumn172(db, table, column) {
32782
32943
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
32783
32944
  }
32784
- function up1062(db) {
32945
+ function up1072(db) {
32785
32946
  if (!hasColumn172(db, "memories", "review_after")) {
32786
32947
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
32787
32948
  }
@@ -32797,14 +32958,14 @@ var TOKEN_COLUMNS2 = [
32797
32958
  ["tokens_cache_write", "INTEGER"],
32798
32959
  ["tokens_cost", "REAL"]
32799
32960
  ];
32800
- function up1072(db) {
32961
+ function up1082(db) {
32801
32962
  for (const [column, type] of TOKEN_COLUMNS2) {
32802
32963
  if (!hasColumn182(db, "dreaming_passes", column)) {
32803
32964
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
32804
32965
  }
32805
32966
  }
32806
32967
  }
32807
- function up1082(db) {
32968
+ function up1092(db) {
32808
32969
  db.exec(`
32809
32970
  CREATE TABLE IF NOT EXISTS embedding_usage (
32810
32971
  day TEXT NOT NULL,
@@ -32817,7 +32978,7 @@ function up1082(db) {
32817
32978
  );
32818
32979
  `);
32819
32980
  }
32820
- function up1092(db) {
32981
+ function up1102(db) {
32821
32982
  db.exec(`
32822
32983
  CREATE TABLE IF NOT EXISTS telemetry_install (
32823
32984
  id TEXT PRIMARY KEY,
@@ -32825,7 +32986,7 @@ function up1092(db) {
32825
32986
  );
32826
32987
  `);
32827
32988
  }
32828
- function up1102(db) {
32989
+ function up1112(db) {
32829
32990
  db.exec(`
32830
32991
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
32831
32992
  ON memory_entity_mentions(entity_id, memory_id);
@@ -32836,7 +32997,7 @@ function hasColumn192(db, table, column) {
32836
32997
  return rows.some((row) => row.name === column);
32837
32998
  }
32838
32999
  var COLUMNS22 = ["first_remember_at", "first_recall_at"];
32839
- function up1112(db) {
33000
+ function up1122(db) {
32840
33001
  for (const column of COLUMNS22) {
32841
33002
  if (!hasColumn192(db, "telemetry_install", column)) {
32842
33003
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -32852,7 +33013,7 @@ function addColumnIfMissing232(db, column, definition) {
32852
33013
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
32853
33014
  }
32854
33015
  }
32855
- function up1122(db) {
33016
+ function up1132(db) {
32856
33017
  addColumnIfMissing232(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
32857
33018
  addColumnIfMissing232(db, "claim_token", "TEXT");
32858
33019
  addColumnIfMissing232(db, "claimed_at", "TEXT");
@@ -32861,7 +33022,7 @@ function up1122(db) {
32861
33022
  ON telemetry_events(source, sent_to_posthog, claimed_at, timestamp);
32862
33023
  `);
32863
33024
  }
32864
- function up1132(db) {
33025
+ function up1142(db) {
32865
33026
  db.exec(`
32866
33027
  CREATE TABLE IF NOT EXISTS session_claims (
32867
33028
  session_key TEXT NOT NULL,
@@ -32882,7 +33043,7 @@ function up1132(db) {
32882
33043
  ON session_claims(agent_id, state, expires_at);
32883
33044
  `);
32884
33045
  }
32885
- function up1142(db) {
33046
+ function up1152(db) {
32886
33047
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
32887
33048
  if (table == null)
32888
33049
  return;
@@ -32891,7 +33052,7 @@ function up1142(db) {
32891
33052
  ON entity_attributes(memory_id, agent_id, status, importance);
32892
33053
  `);
32893
33054
  }
32894
- function up1152(db) {
33055
+ function up1162(db) {
32895
33056
  db.exec(`
32896
33057
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
32897
33058
  id TEXT PRIMARY KEY,
@@ -32948,7 +33109,7 @@ function addColumnIfMissing242(db, column, definition) {
32948
33109
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
32949
33110
  }
32950
33111
  }
32951
- function up1162(db) {
33112
+ function up1172(db) {
32952
33113
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
32953
33114
  if (table == null)
32954
33115
  return;
@@ -33149,7 +33310,7 @@ function backfillTranscriptsFromSummaryJobs2(db) {
33149
33310
  insert.run(...values);
33150
33311
  }
33151
33312
  }
33152
- function up1172(db) {
33313
+ function up1182(db) {
33153
33314
  if (!hasTable42(db, "session_transcripts"))
33154
33315
  return;
33155
33316
  addColumnIfMissing252(db, "session_transcripts", "completed_at", "TEXT");
@@ -33202,7 +33363,7 @@ function up1172(db) {
33202
33363
  ON session_transcripts(agent_id, content_hash);
33203
33364
  `);
33204
33365
  }
33205
- function up1182(db) {
33366
+ function up1192(db) {
33206
33367
  db.exec(`
33207
33368
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
33208
33369
  ON memory_jobs(status)
@@ -33221,12 +33382,12 @@ function up1182(db) {
33221
33382
  function hasColumn222(db, table, column) {
33222
33383
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
33223
33384
  }
33224
- function up1192(db) {
33385
+ function up1202(db) {
33225
33386
  if (!hasColumn222(db, "telemetry_install", "last_seen_version")) {
33226
33387
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
33227
33388
  }
33228
33389
  }
33229
- function up1202(db) {
33390
+ function up1212(db) {
33230
33391
  db.exec(`
33231
33392
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
33232
33393
  agent_id TEXT NOT NULL,
@@ -33255,7 +33416,7 @@ function addColumnIfMissing262(db, column, definition) {
33255
33416
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
33256
33417
  }
33257
33418
  }
33258
- function up1212(db) {
33419
+ function up1222(db) {
33259
33420
  addColumnIfMissing262(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
33260
33421
  addColumnIfMissing262(db, "last_attempt_at", "TEXT");
33261
33422
  addColumnIfMissing262(db, "sent_at", "TEXT");
@@ -33276,7 +33437,7 @@ function up1212(db) {
33276
33437
  VALUES (1, CURRENT_TIMESTAMP);
33277
33438
  `);
33278
33439
  }
33279
- function up1222(db) {
33440
+ function up1232(db) {
33280
33441
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
33281
33442
  const names = new Set(columns.map((column) => column.name));
33282
33443
  if (!names.has("failure_class")) {
@@ -33293,7 +33454,7 @@ function up1222(db) {
33293
33454
  }
33294
33455
  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)");
33295
33456
  }
33296
- function up1232(db) {
33457
+ function up1242(db) {
33297
33458
  db.exec(`
33298
33459
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
33299
33460
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -33317,7 +33478,7 @@ function up1232(db) {
33317
33478
  ON embedding_index_failures(source_type, source_id);
33318
33479
  `);
33319
33480
  }
33320
- function up1242(db) {
33481
+ function up1252(db) {
33321
33482
  db.exec(`
33322
33483
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
33323
33484
  id TEXT PRIMARY KEY,
@@ -33367,7 +33528,7 @@ function backfillTable2(db, params) {
33367
33528
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
33368
33529
  backfill2(db, rows, params.sourceKind, params.scannedAt);
33369
33530
  }
33370
- function up1252(db) {
33531
+ function up1262(db) {
33371
33532
  db.exec(`
33372
33533
  CREATE TABLE IF NOT EXISTS memory_content_safety (
33373
33534
  agent_id TEXT NOT NULL,
@@ -33424,7 +33585,7 @@ function up1252(db) {
33424
33585
  scannedAt
33425
33586
  });
33426
33587
  }
33427
- function up1262(db) {
33588
+ function up1272(db) {
33428
33589
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
33429
33590
  if (!table)
33430
33591
  return;
@@ -33458,7 +33619,7 @@ function up1262(db) {
33458
33619
  ON dreaming_attention (agent_id, resolved_at, priority DESC, created_at ASC);
33459
33620
  `);
33460
33621
  }
33461
- function up1272(db) {
33622
+ function up1282(db) {
33462
33623
  db.exec(`
33463
33624
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
33464
33625
  id TEXT PRIMARY KEY,
@@ -33514,7 +33675,7 @@ function up1272(db) {
33514
33675
  ON ontology_contradictions(agent_id, left_source_id, right_source_id);
33515
33676
  `);
33516
33677
  }
33517
- function up1282(db) {
33678
+ function up1292(db) {
33518
33679
  db.exec(`
33519
33680
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
33520
33681
  ON memory_jobs(status, created_at)
@@ -33529,7 +33690,7 @@ function up1282(db) {
33529
33690
  function tableExists32(db, table) {
33530
33691
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
33531
33692
  }
33532
- function up1292(db) {
33693
+ function up1302(db) {
33533
33694
  if (!tableExists32(db, "memory_jobs"))
33534
33695
  return;
33535
33696
  if (!tableExists32(db, "job_cancellations")) {
@@ -33578,7 +33739,7 @@ function up1292(db) {
33578
33739
  AND status IN ('pending', 'leased');
33579
33740
  `);
33580
33741
  }
33581
- function up1302(db) {
33742
+ function up1312(db) {
33582
33743
  db.exec(`
33583
33744
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
33584
33745
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -33618,7 +33779,7 @@ function up1302(db) {
33618
33779
  END;
33619
33780
  `);
33620
33781
  }
33621
- function up1312(db) {
33782
+ function up1322(db) {
33622
33783
  db.exec(`
33623
33784
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
33624
33785
  agent_id TEXT NOT NULL,
@@ -33641,13 +33802,13 @@ function up1312(db) {
33641
33802
  ON dreaming_evidence_consumption(agent_id, pass_id, delivered_offset, source_length);
33642
33803
  `);
33643
33804
  }
33644
- function up1322(db) {
33805
+ function up1332(db) {
33645
33806
  db.exec(`
33646
33807
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
33647
33808
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
33648
33809
  `);
33649
33810
  }
33650
- function up1332(db) {
33811
+ function up1342(db) {
33651
33812
  db.exec(`
33652
33813
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
33653
33814
  id TEXT PRIMARY KEY,
@@ -33699,7 +33860,7 @@ function up1332(db) {
33699
33860
  if (!names.has("format_version"))
33700
33861
  db.exec("ALTER TABLE memory_md_heads ADD COLUMN format_version INTEGER NOT NULL DEFAULT 1");
33701
33862
  }
33702
- function up1342(db) {
33863
+ function up1352(db) {
33703
33864
  db.exec(`
33704
33865
  CREATE TABLE memory_head_entries_v134 (
33705
33866
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -33717,7 +33878,7 @@ function up1342(db) {
33717
33878
  ON memory_head_entries(agent_id, entry_id, last_revision DESC);
33718
33879
  `);
33719
33880
  }
33720
- function up1352(db) {
33881
+ function up1362(db) {
33721
33882
  db.exec(`
33722
33883
  CREATE TABLE IF NOT EXISTS memory_head_publications (
33723
33884
  agent_id TEXT NOT NULL,
@@ -33733,7 +33894,7 @@ function up1352(db) {
33733
33894
  ON memory_head_publications(agent_id, status, revision DESC);
33734
33895
  `);
33735
33896
  }
33736
- function up1362(db) {
33897
+ function up1372(db) {
33737
33898
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r22) => r22.name));
33738
33899
  for (const [name, type] of [
33739
33900
  ["entry_id", "TEXT"],
@@ -33747,7 +33908,7 @@ function up1362(db) {
33747
33908
  }
33748
33909
  db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_memory_head_revisions_entry ON memory_head_revisions(agent_id, revision, entry_id)");
33749
33910
  }
33750
- function up1372(db) {
33911
+ function up1382(db) {
33751
33912
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r22) => r22.name));
33752
33913
  for (const [name, type] of [
33753
33914
  ["head_revision", "INTEGER"],
@@ -33769,7 +33930,7 @@ function addColumnIfMissing272(db, table, column, definition) {
33769
33930
  if (!hasColumn252(db, table, column))
33770
33931
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
33771
33932
  }
33772
- function up1382(db) {
33933
+ function up1392(db) {
33773
33934
  addColumnIfMissing272(db, "memories", "manual_override", "INTEGER DEFAULT 0");
33774
33935
  db.exec(`
33775
33936
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -34074,7 +34235,7 @@ function up1382(db) {
34074
34235
  GROUP BY j.agent_id;
34075
34236
  `);
34076
34237
  }
34077
- function up1392(db) {
34238
+ function up1402(db) {
34078
34239
  db.exec(`
34079
34240
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
34080
34241
  agent_id TEXT NOT NULL,
@@ -34090,7 +34251,7 @@ function up1392(db) {
34090
34251
  ON native_source_sync_state(agent_id, status);
34091
34252
  `);
34092
34253
  }
34093
- function up1402(db) {
34254
+ function up1412(db) {
34094
34255
  db.exec(`
34095
34256
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
34096
34257
  agent_id TEXT NOT NULL,
@@ -34102,7 +34263,7 @@ function up1402(db) {
34102
34263
  );
34103
34264
  `);
34104
34265
  }
34105
- function up1412(db) {
34266
+ function up1422(db) {
34106
34267
  db.exec(`
34107
34268
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
34108
34269
  agent_id TEXT NOT NULL,
@@ -34116,13 +34277,13 @@ function up1412(db) {
34116
34277
  );
34117
34278
  `);
34118
34279
  }
34119
- function up1422(db) {
34280
+ function up1432(db) {
34120
34281
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
34121
34282
  if (!columns.some((column) => column.name === "frontier")) {
34122
34283
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
34123
34284
  }
34124
34285
  }
34125
- function up1432(db) {
34286
+ function up1442(db) {
34126
34287
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34127
34288
  const additions = [
34128
34289
  ["migration_phase", "TEXT"],
@@ -34157,13 +34318,13 @@ function up1432(db) {
34157
34318
  `);
34158
34319
  }
34159
34320
  }
34160
- function up1442(db) {
34321
+ function up1452(db) {
34161
34322
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
34162
34323
  if (!columns.has("lease_token")) {
34163
34324
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
34164
34325
  }
34165
34326
  }
34166
- function up1452(db) {
34327
+ function up1462(db) {
34167
34328
  db.exec(`
34168
34329
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
34169
34330
  agent_id TEXT NOT NULL,
@@ -34181,7 +34342,7 @@ function up1452(db) {
34181
34342
  ON dreaming_evidence_reviews (agent_id, reviewed_at DESC);
34182
34343
  `);
34183
34344
  }
34184
- function up1462(db) {
34345
+ function up1472(db) {
34185
34346
  db.exec(`
34186
34347
  CREATE TABLE IF NOT EXISTS source_import_jobs (
34187
34348
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -34236,24 +34397,36 @@ function up1462(db) {
34236
34397
  CREATE INDEX IF NOT EXISTS idx_source_import_attempts_record ON source_import_record_attempts(agent_id, record_id, created_at);
34237
34398
  `);
34238
34399
  for (const column of ["source_id", "source_record_id", "source_meta_json"]) {
34239
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?").get(column);
34400
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info('session_transcripts') WHERE name = ?");
34401
+ let exists;
34402
+ try {
34403
+ exists = statement.get(column);
34404
+ } finally {
34405
+ statement.finalize?.();
34406
+ }
34240
34407
  if (exists == null)
34241
34408
  db.exec(`ALTER TABLE session_transcripts ADD COLUMN ${column} TEXT`);
34242
34409
  }
34243
34410
  db.exec("CREATE INDEX IF NOT EXISTS idx_session_transcripts_agent_source ON session_transcripts(agent_id, source_id)");
34244
34411
  }
34245
- function up1472(db) {
34412
+ function up1482(db) {
34246
34413
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
34247
34414
  }
34248
- function up1482(db) {
34415
+ function up1492(db) {
34249
34416
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
34250
34417
  if (!columns.some((column) => column.name === "source_id")) {
34251
34418
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
34252
34419
  }
34253
34420
  }
34254
- function up1492(db) {
34421
+ function up1502(db) {
34255
34422
  const addColumn = (table, column, definition) => {
34256
- const exists = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?").get(table, column);
34423
+ const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
34424
+ let exists;
34425
+ try {
34426
+ exists = statement.get(table, column);
34427
+ } finally {
34428
+ statement.finalize?.();
34429
+ }
34257
34430
  if (exists == null)
34258
34431
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34259
34432
  };
@@ -34266,7 +34439,7 @@ function addColumnIfMissing282(db, table, column, definition) {
34266
34439
  if (!columns.some((row) => row.name === column))
34267
34440
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
34268
34441
  }
34269
- function up1502(db) {
34442
+ function up1512(db) {
34270
34443
  addColumnIfMissing282(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
34271
34444
  addColumnIfMissing282(db, "dreaming_passes", "head_base_revision", "INTEGER");
34272
34445
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -34420,13 +34593,13 @@ var MIGRATIONS2 = [
34420
34593
  {
34421
34594
  version: 1,
34422
34595
  name: "baseline",
34423
- up: up151,
34596
+ up: up210,
34424
34597
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
34425
34598
  },
34426
34599
  {
34427
34600
  version: 2,
34428
34601
  name: "pipeline-v2",
34429
- up: up210,
34602
+ up: up310,
34430
34603
  artifacts: {
34431
34604
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
34432
34605
  }
@@ -34434,12 +34607,12 @@ var MIGRATIONS2 = [
34434
34607
  {
34435
34608
  version: 3,
34436
34609
  name: "unique-content-hash",
34437
- up: up310
34610
+ up: up410
34438
34611
  },
34439
34612
  {
34440
34613
  version: 4,
34441
34614
  name: "history-actor-and-retention",
34442
- up: up410,
34615
+ up: up510,
34443
34616
  artifacts: {
34444
34617
  columns: [{ table: "memory_history", column: "actor_type" }]
34445
34618
  }
@@ -34447,7 +34620,7 @@ var MIGRATIONS2 = [
34447
34620
  {
34448
34621
  version: 5,
34449
34622
  name: "graph-extended",
34450
- up: up510,
34623
+ up: up610,
34451
34624
  artifacts: {
34452
34625
  columns: [{ table: "entities", column: "canonical_name" }]
34453
34626
  }
@@ -34455,7 +34628,7 @@ var MIGRATIONS2 = [
34455
34628
  {
34456
34629
  version: 6,
34457
34630
  name: "idempotency-key",
34458
- up: up610,
34631
+ up: up710,
34459
34632
  artifacts: {
34460
34633
  columns: [{ table: "memories", column: "idempotency_key" }]
34461
34634
  }
@@ -34463,42 +34636,42 @@ var MIGRATIONS2 = [
34463
34636
  {
34464
34637
  version: 7,
34465
34638
  name: "documents-and-connectors",
34466
- up: up710,
34639
+ up: up810,
34467
34640
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
34468
34641
  },
34469
34642
  {
34470
34643
  version: 8,
34471
34644
  name: "embeddings-unique-hash",
34472
- up: up810
34645
+ up: up910
34473
34646
  },
34474
34647
  {
34475
34648
  version: 9,
34476
34649
  name: "summary-jobs",
34477
- up: up910,
34650
+ up: up1010,
34478
34651
  artifacts: { tables: ["summary_jobs"] }
34479
34652
  },
34480
34653
  {
34481
34654
  version: 10,
34482
34655
  name: "umap-cache",
34483
- up: up1010,
34656
+ up: up1110,
34484
34657
  artifacts: { tables: ["umap_cache"] }
34485
34658
  },
34486
34659
  {
34487
34660
  version: 11,
34488
34661
  name: "session-scores",
34489
- up: up1110,
34662
+ up: up1210,
34490
34663
  artifacts: { tables: ["session_scores"] }
34491
34664
  },
34492
34665
  {
34493
34666
  version: 12,
34494
34667
  name: "scheduled-tasks",
34495
- up: up1210,
34668
+ up: up1310,
34496
34669
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
34497
34670
  },
34498
34671
  {
34499
34672
  version: 13,
34500
34673
  name: "ingestion-tracking",
34501
- up: up1310,
34674
+ up: up1410,
34502
34675
  artifacts: {
34503
34676
  columns: [
34504
34677
  { table: "memories", column: "source_path" },
@@ -34509,13 +34682,13 @@ var MIGRATIONS2 = [
34509
34682
  {
34510
34683
  version: 14,
34511
34684
  name: "telemetry",
34512
- up: up1410,
34685
+ up: up153,
34513
34686
  artifacts: { tables: ["telemetry_events"] }
34514
34687
  },
34515
34688
  {
34516
34689
  version: 15,
34517
34690
  name: "session-memories",
34518
- up: up152,
34691
+ up: up162,
34519
34692
  artifacts: {
34520
34693
  tables: ["session_memories"],
34521
34694
  columns: [
@@ -34527,13 +34700,13 @@ var MIGRATIONS2 = [
34527
34700
  {
34528
34701
  version: 16,
34529
34702
  name: "session-checkpoints",
34530
- up: up162,
34703
+ up: up172,
34531
34704
  artifacts: { tables: ["session_checkpoints"] }
34532
34705
  },
34533
34706
  {
34534
34707
  version: 17,
34535
34708
  name: "task-skills",
34536
- up: up172,
34709
+ up: up182,
34537
34710
  artifacts: {
34538
34711
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
34539
34712
  }
@@ -34541,13 +34714,13 @@ var MIGRATIONS2 = [
34541
34714
  {
34542
34715
  version: 18,
34543
34716
  name: "skill-meta",
34544
- up: up182,
34717
+ up: up192,
34545
34718
  artifacts: { tables: ["skill_meta"] }
34546
34719
  },
34547
34720
  {
34548
34721
  version: 19,
34549
34722
  name: "knowledge-structure",
34550
- up: up192,
34723
+ up: up202,
34551
34724
  artifacts: {
34552
34725
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
34553
34726
  columns: [{ table: "entities", column: "agent_id" }]
@@ -34556,7 +34729,7 @@ var MIGRATIONS2 = [
34556
34729
  {
34557
34730
  version: 20,
34558
34731
  name: "session-structural-columns",
34559
- up: up202,
34732
+ up: up212,
34560
34733
  artifacts: {
34561
34734
  columns: [
34562
34735
  { table: "session_memories", column: "entity_slot" },
@@ -34569,7 +34742,7 @@ var MIGRATIONS2 = [
34569
34742
  {
34570
34743
  version: 21,
34571
34744
  name: "checkpoint-structural",
34572
- up: up212,
34745
+ up: up222,
34573
34746
  artifacts: {
34574
34747
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
34575
34748
  }
@@ -34577,7 +34750,7 @@ var MIGRATIONS2 = [
34577
34750
  {
34578
34751
  version: 22,
34579
34752
  name: "entity-pinning",
34580
- up: up222,
34753
+ up: up232,
34581
34754
  artifacts: {
34582
34755
  columns: [
34583
34756
  { table: "entities", column: "pinned" },
@@ -34588,17 +34761,17 @@ var MIGRATIONS2 = [
34588
34761
  {
34589
34762
  version: 23,
34590
34763
  name: "retired-scorer-gap",
34591
- up: up232
34764
+ up: up242
34592
34765
  },
34593
34766
  {
34594
34767
  version: 24,
34595
34768
  name: "retired-scorer-gap",
34596
- up: up242
34769
+ up: up252
34597
34770
  },
34598
34771
  {
34599
34772
  version: 25,
34600
34773
  name: "agent-feedback",
34601
- up: up252,
34774
+ up: up262,
34602
34775
  artifacts: {
34603
34776
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
34604
34777
  }
@@ -34606,32 +34779,32 @@ var MIGRATIONS2 = [
34606
34779
  {
34607
34780
  version: 26,
34608
34781
  name: "retired-scorer-gap",
34609
- up: up262
34782
+ up: up272
34610
34783
  },
34611
34784
  {
34612
34785
  version: 27,
34613
34786
  name: "backfill-canonical-names",
34614
- up: up272
34787
+ up: up282
34615
34788
  },
34616
34789
  {
34617
34790
  version: 28,
34618
34791
  name: "lossless-retention",
34619
- up: up282
34792
+ up: up292
34620
34793
  },
34621
34794
  {
34622
34795
  version: 29,
34623
34796
  name: "session-summary-dag",
34624
- up: up292
34797
+ up: up302
34625
34798
  },
34626
34799
  {
34627
34800
  version: 30,
34628
34801
  name: "nullable-memory-job-memory-id",
34629
- up: up302
34802
+ up: up312
34630
34803
  },
34631
34804
  {
34632
34805
  version: 31,
34633
34806
  name: "dependency-reason",
34634
- up: up312,
34807
+ up: up322,
34635
34808
  artifacts: {
34636
34809
  columns: [
34637
34810
  { table: "entity_dependencies", column: "reason" },
@@ -34642,7 +34815,7 @@ var MIGRATIONS2 = [
34642
34815
  {
34643
34816
  version: 32,
34644
34817
  name: "embeddings-vector-column",
34645
- up: up322,
34818
+ up: up332,
34646
34819
  artifacts: {
34647
34820
  columns: [{ table: "embeddings", column: "vector", optional: true }]
34648
34821
  }
@@ -34650,7 +34823,7 @@ var MIGRATIONS2 = [
34650
34823
  {
34651
34824
  version: 33,
34652
34825
  name: "scope",
34653
- up: up332,
34826
+ up: up342,
34654
34827
  artifacts: {
34655
34828
  columns: [{ table: "memories", column: "scope" }]
34656
34829
  }
@@ -34658,17 +34831,17 @@ var MIGRATIONS2 = [
34658
34831
  {
34659
34832
  version: 34,
34660
34833
  name: "scope-aware-dedup",
34661
- up: up342
34834
+ up: up352
34662
34835
  },
34663
34836
  {
34664
34837
  version: 35,
34665
34838
  name: "entity-fts",
34666
- up: up352
34839
+ up: up362
34667
34840
  },
34668
34841
  {
34669
34842
  version: 36,
34670
34843
  name: "dependency-confidence",
34671
- up: up362,
34844
+ up: up372,
34672
34845
  artifacts: {
34673
34846
  columns: [{ table: "entity_dependencies", column: "confidence" }]
34674
34847
  }
@@ -34676,7 +34849,7 @@ var MIGRATIONS2 = [
34676
34849
  {
34677
34850
  version: 37,
34678
34851
  name: "entity-communities",
34679
- up: up372,
34852
+ up: up382,
34680
34853
  artifacts: {
34681
34854
  tables: ["entity_communities"],
34682
34855
  columns: [{ table: "entities", column: "community_id" }]
@@ -34685,24 +34858,24 @@ var MIGRATIONS2 = [
34685
34858
  {
34686
34859
  version: 38,
34687
34860
  name: "memory-hints",
34688
- up: up382,
34861
+ up: up392,
34689
34862
  artifacts: { tables: ["memory_hints"] }
34690
34863
  },
34691
34864
  {
34692
34865
  version: 39,
34693
34866
  name: "dedup-entity-dependencies",
34694
- up: up392
34867
+ up: up402
34695
34868
  },
34696
34869
  {
34697
34870
  version: 40,
34698
34871
  name: "session-transcripts",
34699
- up: up402,
34872
+ up: up412,
34700
34873
  artifacts: { tables: ["session_transcripts"] }
34701
34874
  },
34702
34875
  {
34703
34876
  version: 41,
34704
34877
  name: "path-feedback",
34705
- up: up412,
34878
+ up: up422,
34706
34879
  artifacts: {
34707
34880
  tables: [
34708
34881
  "path_feedback_events",
@@ -34717,7 +34890,7 @@ var MIGRATIONS2 = [
34717
34890
  {
34718
34891
  version: 42,
34719
34892
  name: "session-memories-agent-id",
34720
- up: up422,
34893
+ up: up432,
34721
34894
  artifacts: {
34722
34895
  columns: [{ table: "session_memories", column: "agent_id" }]
34723
34896
  }
@@ -34725,7 +34898,7 @@ var MIGRATIONS2 = [
34725
34898
  {
34726
34899
  version: 43,
34727
34900
  name: "agents-table",
34728
- up: up432,
34901
+ up: up442,
34729
34902
  artifacts: {
34730
34903
  tables: ["agents"],
34731
34904
  columns: [
@@ -34737,7 +34910,7 @@ var MIGRATIONS2 = [
34737
34910
  {
34738
34911
  version: 44,
34739
34912
  name: "memory-md-temporal-head",
34740
- up: up442,
34913
+ up: up452,
34741
34914
  artifacts: {
34742
34915
  columns: [
34743
34916
  { table: "session_summaries", column: "source_type" },
@@ -34749,7 +34922,7 @@ var MIGRATIONS2 = [
34749
34922
  {
34750
34923
  version: 45,
34751
34924
  name: "lossless-working-memory-hardening",
34752
- up: up452,
34925
+ up: up462,
34753
34926
  artifacts: {
34754
34927
  tables: ["session_transcripts_fts", "memory_md_heads"],
34755
34928
  columns: [
@@ -34762,17 +34935,17 @@ var MIGRATIONS2 = [
34762
34935
  {
34763
34936
  version: 46,
34764
34937
  name: "session-summary-uniqueness",
34765
- up: up462
34938
+ up: up472
34766
34939
  },
34767
34940
  {
34768
34941
  version: 47,
34769
34942
  name: "agent-scoped-temporal-uniqueness",
34770
- up: up472
34943
+ up: up482
34771
34944
  },
34772
34945
  {
34773
34946
  version: 48,
34774
34947
  name: "thread-heads",
34775
- up: up482,
34948
+ up: up492,
34776
34949
  artifacts: {
34777
34950
  tables: ["memory_thread_heads"]
34778
34951
  }
@@ -34780,7 +34953,7 @@ var MIGRATIONS2 = [
34780
34953
  {
34781
34954
  version: 49,
34782
34955
  name: "session-extract-cursors",
34783
- up: up492,
34956
+ up: up502,
34784
34957
  artifacts: {
34785
34958
  tables: ["session_extract_cursors"]
34786
34959
  }
@@ -34788,7 +34961,7 @@ var MIGRATIONS2 = [
34788
34961
  {
34789
34962
  version: 50,
34790
34963
  name: "related-to-audit",
34791
- up: up502,
34964
+ up: up512,
34792
34965
  artifacts: {
34793
34966
  tables: ["entity_dependency_history"]
34794
34967
  }
@@ -34796,7 +34969,7 @@ var MIGRATIONS2 = [
34796
34969
  {
34797
34970
  version: 51,
34798
34971
  name: "memory-md-rolling-window-lineage",
34799
- up: up512,
34972
+ up: up522,
34800
34973
  artifacts: {
34801
34974
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
34802
34975
  columns: [
@@ -34811,7 +34984,7 @@ var MIGRATIONS2 = [
34811
34984
  {
34812
34985
  version: 52,
34813
34986
  name: "mcp-invocations",
34814
- up: up522,
34987
+ up: up532,
34815
34988
  artifacts: {
34816
34989
  tables: ["mcp_invocations"]
34817
34990
  }
@@ -34819,7 +34992,7 @@ var MIGRATIONS2 = [
34819
34992
  {
34820
34993
  version: 53,
34821
34994
  name: "skill-invocations",
34822
- up: up532,
34995
+ up: up542,
34823
34996
  artifacts: {
34824
34997
  tables: ["skill_invocations"]
34825
34998
  }
@@ -34827,7 +35000,7 @@ var MIGRATIONS2 = [
34827
35000
  {
34828
35001
  version: 54,
34829
35002
  name: "task-agent-scope",
34830
- up: up542,
35003
+ up: up552,
34831
35004
  artifacts: {
34832
35005
  tables: ["task_scope_hints"]
34833
35006
  }
@@ -34835,7 +35008,7 @@ var MIGRATIONS2 = [
34835
35008
  {
34836
35009
  version: 55,
34837
35010
  name: "dreaming-state",
34838
- up: up552,
35011
+ up: up562,
34839
35012
  artifacts: {
34840
35013
  tables: ["dreaming_state", "dreaming_passes"]
34841
35014
  }
@@ -34843,22 +35016,22 @@ var MIGRATIONS2 = [
34843
35016
  {
34844
35017
  version: 56,
34845
35018
  name: "agent-scoped-content-hash",
34846
- up: up562
35019
+ up: up572
34847
35020
  },
34848
35021
  {
34849
35022
  version: 57,
34850
35023
  name: "memories-fts-tokenizer-repair",
34851
- up: up572
35024
+ up: up582
34852
35025
  },
34853
35026
  {
34854
35027
  version: 58,
34855
35028
  name: "knowledge-graph-indices",
34856
- up: up582
35029
+ up: up592
34857
35030
  },
34858
35031
  {
34859
35032
  version: 59,
34860
35033
  name: "entity-attribute-claim-key",
34861
- up: up592,
35034
+ up: up602,
34862
35035
  artifacts: {
34863
35036
  columns: [{ table: "entity_attributes", column: "claim_key" }]
34864
35037
  }
@@ -34866,7 +35039,7 @@ var MIGRATIONS2 = [
34866
35039
  {
34867
35040
  version: 60,
34868
35041
  name: "entity-attribute-group-key",
34869
- up: up602,
35042
+ up: up612,
34870
35043
  artifacts: {
34871
35044
  columns: [{ table: "entity_attributes", column: "group_key" }]
34872
35045
  }
@@ -34874,7 +35047,7 @@ var MIGRATIONS2 = [
34874
35047
  {
34875
35048
  version: 61,
34876
35049
  name: "memory-artifact-source-mtime",
34877
- up: up612,
35050
+ up: up622,
34878
35051
  artifacts: {
34879
35052
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
34880
35053
  }
@@ -34882,7 +35055,7 @@ var MIGRATIONS2 = [
34882
35055
  {
34883
35056
  version: 62,
34884
35057
  name: "memory-artifact-soft-delete",
34885
- up: up622,
35058
+ up: up632,
34886
35059
  artifacts: {
34887
35060
  columns: [
34888
35061
  { table: "memory_artifacts", column: "is_deleted" },
@@ -34893,12 +35066,12 @@ var MIGRATIONS2 = [
34893
35066
  {
34894
35067
  version: 63,
34895
35068
  name: "content-only-memories-fts-update",
34896
- up: up632
35069
+ up: up642
34897
35070
  },
34898
35071
  {
34899
35072
  version: 64,
34900
35073
  name: "source-graph-provenance",
34901
- up: up642,
35074
+ up: up652,
34902
35075
  artifacts: {
34903
35076
  columns: [
34904
35077
  { table: "entities", column: "source_path" },
@@ -34911,7 +35084,7 @@ var MIGRATIONS2 = [
34911
35084
  {
34912
35085
  version: 65,
34913
35086
  name: "source-embedding-agent-scope",
34914
- up: up652,
35087
+ up: up662,
34915
35088
  artifacts: {
34916
35089
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
34917
35090
  }
@@ -34919,7 +35092,7 @@ var MIGRATIONS2 = [
34919
35092
  {
34920
35093
  version: 66,
34921
35094
  name: "memory-search-telemetry",
34922
- up: up662,
35095
+ up: up672,
34923
35096
  artifacts: {
34924
35097
  tables: ["memory_search_telemetry"]
34925
35098
  }
@@ -34927,7 +35100,7 @@ var MIGRATIONS2 = [
34927
35100
  {
34928
35101
  version: 67,
34929
35102
  name: "ontology-proposals",
34930
- up: up672,
35103
+ up: up682,
34931
35104
  artifacts: {
34932
35105
  tables: ["ontology_proposals"],
34933
35106
  columns: [
@@ -34941,7 +35114,7 @@ var MIGRATIONS2 = [
34941
35114
  {
34942
35115
  version: 68,
34943
35116
  name: "daily-reflections",
34944
- up: up682,
35117
+ up: up692,
34945
35118
  artifacts: {
34946
35119
  tables: ["daily_reflections"]
34947
35120
  }
@@ -34949,7 +35122,7 @@ var MIGRATIONS2 = [
34949
35122
  {
34950
35123
  version: 69,
34951
35124
  name: "daily-reflections-multiple-insights",
34952
- up: up692,
35125
+ up: up702,
34953
35126
  artifacts: {
34954
35127
  tables: ["daily_reflections"]
34955
35128
  }
@@ -34957,7 +35130,7 @@ var MIGRATIONS2 = [
34957
35130
  {
34958
35131
  version: 70,
34959
35132
  name: "ontology-control-plane-state",
34960
- up: up702,
35133
+ up: up712,
34961
35134
  artifacts: {
34962
35135
  columns: [
34963
35136
  { table: "entities", column: "status" },
@@ -34972,7 +35145,7 @@ var MIGRATIONS2 = [
34972
35145
  {
34973
35146
  version: 71,
34974
35147
  name: "epistemic-assertions",
34975
- up: up712,
35148
+ up: up722,
34976
35149
  artifacts: {
34977
35150
  tables: ["epistemic_assertions"]
34978
35151
  }
@@ -34980,7 +35153,7 @@ var MIGRATIONS2 = [
34980
35153
  {
34981
35154
  version: 72,
34982
35155
  name: "agent-scoped-idempotency-key",
34983
- up: up722,
35156
+ up: up732,
34984
35157
  artifacts: {
34985
35158
  columns: [
34986
35159
  { table: "memories", column: "idempotency_key" },
@@ -34991,7 +35164,7 @@ var MIGRATIONS2 = [
34991
35164
  {
34992
35165
  version: 73,
34993
35166
  name: "recall-context-dedupe",
34994
- up: up732,
35167
+ up: up742,
34995
35168
  artifacts: {
34996
35169
  tables: ["session_context_epochs", "session_recall_events"]
34997
35170
  }
@@ -34999,7 +35172,7 @@ var MIGRATIONS2 = [
34999
35172
  {
35000
35173
  version: 74,
35001
35174
  name: "aggregate-memory-links",
35002
- up: up742,
35175
+ up: up752,
35003
35176
  artifacts: {
35004
35177
  tables: ["aggregate_memory_sources"]
35005
35178
  }
@@ -35007,7 +35180,7 @@ var MIGRATIONS2 = [
35007
35180
  {
35008
35181
  version: 75,
35009
35182
  name: "memory-artifact-source-provenance",
35010
- up: up752,
35183
+ up: up762,
35011
35184
  artifacts: {
35012
35185
  columns: [
35013
35186
  { table: "memory_artifacts", column: "source_id" },
@@ -35021,7 +35194,7 @@ var MIGRATIONS2 = [
35021
35194
  {
35022
35195
  version: 76,
35023
35196
  name: "temporal-edges",
35024
- up: up762,
35197
+ up: up772,
35025
35198
  artifacts: {
35026
35199
  tables: ["temporal_edges"]
35027
35200
  }
@@ -35029,7 +35202,7 @@ var MIGRATIONS2 = [
35029
35202
  {
35030
35203
  version: 77,
35031
35204
  name: "entity-aliases",
35032
- up: up772,
35205
+ up: up782,
35033
35206
  artifacts: {
35034
35207
  tables: ["entity_aliases"]
35035
35208
  }
@@ -35037,7 +35210,7 @@ var MIGRATIONS2 = [
35037
35210
  {
35038
35211
  version: 78,
35039
35212
  name: "api-keys",
35040
- up: up782,
35213
+ up: up792,
35041
35214
  artifacts: {
35042
35215
  tables: ["api_keys"]
35043
35216
  }
@@ -35045,7 +35218,7 @@ var MIGRATIONS2 = [
35045
35218
  {
35046
35219
  version: 79,
35047
35220
  name: "transcript-capture-jobs",
35048
- up: up792,
35221
+ up: up802,
35049
35222
  artifacts: {
35050
35223
  tables: ["transcript_capture_jobs"]
35051
35224
  }
@@ -35053,7 +35226,7 @@ var MIGRATIONS2 = [
35053
35226
  {
35054
35227
  version: 80,
35055
35228
  name: "document-scope-columns",
35056
- up: up802,
35229
+ up: up812,
35057
35230
  artifacts: {
35058
35231
  columns: [
35059
35232
  { table: "documents", column: "agent_id" },
@@ -35064,7 +35237,7 @@ var MIGRATIONS2 = [
35064
35237
  {
35065
35238
  version: 81,
35066
35239
  name: "aggregate-evidence-sources",
35067
- up: up812,
35240
+ up: up822,
35068
35241
  artifacts: {
35069
35242
  tables: ["aggregate_evidence_sources"]
35070
35243
  }
@@ -35072,7 +35245,7 @@ var MIGRATIONS2 = [
35072
35245
  {
35073
35246
  version: 82,
35074
35247
  name: "skill-invocations-harness",
35075
- up: up822,
35248
+ up: up832,
35076
35249
  artifacts: {
35077
35250
  columns: [
35078
35251
  { table: "skill_invocations", column: "harness" },
@@ -35083,7 +35256,7 @@ var MIGRATIONS2 = [
35083
35256
  {
35084
35257
  version: 83,
35085
35258
  name: "memory-lifecycle-repair",
35086
- up: up832,
35259
+ up: up842,
35087
35260
  artifacts: {
35088
35261
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
35089
35262
  columns: [
@@ -35098,7 +35271,7 @@ var MIGRATIONS2 = [
35098
35271
  {
35099
35272
  version: 84,
35100
35273
  name: "legacy-markdown-import-state",
35101
- up: up842,
35274
+ up: up852,
35102
35275
  artifacts: {
35103
35276
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
35104
35277
  }
@@ -35106,7 +35279,7 @@ var MIGRATIONS2 = [
35106
35279
  {
35107
35280
  version: 85,
35108
35281
  name: "backfill-relations-to-dependencies",
35109
- up: up852,
35282
+ up: up862,
35110
35283
  artifacts: {
35111
35284
  tables: ["entity_dependencies"]
35112
35285
  }
@@ -35114,7 +35287,7 @@ var MIGRATIONS2 = [
35114
35287
  {
35115
35288
  version: 86,
35116
35289
  name: "summary-jobs-content-hash",
35117
- up: up862,
35290
+ up: up872,
35118
35291
  artifacts: {
35119
35292
  columns: [{ table: "summary_jobs", column: "content_hash" }]
35120
35293
  }
@@ -35122,7 +35295,7 @@ var MIGRATIONS2 = [
35122
35295
  {
35123
35296
  version: 87,
35124
35297
  name: "summary-jobs-boundary-reason",
35125
- up: up872,
35298
+ up: up882,
35126
35299
  artifacts: {
35127
35300
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
35128
35301
  }
@@ -35130,7 +35303,7 @@ var MIGRATIONS2 = [
35130
35303
  {
35131
35304
  version: 88,
35132
35305
  name: "transcript-recovery-files",
35133
- up: up882,
35306
+ up: up892,
35134
35307
  artifacts: {
35135
35308
  tables: ["transcript_recovery_files"]
35136
35309
  }
@@ -35138,7 +35311,7 @@ var MIGRATIONS2 = [
35138
35311
  {
35139
35312
  version: 89,
35140
35313
  name: "job-cancellations",
35141
- up: up892,
35314
+ up: up902,
35142
35315
  artifacts: {
35143
35316
  tables: ["job_cancellations"]
35144
35317
  }
@@ -35146,7 +35319,7 @@ var MIGRATIONS2 = [
35146
35319
  {
35147
35320
  version: 90,
35148
35321
  name: "job-archive",
35149
- up: up902,
35322
+ up: up912,
35150
35323
  artifacts: {
35151
35324
  tables: ["job_archive"]
35152
35325
  }
@@ -35154,25 +35327,25 @@ var MIGRATIONS2 = [
35154
35327
  {
35155
35328
  version: 91,
35156
35329
  name: "embedding-index-generations",
35157
- up: up912,
35330
+ up: up922,
35158
35331
  artifacts: { tables: ["embedding_index_state"] }
35159
35332
  },
35160
35333
  {
35161
35334
  version: 92,
35162
35335
  name: "embedding-staging-store",
35163
- up: up922,
35336
+ up: up932,
35164
35337
  artifacts: { tables: ["embeddings_staging"] }
35165
35338
  },
35166
35339
  {
35167
35340
  version: 93,
35168
35341
  name: "dreaming-evidence-cursor",
35169
- up: up932,
35342
+ up: up942,
35170
35343
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
35171
35344
  },
35172
35345
  {
35173
35346
  version: 94,
35174
35347
  name: "memory-kind",
35175
- up: up942,
35348
+ up: up952,
35176
35349
  artifacts: {
35177
35350
  columns: [
35178
35351
  { table: "memories", column: "memory_kind" },
@@ -35183,35 +35356,35 @@ var MIGRATIONS2 = [
35183
35356
  {
35184
35357
  version: 95,
35185
35358
  name: "compaction-recall-projections",
35186
- up: up952
35359
+ up: up962
35187
35360
  },
35188
35361
  {
35189
35362
  version: 96,
35190
35363
  name: "retire-legacy-ingestion",
35191
- up: up962
35364
+ up: up972
35192
35365
  },
35193
35366
  {
35194
35367
  version: 97,
35195
35368
  name: "dreaming-failure-backoff",
35196
- up: up972,
35369
+ up: up982,
35197
35370
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
35198
35371
  },
35199
35372
  {
35200
35373
  version: 98,
35201
35374
  name: "dreaming-evidence-exclusions",
35202
- up: up982,
35375
+ up: up992,
35203
35376
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
35204
35377
  },
35205
35378
  {
35206
35379
  version: 99,
35207
35380
  name: "dreaming-tool-calls",
35208
- up: up992,
35381
+ up: up1002,
35209
35382
  artifacts: { tables: ["dreaming_tool_calls"] }
35210
35383
  },
35211
35384
  {
35212
35385
  version: 100,
35213
35386
  name: "dreaming-runbook",
35214
- up: up1002,
35387
+ up: up1012,
35215
35388
  artifacts: {
35216
35389
  columns: [
35217
35390
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -35222,23 +35395,23 @@ var MIGRATIONS2 = [
35222
35395
  {
35223
35396
  version: 101,
35224
35397
  name: "dreaming-attention",
35225
- up: up1012,
35398
+ up: up1022,
35226
35399
  artifacts: { tables: ["dreaming_attention"] }
35227
35400
  },
35228
35401
  {
35229
35402
  version: 102,
35230
35403
  name: "attribute-semantic-memories",
35231
- up: up1022
35404
+ up: up1032
35232
35405
  },
35233
35406
  {
35234
35407
  version: 103,
35235
35408
  name: "semantic-memory-kind",
35236
- up: up1032
35409
+ up: up1042
35237
35410
  },
35238
35411
  {
35239
35412
  version: 104,
35240
35413
  name: "derived-memory-provenance",
35241
- up: up1042,
35414
+ up: up1052,
35242
35415
  artifacts: {
35243
35416
  tables: ["derived_memory_sources"],
35244
35417
  columns: [{ table: "memories", column: "stale_at" }]
@@ -35247,12 +35420,12 @@ var MIGRATIONS2 = [
35247
35420
  {
35248
35421
  version: 105,
35249
35422
  name: "agent-scoped-entity-name",
35250
- up: up1052
35423
+ up: up1062
35251
35424
  },
35252
35425
  {
35253
35426
  version: 106,
35254
35427
  name: "memory-review-after",
35255
- up: up1062,
35428
+ up: up1072,
35256
35429
  artifacts: {
35257
35430
  columns: [{ table: "memories", column: "review_after" }]
35258
35431
  }
@@ -35260,7 +35433,7 @@ var MIGRATIONS2 = [
35260
35433
  {
35261
35434
  version: 107,
35262
35435
  name: "dreaming-pass-usage",
35263
- up: up1072,
35436
+ up: up1082,
35264
35437
  artifacts: {
35265
35438
  columns: [
35266
35439
  { table: "dreaming_passes", column: "tokens_input" },
@@ -35274,7 +35447,7 @@ var MIGRATIONS2 = [
35274
35447
  {
35275
35448
  version: 108,
35276
35449
  name: "embedding-usage",
35277
- up: up1082,
35450
+ up: up1092,
35278
35451
  artifacts: {
35279
35452
  tables: ["embedding_usage"]
35280
35453
  }
@@ -35282,7 +35455,7 @@ var MIGRATIONS2 = [
35282
35455
  {
35283
35456
  version: 109,
35284
35457
  name: "telemetry-install",
35285
- up: up1092,
35458
+ up: up1102,
35286
35459
  artifacts: {
35287
35460
  tables: ["telemetry_install"]
35288
35461
  }
@@ -35290,12 +35463,12 @@ var MIGRATIONS2 = [
35290
35463
  {
35291
35464
  version: 110,
35292
35465
  name: "memory-mention-join-index",
35293
- up: up1102
35466
+ up: up1112
35294
35467
  },
35295
35468
  {
35296
35469
  version: 111,
35297
35470
  name: "telemetry-first-use",
35298
- up: up1112,
35471
+ up: up1122,
35299
35472
  artifacts: {
35300
35473
  columns: [
35301
35474
  { table: "telemetry_install", column: "first_remember_at" },
@@ -35306,7 +35479,7 @@ var MIGRATIONS2 = [
35306
35479
  {
35307
35480
  version: 112,
35308
35481
  name: "telemetry-queue-ownership",
35309
- up: up1122,
35482
+ up: up1132,
35310
35483
  artifacts: {
35311
35484
  columns: [
35312
35485
  { table: "telemetry_events", column: "source" },
@@ -35318,7 +35491,7 @@ var MIGRATIONS2 = [
35318
35491
  {
35319
35492
  version: 113,
35320
35493
  name: "session-claims",
35321
- up: up1132,
35494
+ up: up1142,
35322
35495
  artifacts: {
35323
35496
  tables: ["session_claims"],
35324
35497
  columns: [
@@ -35332,12 +35505,12 @@ var MIGRATIONS2 = [
35332
35505
  {
35333
35506
  version: 114,
35334
35507
  name: "memory-traversal-hydration-index",
35335
- up: up1142
35508
+ up: up1152
35336
35509
  },
35337
35510
  {
35338
35511
  version: 115,
35339
35512
  name: "cross-agent-message-notifications",
35340
- up: up1152,
35513
+ up: up1162,
35341
35514
  artifacts: {
35342
35515
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
35343
35516
  }
@@ -35345,7 +35518,7 @@ var MIGRATIONS2 = [
35345
35518
  {
35346
35519
  version: 116,
35347
35520
  name: "acp-delivery-reconciliation",
35348
- up: up1162,
35521
+ up: up1172,
35349
35522
  artifacts: {
35350
35523
  columns: [
35351
35524
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -35359,7 +35532,7 @@ var MIGRATIONS2 = [
35359
35532
  {
35360
35533
  version: 117,
35361
35534
  name: "retire-summary-worker",
35362
- up: up1172,
35535
+ up: up1182,
35363
35536
  artifacts: {
35364
35537
  columns: [
35365
35538
  { table: "session_transcripts", column: "completed_at" },
@@ -35370,24 +35543,24 @@ var MIGRATIONS2 = [
35370
35543
  {
35371
35544
  version: 118,
35372
35545
  name: "queue-pressure-indices",
35373
- up: up1182
35546
+ up: up1192
35374
35547
  },
35375
35548
  {
35376
35549
  version: 119,
35377
35550
  name: "telemetry-version-observation",
35378
- up: up1192,
35551
+ up: up1202,
35379
35552
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
35380
35553
  },
35381
35554
  {
35382
35555
  version: 120,
35383
35556
  name: "source-lifecycle-telemetry",
35384
- up: up1202,
35557
+ up: up1212,
35385
35558
  artifacts: { tables: ["source_lifecycle_state"] }
35386
35559
  },
35387
35560
  {
35388
35561
  version: 121,
35389
35562
  name: "telemetry-delivery-health",
35390
- up: up1212,
35563
+ up: up1222,
35391
35564
  artifacts: {
35392
35565
  tables: ["telemetry_delivery_state"],
35393
35566
  columns: [
@@ -35401,7 +35574,7 @@ var MIGRATIONS2 = [
35401
35574
  {
35402
35575
  version: 122,
35403
35576
  name: "dreaming-evidence-retry",
35404
- up: up1222,
35577
+ up: up1232,
35405
35578
  artifacts: {
35406
35579
  columns: [
35407
35580
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -35414,13 +35587,13 @@ var MIGRATIONS2 = [
35414
35587
  {
35415
35588
  version: 123,
35416
35589
  name: "embedding-index-failures",
35417
- up: up1232,
35590
+ up: up1242,
35418
35591
  artifacts: { tables: ["embedding_index_failures"] }
35419
35592
  },
35420
35593
  {
35421
35594
  version: 124,
35422
35595
  name: "import-derived-lifecycle",
35423
- up: up1242,
35596
+ up: up1252,
35424
35597
  artifacts: {
35425
35598
  tables: ["imported_source_lifecycle"]
35426
35599
  }
@@ -35428,77 +35601,77 @@ var MIGRATIONS2 = [
35428
35601
  {
35429
35602
  version: 125,
35430
35603
  name: "memory-content-safety",
35431
- up: up1252,
35604
+ up: up1262,
35432
35605
  artifacts: { tables: ["memory_content_safety"] }
35433
35606
  },
35434
35607
  {
35435
35608
  version: 126,
35436
35609
  name: "dreaming-surprisal-attention",
35437
- up: up1262,
35610
+ up: up1272,
35438
35611
  artifacts: { tables: ["dreaming_attention"] }
35439
35612
  },
35440
35613
  {
35441
35614
  version: 127,
35442
35615
  name: "ontology-contradictions",
35443
- up: up1272,
35616
+ up: up1282,
35444
35617
  artifacts: { tables: ["ontology_contradictions"] }
35445
35618
  },
35446
35619
  {
35447
35620
  version: 128,
35448
35621
  name: "bounded-queue-diagnostics",
35449
- up: up1282
35622
+ up: up1292
35450
35623
  },
35451
35624
  {
35452
35625
  version: 129,
35453
35626
  name: "retire-structural-jobs",
35454
- up: up1292
35627
+ up: up1302
35455
35628
  },
35456
35629
  {
35457
35630
  version: 130,
35458
35631
  name: "embedding-repair-state",
35459
- up: up1302,
35632
+ up: up1312,
35460
35633
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
35461
35634
  },
35462
35635
  {
35463
35636
  version: 131,
35464
35637
  name: "dreaming-evidence-consumption",
35465
- up: up1312,
35638
+ up: up1322,
35466
35639
  artifacts: { tables: ["dreaming_evidence_consumption"] }
35467
35640
  },
35468
35641
  {
35469
35642
  version: 132,
35470
35643
  name: "observer-scoped-epistemic-assertions",
35471
- up: up1322,
35644
+ up: up1332,
35472
35645
  artifacts: { tables: ["epistemic_assertions"] }
35473
35646
  },
35474
35647
  {
35475
35648
  version: 133,
35476
35649
  name: "dreaming-memory-head",
35477
- up: up1332,
35650
+ up: up1342,
35478
35651
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
35479
35652
  },
35480
35653
  {
35481
35654
  version: 134,
35482
35655
  name: "scope-memory-head-entries",
35483
- up: up1342,
35656
+ up: up1352,
35484
35657
  artifacts: { tables: ["memory_head_entries"] }
35485
35658
  },
35486
35659
  {
35487
35660
  version: 135,
35488
35661
  name: "memory-head-publication",
35489
- up: up1352,
35662
+ up: up1362,
35490
35663
  artifacts: { tables: ["memory_head_publications"] }
35491
35664
  },
35492
35665
  {
35493
35666
  version: 136,
35494
35667
  name: "memory-head-revisions",
35495
- up: up1362,
35668
+ up: up1372,
35496
35669
  artifacts: { tables: ["memory_head_revisions"] }
35497
35670
  },
35498
35671
  {
35499
35672
  version: 137,
35500
35673
  name: "dreaming-head-manifest",
35501
- up: up1372,
35674
+ up: up1382,
35502
35675
  artifacts: {
35503
35676
  columns: [
35504
35677
  { table: "dreaming_passes", column: "head_revision" },
@@ -35509,7 +35682,7 @@ var MIGRATIONS2 = [
35509
35682
  {
35510
35683
  version: 138,
35511
35684
  name: "bounded-status-projections",
35512
- up: up1382,
35685
+ up: up1392,
35513
35686
  artifacts: {
35514
35687
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
35515
35688
  }
@@ -35517,31 +35690,31 @@ var MIGRATIONS2 = [
35517
35690
  {
35518
35691
  version: 139,
35519
35692
  name: "native-source-sync-state",
35520
- up: up1392,
35693
+ up: up1402,
35521
35694
  artifacts: { tables: ["native_source_sync_state"] }
35522
35695
  },
35523
35696
  {
35524
35697
  version: 140,
35525
35698
  name: "transcript-recovery-frontier",
35526
- up: up1402,
35699
+ up: up1412,
35527
35700
  artifacts: { tables: ["transcript_recovery_frontiers"] }
35528
35701
  },
35529
35702
  {
35530
35703
  version: 141,
35531
35704
  name: "source-sync-checkpoints",
35532
- up: up1412,
35705
+ up: up1422,
35533
35706
  artifacts: { tables: ["source_sync_checkpoints"] }
35534
35707
  },
35535
35708
  {
35536
35709
  version: 142,
35537
35710
  name: "source-sync-frontier",
35538
- up: up1422,
35711
+ up: up1432,
35539
35712
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
35540
35713
  },
35541
35714
  {
35542
35715
  version: 143,
35543
35716
  name: "embedding-index-progress",
35544
- up: up1432,
35717
+ up: up1442,
35545
35718
  artifacts: {
35546
35719
  columns: [
35547
35720
  { table: "embedding_index_state", column: "migration_phase" },
@@ -35557,19 +35730,19 @@ var MIGRATIONS2 = [
35557
35730
  {
35558
35731
  version: 144,
35559
35732
  name: "memory-job-lease-token",
35560
- up: up1442,
35733
+ up: up1452,
35561
35734
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
35562
35735
  },
35563
35736
  {
35564
35737
  version: 145,
35565
35738
  name: "dreaming-evidence-reviews",
35566
- up: up1452,
35739
+ up: up1462,
35567
35740
  artifacts: { tables: ["dreaming_evidence_reviews"] }
35568
35741
  },
35569
35742
  {
35570
35743
  version: 146,
35571
35744
  name: "source-transcript-import",
35572
- up: up1462,
35745
+ up: up1472,
35573
35746
  artifacts: {
35574
35747
  tables: [
35575
35748
  "source_import_jobs",
@@ -35588,19 +35761,19 @@ var MIGRATIONS2 = [
35588
35761
  {
35589
35762
  version: 147,
35590
35763
  name: "source-import-replay-file-slots",
35591
- up: up1472,
35764
+ up: up1482,
35592
35765
  artifacts: { tables: ["source_import_files"] }
35593
35766
  },
35594
35767
  {
35595
35768
  version: 148,
35596
35769
  name: "source-import-attempt-provenance",
35597
- up: up1482,
35770
+ up: up1492,
35598
35771
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
35599
35772
  },
35600
35773
  {
35601
35774
  version: 149,
35602
35775
  name: "transcript-import-state-machine",
35603
- up: up1492,
35776
+ up: up1502,
35604
35777
  artifacts: {
35605
35778
  columns: [
35606
35779
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -35612,13 +35785,42 @@ var MIGRATIONS2 = [
35612
35785
  {
35613
35786
  version: 150,
35614
35787
  name: "memory-head-freshness",
35615
- up: up1502,
35788
+ up: up1512,
35616
35789
  artifacts: {
35617
35790
  columns: [
35618
35791
  { table: "memory_md_heads", column: "is_current" },
35619
35792
  { table: "dreaming_passes", column: "head_base_revision" }
35620
35793
  ]
35621
35794
  }
35795
+ },
35796
+ {
35797
+ version: 151,
35798
+ name: "transcript-import-bytes",
35799
+ up: up152,
35800
+ artifacts: {
35801
+ tables: [
35802
+ "source_import_chunks",
35803
+ "source_import_capacity",
35804
+ "source_import_migrations",
35805
+ "source_import_migration_streams",
35806
+ "source_import_migration_counts"
35807
+ ],
35808
+ columns: [
35809
+ { table: "source_import_files", column: "storage_state" },
35810
+ { table: "source_import_files", column: "upload_generation" },
35811
+ { table: "source_import_files", column: "upload_offset" },
35812
+ { table: "source_import_files", column: "upload_size" },
35813
+ { table: "source_import_files", column: "upload_digest" },
35814
+ ...["checkpoint_line_number", "reserved_bytes", "original_path"].map((column) => ({
35815
+ table: "source_import_files",
35816
+ column
35817
+ })),
35818
+ ...["retry_count", "cleanup_state", "retry_cursor", "retry_requested"].map((column) => ({
35819
+ table: "source_import_jobs",
35820
+ column
35821
+ }))
35822
+ ]
35823
+ }
35622
35824
  }
35623
35825
  ];
35624
35826
  var LATEST_SCHEMA_VERSION2 = MIGRATIONS2[MIGRATIONS2.length - 1]?.version ?? 0;