@inerrata-corporation/errata 2.0.13-dev.3054 → 2.0.13-dev.3077
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/consolidate-worker.mjs +49 -0
- package/errata.mjs +54 -1
- package/package.json +1 -1
- package/pass-worker.mjs +49 -0
package/consolidate-worker.mjs
CHANGED
|
@@ -16141,6 +16141,54 @@ import { parentPort } from "node:worker_threads";
|
|
|
16141
16141
|
// ../../packages/local-graph/src/store.ts
|
|
16142
16142
|
init_src2();
|
|
16143
16143
|
init_src();
|
|
16144
|
+
|
|
16145
|
+
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
16146
|
+
function installHistoryCacheFloor(db) {
|
|
16147
|
+
const key = "history-cache-withdrawal-floor-2";
|
|
16148
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
16149
|
+
db.transaction(() => {
|
|
16150
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
16151
|
+
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
16152
|
+
}
|
|
16153
|
+
db.exec(`
|
|
16154
|
+
CREATE VIEW IF NOT EXISTS history_cache_withdrawals AS
|
|
16155
|
+
SELECT n.id, json_extract(m.value, '$.action') = 'quarantine' AS privacy,
|
|
16156
|
+
json_extract(m.value, '$.nodeId') AS cloud_id,
|
|
16157
|
+
json_extract(m.value, '$.seq') AS seq,
|
|
16158
|
+
CASE WHEN json_extract(m.value, '$.action') = 'quarantine' THEN 'quarantined' ELSE 'contradicted' END AS support
|
|
16159
|
+
FROM nodes n JOIN store_meta m
|
|
16160
|
+
ON m.key = 'history-correction:' || coalesce(json_extract(n.attrs_json, '$.cloudNodeId'), n.id)
|
|
16161
|
+
WHERE json_extract(n.attrs_json, '$.source') = 'cloud' AND json_valid(m.value)
|
|
16162
|
+
AND json_extract(m.value, '$.seq') >= coalesce(json_extract(n.attrs_json, '$.historyCorrectionSeq'), 0)
|
|
16163
|
+
AND (json_extract(m.value, '$.action') = 'quarantine' OR json_extract(m.value, '$.sourceSupport') = 'contradicted');
|
|
16164
|
+
`);
|
|
16165
|
+
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
16166
|
+
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
16167
|
+
const description = `CASE WHEN ${privacy} THEN 'History source withdrawn.' ELSE description END`;
|
|
16168
|
+
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
16169
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', 'history-mined',
|
|
16170
|
+
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
16171
|
+
'historyCorrectionSeq', ${lookup("seq")})
|
|
16172
|
+
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
16173
|
+
'$.historyQuality.sourceSupport', coalesce(${lookup("support")}, json_extract(attrs_json, '$.historyQuality.sourceSupport')),
|
|
16174
|
+
'$.historyQuality.applicability', 'unknown',
|
|
16175
|
+
'$.historyCorrectionSeq', coalesce(${lookup("seq")}, json_extract(attrs_json, '$.historyCorrectionSeq'), 0)) END`;
|
|
16176
|
+
const repair = (scope) => `UPDATE nodes SET description = ${description},
|
|
16177
|
+
embedding_blob = NULL, embedding_json = '[]', is_landmark = 0, attrs_json = ${attrs}
|
|
16178
|
+
WHERE (${scope}) AND (json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')
|
|
16179
|
+
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
16180
|
+
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
16181
|
+
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
16182
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
16183
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
16184
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
16185
|
+
}
|
|
16186
|
+
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
16187
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
16188
|
+
});
|
|
16189
|
+
}
|
|
16190
|
+
|
|
16191
|
+
// ../../packages/local-graph/src/store.ts
|
|
16144
16192
|
var LOCAL_RULE_OVERRIDES = {
|
|
16145
16193
|
ANCHORED_AT: {
|
|
16146
16194
|
from: EDGE_RULES["ANCHORED_AT"]?.from,
|
|
@@ -16383,6 +16431,7 @@ var SqliteGraphStore = class {
|
|
|
16383
16431
|
);
|
|
16384
16432
|
}
|
|
16385
16433
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
16434
|
+
installHistoryCacheFloor(this.db);
|
|
16386
16435
|
this.stmts = {
|
|
16387
16436
|
insertNode: this.db.prepare(`
|
|
16388
16437
|
INSERT INTO nodes (
|
package/errata.mjs
CHANGED
|
@@ -17951,6 +17951,57 @@ var init_src2 = __esm({
|
|
|
17951
17951
|
}
|
|
17952
17952
|
});
|
|
17953
17953
|
|
|
17954
|
+
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
17955
|
+
function installHistoryCacheFloor(db) {
|
|
17956
|
+
const key = "history-cache-withdrawal-floor-2";
|
|
17957
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
17958
|
+
db.transaction(() => {
|
|
17959
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
17960
|
+
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
17961
|
+
}
|
|
17962
|
+
db.exec(`
|
|
17963
|
+
CREATE VIEW IF NOT EXISTS history_cache_withdrawals AS
|
|
17964
|
+
SELECT n.id, json_extract(m.value, '$.action') = 'quarantine' AS privacy,
|
|
17965
|
+
json_extract(m.value, '$.nodeId') AS cloud_id,
|
|
17966
|
+
json_extract(m.value, '$.seq') AS seq,
|
|
17967
|
+
CASE WHEN json_extract(m.value, '$.action') = 'quarantine' THEN 'quarantined' ELSE 'contradicted' END AS support
|
|
17968
|
+
FROM nodes n JOIN store_meta m
|
|
17969
|
+
ON m.key = 'history-correction:' || coalesce(json_extract(n.attrs_json, '$.cloudNodeId'), n.id)
|
|
17970
|
+
WHERE json_extract(n.attrs_json, '$.source') = 'cloud' AND json_valid(m.value)
|
|
17971
|
+
AND json_extract(m.value, '$.seq') >= coalesce(json_extract(n.attrs_json, '$.historyCorrectionSeq'), 0)
|
|
17972
|
+
AND (json_extract(m.value, '$.action') = 'quarantine' OR json_extract(m.value, '$.sourceSupport') = 'contradicted');
|
|
17973
|
+
`);
|
|
17974
|
+
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
17975
|
+
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
17976
|
+
const description = `CASE WHEN ${privacy} THEN 'History source withdrawn.' ELSE description END`;
|
|
17977
|
+
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
17978
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', 'history-mined',
|
|
17979
|
+
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
17980
|
+
'historyCorrectionSeq', ${lookup("seq")})
|
|
17981
|
+
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
17982
|
+
'$.historyQuality.sourceSupport', coalesce(${lookup("support")}, json_extract(attrs_json, '$.historyQuality.sourceSupport')),
|
|
17983
|
+
'$.historyQuality.applicability', 'unknown',
|
|
17984
|
+
'$.historyCorrectionSeq', coalesce(${lookup("seq")}, json_extract(attrs_json, '$.historyCorrectionSeq'), 0)) END`;
|
|
17985
|
+
const repair = (scope) => `UPDATE nodes SET description = ${description},
|
|
17986
|
+
embedding_blob = NULL, embedding_json = '[]', is_landmark = 0, attrs_json = ${attrs}
|
|
17987
|
+
WHERE (${scope}) AND (json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')
|
|
17988
|
+
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
17989
|
+
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
17990
|
+
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
17991
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
17992
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
17993
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
17994
|
+
}
|
|
17995
|
+
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
17996
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
17997
|
+
});
|
|
17998
|
+
}
|
|
17999
|
+
var init_history_cache_floor = __esm({
|
|
18000
|
+
"../../packages/local-graph/src/history-cache-floor.ts"() {
|
|
18001
|
+
"use strict";
|
|
18002
|
+
}
|
|
18003
|
+
});
|
|
18004
|
+
|
|
17954
18005
|
// ../../packages/local-graph/src/store.ts
|
|
17955
18006
|
function localEdgeViolation(fromLabel, type, toLabel) {
|
|
17956
18007
|
if (type in LOCAL_RULE_OVERRIDES) {
|
|
@@ -18033,6 +18084,7 @@ var init_store = __esm({
|
|
|
18033
18084
|
"use strict";
|
|
18034
18085
|
init_src2();
|
|
18035
18086
|
init_src();
|
|
18087
|
+
init_history_cache_floor();
|
|
18036
18088
|
LOCAL_RULE_OVERRIDES = {
|
|
18037
18089
|
ANCHORED_AT: {
|
|
18038
18090
|
from: EDGE_RULES["ANCHORED_AT"]?.from,
|
|
@@ -18203,6 +18255,7 @@ CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_js
|
|
|
18203
18255
|
);
|
|
18204
18256
|
}
|
|
18205
18257
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
18258
|
+
installHistoryCacheFloor(this.db);
|
|
18206
18259
|
this.stmts = {
|
|
18207
18260
|
insertNode: this.db.prepare(`
|
|
18208
18261
|
INSERT INTO nodes (
|
|
@@ -80859,7 +80912,7 @@ function createWatchBreaker(deps) {
|
|
|
80859
80912
|
}
|
|
80860
80913
|
|
|
80861
80914
|
// src/engine.ts
|
|
80862
|
-
var DAEMON_VERSION = true ? "2.0.13-dev.
|
|
80915
|
+
var DAEMON_VERSION = true ? "2.0.13-dev.3077" : "2.0.0-alpha.0";
|
|
80863
80916
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
80864
80917
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
80865
80918
|
var GIT_OP_MUTE_MS = 4e3;
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -24558,6 +24558,54 @@ import { parentPort, workerData } from "node:worker_threads";
|
|
|
24558
24558
|
// ../../packages/local-graph/src/store.ts
|
|
24559
24559
|
init_src2();
|
|
24560
24560
|
init_src();
|
|
24561
|
+
|
|
24562
|
+
// ../../packages/local-graph/src/history-cache-floor.ts
|
|
24563
|
+
function installHistoryCacheFloor(db) {
|
|
24564
|
+
const key = "history-cache-withdrawal-floor-2";
|
|
24565
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key)) return;
|
|
24566
|
+
db.transaction(() => {
|
|
24567
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get("history-cache-withdrawal-floor-1")) {
|
|
24568
|
+
db.exec("DROP INDEX IF EXISTS nodes_cloud_id");
|
|
24569
|
+
}
|
|
24570
|
+
db.exec(`
|
|
24571
|
+
CREATE VIEW IF NOT EXISTS history_cache_withdrawals AS
|
|
24572
|
+
SELECT n.id, json_extract(m.value, '$.action') = 'quarantine' AS privacy,
|
|
24573
|
+
json_extract(m.value, '$.nodeId') AS cloud_id,
|
|
24574
|
+
json_extract(m.value, '$.seq') AS seq,
|
|
24575
|
+
CASE WHEN json_extract(m.value, '$.action') = 'quarantine' THEN 'quarantined' ELSE 'contradicted' END AS support
|
|
24576
|
+
FROM nodes n JOIN store_meta m
|
|
24577
|
+
ON m.key = 'history-correction:' || coalesce(json_extract(n.attrs_json, '$.cloudNodeId'), n.id)
|
|
24578
|
+
WHERE json_extract(n.attrs_json, '$.source') = 'cloud' AND json_valid(m.value)
|
|
24579
|
+
AND json_extract(m.value, '$.seq') >= coalesce(json_extract(n.attrs_json, '$.historyCorrectionSeq'), 0)
|
|
24580
|
+
AND (json_extract(m.value, '$.action') = 'quarantine' OR json_extract(m.value, '$.sourceSupport') = 'contradicted');
|
|
24581
|
+
`);
|
|
24582
|
+
const lookup = (field) => `(SELECT ${field} FROM history_cache_withdrawals w WHERE w.id = nodes.id)`;
|
|
24583
|
+
const privacy = `coalesce(${lookup("privacy")}, 0)`;
|
|
24584
|
+
const description = `CASE WHEN ${privacy} THEN 'History source withdrawn.' ELSE description END`;
|
|
24585
|
+
const attrs = `CASE WHEN ${privacy} THEN json_object(
|
|
24586
|
+
'source', 'cloud', 'cloudNodeId', ${lookup("cloud_id")}, 'extractionSource', 'history-mined',
|
|
24587
|
+
'historyQuality', json_object('sourceSupport', 'quarantined', 'applicability', 'unknown'),
|
|
24588
|
+
'historyCorrectionSeq', ${lookup("seq")})
|
|
24589
|
+
ELSE json_set(json_remove(attrs_json, '$.embeddingVersion'),
|
|
24590
|
+
'$.historyQuality.sourceSupport', coalesce(${lookup("support")}, json_extract(attrs_json, '$.historyQuality.sourceSupport')),
|
|
24591
|
+
'$.historyQuality.applicability', 'unknown',
|
|
24592
|
+
'$.historyCorrectionSeq', coalesce(${lookup("seq")}, json_extract(attrs_json, '$.historyCorrectionSeq'), 0)) END`;
|
|
24593
|
+
const repair = (scope) => `UPDATE nodes SET description = ${description},
|
|
24594
|
+
embedding_blob = NULL, embedding_json = '[]', is_landmark = 0, attrs_json = ${attrs}
|
|
24595
|
+
WHERE (${scope}) AND (json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')
|
|
24596
|
+
OR EXISTS(SELECT 1 FROM history_cache_withdrawals w WHERE w.id = nodes.id))
|
|
24597
|
+
AND (embedding_blob IS NOT NULL OR embedding_json <> '[]' OR is_landmark <> 0
|
|
24598
|
+
OR description <> ${description} OR attrs_json <> ${attrs});`;
|
|
24599
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
24600
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS history_cache_nodes_${operation.toLowerCase()}
|
|
24601
|
+
AFTER ${operation} ON nodes BEGIN ${repair("id = NEW.id")} END;`);
|
|
24602
|
+
}
|
|
24603
|
+
db.exec(repair("json_extract(attrs_json, '$.source') = 'cloud' OR json_extract(attrs_json, '$.historyQuality.sourceSupport') IN ('quarantined','contradicted')"));
|
|
24604
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(key, "installed");
|
|
24605
|
+
});
|
|
24606
|
+
}
|
|
24607
|
+
|
|
24608
|
+
// ../../packages/local-graph/src/store.ts
|
|
24561
24609
|
var LOCAL_RULE_OVERRIDES = {
|
|
24562
24610
|
ANCHORED_AT: {
|
|
24563
24611
|
from: EDGE_RULES["ANCHORED_AT"]?.from,
|
|
@@ -24800,6 +24848,7 @@ var SqliteGraphStore = class {
|
|
|
24800
24848
|
);
|
|
24801
24849
|
}
|
|
24802
24850
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
24851
|
+
installHistoryCacheFloor(this.db);
|
|
24803
24852
|
this.stmts = {
|
|
24804
24853
|
insertNode: this.db.prepare(`
|
|
24805
24854
|
INSERT INTO nodes (
|