@signetai/signet-memory-openclaw 0.98.5 → 0.98.6
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 +62 -30
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6869,6 +6869,56 @@ var require_dist = __commonJS((exports) => {
|
|
|
6869
6869
|
exports.visit = visit.visit;
|
|
6870
6870
|
exports.visitAsync = visit.visitAsync;
|
|
6871
6871
|
});
|
|
6872
|
+
var MEMORIES_FTS_TOKENIZER = "unicode61";
|
|
6873
|
+
function normalizeSql(sql) {
|
|
6874
|
+
return sql.replace(/\s+/g, " ").trim().toLowerCase();
|
|
6875
|
+
}
|
|
6876
|
+
function createMemoriesFts(db) {
|
|
6877
|
+
db.exec(`
|
|
6878
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
|
|
6879
|
+
content,
|
|
6880
|
+
content='memories',
|
|
6881
|
+
content_rowid='rowid',
|
|
6882
|
+
tokenize='${MEMORIES_FTS_TOKENIZER}'
|
|
6883
|
+
);
|
|
6884
|
+
`);
|
|
6885
|
+
db.exec(`
|
|
6886
|
+
CREATE TRIGGER IF NOT EXISTS memories_ai AFTER INSERT ON memories BEGIN
|
|
6887
|
+
INSERT INTO memories_fts(rowid, content) VALUES (new.rowid, new.content);
|
|
6888
|
+
END;
|
|
6889
|
+
`);
|
|
6890
|
+
db.exec(`
|
|
6891
|
+
CREATE TRIGGER IF NOT EXISTS memories_ad AFTER DELETE ON memories BEGIN
|
|
6892
|
+
INSERT INTO memories_fts(memories_fts, rowid, content) VALUES('delete', old.rowid, old.content);
|
|
6893
|
+
END;
|
|
6894
|
+
`);
|
|
6895
|
+
db.exec(`
|
|
6896
|
+
CREATE TRIGGER IF NOT EXISTS memories_au AFTER UPDATE ON memories BEGIN
|
|
6897
|
+
INSERT INTO memories_fts(memories_fts, rowid, content) VALUES('delete', old.rowid, old.content);
|
|
6898
|
+
INSERT INTO memories_fts(rowid, content) VALUES (new.rowid, new.content);
|
|
6899
|
+
END;
|
|
6900
|
+
`);
|
|
6901
|
+
}
|
|
6902
|
+
function recreateMemoriesFts(db) {
|
|
6903
|
+
db.exec("DROP TRIGGER IF EXISTS memories_ai");
|
|
6904
|
+
db.exec("DROP TRIGGER IF EXISTS memories_ad");
|
|
6905
|
+
db.exec("DROP TRIGGER IF EXISTS memories_au");
|
|
6906
|
+
db.exec("DROP TABLE IF EXISTS memories_fts");
|
|
6907
|
+
createMemoriesFts(db);
|
|
6908
|
+
db.exec("INSERT INTO memories_fts(rowid, content) SELECT rowid, content FROM memories");
|
|
6909
|
+
}
|
|
6910
|
+
function readMemoriesFtsSql(db) {
|
|
6911
|
+
const row = db.prepare("SELECT sql FROM sqlite_master WHERE name = 'memories_fts' AND type = 'table'").get();
|
|
6912
|
+
return typeof row?.sql === "string" ? row.sql : null;
|
|
6913
|
+
}
|
|
6914
|
+
function memoriesFtsNeedsTokenizerRepair(sql) {
|
|
6915
|
+
if (sql === null)
|
|
6916
|
+
return false;
|
|
6917
|
+
const normalized = normalizeSql(sql);
|
|
6918
|
+
if (normalized.includes("porter unicode61"))
|
|
6919
|
+
return true;
|
|
6920
|
+
return !normalized.includes(`tokenize='${MEMORIES_FTS_TOKENIZER}'`);
|
|
6921
|
+
}
|
|
6872
6922
|
function up(db) {
|
|
6873
6923
|
db.exec(`
|
|
6874
6924
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
@@ -6956,36 +7006,7 @@ function up(db) {
|
|
|
6956
7006
|
);
|
|
6957
7007
|
`);
|
|
6958
7008
|
} catch {}
|
|
6959
|
-
db
|
|
6960
|
-
CREATE VIRTUAL TABLE IF NOT EXISTS memories_fts USING fts5(
|
|
6961
|
-
content,
|
|
6962
|
-
content=memories,
|
|
6963
|
-
content_rowid=rowid
|
|
6964
|
-
);
|
|
6965
|
-
`);
|
|
6966
|
-
db.exec(`
|
|
6967
|
-
CREATE TRIGGER IF NOT EXISTS memories_ai
|
|
6968
|
-
AFTER INSERT ON memories BEGIN
|
|
6969
|
-
INSERT INTO memories_fts(rowid, content)
|
|
6970
|
-
VALUES (new.rowid, new.content);
|
|
6971
|
-
END;
|
|
6972
|
-
`);
|
|
6973
|
-
db.exec(`
|
|
6974
|
-
CREATE TRIGGER IF NOT EXISTS memories_ad
|
|
6975
|
-
AFTER DELETE ON memories BEGIN
|
|
6976
|
-
INSERT INTO memories_fts(memories_fts, rowid, content)
|
|
6977
|
-
VALUES('delete', old.rowid, old.content);
|
|
6978
|
-
END;
|
|
6979
|
-
`);
|
|
6980
|
-
db.exec(`
|
|
6981
|
-
CREATE TRIGGER IF NOT EXISTS memories_au
|
|
6982
|
-
AFTER UPDATE ON memories BEGIN
|
|
6983
|
-
INSERT INTO memories_fts(memories_fts, rowid, content)
|
|
6984
|
-
VALUES('delete', old.rowid, old.content);
|
|
6985
|
-
INSERT INTO memories_fts(rowid, content)
|
|
6986
|
-
VALUES (new.rowid, new.content);
|
|
6987
|
-
END;
|
|
6988
|
-
`);
|
|
7009
|
+
createMemoriesFts(db);
|
|
6989
7010
|
}
|
|
6990
7011
|
function hasColumn(db, table, column) {
|
|
6991
7012
|
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
@@ -9032,6 +9053,12 @@ function up56(db) {
|
|
|
9032
9053
|
WHERE content_hash IS NOT NULL AND is_deleted = 0
|
|
9033
9054
|
`);
|
|
9034
9055
|
}
|
|
9056
|
+
function up57(db) {
|
|
9057
|
+
const sql = readMemoriesFtsSql(db);
|
|
9058
|
+
if (sql !== null && !memoriesFtsNeedsTokenizerRepair(sql))
|
|
9059
|
+
return;
|
|
9060
|
+
recreateMemoriesFts(db);
|
|
9061
|
+
}
|
|
9035
9062
|
var MIGRATIONS = [
|
|
9036
9063
|
{
|
|
9037
9064
|
version: 1,
|
|
@@ -9476,6 +9503,11 @@ var MIGRATIONS = [
|
|
|
9476
9503
|
version: 56,
|
|
9477
9504
|
name: "agent-scoped-content-hash",
|
|
9478
9505
|
up: up56
|
|
9506
|
+
},
|
|
9507
|
+
{
|
|
9508
|
+
version: 57,
|
|
9509
|
+
name: "memories-fts-tokenizer-repair",
|
|
9510
|
+
up: up57
|
|
9479
9511
|
}
|
|
9480
9512
|
];
|
|
9481
9513
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signetai/signet-memory-openclaw",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.6",
|
|
4
4
|
"description": "Signet adapter for OpenClaw — runtime plugin for AI agent memory",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@sinclair/typebox": "0.34.47"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@signet/core": "0.98.
|
|
39
|
+
"@signet/core": "0.98.6",
|
|
40
40
|
"@types/node": "^22.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|