@signetai/signet-memory-openclaw 0.119.1 → 0.121.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.
- package/dist/index.js +116 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9211,6 +9211,99 @@ function up69(db) {
|
|
|
9211
9211
|
WHERE content_key IS NOT NULL;
|
|
9212
9212
|
`);
|
|
9213
9213
|
}
|
|
9214
|
+
function hasColumn9(db, table, column) {
|
|
9215
|
+
const rows = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
9216
|
+
return rows.some((row) => row.name === column);
|
|
9217
|
+
}
|
|
9218
|
+
function addColumnIfMissing18(db, table, column, definition) {
|
|
9219
|
+
if (!hasColumn9(db, table, column)) {
|
|
9220
|
+
db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`);
|
|
9221
|
+
}
|
|
9222
|
+
}
|
|
9223
|
+
function backfillVersionRoots(db) {
|
|
9224
|
+
db.exec(`
|
|
9225
|
+
UPDATE entity_attributes
|
|
9226
|
+
SET version_root_id = id
|
|
9227
|
+
WHERE version_root_id IS NULL
|
|
9228
|
+
`);
|
|
9229
|
+
}
|
|
9230
|
+
function up70(db) {
|
|
9231
|
+
for (const table of ["entities", "entity_aspects", "entity_dependencies"]) {
|
|
9232
|
+
addColumnIfMissing18(db, table, "status", "TEXT NOT NULL DEFAULT 'active'");
|
|
9233
|
+
addColumnIfMissing18(db, table, "archived_at", "TEXT");
|
|
9234
|
+
addColumnIfMissing18(db, table, "archived_by", "TEXT");
|
|
9235
|
+
addColumnIfMissing18(db, table, "archive_reason", "TEXT");
|
|
9236
|
+
}
|
|
9237
|
+
for (const table of ["entities", "entity_aspects"]) {
|
|
9238
|
+
addColumnIfMissing18(db, table, "proposal_id", "TEXT");
|
|
9239
|
+
addColumnIfMissing18(db, table, "proposal_evidence", "TEXT NOT NULL DEFAULT '[]'");
|
|
9240
|
+
}
|
|
9241
|
+
addColumnIfMissing18(db, "entity_attributes", "version", "INTEGER NOT NULL DEFAULT 1");
|
|
9242
|
+
addColumnIfMissing18(db, "entity_attributes", "version_root_id", "TEXT");
|
|
9243
|
+
addColumnIfMissing18(db, "entity_attributes", "previous_attribute_id", "TEXT");
|
|
9244
|
+
addColumnIfMissing18(db, "entity_attributes", "archived_at", "TEXT");
|
|
9245
|
+
addColumnIfMissing18(db, "entity_attributes", "archived_by", "TEXT");
|
|
9246
|
+
addColumnIfMissing18(db, "entity_attributes", "archive_reason", "TEXT");
|
|
9247
|
+
backfillVersionRoots(db);
|
|
9248
|
+
db.exec(`
|
|
9249
|
+
CREATE INDEX IF NOT EXISTS idx_entities_status
|
|
9250
|
+
ON entities(agent_id, status, updated_at DESC);
|
|
9251
|
+
CREATE INDEX IF NOT EXISTS idx_entity_aspects_status
|
|
9252
|
+
ON entity_aspects(agent_id, entity_id, status);
|
|
9253
|
+
CREATE INDEX IF NOT EXISTS idx_entity_attributes_version_root
|
|
9254
|
+
ON entity_attributes(agent_id, version_root_id, version DESC);
|
|
9255
|
+
CREATE INDEX IF NOT EXISTS idx_entity_attributes_claim_version
|
|
9256
|
+
ON entity_attributes(agent_id, aspect_id, group_key, claim_key, version DESC);
|
|
9257
|
+
CREATE INDEX IF NOT EXISTS idx_entity_dependencies_status
|
|
9258
|
+
ON entity_dependencies(agent_id, status, updated_at DESC);
|
|
9259
|
+
CREATE INDEX IF NOT EXISTS idx_entities_proposal
|
|
9260
|
+
ON entities(agent_id, proposal_id);
|
|
9261
|
+
CREATE INDEX IF NOT EXISTS idx_entity_aspects_proposal
|
|
9262
|
+
ON entity_aspects(agent_id, proposal_id);
|
|
9263
|
+
`);
|
|
9264
|
+
}
|
|
9265
|
+
function up71(db) {
|
|
9266
|
+
db.exec(`
|
|
9267
|
+
CREATE TABLE IF NOT EXISTS epistemic_assertions (
|
|
9268
|
+
id TEXT PRIMARY KEY,
|
|
9269
|
+
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
9270
|
+
subject_entity_id TEXT NOT NULL REFERENCES entities(id) ON DELETE CASCADE,
|
|
9271
|
+
claim_attribute_id TEXT REFERENCES entity_attributes(id) ON DELETE SET NULL,
|
|
9272
|
+
predicate TEXT NOT NULL CHECK (
|
|
9273
|
+
predicate IN ('claims', 'believes', 'observed', 'decided', 'prefers', 'denies', 'questions')
|
|
9274
|
+
),
|
|
9275
|
+
content TEXT NOT NULL,
|
|
9276
|
+
normalized_content TEXT NOT NULL,
|
|
9277
|
+
speaker TEXT,
|
|
9278
|
+
asserted_at TEXT NOT NULL,
|
|
9279
|
+
confidence REAL NOT NULL DEFAULT 0.0 CHECK (confidence >= 0.0 AND confidence <= 1.0),
|
|
9280
|
+
evidence TEXT NOT NULL DEFAULT '[]',
|
|
9281
|
+
source_kind TEXT,
|
|
9282
|
+
source_id TEXT,
|
|
9283
|
+
source_path TEXT,
|
|
9284
|
+
source_root TEXT,
|
|
9285
|
+
status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'archived', 'superseded')),
|
|
9286
|
+
supersedes_assertion_id TEXT REFERENCES epistemic_assertions(id) ON DELETE SET NULL,
|
|
9287
|
+
archived_at TEXT,
|
|
9288
|
+
archived_by TEXT,
|
|
9289
|
+
archive_reason TEXT,
|
|
9290
|
+
created_by TEXT NOT NULL DEFAULT 'operator',
|
|
9291
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
9292
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
9293
|
+
);
|
|
9294
|
+
|
|
9295
|
+
CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_agent_entity
|
|
9296
|
+
ON epistemic_assertions(agent_id, subject_entity_id, status, asserted_at DESC);
|
|
9297
|
+
CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_agent_speaker
|
|
9298
|
+
ON epistemic_assertions(agent_id, speaker, asserted_at DESC);
|
|
9299
|
+
CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_agent_predicate
|
|
9300
|
+
ON epistemic_assertions(agent_id, predicate, status, asserted_at DESC);
|
|
9301
|
+
CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_agent_source
|
|
9302
|
+
ON epistemic_assertions(agent_id, source_kind, source_id);
|
|
9303
|
+
CREATE INDEX IF NOT EXISTS idx_epistemic_assertions_claim
|
|
9304
|
+
ON epistemic_assertions(agent_id, claim_attribute_id);
|
|
9305
|
+
`);
|
|
9306
|
+
}
|
|
9214
9307
|
var MIGRATIONS = [
|
|
9215
9308
|
{
|
|
9216
9309
|
version: 1,
|
|
@@ -9749,6 +9842,29 @@ var MIGRATIONS = [
|
|
|
9749
9842
|
artifacts: {
|
|
9750
9843
|
tables: ["daily_reflections"]
|
|
9751
9844
|
}
|
|
9845
|
+
},
|
|
9846
|
+
{
|
|
9847
|
+
version: 70,
|
|
9848
|
+
name: "ontology-control-plane-state",
|
|
9849
|
+
up: up70,
|
|
9850
|
+
artifacts: {
|
|
9851
|
+
columns: [
|
|
9852
|
+
{ table: "entities", column: "status" },
|
|
9853
|
+
{ table: "entity_aspects", column: "status" },
|
|
9854
|
+
{ table: "entity_attributes", column: "version" },
|
|
9855
|
+
{ table: "entity_attributes", column: "version_root_id" },
|
|
9856
|
+
{ table: "entity_attributes", column: "previous_attribute_id" },
|
|
9857
|
+
{ table: "entity_dependencies", column: "status" }
|
|
9858
|
+
]
|
|
9859
|
+
}
|
|
9860
|
+
},
|
|
9861
|
+
{
|
|
9862
|
+
version: 71,
|
|
9863
|
+
name: "epistemic-assertions",
|
|
9864
|
+
up: up71,
|
|
9865
|
+
artifacts: {
|
|
9866
|
+
tables: ["epistemic_assertions"]
|
|
9867
|
+
}
|
|
9752
9868
|
}
|
|
9753
9869
|
];
|
|
9754
9870
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|