@inerrata-corporation/errata 2.0.2-dev.568 → 2.0.2-dev.592

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 +92 -5
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -22556,6 +22556,21 @@ function renderSnapshot(s) {
22556
22556
  lines.push(`- **${h.description}** \u2014 \`${h.id}\``);
22557
22557
  }
22558
22558
  }
22559
+ if (si.remoteHits?.length) {
22560
+ lines.push("");
22561
+ lines.push("_From the Errata Network \u2014 collective priors on this intent:_");
22562
+ for (const h of si.remoteHits) {
22563
+ lines.push(`- **${h.label}:** ${h.description} \u2014 \`${h.id}\``);
22564
+ }
22565
+ }
22566
+ if (si.knownGap) {
22567
+ const g = si.knownGap;
22568
+ const others = g.othersStuck !== null ? `, ${g.othersStuck} other contributor(s) stuck here` : "";
22569
+ lines.push("");
22570
+ lines.push(
22571
+ `_\u26A0 Known gap: the collective graph knows it doesn't know this (open void \u2014 demand ${g.demand.toFixed(1)}, ${g.demandTier}${others}). What you capture on this intent fills a gap someone is already waiting on._`
22572
+ );
22573
+ }
22559
22574
  lines.push("");
22560
22575
  } else if (s.workingFile) {
22561
22576
  const w = s.workingFile;
@@ -23701,9 +23716,15 @@ var init_client = __esm({
23701
23716
  if (q.codeFingerprint) qs.set("codeFingerprint", q.codeFingerprint);
23702
23717
  if (q.seed?.length) qs.set("seed", q.seed.join(","));
23703
23718
  if (q.q) qs.set("q", q.q);
23719
+ if (q.channel) qs.set("channel", q.channel);
23704
23720
  const res = await this.json("GET", `/v2/search?${qs.toString()}`);
23705
23721
  const { nodes, edges } = this.toCastalia(res);
23706
- return { nodes, edges, generatedAt: res.generatedAt };
23722
+ return {
23723
+ nodes,
23724
+ edges,
23725
+ generatedAt: res.generatedAt,
23726
+ ...res.voidSignal ? { voidSignal: res.voidSignal } : {}
23727
+ };
23707
23728
  }
23708
23729
  /**
23709
23730
  * The castalia wire shape → local-mergeable graph. Extracted so the priming fetch
@@ -54420,7 +54441,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54420
54441
  }
54421
54442
 
54422
54443
  // src/engine.ts
54423
- var DAEMON_VERSION = true ? "2.0.2-dev.568" : "2.0.0-alpha.0";
54444
+ var DAEMON_VERSION = true ? "2.0.2-dev.592" : "2.0.0-alpha.0";
54424
54445
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54425
54446
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54426
54447
  var GIT_OP_MUTE_MS = 4e3;
@@ -54759,6 +54780,8 @@ function createWorkspaceEngine(opts) {
54759
54780
  let lastRemoteAt = 0;
54760
54781
  let remoteInFlight = false;
54761
54782
  const REMOTE_REFRESH_MS = 5 * 6e4;
54783
+ let intentRemote = null;
54784
+ let intentRemoteInFlight = false;
54762
54785
  let ctxRefreshInFlight = false;
54763
54786
  let ctxRefreshQueued = false;
54764
54787
  let lastSelfCiteSkips = 0;
@@ -54820,12 +54843,14 @@ function createWorkspaceEngine(opts) {
54820
54843
  const pendingUpdate = opts.pendingUpdate?.() ?? null;
54821
54844
  const reviewItems = pickReviewItems();
54822
54845
  const liveIntent = intents.mostRecent(Date.now());
54846
+ maybeRefreshIntentPriors(liveIntent ?? null);
54823
54847
  const intentHits = liveIntent ? searchByIntent(store, liveIntent, { limit: 4 }).map((h) => ({
54824
54848
  id: h.node.id,
54825
54849
  label: h.node.label,
54826
54850
  description: h.node.description,
54827
54851
  coverage: h.coverage
54828
54852
  })) : [];
54853
+ const intentCollective = liveIntent && intentRemote?.forIntent === liveIntent ? intentRemote : null;
54829
54854
  const { body: body2, snapshot, ledger } = assembleAgentContext({
54830
54855
  store,
54831
54856
  ...snapOpts,
@@ -54834,7 +54859,20 @@ function createWorkspaceEngine(opts) {
54834
54859
  ...prebuilt ? { snapshot: prebuilt } : {},
54835
54860
  ...pendingUpdate ? { pendingUpdate } : {},
54836
54861
  ...reviewItems.length ? { reviewItems } : {},
54837
- ...liveIntent ? { statedIntent: { text: liveIntent, hits: intentHits } } : {}
54862
+ ...liveIntent ? {
54863
+ statedIntent: {
54864
+ text: liveIntent,
54865
+ hits: intentHits,
54866
+ ...intentCollective && intentCollective.hits.length > 0 ? {
54867
+ remoteHits: intentCollective.hits.slice(0, 4).map((n) => ({
54868
+ id: n.id,
54869
+ label: n.label,
54870
+ description: n.description
54871
+ }))
54872
+ } : {},
54873
+ ...intentCollective?.voidSignal ? { knownGap: intentCollective.voidSignal } : {}
54874
+ }
54875
+ } : {}
54838
54876
  });
54839
54877
  doneRender?.();
54840
54878
  try {
@@ -54888,6 +54926,10 @@ function createWorkspaceEngine(opts) {
54888
54926
  domains: norm(profile.domains),
54889
54927
  kinds: ["Pattern", "Technique", "AntiPattern"],
54890
54928
  ...seed.length ? { seed } : {},
54929
+ // VD-priorsearch: this is the AMBIENT lane — declaring it keeps its
54930
+ // misses from masquerading as asks (the 1515-miss mega-void was this
54931
+ // exact query, unlabeled).
54932
+ channel: "priming",
54891
54933
  limit: 8
54892
54934
  };
54893
54935
  cloud.search(q).then((res) => {
@@ -54901,6 +54943,32 @@ function createWorkspaceEngine(opts) {
54901
54943
  remoteInFlight = false;
54902
54944
  }
54903
54945
  };
54946
+ const maybeRefreshIntentPriors = (liveIntent) => {
54947
+ if (!liveIntent || opts.skipContextWriter || intentRemoteInFlight) return;
54948
+ if (intentRemote?.forIntent === liveIntent) return;
54949
+ const syncOk = opts.syncConsent ?? loadConfig().consent.sync;
54950
+ if (!syncOk) return;
54951
+ if (typeof cloud.search !== "function") return;
54952
+ intentRemoteInFlight = true;
54953
+ cloud.search({
54954
+ stack: [],
54955
+ domains: [],
54956
+ kinds: ["Pattern", "Technique", "AntiPattern", "Problem", "Solution"],
54957
+ q: liveIntent,
54958
+ channel: "intent",
54959
+ limit: 6
54960
+ }).then((res) => {
54961
+ intentRemote = {
54962
+ forIntent: liveIntent,
54963
+ hits: res.nodes ?? [],
54964
+ ...res.voidSignal ? { voidSignal: res.voidSignal } : {}
54965
+ };
54966
+ contextDirty = true;
54967
+ }).catch(() => {
54968
+ }).finally(() => {
54969
+ intentRemoteInFlight = false;
54970
+ });
54971
+ };
54904
54972
  const runNightly = async () => {
54905
54973
  if (passWorker) {
54906
54974
  try {
@@ -56595,8 +56663,23 @@ function preservedSymbolsFor(description, index) {
56595
56663
  }
56596
56664
  return out2;
56597
56665
  }
56666
+ function internalSymbolsFor(description, lexiconHas, publicIndex) {
56667
+ const out2 = [];
56668
+ const seen = /* @__PURE__ */ new Set();
56669
+ for (const m of description.matchAll(/[A-Za-z_$][\w$]{2,}(?:\.[A-Za-z_$][\w$]+)*/g)) {
56670
+ const tok = m[0];
56671
+ if (seen.has(tok)) continue;
56672
+ seen.add(tok);
56673
+ if (!lexiconHas(tok)) continue;
56674
+ if (publicIndex?.symbols.has(tok)) continue;
56675
+ out2.push(tok);
56676
+ if (out2.length >= PRESERVED_SYMBOLS_CAP) break;
56677
+ }
56678
+ return out2;
56679
+ }
56598
56680
 
56599
56681
  // src/instance-ingest.ts
56682
+ init_generalize_graph();
56600
56683
  var INSTANCE_LABELS = ["Problem", "Solution", "RootCause"];
56601
56684
  var INSTANCE_EDGES = ["CAUSED_BY", "SOLVED_BY"];
56602
56685
  var ANCHOR_EDGES = ["OCCURS_IN", "DEPENDS_ON", "PERTAIN_TO", "CONCERNS"];
@@ -56666,18 +56749,22 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
56666
56749
  return key ? { originSession: key } : {};
56667
56750
  };
