@inerrata-corporation/errata 2.0.0-dev.52 → 2.0.0-dev.53

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.
Files changed (2) hide show
  1. package/errata.mjs +44 -4
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -24531,7 +24531,7 @@ var init_generalize_graph = __esm({
24531
24531
 
24532
24532
  // src/dual-burst.ts
24533
24533
  function collectiveScore(hit, cap) {
24534
- if (hit.cloudScore != null) return Math.min(cap, Math.max(0, hit.cloudScore));
24534
+ if (hit.cloudScore != null) return cap * Math.max(0, Math.min(1, hit.cloudScore));
24535
24535
  const u = hit.usageCount ?? 0;
24536
24536
  return Math.min(cap, Math.log10(u + 1) / 3);
24537
24537
  }
@@ -24602,20 +24602,26 @@ function dedupCloudHits(hits) {
24602
24602
  }
24603
24603
  function searchResultToCloudHits(result) {
24604
24604
  const n = result.nodes.length;
24605
+ const scores = result.nodes.map((nd) => typeof nd.attrs?.["score"] === "number" ? nd.attrs["score"] : NaN);
24606
+ const maxScore = Math.max(0, ...scores.filter((s) => !Number.isNaN(s)));
24605
24607
  return result.nodes.map((node2, i2) => {
24606
24608
  const usage = node2.attrs?.["usageCount"];
24609
+ const s = scores[i2];
24610
+ const cloudScore = !Number.isNaN(s) && maxScore > 0 ? s / maxScore : n > 0 ? (n - i2) / n : 0;
24607
24611
  return {
24608
24612
  id: node2.id,
24609
24613
  label: node2.label,
24610
24614
  description: node2.description,
24611
- cloudScore: n > 0 ? (n - i2) / n : 0,
24615
+ cloudScore,
24612
24616
  ...typeof usage === "number" ? { usageCount: usage } : {}
24613
24617
  };
24614
24618
  });
24615
24619
  }
24620
+ var DUAL_BURST_SEMANTIC_NEUTRAL;
24616
24621
  var init_dual_burst = __esm({
24617
24622
  "src/dual-burst.ts"() {
24618
24623
  "use strict";
24624
+ DUAL_BURST_SEMANTIC_NEUTRAL = 0.3;
24619
24625
  }
24620
24626
  });
24621
24627
 
@@ -24710,7 +24716,7 @@ import { homedir as homedir2 } from "node:os";
24710
24716
  import { dirname as dirname3, join as join4 } from "node:path";
24711
24717
  import { createRequire } from "node:module";
24712
24718
  function semanticFloorFor(version2) {
24713
- if (version2 === EMBEDDING_VERSION) return 0.25;
24719
+ if (version2 === EMBEDDING_VERSION || version2 === MODEL_EMBEDDING_VERSION) return 0.25;
24714
24720
  return 0.5;
24715
24721
  }
24716
24722
  function noteHashFallback() {
@@ -26254,6 +26260,30 @@ function embedCodeNodes(store, opts = {}) {
26254
26260
  function embedSemanticNodes(store, opts = {}) {
26255
26261
  return embedNodesByLabels(store, SEMANTIC_LABELS, opts);
26256
26262
  }
26263
+ async function ensureNodeEmbedded(store, nodeId, opts = {}) {
26264
+ const node2 = store.getNode(nodeId);
26265
+ if (!node2 || node2.embedding.length > 0) return false;
26266
+ const text = buildText(store, node2);
26267
+ if (!text) return false;
26268
+ let result;
26269
+ try {
26270
+ if (opts.mode === "hash") {
26271
+ const v = embed(text);
26272
+ result = { vector: v, version: EMBEDDING_VERSION, dim: v.length };
26273
+ } else {
26274
+ const r = (await embedBatchWithModelOrHash([text]))[0];
26275
+ if (!r) return false;
26276
+ result = r;
26277
+ }
26278
+ } catch {
26279
+ return false;
26280
+ }
26281
+ store.updateNode(nodeId, {
26282
+ embedding: result.vector,
26283
+ attrs: { ...node2.attrs, embeddingVersion: result.version }
26284
+ });
26285
+ return true;
26286
+ }
26257
26287
  async function embedNodesByLabels(store, labels, opts = {}) {
26258
26288
  const started2 = Date.now();
26259
26289
  const report = {
@@ -26460,6 +26490,7 @@ __export(src_exports4, {
26460
26490
  commandSignature: () => commandSignature,
26461
26491
  embedCodeNodes: () => embedCodeNodes,
26462
26492
  embedSemanticNodes: () => embedSemanticNodes,
26493
+ ensureNodeEmbedded: () => ensureNodeEmbedded,
26463
26494
  evaluateForReview: () => evaluateForReview,
26464
26495
  extractDiagnostics: () => extractDiagnostics,
26465
26496
  extractErrorSignature: () => extractErrorSignature,
@@ -35733,6 +35764,7 @@ var init_mcp = __esm({
35733
35764
  init_src4();
35734
35765
  init_src2();
35735
35766
  init_src10();
35767
+ init_dual_burst();
35736
35768
  init_paths();
35737
35769
  init_symbol_summaries();
35738
35770
  init_webui();
@@ -35960,7 +35992,15 @@ var init_mcp = __esm({
35960
35992
  }
35961
35993
  return unresolved(args2);
35962
35994
  }
35995
+ const seedForBurst = store.getNode(id);
35996
+ if (seedForBurst && seedForBurst.embedding.length === 0) {
35997
+ await ensureNodeEmbedded(store, id);
35998
+ }
35963
35999
  const ranked = localBurst(store, id, {
36000
+ // Hold an embeddingless candidate's neutral semantic under the dual-burst
36001
+ // cloud cap so unknown local code can't outrank the capped collective (see
36002
+ // DUAL_BURST_SEMANTIC_NEUTRAL). No-op for local-only bursts.
36003
+ weights: { semanticNeutral: DUAL_BURST_SEMANTIC_NEUTRAL },
35964
36004
  ...args2["maxHops"] != null ? { maxHops: Number(args2["maxHops"]) } : {},
35965
36005
  ...args2["limit"] != null ? { limit: Number(args2["limit"]) } : {}
35966
36006
  });
@@ -42759,7 +42799,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42759
42799
  }
42760
42800
 
42761
42801
  // src/engine.ts
42762
- var DAEMON_VERSION = true ? "2.0.0-dev.52" : "2.0.0-alpha.0";
42802
+ var DAEMON_VERSION = true ? "2.0.0-dev.53" : "2.0.0-alpha.0";
42763
42803
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42764
42804
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42765
42805
  var GIT_OP_MUTE_MS = 4e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.52",
3
+ "version": "2.0.0-dev.53",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {