@signetai/core 0.226.25 → 0.227.1

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.
package/dist/index.js CHANGED
@@ -11250,6 +11250,11 @@ function up4(db) {
11250
11250
  `);
11251
11251
  }
11252
11252
 
11253
+ // src/migrations/159-retire-obsolete-invocation-ledger.ts
11254
+ function up5(db) {
11255
+ db.exec("DROP TABLE IF EXISTS mcp_invocations");
11256
+ }
11257
+
11253
11258
  // src/fts-schema.ts
11254
11259
  var MEMORIES_FTS_TOKENIZER = "unicode61";
11255
11260
  var FTS_STATE_TABLE = "memories_fts_state";
@@ -11417,7 +11422,7 @@ function memoriesFtsNeedsTokenizerRepair(sql) {
11417
11422
  }
11418
11423
 
11419
11424
  // src/migrations/001-baseline.ts
11420
- function up5(db) {
11425
+ function up6(db) {
11421
11426
  db.exec(`
11422
11427
  CREATE TABLE IF NOT EXISTS schema_migrations (
11423
11428
  version INTEGER PRIMARY KEY,
@@ -11517,7 +11522,7 @@ function addColumnIfMissing2(db, table, column, definition) {
11517
11522
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11518
11523
  }
11519
11524
  }
11520
- function up6(db) {
11525
+ function up7(db) {
11521
11526
  addColumnIfMissing2(db, "memories", "content_hash", "TEXT");
11522
11527
  addColumnIfMissing2(db, "memories", "normalized_content", "TEXT");
11523
11528
  addColumnIfMissing2(db, "memories", "is_deleted", "INTEGER DEFAULT 0");
@@ -11637,7 +11642,7 @@ function addColumnIfMissing3(db, table, column, definition) {
11637
11642
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11638
11643
  return true;
11639
11644
  }
11640
- function up7(db) {
11645
+ function up8(db) {
11641
11646
  addColumnIfMissing3(db, "memories", "why", "TEXT");
11642
11647
  addColumnIfMissing3(db, "memories", "project", "TEXT");
11643
11648
  db.exec(`DROP INDEX IF EXISTS idx_memories_content_hash`);
@@ -11676,7 +11681,7 @@ function addColumnIfMissing4(db, table, column, definition) {
11676
11681
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11677
11682
  }
11678
11683
  }
11679
- function up8(db) {
11684
+ function up9(db) {
11680
11685
  addColumnIfMissing4(db, "memory_history", "actor_type", "TEXT");
11681
11686
  addColumnIfMissing4(db, "memory_history", "session_id", "TEXT");
11682
11687
  addColumnIfMissing4(db, "memory_history", "request_id", "TEXT");
@@ -11711,7 +11716,7 @@ function addColumnIfMissing5(db, table, column, definition) {
11711
11716
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11712
11717
  }
11713
11718
  }
11714
- function up9(db) {
11719
+ function up10(db) {
11715
11720
  addColumnIfMissing5(db, "entities", "canonical_name", "TEXT");
11716
11721
  addColumnIfMissing5(db, "entities", "mentions", "INTEGER DEFAULT 0");
11717
11722
  addColumnIfMissing5(db, "entities", "embedding", "BLOB");
@@ -11730,7 +11735,7 @@ function hasColumn4(db, table, column) {
11730
11735
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11731
11736
  return rows.some((r) => r.name === column);
11732
11737
  }
11733
- function up10(db) {
11738
+ function up11(db) {
11734
11739
  if (!hasColumn4(db, "memories", "idempotency_key")) {
11735
11740
  db.exec("ALTER TABLE memories ADD COLUMN idempotency_key TEXT");
11736
11741
  }
@@ -11747,7 +11752,7 @@ function hasColumn5(db, table, column) {
11747
11752
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
11748
11753
  return rows.some((r) => r.name === column);
11749
11754
  }
11750
- function up11(db) {
11755
+ function up12(db) {
11751
11756
  db.exec(`
11752
11757
  CREATE TABLE IF NOT EXISTS documents (
11753
11758
  id TEXT PRIMARY KEY,
@@ -11806,7 +11811,7 @@ function up11(db) {
11806
11811
  }
11807
11812
 
11808
11813
  // src/migrations/008-embeddings-unique-hash.ts
11809
- function up12(db) {
11814
+ function up13(db) {
11810
11815
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
11811
11816
  if (tables.length === 0)
11812
11817
  return;
@@ -11825,7 +11830,7 @@ function up12(db) {
11825
11830
  }
11826
11831
 
11827
11832
  // src/migrations/009-summary-jobs.ts
11828
- function up13(db) {
11833
+ function up14(db) {
11829
11834
  db.exec(`
11830
11835
  CREATE TABLE IF NOT EXISTS summary_jobs (
11831
11836
  id TEXT PRIMARY KEY,
@@ -11847,7 +11852,7 @@ function up13(db) {
11847
11852
  }
11848
11853
 
11849
11854
  // src/migrations/010-umap-cache.ts
11850
- function up14(db) {
11855
+ function up15(db) {
11851
11856
  db.exec(`
11852
11857
  CREATE TABLE IF NOT EXISTS umap_cache (
11853
11858
  id INTEGER PRIMARY KEY,
@@ -11860,7 +11865,7 @@ function up14(db) {
11860
11865
  }
11861
11866
 
11862
11867
  // src/migrations/011-session-scores.ts
11863
- function up15(db) {
11868
+ function up16(db) {
11864
11869
  db.exec(`
11865
11870
  CREATE TABLE IF NOT EXISTS session_scores (
11866
11871
  id TEXT PRIMARY KEY,
@@ -11882,7 +11887,7 @@ function up15(db) {
11882
11887
  }
11883
11888
 
11884
11889
  // src/migrations/012-scheduled-tasks.ts
11885
- function up16(db) {
11890
+ function up17(db) {
11886
11891
  db.exec(`
11887
11892
  CREATE TABLE IF NOT EXISTS scheduled_tasks (
11888
11893
  id TEXT PRIMARY KEY,
@@ -11925,7 +11930,7 @@ function addColumnIfMissing6(db, table, column, definition) {
11925
11930
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11926
11931
  }
11927
11932
  }
11928
- function up17(db) {
11933
+ function up18(db) {
11929
11934
  db.exec(`
11930
11935
  CREATE TABLE IF NOT EXISTS ingestion_jobs (
11931
11936
  id TEXT PRIMARY KEY,
@@ -11953,7 +11958,7 @@ function up17(db) {
11953
11958
  }
11954
11959
 
11955
11960
  // src/migrations/014-telemetry.ts
11956
- function up18(db) {
11961
+ function up19(db) {
11957
11962
  db.exec(`
11958
11963
  CREATE TABLE IF NOT EXISTS telemetry_events (
11959
11964
  id TEXT PRIMARY KEY,
@@ -11980,7 +11985,7 @@ function addColumnIfMissing7(db, table, column, definition) {
11980
11985
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
11981
11986
  }
11982
11987
  }
11983
- function up19(db) {
11988
+ function up20(db) {
11984
11989
  db.exec(`
11985
11990
  CREATE TABLE IF NOT EXISTS session_memories (
11986
11991
  id TEXT PRIMARY KEY,
@@ -12009,7 +12014,7 @@ function up19(db) {
12009
12014
  }
12010
12015
 
12011
12016
  // src/migrations/016-session-checkpoints.ts
12012
- function up20(db) {
12017
+ function up21(db) {
12013
12018
  db.exec(`
12014
12019
  CREATE TABLE IF NOT EXISTS session_checkpoints (
12015
12020
  id TEXT PRIMARY KEY,
@@ -12033,7 +12038,7 @@ function up20(db) {
12033
12038
  }
12034
12039
 
12035
12040
  // src/migrations/017-task-skills.ts
12036
- function up21(db) {
12041
+ function up22(db) {
12037
12042
  const cols = db.prepare("PRAGMA table_info(scheduled_tasks)").all();
12038
12043
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
12039
12044
  if (!colNames.has("skill_name")) {
@@ -12046,7 +12051,7 @@ function up21(db) {
12046
12051
  }
12047
12052
 
12048
12053
  // src/migrations/018-skill-meta.ts
12049
- function up22(db) {
12054
+ function up23(db) {
12050
12055
  const existing = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='skill_meta'").get();
12051
12056
  if (existing)
12052
12057
  return;
@@ -12080,7 +12085,7 @@ function up22(db) {
12080
12085
  }
12081
12086
 
12082
12087
  // src/migrations/019-knowledge-structure.ts
12083
- function up23(db) {
12088
+ function up24(db) {
12084
12089
  const entityCols = db.prepare("PRAGMA table_info(entities)").all();
12085
12090
  const entityColNames = new Set(entityCols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
12086
12091
  if (!entityColNames.has("agent_id")) {
@@ -12167,7 +12172,7 @@ function addColumnIfMissing8(db, table, column, definition) {
12167
12172
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12168
12173
  }
12169
12174
  }
12170
- function up24(db) {
12175
+ function up25(db) {
12171
12176
  addColumnIfMissing8(db, "session_memories", "entity_slot", "INTEGER");
12172
12177
  addColumnIfMissing8(db, "session_memories", "aspect_slot", "INTEGER");
12173
12178
  addColumnIfMissing8(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12175,7 +12180,7 @@ function up24(db) {
12175
12180
  }
12176
12181
 
12177
12182
  // src/migrations/021-checkpoint-structural.ts
12178
- function up25(db) {
12183
+ function up26(db) {
12179
12184
  const columns = db.prepare("PRAGMA table_info(session_checkpoints)").all();
12180
12185
  const columnNames = new Set(columns.flatMap((column) => typeof column.name === "string" ? [column.name] : []));
12181
12186
  if (!columnNames.has("focal_entity_ids")) {
@@ -12202,17 +12207,17 @@ function addColumnIfMissing9(db, table, column, definition) {
12202
12207
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12203
12208
  }
12204
12209
  }
12205
- function up26(db) {
12210
+ function up27(db) {
12206
12211
  addColumnIfMissing9(db, "entities", "pinned", "INTEGER NOT NULL DEFAULT 0");
12207
12212
  addColumnIfMissing9(db, "entities", "pinned_at", "TEXT");
12208
12213
  db.exec("CREATE INDEX IF NOT EXISTS idx_entities_pinned ON entities(agent_id, pinned, pinned_at DESC)");
12209
12214
  }
12210
12215
 
12211
12216
  // src/migrations/023-predictor-columns.ts
12212
- function up27(_db) {}
12217
+ function up28(_db) {}
12213
12218
 
12214
12219
  // src/migrations/024-predictor-comparison-columns.ts
12215
- function up28(_db) {}
12220
+ function up29(_db) {}
12216
12221
 
12217
12222
  // src/migrations/025-agent-feedback.ts
12218
12223
  function addColumnIfMissing10(db, table, column, definition) {
@@ -12221,16 +12226,16 @@ function addColumnIfMissing10(db, table, column, definition) {
12221
12226
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12222
12227
  }
12223
12228
  }
12224
- function up29(db) {
12229
+ function up30(db) {
12225
12230
  addColumnIfMissing10(db, "session_memories", "agent_relevance_score", "REAL");
12226
12231
  addColumnIfMissing10(db, "session_memories", "agent_feedback_count", "INTEGER DEFAULT 0");
12227
12232
  }
12228
12233
 
12229
12234
  // src/migrations/026-predictor-training-pairs.ts
12230
- function up30(_db) {}
12235
+ function up31(_db) {}
12231
12236
 
12232
12237
  // src/migrations/027-backfill-canonical-names.ts
12233
- function up31(db) {
12238
+ function up32(db) {
12234
12239
  db.exec(`
12235
12240
  UPDATE entities
12236
12241
  SET canonical_name = REPLACE(REPLACE(REPLACE(
@@ -12241,7 +12246,7 @@ function up31(db) {
12241
12246
  }
12242
12247
 
12243
12248
  // src/migrations/028-lossless-retention.ts
12244
- function up32(db) {
12249
+ function up33(db) {
12245
12250
  db.exec(`
12246
12251
  CREATE TABLE IF NOT EXISTS memories_cold (
12247
12252
  archive_id TEXT PRIMARY KEY,
@@ -12280,7 +12285,7 @@ function up32(db) {
12280
12285
  }
12281
12286
 
12282
12287
  // src/migrations/029-session-summary-dag.ts
12283
- function up33(db) {
12288
+ function up34(db) {
12284
12289
  db.exec(`
12285
12290
  CREATE TABLE IF NOT EXISTS session_summaries (
12286
12291
  id TEXT PRIMARY KEY,
@@ -12327,7 +12332,7 @@ function up33(db) {
12327
12332
  }
12328
12333
 
12329
12334
  // src/migrations/030-nullable-memory-job-memory-id.ts
12330
- function up34(db) {
12335
+ function up35(db) {
12331
12336
  db.exec(`
12332
12337
  CREATE TABLE IF NOT EXISTS memory_jobs_new (
12333
12338
  id TEXT PRIMARY KEY,
@@ -12374,7 +12379,7 @@ function up34(db) {
12374
12379
  }
12375
12380
 
12376
12381
  // src/migrations/031-dependency-reason.ts
12377
- function up35(db) {
12382
+ function up36(db) {
12378
12383
  const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12379
12384
  if (!depCols.some((c) => c.name === "reason")) {
12380
12385
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN reason TEXT");
@@ -12386,7 +12391,7 @@ function up35(db) {
12386
12391
  }
12387
12392
 
12388
12393
  // src/migrations/032-embeddings-vector-column.ts
12389
- function up36(db) {
12394
+ function up37(db) {
12390
12395
  const cols = db.prepare("PRAGMA table_info(embeddings)").all();
12391
12396
  if (cols.length === 0)
12392
12397
  return;
@@ -12396,7 +12401,7 @@ function up36(db) {
12396
12401
  }
12397
12402
 
12398
12403
  // src/migrations/033-scope.ts
12399
- function up37(db) {
12404
+ function up38(db) {
12400
12405
  const cols = db.prepare("PRAGMA table_info(memories)").all();
12401
12406
  if (!cols.some((c) => c.name === "scope")) {
12402
12407
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT DEFAULT NULL");
@@ -12405,7 +12410,7 @@ function up37(db) {
12405
12410
  }
12406
12411
 
12407
12412
  // src/migrations/034-scope-aware-dedup.ts
12408
- function up38(db) {
12413
+ function up39(db) {
12409
12414
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
12410
12415
  db.exec(`
12411
12416
  CREATE UNIQUE INDEX idx_memories_content_hash_unique
@@ -12415,7 +12420,7 @@ function up38(db) {
12415
12420
  }
12416
12421
 
12417
12422
  // src/migrations/035-entity-fts.ts
12418
- function up39(db) {
12423
+ function up40(db) {
12419
12424
  db.exec(`
12420
12425
  CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
12421
12426
  name, canonical_name,
@@ -12449,7 +12454,7 @@ function up39(db) {
12449
12454
  }
12450
12455
 
12451
12456
  // src/migrations/036-dependency-confidence.ts
12452
- function up40(db) {
12457
+ function up41(db) {
12453
12458
  const cols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
12454
12459
  if (!cols.some((c) => c.name === "confidence")) {
12455
12460
  db.exec("ALTER TABLE entity_dependencies ADD COLUMN confidence REAL DEFAULT 0.7");
@@ -12457,7 +12462,7 @@ function up40(db) {
12457
12462
  }
12458
12463
 
12459
12464
  // src/migrations/037-entity-communities.ts
12460
- function up41(db) {
12465
+ function up42(db) {
12461
12466
  db.exec(`
12462
12467
  CREATE TABLE IF NOT EXISTS entity_communities (
12463
12468
  id TEXT PRIMARY KEY,
@@ -12477,7 +12482,7 @@ function up41(db) {
12477
12482
  }
12478
12483
 
12479
12484
  // src/migrations/038-memory-hints.ts
12480
- function up42(db) {
12485
+ function up43(db) {
12481
12486
  db.exec(`
12482
12487
  CREATE TABLE IF NOT EXISTS memory_hints (
12483
12488
  id TEXT PRIMARY KEY,
@@ -12519,7 +12524,7 @@ function up42(db) {
12519
12524
  }
12520
12525
 
12521
12526
  // src/migrations/039-dedup-entity-dependencies.ts
12522
- function up43(db) {
12527
+ function up44(db) {
12523
12528
  db.exec(`
12524
12529
  DELETE FROM entity_dependencies
12525
12530
  WHERE id NOT IN (
@@ -12539,7 +12544,7 @@ function up43(db) {
12539
12544
  }
12540
12545
 
12541
12546
  // src/migrations/040-session-transcripts.ts
12542
- function up44(db) {
12547
+ function up45(db) {
12543
12548
  db.exec(`
12544
12549
  CREATE TABLE IF NOT EXISTS session_transcripts (
12545
12550
  session_key TEXT PRIMARY KEY,
@@ -12564,7 +12569,7 @@ function addColumnIfMissing11(db, table, column, definition) {
12564
12569
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12565
12570
  }
12566
12571
  }
12567
- function up45(db) {
12572
+ function up46(db) {
12568
12573
  addColumnIfMissing11(db, "session_memories", "path_json", "TEXT");
12569
12574
  db.exec(`
12570
12575
  CREATE TABLE IF NOT EXISTS path_feedback_events (
@@ -12641,7 +12646,7 @@ function addColumnIfMissing12(db, table, column, definition) {
12641
12646
  return;
12642
12647
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12643
12648
  }
12644
- function up46(db) {
12649
+ function up47(db) {
12645
12650
  addColumnIfMissing12(db, "session_memories", "entity_slot", "INTEGER");
12646
12651
  addColumnIfMissing12(db, "session_memories", "aspect_slot", "INTEGER");
12647
12652
  addColumnIfMissing12(db, "session_memories", "is_constraint", "INTEGER NOT NULL DEFAULT 0");
@@ -12731,7 +12736,7 @@ function addColumnIfMissing13(db, table, column, definition) {
12731
12736
  return;
12732
12737
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12733
12738
  }
12734
- function up47(db) {
12739
+ function up48(db) {
12735
12740
  db.exec(`
12736
12741
  CREATE TABLE IF NOT EXISTS agents (
12737
12742
  id TEXT PRIMARY KEY,
@@ -12762,7 +12767,7 @@ function addColumnIfMissing14(db, table, column, definition) {
12762
12767
  return;
12763
12768
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12764
12769
  }
12765
- function up48(db) {
12770
+ function up49(db) {
12766
12771
  addColumnIfMissing14(db, "session_summaries", "source_type", "TEXT");
12767
12772
  addColumnIfMissing14(db, "session_summaries", "source_ref", "TEXT");
12768
12773
  addColumnIfMissing14(db, "session_summaries", "meta_json", "TEXT");
@@ -12790,7 +12795,7 @@ function addColumnIfMissing15(db, table, column, definition) {
12790
12795
  return;
12791
12796
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
12792
12797
  }
12793
- function up49(db) {
12798
+ function up50(db) {
12794
12799
  addColumnIfMissing15(db, "session_transcripts", "updated_at", "TEXT");
12795
12800
  addColumnIfMissing15(db, "summary_jobs", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
12796
12801
  addColumnIfMissing15(db, "session_scores", "agent_id", "TEXT NOT NULL DEFAULT 'default'");
@@ -12863,7 +12868,7 @@ function up49(db) {
12863
12868
  }
12864
12869
 
12865
12870
  // src/migrations/046-session-summary-uniqueness.ts
12866
- function up50(db) {
12871
+ function up51(db) {
12867
12872
  db.exec(`
12868
12873
  DROP INDEX IF EXISTS idx_summaries_session_depth;
12869
12874
 
@@ -12926,7 +12931,7 @@ function up50(db) {
12926
12931
  }
12927
12932
 
12928
12933
  // src/migrations/047-agent-scoped-temporal-uniqueness.ts
12929
- function up51(db) {
12934
+ function up52(db) {
12930
12935
  db.exec(`
12931
12936
  DROP TRIGGER IF EXISTS session_transcripts_fts_ai;
12932
12937
  DROP TRIGGER IF EXISTS session_transcripts_fts_ad;
@@ -13026,7 +13031,7 @@ function up51(db) {
13026
13031
  }
13027
13032
 
13028
13033
  // src/migrations/048-thread-heads.ts
13029
- function up52(db) {
13034
+ function up53(db) {
13030
13035
  db.exec(`
13031
13036
  CREATE TABLE IF NOT EXISTS memory_thread_heads (
13032
13037
  agent_id TEXT NOT NULL DEFAULT 'default',
@@ -13146,7 +13151,7 @@ function up52(db) {
13146
13151
  }
13147
13152
 
13148
13153
  // src/migrations/049-session-extract-cursors.ts
13149
- function up53(db) {
13154
+ function up54(db) {
13150
13155
  db.exec(`
13151
13156
  CREATE TABLE IF NOT EXISTS session_extract_cursors (
13152
13157
  session_key TEXT NOT NULL,
@@ -13165,7 +13170,7 @@ function hasTable(db, name) {
13165
13170
  WHERE type = 'table' AND name = ?
13166
13171
  LIMIT 1`).get(name) !== undefined;
13167
13172
  }
13168
- function up54(db) {
13173
+ function up55(db) {
13169
13174
  db.exec(`
13170
13175
  CREATE TABLE IF NOT EXISTS entity_dependency_history (
13171
13176
  id TEXT PRIMARY KEY,
@@ -13337,7 +13342,7 @@ function addColumnIfMissing16(db, table, column, definition) {
13337
13342
  return;
13338
13343
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13339
13344
  }
13340
- function up55(db) {
13345
+ function up56(db) {
13341
13346
  addColumnIfMissing16(db, "summary_jobs", "session_id", "TEXT");
13342
13347
  addColumnIfMissing16(db, "summary_jobs", "trigger", "TEXT NOT NULL DEFAULT 'session_end'");
13343
13348
  addColumnIfMissing16(db, "summary_jobs", "captured_at", "TEXT");
@@ -13431,26 +13436,10 @@ function up55(db) {
13431
13436
  }
13432
13437
 
13433
13438
  // src/migrations/052-mcp-invocations.ts
13434
- function up56(db) {
13435
- db.exec(`
13436
- CREATE TABLE IF NOT EXISTS mcp_invocations (
13437
- id TEXT PRIMARY KEY,
13438
- server_id TEXT NOT NULL,
13439
- tool_name TEXT NOT NULL,
13440
- agent_id TEXT NOT NULL DEFAULT 'default',
13441
- source TEXT NOT NULL CHECK(source IN ('cli','agent','mcp','dashboard')),
13442
- latency_ms INTEGER NOT NULL,
13443
- success INTEGER NOT NULL DEFAULT 1,
13444
- error_text TEXT,
13445
- created_at TEXT NOT NULL DEFAULT (datetime('now'))
13446
- );
13447
- CREATE INDEX IF NOT EXISTS idx_mcp_inv_server ON mcp_invocations(server_id, created_at);
13448
- CREATE INDEX IF NOT EXISTS idx_mcp_inv_agent ON mcp_invocations(agent_id, created_at);
13449
- `);
13450
- }
13439
+ function up57(_db) {}
13451
13440
 
13452
13441
  // src/migrations/053-skill-invocations.ts
13453
- function up57(db) {
13442
+ function up58(db) {
13454
13443
  db.exec(`
13455
13444
  CREATE TABLE IF NOT EXISTS skill_invocations (
13456
13445
  id TEXT PRIMARY KEY,
@@ -13468,7 +13457,7 @@ function up57(db) {
13468
13457
  }
13469
13458
 
13470
13459
  // src/migrations/054-task-agent-scope.ts
13471
- function up58(db) {
13460
+ function up59(db) {
13472
13461
  db.exec(`
13473
13462
  CREATE TABLE IF NOT EXISTS task_scope_hints (
13474
13463
  task_id TEXT PRIMARY KEY REFERENCES scheduled_tasks(id) ON DELETE CASCADE,
@@ -13501,7 +13490,7 @@ function up58(db) {
13501
13490
  }
13502
13491
 
13503
13492
  // src/migrations/055-dreaming-state.ts
13504
- function up59(db) {
13493
+ function up60(db) {
13505
13494
  db.exec(`
13506
13495
  CREATE TABLE IF NOT EXISTS dreaming_state (
13507
13496
  agent_id TEXT PRIMARY KEY NOT NULL,
@@ -13546,7 +13535,7 @@ function ensureMemoriesScopeColumns(db) {
13546
13535
  if (!names.has("scope"))
13547
13536
  db.exec("ALTER TABLE memories ADD COLUMN scope TEXT");
13548
13537
  }
13549
- function up60(db) {
13538
+ function up61(db) {
13550
13539
  ensureMemoriesScopeColumns(db);
13551
13540
  db.exec("DROP INDEX IF EXISTS idx_memories_content_hash_unique");
13552
13541
  db.exec(`
@@ -13561,7 +13550,7 @@ function up60(db) {
13561
13550
  }
13562
13551
 
13563
13552
  // src/migrations/057-memories-fts-tokenizer-repair.ts
13564
- function up61(db) {
13553
+ function up62(db) {
13565
13554
  const sql = readMemoriesFtsSql(db);
13566
13555
  if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
13567
13556
  return;
@@ -13569,7 +13558,7 @@ function up61(db) {
13569
13558
  }
13570
13559
 
13571
13560
  // src/migrations/058-knowledge-graph-indices.ts
13572
- function up62(db) {
13561
+ function up63(db) {
13573
13562
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_order
13574
13563
  ON entities(agent_id, pinned DESC, pinned_at DESC, mentions DESC, updated_at DESC, name)`);
13575
13564
  db.exec(`CREATE INDEX IF NOT EXISTS idx_entities_extracted_mentions
@@ -13578,7 +13567,7 @@ function up62(db) {
13578
13567
  }
13579
13568
 
13580
13569
  // src/migrations/059-entity-attribute-claim-key.ts
13581
- function up63(db) {
13570
+ function up64(db) {
13582
13571
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13583
13572
  if (!cols.some((col) => col.name === "claim_key")) {
13584
13573
  db.exec("ALTER TABLE entity_attributes ADD COLUMN claim_key TEXT");
@@ -13589,7 +13578,7 @@ function up63(db) {
13589
13578
  }
13590
13579
 
13591
13580
  // src/migrations/060-entity-attribute-group-key.ts
13592
- function up64(db) {
13581
+ function up65(db) {
13593
13582
  const cols = db.prepare("PRAGMA table_info(entity_attributes)").all();
13594
13583
  if (!cols.some((col) => col.name === "group_key")) {
13595
13584
  db.exec("ALTER TABLE entity_attributes ADD COLUMN group_key TEXT");
@@ -13603,7 +13592,7 @@ function up64(db) {
13603
13592
  }
13604
13593
 
13605
13594
  // src/migrations/061-memory-artifact-source-mtime.ts
13606
- function up65(db) {
13595
+ function up66(db) {
13607
13596
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13608
13597
  if (cols.some((col) => col.name === "source_mtime_ms"))
13609
13598
  return;
@@ -13611,7 +13600,7 @@ function up65(db) {
13611
13600
  }
13612
13601
 
13613
13602
  // src/migrations/062-memory-artifact-soft-delete.ts
13614
- function up66(db) {
13603
+ function up67(db) {
13615
13604
  const cols = db.prepare("PRAGMA table_info(memory_artifacts)").all();
13616
13605
  const names = new Set(cols.map((col) => col.name));
13617
13606
  if (!names.has("is_deleted")) {
@@ -13627,7 +13616,7 @@ function up66(db) {
13627
13616
  }
13628
13617
 
13629
13618
  // src/migrations/063-content-only-memories-fts-update.ts
13630
- function up67(db) {
13619
+ function up68(db) {
13631
13620
  db.exec("DROP TRIGGER IF EXISTS memories_au");
13632
13621
  db.exec(`
13633
13622
  CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE OF content ON memories BEGIN
@@ -13647,7 +13636,7 @@ function addColumnIfMissing17(db, table, column, definition) {
13647
13636
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13648
13637
  }
13649
13638
  }
13650
- function up68(db) {
13639
+ function up69(db) {
13651
13640
  for (const table of ["entities", "entity_communities", "entity_attributes", "entity_dependencies"]) {
13652
13641
  addColumnIfMissing17(db, table, "source_id", "TEXT");
13653
13642
  addColumnIfMissing17(db, table, "source_kind", "TEXT");
@@ -13669,7 +13658,7 @@ function hasColumn7(db, table, column) {
13669
13658
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
13670
13659
  return rows.some((row) => row.name === column);
13671
13660
  }
13672
- function up69(db) {
13661
+ function up70(db) {
13673
13662
  if (!hasTable2(db, "embeddings"))
13674
13663
  return;
13675
13664
  if (!hasColumn7(db, "embeddings", "agent_id")) {
@@ -13679,7 +13668,7 @@ function up69(db) {
13679
13668
  }
13680
13669
 
13681
13670
  // src/migrations/066-memory-search-telemetry.ts
13682
- function up70(db) {
13671
+ function up71(db) {
13683
13672
  db.exec(`
13684
13673
  CREATE TABLE IF NOT EXISTS memory_search_telemetry (
13685
13674
  id TEXT PRIMARY KEY,
@@ -13722,7 +13711,7 @@ function addColumnIfMissing18(db, table, column, definition) {
13722
13711
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
13723
13712
  }
13724
13713
  }
13725
- function up71(db) {
13714
+ function up72(db) {
13726
13715
  db.exec(`
13727
13716
  CREATE TABLE IF NOT EXISTS ontology_proposals (
13728
13717
  id TEXT PRIMARY KEY,
@@ -13767,7 +13756,7 @@ function up71(db) {
13767
13756
  }
13768
13757
 
13769
13758
  // src/migrations/068-daily-reflections.ts
13770
- function up72(db) {
13759
+ function up73(db) {
13771
13760
  db.exec(`
13772
13761
  CREATE TABLE IF NOT EXISTS daily_reflections (
13773
13762
  id TEXT PRIMARY KEY,
@@ -13796,7 +13785,7 @@ function up72(db) {
13796
13785
  }
13797
13786
 
13798
13787
  // src/migrations/069-daily-reflections-multiple-insights.ts
13799
- function up73(db) {
13788
+ function up74(db) {
13800
13789
  const cols = db.prepare("PRAGMA table_info(daily_reflections)").all();
13801
13790
  const colNames = new Set(cols.flatMap((c) => typeof c.name === "string" ? [c.name] : []));
13802
13791
  if (!colNames.has("content_key")) {
@@ -13835,7 +13824,7 @@ function backfillVersionRoots(db) {
13835
13824
  WHERE version_root_id IS NULL
13836
13825
  `);
13837
13826
  }
13838
- function up74(db) {
13827
+ function up75(db) {
13839
13828
  for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
13840
13829
  addColumnIfMissing19(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
13841
13830
  addColumnIfMissing19(db, table, "archived_at", "TEXT");
@@ -13872,7 +13861,7 @@ function up74(db) {
13872
13861
  }
13873
13862
 
13874
13863
  // src/migrations/071-epistemic-assertions.ts
13875
- function up75(db) {
13864
+ function up76(db) {
13876
13865
  db.exec(`
13877
13866
  CREATE TABLE IF NOT EXISTS epistemic_assertions (
13878
13867
  id TEXT PRIMARY KEY,
@@ -13930,7 +13919,7 @@ function ensureMemoriesScopeColumns2(db) {
13930
13919
  if (!names.has("runtime_path"))
13931
13920
  db.exec("ALTER TABLE memories ADD COLUMN runtime_path TEXT");
13932
13921
  }
13933
- function up76(db) {
13922
+ function up77(db) {
13934
13923
  ensureMemoriesScopeColumns2(db);
13935
13924
  db.exec("DROP INDEX IF EXISTS idx_memories_idempotency_key");
13936
13925
  db.exec(`
@@ -13946,7 +13935,7 @@ function up76(db) {
13946
13935
  }
13947
13936
 
13948
13937
  // src/migrations/073-recall-context-dedupe.ts
13949
- function up77(db) {
13938
+ function up78(db) {
13950
13939
  db.exec(`
13951
13940
  CREATE TABLE IF NOT EXISTS session_context_epochs (
13952
13941
  session_key TEXT NOT NULL,
@@ -13983,7 +13972,7 @@ function up77(db) {
13983
13972
  }
13984
13973
 
13985
13974
  // src/migrations/074-aggregate-memory-links.ts
13986
- function up78(db) {
13975
+ function up79(db) {
13987
13976
  db.exec(`
13988
13977
  CREATE TABLE IF NOT EXISTS aggregate_memory_sources (
13989
13978
  aggregate_memory_id TEXT NOT NULL,
@@ -14004,7 +13993,7 @@ function addColumnIfMissing20(db, table, column, definition) {
14004
13993
  return;
14005
13994
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14006
13995
  }
14007
- function up79(db) {
13996
+ function up80(db) {
14008
13997
  addColumnIfMissing20(db, "memory_artifacts", "source_id", "TEXT");
14009
13998
  addColumnIfMissing20(db, "memory_artifacts", "source_root", "TEXT");
14010
13999
  addColumnIfMissing20(db, "memory_artifacts", "source_external_id", "TEXT");
@@ -14019,7 +14008,7 @@ function up79(db) {
14019
14008
  }
14020
14009
 
14021
14010
  // src/migrations/076-temporal-edges.ts
14022
- function up80(db) {
14011
+ function up81(db) {
14023
14012
  db.exec(`
14024
14013
  CREATE TABLE IF NOT EXISTS temporal_edges (
14025
14014
  id TEXT PRIMARY KEY,
@@ -14044,7 +14033,7 @@ function up80(db) {
14044
14033
  }
14045
14034
 
14046
14035
  // src/migrations/077-entity-aliases.ts
14047
- function up81(db) {
14036
+ function up82(db) {
14048
14037
  db.exec(`
14049
14038
  CREATE TABLE IF NOT EXISTS entity_aliases (
14050
14039
  id TEXT PRIMARY KEY,
@@ -14070,7 +14059,7 @@ function up81(db) {
14070
14059
  }
14071
14060
 
14072
14061
  // src/migrations/078-api-keys.ts
14073
- function up82(db) {
14062
+ function up83(db) {
14074
14063
  db.exec(`
14075
14064
  CREATE TABLE IF NOT EXISTS api_keys (
14076
14065
  id TEXT PRIMARY KEY,
@@ -14100,7 +14089,7 @@ function up82(db) {
14100
14089
  }
14101
14090
 
14102
14091
  // src/migrations/079-transcript-capture-jobs.ts
14103
- function up83(db) {
14092
+ function up84(db) {
14104
14093
  db.exec(`
14105
14094
  CREATE TABLE IF NOT EXISTS transcript_capture_jobs (
14106
14095
  id TEXT PRIMARY KEY,
@@ -14137,7 +14126,7 @@ function hasColumn10(db, table, column) {
14137
14126
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14138
14127
  return rows.some((row) => row.name === column);
14139
14128
  }
14140
- function up84(db) {
14129
+ function up85(db) {
14141
14130
  if (!hasColumn10(db, "documents", "agent_id")) {
14142
14131
  db.exec("ALTER TABLE documents ADD COLUMN agent_id TEXT NOT NULL DEFAULT 'default'");
14143
14132
  }
@@ -14225,7 +14214,7 @@ function up84(db) {
14225
14214
  }
14226
14215
 
14227
14216
  // src/migrations/081-aggregate-evidence-sources.ts
14228
- function up85(db) {
14217
+ function up86(db) {
14229
14218
  db.exec(`
14230
14219
  CREATE TABLE IF NOT EXISTS aggregate_evidence_sources (
14231
14220
  aggregate_memory_id TEXT NOT NULL,
@@ -14249,7 +14238,7 @@ function hasColumn11(db, table, column) {
14249
14238
  return rows.some((row) => row.name === column);
14250
14239
  }
14251
14240
  var COLUMNS = ["harness", "session_id", "tool_use_id", "cwd", "origin", "args"];
14252
- function up86(db) {
14241
+ function up87(db) {
14253
14242
  for (const column of COLUMNS) {
14254
14243
  if (!hasColumn11(db, "skill_invocations", column)) {
14255
14244
  db.exec(`ALTER TABLE skill_invocations ADD COLUMN ${column} TEXT`);
@@ -14332,7 +14321,7 @@ function documentScopeColumnsPreservingExisting(db) {
14332
14321
  `);
14333
14322
  }
14334
14323
  try {
14335
- up84(db);
14324
+ up85(db);
14336
14325
  if (preserveAgentId) {
14337
14326
  db.exec(`
14338
14327
  UPDATE documents
@@ -14352,12 +14341,12 @@ function documentScopeColumnsPreservingExisting(db) {
14352
14341
  db.exec("DROP TABLE IF EXISTS temp.__signet_doc_project_guard");
14353
14342
  }
14354
14343
  }
14355
- function up87(db) {
14356
- up83(db);
14344
+ function up88(db) {
14345
+ up84(db);
14357
14346
  if (hasTable3(db, "documents")) {
14358
14347
  documentScopeColumnsPreservingExisting(db);
14359
14348
  }
14360
- up85(db);
14349
+ up86(db);
14361
14350
  addColumnIfMissing21(db, "memories", "superseded_by", "TEXT");
14362
14351
  addColumnIfMissing21(db, "memories", "superseded_at", "TEXT");
14363
14352
  addColumnIfMissing21(db, "memories", "superseded_reason", "TEXT");
@@ -14416,7 +14405,7 @@ function up87(db) {
14416
14405
  }
14417
14406
 
14418
14407
  // src/migrations/084-legacy-markdown-import-state.ts
14419
- function up88(db) {
14408
+ function up89(db) {
14420
14409
  db.exec(`
14421
14410
  CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
14422
14411
  path TEXT PRIMARY KEY,
@@ -14448,7 +14437,7 @@ function up88(db) {
14448
14437
  }
14449
14438
 
14450
14439
  // src/migrations/085-backfill-relations-to-dependencies.ts
14451
- function up89(db) {
14440
+ function up90(db) {
14452
14441
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
14453
14442
  const tableNames = new Set(tables.map((r) => String(r.name)));
14454
14443
  if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
@@ -14509,7 +14498,7 @@ function addColumnIfMissing22(db, table, column, definition) {
14509
14498
  return;
14510
14499
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14511
14500
  }
14512
- function up90(db) {
14501
+ function up91(db) {
14513
14502
  addColumnIfMissing22(db, "summary_jobs", "content_hash", "TEXT");
14514
14503
  db.exec(`
14515
14504
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
@@ -14524,7 +14513,7 @@ function addColumnIfMissing23(db, table, column, definition) {
14524
14513
  return;
14525
14514
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
14526
14515
  }
14527
- function up91(db) {
14516
+ function up92(db) {
14528
14517
  addColumnIfMissing23(db, "summary_jobs", "boundary_reason", "TEXT");
14529
14518
  db.exec(`
14530
14519
  CREATE INDEX IF NOT EXISTS idx_summary_jobs_boundary_reason
@@ -14533,7 +14522,7 @@ function up91(db) {
14533
14522
  }
14534
14523
 
14535
14524
  // src/migrations/088-transcript-recovery-files.ts
14536
- function up92(db) {
14525
+ function up93(db) {
14537
14526
  db.exec(`
14538
14527
  CREATE TABLE IF NOT EXISTS transcript_recovery_files (
14539
14528
  agent_id TEXT NOT NULL,
@@ -14553,7 +14542,7 @@ function up92(db) {
14553
14542
  }
14554
14543
 
14555
14544
  // src/migrations/089-job-cancellations.ts
14556
- function up93(db) {
14545
+ function up94(db) {
14557
14546
  db.exec(`
14558
14547
  CREATE TABLE IF NOT EXISTS job_cancellations (
14559
14548
  id TEXT PRIMARY KEY,
@@ -14583,7 +14572,7 @@ function indexExists(db, table, indexName) {
14583
14572
  }
14584
14573
 
14585
14574
  // src/migrations/090-job-archive.ts
14586
- function up94(db) {
14575
+ function up95(db) {
14587
14576
  db.exec(`
14588
14577
  CREATE TABLE IF NOT EXISTS job_archive (
14589
14578
  id TEXT PRIMARY KEY,
@@ -14612,7 +14601,7 @@ function indexExists2(db, table, indexName) {
14612
14601
  }
14613
14602
 
14614
14603
  // src/migrations/091-embedding-index-generations.ts
14615
- function up95(db) {
14604
+ function up96(db) {
14616
14605
  db.exec(`
14617
14606
  CREATE TABLE IF NOT EXISTS embedding_index_state (
14618
14607
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -14627,7 +14616,7 @@ function up95(db) {
14627
14616
  }
14628
14617
 
14629
14618
  // src/migrations/092-embedding-staging-store.ts
14630
- function up96(db) {
14619
+ function up97(db) {
14631
14620
  db.exec(`
14632
14621
  CREATE TABLE IF NOT EXISTS embeddings_staging (
14633
14622
  id TEXT PRIMARY KEY,
@@ -14648,7 +14637,7 @@ function up96(db) {
14648
14637
  }
14649
14638
 
14650
14639
  // src/migrations/093-dreaming-evidence-cursor.ts
14651
- function up97(db) {
14640
+ function up98(db) {
14652
14641
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14653
14642
  if (!columns.some((column) => column.name === "evidence_cursor")) {
14654
14643
  db.exec("ALTER TABLE dreaming_state ADD COLUMN evidence_cursor TEXT");
@@ -14661,7 +14650,7 @@ function hasColumn13(db, table, column) {
14661
14650
  const rows = db.prepare(`PRAGMA table_info(${table})`).all();
14662
14651
  return rows.some((r) => r.name === column);
14663
14652
  }
14664
- function up98(db) {
14653
+ function up99(db) {
14665
14654
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'memories'").all();
14666
14655
  if (tables.length === 0)
14667
14656
  return;
@@ -14688,7 +14677,7 @@ function up98(db) {
14688
14677
  function hasColumn14(db, table, column) {
14689
14678
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14690
14679
  }
14691
- function up99(db) {
14680
+ function up100(db) {
14692
14681
  const hasMemories = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'memories'").get();
14693
14682
  if (!hasMemories || !hasColumn14(db, "memories", "memory_kind") || !hasColumn14(db, "memories", "type"))
14694
14683
  return;
@@ -14696,12 +14685,12 @@ function up99(db) {
14696
14685
  }
14697
14686
 
14698
14687
  // src/migrations/096-retire-legacy-ingestion.ts
14699
- function up100(db) {
14688
+ function up101(db) {
14700
14689
  db.exec("DROP TABLE IF EXISTS ingestion_jobs");
14701
14690
  }
14702
14691
 
14703
14692
  // src/migrations/097-dreaming-failure-backoff.ts
14704
- function up101(db) {
14693
+ function up102(db) {
14705
14694
  const columns = db.prepare("PRAGMA table_info(dreaming_state)").all();
14706
14695
  if (!columns.some((column) => column.name === "last_failure_at")) {
14707
14696
  db.exec("ALTER TABLE dreaming_state ADD COLUMN last_failure_at TEXT");
@@ -14710,7 +14699,7 @@ function up101(db) {
14710
14699
  }
14711
14700
 
14712
14701
  // src/migrations/098-dreaming-evidence-exclusions.ts
14713
- function up102(db) {
14702
+ function up103(db) {
14714
14703
  db.exec(`
14715
14704
  CREATE TABLE IF NOT EXISTS dreaming_evidence_exclusions (
14716
14705
  agent_id TEXT NOT NULL,
@@ -14729,7 +14718,7 @@ function up102(db) {
14729
14718
  }
14730
14719
 
14731
14720
  // src/migrations/099-dreaming-tool-calls.ts
14732
- function up103(db) {
14721
+ function up104(db) {
14733
14722
  db.exec(`
14734
14723
  CREATE TABLE IF NOT EXISTS dreaming_tool_calls (
14735
14724
  id TEXT PRIMARY KEY,
@@ -14751,7 +14740,7 @@ function up103(db) {
14751
14740
  }
14752
14741
 
14753
14742
  // src/migrations/100-dreaming-runbook.ts
14754
- function up104(db) {
14743
+ function up105(db) {
14755
14744
  const columns = db.prepare("PRAGMA table_info(dreaming_passes)").all();
14756
14745
  if (!columns.some((column) => column.name === "evidence_window_json")) {
14757
14746
  db.exec("ALTER TABLE dreaming_passes ADD COLUMN evidence_window_json TEXT");
@@ -14762,7 +14751,7 @@ function up104(db) {
14762
14751
  }
14763
14752
 
14764
14753
  // src/migrations/101-dreaming-attention.ts
14765
- function up105(db) {
14754
+ function up106(db) {
14766
14755
  db.exec(`
14767
14756
  CREATE TABLE IF NOT EXISTS dreaming_attention (
14768
14757
  id TEXT PRIMARY KEY,
@@ -14786,7 +14775,7 @@ function up105(db) {
14786
14775
  function hasColumn15(db, table, column) {
14787
14776
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14788
14777
  }
14789
- function up106(db) {
14778
+ function up107(db) {
14790
14779
  const requiredMemoryColumns = [
14791
14780
  "content_hash",
14792
14781
  "normalized_content",
@@ -14839,7 +14828,7 @@ function up106(db) {
14839
14828
  }
14840
14829
 
14841
14830
  // src/migrations/103-semantic-memory-kind.ts
14842
- function up107(db) {
14831
+ function up108(db) {
14843
14832
  const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('memories', 'entity_attributes')").all();
14844
14833
  if (tables.length !== 2)
14845
14834
  return;
@@ -14864,7 +14853,7 @@ function tableExists(db, table) {
14864
14853
  function hasColumn16(db, table, column) {
14865
14854
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
14866
14855
  }
14867
- function up108(db) {
14856
+ function up109(db) {
14868
14857
  db.exec(`
14869
14858
  CREATE TABLE IF NOT EXISTS derived_memory_sources (
14870
14859
  derived_memory_id TEXT NOT NULL,
@@ -14909,7 +14898,7 @@ function up108(db) {
14909
14898
  }
14910
14899
 
14911
14900
  // src/migrations/105-agent-scoped-entity-name.ts
14912
- function up109(db) {
14901
+ function up110(db) {
14913
14902
  db.exec(`
14914
14903
  DROP TRIGGER IF EXISTS entities_fts_ai;
14915
14904
  DROP TRIGGER IF EXISTS entities_fts_ad;
@@ -15000,7 +14989,7 @@ function up109(db) {
15000
14989
  function hasColumn17(db, table, column) {
15001
14990
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15002
14991
  }
15003
- function up110(db) {
14992
+ function up111(db) {
15004
14993
  if (!hasColumn17(db, "memories", "review_after")) {
15005
14994
  db.exec("ALTER TABLE memories ADD COLUMN review_after TEXT;");
15006
14995
  }
@@ -15018,7 +15007,7 @@ var TOKEN_COLUMNS = [
15018
15007
  ["tokens_cache_write", "INTEGER"],
15019
15008
  ["tokens_cost", "REAL"]
15020
15009
  ];
15021
- function up111(db) {
15010
+ function up112(db) {
15022
15011
  for (const [column, type] of TOKEN_COLUMNS) {
15023
15012
  if (!hasColumn18(db, "dreaming_passes", column)) {
15024
15013
  db.exec(`ALTER TABLE dreaming_passes ADD COLUMN ${column} ${type};`);
@@ -15027,7 +15016,7 @@ function up111(db) {
15027
15016
  }
15028
15017
 
15029
15018
  // src/migrations/108-embedding-usage.ts
15030
- function up112(db) {
15019
+ function up113(db) {
15031
15020
  db.exec(`
15032
15021
  CREATE TABLE IF NOT EXISTS embedding_usage (
15033
15022
  day TEXT NOT NULL,
@@ -15042,7 +15031,7 @@ function up112(db) {
15042
15031
  }
15043
15032
 
15044
15033
  // src/migrations/109-telemetry-install.ts
15045
- function up113(db) {
15034
+ function up114(db) {
15046
15035
  db.exec(`
15047
15036
  CREATE TABLE IF NOT EXISTS telemetry_install (
15048
15037
  id TEXT PRIMARY KEY,
@@ -15052,7 +15041,7 @@ function up113(db) {
15052
15041
  }
15053
15042
 
15054
15043
  // src/migrations/110-memory-mention-join-index.ts
15055
- function up114(db) {
15044
+ function up115(db) {
15056
15045
  db.exec(`
15057
15046
  CREATE INDEX IF NOT EXISTS idx_memory_entity_mentions_entity_memory
15058
15047
  ON memory_entity_mentions(entity_id, memory_id);
@@ -15065,7 +15054,7 @@ function hasColumn19(db, table, column) {
15065
15054
  return rows.some((row) => row.name === column);
15066
15055
  }
15067
15056
  var COLUMNS2 = ["first_remember_at", "first_recall_at"];
15068
- function up115(db) {
15057
+ function up116(db) {
15069
15058
  for (const column of COLUMNS2) {
15070
15059
  if (!hasColumn19(db, "telemetry_install", column)) {
15071
15060
  db.exec(`ALTER TABLE telemetry_install ADD COLUMN ${column} TEXT`);
@@ -15083,7 +15072,7 @@ function addColumnIfMissing24(db, column, definition) {
15083
15072
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15084
15073
  }
15085
15074
  }
15086
- function up116(db) {
15075
+ function up117(db) {
15087
15076
  addColumnIfMissing24(db, "source", "TEXT NOT NULL DEFAULT 'daemon'");
15088
15077
  addColumnIfMissing24(db, "claim_token", "TEXT");
15089
15078
  addColumnIfMissing24(db, "claimed_at", "TEXT");
@@ -15094,7 +15083,7 @@ function up116(db) {
15094
15083
  }
15095
15084
 
15096
15085
  // src/migrations/113-session-claims.ts
15097
- function up117(db) {
15086
+ function up118(db) {
15098
15087
  db.exec(`
15099
15088
  CREATE TABLE IF NOT EXISTS session_claims (
15100
15089
  session_key TEXT NOT NULL,
@@ -15117,7 +15106,7 @@ function up117(db) {
15117
15106
  }
15118
15107
 
15119
15108
  // src/migrations/114-memory-traversal-hydration-index.ts
15120
- function up118(db) {
15109
+ function up119(db) {
15121
15110
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'entity_attributes'").get();
15122
15111
  if (table == null)
15123
15112
  return;
@@ -15128,7 +15117,7 @@ function up118(db) {
15128
15117
  }
15129
15118
 
15130
15119
  // src/migrations/115-cross-agent-message-notifications.ts
15131
- function up119(db) {
15120
+ function up120(db) {
15132
15121
  db.exec(`
15133
15122
  CREATE TABLE IF NOT EXISTS cross_agent_messages (
15134
15123
  id TEXT PRIMARY KEY,
@@ -15187,7 +15176,7 @@ function addColumnIfMissing25(db, column, definition) {
15187
15176
  db.exec(`ALTER TABLE cross_agent_messages ADD COLUMN ${column} ${definition}`);
15188
15177
  }
15189
15178
  }
15190
- function up120(db) {
15179
+ function up121(db) {
15191
15180
  const table = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'cross_agent_messages'").get();
15192
15181
  if (table == null)
15193
15182
  return;
@@ -15391,7 +15380,7 @@ function backfillTranscriptsFromSummaryJobs(db) {
15391
15380
  insert.run(...values);
15392
15381
  }
15393
15382
  }
15394
- function up121(db) {
15383
+ function up122(db) {
15395
15384
  if (!hasTable4(db, "session_transcripts"))
15396
15385
  return;
15397
15386
  addColumnIfMissing26(db, "session_transcripts", "completed_at", "TEXT");
@@ -15446,7 +15435,7 @@ function up121(db) {
15446
15435
  }
15447
15436
 
15448
15437
  // src/migrations/118-queue-pressure-indices.ts
15449
- function up122(db) {
15438
+ function up123(db) {
15450
15439
  db.exec(`
15451
15440
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_pressure_status
15452
15441
  ON memory_jobs(status)
@@ -15467,14 +15456,14 @@ function up122(db) {
15467
15456
  function hasColumn22(db, table, column) {
15468
15457
  return db.prepare(`PRAGMA table_info(${table})`).all().some((row) => row.name === column);
15469
15458
  }
15470
- function up123(db) {
15459
+ function up124(db) {
15471
15460
  if (!hasColumn22(db, "telemetry_install", "last_seen_version")) {
15472
15461
  db.exec("ALTER TABLE telemetry_install ADD COLUMN last_seen_version TEXT");
15473
15462
  }
15474
15463
  }
15475
15464
 
15476
15465
  // src/migrations/120-source-lifecycle-telemetry.ts
15477
- function up124(db) {
15466
+ function up125(db) {
15478
15467
  db.exec(`
15479
15468
  CREATE TABLE IF NOT EXISTS source_lifecycle_state (
15480
15469
  agent_id TEXT NOT NULL,
@@ -15505,7 +15494,7 @@ function addColumnIfMissing27(db, column, definition) {
15505
15494
  db.exec(`ALTER TABLE telemetry_events ADD COLUMN ${column} ${definition}`);
15506
15495
  }
15507
15496
  }
15508
- function up125(db) {
15497
+ function up126(db) {
15509
15498
  addColumnIfMissing27(db, "delivery_attempts", "INTEGER NOT NULL DEFAULT 0");
15510
15499
  addColumnIfMissing27(db, "last_attempt_at", "TEXT");
15511
15500
  addColumnIfMissing27(db, "sent_at", "TEXT");
@@ -15528,7 +15517,7 @@ function up125(db) {
15528
15517
  }
15529
15518
 
15530
15519
  // src/migrations/122-dreaming-evidence-retry.ts
15531
- function up126(db) {
15520
+ function up127(db) {
15532
15521
  const columns = db.prepare("PRAGMA table_info(dreaming_evidence_exclusions)").all();
15533
15522
  const names = new Set(columns.map((column) => column.name));
15534
15523
  if (!names.has("failure_class")) {
@@ -15547,7 +15536,7 @@ function up126(db) {
15547
15536
  }
15548
15537
 
15549
15538
  // src/migrations/123-embedding-index-failures.ts
15550
- function up127(db) {
15539
+ function up128(db) {
15551
15540
  db.exec(`
15552
15541
  CREATE TABLE IF NOT EXISTS embedding_index_failures (
15553
15542
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -15573,7 +15562,7 @@ function up127(db) {
15573
15562
  }
15574
15563
 
15575
15564
  // src/migrations/124-import-derived-lifecycle.ts
15576
- function up128(db) {
15565
+ function up129(db) {
15577
15566
  db.exec(`
15578
15567
  CREATE TABLE IF NOT EXISTS imported_source_lifecycle (
15579
15568
  id TEXT PRIMARY KEY,
@@ -15625,7 +15614,7 @@ function backfillTable(db, params) {
15625
15614
  FROM ${params.table}${params.where ? ` WHERE ${params.where}` : ""}`).all();
15626
15615
  backfill(db, rows, params.sourceKind, params.scannedAt);
15627
15616
  }
15628
- function up129(db) {
15617
+ function up130(db) {
15629
15618
  db.exec(`
15630
15619
  CREATE TABLE IF NOT EXISTS memory_content_safety (
15631
15620
  agent_id TEXT NOT NULL,
@@ -15684,7 +15673,7 @@ function up129(db) {
15684
15673
  }
15685
15674
 
15686
15675
  // src/migrations/126-dreaming-surprisal-attention.ts
15687
- function up130(db) {
15676
+ function up131(db) {
15688
15677
  const table = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = 'dreaming_attention'").get();
15689
15678
  if (!table)
15690
15679
  return;
@@ -15720,7 +15709,7 @@ function up130(db) {
15720
15709
  }
15721
15710
 
15722
15711
  // src/migrations/127-ontology-contradictions.ts
15723
- function up131(db) {
15712
+ function up132(db) {
15724
15713
  db.exec(`
15725
15714
  CREATE TABLE IF NOT EXISTS ontology_contradictions (
15726
15715
  id TEXT PRIMARY KEY,
@@ -15778,7 +15767,7 @@ function up131(db) {
15778
15767
  }
15779
15768
 
15780
15769
  // src/migrations/128-bounded-queue-diagnostics.ts
15781
- function up132(db) {
15770
+ function up133(db) {
15782
15771
  db.exec(`
15783
15772
  CREATE INDEX IF NOT EXISTS idx_memory_jobs_diagnostics_status_created_at
15784
15773
  ON memory_jobs(status, created_at)
@@ -15795,7 +15784,7 @@ function up132(db) {
15795
15784
  function tableExists3(db, table) {
15796
15785
  return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
15797
15786
  }
15798
- function up133(db) {
15787
+ function up134(db) {
15799
15788
  if (!tableExists3(db, "memory_jobs"))
15800
15789
  return;
15801
15790
  if (!tableExists3(db, "job_cancellations")) {
@@ -15846,7 +15835,7 @@ function up133(db) {
15846
15835
  }
15847
15836
 
15848
15837
  // src/migrations/130-embedding-repair-state.ts
15849
- function up134(db) {
15838
+ function up135(db) {
15850
15839
  db.exec(`
15851
15840
  CREATE TABLE IF NOT EXISTS embedding_repair_budget (
15852
15841
  id INTEGER PRIMARY KEY CHECK (id = 1),
@@ -15888,7 +15877,7 @@ function up134(db) {
15888
15877
  }
15889
15878
 
15890
15879
  // src/migrations/131-dreaming-evidence-consumption.ts
15891
- function up135(db) {
15880
+ function up136(db) {
15892
15881
  db.exec(`
15893
15882
  CREATE TABLE IF NOT EXISTS dreaming_evidence_consumption (
15894
15883
  agent_id TEXT NOT NULL,
@@ -15913,7 +15902,7 @@ function up135(db) {
15913
15902
  }
15914
15903
 
15915
15904
  // src/migrations/132-observer-scoped-epistemic-assertions.ts
15916
- function up136(db) {
15905
+ function up137(db) {
15917
15906
  db.exec(`
15918
15907
  CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_observer_entity
15919
15908
  ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC, created_at DESC);
@@ -15921,7 +15910,7 @@ function up136(db) {
15921
15910
  }
15922
15911
 
15923
15912
  // src/migrations/133-dreaming-memory-head.ts
15924
- function up137(db) {
15913
+ function up138(db) {
15925
15914
  db.exec(`
15926
15915
  CREATE TABLE IF NOT EXISTS memory_head_revisions (
15927
15916
  id TEXT PRIMARY KEY,
@@ -15975,7 +15964,7 @@ function up137(db) {
15975
15964
  }
15976
15965
 
15977
15966
  // src/migrations/134-scope-memory-head-entries.ts
15978
- function up138(db) {
15967
+ function up139(db) {
15979
15968
  db.exec(`
15980
15969
  CREATE TABLE memory_head_entries_v134 (
15981
15970
  entry_id TEXT NOT NULL, agent_id TEXT NOT NULL, canonical_text TEXT NOT NULL,
@@ -15995,7 +15984,7 @@ function up138(db) {
15995
15984
  }
15996
15985
 
15997
15986
  // src/migrations/135-memory-head-publication.ts
15998
- function up139(db) {
15987
+ function up140(db) {
15999
15988
  db.exec(`
16000
15989
  CREATE TABLE IF NOT EXISTS memory_head_publications (
16001
15990
  agent_id TEXT NOT NULL,
@@ -16013,7 +16002,7 @@ function up139(db) {
16013
16002
  }
16014
16003
 
16015
16004
  // src/migrations/136-memory-head-revisions.ts
16016
- function up140(db) {
16005
+ function up141(db) {
16017
16006
  const cols = new Set(db.prepare("PRAGMA table_info(memory_head_revisions)").all().map((r) => r.name));
16018
16007
  for (const [name, type] of [
16019
16008
  ["entry_id", "TEXT"],
@@ -16029,7 +16018,7 @@ function up140(db) {
16029
16018
  }
16030
16019
 
16031
16020
  // src/migrations/137-dreaming-head-manifest.ts
16032
- function up141(db) {
16021
+ function up142(db) {
16033
16022
  const cols = new Set(db.prepare("PRAGMA table_info(dreaming_passes)").all().map((r) => r.name));
16034
16023
  for (const [name, type] of [
16035
16024
  ["head_revision", "INTEGER"],
@@ -16053,7 +16042,7 @@ function addColumnIfMissing28(db, table, column, definition) {
16053
16042
  if (!hasColumn25(db, table, column))
16054
16043
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16055
16044
  }
16056
- function up142(db) {
16045
+ function up143(db) {
16057
16046
  addColumnIfMissing28(db, "memories", "manual_override", "INTEGER DEFAULT 0");
16058
16047
  db.exec(`
16059
16048
  CREATE TABLE IF NOT EXISTS transcript_capture_status (
@@ -16360,7 +16349,7 @@ function up142(db) {
16360
16349
  }
16361
16350
 
16362
16351
  // src/migrations/139-native-source-sync-state.ts
16363
- function up143(db) {
16352
+ function up144(db) {
16364
16353
  db.exec(`
16365
16354
  CREATE TABLE IF NOT EXISTS native_source_sync_state (
16366
16355
  agent_id TEXT NOT NULL,
@@ -16378,7 +16367,7 @@ function up143(db) {
16378
16367
  }
16379
16368
 
16380
16369
  // src/migrations/140-transcript-recovery-frontier.ts
16381
- function up144(db) {
16370
+ function up145(db) {
16382
16371
  db.exec(`
16383
16372
  CREATE TABLE IF NOT EXISTS transcript_recovery_frontiers (
16384
16373
  agent_id TEXT NOT NULL,
@@ -16392,7 +16381,7 @@ function up144(db) {
16392
16381
  }
16393
16382
 
16394
16383
  // src/migrations/141-source-sync-checkpoints.ts
16395
- function up145(db) {
16384
+ function up146(db) {
16396
16385
  db.exec(`
16397
16386
  CREATE TABLE IF NOT EXISTS source_sync_checkpoints (
16398
16387
  agent_id TEXT NOT NULL,
@@ -16408,7 +16397,7 @@ function up145(db) {
16408
16397
  }
16409
16398
 
16410
16399
  // src/migrations/142-source-sync-frontier.ts
16411
- function up146(db) {
16400
+ function up147(db) {
16412
16401
  const columns = db.prepare("PRAGMA table_info(source_sync_checkpoints)").all();
16413
16402
  if (!columns.some((column) => column.name === "frontier")) {
16414
16403
  db.exec("ALTER TABLE source_sync_checkpoints ADD COLUMN frontier TEXT");
@@ -16416,7 +16405,7 @@ function up146(db) {
16416
16405
  }
16417
16406
 
16418
16407
  // src/migrations/143-embedding-index-progress.ts
16419
- function up147(db) {
16408
+ function up148(db) {
16420
16409
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_index_state)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16421
16410
  const additions = [
16422
16411
  ["migration_phase", "TEXT"],
@@ -16453,7 +16442,7 @@ function up147(db) {
16453
16442
  }
16454
16443
 
16455
16444
  // src/migrations/144-memory-job-lease-token.ts
16456
- function up148(db) {
16445
+ function up149(db) {
16457
16446
  const columns = new Set(db.prepare("PRAGMA table_info(memory_jobs)").all().map((row) => row.name).filter((name) => typeof name === "string"));
16458
16447
  if (!columns.has("lease_token")) {
16459
16448
  db.exec("ALTER TABLE memory_jobs ADD COLUMN lease_token TEXT");
@@ -16461,7 +16450,7 @@ function up148(db) {
16461
16450
  }
16462
16451
 
16463
16452
  // src/migrations/145-dreaming-evidence-reviews.ts
16464
- function up149(db) {
16453
+ function up150(db) {
16465
16454
  db.exec(`
16466
16455
  CREATE TABLE IF NOT EXISTS dreaming_evidence_reviews (
16467
16456
  agent_id TEXT NOT NULL,
@@ -16481,7 +16470,7 @@ function up149(db) {
16481
16470
  }
16482
16471
 
16483
16472
  // src/migrations/146-source-transcript-import.ts
16484
- function up150(db) {
16473
+ function up151(db) {
16485
16474
  db.exec(`
16486
16475
  CREATE TABLE IF NOT EXISTS source_import_jobs (
16487
16476
  id TEXT PRIMARY KEY, kind TEXT NOT NULL CHECK (kind = 'import'), agent_id TEXT NOT NULL,
@@ -16550,12 +16539,12 @@ function up150(db) {
16550
16539
  }
16551
16540
 
16552
16541
  // src/migrations/147-source-import-replay-file-slots.ts
16553
- function up151(db) {
16542
+ function up152(db) {
16554
16543
  db.exec("CREATE INDEX IF NOT EXISTS idx_source_import_files_job_state ON source_import_files(job_id, state)");
16555
16544
  }
16556
16545
 
16557
16546
  // src/migrations/148-source-import-attempt-provenance.ts
16558
- function up152(db) {
16547
+ function up153(db) {
16559
16548
  const columns = db.prepare("PRAGMA table_info(source_import_record_attempts)").all();
16560
16549
  if (!columns.some((column) => column.name === "source_id")) {
16561
16550
  db.exec("ALTER TABLE source_import_record_attempts ADD COLUMN source_id TEXT");
@@ -16563,7 +16552,7 @@ function up152(db) {
16563
16552
  }
16564
16553
 
16565
16554
  // src/migrations/149-transcript-import-state-machine.ts
16566
- function up153(db) {
16555
+ function up154(db) {
16567
16556
  const addColumn = (table, column, definition) => {
16568
16557
  const statement = db.prepare("SELECT 1 AS found FROM pragma_table_info(?) WHERE name = ?");
16569
16558
  let exists;
@@ -16586,7 +16575,7 @@ function addColumnIfMissing29(db, table, column, definition) {
16586
16575
  if (!columns.some((row) => row.name === column))
16587
16576
  db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
16588
16577
  }
16589
- function up154(db) {
16578
+ function up155(db) {
16590
16579
  addColumnIfMissing29(db, "memory_md_heads", "is_current", "INTEGER NOT NULL DEFAULT 0");
16591
16580
  addColumnIfMissing29(db, "dreaming_passes", "head_base_revision", "INTEGER");
16592
16581
  db.exec("CREATE INDEX IF NOT EXISTS idx_memory_head_revisions_content_hash ON memory_head_revisions(content_hash)");
@@ -16738,7 +16727,7 @@ function up154(db) {
16738
16727
  }
16739
16728
 
16740
16729
  // src/migrations/153-vector-repair-checkpoints.ts
16741
- function up155(db) {
16730
+ function up156(db) {
16742
16731
  db.exec(`
16743
16732
  CREATE TABLE IF NOT EXISTS vector_repair_checkpoints (
16744
16733
  operation TEXT NOT NULL CHECK (operation IN ('resync', 'clean-orphans')),
@@ -16765,7 +16754,7 @@ function up155(db) {
16765
16754
  }
16766
16755
 
16767
16756
  // src/migrations/156-embedding-repair-checkpoints.ts
16768
- function up156(db) {
16757
+ function up157(db) {
16769
16758
  db.exec(`
16770
16759
  CREATE TABLE IF NOT EXISTS embedding_repair_checkpoints (
16771
16760
  checkpoint_id TEXT PRIMARY KEY,
@@ -16788,7 +16777,7 @@ function up156(db) {
16788
16777
  }
16789
16778
 
16790
16779
  // src/migrations/157-embedding-repair-progress.ts
16791
- function up157(db) {
16780
+ function up158(db) {
16792
16781
  const columns = new Set(db.prepare("PRAGMA table_info(embedding_repair_checkpoints)").all().map((row) => row.name));
16793
16782
  if (!columns.has("profile_fingerprint")) {
16794
16783
  db.exec("ALTER TABLE embedding_repair_checkpoints ADD COLUMN profile_fingerprint TEXT");
@@ -16805,7 +16794,7 @@ function up157(db) {
16805
16794
  }
16806
16795
 
16807
16796
  // src/migrations/158-dreaming-candidate-scan-index.ts
16808
- function up158(db) {
16797
+ function up159(db) {
16809
16798
  db.exec(`
16810
16799
  CREATE INDEX IF NOT EXISTS idx_memories_agent_kind
16811
16800
  ON memories(agent_id, memory_kind);
@@ -16817,13 +16806,13 @@ var MIGRATIONS = [
16817
16806
  {
16818
16807
  version: 1,
16819
16808
  name: "baseline",
16820
- up: up5,
16809
+ up: up6,
16821
16810
  artifacts: { tables: ["memories", "conversations", "embeddings"] }
16822
16811
  },
16823
16812
  {
16824
16813
  version: 2,
16825
16814
  name: "pipeline-v2",
16826
- up: up6,
16815
+ up: up7,
16827
16816
  artifacts: {
16828
16817
  tables: ["memory_history", "memory_jobs", "entities", "relations", "memory_entity_mentions"]
16829
16818
  }
@@ -16831,12 +16820,12 @@ var MIGRATIONS = [
16831
16820
  {
16832
16821
  version: 3,
16833
16822
  name: "unique-content-hash",
16834
- up: up7
16823
+ up: up8
16835
16824
  },
16836
16825
  {
16837
16826
  version: 4,
16838
16827
  name: "history-actor-and-retention",
16839
- up: up8,
16828
+ up: up9,
16840
16829
  artifacts: {
16841
16830
  columns: [{ table: "memory_history", column: "actor_type" }]
16842
16831
  }
@@ -16844,7 +16833,7 @@ var MIGRATIONS = [
16844
16833
  {
16845
16834
  version: 5,
16846
16835
  name: "graph-extended",
16847
- up: up9,
16836
+ up: up10,
16848
16837
  artifacts: {
16849
16838
  columns: [{ table: "entities", column: "canonical_name" }]
16850
16839
  }
@@ -16852,7 +16841,7 @@ var MIGRATIONS = [
16852
16841
  {
16853
16842
  version: 6,
16854
16843
  name: "idempotency-key",
16855
- up: up10,
16844
+ up: up11,
16856
16845
  artifacts: {
16857
16846
  columns: [{ table: "memories", column: "idempotency_key" }]
16858
16847
  }
@@ -16860,42 +16849,42 @@ var MIGRATIONS = [
16860
16849
  {
16861
16850
  version: 7,
16862
16851
  name: "documents-and-connectors",
16863
- up: up11,
16852
+ up: up12,
16864
16853
  artifacts: { tables: ["documents", "document_memories", "connectors"] }
16865
16854
  },
16866
16855
  {
16867
16856
  version: 8,
16868
16857
  name: "embeddings-unique-hash",
16869
- up: up12
16858
+ up: up13
16870
16859
  },
16871
16860
  {
16872
16861
  version: 9,
16873
16862
  name: "summary-jobs",
16874
- up: up13,
16863
+ up: up14,
16875
16864
  artifacts: { tables: ["summary_jobs"] }
16876
16865
  },
16877
16866
  {
16878
16867
  version: 10,
16879
16868
  name: "umap-cache",
16880
- up: up14,
16869
+ up: up15,
16881
16870
  artifacts: { tables: ["umap_cache"] }
16882
16871
  },
16883
16872
  {
16884
16873
  version: 11,
16885
16874
  name: "session-scores",
16886
- up: up15,
16875
+ up: up16,
16887
16876
  artifacts: { tables: ["session_scores"] }
16888
16877
  },
16889
16878
  {
16890
16879
  version: 12,
16891
16880
  name: "scheduled-tasks",
16892
- up: up16,
16881
+ up: up17,
16893
16882
  artifacts: { tables: ["scheduled_tasks", "task_runs"] }
16894
16883
  },
16895
16884
  {
16896
16885
  version: 13,
16897
16886
  name: "ingestion-tracking",
16898
- up: up17,
16887
+ up: up18,
16899
16888
  artifacts: {
16900
16889
  columns: [
16901
16890
  { table: "memories", column: "source_path" },
@@ -16906,13 +16895,13 @@ var MIGRATIONS = [
16906
16895
  {
16907
16896
  version: 14,
16908
16897
  name: "telemetry",
16909
- up: up18,
16898
+ up: up19,
16910
16899
  artifacts: { tables: ["telemetry_events"] }
16911
16900
  },
16912
16901
  {
16913
16902
  version: 15,
16914
16903
  name: "session-memories",
16915
- up: up19,
16904
+ up: up20,
16916
16905
  artifacts: {
16917
16906
  tables: ["session_memories"],
16918
16907
  columns: [
@@ -16924,13 +16913,13 @@ var MIGRATIONS = [
16924
16913
  {
16925
16914
  version: 16,
16926
16915
  name: "session-checkpoints",
16927
- up: up20,
16916
+ up: up21,
16928
16917
  artifacts: { tables: ["session_checkpoints"] }
16929
16918
  },
16930
16919
  {
16931
16920
  version: 17,
16932
16921
  name: "task-skills",
16933
- up: up21,
16922
+ up: up22,
16934
16923
  artifacts: {
16935
16924
  columns: [{ table: "scheduled_tasks", column: "skill_name" }]
16936
16925
  }
@@ -16938,13 +16927,13 @@ var MIGRATIONS = [
16938
16927
  {
16939
16928
  version: 18,
16940
16929
  name: "skill-meta",
16941
- up: up22,
16930
+ up: up23,
16942
16931
  artifacts: { tables: ["skill_meta"] }
16943
16932
  },
16944
16933
  {
16945
16934
  version: 19,
16946
16935
  name: "knowledge-structure",
16947
- up: up23,
16936
+ up: up24,
16948
16937
  artifacts: {
16949
16938
  tables: ["entity_aspects", "entity_attributes", "entity_dependencies", "task_meta"],
16950
16939
  columns: [{ table: "entities", column: "agent_id" }]
@@ -16953,7 +16942,7 @@ var MIGRATIONS = [
16953
16942
  {
16954
16943
  version: 20,
16955
16944
  name: "session-structural-columns",
16956
- up: up24,
16945
+ up: up25,
16957
16946
  artifacts: {
16958
16947
  columns: [
16959
16948
  { table: "session_memories", column: "entity_slot" },
@@ -16966,7 +16955,7 @@ var MIGRATIONS = [
16966
16955
  {
16967
16956
  version: 21,
16968
16957
  name: "checkpoint-structural",
16969
- up: up25,
16958
+ up: up26,
16970
16959
  artifacts: {
16971
16960
  columns: [{ table: "session_checkpoints", column: "focal_entity_ids" }]
16972
16961
  }
@@ -16974,7 +16963,7 @@ var MIGRATIONS = [
16974
16963
  {
16975
16964
  version: 22,
16976
16965
  name: "entity-pinning",
16977
- up: up26,
16966
+ up: up27,
16978
16967
  artifacts: {
16979
16968
  columns: [
16980
16969
  { table: "entities", column: "pinned" },
@@ -16985,17 +16974,17 @@ var MIGRATIONS = [
16985
16974
  {
16986
16975
  version: 23,
16987
16976
  name: "retired-scorer-gap",
16988
- up: up27
16977
+ up: up28
16989
16978
  },
16990
16979
  {
16991
16980
  version: 24,
16992
16981
  name: "retired-scorer-gap",
16993
- up: up28
16982
+ up: up29
16994
16983
  },
16995
16984
  {
16996
16985
  version: 25,
16997
16986
  name: "agent-feedback",
16998
- up: up29,
16987
+ up: up30,
16999
16988
  artifacts: {
17000
16989
  columns: [{ table: "session_memories", column: "agent_relevance_score" }]
17001
16990
  }
@@ -17003,32 +16992,32 @@ var MIGRATIONS = [
17003
16992
  {
17004
16993
  version: 26,
17005
16994
  name: "retired-scorer-gap",
17006
- up: up30
16995
+ up: up31
17007
16996
  },
17008
16997
  {
17009
16998
  version: 27,
17010
16999
  name: "backfill-canonical-names",
17011
- up: up31
17000
+ up: up32
17012
17001
  },
17013
17002
  {
17014
17003
  version: 28,
17015
17004
  name: "lossless-retention",
17016
- up: up32
17005
+ up: up33
17017
17006
  },
17018
17007
  {
17019
17008
  version: 29,
17020
17009
  name: "session-summary-dag",
17021
- up: up33
17010
+ up: up34
17022
17011
  },
17023
17012
  {
17024
17013
  version: 30,
17025
17014
  name: "nullable-memory-job-memory-id",
17026
- up: up34
17015
+ up: up35
17027
17016
  },
17028
17017
  {
17029
17018
  version: 31,
17030
17019
  name: "dependency-reason",
17031
- up: up35,
17020
+ up: up36,
17032
17021
  artifacts: {
17033
17022
  columns: [
17034
17023
  { table: "entity_dependencies", column: "reason" },
@@ -17039,7 +17028,7 @@ var MIGRATIONS = [
17039
17028
  {
17040
17029
  version: 32,
17041
17030
  name: "embeddings-vector-column",
17042
- up: up36,
17031
+ up: up37,
17043
17032
  artifacts: {
17044
17033
  columns: [{ table: "embeddings", column: "vector", optional: true }]
17045
17034
  }
@@ -17047,7 +17036,7 @@ var MIGRATIONS = [
17047
17036
  {
17048
17037
  version: 33,
17049
17038
  name: "scope",
17050
- up: up37,
17039
+ up: up38,
17051
17040
  artifacts: {
17052
17041
  columns: [{ table: "memories", column: "scope" }]
17053
17042
  }
@@ -17055,17 +17044,17 @@ var MIGRATIONS = [
17055
17044
  {
17056
17045
  version: 34,
17057
17046
  name: "scope-aware-dedup",
17058
- up: up38
17047
+ up: up39
17059
17048
  },
17060
17049
  {
17061
17050
  version: 35,
17062
17051
  name: "entity-fts",
17063
- up: up39
17052
+ up: up40
17064
17053
  },
17065
17054
  {
17066
17055
  version: 36,
17067
17056
  name: "dependency-confidence",
17068
- up: up40,
17057
+ up: up41,
17069
17058
  artifacts: {
17070
17059
  columns: [{ table: "entity_dependencies", column: "confidence" }]
17071
17060
  }
@@ -17073,7 +17062,7 @@ var MIGRATIONS = [
17073
17062
  {
17074
17063
  version: 37,
17075
17064
  name: "entity-communities",
17076
- up: up41,
17065
+ up: up42,
17077
17066
  artifacts: {
17078
17067
  tables: ["entity_communities"],
17079
17068
  columns: [{ table: "entities", column: "community_id" }]
@@ -17082,24 +17071,24 @@ var MIGRATIONS = [
17082
17071
  {
17083
17072
  version: 38,
17084
17073
  name: "memory-hints",
17085
- up: up42,
17074
+ up: up43,
17086
17075
  artifacts: { tables: ["memory_hints"] }
17087
17076
  },
17088
17077
  {
17089
17078
  version: 39,
17090
17079
  name: "dedup-entity-dependencies",
17091
- up: up43
17080
+ up: up44
17092
17081
  },
17093
17082
  {
17094
17083
  version: 40,
17095
17084
  name: "session-transcripts",
17096
- up: up44,
17085
+ up: up45,
17097
17086
  artifacts: { tables: ["session_transcripts"] }
17098
17087
  },
17099
17088
  {
17100
17089
  version: 41,
17101
17090
  name: "path-feedback",
17102
- up: up45,
17091
+ up: up46,
17103
17092
  artifacts: {
17104
17093
  tables: [
17105
17094
  "path_feedback_events",
@@ -17114,7 +17103,7 @@ var MIGRATIONS = [
17114
17103
  {
17115
17104
  version: 42,
17116
17105
  name: "session-memories-agent-id",
17117
- up: up46,
17106
+ up: up47,
17118
17107
  artifacts: {
17119
17108
  columns: [{ table: "session_memories", column: "agent_id" }]
17120
17109
  }
@@ -17122,7 +17111,7 @@ var MIGRATIONS = [
17122
17111
  {
17123
17112
  version: 43,
17124
17113
  name: "agents-table",
17125
- up: up47,
17114
+ up: up48,
17126
17115
  artifacts: {
17127
17116
  tables: ["agents"],
17128
17117
  columns: [
@@ -17134,7 +17123,7 @@ var MIGRATIONS = [
17134
17123
  {
17135
17124
  version: 44,
17136
17125
  name: "memory-md-temporal-head",
17137
- up: up48,
17126
+ up: up49,
17138
17127
  artifacts: {
17139
17128
  columns: [
17140
17129
  { table: "session_summaries", column: "source_type" },
@@ -17146,7 +17135,7 @@ var MIGRATIONS = [
17146
17135
  {
17147
17136
  version: 45,
17148
17137
  name: "lossless-working-memory-hardening",
17149
- up: up49,
17138
+ up: up50,
17150
17139
  artifacts: {
17151
17140
  tables: ["session_transcripts_fts", "memory_md_heads"],
17152
17141
  columns: [
@@ -17159,17 +17148,17 @@ var MIGRATIONS = [
17159
17148
  {
17160
17149
  version: 46,
17161
17150
  name: "session-summary-uniqueness",
17162
- up: up50
17151
+ up: up51
17163
17152
  },
17164
17153
  {
17165
17154
  version: 47,
17166
17155
  name: "agent-scoped-temporal-uniqueness",
17167
- up: up51
17156
+ up: up52
17168
17157
  },
17169
17158
  {
17170
17159
  version: 48,
17171
17160
  name: "thread-heads",
17172
- up: up52,
17161
+ up: up53,
17173
17162
  artifacts: {
17174
17163
  tables: ["memory_thread_heads"]
17175
17164
  }
@@ -17177,7 +17166,7 @@ var MIGRATIONS = [
17177
17166
  {
17178
17167
  version: 49,
17179
17168
  name: "session-extract-cursors",
17180
- up: up53,
17169
+ up: up54,
17181
17170
  artifacts: {
17182
17171
  tables: ["session_extract_cursors"]
17183
17172
  }
@@ -17185,7 +17174,7 @@ var MIGRATIONS = [
17185
17174
  {
17186
17175
  version: 50,
17187
17176
  name: "related-to-audit",
17188
- up: up54,
17177
+ up: up55,
17189
17178
  artifacts: {
17190
17179
  tables: ["entity_dependency_history"]
17191
17180
  }
@@ -17193,7 +17182,7 @@ var MIGRATIONS = [
17193
17182
  {
17194
17183
  version: 51,
17195
17184
  name: "memory-md-rolling-window-lineage",
17196
- up: up55,
17185
+ up: up56,
17197
17186
  artifacts: {
17198
17187
  tables: ["memory_artifacts", "memory_artifact_tombstones", "memory_artifacts_fts"],
17199
17188
  columns: [
@@ -17208,15 +17197,12 @@ var MIGRATIONS = [
17208
17197
  {
17209
17198
  version: 52,
17210
17199
  name: "mcp-invocations",
17211
- up: up56,
17212
- artifacts: {
17213
- tables: ["mcp_invocations"]
17214
- }
17200
+ up: up57
17215
17201
  },
17216
17202
  {
17217
17203
  version: 53,
17218
17204
  name: "skill-invocations",
17219
- up: up57,
17205
+ up: up58,
17220
17206
  artifacts: {
17221
17207
  tables: ["skill_invocations"]
17222
17208
  }
@@ -17224,7 +17210,7 @@ var MIGRATIONS = [
17224
17210
  {
17225
17211
  version: 54,
17226
17212
  name: "task-agent-scope",
17227
- up: up58,
17213
+ up: up59,
17228
17214
  artifacts: {
17229
17215
  tables: ["task_scope_hints"]
17230
17216
  }
@@ -17232,7 +17218,7 @@ var MIGRATIONS = [
17232
17218
  {
17233
17219
  version: 55,
17234
17220
  name: "dreaming-state",
17235
- up: up59,
17221
+ up: up60,
17236
17222
  artifacts: {
17237
17223
  tables: ["dreaming_state", "dreaming_passes"]
17238
17224
  }
@@ -17240,22 +17226,22 @@ var MIGRATIONS = [
17240
17226
  {
17241
17227
  version: 56,
17242
17228
  name: "agent-scoped-content-hash",
17243
- up: up60
17229
+ up: up61
17244
17230
  },
17245
17231
  {
17246
17232
  version: 57,
17247
17233
  name: "memories-fts-tokenizer-repair",
17248
- up: up61
17234
+ up: up62
17249
17235
  },
17250
17236
  {
17251
17237
  version: 58,
17252
17238
  name: "knowledge-graph-indices",
17253
- up: up62
17239
+ up: up63
17254
17240
  },
17255
17241
  {
17256
17242
  version: 59,
17257
17243
  name: "entity-attribute-claim-key",
17258
- up: up63,
17244
+ up: up64,
17259
17245
  artifacts: {
17260
17246
  columns: [{ table: "entity_attributes", column: "claim_key" }]
17261
17247
  }
@@ -17263,7 +17249,7 @@ var MIGRATIONS = [
17263
17249
  {
17264
17250
  version: 60,
17265
17251
  name: "entity-attribute-group-key",
17266
- up: up64,
17252
+ up: up65,
17267
17253
  artifacts: {
17268
17254
  columns: [{ table: "entity_attributes", column: "group_key" }]
17269
17255
  }
@@ -17271,7 +17257,7 @@ var MIGRATIONS = [
17271
17257
  {
17272
17258
  version: 61,
17273
17259
  name: "memory-artifact-source-mtime",
17274
- up: up65,
17260
+ up: up66,
17275
17261
  artifacts: {
17276
17262
  columns: [{ table: "memory_artifacts", column: "source_mtime_ms" }]
17277
17263
  }
@@ -17279,7 +17265,7 @@ var MIGRATIONS = [
17279
17265
  {
17280
17266
  version: 62,
17281
17267
  name: "memory-artifact-soft-delete",
17282
- up: up66,
17268
+ up: up67,
17283
17269
  artifacts: {
17284
17270
  columns: [
17285
17271
  { table: "memory_artifacts", column: "is_deleted" },
@@ -17290,12 +17276,12 @@ var MIGRATIONS = [
17290
17276
  {
17291
17277
  version: 63,
17292
17278
  name: "content-only-memories-fts-update",
17293
- up: up67
17279
+ up: up68
17294
17280
  },
17295
17281
  {
17296
17282
  version: 64,
17297
17283
  name: "source-graph-provenance",
17298
- up: up68,
17284
+ up: up69,
17299
17285
  artifacts: {
17300
17286
  columns: [
17301
17287
  { table: "entities", column: "source_path" },
@@ -17308,7 +17294,7 @@ var MIGRATIONS = [
17308
17294
  {
17309
17295
  version: 65,
17310
17296
  name: "source-embedding-agent-scope",
17311
- up: up69,
17297
+ up: up70,
17312
17298
  artifacts: {
17313
17299
  columns: [{ table: "embeddings", column: "agent_id", optional: true }]
17314
17300
  }
@@ -17316,7 +17302,7 @@ var MIGRATIONS = [
17316
17302
  {
17317
17303
  version: 66,
17318
17304
  name: "memory-search-telemetry",
17319
- up: up70,
17305
+ up: up71,
17320
17306
  artifacts: {
17321
17307
  tables: ["memory_search_telemetry"]
17322
17308
  }
@@ -17324,7 +17310,7 @@ var MIGRATIONS = [
17324
17310
  {
17325
17311
  version: 67,
17326
17312
  name: "ontology-proposals",
17327
- up: up71,
17313
+ up: up72,
17328
17314
  artifacts: {
17329
17315
  tables: ["ontology_proposals"],
17330
17316
  columns: [
@@ -17338,7 +17324,7 @@ var MIGRATIONS = [
17338
17324
  {
17339
17325
  version: 68,
17340
17326
  name: "daily-reflections",
17341
- up: up72,
17327
+ up: up73,
17342
17328
  artifacts: {
17343
17329
  tables: ["daily_reflections"]
17344
17330
  }
@@ -17346,7 +17332,7 @@ var MIGRATIONS = [
17346
17332
  {
17347
17333
  version: 69,
17348
17334
  name: "daily-reflections-multiple-insights",
17349
- up: up73,
17335
+ up: up74,
17350
17336
  artifacts: {
17351
17337
  tables: ["daily_reflections"]
17352
17338
  }
@@ -17354,7 +17340,7 @@ var MIGRATIONS = [
17354
17340
  {
17355
17341
  version: 70,
17356
17342
  name: "ontology-control-plane-state",
17357
- up: up74,
17343
+ up: up75,
17358
17344
  artifacts: {
17359
17345
  columns: [
17360
17346
  { table: "entities", column: "status" },
@@ -17369,7 +17355,7 @@ var MIGRATIONS = [
17369
17355
  {
17370
17356
  version: 71,
17371
17357
  name: "epistemic-assertions",
17372
- up: up75,
17358
+ up: up76,
17373
17359
  artifacts: {
17374
17360
  tables: ["epistemic_assertions"]
17375
17361
  }
@@ -17377,7 +17363,7 @@ var MIGRATIONS = [
17377
17363
  {
17378
17364
  version: 72,
17379
17365
  name: "agent-scoped-idempotency-key",
17380
- up: up76,
17366
+ up: up77,
17381
17367
  artifacts: {
17382
17368
  columns: [
17383
17369
  { table: "memories", column: "idempotency_key" },
@@ -17388,7 +17374,7 @@ var MIGRATIONS = [
17388
17374
  {
17389
17375
  version: 73,
17390
17376
  name: "recall-context-dedupe",
17391
- up: up77,
17377
+ up: up78,
17392
17378
  artifacts: {
17393
17379
  tables: ["session_context_epochs", "session_recall_events"]
17394
17380
  }
@@ -17396,7 +17382,7 @@ var MIGRATIONS = [
17396
17382
  {
17397
17383
  version: 74,
17398
17384
  name: "aggregate-memory-links",
17399
- up: up78,
17385
+ up: up79,
17400
17386
  artifacts: {
17401
17387
  tables: ["aggregate_memory_sources"]
17402
17388
  }
@@ -17404,7 +17390,7 @@ var MIGRATIONS = [
17404
17390
  {
17405
17391
  version: 75,
17406
17392
  name: "memory-artifact-source-provenance",
17407
- up: up79,
17393
+ up: up80,
17408
17394
  artifacts: {
17409
17395
  columns: [
17410
17396
  { table: "memory_artifacts", column: "source_id" },
@@ -17418,7 +17404,7 @@ var MIGRATIONS = [
17418
17404
  {
17419
17405
  version: 76,
17420
17406
  name: "temporal-edges",
17421
- up: up80,
17407
+ up: up81,
17422
17408
  artifacts: {
17423
17409
  tables: ["temporal_edges"]
17424
17410
  }
@@ -17426,7 +17412,7 @@ var MIGRATIONS = [
17426
17412
  {
17427
17413
  version: 77,
17428
17414
  name: "entity-aliases",
17429
- up: up81,
17415
+ up: up82,
17430
17416
  artifacts: {
17431
17417
  tables: ["entity_aliases"]
17432
17418
  }
@@ -17434,7 +17420,7 @@ var MIGRATIONS = [
17434
17420
  {
17435
17421
  version: 78,
17436
17422
  name: "api-keys",
17437
- up: up82,
17423
+ up: up83,
17438
17424
  artifacts: {
17439
17425
  tables: ["api_keys"]
17440
17426
  }
@@ -17442,7 +17428,7 @@ var MIGRATIONS = [
17442
17428
  {
17443
17429
  version: 79,
17444
17430
  name: "transcript-capture-jobs",
17445
- up: up83,
17431
+ up: up84,
17446
17432
  artifacts: {
17447
17433
  tables: ["transcript_capture_jobs"]
17448
17434
  }
@@ -17450,7 +17436,7 @@ var MIGRATIONS = [
17450
17436
  {
17451
17437
  version: 80,
17452
17438
  name: "document-scope-columns",
17453
- up: up84,
17439
+ up: up85,
17454
17440
  artifacts: {
17455
17441
  columns: [
17456
17442
  { table: "documents", column: "agent_id" },
@@ -17461,7 +17447,7 @@ var MIGRATIONS = [
17461
17447
  {
17462
17448
  version: 81,
17463
17449
  name: "aggregate-evidence-sources",
17464
- up: up85,
17450
+ up: up86,
17465
17451
  artifacts: {
17466
17452
  tables: ["aggregate_evidence_sources"]
17467
17453
  }
@@ -17469,7 +17455,7 @@ var MIGRATIONS = [
17469
17455
  {
17470
17456
  version: 82,
17471
17457
  name: "skill-invocations-harness",
17472
- up: up86,
17458
+ up: up87,
17473
17459
  artifacts: {
17474
17460
  columns: [
17475
17461
  { table: "skill_invocations", column: "harness" },
@@ -17480,7 +17466,7 @@ var MIGRATIONS = [
17480
17466
  {
17481
17467
  version: 83,
17482
17468
  name: "memory-lifecycle-repair",
17483
- up: up87,
17469
+ up: up88,
17484
17470
  artifacts: {
17485
17471
  tables: ["transcript_capture_jobs", "aggregate_evidence_sources", "entity_dependencies"],
17486
17472
  columns: [
@@ -17495,7 +17481,7 @@ var MIGRATIONS = [
17495
17481
  {
17496
17482
  version: 84,
17497
17483
  name: "legacy-markdown-import-state",
17498
- up: up88,
17484
+ up: up89,
17499
17485
  artifacts: {
17500
17486
  tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
17501
17487
  }
@@ -17503,7 +17489,7 @@ var MIGRATIONS = [
17503
17489
  {
17504
17490
  version: 85,
17505
17491
  name: "backfill-relations-to-dependencies",
17506
- up: up89,
17492
+ up: up90,
17507
17493
  artifacts: {
17508
17494
  tables: ["entity_dependencies"]
17509
17495
  }
@@ -17511,7 +17497,7 @@ var MIGRATIONS = [
17511
17497
  {
17512
17498
  version: 86,
17513
17499
  name: "summary-jobs-content-hash",
17514
- up: up90,
17500
+ up: up91,
17515
17501
  artifacts: {
17516
17502
  columns: [{ table: "summary_jobs", column: "content_hash" }]
17517
17503
  }
@@ -17519,7 +17505,7 @@ var MIGRATIONS = [
17519
17505
  {
17520
17506
  version: 87,
17521
17507
  name: "summary-jobs-boundary-reason",
17522
- up: up91,
17508
+ up: up92,
17523
17509
  artifacts: {
17524
17510
  columns: [{ table: "summary_jobs", column: "boundary_reason" }]
17525
17511
  }
@@ -17527,7 +17513,7 @@ var MIGRATIONS = [
17527
17513
  {
17528
17514
  version: 88,
17529
17515
  name: "transcript-recovery-files",
17530
- up: up92,
17516
+ up: up93,
17531
17517
  artifacts: {
17532
17518
  tables: ["transcript_recovery_files"]
17533
17519
  }
@@ -17535,7 +17521,7 @@ var MIGRATIONS = [
17535
17521
  {
17536
17522
  version: 89,
17537
17523
  name: "job-cancellations",
17538
- up: up93,
17524
+ up: up94,
17539
17525
  artifacts: {
17540
17526
  tables: ["job_cancellations"]
17541
17527
  }
@@ -17543,7 +17529,7 @@ var MIGRATIONS = [
17543
17529
  {
17544
17530
  version: 90,
17545
17531
  name: "job-archive",
17546
- up: up94,
17532
+ up: up95,
17547
17533
  artifacts: {
17548
17534
  tables: ["job_archive"]
17549
17535
  }
@@ -17551,25 +17537,25 @@ var MIGRATIONS = [
17551
17537
  {
17552
17538
  version: 91,
17553
17539
  name: "embedding-index-generations",
17554
- up: up95,
17540
+ up: up96,
17555
17541
  artifacts: { tables: ["embedding_index_state"] }
17556
17542
  },
17557
17543
  {
17558
17544
  version: 92,
17559
17545
  name: "embedding-staging-store",
17560
- up: up96,
17546
+ up: up97,
17561
17547
  artifacts: { tables: ["embeddings_staging"] }
17562
17548
  },
17563
17549
  {
17564
17550
  version: 93,
17565
17551
  name: "dreaming-evidence-cursor",
17566
- up: up97,
17552
+ up: up98,
17567
17553
  artifacts: { columns: [{ table: "dreaming_state", column: "evidence_cursor" }] }
17568
17554
  },
17569
17555
  {
17570
17556
  version: 94,
17571
17557
  name: "memory-kind",
17572
- up: up98,
17558
+ up: up99,
17573
17559
  artifacts: {
17574
17560
  columns: [
17575
17561
  { table: "memories", column: "memory_kind" },
@@ -17580,35 +17566,35 @@ var MIGRATIONS = [
17580
17566
  {
17581
17567
  version: 95,
17582
17568
  name: "compaction-recall-projections",
17583
- up: up99
17569
+ up: up100
17584
17570
  },
17585
17571
  {
17586
17572
  version: 96,
17587
17573
  name: "retire-legacy-ingestion",
17588
- up: up100
17574
+ up: up101
17589
17575
  },
17590
17576
  {
17591
17577
  version: 97,
17592
17578
  name: "dreaming-failure-backoff",
17593
- up: up101,
17579
+ up: up102,
17594
17580
  artifacts: { columns: [{ table: "dreaming_state", column: "last_failure_at" }] }
17595
17581
  },
17596
17582
  {
17597
17583
  version: 98,
17598
17584
  name: "dreaming-evidence-exclusions",
17599
- up: up102,
17585
+ up: up103,
17600
17586
  artifacts: { tables: ["dreaming_evidence_exclusions"] }
17601
17587
  },
17602
17588
  {
17603
17589
  version: 99,
17604
17590
  name: "dreaming-tool-calls",
17605
- up: up103,
17591
+ up: up104,
17606
17592
  artifacts: { tables: ["dreaming_tool_calls"] }
17607
17593
  },
17608
17594
  {
17609
17595
  version: 100,
17610
17596
  name: "dreaming-runbook",
17611
- up: up104,
17597
+ up: up105,
17612
17598
  artifacts: {
17613
17599
  columns: [
17614
17600
  { table: "dreaming_passes", column: "evidence_window_json" },
@@ -17619,23 +17605,23 @@ var MIGRATIONS = [
17619
17605
  {
17620
17606
  version: 101,
17621
17607
  name: "dreaming-attention",
17622
- up: up105,
17608
+ up: up106,
17623
17609
  artifacts: { tables: ["dreaming_attention"] }
17624
17610
  },
17625
17611
  {
17626
17612
  version: 102,
17627
17613
  name: "attribute-semantic-memories",
17628
- up: up106
17614
+ up: up107
17629
17615
  },
17630
17616
  {
17631
17617
  version: 103,
17632
17618
  name: "semantic-memory-kind",
17633
- up: up107
17619
+ up: up108
17634
17620
  },
17635
17621
  {
17636
17622
  version: 104,
17637
17623
  name: "derived-memory-provenance",
17638
- up: up108,
17624
+ up: up109,
17639
17625
  artifacts: {
17640
17626
  tables: ["derived_memory_sources"],
17641
17627
  columns: [{ table: "memories", column: "stale_at" }]
@@ -17644,12 +17630,12 @@ var MIGRATIONS = [
17644
17630
  {
17645
17631
  version: 105,
17646
17632
  name: "agent-scoped-entity-name",
17647
- up: up109
17633
+ up: up110
17648
17634
  },
17649
17635
  {
17650
17636
  version: 106,
17651
17637
  name: "memory-review-after",
17652
- up: up110,
17638
+ up: up111,
17653
17639
  artifacts: {
17654
17640
  columns: [{ table: "memories", column: "review_after" }]
17655
17641
  }
@@ -17657,7 +17643,7 @@ var MIGRATIONS = [
17657
17643
  {
17658
17644
  version: 107,
17659
17645
  name: "dreaming-pass-usage",
17660
- up: up111,
17646
+ up: up112,
17661
17647
  artifacts: {
17662
17648
  columns: [
17663
17649
  { table: "dreaming_passes", column: "tokens_input" },
@@ -17671,7 +17657,7 @@ var MIGRATIONS = [
17671
17657
  {
17672
17658
  version: 108,
17673
17659
  name: "embedding-usage",
17674
- up: up112,
17660
+ up: up113,
17675
17661
  artifacts: {
17676
17662
  tables: ["embedding_usage"]
17677
17663
  }
@@ -17679,7 +17665,7 @@ var MIGRATIONS = [
17679
17665
  {
17680
17666
  version: 109,
17681
17667
  name: "telemetry-install",
17682
- up: up113,
17668
+ up: up114,
17683
17669
  artifacts: {
17684
17670
  tables: ["telemetry_install"]
17685
17671
  }
@@ -17687,12 +17673,12 @@ var MIGRATIONS = [
17687
17673
  {
17688
17674
  version: 110,
17689
17675
  name: "memory-mention-join-index",
17690
- up: up114
17676
+ up: up115
17691
17677
  },
17692
17678
  {
17693
17679
  version: 111,
17694
17680
  name: "telemetry-first-use",
17695
- up: up115,
17681
+ up: up116,
17696
17682
  artifacts: {
17697
17683
  columns: [
17698
17684
  { table: "telemetry_install", column: "first_remember_at" },
@@ -17703,7 +17689,7 @@ var MIGRATIONS = [
17703
17689
  {
17704
17690
  version: 112,
17705
17691
  name: "telemetry-queue-ownership",
17706
- up: up116,
17692
+ up: up117,
17707
17693
  artifacts: {
17708
17694
  columns: [
17709
17695
  { table: "telemetry_events", column: "source" },
@@ -17715,7 +17701,7 @@ var MIGRATIONS = [
17715
17701
  {
17716
17702
  version: 113,
17717
17703
  name: "session-claims",
17718
- up: up117,
17704
+ up: up118,
17719
17705
  artifacts: {
17720
17706
  tables: ["session_claims"],
17721
17707
  columns: [
@@ -17729,12 +17715,12 @@ var MIGRATIONS = [
17729
17715
  {
17730
17716
  version: 114,
17731
17717
  name: "memory-traversal-hydration-index",
17732
- up: up118
17718
+ up: up119
17733
17719
  },
17734
17720
  {
17735
17721
  version: 115,
17736
17722
  name: "cross-agent-message-notifications",
17737
- up: up119,
17723
+ up: up120,
17738
17724
  artifacts: {
17739
17725
  tables: ["cross_agent_messages", "cross_agent_message_receipts"]
17740
17726
  }
@@ -17742,7 +17728,7 @@ var MIGRATIONS = [
17742
17728
  {
17743
17729
  version: 116,
17744
17730
  name: "acp-delivery-reconciliation",
17745
- up: up120,
17731
+ up: up121,
17746
17732
  artifacts: {
17747
17733
  columns: [
17748
17734
  { table: "cross_agent_messages", column: "delivery_state" },
@@ -17756,7 +17742,7 @@ var MIGRATIONS = [
17756
17742
  {
17757
17743
  version: 117,
17758
17744
  name: "retire-summary-worker",
17759
- up: up121,
17745
+ up: up122,
17760
17746
  artifacts: {
17761
17747
  columns: [
17762
17748
  { table: "session_transcripts", column: "completed_at" },
@@ -17767,24 +17753,24 @@ var MIGRATIONS = [
17767
17753
  {
17768
17754
  version: 118,
17769
17755
  name: "queue-pressure-indices",
17770
- up: up122
17756
+ up: up123
17771
17757
  },
17772
17758
  {
17773
17759
  version: 119,
17774
17760
  name: "telemetry-version-observation",
17775
- up: up123,
17761
+ up: up124,
17776
17762
  artifacts: { columns: [{ table: "telemetry_install", column: "last_seen_version" }] }
17777
17763
  },
17778
17764
  {
17779
17765
  version: 120,
17780
17766
  name: "source-lifecycle-telemetry",
17781
- up: up124,
17767
+ up: up125,
17782
17768
  artifacts: { tables: ["source_lifecycle_state"] }
17783
17769
  },
17784
17770
  {
17785
17771
  version: 121,
17786
17772
  name: "telemetry-delivery-health",
17787
- up: up125,
17773
+ up: up126,
17788
17774
  artifacts: {
17789
17775
  tables: ["telemetry_delivery_state"],
17790
17776
  columns: [
@@ -17798,7 +17784,7 @@ var MIGRATIONS = [
17798
17784
  {
17799
17785
  version: 122,
17800
17786
  name: "dreaming-evidence-retry",
17801
- up: up126,
17787
+ up: up127,
17802
17788
  artifacts: {
17803
17789
  columns: [
17804
17790
  { table: "dreaming_evidence_exclusions", column: "failure_class" },
@@ -17811,13 +17797,13 @@ var MIGRATIONS = [
17811
17797
  {
17812
17798
  version: 123,
17813
17799
  name: "embedding-index-failures",
17814
- up: up127,
17800
+ up: up128,
17815
17801
  artifacts: { tables: ["embedding_index_failures"] }
17816
17802
  },
17817
17803
  {
17818
17804
  version: 124,
17819
17805
  name: "import-derived-lifecycle",
17820
- up: up128,
17806
+ up: up129,
17821
17807
  artifacts: {
17822
17808
  tables: ["imported_source_lifecycle"]
17823
17809
  }
@@ -17825,77 +17811,77 @@ var MIGRATIONS = [
17825
17811
  {
17826
17812
  version: 125,
17827
17813
  name: "memory-content-safety",
17828
- up: up129,
17814
+ up: up130,
17829
17815
  artifacts: { tables: ["memory_content_safety"] }
17830
17816
  },
17831
17817
  {
17832
17818
  version: 126,
17833
17819
  name: "dreaming-surprisal-attention",
17834
- up: up130,
17820
+ up: up131,
17835
17821
  artifacts: { tables: ["dreaming_attention"] }
17836
17822
  },
17837
17823
  {
17838
17824
  version: 127,
17839
17825
  name: "ontology-contradictions",
17840
- up: up131,
17826
+ up: up132,
17841
17827
  artifacts: { tables: ["ontology_contradictions"] }
17842
17828
  },
17843
17829
  {
17844
17830
  version: 128,
17845
17831
  name: "bounded-queue-diagnostics",
17846
- up: up132
17832
+ up: up133
17847
17833
  },
17848
17834
  {
17849
17835
  version: 129,
17850
17836
  name: "retire-structural-jobs",
17851
- up: up133
17837
+ up: up134
17852
17838
  },
17853
17839
  {
17854
17840
  version: 130,
17855
17841
  name: "embedding-repair-state",
17856
- up: up134,
17842
+ up: up135,
17857
17843
  artifacts: { tables: ["embedding_repair_budget", "embedding_repair_backoff"] }
17858
17844
  },
17859
17845
  {
17860
17846
  version: 131,
17861
17847
  name: "dreaming-evidence-consumption",
17862
- up: up135,
17848
+ up: up136,
17863
17849
  artifacts: { tables: ["dreaming_evidence_consumption"] }
17864
17850
  },
17865
17851
  {
17866
17852
  version: 132,
17867
17853
  name: "observer-scoped-epistemic-assertions",
17868
- up: up136,
17854
+ up: up137,
17869
17855
  artifacts: { tables: ["epistemic_assertions"] }
17870
17856
  },
17871
17857
  {
17872
17858
  version: 133,
17873
17859
  name: "dreaming-memory-head",
17874
- up: up137,
17860
+ up: up138,
17875
17861
  artifacts: { tables: ["memory_head_revisions", "memory_head_entries", "memory_head_revision_entries"] }
17876
17862
  },
17877
17863
  {
17878
17864
  version: 134,
17879
17865
  name: "scope-memory-head-entries",
17880
- up: up138,
17866
+ up: up139,
17881
17867
  artifacts: { tables: ["memory_head_entries"] }
17882
17868
  },
17883
17869
  {
17884
17870
  version: 135,
17885
17871
  name: "memory-head-publication",
17886
- up: up139,
17872
+ up: up140,
17887
17873
  artifacts: { tables: ["memory_head_publications"] }
17888
17874
  },
17889
17875
  {
17890
17876
  version: 136,
17891
17877
  name: "memory-head-revisions",
17892
- up: up140,
17878
+ up: up141,
17893
17879
  artifacts: { tables: ["memory_head_revisions"] }
17894
17880
  },
17895
17881
  {
17896
17882
  version: 137,
17897
17883
  name: "dreaming-head-manifest",
17898
- up: up141,
17884
+ up: up142,
17899
17885
  artifacts: {
17900
17886
  columns: [
17901
17887
  { table: "dreaming_passes", column: "head_revision" },
@@ -17906,7 +17892,7 @@ var MIGRATIONS = [
17906
17892
  {
17907
17893
  version: 138,
17908
17894
  name: "bounded-status-projections",
17909
- up: up142,
17895
+ up: up143,
17910
17896
  artifacts: {
17911
17897
  tables: ["transcript_capture_status", "memories_duplicate_hash_counts", "memories_diagnostics_state"]
17912
17898
  }
@@ -17914,31 +17900,31 @@ var MIGRATIONS = [
17914
17900
  {
17915
17901
  version: 139,
17916
17902
  name: "native-source-sync-state",
17917
- up: up143,
17903
+ up: up144,
17918
17904
  artifacts: { tables: ["native_source_sync_state"] }
17919
17905
  },
17920
17906
  {
17921
17907
  version: 140,
17922
17908
  name: "transcript-recovery-frontier",
17923
- up: up144,
17909
+ up: up145,
17924
17910
  artifacts: { tables: ["transcript_recovery_frontiers"] }
17925
17911
  },
17926
17912
  {
17927
17913
  version: 141,
17928
17914
  name: "source-sync-checkpoints",
17929
- up: up145,
17915
+ up: up146,
17930
17916
  artifacts: { tables: ["source_sync_checkpoints"] }
17931
17917
  },
17932
17918
  {
17933
17919
  version: 142,
17934
17920
  name: "source-sync-frontier",
17935
- up: up146,
17921
+ up: up147,
17936
17922
  artifacts: { columns: [{ table: "source_sync_checkpoints", column: "frontier" }] }
17937
17923
  },
17938
17924
  {
17939
17925
  version: 143,
17940
17926
  name: "embedding-index-progress",
17941
- up: up147,
17927
+ up: up148,
17942
17928
  artifacts: {
17943
17929
  columns: [
17944
17930
  { table: "embedding_index_state", column: "migration_phase" },
@@ -17954,19 +17940,19 @@ var MIGRATIONS = [
17954
17940
  {
17955
17941
  version: 144,
17956
17942
  name: "memory-job-lease-token",
17957
- up: up148,
17943
+ up: up149,
17958
17944
  artifacts: { columns: [{ table: "memory_jobs", column: "lease_token" }] }
17959
17945
  },
17960
17946
  {
17961
17947
  version: 145,
17962
17948
  name: "dreaming-evidence-reviews",
17963
- up: up149,
17949
+ up: up150,
17964
17950
  artifacts: { tables: ["dreaming_evidence_reviews"] }
17965
17951
  },
17966
17952
  {
17967
17953
  version: 146,
17968
17954
  name: "source-transcript-import",
17969
- up: up150,
17955
+ up: up151,
17970
17956
  artifacts: {
17971
17957
  tables: [
17972
17958
  "source_import_jobs",
@@ -17985,19 +17971,19 @@ var MIGRATIONS = [
17985
17971
  {
17986
17972
  version: 147,
17987
17973
  name: "source-import-replay-file-slots",
17988
- up: up151,
17974
+ up: up152,
17989
17975
  artifacts: { tables: ["source_import_files"] }
17990
17976
  },
17991
17977
  {
17992
17978
  version: 148,
17993
17979
  name: "source-import-attempt-provenance",
17994
- up: up152,
17980
+ up: up153,
17995
17981
  artifacts: { columns: [{ table: "source_import_record_attempts", column: "source_id" }] }
17996
17982
  },
17997
17983
  {
17998
17984
  version: 149,
17999
17985
  name: "transcript-import-state-machine",
18000
- up: up153,
17986
+ up: up154,
18001
17987
  artifacts: {
18002
17988
  columns: [
18003
17989
  { table: "source_import_jobs", column: "duplicate_mode" },
@@ -18009,7 +17995,7 @@ var MIGRATIONS = [
18009
17995
  {
18010
17996
  version: 150,
18011
17997
  name: "memory-head-freshness",
18012
- up: up154,
17998
+ up: up155,
18013
17999
  artifacts: {
18014
18000
  columns: [
18015
18001
  { table: "memory_md_heads", column: "is_current" },
@@ -18055,7 +18041,7 @@ var MIGRATIONS = [
18055
18041
  {
18056
18042
  version: 153,
18057
18043
  name: "vector-repair-checkpoints",
18058
- up: up155,
18044
+ up: up156,
18059
18045
  artifacts: { tables: ["vector_repair_checkpoints"] }
18060
18046
  },
18061
18047
  {
@@ -18082,13 +18068,13 @@ var MIGRATIONS = [
18082
18068
  {
18083
18069
  version: 156,
18084
18070
  name: "embedding-repair-checkpoints",
18085
- up: up156,
18071
+ up: up157,
18086
18072
  artifacts: { tables: ["embedding_repair_checkpoints"] }
18087
18073
  },
18088
18074
  {
18089
18075
  version: 157,
18090
18076
  name: "embedding-repair-progress",
18091
- up: up157,
18077
+ up: up158,
18092
18078
  artifacts: {
18093
18079
  tables: ["embedding_repair_progress"],
18094
18080
  columns: [{ table: "embedding_repair_checkpoints", column: "profile_fingerprint" }]
@@ -18097,8 +18083,13 @@ var MIGRATIONS = [
18097
18083
  {
18098
18084
  version: 158,
18099
18085
  name: "dreaming-candidate-scan-index",
18100
- up: up158,
18086
+ up: up159,
18101
18087
  artifacts: { indexes: ["idx_memories_agent_kind"] }
18088
+ },
18089
+ {
18090
+ version: 159,
18091
+ name: "retire-obsolete-invocation-ledger",
18092
+ up: up5
18102
18093
  }
18103
18094
  ];
18104
18095
  function checksum(m) {
@@ -21119,21 +21110,29 @@ function blobToVector(blob) {
21119
21110
  return new Float32Array(blob.buffer, blob.byteOffset, blob.byteLength / 4);
21120
21111
  }
21121
21112
  function tsCosineSimilarity(a2, b2) {
21113
+ if (a2.length === 0 || a2.length !== b2.length)
21114
+ return 0;
21122
21115
  let dot = 0;
21123
21116
  let normA = 0;
21124
21117
  let normB = 0;
21125
- const len = Math.min(a2.length, b2.length);
21126
- for (let i2 = 0;i2 < len; i2++) {
21127
- dot += a2[i2] * b2[i2];
21128
- normA += a2[i2] * a2[i2];
21129
- normB += b2[i2] * b2[i2];
21118
+ for (let i2 = 0;i2 < a2.length; i2++) {
21119
+ const left = a2[i2] ?? Number.NaN;
21120
+ const right = b2[i2] ?? Number.NaN;
21121
+ if (!Number.isFinite(left) || !Number.isFinite(right))
21122
+ return 0;
21123
+ dot += left * right;
21124
+ normA += left * left;
21125
+ normB += right * right;
21130
21126
  }
21131
21127
  const denom = Math.sqrt(normA) * Math.sqrt(normB);
21132
- return denom > 0 ? dot / denom : 0;
21128
+ return Number.isFinite(denom) && denom > 0 ? dot / denom : 0;
21133
21129
  }
21134
21130
  function cosineSimilarity(a2, b2) {
21131
+ if (a2.length === 0 || a2.length !== b2.length || !a2.every(Number.isFinite) || !b2.every(Number.isFinite))
21132
+ return 0;
21135
21133
  if (native !== null) {
21136
- return native.cosineSimilarity(a2, b2);
21134
+ const score = native.cosineSimilarity(a2, b2);
21135
+ return Number.isFinite(score) ? Math.max(-1, Math.min(1, score)) : 0;
21137
21136
  }
21138
21137
  return tsCosineSimilarity(a2, b2);
21139
21138
  }
@@ -21436,6 +21435,20 @@ async function migrateGemini(_inputPath) {
21436
21435
  throw new Error("Gemini migration is not yet implemented. " + "See https://github.com/Signet-AI/signetai/issues for tracking.");
21437
21436
  }
21438
21437
  // src/migration.ts
21438
+ function detectSchemaType(columns) {
21439
+ if (columns.length === 0)
21440
+ return "unknown";
21441
+ const hasPythonColumns = columns.includes("who") && columns.includes("why");
21442
+ const hasCliV1Columns = columns.includes("source") && columns.includes("accessed_at");
21443
+ const hasCoreColumns = columns.includes("category") && columns.includes("confidence") && columns.includes("source_id") && columns.includes("vector_clock");
21444
+ if (hasCoreColumns)
21445
+ return "core";
21446
+ if (hasPythonColumns)
21447
+ return "python";
21448
+ if (hasCliV1Columns)
21449
+ return "cli-v1";
21450
+ return "unknown";
21451
+ }
21439
21452
  function detectSchema(db) {
21440
21453
  let columns = [];
21441
21454
  let hasMemories = false;
@@ -21472,19 +21485,7 @@ function detectSchema(db) {
21472
21485
  } catch {
21473
21486
  hasFts = false;
21474
21487
  }
21475
- let type = "unknown";
21476
- if (hasMemories) {
21477
- const hasPythonColumns = columns.includes("who") && columns.includes("why");
21478
- const hasCliV1Columns = columns.includes("source") && columns.includes("accessed_at");
21479
- const hasCoreColumns = columns.includes("category") && columns.includes("confidence") && columns.includes("source_id") && columns.includes("vector_clock");
21480
- if (hasCoreColumns) {
21481
- type = "core";
21482
- } else if (hasPythonColumns) {
21483
- type = "python";
21484
- } else if (hasCliV1Columns) {
21485
- type = "cli-v1";
21486
- }
21487
- }
21488
+ const type = hasMemories ? detectSchemaType(columns) : "unknown";
21488
21489
  let version = 0;
21489
21490
  try {
21490
21491
  const versionResult = db.prepare("SELECT MAX(version) as version FROM schema_migrations").get();
@@ -23151,8 +23152,7 @@ function addImportedSource(input, agentsDir = getAgentsDir2()) {
23151
23152
  if (duplicate && mode === "skip") {
23152
23153
  return { ok: true, source: duplicate, created: false, duplicate: true };
23153
23154
  }
23154
- const ownerSuffix = agentId ? `:${createHash4("sha256").update(agentId).digest("hex").slice(0, 8)}` : "";
23155
- const sourceId = duplicate && mode === "replace" ? duplicate.id : `import:${contentHash.slice(0, 16)}${mode === "reimport" ? `:${randomUUID3().slice(0, 8)}` : ownerSuffix}`;
23155
+ const sourceId = duplicate && mode === "replace" ? duplicate.id : input.sourceId?.trim() || (mode === "reimport" ? `import:${contentHash.slice(0, 16)}:${randomUUID3().slice(0, 8)}` : deterministicImportedSourceId(contentHash, agentId));
23156
23156
  const source = {
23157
23157
  id: sourceId,
23158
23158
  generation: newSourceGeneration(),
@@ -23176,6 +23176,11 @@ function addImportedSource(input, agentsDir = getAgentsDir2()) {
23176
23176
  return { ok: true, source, created: !duplicate || mode === "reimport", duplicate: Boolean(duplicate) };
23177
23177
  });
23178
23178
  }
23179
+ function deterministicImportedSourceId(contentHash, agentId) {
23180
+ const normalizedAgentId = agentId?.trim() || undefined;
23181
+ const ownerSuffix = normalizedAgentId ? `:${createHash4("sha256").update(normalizedAgentId).digest("hex").slice(0, 8)}` : "";
23182
+ return `import:${contentHash.trim().toLowerCase().slice(0, 16)}${ownerSuffix}`;
23183
+ }
23179
23184
  function addDiscordSourceUnlocked(input, agentsDir = getAgentsDir2()) {
23180
23185
  try {
23181
23186
  return addDiscordSourceChecked(input, agentsDir);
@@ -25489,9 +25494,7 @@ var ROUTING_OPERATION_KINDS = [
25489
25494
  "memory_extraction",
25490
25495
  "session_synthesis",
25491
25496
  "aggregate_recall",
25492
- "widget_generation",
25493
- "repair",
25494
- "os_agent"
25497
+ "repair"
25495
25498
  ];
25496
25499
  var ROUTING_CLASSIFIER_TASK_CLASSES = {
25497
25500
  codeReasoning: "hard_coding",
@@ -26106,7 +26109,6 @@ function parseRoutingConfig(raw) {
26106
26109
  const interactive = parseWorkloadBinding(routingRaw.workloads.interactive);
26107
26110
  const memoryExtraction = parseWorkloadBinding(routingRaw.workloads.memoryExtraction ?? routingRaw.workloads.memory_extraction);
26108
26111
  const aggregateRecall = parseWorkloadBinding(routingRaw.workloads.aggregateRecall ?? routingRaw.workloads.aggregate_recall);
26109
- const widgetGeneration = parseWorkloadBinding(routingRaw.workloads.widgetGeneration ?? routingRaw.workloads.widget_generation);
26110
26112
  const repair = parseWorkloadBinding(routingRaw.workloads.repair);
26111
26113
  if (defaultBinding)
26112
26114
  workloads.default = defaultBinding;
@@ -26116,8 +26118,6 @@ function parseRoutingConfig(raw) {
26116
26118
  workloads.memoryExtraction = memoryExtraction;
26117
26119
  if (aggregateRecall)
26118
26120
  workloads.aggregateRecall = aggregateRecall;
26119
- if (widgetGeneration)
26120
- workloads.widgetGeneration = widgetGeneration;
26121
26121
  if (repair)
26122
26122
  workloads.repair = repair;
26123
26123
  }
@@ -26166,7 +26166,6 @@ function workloadBindingForOperation(config, operation) {
26166
26166
  case "interactive":
26167
26167
  case "tool_planning":
26168
26168
  case "code_reasoning":
26169
- case "os_agent":
26170
26169
  return config.workloads?.interactive ?? config.workloads?.default;
26171
26170
  case "memory_extraction":
26172
26171
  return config.workloads?.memoryExtraction ?? config.workloads?.default;
@@ -26174,8 +26173,6 @@ function workloadBindingForOperation(config, operation) {
26174
26173
  return config.workloads?.memoryExtraction ?? config.workloads?.default;
26175
26174
  case "aggregate_recall":
26176
26175
  return config.workloads?.aggregateRecall ?? config.workloads?.memoryExtraction ?? config.workloads?.default;
26177
- case "widget_generation":
26178
- return config.workloads?.widgetGeneration ?? config.workloads?.memoryExtraction ?? config.workloads?.default;
26179
26176
  case "repair":
26180
26177
  return config.workloads?.repair ?? config.workloads?.memoryExtraction ?? config.workloads?.default;
26181
26178
  }
@@ -27023,8 +27020,6 @@ var DOCUMENT_STATUSES = [
27023
27020
  "deleted"
27024
27021
  ];
27025
27022
  var DOCUMENT_SOURCE_TYPES = ["text", "url", "file"];
27026
- // src/signet-os-types.ts
27027
- var DEFAULT_APP_SIZE = { w: 4, h: 3 };
27028
27023
  // src/transcript-export.ts
27029
27024
  var ROLE_PREFIX = /^(user|assistant|system|tool(?:_result)?|human):\s?(.*)$/i;
27030
27025
  function normalizeRole(role) {
@@ -27124,7 +27119,6 @@ export {
27124
27119
  DAEMON_RUNTIME_ENV,
27125
27120
  DAEMON_RUNTIME_VALUES,
27126
27121
  DECISION_ACTIONS,
27127
- DEFAULT_APP_SIZE,
27128
27122
  DEFAULT_DAEMON_RUNTIME,
27129
27123
  DEFAULT_DISCORD_DESKTOP_CACHE_PATH,
27130
27124
  DEFAULT_DISCORD_MAX_ATTACHMENT_TEXT_BYTES,
@@ -27259,7 +27253,9 @@ export {
27259
27253
  detectAvailablePackageManagers,
27260
27254
  detectFilesystemType,
27261
27255
  detectSchema,
27256
+ detectSchemaType,
27262
27257
  detectSignetInstallations,
27258
+ deterministicImportedSourceId,
27263
27259
  disableGraphiqState,
27264
27260
  discoverAgents,
27265
27261
  emptyGraphiqState,