@signetai/connector-base 0.146.5 → 0.147.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +120 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9769,6 +9769,102 @@ function up83(db) {
9769
9769
  AND ${sourceAgentId} = ${targetAgentId}
9770
9770
  `);
9771
9771
  }
9772
+ function up84(db) {
9773
+ db.exec(`
9774
+ CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
9775
+ path TEXT PRIMARY KEY,
9776
+ mtime_ms INTEGER NOT NULL,
9777
+ ctime_ms INTEGER NOT NULL,
9778
+ size INTEGER NOT NULL,
9779
+ content_hash TEXT NOT NULL,
9780
+ importer_version INTEGER NOT NULL,
9781
+ chunk_count INTEGER NOT NULL DEFAULT 0,
9782
+ last_imported_at TEXT NOT NULL,
9783
+ last_seen_at TEXT NOT NULL,
9784
+ status TEXT NOT NULL DEFAULT 'imported',
9785
+ error TEXT
9786
+ );
9787
+
9788
+ CREATE TABLE IF NOT EXISTS legacy_markdown_chunks (
9789
+ file_path TEXT NOT NULL,
9790
+ chunk_hash TEXT NOT NULL,
9791
+ chunk_index INTEGER NOT NULL,
9792
+ memory_id TEXT,
9793
+ source_id TEXT,
9794
+ created_at TEXT NOT NULL,
9795
+ PRIMARY KEY (file_path, chunk_hash)
9796
+ );
9797
+
9798
+ CREATE INDEX IF NOT EXISTS idx_legacy_markdown_chunks_memory_id
9799
+ ON legacy_markdown_chunks(memory_id);
9800
+ `);
9801
+ }
9802
+ function up85(db) {
9803
+ const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
9804
+ const tableNames = new Set(tables.map((r) => String(r.name)));
9805
+ if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
9806
+ return;
9807
+ const relCols = db.prepare("PRAGMA table_info(relations)").all();
9808
+ const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
9809
+ const rel = new Set(relCols.map((c) => String(c.name)));
9810
+ const dep = new Set(depCols.map((c) => String(c.name)));
9811
+ if (!rel.has("source_entity_id") || !rel.has("relation_type"))
9812
+ return;
9813
+ if (!dep.has("source_entity_id") || !dep.has("dependency_type") || !dep.has("agent_id"))
9814
+ return;
9815
+ const hasRelConfidence = rel.has("confidence");
9816
+ const hasRelUpdated = rel.has("updated_at");
9817
+ const hasDepConfidence = dep.has("confidence");
9818
+ const hasDepReason = dep.has("reason");
9819
+ const hasDepStatus = dep.has("status");
9820
+ const selectParts = ["id", "source_entity_id", "target_entity_id"];
9821
+ const colParts = ["id", "source_entity_id", "target_entity_id"];
9822
+ selectParts.push("relation_type");
9823
+ colParts.push("dependency_type");
9824
+ selectParts.push("strength", "created_at");
9825
+ colParts.push("strength", "created_at");
9826
+ selectParts.push("'default'");
9827
+ colParts.push("agent_id");
9828
+ selectParts.push("NULL");
9829
+ colParts.push("aspect_id");
9830
+ if (hasRelConfidence && hasDepConfidence) {
9831
+ selectParts.push("confidence");
9832
+ colParts.push("confidence");
9833
+ }
9834
+ if (hasDepReason) {
9835
+ selectParts.push("'extracted'");
9836
+ colParts.push("reason");
9837
+ }
9838
+ if (hasDepStatus) {
9839
+ selectParts.push("'active'");
9840
+ colParts.push("status");
9841
+ }
9842
+ if (hasRelUpdated && dep.has("updated_at")) {
9843
+ selectParts.push("updated_at");
9844
+ colParts.push("updated_at");
9845
+ }
9846
+ const selectClause = selectParts.join(", ");
9847
+ const colsClause = colParts.join(", ");
9848
+ db.exec(`INSERT OR IGNORE INTO entity_dependencies (${colsClause})
9849
+ SELECT ${selectClause}
9850
+ FROM relations
9851
+ WHERE source_entity_id IS NOT NULL
9852
+ AND target_entity_id IS NOT NULL
9853
+ AND relation_type IS NOT NULL`);
9854
+ }
9855
+ function addColumnIfMissing21(db, table, column, definition) {
9856
+ const cols = db.prepare(`PRAGMA table_info(${table})`).all();
9857
+ if (cols.some((col) => col.name === column))
9858
+ return;
9859
+ db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
9860
+ }
9861
+ function up86(db) {
9862
+ addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
9863
+ db.exec(`
9864
+ CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
9865
+ ON summary_jobs(agent_id, session_key, content_hash)
9866
+ `);
9867
+ }
9772
9868
  var MIGRATIONS = [
9773
9869
  {
9774
9870
  version: 1,
@@ -10448,6 +10544,30 @@ var MIGRATIONS = [
10448
10544
  { table: "memories", column: "superseded_reason" }
10449
10545
  ]
10450
10546
  }
10547
+ },
10548
+ {
10549
+ version: 84,
10550
+ name: "legacy-markdown-import-state",
10551
+ up: up84,
10552
+ artifacts: {
10553
+ tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
10554
+ }
10555
+ },
10556
+ {
10557
+ version: 85,
10558
+ name: "backfill-relations-to-dependencies",
10559
+ up: up85,
10560
+ artifacts: {
10561
+ tables: ["entity_dependencies"]
10562
+ }
10563
+ },
10564
+ {
10565
+ version: 86,
10566
+ name: "summary-jobs-content-hash",
10567
+ up: up86,
10568
+ artifacts: {
10569
+ columns: [{ table: "summary_jobs", column: "content_hash" }]
10570
+ }
10451
10571
  }
10452
10572
  ];
10453
10573
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-base",
3
- "version": "0.146.5",
3
+ "version": "0.147.0",
4
4
  "description": "Base class for Signet harness connectors",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "typecheck": "tsc --noEmit"
23
23
  },
24
24
  "dependencies": {
25
- "@signetai/core": "0.146.5"
25
+ "@signetai/core": "0.147.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.0.0",