@inerrata-corporation/errata 2.0.21-dev.3749 → 2.0.21-dev.3861

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.
@@ -594,6 +594,13 @@ function aliasRegex(alias) {
594
594
  const body = escapeRe(alias).replace(/\\?\s+/g, "\\s+");
595
595
  return new RegExp(`(?<![\\w-])${body}(?![\\w-])`, "i");
596
596
  }
597
+ function withoutEntityMentions(text, entityId) {
598
+ let out = text;
599
+ for (const { entity, re } of COMPILED) {
600
+ if (entity.id === entityId) out = out.replace(new RegExp(re.source, "gi"), " ");
601
+ }
602
+ return out;
603
+ }
597
604
  function prefilterEntities(text) {
598
605
  const seen = /* @__PURE__ */ new Set();
599
606
  const hits = [];
@@ -770,13 +777,19 @@ var init_concept_bag = __esm({
770
777
 
771
778
  // ../../packages/shared/src/nlp/claim-id.ts
772
779
  function claimStructure(text, scope) {
773
- const entities = prefilterEntities(text).map((e) => e.id).sort();
780
+ const extracted = prefilterEntities(text);
781
+ const entities = extracted.map((e) => e.id).sort();
774
782
  const predicate = normalizePredicate(text);
775
783
  const stance = detectStance(text);
776
784
  const base = { entities, predicate, stance, scope: scope ?? {} };
777
- if (predicate === "" || entities.length === 0) base.raw = conceptBag(text);
785
+ if (predicate === "" || entities.length === 0 || predicateIsTheEntity(text, extracted[0].id, entities.length)) {
786
+ base.raw = conceptBag(text);
787
+ }
778
788
  return base;
779
789
  }
790
+ function predicateIsTheEntity(text, entityId, entityCount) {
791
+ return entityCount === 1 && normalizePredicate(withoutEntityMentions(text, entityId)) === "";
792
+ }
780
793
  function canonicalClaimId(text, scope) {
781
794
  const s = claimStructure(text, scope);
782
795
  return digest(
@@ -15726,10 +15739,12 @@ var init_history_quality = __esm({
15726
15739
  });
15727
15740
 
15728
15741
  // ../../packages/shared/src/history-read.ts
15742
+ var CLOUD_ATTR_DUPLICATE_KEYS;
15729
15743
  var init_history_read = __esm({
15730
15744
  "../../packages/shared/src/history-read.ts"() {
15731
15745
  "use strict";
15732
15746
  init_history_dependencies();
15747
+ CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
15733
15748
  }
15734
15749
  });
15735
15750
 
@@ -16396,6 +16411,39 @@ function installEditPlaceholderRetirement(db) {
16396
16411
  });
16397
16412
  }
16398
16413
 
16414
+ // ../../packages/local-graph/src/cloud-attr-compaction.ts
16415
+ init_src2();
16416
+ var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
16417
+ var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
16418
+ function compacted(row) {
16419
+ const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
16420
+ const nested = `CASE WHEN json_type(${row}.attrs_json, '$.attrsJson') = 'text' AND json_valid(${packed})
16421
+ AND json_type(${packed}) = 'object' THEN ${packed} ELSE '{}' END`;
16422
+ const value = `CASE WHEN type IN ('array','object') THEN json(value) WHEN type IN ('true','false') THEN json(type) ELSE value END`;
16423
+ return `(SELECT json_group_object(key, ${value}) FROM (
16424
+ SELECT key, value, type, min(pri) FROM (
16425
+ SELECT key, value, type, 0 AS pri FROM json_each(${row}.attrs_json)
16426
+ UNION ALL
16427
+ SELECT key, value, type, 1 AS pri FROM json_each(${nested})
16428
+ ) WHERE key NOT IN (${DUPES}) GROUP BY key))`;
16429
+ }
16430
+ function dirty(row) {
16431
+ const has = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `json_type(${row}.attrs_json, '$.${k}') IS NOT NULL`).join(" OR ");
16432
+ return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
16433
+ }
16434
+ function installCloudAttrCompaction(db) {
16435
+ if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
16436
+ db.transaction(() => {
16437
+ for (const operation of ["INSERT", "UPDATE"]) {
16438
+ db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
16439
+ AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
16440
+ BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
16441
+ }
16442
+ db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
16443
+ db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
16444
+ });
16445
+ }
16446
+
16399
16447
  // ../../packages/math/src/constants.ts
16400
16448
  var NEMORI_DEDUP_COSINE = 0.88;
16401
16449
 
@@ -16579,6 +16627,10 @@ function detectCommunitiesLeiden(input, opts = {}) {
16579
16627
  return normalize(assignment);
16580
16628
  }
16581
16629
 
16630
+ // ../../packages/math/src/void-demand.ts
16631
+ var DEMAND_HOT = Math.log1p(10);
16632
+ var DEMAND_WARM = Math.log1p(5);
16633
+
16582
16634
  // ../../packages/local-graph/src/store.ts
16583
16635
  var PAGE_RANK_SCALE_KEY = "pageRankScale.p95.v1";
16584
16636
  var TEXT_SEARCH_COLUMNS = `id, label, description, page_rank,
@@ -16752,6 +16804,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
16752
16804
  -- Problems by the file their anchor hint names: the harvest upgrades hints for
16753
16805
  -- every edited file of every turn, and a scan parses every Problem's attrs.
16754
16806
  CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
16807
+ -- Problems by the command / checker / file that opened them. The generalizer
16808
+ -- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
16809
+ -- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
16810
+ CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
16811
+ CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
16812
+ CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
16755
16813
  -- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
16756
16814
  -- tool response (the enrichment piggyback), so it must not parse every
16757
16815
  -- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
@@ -16855,6 +16913,7 @@ var SqliteGraphStore = class {
16855
16913
  this.db.exec(TEMPORAL_INDEX_SQL);
16856
16914
  installHistoryCacheFloor(this.db);
16857
16915
  installEditPlaceholderRetirement(this.db);
16916
+ installCloudAttrCompaction(this.db);
16858
16917
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
16859
16918
  this.db.transaction(() => {
16860
16919
  this.repairSessionAliases();
package/errata.mjs CHANGED
@@ -873,6 +873,13 @@ function aliasRegex(alias) {
873
873
  const body2 = escapeRe(alias).replace(/\\?\s+/g, "\\s+");
874
874
  return new RegExp(`(?<![\\w-])${body2}(?![\\w-])`, "i");
875
875
  }
876
+ function withoutEntityMentions(text, entityId) {
877
+ let out2 = text;
878
+ for (const { entity, re } of COMPILED) {
879
+ if (entity.id === entityId) out2 = out2.replace(new RegExp(re.source, "gi"), " ");
880
+ }
881
+ return out2;
882
+ }
876
883
  function prefilterEntities(text) {
877
884
  const seen = /* @__PURE__ */ new Set();
878
885
  const hits = [];
@@ -1052,13 +1059,19 @@ var init_concept_bag = __esm({
1052
1059
 
1053
1060
  // ../../packages/shared/src/nlp/claim-id.ts
1054
1061
  function claimStructure(text, scope) {
1055
- const entities = prefilterEntities(text).map((e) => e.id).sort();
1062
+ const extracted = prefilterEntities(text);
1063
+ const entities = extracted.map((e) => e.id).sort();
1056
1064
  const predicate = normalizePredicate(text);
1057
1065
  const stance = detectStance(text);
1058
1066
  const base = { entities, predicate, stance, scope: scope ?? {} };
1059
- if (predicate === "" || entities.length === 0) base.raw = conceptBag(text);
1067
+ if (predicate === "" || entities.length === 0 || predicateIsTheEntity(text, extracted[0].id, entities.length)) {
1068
+ base.raw = conceptBag(text);
1069
+ }
1060
1070
  return base;
1061
1071
  }
1072
+ function predicateIsTheEntity(text, entityId, entityCount) {
1073
+ return entityCount === 1 && normalizePredicate(withoutEntityMentions(text, entityId)) === "";
1074
+ }
1062
1075
  function canonicalClaimId(text, scope) {
1063
1076
  const s = claimStructure(text, scope);
1064
1077
  return digest(
@@ -17291,6 +17304,11 @@ function unpackHistoryAttrs(attrs = {}) {
17291
17304
  }
17292
17305
  return { ...nested, ...attrs };
17293
17306
  }
17307
+ function localCloudAttrs(attrs = {}) {
17308
+ const out2 = unpackHistoryAttrs(attrs);
17309
+ for (const key of CLOUD_ATTR_DUPLICATE_KEYS) delete out2[key];
17310
+ return out2;
17311
+ }
17294
17312
  function historyReadPolicy(node2, options = {}) {
17295
17313
  const attrs = unpackHistoryAttrs(node2.attrs);
17296
17314
  if (attrs["source"] === "cloud" && typeof attrs["extractionSource"] !== "string" && attrs["historyQuality"] == null) {
@@ -17317,10 +17335,12 @@ function historyReadPolicy(node2, options = {}) {
17317
17335
  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
17336
  };
17319
17337
  }
17338
+ var CLOUD_ATTR_DUPLICATE_KEYS;
17320
17339
  var init_history_read = __esm({
17321
17340
  "../../packages/shared/src/history-read.ts"() {
17322
17341
  "use strict";
17323
17342
  init_history_dependencies();
17343
+ CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
17324
17344
  }
17325
17345
  });
17326
17346
 
@@ -17519,6 +17539,7 @@ __export(src_exports, {
17519
17539
  BRIDGE_EDGES: () => BRIDGE_EDGES,
17520
17540
  CAUSAL_EDGES: () => CAUSAL_EDGES,
17521
17541
  CAUSAL_PROTECT_EDGES: () => CAUSAL_PROTECT_EDGES,
17542
+ CLOUD_ATTR_DUPLICATE_KEYS: () => CLOUD_ATTR_DUPLICATE_KEYS,
17522
17543
  CLOUD_EDGE_TYPES: () => CLOUD_EDGE_TYPES,
17523
17544
  CLOUD_NODE_LABELS: () => CLOUD_NODE_LABELS,
17524
17545
  CLOUD_WRITABLE_NODE_LABELS: () => CLOUD_WRITABLE_NODE_LABELS,
@@ -17647,6 +17668,7 @@ __export(src_exports, {
17647
17668
  isValidEdge: () => isValidEdge,
17648
17669
  isValidEdgeType: () => isValidEdgeType,
17649
17670
  languageCanonicalId: () => languageCanonicalId,
17671
+ localCloudAttrs: () => localCloudAttrs,
17650
17672
  namedHistoryDependency: () => namedHistoryDependency,
17651
17673
  nearestDeps: () => nearestDeps,
17652
17674
  normalizeExtractionSource: () => normalizeExtractionSource,
@@ -17699,7 +17721,8 @@ __export(src_exports, {
17699
17721
  unregisteredGraphEventKeys: () => unregisteredGraphEventKeys,
17700
17722
  validateCastaliaPayload: () => validateCastaliaPayload,
17701
17723
  versionlessPurl: () => versionlessPurl,
17702
- vetSidecarSummaries: () => vetSidecarSummaries
17724
+ vetSidecarSummaries: () => vetSidecarSummaries,
17725
+ withoutEntityMentions: () => withoutEntityMentions
17703
17726
  });
17704
17727
  var init_src = __esm({
17705
17728
  "../../packages/shared/src/index.ts"() {
@@ -18355,6 +18378,45 @@ var init_edit_placeholder_retirement = __esm({
18355
18378
  }
18356
18379
  });
18357
18380
 
18381
+ // ../../packages/local-graph/src/cloud-attr-compaction.ts
18382
+ function compacted(row) {
18383
+ const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
18384
+ const nested = `CASE WHEN json_type(${row}.attrs_json, '$.attrsJson') = 'text' AND json_valid(${packed})
18385
+ AND json_type(${packed}) = 'object' THEN ${packed} ELSE '{}' END`;
18386
+ const value = `CASE WHEN type IN ('array','object') THEN json(value) WHEN type IN ('true','false') THEN json(type) ELSE value END`;
18387
+ return `(SELECT json_group_object(key, ${value}) FROM (
18388
+ SELECT key, value, type, min(pri) FROM (
18389
+ SELECT key, value, type, 0 AS pri FROM json_each(${row}.attrs_json)
18390
+ UNION ALL
18391
+ SELECT key, value, type, 1 AS pri FROM json_each(${nested})
18392
+ ) WHERE key NOT IN (${DUPES}) GROUP BY key))`;
18393
+ }
18394
+ function dirty(row) {
18395
+ const has = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `json_type(${row}.attrs_json, '$.${k}') IS NOT NULL`).join(" OR ");
18396
+ return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
18397
+ }
18398
+ function installCloudAttrCompaction(db) {
18399
+ if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
18400
+ db.transaction(() => {
18401
+ for (const operation of ["INSERT", "UPDATE"]) {
18402
+ db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
18403
+ AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
18404
+ BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
18405
+ }
18406
+ db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
18407
+ db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
18408
+ });
18409
+ }
18410
+ var CLOUD_ATTR_COMPACTION_KEY, DUPES;
18411
+ var init_cloud_attr_compaction = __esm({
18412
+ "../../packages/local-graph/src/cloud-attr-compaction.ts"() {
18413
+ "use strict";
18414
+ init_src2();
18415
+ CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
18416
+ DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
18417
+ }
18418
+ });
18419
+
18358
18420
  // ../../packages/math/src/constants.ts
18359
18421
  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
18422
  var init_constants = __esm({
@@ -18966,6 +19028,16 @@ var init_spectral = __esm({
18966
19028
  }
18967
19029
  });
18968
19030
 
19031
+ // ../../packages/math/src/void-demand.ts
19032
+ var DEMAND_HOT, DEMAND_WARM;
19033
+ var init_void_demand = __esm({
19034
+ "../../packages/math/src/void-demand.ts"() {
19035
+ "use strict";
19036
+ DEMAND_HOT = Math.log1p(10);
19037
+ DEMAND_WARM = Math.log1p(5);
19038
+ }
19039
+ });
19040
+
18969
19041
  // ../../packages/math/src/bko/a1-stable-motif.ts
18970
19042
  function a1StableMotif(input) {
18971
19043
  if (input.instanceCount >= MIN_INSTANCES && input.survivedRuns >= MIN_SURVIVED_RUNS) {
@@ -19213,6 +19285,7 @@ var init_src3 = __esm({
19213
19285
  init_relevance();
19214
19286
  init_leiden();
19215
19287
  init_spectral();
19288
+ init_void_demand();
19216
19289
  init_motif_gate();
19217
19290
  init_bko();
19218
19291
  init_pagerank_local();
@@ -19249,7 +19322,7 @@ function graphStoreNeedsPreparation(path2) {
19249
19322
  for (const match2 of (SCHEMA_SQL + TEMPORAL_INDEX_SQL).matchAll(/CREATE INDEX IF NOT EXISTS (\w+)/g)) {
19250
19323
  if (!indexes.has(match2[1])) return true;
19251
19324
  }
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));
19325
+ 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
19326
  } catch {
19254
19327
  return true;
19255
19328
  } finally {
@@ -19325,6 +19398,7 @@ var init_store = __esm({
19325
19398
  init_history_cache_floor();
19326
19399
  init_session_evidence();
19327
19400
  init_edit_placeholder_retirement();
19401
+ init_cloud_attr_compaction();
19328
19402
  init_src3();
19329
19403
  PAGE_RANK_SCALE_KEY = "pageRankScale.p95.v1";
19330
19404
  TEXT_SEARCH_COLUMNS = `id, label, description, page_rank,
@@ -19479,6 +19553,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
19479
19553
  -- Problems by the file their anchor hint names: the harvest upgrades hints for
19480
19554
  -- every edited file of every turn, and a scan parses every Problem's attrs.
19481
19555
  CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
19556
+ -- Problems by the command / checker / file that opened them. The generalizer
19557
+ -- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
19558
+ -- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
19559
+ CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
19560
+ CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
19561
+ CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
19482
19562
  -- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
19483
19563
  -- tool response (the enrichment piggyback), so it must not parse every
19484
19564
  -- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
@@ -19525,6 +19605,7 @@ CREATE INDEX IF NOT EXISTS nodes_enrichment_pending ON nodes(json_extract(attrs_
19525
19605
  this.db.exec(TEMPORAL_INDEX_SQL);
19526
19606
  installHistoryCacheFloor(this.db);
19527
19607
  installEditPlaceholderRetirement(this.db);
19608
+ installCloudAttrCompaction(this.db);
19528
19609
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
19529
19610
  this.db.transaction(() => {
19530
19611
  this.repairSessionAliases();
@@ -27354,7 +27435,7 @@ var init_client = __esm({
27354
27435
  isLandmark: false,
27355
27436
  community: null,
27356
27437
  stability: "stable",
27357
- attrs: { ...unpackHistoryAttrs(n.attrs), source: "cloud", cloudNodeId: n.nodeId }
27438
+ attrs: { ...localCloudAttrs(n.attrs), source: "cloud", cloudNodeId: n.nodeId }
27358
27439
  }));
27359
27440
  const edges = res.edges.map((e) => ({
27360
27441
  id: digest({ from: e.fromCanonicalId, type: e.type, to: e.toCanonicalId }),
@@ -30655,8 +30736,8 @@ async function runGeneralizer(opts) {
30655
30736
  const command = commandSignatureOf(anyEv);
30656
30737
  const priorFiles = /* @__PURE__ */ new Set();
30657
30738
  if (command) {
30658
- for (const p of opts.store.findNodesByLabel("Problem")) {
30659
- if (p.attrs["source"] === "lsp" && (p.attrs["diagCommand"] ?? null) === command) {
30739
+ for (const p of opts.store.findLiveNodesByAttr("Problem", "diagCommand", command)) {
30740
+ if (p.attrs["source"] === "lsp") {
30660
30741
  priorFiles.add(p.attrs["lspRelPath"]);
30661
30742
  }
30662
30743
  }
@@ -31476,8 +31557,7 @@ function detectResolution(opts, ev) {
31476
31557
  const sig = commandSignature(sh.command);
31477
31558
  const now = Date.now();
31478
31559
  const resolved = [];
31479
- for (const p of opts.store.findNodesByLabel("Problem")) {
31480
- if (p.attrs["commandSignature"] !== sig) continue;
31560
+ for (const p of opts.store.findLiveNodesByAttr("Problem", "commandSignature", sig)) {
31481
31561
  resolveProblem(opts.store, p, now);
31482
31562
  resolved.push(p.id);
31483
31563
  }
@@ -31594,9 +31674,7 @@ function reconcileDiagnostics(store, workspaceId2, relPath, diags, t, command) {
31594
31674
  wanted.set(diagnosticKey(relPath, d), d);
31595
31675
  }
31596
31676
  const scope = command ?? null;
31597
- const open2 = store.findNodesByLabel("Problem").filter(
31598
- (p) => p.attrs["source"] === "lsp" && p.attrs["lspRelPath"] === relPath && (p.attrs["diagCommand"] ?? null) === scope
31599
- );
31677
+ const open2 = store.findLiveNodesByAttr("Problem", "lspRelPath", relPath).filter((p) => p.attrs["source"] === "lsp" && (p.attrs["diagCommand"] ?? null) === scope);
31600
31678
  const openKeys = new Set(open2.map((p) => p.attrs["diagnosticKey"]));
31601
31679
  let opened = 0;
31602
31680
  for (const [key, d] of wanted) {
@@ -82926,7 +83004,7 @@ function createWatchBreaker(deps) {
82926
83004
  }
82927
83005
 
82928
83006
  // src/engine.ts
82929
- var DAEMON_VERSION = true ? "2.0.21-dev.3749" : "2.0.0-alpha.0";
83007
+ var DAEMON_VERSION = true ? "2.0.21-dev.3861" : "2.0.0-alpha.0";
82930
83008
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
82931
83009
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
82932
83010
  var GIT_OP_MUTE_MS = 4e3;
@@ -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,12 +14983,48 @@ 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);
14986
15021
  return positive.length ? Math.max(1e-9, positive[Math.floor((positive.length - 1) * 0.95)]) : 1;
14987
15022
  }
14988
15023
 
15024
+ // ../../packages/math/src/void-demand.ts
15025
+ var DEMAND_HOT = Math.log1p(10);
15026
+ var DEMAND_WARM = Math.log1p(5);
15027
+
14989
15028
  // ../../packages/local-graph/src/store.ts
14990
15029
  var PAGE_RANK_SCALE_KEY = "pageRankScale.p95.v1";
14991
15030
  var TEXT_SEARCH_COLUMNS = `id, label, description, page_rank,
@@ -15159,6 +15198,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
15159
15198
  -- Problems by the file their anchor hint names: the harvest upgrades hints for
15160
15199
  -- every edited file of every turn, and a scan parses every Problem's attrs.
15161
15200
  CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
15201
+ -- Problems by the command / checker / file that opened them. The generalizer
15202
+ -- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
15203
+ -- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
15204
+ CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
15205
+ CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
15206
+ CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
15162
15207
  -- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
15163
15208
  -- tool response (the enrichment piggyback), so it must not parse every
15164
15209
  -- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
@@ -15262,6 +15307,7 @@ var SqliteGraphStore = class {
15262
15307
  this.db.exec(TEMPORAL_INDEX_SQL);
15263
15308
  installHistoryCacheFloor(this.db);
15264
15309
  installEditPlaceholderRetirement(this.db);
15310
+ installCloudAttrCompaction(this.db);
15265
15311
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
15266
15312
  this.db.transaction(() => {
15267
15313
  this.repairSessionAliases();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.21-dev.3749",
3
+ "version": "2.0.21-dev.3861",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
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;
@@ -25693,6 +25728,10 @@ function detectCommunitiesLeiden(input, opts = {}) {
25693
25728
  return normalize(assignment);
25694
25729
  }
25695
25730
 
25731
+ // ../../packages/math/src/void-demand.ts
25732
+ var DEMAND_HOT = Math.log1p(10);
25733
+ var DEMAND_WARM = Math.log1p(5);
25734
+
25696
25735
  // ../../packages/math/src/bko/a1-stable-motif.ts
25697
25736
  var MIN_INSTANCES = 5;
25698
25737
  var MIN_SURVIVED_RUNS = 2;
@@ -26018,6 +26057,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_description ON nodes(description, label) W
26018
26057
  -- Problems by the file their anchor hint names: the harvest upgrades hints for
26019
26058
  -- every edited file of every turn, and a scan parses every Problem's attrs.
26020
26059
  CREATE INDEX IF NOT EXISTS nodes_anchor_hint_path ON nodes(json_extract(attrs_json, '$.anchorHint.path')) WHERE valid_to IS NULL;
26060
+ -- Problems by the command / checker / file that opened them. The generalizer
26061
+ -- looked these up per shell or tool EVENT by hydrating every Problem: ~12s of
26062
+ -- every minute of daemon main-thread time on a 3.4k-Problem store (2026-10-05).
26063
+ CREATE INDEX IF NOT EXISTS nodes_command_signature ON nodes(json_extract(attrs_json, '$.commandSignature')) WHERE valid_to IS NULL;
26064
+ CREATE INDEX IF NOT EXISTS nodes_diag_command ON nodes(json_extract(attrs_json, '$.diagCommand')) WHERE valid_to IS NULL;
26065
+ CREATE INDEX IF NOT EXISTS nodes_lsp_rel_path ON nodes(json_extract(attrs_json, '$.lspRelPath')) WHERE valid_to IS NULL;
26021
26066
  -- Nodes still waiting on a root-cause ask. The MCP server checks this on EVERY
26022
26067
  -- tool response (the enrichment piggyback), so it must not parse every
26023
26068
  -- Solution's and Problem's attrs per call. Not partial: the Problem pull reads
@@ -26121,6 +26166,7 @@ var SqliteGraphStore = class {
26121
26166
  this.db.exec(TEMPORAL_INDEX_SQL);
26122
26167
  installHistoryCacheFloor(this.db);
26123
26168
  installEditPlaceholderRetirement(this.db);
26169
+ installCloudAttrCompaction(this.db);
26124
26170
  if (!this.db.prepare("SELECT value FROM store_meta WHERE key = ?").get(SESSION_REPAIR_KEY)) {
26125
26171
  this.db.transaction(() => {
26126
26172
  this.repairSessionAliases();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.21-dev.3749",
3
+ "version": "2.0.21-dev.3861",
4
4
  "description": "A minimal 3D view of loaded Errata priors and recent graph bursts.",
5
5
  "author": {
6
6
  "name": "inErrata"
@@ -1,4 +1,4 @@
1
- a142636b5d846885ca508d1ca3b8fce7e3fca053c00311599d8c93d97e3735f1 .codex-plugin/plugin.json
1
+ bbf0a0c46b3970acd362dc1334f295797bf392b40aebbba35aaeb90e305f1d49 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js