@inerrata-corporation/errata 2.0.22-dev.4657 → 2.0.22-dev.4665

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.
@@ -15778,7 +15778,7 @@ var init_history_read = __esm({
15778
15778
  "../../packages/shared/src/history-read.ts"() {
15779
15779
  "use strict";
15780
15780
  init_history_dependencies();
15781
- CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
15781
+ CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding", "structEmbedding", "structEmbeddedAt"];
15782
15782
  }
15783
15783
  });
15784
15784
 
@@ -17001,7 +17001,9 @@ function installEditPlaceholderRetirement(db) {
17001
17001
 
17002
17002
  // ../../packages/local-graph/src/cloud-attr-compaction.ts
17003
17003
  init_src2();
17004
- var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
17004
+ var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-2";
17005
+ var V1_KEY = "cloud-attr-compaction-1";
17006
+ var STRUCT_LABELS = "('Problem', 'Solution', 'RootCause')";
17005
17007
  var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
17006
17008
  function compacted(row) {
17007
17009
  const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
@@ -17020,14 +17022,17 @@ function dirty(row) {
17020
17022
  return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
17021
17023
  }
17022
17024
  function installCloudAttrCompaction(db) {
17023
- if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
17025
+ const marked = (key) => Boolean(db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
17026
+ if (marked(CLOUD_ATTR_COMPACTION_KEY)) return;
17027
+ const scope = marked(V1_KEY) ? ` AND label IN ${STRUCT_LABELS}` : "";
17024
17028
  db.transaction(() => {
17025
17029
  for (const operation of ["INSERT", "UPDATE"]) {
17026
- db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
17030
+ db.exec(`DROP TRIGGER IF EXISTS cloud_attr_compact_${operation.toLowerCase()}`);
17031
+ db.exec(`CREATE TRIGGER cloud_attr_compact_${operation.toLowerCase()}
17027
17032
  AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
17028
17033
  BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
17029
17034
  }
17030
- db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
17035
+ db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}${scope}`);
17031
17036
  db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
17032
17037
  });
17033
17038
  }
@@ -17570,7 +17575,13 @@ var DEMAND_HOT = Math.log1p(10);
17570
17575
  var DEMAND_WARM = Math.log1p(5);
17571
17576
 
17572
17577
  // ../../packages/local-graph/src/node-select.ts
17573
- var SELECT_INDEXES = ["nodes_live_local_community", "nodes_live_fold_candidate"];
17578
+ var SELECT_INDEXES = [
17579
+ "nodes_live_local_community",
17580
+ "nodes_live_fold_candidate",
17581
+ "nodes_live_resolved",
17582
+ "nodes_live_fix_candidate",
17583
+ "nodes_live_anchor_hint"
17584
+ ];
17574
17585
  var EMBEDDING_DIM_SQL = "(CASE WHEN length(embedding_blob) >= 4 THEN length(embedding_blob) / 4 ELSE COALESCE(json_array_length(embedding_json), 0) END)";
17575
17586
  var KEY = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
17576
17587
  var COLUMNS = /* @__PURE__ */ new Set([
@@ -17597,7 +17608,7 @@ function column(c) {
17597
17608
  function compileNodeWhere(q) {
17598
17609
  if (q.labels.length === 0) throw new Error("selectNodes: no labels");
17599
17610
  const params = [...q.labels];
17600
- const byId = (q.where ?? []).some((w) => "idIn" in w);
17611
+ const byId = (q.where ?? []).some((w) => "idIn" in w || "idPrefix" in w && w.idPrefix.length > 0);
17601
17612
  const unindexed = byId ? "+" : "";
17602
17613
  const conds = [`${unindexed}label IN (${q.labels.map(() => "?").join(", ")})`];
17603
17614
  if (!q.includeClosed) conds.push(`${unindexed}valid_to IS NULL`);
@@ -17607,6 +17618,11 @@ function compileNodeWhere(q) {
17607
17618
  } else if ("idPrefix" in w) {
17608
17619
  conds.push("substr(id, 1, ?) = ?");
17609
17620
  params.push(w.idPrefix.length, w.idPrefix);
17621
+ if (w.idPrefix.length > 0) {
17622
+ const last = w.idPrefix.charCodeAt(w.idPrefix.length - 1);
17623
+ conds.push("id >= ? AND id < ?");
17624
+ params.push(w.idPrefix, w.idPrefix.slice(0, -1) + String.fromCharCode(last + 1));
17625
+ }
17610
17626
  } else if ("idIn" in w) {
17611
17627
  if (w.idIn.length === 0) conds.push("0");
17612
17628
  else {
@@ -17888,6 +17904,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_local_community ON nodes(label, valid_to,
17888
17904
  -- Problems parked for the fold judge (read every settle boundary): ~1 in 5 open
17889
17905
  -- Problems; without it every live Problem was read to find them (56 MB).
17890
17906
  CREATE INDEX IF NOT EXISTS nodes_live_fold_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.foldCandidate') IS NOT NULL;
17907
+ -- The semantic-maintenance sweeps' own filters (closed, asked, hinted): each read
17908
+ -- every Problem row (~30 MB on a 1.1 GB store) for the few hundred that match,
17909
+ -- several times a run, and a run follows most writes (2026-10-20).
17910
+ CREATE INDEX IF NOT EXISTS nodes_live_resolved ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.resolvedAt') IS NOT NULL;
17911
+ CREATE INDEX IF NOT EXISTS nodes_live_fix_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.fixCandidateAt') IS NOT NULL;
17912
+ CREATE INDEX IF NOT EXISTS nodes_live_anchor_hint ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.anchorHint') IS NOT NULL;
17891
17913
  CREATE INDEX IF NOT EXISTS nodes_session_evidence ON nodes(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
17892
17914
  CREATE INDEX IF NOT EXISTS edges_session_evidence ON edges(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
17893
17915
  -- Covering + partial index for labelFingerprint over the instance labels: the
package/errata.mjs CHANGED
@@ -17382,7 +17382,7 @@ var init_history_read = __esm({
17382
17382
  "../../packages/shared/src/history-read.ts"() {
17383
17383
  "use strict";
17384
17384
  init_history_dependencies();
17385
- CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
17385
+ CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding", "structEmbedding", "structEmbeddedAt"];
17386
17386
  }
17387
17387
  });
17388
17388
 
@@ -19061,23 +19061,28 @@ function dirty(row) {
19061
19061
  return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
19062
19062
  }
19063
19063
  function installCloudAttrCompaction(db) {
19064
- if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
19064
+ const marked = (key) => Boolean(db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
19065
+ if (marked(CLOUD_ATTR_COMPACTION_KEY)) return;
19066
+ const scope = marked(V1_KEY) ? ` AND label IN ${STRUCT_LABELS}` : "";
19065
19067
  db.transaction(() => {
19066
19068
  for (const operation of ["INSERT", "UPDATE"]) {
19067
- db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
19069
+ db.exec(`DROP TRIGGER IF EXISTS cloud_attr_compact_${operation.toLowerCase()}`);
19070
+ db.exec(`CREATE TRIGGER cloud_attr_compact_${operation.toLowerCase()}
19068
19071
  AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
19069
19072
  BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
19070
19073
  }
19071
- db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
19074
+ db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}${scope}`);
19072
19075
  db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
19073
19076
  });
19074
19077
  }
19075
- var CLOUD_ATTR_COMPACTION_KEY, DUPES;
19078
+ var CLOUD_ATTR_COMPACTION_KEY, V1_KEY, STRUCT_LABELS, DUPES;
19076
19079
  var init_cloud_attr_compaction = __esm({
19077
19080
  "../../packages/local-graph/src/cloud-attr-compaction.ts"() {
19078
19081
  "use strict";
19079
19082
  init_src2();
19080
- CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
19083
+ CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-2";
19084
+ V1_KEY = "cloud-attr-compaction-1";
19085
+ STRUCT_LABELS = "('Problem', 'Solution', 'RootCause')";
19081
19086
  DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
19082
19087
  }
19083
19088
  });
@@ -20393,7 +20398,7 @@ function column(c) {
20393
20398
  function compileNodeWhere(q) {
20394
20399
  if (q.labels.length === 0) throw new Error("selectNodes: no labels");
20395
20400
  const params = [...q.labels];
20396
- const byId = (q.where ?? []).some((w) => "idIn" in w);
20401
+ const byId = (q.where ?? []).some((w) => "idIn" in w || "idPrefix" in w && w.idPrefix.length > 0);
20397
20402
  const unindexed = byId ? "+" : "";
20398
20403
  const conds = [`${unindexed}label IN (${q.labels.map(() => "?").join(", ")})`];
20399
20404
  if (!q.includeClosed) conds.push(`${unindexed}valid_to IS NULL`);
@@ -20403,6 +20408,11 @@ function compileNodeWhere(q) {
20403
20408
  } else if ("idPrefix" in w) {
20404
20409
  conds.push("substr(id, 1, ?) = ?");
20405
20410
  params.push(w.idPrefix.length, w.idPrefix);
20411
+ if (w.idPrefix.length > 0) {
20412
+ const last = w.idPrefix.charCodeAt(w.idPrefix.length - 1);
20413
+ conds.push("id >= ? AND id < ?");
20414
+ params.push(w.idPrefix, w.idPrefix.slice(0, -1) + String.fromCharCode(last + 1));
20415
+ }
20406
20416
  } else if ("idIn" in w) {
20407
20417
  if (w.idIn.length === 0) conds.push("0");
20408
20418
  else {
@@ -20525,7 +20535,13 @@ var SELECT_INDEXES, EMBEDDING_DIM_SQL, KEY, COLUMNS;
20525
20535
  var init_node_select = __esm({
20526
20536
  "../../packages/local-graph/src/node-select.ts"() {
20527
20537
  "use strict";
20528
- SELECT_INDEXES = ["nodes_live_local_community", "nodes_live_fold_candidate"];
20538
+ SELECT_INDEXES = [
20539
+ "nodes_live_local_community",
20540
+ "nodes_live_fold_candidate",
20541
+ "nodes_live_resolved",
20542
+ "nodes_live_fix_candidate",
20543
+ "nodes_live_anchor_hint"
20544
+ ];
20529
20545
  EMBEDDING_DIM_SQL = "(CASE WHEN length(embedding_blob) >= 4 THEN length(embedding_blob) / 4 ELSE COALESCE(json_array_length(embedding_json), 0) END)";
20530
20546
  KEY = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
20531
20547
  COLUMNS = /* @__PURE__ */ new Set([
@@ -20796,6 +20812,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_local_community ON nodes(label, valid_to,
20796
20812
  -- Problems parked for the fold judge (read every settle boundary): ~1 in 5 open
20797
20813
  -- Problems; without it every live Problem was read to find them (56 MB).
20798
20814
  CREATE INDEX IF NOT EXISTS nodes_live_fold_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.foldCandidate') IS NOT NULL;
20815
+ -- The semantic-maintenance sweeps' own filters (closed, asked, hinted): each read
20816
+ -- every Problem row (~30 MB on a 1.1 GB store) for the few hundred that match,
20817
+ -- several times a run, and a run follows most writes (2026-10-20).
20818
+ CREATE INDEX IF NOT EXISTS nodes_live_resolved ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.resolvedAt') IS NOT NULL;
20819
+ CREATE INDEX IF NOT EXISTS nodes_live_fix_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.fixCandidateAt') IS NOT NULL;
20820
+ CREATE INDEX IF NOT EXISTS nodes_live_anchor_hint ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.anchorHint') IS NOT NULL;
20799
20821
  CREATE INDEX IF NOT EXISTS nodes_session_evidence ON nodes(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
20800
20822
  CREATE INDEX IF NOT EXISTS edges_session_evidence ON edges(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
20801
20823
  -- Covering + partial index for labelFingerprint over the instance labels: the
@@ -24529,7 +24551,8 @@ function upgradeAnchorHints(store, workspaceId2, ts) {
24529
24551
  const hinted = store.selectNodes({
24530
24552
  labels: ["Problem"],
24531
24553
  attrs: ["resolvedAt", "anchorHint"],
24532
- where: [{ attr: "anchorHint", notNullish: true }]
24554
+ where: [{ attr: "anchorHint", notNullish: true }],
24555
+ indexedBy: "nodes_live_anchor_hint"
24533
24556
  });
24534
24557
  for (const row of hinted) {
24535
24558
  if (row.attrs["resolvedAt"]) continue;
@@ -24612,7 +24635,8 @@ function reopenAutoClosedProblems(store, t) {
24612
24635
  const closed = store.selectNodes({
24613
24636
  labels: ["Problem"],
24614
24637
  attrs: ["resolvedAt", "resolvedAs", "mergedInto", "resolutionWitnessed", "retiredEditPlaceholder", "resolutionSuspect"],
24615
- where: [{ attr: "resolvedAt", notNullish: true }, { attr: "resolvedAs", nullish: true }, { attr: "mergedInto", absent: true }]
24638
+ where: [{ attr: "resolvedAt", notNullish: true }, { attr: "resolvedAs", nullish: true }, { attr: "mergedInto", absent: true }],
24639
+ indexedBy: "nodes_live_resolved"
24616
24640
  });
24617
24641
  for (const p of closed) {
24618
24642
  if (p.attrs["resolvedAt"] == null) continue;
@@ -24730,7 +24754,7 @@ function markFixCandidates(store, t) {
24730
24754
  }
24731
24755
  function clearSettledFixCandidates(store, t) {
24732
24756
  const report = { answered: 0, ignored: 0, unsubstantiated: 0, standing: 0 };
24733
- const asked = store.selectNodes({ labels: ["Problem"], where: [{ attr: "fixCandidateAt", present: true }] });
24757
+ const asked = store.selectNodes({ labels: ["Problem"], where: [{ attr: "fixCandidateAt", present: true }], indexedBy: "nodes_live_fix_candidate" });
24734
24758
  for (const row of asked) {
24735
24759
  const p = store.getNode(row.id);
24736
24760
  if (!p) continue;
@@ -87025,7 +87049,7 @@ function createWatchBreaker(deps) {
87025
87049
  }
87026
87050
 
87027
87051
  // src/engine.ts
87028
- var DAEMON_VERSION = true ? "2.0.22-dev.4657" : "2.0.0-alpha.0";
87052
+ var DAEMON_VERSION = true ? "2.0.22-dev.4665" : "2.0.0-alpha.0";
87029
87053
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
87030
87054
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
87031
87055
  var GIT_OP_MUTE_MS = 4e3;
@@ -14697,7 +14697,7 @@ var CastaliaIngestPayloadSchema = external_exports.object({
14697
14697
  });
14698
14698
 
14699
14699
  // ../../packages/shared/src/history-read.ts
14700
- var CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
14700
+ var CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding", "structEmbedding", "structEmbeddedAt"];
14701
14701
 
14702
14702
  // ../../packages/shared/src/history-revision.ts
14703
14703
  var Sha = external_exports.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/);
@@ -15576,7 +15576,9 @@ function installEditPlaceholderRetirement(db) {
15576
15576
  }
15577
15577
 
15578
15578
  // ../../packages/local-graph/src/cloud-attr-compaction.ts
15579
- var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
15579
+ var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-2";
15580
+ var V1_KEY = "cloud-attr-compaction-1";
15581
+ var STRUCT_LABELS = "('Problem', 'Solution', 'RootCause')";
15580
15582
  var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
15581
15583
  function compacted(row) {
15582
15584
  const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
@@ -15595,14 +15597,17 @@ function dirty(row) {
15595
15597
  return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
15596
15598
  }
15597
15599
  function installCloudAttrCompaction(db) {
15598
- if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
15600
+ const marked = (key) => Boolean(db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
15601
+ if (marked(CLOUD_ATTR_COMPACTION_KEY)) return;
15602
+ const scope = marked(V1_KEY) ? ` AND label IN ${STRUCT_LABELS}` : "";
15599
15603
  db.transaction(() => {
15600
15604
  for (const operation of ["INSERT", "UPDATE"]) {
15601
- db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
15605
+ db.exec(`DROP TRIGGER IF EXISTS cloud_attr_compact_${operation.toLowerCase()}`);
15606
+ db.exec(`CREATE TRIGGER cloud_attr_compact_${operation.toLowerCase()}
15602
15607
  AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
15603
15608
  BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
15604
15609
  }
15605
- db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
15610
+ db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}${scope}`);
15606
15611
  db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
15607
15612
  });
15608
15613
  }
@@ -15967,7 +15972,13 @@ var DEMAND_HOT = Math.log1p(10);
15967
15972
  var DEMAND_WARM = Math.log1p(5);
15968
15973
 
15969
15974
  // ../../packages/local-graph/src/node-select.ts
15970
- var SELECT_INDEXES = ["nodes_live_local_community", "nodes_live_fold_candidate"];
15975
+ var SELECT_INDEXES = [
15976
+ "nodes_live_local_community",
15977
+ "nodes_live_fold_candidate",
15978
+ "nodes_live_resolved",
15979
+ "nodes_live_fix_candidate",
15980
+ "nodes_live_anchor_hint"
15981
+ ];
15971
15982
  var EMBEDDING_DIM_SQL = "(CASE WHEN length(embedding_blob) >= 4 THEN length(embedding_blob) / 4 ELSE COALESCE(json_array_length(embedding_json), 0) END)";
15972
15983
  var KEY = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
15973
15984
  var COLUMNS = /* @__PURE__ */ new Set([
@@ -15994,7 +16005,7 @@ function column(c) {
15994
16005
  function compileNodeWhere(q) {
15995
16006
  if (q.labels.length === 0) throw new Error("selectNodes: no labels");
15996
16007
  const params = [...q.labels];
15997
- const byId = (q.where ?? []).some((w) => "idIn" in w);
16008
+ const byId = (q.where ?? []).some((w) => "idIn" in w || "idPrefix" in w && w.idPrefix.length > 0);
15998
16009
  const unindexed = byId ? "+" : "";
15999
16010
  const conds = [`${unindexed}label IN (${q.labels.map(() => "?").join(", ")})`];
16000
16011
  if (!q.includeClosed) conds.push(`${unindexed}valid_to IS NULL`);
@@ -16004,6 +16015,11 @@ function compileNodeWhere(q) {
16004
16015
  } else if ("idPrefix" in w) {
16005
16016
  conds.push("substr(id, 1, ?) = ?");
16006
16017
  params.push(w.idPrefix.length, w.idPrefix);
16018
+ if (w.idPrefix.length > 0) {
16019
+ const last = w.idPrefix.charCodeAt(w.idPrefix.length - 1);
16020
+ conds.push("id >= ? AND id < ?");
16021
+ params.push(w.idPrefix, w.idPrefix.slice(0, -1) + String.fromCharCode(last + 1));
16022
+ }
16007
16023
  } else if ("idIn" in w) {
16008
16024
  if (w.idIn.length === 0) conds.push("0");
16009
16025
  else {
@@ -16285,6 +16301,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_local_community ON nodes(label, valid_to,
16285
16301
  -- Problems parked for the fold judge (read every settle boundary): ~1 in 5 open
16286
16302
  -- Problems; without it every live Problem was read to find them (56 MB).
16287
16303
  CREATE INDEX IF NOT EXISTS nodes_live_fold_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.foldCandidate') IS NOT NULL;
16304
+ -- The semantic-maintenance sweeps' own filters (closed, asked, hinted): each read
16305
+ -- every Problem row (~30 MB on a 1.1 GB store) for the few hundred that match,
16306
+ -- several times a run, and a run follows most writes (2026-10-20).
16307
+ CREATE INDEX IF NOT EXISTS nodes_live_resolved ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.resolvedAt') IS NOT NULL;
16308
+ CREATE INDEX IF NOT EXISTS nodes_live_fix_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.fixCandidateAt') IS NOT NULL;
16309
+ CREATE INDEX IF NOT EXISTS nodes_live_anchor_hint ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.anchorHint') IS NOT NULL;
16288
16310
  CREATE INDEX IF NOT EXISTS nodes_session_evidence ON nodes(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
16289
16311
  CREATE INDEX IF NOT EXISTS edges_session_evidence ON edges(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
16290
16312
  -- Covering + partial index for labelFingerprint over the instance labels: the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.22-dev.4657",
3
+ "version": "2.0.22-dev.4665",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -16172,7 +16172,7 @@ var init_history_read = __esm({
16172
16172
  "../../packages/shared/src/history-read.ts"() {
16173
16173
  "use strict";
16174
16174
  init_history_dependencies();
16175
- CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding"];
16175
+ CLOUD_ATTR_DUPLICATE_KEYS = ["attrsJson", "embedding", "structEmbedding", "structEmbeddedAt"];
16176
16176
  }
16177
16177
  });
16178
16178
 
@@ -26018,7 +26018,9 @@ function installEditPlaceholderRetirement(db) {
26018
26018
 
26019
26019
  // ../../packages/local-graph/src/cloud-attr-compaction.ts
26020
26020
  init_src2();
26021
- var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-1";
26021
+ var CLOUD_ATTR_COMPACTION_KEY = "cloud-attr-compaction-2";
26022
+ var V1_KEY = "cloud-attr-compaction-1";
26023
+ var STRUCT_LABELS = "('Problem', 'Solution', 'RootCause')";
26022
26024
  var DUPES = CLOUD_ATTR_DUPLICATE_KEYS.map((k) => `'${k}'`).join(",");
26023
26025
  function compacted(row) {
26024
26026
  const packed = `json_extract(${row}.attrs_json, '$.attrsJson')`;
@@ -26037,14 +26039,17 @@ function dirty(row) {
26037
26039
  return `json_extract(${row}.attrs_json, '$.source') = 'cloud' AND (${has})`;
26038
26040
  }
26039
26041
  function installCloudAttrCompaction(db) {
26040
- if (db.prepare("SELECT value FROM store_meta WHERE key = ?").get(CLOUD_ATTR_COMPACTION_KEY)) return;
26042
+ const marked = (key) => Boolean(db.prepare("SELECT value FROM store_meta WHERE key = ?").get(key));
26043
+ if (marked(CLOUD_ATTR_COMPACTION_KEY)) return;
26044
+ const scope = marked(V1_KEY) ? ` AND label IN ${STRUCT_LABELS}` : "";
26041
26045
  db.transaction(() => {
26042
26046
  for (const operation of ["INSERT", "UPDATE"]) {
26043
- db.exec(`CREATE TRIGGER IF NOT EXISTS cloud_attr_compact_${operation.toLowerCase()}
26047
+ db.exec(`DROP TRIGGER IF EXISTS cloud_attr_compact_${operation.toLowerCase()}`);
26048
+ db.exec(`CREATE TRIGGER cloud_attr_compact_${operation.toLowerCase()}
26044
26049
  AFTER ${operation} ON nodes WHEN ${dirty("NEW")}
26045
26050
  BEGIN UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE id = NEW.id; END;`);
26046
26051
  }
26047
- db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}`);
26052
+ db.exec(`UPDATE nodes SET attrs_json = ${compacted("nodes")} WHERE ${dirty("nodes")}${scope}`);
26048
26053
  db.prepare("INSERT INTO store_meta(key,value) VALUES (?,?)").run(CLOUD_ATTR_COMPACTION_KEY, "installed");
26049
26054
  });
26050
26055
  }
@@ -26846,7 +26851,13 @@ function pagerankLocal(input) {
26846
26851
  }
26847
26852
 
26848
26853
  // ../../packages/local-graph/src/node-select.ts
26849
- var SELECT_INDEXES = ["nodes_live_local_community", "nodes_live_fold_candidate"];
26854
+ var SELECT_INDEXES = [
26855
+ "nodes_live_local_community",
26856
+ "nodes_live_fold_candidate",
26857
+ "nodes_live_resolved",
26858
+ "nodes_live_fix_candidate",
26859
+ "nodes_live_anchor_hint"
26860
+ ];
26850
26861
  var EMBEDDING_DIM_SQL = "(CASE WHEN length(embedding_blob) >= 4 THEN length(embedding_blob) / 4 ELSE COALESCE(json_array_length(embedding_json), 0) END)";
26851
26862
  var KEY = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
26852
26863
  var COLUMNS = /* @__PURE__ */ new Set([
@@ -26873,7 +26884,7 @@ function column(c) {
26873
26884
  function compileNodeWhere(q) {
26874
26885
  if (q.labels.length === 0) throw new Error("selectNodes: no labels");
26875
26886
  const params = [...q.labels];
26876
- const byId = (q.where ?? []).some((w) => "idIn" in w);
26887
+ const byId = (q.where ?? []).some((w) => "idIn" in w || "idPrefix" in w && w.idPrefix.length > 0);
26877
26888
  const unindexed = byId ? "+" : "";
26878
26889
  const conds = [`${unindexed}label IN (${q.labels.map(() => "?").join(", ")})`];
26879
26890
  if (!q.includeClosed) conds.push(`${unindexed}valid_to IS NULL`);
@@ -26883,6 +26894,11 @@ function compileNodeWhere(q) {
26883
26894
  } else if ("idPrefix" in w) {
26884
26895
  conds.push("substr(id, 1, ?) = ?");
26885
26896
  params.push(w.idPrefix.length, w.idPrefix);
26897
+ if (w.idPrefix.length > 0) {
26898
+ const last = w.idPrefix.charCodeAt(w.idPrefix.length - 1);
26899
+ conds.push("id >= ? AND id < ?");
26900
+ params.push(w.idPrefix, w.idPrefix.slice(0, -1) + String.fromCharCode(last + 1));
26901
+ }
26886
26902
  } else if ("idIn" in w) {
26887
26903
  if (w.idIn.length === 0) conds.push("0");
26888
26904
  else {
@@ -27164,6 +27180,12 @@ CREATE INDEX IF NOT EXISTS nodes_live_local_community ON nodes(label, valid_to,
27164
27180
  -- Problems parked for the fold judge (read every settle boundary): ~1 in 5 open
27165
27181
  -- Problems; without it every live Problem was read to find them (56 MB).
27166
27182
  CREATE INDEX IF NOT EXISTS nodes_live_fold_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.foldCandidate') IS NOT NULL;
27183
+ -- The semantic-maintenance sweeps' own filters (closed, asked, hinted): each read
27184
+ -- every Problem row (~30 MB on a 1.1 GB store) for the few hundred that match,
27185
+ -- several times a run, and a run follows most writes (2026-10-20).
27186
+ CREATE INDEX IF NOT EXISTS nodes_live_resolved ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.resolvedAt') IS NOT NULL;
27187
+ CREATE INDEX IF NOT EXISTS nodes_live_fix_candidate ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_type(attrs_json, '$.fixCandidateAt') IS NOT NULL;
27188
+ CREATE INDEX IF NOT EXISTS nodes_live_anchor_hint ON nodes(label, valid_to) WHERE valid_to IS NULL AND json_extract(attrs_json, '$.anchorHint') IS NOT NULL;
27167
27189
  CREATE INDEX IF NOT EXISTS nodes_session_evidence ON nodes(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
27168
27190
  CREATE INDEX IF NOT EXISTS edges_session_evidence ON edges(id) WHERE ${SESSION_EVIDENCE_PREDICATE};
27169
27191
  -- Covering + partial index for labelFingerprint over the instance labels: the
@@ -29382,7 +29404,8 @@ function upgradeAnchorHints(store2, workspaceId, ts) {
29382
29404
  const hinted = store2.selectNodes({
29383
29405
  labels: ["Problem"],
29384
29406
  attrs: ["resolvedAt", "anchorHint"],
29385
- where: [{ attr: "anchorHint", notNullish: true }]
29407
+ where: [{ attr: "anchorHint", notNullish: true }],
29408
+ indexedBy: "nodes_live_anchor_hint"
29386
29409
  });
29387
29410
  for (const row of hinted) {
29388
29411
  if (row.attrs["resolvedAt"]) continue;
@@ -29413,7 +29436,8 @@ function reopenAutoClosedProblems(store2, t) {
29413
29436
  const closed = store2.selectNodes({
29414
29437
  labels: ["Problem"],
29415
29438
  attrs: ["resolvedAt", "resolvedAs", "mergedInto", "resolutionWitnessed", "retiredEditPlaceholder", "resolutionSuspect"],
29416
- where: [{ attr: "resolvedAt", notNullish: true }, { attr: "resolvedAs", nullish: true }, { attr: "mergedInto", absent: true }]
29439
+ where: [{ attr: "resolvedAt", notNullish: true }, { attr: "resolvedAs", nullish: true }, { attr: "mergedInto", absent: true }],
29440
+ indexedBy: "nodes_live_resolved"
29417
29441
  });
29418
29442
  for (const p of closed) {
29419
29443
  if (p.attrs["resolvedAt"] == null) continue;
@@ -29502,7 +29526,7 @@ function markFixCandidates(store2, t) {
29502
29526
  var FIX_CANDIDATE_ASK_LIMIT = 5;
29503
29527
  function clearSettledFixCandidates(store2, t) {
29504
29528
  const report = { answered: 0, ignored: 0, unsubstantiated: 0, standing: 0 };
29505
- const asked = store2.selectNodes({ labels: ["Problem"], where: [{ attr: "fixCandidateAt", present: true }] });
29529
+ const asked = store2.selectNodes({ labels: ["Problem"], where: [{ attr: "fixCandidateAt", present: true }], indexedBy: "nodes_live_fix_candidate" });
29506
29530
  for (const row of asked) {
29507
29531
  const p = store2.getNode(row.id);
29508
29532
  if (!p) continue;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.22-dev.4657",
3
+ "version": "2.0.22-dev.4665",
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
- e7f2b11ac106aa4f1ad1c492a48adfed53759ae7c7d5cba5f087ff791f67f48d .codex-plugin/plugin.json
1
+ f1e400bb7113a7620b6d9642dba999330a5888059992763fc34dd7c802ff0843 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js