56668
56751
  const symbolIndex = opts.workspaceRoot ? publicSymbolIndex(store, opts.workspaceRoot) : null;
56752
+ const ownLexicon = buildSymbolLexicon(store);
56669
56753
  const shareable = (n) => {
56670
56754
  const preserved = symbolIndex ? preservedSymbolsFor(n.description, symbolIndex) : [];
56755
+ const shippedText = generalize(n.description, { level }).text;
56756
+ const internal = internalSymbolsFor(shippedText, (t) => ownLexicon.has(t), symbolIndex);
56671
56757
  return {
56672
56758
  ...n,
56673
- description: generalize(n.description, { level }).text,
56759
+ description: shippedText,
56674
56760
  embedding: [],
56675
56761
  ...originSessionOf(n),
56676
56762
  attrs: {
56677
56763
  scope: stripCodebaseScope(n.attrs["scope"]),
56678
56764
  ...n.attrs["kind"] ? { kind: n.attrs["kind"] } : {},
56679
56765
  ...n.attrs["resolvedAs"] ? { resolvedAs: n.attrs["resolvedAs"] } : {},
56680
- ...preserved.length > 0 ? { preservedSymbols: preserved } : {}
56766
+ ...preserved.length > 0 ? { preservedSymbols: preserved } : {},
56767
+ ...internal.length > 0 ? { internalSymbols: internal } : {}
56681
56768
  }
56682
56769
  };
56683
56770
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.568",
3
+ "version": "2.0.2-dev.592",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {