@inerrata-corporation/errata 2.0.23 → 2.0.24-dev.5107

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.
@@ -31,8 +31,8 @@ The Codex context plugin under `resources/context-plugin/` carries its own
31
31
  | hono | 4.12.34 | MIT |
32
32
  | ignore | 7.0.5 | MIT |
33
33
  | readdirp | 4.1.2 | MIT |
34
- | smol-toml | 1.6.1 | BSD-3-Clause |
35
- | undici | 6.24.1 | MIT |
34
+ | smol-toml | 1.9.1 | BSD-3-Clause |
35
+ | undici | 6.29.1 | MIT |
36
36
  | ↳ llhttp (in undici) | v8.1.0 | MIT |
37
37
  | web-tree-sitter | 0.26.9 | MIT |
38
38
  | zod | 4.3.6 | MIT |
@@ -40,6 +40,33 @@ The Codex context plugin under `resources/context-plugin/` carries its own
40
40
  ## Data credits
41
41
 
42
42
  - tldr-pages command index (snapshot in src/tldr-tools.generated.ts): Command names from the tldr-pages project, (c) the tldr-pages contributors, licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Source: https://github.com/tldr-pages/tldr
43
+ - Static embedding weights (resources/models/potion-base-8M.q8.bin): potion-base-8M by The Minish Lab (model2vec), MIT License; vocabulary from baai/bge-base-en-v1.5. Redistributed quantized to per-row int8 by packages/embedding/scripts/build-static-model.ts. Source: https://huggingface.co/minishlab/potion-base-8M (revision bf8b056651a2c21b8d2565580b8569da283cab23)
44
+
45
+ ### Static embedding weights (resources/models/potion-base-8M.q8.bin) — MIT
46
+
47
+ ```
48
+ MIT License
49
+
50
+ Copyright (c) 2024 Thomas van Dongen
51
+
52
+ Permission is hereby granted, free of charge, to any person obtaining a copy
53
+ of this software and associated documentation files (the "Software"), to deal
54
+ in the Software without restriction, including without limitation the rights
55
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
56
+ copies of the Software, and to permit persons to whom the Software is
57
+ furnished to do so, subject to the following conditions:
58
+
59
+ The above copyright notice and this permission notice shall be included in all
60
+ copies or substantial portions of the Software.
61
+
62
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
63
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
64
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
66
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
67
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68
+ SOFTWARE.
69
+ ```
43
70
 
44
71
  ---
45
72
 
@@ -891,7 +918,7 @@ SOFTWARE.
891
918
 
892
919
  ---
893
920
 
894
- ## smol-toml@1.6.1
921
+ ## smol-toml@1.9.1
895
922
 
896
923
  License: BSD-3-Clause
897
924
  Source: https://github.com/squirrelchat/smol-toml
@@ -927,7 +954,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
927
954
 
928
955
  ---
929
956
 
930
- ## undici@6.24.1
957
+ ## undici@6.29.1
931
958
 
932
959
  License: MIT
933
960
  Source: https://github.com/nodejs/undici
@@ -16146,7 +16146,25 @@ var TAG_CANONICAL_ID_PREFIXES, TAG_HANDLE_SOURCE, TAG_THREAD_SOURCE, TAG_PLACEHO
16146
16146
  var init_tag_grammar = __esm({
16147
16147
  "../../packages/local-shared/src/tag-grammar.ts"() {
16148
16148
  "use strict";
16149
- TAG_CANONICAL_ID_PREFIXES = ["pat", "sol", "drc", "dcause", "dfix", "dprob", "dvuln", "prob", "claim", "err"];
16149
+ TAG_CANONICAL_ID_PREFIXES = [
16150
+ "motif_community_projn",
16151
+ "motif_community_orgn",
16152
+ "motif",
16153
+ "projn",
16154
+ "orgn",
16155
+ "dtri",
16156
+ "dom",
16157
+ "pat",
16158
+ "sol",
16159
+ "drc",
16160
+ "dcause",
16161
+ "dfix",
16162
+ "dprob",
16163
+ "dvuln",
16164
+ "prob",
16165
+ "claim",
16166
+ "err"
16167
+ ];
16150
16168
  TAG_HANDLE_SOURCE = String.raw`\[([a-z0-9][\w-]{0,80})\]|((?:${TAG_CANONICAL_ID_PREFIXES.join("|")})_[0-9a-f]{6,})`;
16151
16169
  TAG_THREAD_SOURCE = String.raw`#([a-z][\w-]{0,63})`;
16152
16170
  TAG_PLACEHOLDER_HANDLES = /* @__PURE__ */ new Set([
@@ -17420,9 +17438,6 @@ function installLineageIntegrityRepair(db, now = Date.now()) {
17420
17438
  });
17421
17439
  }
17422
17440
 
17423
- // ../../packages/math/src/constants.ts
17424
- var NEMORI_DEDUP_COSINE = 0.88;
17425
-
17426
17441
  // ../../packages/math/src/triage.ts
17427
17442
  var TRIAGE_GLOBAL_BUCKET = "*";
17428
17443
  function triageContextBuckets(ctx) {
@@ -17607,13 +17622,23 @@ function detectCommunitiesLeiden(input, opts = {}) {
17607
17622
  var DEMAND_HOT = Math.log1p(10);
17608
17623
  var DEMAND_WARM = Math.log1p(5);
17609
17624
 
17625
+ // ../../packages/math/src/reader-evidence.ts
17626
+ var FIELD_CODES = {
17627
+ a: "acceptedCount",
17628
+ c: "corroborationCount",
17629
+ f: "failureReportCount",
17630
+ p: "contradictionPressure"
17631
+ };
17632
+ var FIELDS = Object.values(FIELD_CODES);
17633
+
17610
17634
  // ../../packages/local-graph/src/node-select.ts
17611
17635
  var SELECT_INDEXES = [
17612
17636
  "nodes_live_local_community",
17613
17637
  "nodes_live_fold_candidate",
17614
17638
  "nodes_live_resolved",
17615
17639
  "nodes_live_fix_candidate",
17616
- "nodes_live_anchor_hint"
17640
+ "nodes_live_anchor_hint",
17641
+ "nodes_live_created_v2"
17617
17642
  ];
17618
17643
  var EMBEDDING_DIM_SQL = "(CASE WHEN length(embedding_blob) >= 4 THEN length(embedding_blob) / 4 ELSE COALESCE(json_array_length(embedding_json), 0) END)";
17619
17644
  var KEY = /^[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$/;
@@ -17934,7 +17959,10 @@ CREATE UNIQUE INDEX IF NOT EXISTS edges_triple ON edges(from_id, type, to_id);
17934
17959
  `;
17935
17960
  var TEMPORAL_INDEX_SQL = `
17936
17961
  CREATE INDEX IF NOT EXISTS nodes_live ON nodes(label, valid_to);
17937
- CREATE INDEX IF NOT EXISTS nodes_live_count ON nodes(valid_to);
17962
+ -- Dropped: a prefix of nodes_live_page_rank (valid_to, page_rank), which serves
17963
+ -- the live count and the "any live node?" check as a covering index too. It was
17964
+ -- re-keyed on every close and revive: ~11 KB of a symbol flip's ~80 KB.
17965
+ DROP INDEX IF EXISTS nodes_live_count;
17938
17966
  -- Problems by recency (the only label read newest-first). Over every live row,
17939
17967
  -- each write that stamps last_updated_at moved a code symbol's entry from a
17940
17968
  -- scattered leaf: ~19 KB per position-only symbol rewrite on a 1.1 GB store.
@@ -17946,7 +17974,13 @@ CREATE INDEX IF NOT EXISTS nodes_live_problem_recent ON nodes(label, last_update
17946
17974
  -- walks nodes_live and reads every live row of the label to test created_at:
17947
17975
  -- 56 MB per guard on a 1.1 GB store, to learn there was nothing to do. valid_to
17948
17976
  -- is a key column so the planner prefers this over nodes_live (one more term).
17949
- CREATE INDEX IF NOT EXISTS nodes_live_created ON nodes(label, valid_to, created_at) WHERE valid_to IS NULL;
17977
+ -- last_updated_at rides along for errata.recent on code labels, which names this
17978
+ -- index: the filter runs on index entries, not on every row of the label (79 ms
17979
+ -- \u2192 3 ms for Function on a 1.1 GB store). It costs no extra writes: a close or
17980
+ -- revive already re-keys this index, and mergeNodeIfChanged leaves a symbol's
17981
+ -- last_updated_at alone when only its position moved.
17982
+ DROP INDEX IF EXISTS nodes_live_created;
17983
+ CREATE INDEX IF NOT EXISTS nodes_live_created_v2 ON nodes(label, valid_to, created_at, last_updated_at) WHERE valid_to IS NULL;
17950
17984
  -- Community members (the skills pull reads them twice per session boundary):
17951
17985
  -- ~15% of semantic nodes carry a localCommunity, and without this every live
17952
17986
  -- semantic row was read to find them (168 MB \u2192 18 MB per read).
@@ -18131,6 +18165,12 @@ function sameSqlValue(a, b) {
18131
18165
  if (a instanceof Uint8Array && b instanceof Uint8Array) return Buffer.compare(a, b) === 0;
18132
18166
  return false;
18133
18167
  }
18168
+ var POSITION_ATTRS = ["startByte", "endByte", "startRow"];
18169
+ function attrsJsonWithoutPositions(attrs) {
18170
+ const rest = { ...attrs };
18171
+ for (const k of POSITION_ATTRS) delete rest[k];
18172
+ return JSON.stringify(rest);
18173
+ }
18134
18174
  var PRIOR_TAG_MARKER = '"priorTag":true';
18135
18175
  var SqliteGraphStore = class {
18136
18176
  db;
@@ -18231,7 +18271,7 @@ var SqliteGraphStore = class {
18231
18271
  lastUpdatedOf: this.db.prepare("SELECT last_updated_at AS t, attrs_json FROM nodes WHERE id = ?"),
18232
18272
  labelOf: this.db.prepare("SELECT label FROM nodes WHERE id = ?"),
18233
18273
  nodeContent: this.db.prepare(
18234
- "SELECT label, description, extraction_confidence, extraction_source, stability, valid_to, attrs_json FROM nodes WHERE id = ?"
18274
+ "SELECT label, description, extraction_confidence, extraction_source, stability, valid_to, last_updated_at, attrs_json FROM nodes WHERE id = ?"
18235
18275
  ),
18236
18276
  edgeContent: this.db.prepare(
18237
18277
  "SELECT confidence, valid_to, attrs_json FROM edges WHERE from_id = ? AND type = ? AND to_id = ?"
@@ -18644,11 +18684,23 @@ var SqliteGraphStore = class {
18644
18684
  * rank, community, landmark, surprise, hits, tier and the vector belong to
18645
18685
  * the passes that compute them, and a skipped write leaves them as they are
18646
18686
  * where a merge would have reset them to the producer's defaults. Returns
18647
- * whether it wrote. */
18687
+ * whether it wrote.
18688
+ *
18689
+ * A live row whose only change is its position keeps its lastUpdatedAt, so
18690
+ * that stamp means "this symbol's content changed": what errata.recent lists
18691
+ * and the fix-candidate ask reads, and what lets nodes_live_created_v2 carry
18692
+ * it without being re-keyed by every edit above a symbol. A closed row is
18693
+ * always stamped: reviveReobserved reopens what this pass stamped. */
18648
18694
  mergeNodeIfChanged(node) {
18649
18695
  const row = this.stmts.nodeContent.get(node.id);
18650
- if (row && row.valid_to === null && row.label === node.label && row.description === node.description && row.extraction_confidence === node.extractionConfidence && row.stability === node.stability && !EXPOSURE_ATTRS.some((k) => node.attrs?.[k] !== void 0) && row.attrs_json === JSON.stringify(node.attrs ?? {})) return false;
18651
- this.mergeNode(node);
18696
+ if (!row || row.valid_to !== null || row.label !== node.label || row.description !== node.description || row.extraction_confidence !== node.extractionConfidence || row.stability !== node.stability || EXPOSURE_ATTRS.some((k) => node.attrs?.[k] !== void 0)) {
18697
+ this.mergeNode(node);
18698
+ return true;
18699
+ }
18700
+ const attrs = node.attrs ?? {};
18701
+ if (row.attrs_json === JSON.stringify(attrs)) return false;
18702
+ const moved = attrsJsonWithoutPositions(JSON.parse(row.attrs_json)) === attrsJsonWithoutPositions(attrs);
18703
+ this.mergeNode(moved ? { ...node, lastUpdatedAt: row.last_updated_at } : node);
18652
18704
  return true;
18653
18705
  }
18654
18706
  updateNode(id, patch) {
@@ -18728,8 +18780,8 @@ var SqliteGraphStore = class {
18728
18780
  stmt2 = this.db.prepare(
18729
18781
  // Ordered, not left to the planner: readers take "first row wins" (the
18730
18782
  // symbol lexicon's name winner and doc pick), and the order otherwise
18731
- // followed whichever partial index the planner chose. nodes_live_created
18732
- // serves this order without a sort.
18783
+ // followed whichever partial index the planner chose. nodes_live_created_v2
18784
+ // serves it, sorting rowids only within an equal created_at.
18733
18785
  `SELECT id, description, community, extraction_confidence${cols} FROM nodes WHERE label = ? AND valid_to IS NULL ORDER BY created_at, rowid`
18734
18786
  );
18735
18787
  this.fieldStmts.set(cacheKey, stmt2);
@@ -19639,6 +19691,38 @@ init_src();
19639
19691
  // ../../packages/local-graph/src/problem-package-link.ts
19640
19692
  init_src();
19641
19693
 
19694
+ // ../../packages/embedding/src/bands.ts
19695
+ var DESIGNED_FOR_MINILM = {
19696
+ dedup: 0.88,
19697
+ softWriteMin: 0.8,
19698
+ bindMin: 0.78,
19699
+ nearMiss: 0.72,
19700
+ judgeMin: 0.5,
19701
+ predictionFloor: 0.5,
19702
+ relevanceFloor: 0.25,
19703
+ relatedWeak: 0.35,
19704
+ relatedStrong: 0.45
19705
+ };
19706
+ var BANDS = {
19707
+ "hash-v1": DESIGNED_FOR_MINILM,
19708
+ "minilm-l6-v2": DESIGNED_FOR_MINILM,
19709
+ "potion-8m-q8": {
19710
+ dedup: 0.895,
19711
+ softWriteMin: 0.835,
19712
+ bindMin: 0.83,
19713
+ nearMiss: 0.775,
19714
+ judgeMin: 0.335,
19715
+ predictionFloor: 0.335,
19716
+ relevanceFloor: 0.35,
19717
+ relatedWeak: 0.49,
19718
+ relatedStrong: 0.53
19719
+ }
19720
+ };
19721
+ var UNKNOWN = { ...DESIGNED_FOR_MINILM, relevanceFloor: 0.5 };
19722
+ function cosineBandsFor(version3) {
19723
+ return (version3 ? BANDS[version3] : void 0) ?? UNKNOWN;
19724
+ }
19725
+
19642
19726
  // ../../packages/local-graph/src/design-problem.ts
19643
19727
  init_src2();
19644
19728
 
@@ -20561,7 +20645,8 @@ function generalize(text, opts = {}) {
20561
20645
  init_src();
20562
20646
 
20563
20647
  // src/instance-receipts.ts
20564
- var INSTANCE_SEMANTIC_EDGE_TYPES = ["CAUSED_BY", "SOLVED_BY"];
20648
+ var INSTANCE_SEMANTIC_EDGE_TYPES = ["CAUSED_BY", "SOLVED_BY", "SUPERSEDES", "BUILDS_ON", "ALTERNATIVE_TO"];
20649
+ var INSTANCE_STRUCTURE_EDGE_TYPES = /* @__PURE__ */ new Set(["SUPERSEDES", "BUILDS_ON", "ALTERNATIVE_TO"]);
20565
20650
  var INSTANCE_ANCHOR_EDGE_TYPES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
20566
20651
  function instanceCloudWithdrawal(n, destination, getMeta) {
20567
20652
  const id = n.attrs["source"] === "cloud" ? n.attrs["cloudNodeId"] ?? n.id : instanceReceipt(n, destination)["cloudNodeId"];
@@ -20602,7 +20687,9 @@ function cosine2(a, b) {
20602
20687
  return na === 0 || nb === 0 ? 0 : dot / (Math.sqrt(na) * Math.sqrt(nb));
20603
20688
  }
20604
20689
  function noveltyAgainst(node, neighbors, opts = {}) {
20605
- const floor = opts.dedupCosine ?? NEMORI_DEDUP_COSINE;
20690
+ const versionOf = (n) => String(n.attrs?.["embeddingVersion"] ?? "hash-v1");
20691
+ const version3 = versionOf(node);
20692
+ const floor = opts.dedupCosine ?? cosineBandsFor(version3).dedup;
20606
20693
  const emb = node.embedding ?? [];
20607
20694
  if (emb.length === 0) {
20608
20695
  return { ready: true, surprise: 1, topCosine: 0, reason: "no-embedding (fidelity-first)" };
@@ -20611,7 +20698,7 @@ function noveltyAgainst(node, neighbors, opts = {}) {
20611
20698
  for (const other of neighbors) {
20612
20699
  if (other.id === node.id) continue;
20613
20700
  const oe = other.embedding ?? [];
20614
- if (oe.length !== emb.length) continue;
20701
+ if (oe.length !== emb.length || versionOf(other) !== version3) continue;
20615
20702
  const c = cosine2(emb, oe);
20616
20703
  if (c > topCosine) topCosine = c;
20617
20704
  }
@@ -21986,6 +22073,11 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
21986
22073
  }
21987
22074
  const edges = [];
21988
22075
  const semanticEdgeDigests = {};
22076
+ const pulledStructureTarget = (e) => {
22077
+ if (!INSTANCE_STRUCTURE_EDGE_TYPES.has(e.type)) return void 0;
22078
+ const target = store.getNode(e.to) ?? opts.sharedStore?.getNode(e.to);
22079
+ return target?.label === "Solution" && target.attrs["source"] === "cloud" ? e.to : void 0;
22080
+ };
21989
22081
  for (const [sourceId, wireFrom] of semanticEndpoints) {
21990
22082
  const rawOuts = [
21991
22083
  ...store.outEdges(sourceId, [...INSTANCE_EDGES]),
@@ -21993,7 +22085,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
21993
22085
  ];
21994
22086
  const dedup = /* @__PURE__ */ new Map();
21995
22087
  for (const e of rawOuts) dedup.set(`${e.type}>${e.to}`, e);
21996
- const outs = [...dedup.values()].map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) })).filter((x) => {
22088
+ const outs = [...dedup.values()].map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) ?? pulledStructureTarget(e) })).filter((x) => {
21997
22089
  if (x.wireTo === wireFrom) {
21998
22090
  composition.collapsedEdges++;
21999
22091
  return false;