@signetai/signet-memory-openclaw 0.146.5 → 0.147.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 +120 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9783,6 +9783,102 @@ function up83(db) {
|
|
|
9783
9783
|
AND ${sourceAgentId} = ${targetAgentId}
|
|
9784
9784
|
`);
|
|
9785
9785
|
}
|
|
9786
|
+
function up84(db) {
|
|
9787
|
+
db.exec(`
|
|
9788
|
+
CREATE TABLE IF NOT EXISTS legacy_markdown_imports (
|
|
9789
|
+
path TEXT PRIMARY KEY,
|
|
9790
|
+
mtime_ms INTEGER NOT NULL,
|
|
9791
|
+
ctime_ms INTEGER NOT NULL,
|
|
9792
|
+
size INTEGER NOT NULL,
|
|
9793
|
+
content_hash TEXT NOT NULL,
|
|
9794
|
+
importer_version INTEGER NOT NULL,
|
|
9795
|
+
chunk_count INTEGER NOT NULL DEFAULT 0,
|
|
9796
|
+
last_imported_at TEXT NOT NULL,
|
|
9797
|
+
last_seen_at TEXT NOT NULL,
|
|
9798
|
+
status TEXT NOT NULL DEFAULT 'imported',
|
|
9799
|
+
error TEXT
|
|
9800
|
+
);
|
|
9801
|
+
|
|
9802
|
+
CREATE TABLE IF NOT EXISTS legacy_markdown_chunks (
|
|
9803
|
+
file_path TEXT NOT NULL,
|
|
9804
|
+
chunk_hash TEXT NOT NULL,
|
|
9805
|
+
chunk_index INTEGER NOT NULL,
|
|
9806
|
+
memory_id TEXT,
|
|
9807
|
+
source_id TEXT,
|
|
9808
|
+
created_at TEXT NOT NULL,
|
|
9809
|
+
PRIMARY KEY (file_path, chunk_hash)
|
|
9810
|
+
);
|
|
9811
|
+
|
|
9812
|
+
CREATE INDEX IF NOT EXISTS idx_legacy_markdown_chunks_memory_id
|
|
9813
|
+
ON legacy_markdown_chunks(memory_id);
|
|
9814
|
+
`);
|
|
9815
|
+
}
|
|
9816
|
+
function up85(db) {
|
|
9817
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name IN ('relations', 'entity_dependencies')").all();
|
|
9818
|
+
const tableNames = new Set(tables.map((r) => String(r.name)));
|
|
9819
|
+
if (!tableNames.has("relations") || !tableNames.has("entity_dependencies"))
|
|
9820
|
+
return;
|
|
9821
|
+
const relCols = db.prepare("PRAGMA table_info(relations)").all();
|
|
9822
|
+
const depCols = db.prepare("PRAGMA table_info(entity_dependencies)").all();
|
|
9823
|
+
const rel = new Set(relCols.map((c) => String(c.name)));
|
|
9824
|
+
const dep = new Set(depCols.map((c) => String(c.name)));
|
|
9825
|
+
if (!rel.has("source_entity_id") || !rel.has("relation_type"))
|
|
9826
|
+
return;
|
|
9827
|
+
if (!dep.has("source_entity_id") || !dep.has("dependency_type") || !dep.has("agent_id"))
|
|
9828
|
+
return;
|
|
9829
|
+
const hasRelConfidence = rel.has("confidence");
|
|
9830
|
+
const hasRelUpdated = rel.has("updated_at");
|
|
9831
|
+
const hasDepConfidence = dep.has("confidence");
|
|
9832
|
+
const hasDepReason = dep.has("reason");
|
|
9833
|
+
const hasDepStatus = dep.has("status");
|
|
9834
|
+
const selectParts = ["id", "source_entity_id", "target_entity_id"];
|
|
9835
|
+
const colParts = ["id", "source_entity_id", "target_entity_id"];
|
|
9836
|
+
selectParts.push("relation_type");
|
|
9837
|
+
colParts.push("dependency_type");
|
|
9838
|
+
selectParts.push("strength", "created_at");
|
|
9839
|
+
colParts.push("strength", "created_at");
|
|
9840
|
+
selectParts.push("'default'");
|
|
9841
|
+
colParts.push("agent_id");
|
|
9842
|
+
selectParts.push("NULL");
|
|
9843
|
+
colParts.push("aspect_id");
|
|
9844
|
+
if (hasRelConfidence && hasDepConfidence) {
|
|
9845
|
+
selectParts.push("confidence");
|
|
9846
|
+
colParts.push("confidence");
|
|
9847
|
+
}
|
|
9848
|
+
if (hasDepReason) {
|
|
9849
|
+
selectParts.push("'extracted'");
|
|
9850
|
+
colParts.push("reason");
|
|
9851
|
+
}
|
|
9852
|
+
if (hasDepStatus) {
|
|
9853
|
+
selectParts.push("'active'");
|
|
9854
|
+
colParts.push("status");
|
|
9855
|
+
}
|
|
9856
|
+
if (hasRelUpdated && dep.has("updated_at")) {
|
|
9857
|
+
selectParts.push("updated_at");
|
|
9858
|
+
colParts.push("updated_at");
|
|
9859
|
+
}
|
|
9860
|
+
const selectClause = selectParts.join(", ");
|
|
9861
|
+
const colsClause = colParts.join(", ");
|
|
9862
|
+
db.exec(`INSERT OR IGNORE INTO entity_dependencies (${colsClause})
|
|
9863
|
+
SELECT ${selectClause}
|
|
9864
|
+
FROM relations
|
|
9865
|
+
WHERE source_entity_id IS NOT NULL
|
|
9866
|
+
AND target_entity_id IS NOT NULL
|
|
9867
|
+
AND relation_type IS NOT NULL`);
|
|
9868
|
+
}
|
|
9869
|
+
function addColumnIfMissing21(db, table, column, definition) {
|
|
9870
|
+
const cols = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
9871
|
+
if (cols.some((col) => col.name === column))
|
|
9872
|
+
return;
|
|
9873
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
9874
|
+
}
|
|
9875
|
+
function up86(db) {
|
|
9876
|
+
addColumnIfMissing21(db, "summary_jobs", "content_hash", "TEXT");
|
|
9877
|
+
db.exec(`
|
|
9878
|
+
CREATE INDEX IF NOT EXISTS idx_summary_jobs_agent_session_content_hash
|
|
9879
|
+
ON summary_jobs(agent_id, session_key, content_hash)
|
|
9880
|
+
`);
|
|
9881
|
+
}
|
|
9786
9882
|
var MIGRATIONS = [
|
|
9787
9883
|
{
|
|
9788
9884
|
version: 1,
|
|
@@ -10462,6 +10558,30 @@ var MIGRATIONS = [
|
|
|
10462
10558
|
{ table: "memories", column: "superseded_reason" }
|
|
10463
10559
|
]
|
|
10464
10560
|
}
|
|
10561
|
+
},
|
|
10562
|
+
{
|
|
10563
|
+
version: 84,
|
|
10564
|
+
name: "legacy-markdown-import-state",
|
|
10565
|
+
up: up84,
|
|
10566
|
+
artifacts: {
|
|
10567
|
+
tables: ["legacy_markdown_imports", "legacy_markdown_chunks"]
|
|
10568
|
+
}
|
|
10569
|
+
},
|
|
10570
|
+
{
|
|
10571
|
+
version: 85,
|
|
10572
|
+
name: "backfill-relations-to-dependencies",
|
|
10573
|
+
up: up85,
|
|
10574
|
+
artifacts: {
|
|
10575
|
+
tables: ["entity_dependencies"]
|
|
10576
|
+
}
|
|
10577
|
+
},
|
|
10578
|
+
{
|
|
10579
|
+
version: 86,
|
|
10580
|
+
name: "summary-jobs-content-hash",
|
|
10581
|
+
up: up86,
|
|
10582
|
+
artifacts: {
|
|
10583
|
+
columns: [{ table: "summary_jobs", column: "content_hash" }]
|
|
10584
|
+
}
|
|
10465
10585
|
}
|
|
10466
10586
|
];
|
|
10467
10587
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|