@inerrata-corporation/errata 2.0.21-dev.3749 → 2.0.21-dev.3763
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
CHANGED
|
@@ -15726,10 +15726,12 @@ var init_history_quality = __esm({
|
|
|
15726
15726
|
});
|
|
15727
15727
|
|
|
15728
15728
|
// ../../packages/shared/src/history-read.ts
|
|
15729
|
+
var CLOUD_ATTR_DUPLICATE_KEYS;
|
|
15729
15730
|
var init_history_read = __esm({
|
|
15730
15731
|
"../../packages/shared/src/history-read.ts"() {
|
|
15731
15732
|
"use strict";
|
|
15732
15733
|
init_history_dependencies();
|
|
15734
|
+
CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
|
|
15733
15735
|
}
|
|
15734
15736
|
});
|
|
15735
15737
|
|
|
@@ -16396,6 +16398,39 @@ function installEditPlaceholderRetirement(db) {
|
|
|
16396
16398
|
});
|
|
16397
16399
|
}
|
|
16398
16400
|
|
|
16401
|
+
// ../../packages/local-graph/src/cloud-attr-compaction.ts
|
|
16402
|
+
init_src2();
|
|
16403
|
+
var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
|
|
16404
|
+
var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
|
|
16405
|
+
function compacted(row) {
|
|
16406
|
+
const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
|
|
16407
|
+
const nested = `CASE WHEN json_type(${row}.attrs_json, '$.attrsJson') = 'text' AND json_valid(${packed})
|
|
16408
|
+
AND json_type(${packed}) = 'object' THEN ${packed} ELSE '{}' END`;
|
|
16409
|
+
const value = `CASE WHEN type IN ('array','object') THEN json(value) WHEN type IN ('true','false') THEN json(type) ELSE value END`;
|
|
16410
|
+
return `(SELECT json_group_object(key, ${value}) FROM (
|
|
16411
|
+
SELECT key, value, type, min(pri) FROM (
|
|
16412
|
+
SELECT key, value, type, 0 AS pri FROM json_each(${row}.attrs_json)
|
|
16413
|
+
UNION ALL
|
|
16414
|
+
SELECT key, value, type, 1 AS pri FROM json_each(${nested})
|
|
16415
|
+
) WHERE key NOT IN (${DUPES}) GROUP BY key))`;
|
|
16416
|
+
}
|
|
16417
|
+
function dirty(row) {
|
|
16418
|
+
const has = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `json_type(${row}.attrs_json, '$.${k}') IS NOT NULL`).join(" OR ");
|
|
16419
|
+
return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
|
|
16420
|
+
}
|
|
16421
|
+
function installCloudAttrCompaction(db) {
|
|
16422
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
|
|
16423
|
+
db.transaction(() => {
|
|
16424
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
16425
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
|
|
16426
|
+
AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
|
|
16427
|
+
BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
|
|
16428
|
+
}
|
|
16429
|
+
db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
|
|
16430
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
|
|
16431
|
+
});
|
|
16432
|
+
}
|
|
16433
|
+
|
|
16399
16434
|
// ../../packages/math/src/constants.ts
|
|
16400
16435
|
var NEMORI_DEDUP_COSINE = 0.88;
|
|
16401
16436
|
|
|
@@ -16752,6 +16787,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
|
|
|
16752
16787
|
-- Problems by the file their anchor hint names: the harvest upgrades hints for
|
|
16753
16788
|
-- every edited file of every turn, and a scan parses every Problem's attrs.
|
|
16754
16789
|
CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
|
|
16790
|
+
-- Problems by the command / checker / file that opened them. The generalizer
|
|
16791
|
+
-- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
|
|
16792
|
+
-- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
|
|
16793
|
+
CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
|
|
16794
|
+
CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
|
|
16795
|
+
CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
|
|
16755
16796
|
-- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
|
|
16756
16797
|
-- tool response (the enrichment piggyback), so it must not parse every
|
|
16757
16798
|
-- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
|
|
@@ -16855,6 +16896,7 @@ var SqliteGraphStore = class {
|
|
|
16855
16896
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
16856
16897
|
installHistoryCacheFloor(this.db);
|
|
16857
16898
|
installEditPlaceholderRetirement(this.db);
|
|
16899
|
+
installCloudAttrCompaction(this.db);
|
|
16858
16900
|
if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
|
|
16859
16901
|
this.db.transaction(() => {
|
|
16860
16902
|
this.repairSessionAliases();
|
package/errata.mjs
CHANGED
|
@@ -17291,6 +17291,11 @@ function unpackHistoryAttrs(attrs = {}) {
|
|
|
17291
17291
|
}
|
|
17292
17292
|
return { ...nested, ...attrs };
|
|
17293
17293
|
}
|
|
17294
|
+
function localCloudAttrs(attrs = {}) {
|
|
17295
|
+
const out2 = unpackHistoryAttrs(attrs);
|
|
17296
|
+
for (const key of CLOUD_ATTR_DUPLICATE_KEYS) delete out2[key];
|
|
17297
|
+
return out2;
|
|
17298
|
+
}
|
|
17294
17299
|
function historyReadPolicy(node2, options = {}) {
|
|
17295
17300
|
const attrs = unpackHistoryAttrs(node2.attrs);
|
|
17296
17301
|
if (attrs["source"] === "cloud" && typeof attrs["extractionSource"] !== "string" && attrs["historyQuality"] == null) {
|
|
@@ -17317,10 +17322,12 @@ function historyReadPolicy(node2, options = {}) {
|
|
|
17317
17322
|
notice: `History-derived${at}; source ${String(source)}; applicability ${current ? String(applicability) : "unknown at this checkout"}; ${environmentKnown ? "dependency context checked" : "dependency applicability unverified"}; ${independentlyValidated ? "separate validation recorded" : "not independently validated"}.`
|
|
17318
17323
|
};
|
|
17319
17324
|
}
|
|
17325
|
+
var CLOUD_ATTR_DUPLICATE_KEYS;
|
|
17320
17326
|
var init_history_read = __esm({
|
|
17321
17327
|
"../../packages/shared/src/history-read.ts"() {
|
|
17322
17328
|
"use strict";
|
|
17323
17329
|
init_history_dependencies();
|
|
17330
|
+
CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
|
|
17324
17331
|
}
|
|
17325
17332
|
});
|
|
17326
17333
|
|
|
@@ -17519,6 +17526,7 @@ __export(src_exports, {
|
|
|
17519
17526
|
BRIDGE_EDGES: () => BRIDGE_EDGES,
|
|
17520
17527
|
CAUSAL_EDGES: () => CAUSAL_EDGES,
|
|
17521
17528
|
CAUSAL_PROTECT_EDGES: () => CAUSAL_PROTECT_EDGES,
|
|
17529
|
+
CLOUD_ATTR_DUPLICATE_KEYS: () => CLOUD_ATTR_DUPLICATE_KEYS,
|
|
17522
17530
|
CLOUD_EDGE_TYPES: () => CLOUD_EDGE_TYPES,
|
|
17523
17531
|
CLOUD_NODE_LABELS: () => CLOUD_NODE_LABELS,
|
|
17524
17532
|
CLOUD_WRITABLE_NODE_LABELS: () => CLOUD_WRITABLE_NODE_LABELS,
|
|
@@ -17647,6 +17655,7 @@ __export(src_exports, {
|
|
|
17647
17655
|
isValidEdge: () => isValidEdge,
|
|
17648
17656
|
isValidEdgeType: () => isValidEdgeType,
|
|
17649
17657
|
languageCanonicalId: () => languageCanonicalId,
|
|
17658
|
+
localCloudAttrs: () => localCloudAttrs,
|
|
17650
17659
|
namedHistoryDependency: () => namedHistoryDependency,
|
|
17651
17660
|
nearestDeps: () => nearestDeps,
|
|
17652
17661
|
normalizeExtractionSource: () => normalizeExtractionSource,
|
|
@@ -18355,6 +18364,45 @@ var init_edit_placeholder_retirement = __esm({
|
|
|
18355
18364
|
}
|
|
18356
18365
|
});
|
|
18357
18366
|
|
|
18367
|
+
// ../../packages/local-graph/src/cloud-attr-compaction.ts
|
|
18368
|
+
function compacted(row) {
|
|
18369
|
+
const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
|
|
18370
|
+
const nested = `CASE WHEN json_type(${row}.attrs_json, '$.attrsJson') = 'text' AND json_valid(${packed})
|
|
18371
|
+
AND json_type(${packed}) = 'object' THEN ${packed} ELSE '{}' END`;
|
|
18372
|
+
const value = `CASE WHEN type IN ('array','object') THEN json(value) WHEN type IN ('true','false') THEN json(type) ELSE value END`;
|
|
18373
|
+
return `(SELECT json_group_object(key, ${value}) FROM (
|
|
18374
|
+
SELECT key, value, type, min(pri) FROM (
|
|
18375
|
+
SELECT key, value, type, 0 AS pri FROM json_each(${row}.attrs_json)
|
|
18376
|
+
UNION ALL
|
|
18377
|
+
SELECT key, value, type, 1 AS pri FROM json_each(${nested})
|
|
18378
|
+
) WHERE key NOT IN (${DUPES}) GROUP BY key))`;
|
|
18379
|
+
}
|
|
18380
|
+
function dirty(row) {
|
|
18381
|
+
const has = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `json_type(${row}.attrs_json, '$.${k}') IS NOT NULL`).join(" OR ");
|
|
18382
|
+
return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
|
|
18383
|
+
}
|
|
18384
|
+
function installCloudAttrCompaction(db) {
|
|
18385
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
|
|
18386
|
+
db.transaction(() => {
|
|
18387
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
18388
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
|
|
18389
|
+
AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
|
|
18390
|
+
BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
|
|
18391
|
+
}
|
|
18392
|
+
db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
|
|
18393
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
|
|
18394
|
+
});
|
|
18395
|
+
}
|
|
18396
|
+
var CLOUD_ATTR_COMPACTION_KEY, DUPES;
|
|
18397
|
+
var init_cloud_attr_compaction = __esm({
|
|
18398
|
+
"../../packages/local-graph/src/cloud-attr-compaction.ts"() {
|
|
18399
|
+
"use strict";
|
|
18400
|
+
init_src2();
|
|
18401
|
+
CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
|
|
18402
|
+
DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
|
|
18403
|
+
}
|
|
18404
|
+
});
|
|
18405
|
+
|
|
18358
18406
|
// ../../packages/math/src/constants.ts
|
|
18359
18407
|
var SURPRISE_MOMENTUM, SURPRISE_LEARNING_RATE, SURPRISE_LEARNING_RATE_SCALING, TIER_HALFLIFE_MULTIPLIER, HIT_RATE_SCALING_ALPHA, BASE_HALF_LIFE_SEQ, MOMENTUM_GATE_FLOOR, SURPRISE_RECENCY_LAMBDA_SEQ, NEMORI_SOFT_WRITE_MIN_COSINE, NEMORI_SOFT_WRITE_MAX_COSINE, NEMORI_DEDUP_COSINE, NEMORI_SOFT_ALPHA_MIN, NEMORI_SOFT_ALPHA_MAX, NEMORI_HIGH_SURPRISE_THRESHOLD, NEMORI_PREDICTION_FLOOR, REVIEW_SURPRISE_THRESHOLD, REVIEW_HITS_THRESHOLD;
|
|
18360
18408
|
var init_constants = __esm({
|
|
@@ -19249,7 +19297,7 @@ function graphStoreNeedsPreparation(path2) {
|
|
|
19249
19297
|
for (const match2 of (SCHEMA_SQL + TEMPORAL_INDEX_SQL).matchAll(/CREATE INDEX IF NOT EXISTS (\w+)/g)) {
|
|
19250
19298
|
if (!indexes.has(match2[1])) return true;
|
|
19251
19299
|
}
|
|
19252
|
-
return [SESSION_REPAIR_KEY, HISTORY_CACHE_FLOOR_KEY, EDIT_PLACEHOLDER_FLOOR_KEY].some((key) => !db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
|
|
19300
|
+
return [SESSION_REPAIR_KEY, HISTORY_CACHE_FLOOR_KEY, EDIT_PLACEHOLDER_FLOOR_KEY, CLOUD_ATTR_COMPACTION_KEY].some((key) => !db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
|
|
19253
19301
|
} catch {
|
|
19254
19302
|
return true;
|
|
19255
19303
|
} finally {
|
|
@@ -19325,6 +19373,7 @@ var init_store = __esm({
|
|
|
19325
19373
|
init_history_cache_floor();
|
|
19326
19374
|
init_session_evidence();
|
|
19327
19375
|
init_edit_placeholder_retirement();
|
|
19376
|
+
init_cloud_attr_compaction();
|
|
19328
19377
|
init_src3();
|
|
19329
19378
|
PAGE_RANK_SCALE_KEY = "pageRankScale.p95.v1";
|
|
19330
19379
|
TEXT_SEARCH_COLUMNS = `id, label, description, page_rank,
|
|
@@ -19479,6 +19528,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
|
|
|
19479
19528
|
-- Problems by the file their anchor hint names: the harvest upgrades hints for
|
|
19480
19529
|
-- every edited file of every turn, and a scan parses every Problem's attrs.
|
|
19481
19530
|
CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
|
|
19531
|
+
-- Problems by the command / checker / file that opened them. The generalizer
|
|
19532
|
+
-- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
|
|
19533
|
+
-- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
|
|
19534
|
+
CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
|
|
19535
|
+
CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
|
|
19536
|
+
CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
|
|
19482
19537
|
-- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
|
|
19483
19538
|
-- tool response (the enrichment piggyback), so it must not parse every
|
|
19484
19539
|
-- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
|
|
@@ -19525,6 +19580,7 @@ CREATE INDEX IF NOT EXISTS nodes_enrichment_pending ON nodes(json_extract(attrs_
|
|
|
19525
19580
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
19526
19581
|
installHistoryCacheFloor(this.db);
|
|
19527
19582
|
installEditPlaceholderRetirement(this.db);
|
|
19583
|
+
installCloudAttrCompaction(this.db);
|
|
19528
19584
|
if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
|
|
19529
19585
|
this.db.transaction(() => {
|
|
19530
19586
|
this.repairSessionAliases();
|
|
@@ -27354,7 +27410,7 @@ var init_client = __esm({
|
|
|
27354
27410
|
isLandmark: false,
|
|
27355
27411
|
community: null,
|
|
27356
27412
|
stability: "stable",
|
|
27357
|
-
attrs: { ...
|
|
27413
|
+
attrs: { ...localCloudAttrs(n.attrs), source: "cloud", cloudNodeId: n.nodeId }
|
|
27358
27414
|
}));
|
|
27359
27415
|
const edges = res.edges.map((e) => ({
|
|
27360
27416
|
id: digest({ from: e.fromCanonicalId, type: e.type, to: e.toCanonicalId }),
|
|
@@ -30655,8 +30711,8 @@ async function runGeneralizer(opts) {
|
|
|
30655
30711
|
const command = commandSignatureOf(anyEv);
|
|
30656
30712
|
const priorFiles = /* @__PURE__ */ new Set();
|
|
30657
30713
|
if (command) {
|
|
30658
|
-
for (const p of opts.store.
|
|
30659
|
-
if (p.attrs["source"] === "lsp"
|
|
30714
|
+
for (const p of opts.store.findLiveNodesByAttr("Problem", "diagCommand", command)) {
|
|
30715
|
+
if (p.attrs["source"] === "lsp") {
|
|
30660
30716
|
priorFiles.add(p.attrs["lspRelPath"]);
|
|
30661
30717
|
}
|
|
30662
30718
|
}
|
|
@@ -31476,8 +31532,7 @@ function detectResolution(opts, ev) {
|
|
|
31476
31532
|
const sig = commandSignature(sh.command);
|
|
31477
31533
|
const now = Date.now();
|
|
31478
31534
|
const resolved = [];
|
|
31479
|
-
for (const p of opts.store.
|
|
31480
|
-
if (p.attrs["commandSignature"] !== sig) continue;
|
|
31535
|
+
for (const p of opts.store.findLiveNodesByAttr("Problem", "commandSignature", sig)) {
|
|
31481
31536
|
resolveProblem(opts.store, p, now);
|
|
31482
31537
|
resolved.push(p.id);
|
|
31483
31538
|
}
|
|
@@ -31594,9 +31649,7 @@ function reconcileDiagnostics(store, workspaceId2, relPath, diags, t, command) {
|
|
|
31594
31649
|
wanted.set(diagnosticKey(relPath, d), d);
|
|
31595
31650
|
}
|
|
31596
31651
|
const scope = command ?? null;
|
|
31597
|
-
const open2 = store.
|
|
31598
|
-
(p) => p.attrs["source"] === "lsp" && p.attrs["lspRelPath"] === relPath && (p.attrs["diagCommand"] ?? null) === scope
|
|
31599
|
-
);
|
|
31652
|
+
const open2 = store.findLiveNodesByAttr("Problem", "lspRelPath", relPath).filter((p) => p.attrs["source"] === "lsp" && (p.attrs["diagCommand"] ?? null) === scope);
|
|
31600
31653
|
const openKeys = new Set(open2.map((p) => p.attrs["diagnosticKey"]));
|
|
31601
31654
|
let opened = 0;
|
|
31602
31655
|
for (const [key, d] of wanted) {
|
|
@@ -82926,7 +82979,7 @@ function createWatchBreaker(deps) {
|
|
|
82926
82979
|
}
|
|
82927
82980
|
|
|
82928
82981
|
// src/engine.ts
|
|
82929
|
-
var DAEMON_VERSION = true ? "2.0.21-dev.
|
|
82982
|
+
var DAEMON_VERSION = true ? "2.0.21-dev.3763" : "2.0.0-alpha.0";
|
|
82930
82983
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
82931
82984
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
82932
82985
|
var GIT_OP_MUTE_MS = 4e3;
|
package/generalize-worker.mjs
CHANGED
|
@@ -14651,6 +14651,9 @@ var CastaliaIngestPayloadSchema = external_exports.object({
|
|
|
14651
14651
|
symbolSummaries: SymbolSummarySidecarSchema.optional()
|
|
14652
14652
|
});
|
|
14653
14653
|
|
|
14654
|
+
// ../../packages/shared/src/history-read.ts
|
|
14655
|
+
var CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
|
|
14656
|
+
|
|
14654
14657
|
// ../../packages/shared/src/history-revision.ts
|
|
14655
14658
|
var Sha = external_exports.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);
|
|
14656
14659
|
var HistoryRevisionRequestSchema = external_exports.strictObject({
|
|
@@ -14980,6 +14983,38 @@ function installEditPlaceholderRetirement(db) {
|
|
|
14980
14983
|
});
|
|
14981
14984
|
}
|
|
14982
14985
|
|
|
14986
|
+
// ../../packages/local-graph/src/cloud-attr-compaction.ts
|
|
14987
|
+
var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
|
|
14988
|
+
var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
|
|
14989
|
+
function compacted(row) {
|
|
14990
|
+
const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
|
|
14991
|
+
const nested = `CASE WHEN json_type(${row}.attrs_json, '$.attrsJson') = 'text' AND json_valid(${packed})
|
|
14992
|
+
AND json_type(${packed}) = 'object' THEN ${packed} ELSE '{}' END`;
|
|
14993
|
+
const value = `CASE WHEN type IN ('array','object') THEN json(value) WHEN type IN ('true','false') THEN json(type) ELSE value END`;
|
|
14994
|
+
return `(SELECT json_group_object(key, ${value}) FROM (
|
|
14995
|
+
SELECT key, value, type, min(pri) FROM (
|
|
14996
|
+
SELECT key, value, type, 0 AS pri FROM json_each(${row}.attrs_json)
|
|
14997
|
+
UNION ALL
|
|
14998
|
+
SELECT key, value, type, 1 AS pri FROM json_each(${nested})
|
|
14999
|
+
) WHERE key NOT IN (${DUPES}) GROUP BY key))`;
|
|
15000
|
+
}
|
|
15001
|
+
function dirty(row) {
|
|
15002
|
+
const has = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `json_type(${row}.attrs_json, '$.${k}') IS NOT NULL`).join(" OR ");
|
|
15003
|
+
return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
|
|
15004
|
+
}
|
|
15005
|
+
function installCloudAttrCompaction(db) {
|
|
15006
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
|
|
15007
|
+
db.transaction(() => {
|
|
15008
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
15009
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
|
|
15010
|
+
AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
|
|
15011
|
+
BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
|
|
15012
|
+
}
|
|
15013
|
+
db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
|
|
15014
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
|
|
15015
|
+
});
|
|
15016
|
+
}
|
|
15017
|
+
|
|
14983
15018
|
// ../../packages/math/src/relevance.ts
|
|
14984
15019
|
function pageRankScale(ranks) {
|
|
14985
15020
|
const positive = [...ranks].filter((r) => Number.isFinite(r) && r > 0).sort((a, b) => a - b);
|
|
@@ -15159,6 +15194,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
|
|
|
15159
15194
|
-- Problems by the file their anchor hint names: the harvest upgrades hints for
|
|
15160
15195
|
-- every edited file of every turn, and a scan parses every Problem's attrs.
|
|
15161
15196
|
CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
|
|
15197
|
+
-- Problems by the command / checker / file that opened them. The generalizer
|
|
15198
|
+
-- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
|
|
15199
|
+
-- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
|
|
15200
|
+
CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
|
|
15201
|
+
CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
|
|
15202
|
+
CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
|
|
15162
15203
|
-- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
|
|
15163
15204
|
-- tool response (the enrichment piggyback), so it must not parse every
|
|
15164
15205
|
-- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
|
|
@@ -15262,6 +15303,7 @@ var SqliteGraphStore = class {
|
|
|
15262
15303
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
15263
15304
|
installHistoryCacheFloor(this.db);
|
|
15264
15305
|
installEditPlaceholderRetirement(this.db);
|
|
15306
|
+
installCloudAttrCompaction(this.db);
|
|
15265
15307
|
if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
|
|
15266
15308
|
this.db.transaction(() => {
|
|
15267
15309
|
this.repairSessionAliases();
|
package/package.json
CHANGED
package/pass-worker.mjs
CHANGED
|
@@ -16146,10 +16146,12 @@ function historyReadPolicy(node, options = {}) {
|
|
|
16146
16146
|
notice: `History-derived${at}; source ${String(source)}; applicability ${current ? String(applicability) : "unknown at this checkout"}; ${environmentKnown ? "dependency context checked" : "dependency applicability unverified"}; ${independentlyValidated ? "separate validation recorded" : "not independently validated"}.`
|
|
16147
16147
|
};
|
|
16148
16148
|
}
|
|
16149
|
+
var CLOUD_ATTR_DUPLICATE_KEYS;
|
|
16149
16150
|
var init_history_read = __esm({
|
|
16150
16151
|
"../../packages/shared/src/history-read.ts"() {
|
|
16151
16152
|
"use strict";
|
|
16152
16153
|
init_history_dependencies();
|
|
16154
|
+
CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
|
|
16153
16155
|
}
|
|
16154
16156
|
});
|
|
16155
16157
|
|
|
@@ -25425,6 +25427,39 @@ function installEditPlaceholderRetirement(db) {
|
|
|
25425
25427
|
});
|
|
25426
25428
|
}
|
|
25427
25429
|
|
|
25430
|
+
// ../../packages/local-graph/src/cloud-attr-compaction.ts
|
|
25431
|
+
init_src2();
|
|
25432
|
+
var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
|
|
25433
|
+
var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
|
|
25434
|
+
function compacted(row) {
|
|
25435
|
+
const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
|
|
25436
|
+
const nested = `CASE WHEN json_type(${row}.attrs_json, '$.attrsJson') = 'text' AND json_valid(${packed})
|
|
25437
|
+
AND json_type(${packed}) = 'object' THEN ${packed} ELSE '{}' END`;
|
|
25438
|
+
const value = `CASE WHEN type IN ('array','object') THEN json(value) WHEN type IN ('true','false') THEN json(type) ELSE value END`;
|
|
25439
|
+
return `(SELECT json_group_object(key, ${value}) FROM (
|
|
25440
|
+
SELECT key, value, type, min(pri) FROM (
|
|
25441
|
+
SELECT key, value, type, 0 AS pri FROM json_each(${row}.attrs_json)
|
|
25442
|
+
UNION ALL
|
|
25443
|
+
SELECT key, value, type, 1 AS pri FROM json_each(${nested})
|
|
25444
|
+
) WHERE key NOT IN (${DUPES}) GROUP BY key))`;
|
|
25445
|
+
}
|
|
25446
|
+
function dirty(row) {
|
|
25447
|
+
const has = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `json_type(${row}.attrs_json, '$.${k}') IS NOT NULL`).join(" OR ");
|
|
25448
|
+
return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
|
|
25449
|
+
}
|
|
25450
|
+
function installCloudAttrCompaction(db) {
|
|
25451
|
+
if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
|
|
25452
|
+
db.transaction(() => {
|
|
25453
|
+
for (const operation of ["INSERT", "UPDATE"]) {
|
|
25454
|
+
db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
|
|
25455
|
+
AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
|
|
25456
|
+
BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
|
|
25457
|
+
}
|
|
25458
|
+
db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
|
|
25459
|
+
db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
|
|
25460
|
+
});
|
|
25461
|
+
}
|
|
25462
|
+
|
|
25428
25463
|
// ../../packages/math/src/pagerank.ts
|
|
25429
25464
|
function pagerank(input) {
|
|
25430
25465
|
const damping = input.damping ?? 0.85;
|
|
@@ -26018,6 +26053,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
|
|
|
26018
26053
|
-- Problems by the file their anchor hint names: the harvest upgrades hints for
|
|
26019
26054
|
-- every edited file of every turn, and a scan parses every Problem's attrs.
|
|
26020
26055
|
CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
|
|
26056
|
+
-- Problems by the command / checker / file that opened them. The generalizer
|
|
26057
|
+
-- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
|
|
26058
|
+
-- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
|
|
26059
|
+
CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
|
|
26060
|
+
CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
|
|
26061
|
+
CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
|
|
26021
26062
|
-- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
|
|
26022
26063
|
-- tool response (the enrichment piggyback), so it must not parse every
|
|
26023
26064
|
-- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
|
|
@@ -26121,6 +26162,7 @@ var SqliteGraphStore = class {
|
|
|
26121
26162
|
this.db.exec(TEMPORAL_INDEX_SQL);
|
|
26122
26163
|
installHistoryCacheFloor(this.db);
|
|
26123
26164
|
installEditPlaceholderRetirement(this.db);
|
|
26165
|
+
installCloudAttrCompaction(this.db);
|
|
26124
26166
|
if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
|
|
26125
26167
|
this.db.transaction(() => {
|
|
26126
26168
|
this.repairSessionAliases();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
9cdbe6022b073c75f8e7f7c88290ecc356976f7febaac12fb63cb506342ffc3c .codex-plugin/plugin.json
|
|
2
2
|
a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
|
|
3
3
|
fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
|
|
4
4
|
73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js
|