@inerrata-corporation/errata 2.0.3-dev.1796 → 2.0.3

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.
package/errata.mjs CHANGED
@@ -25280,8 +25280,8 @@ var init_config = __esm({
25280
25280
  "use strict";
25281
25281
  init_paths();
25282
25282
  LEGACY_CLOUD_URL = "https://inerrata-gateway.onrender.com";
25283
- DEFAULT_CLOUD_URL = true ? "https://dev.inerrata.dev" : DEV_CLOUD_URL;
25284
- DEFAULT_UPDATE_CHANNEL = false ? "latest" : "dev";
25283
+ DEFAULT_CLOUD_URL = true ? "https://inerrata.dev" : DEV_CLOUD_URL;
25284
+ DEFAULT_UPDATE_CHANNEL = true ? "latest" : "dev";
25285
25285
  }
25286
25286
  });
25287
25287
 
@@ -31782,10 +31782,6 @@ function fileHasStrandedSymbol(store, fileId) {
31782
31782
  }
31783
31783
  return false;
31784
31784
  }
31785
- function fileIndexUnsettled(store, fnode) {
31786
- if (fnode.attrs["symbolCount"] === 0 || typeof fnode.attrs["indexSkipped"] === "string") return false;
31787
- return store.outEdges(fnode.id, ["DEFINES", "CONTAINS"]).length === 0;
31788
- }
31789
31785
  function symbolNodeId(workspaceId2, relPath, qname, kind) {
31790
31786
  return `${kind}_${sha(
31791
31787
  workspaceId2 + ":" + relPath.replace(/\\/g, "/") + ":" + qname
@@ -31901,7 +31897,7 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
31901
31897
  }
31902
31898
  fileHashes.set(rel, h);
31903
31899
  const fnode = store.getNode(fileNodeId(workspaceId2, rel));
31904
- if (fnode && fnode.attrs["contentHash"] === h && !fileHasStrandedSymbol(store, fnode.id) && !fileIndexUnsettled(store, fnode)) {
31900
+ if (fnode && fnode.attrs["contentHash"] === h && !fileHasStrandedSymbol(store, fnode.id)) {
31905
31901
  store.updateNode(fnode.id, { lastUpdatedAt: t });
31906
31902
  changedRelPaths.delete(rel);
31907
31903
  } else if (!fnode || fnode.attrs["contentHash"] !== h) {
@@ -32242,8 +32238,7 @@ async function runIndexer(store, opts) {
32242
32238
  parentId = fid2;
32243
32239
  }
32244
32240
  const fid = fileNodeId(opts.workspaceId, f.relPath);
32245
- const skip = !f.provider ? "no-provider" : f.size > maxBytes ? "oversize" : void 0;
32246
- upsertFile(store, fid, f, opts.workspaceId, skip);
32241
+ upsertFile(store, fid, f, opts.workspaceId);
32247
32242
  report.nodesEmitted++;
32248
32243
  upsertEdge(store, parentId, "CONTAINS", fid, 1);
32249
32244
  report.edgesEmitted++;
@@ -32288,7 +32283,6 @@ async function runIndexer(store, opts) {
32288
32283
  symbols = f.provider.extractSymbols(source, f.absPath);
32289
32284
  } catch {
32290
32285
  report.filesSkipped++;
32291
- stampIndexOutcome(store, fileNodeId(opts.workspaceId, f.relPath), { indexSkipped: "parse-error" });
32292
32286
  continue;
32293
32287
  }
32294
32288
  reExports = scanReExports(source);
@@ -32690,12 +32684,6 @@ async function runIndexer(store, opts) {
32690
32684
  }
32691
32685
  }
32692
32686
  perf("flush cross-file edges");
32693
- for (const relPath of symbolsByFile.keys()) {
32694
- const fid = fileNodeId(opts.workspaceId, relPath);
32695
- if (store.outEdges(fid, ["DEFINES", "CONTAINS"]).length === 0) {
32696
- stampIndexOutcome(store, fid, { symbolCount: 0 });
32697
- }
32698
- }
32699
32687
  report.durationMs = Date.now() - started2;
32700
32688
  indexNow = null;
32701
32689
  return report;
@@ -32804,7 +32792,7 @@ function gitListFiles(root, ignores, providers) {
32804
32792
  }
32805
32793
  return out2;
32806
32794
  }
32807
- function upsertFile(store, id, f, workspaceId2, skip) {
32795
+ function upsertFile(store, id, f, workspaceId2) {
32808
32796
  const now = nowTs();
32809
32797
  let contentHash;
32810
32798
  try {
@@ -32834,17 +32822,11 @@ function upsertFile(store, id, f, workspaceId2, skip) {
32834
32822
  size: f.size,
32835
32823
  language: f.language ?? null,
32836
32824
  workspaceId: workspaceId2,
32837
- ...contentHash ? { contentHash } : {},
32838
- ...skip ? { indexSkipped: skip } : {}
32825
+ ...contentHash ? { contentHash } : {}
32839
32826
  }
32840
32827
  };
32841
32828
  store.mergeNode(node2);
32842
32829
  }
32843
- function stampIndexOutcome(store, fileId, outcome) {
32844
- const fnode = store.getNode(fileId);
32845
- if (!fnode) return;
32846
- store.updateNode(fileId, { attrs: { ...fnode.attrs, ...outcome } });
32847
- }
32848
32830
  function upsertFolder(store, id, name2, workspaceId2, relPath) {
32849
32831
  const now = nowTs();
32850
32832
  const node2 = {
@@ -40206,14 +40188,6 @@ var init_src11 = __esm({
40206
40188
  import { execFileSync as execFileSync2 } from "node:child_process";
40207
40189
  import { readdirSync as readdirSync4, statSync as statSync3 } from "node:fs";
40208
40190
  import { join as join11, relative as relative3, sep as sep2 } from "node:path";
40209
- function indexerWouldScan(rel) {
40210
- for (const seg of rel.split(/[\\/]/)) {
40211
- if (seg.length === 0) continue;
40212
- if (DEFAULT_IGNORES.has(seg)) return false;
40213
- if (seg.startsWith(".") && seg !== ".") return false;
40214
- }
40215
- return true;
40216
- }
40217
40191
  function gitSourceFiles(root) {
40218
40192
  let stdout;
40219
40193
  try {
@@ -40227,7 +40201,7 @@ function gitSourceFiles(root) {
40227
40201
  }
40228
40202
  const out2 = [];
40229
40203
  for (const rel of stdout.split("\0")) {
40230
- if (!rel || !SOURCE_RE.test(rel) || !indexerWouldScan(rel)) continue;
40204
+ if (!rel || !SOURCE_RE.test(rel)) continue;
40231
40205
  const abs = join11(root, rel);
40232
40206
  if (IGNORED.test(abs)) continue;
40233
40207
  out2.push(abs);
@@ -40245,7 +40219,6 @@ function* walkSource(dir) {
40245
40219
  const name2 = String(e.name);
40246
40220
  const full = join11(dir, name2);
40247
40221
  if (IGNORED.test(full)) continue;
40248
- if (!indexerWouldScan(name2)) continue;
40249
40222
  if (e.isDirectory()) yield* walkSource(full);
40250
40223
  else if (SOURCE_RE.test(name2)) yield full;
40251
40224
  }
@@ -40277,8 +40250,7 @@ async function findStaleFiles(store, rootPath, workspaceId2) {
40277
40250
  } else {
40278
40251
  const edges = store.outEdges(fnode.id, ["DEFINES", "CONTAINS"]);
40279
40252
  if (edges.length === 0) {
40280
- const converged = fnode.attrs["symbolCount"] === 0 || typeof fnode.attrs["indexSkipped"] === "string";
40281
- if (!converged) stale.push(abs);
40253
+ stale.push(abs);
40282
40254
  } else {
40283
40255
  const targets = edges.map((e) => e.to);
40284
40256
  pending.push({ abs, targets });
@@ -57576,14 +57548,7 @@ var census = {
57576
57548
  since: Date.now(),
57577
57549
  breakerRecycles: 0,
57578
57550
  breakerQuarantined: [],
57579
- topOffender: null,
57580
- liveWatchers: 0
57581
- };
57582
- var noteWatcherOpened = () => {
57583
- census.liveWatchers = (census.liveWatchers ?? 0) + 1;
57584
- };
57585
- var noteWatcherClosed = () => {
57586
- census.liveWatchers = Math.max(0, (census.liveWatchers ?? 0) - 1);
57551
+ topOffender: null
57587
57552
  };
57588
57553
  var QUARANTINE_LIST_CAP = 8;
57589
57554
  var noteWatchDispatched = () => void census.dispatched++;
@@ -57602,33 +57567,19 @@ var noteWindowOffender = (path2, count, windowMs) => {
57602
57567
  function watchCensus() {
57603
57568
  return { ...census };
57604
57569
  }
57605
- var WATCH_STORM_RATE_PER_SEC = 20;
57606
- function ago(ms) {
57607
- const s = Math.max(0, Math.round(ms / 1e3));
57608
- if (s < 60) return `${s}s ago`;
57609
- const m = Math.round(s / 60);
57610
- if (m < 60) return `${m}m ago`;
57611
- return `${Math.floor(m / 60)}h ${m % 60}m ago`;
57612
- }
57613
- function watchCensusLine(c = watchCensus(), now = Date.now()) {
57570
+ function watchCensusLine(c = watchCensus()) {
57614
57571
  if (c.dispatched === 0 && c.emitted === 0) return null;
57615
- const elapsedSec = Math.max(1, (now - c.since) / 1e3);
57616
- const perMin = Math.round(c.dispatched / Math.max(1, elapsedSec / 60));
57572
+ const mins = Math.max(1, Math.round((Date.now() - c.since) / 6e4));
57573
+ const perMin = Math.round(c.dispatched / mins);
57617
57574
  let base = `${c.dispatched} OS event(s) \u2192 ${c.logged} logged (${perMin}/min, ${c.rejected} rejected here)`;
57618
57575
  if (c.breakerRecycles > 0 || c.breakerQuarantined.length > 0) {
57619
57576
  const q = c.breakerQuarantined.length > 0 ? `, ${c.breakerQuarantined.length} quarantined` : "";
57620
57577
  base += ` \xB7 breaker: ${c.breakerRecycles} recycled${q}`;
57621
57578
  }
57622
- const top = c.topOffender ? ` \u2014 top: ${c.topOffender.path} (${c.topOffender.count}/${Math.round(c.topOffender.windowMs / 1e3)}s, ${ago(now - c.topOffender.at)})` : "";
57623
- const cold = c.liveWatchers === 0;
57624
- if (cold) return `${base} \xB7 no live watcher (all workspaces cold; lifetime totals of retired engines)${top}`;
57625
- const noOutput = c.dispatched > 500 && c.dispatched / Math.max(c.logged, 1) > 1e4;
57626
- if (noOutput && c.dispatched / elapsedSec >= WATCH_STORM_RATE_PER_SEC) {
57579
+ if (c.dispatched > 500 && c.dispatched / Math.max(c.logged, 1) > 1e4) {
57580
+ const top = c.topOffender ? ` \u2014 top: ${c.topOffender.path} (${c.topOffender.count}/${Math.round(c.topOffender.windowMs / 1e3)}s)` : "";
57627
57581
  return `${base} \u26A0 watcher is doing work with NO output \u2014 a watch target likely contains an ignored tree${top}`;
57628
57582
  }
57629
- if (noOutput) {
57630
- return `${base} \xB7 no-output dispatch at a low rate = last-access echo of bulk reads (harmless)${top}`;
57631
- }
57632
57583
  return base;
57633
57584
  }
57634
57585
 
@@ -57799,7 +57750,7 @@ function createWatchBreaker(deps) {
57799
57750
  }
57800
57751
 
57801
57752
  // src/engine.ts
57802
- var DAEMON_VERSION = true ? "2.0.3-dev.1796" : "2.0.0-alpha.0";
57753
+ var DAEMON_VERSION = true ? "2.0.3" : "2.0.0-alpha.0";
57803
57754
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
57804
57755
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
57805
57756
  var GIT_OP_MUTE_MS = 4e3;
@@ -57944,7 +57895,6 @@ function createWorkspaceEngine(opts) {
57944
57895
  ignoreInitial: true,
57945
57896
  persistent: true
57946
57897
  });
57947
- noteWatcherOpened();
57948
57898
  watchBreaker = createWatchBreaker({
57949
57899
  unwatch: (p) => void watcher?.unwatch(p),
57950
57900
  readd: (p) => void watcher?.add(p),
@@ -60013,10 +59963,7 @@ B: ${b}`,
60013
59963
  if (stopGit) stopGit();
60014
59964
  if (passWorker) await passWorker.stop();
60015
59965
  if (watchBreaker) watchBreaker.stop();
60016
- if (watcher) {
60017
- await watcher.close();
60018
- noteWatcherClosed();
60019
- }
59966
+ if (watcher) await watcher.close();
60020
59967
  if (flushTimer) clearTimeout(flushTimer);
60021
59968
  for (const tmr of diagTimers.values()) clearTimeout(tmr);
60022
59969
  diagTimers.clear();
@@ -60607,7 +60554,6 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
60607
60554
  };
60608
60555
  const nodes = [];
60609
60556
  const seen = /* @__PURE__ */ new Set();
60610
- const walked = /* @__PURE__ */ new Set();
60611
60557
  const shippedById = /* @__PURE__ */ new Map();
60612
60558
  const anchorSources = /* @__PURE__ */ new Set();
60613
60559
  const semanticEndpoints = /* @__PURE__ */ new Map();
@@ -60639,8 +60585,6 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
60639
60585
  const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...opts.sharedStore.findNodesByLabel(label)] : store.findNodesByLabel(label);
60640
60586
  for (const n of population) {
60641
60587
  if (seen.has(n.id)) continue;
60642
- if (walked.has(n.id)) continue;
60643
- walked.add(n.id);
60644
60588
  composition.candidates++;
60645
60589
  if (n.attrs["source"] === "cloud") {
60646
60590
  composition.cloudSourced++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.3-dev.1796",
3
+ "version": "2.0.3",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15877,10 +15877,6 @@ function fileHasStrandedSymbol(store2, fileId) {
15877
15877
  }
15878
15878
  return false;
15879
15879
  }
15880
- function fileIndexUnsettled(store2, fnode) {
15881
- if (fnode.attrs["symbolCount"] === 0 || typeof fnode.attrs["indexSkipped"] === "string") return false;
15882
- return store2.outEdges(fnode.id, ["DEFINES", "CONTAINS"]).length === 0;
15883
- }
15884
15880
  function symbolNodeId(workspaceId, relPath, qname, kind) {
15885
15881
  return `${kind}_${sha(
15886
15882
  workspaceId + ":" + relPath.replace(/\\/g, "/") + ":" + qname
@@ -15996,7 +15992,7 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
15996
15992
  }
15997
15993
  fileHashes.set(rel, h);
15998
15994
  const fnode = store2.getNode(fileNodeId(workspaceId, rel));
15999
- if (fnode && fnode.attrs["contentHash"] === h && !fileHasStrandedSymbol(store2, fnode.id) && !fileIndexUnsettled(store2, fnode)) {
15995
+ if (fnode && fnode.attrs["contentHash"] === h && !fileHasStrandedSymbol(store2, fnode.id)) {
16000
15996
  store2.updateNode(fnode.id, { lastUpdatedAt: t });
16001
15997
  changedRelPaths.delete(rel);
16002
15998
  } else if (!fnode || fnode.attrs["contentHash"] !== h) {
@@ -16337,8 +16333,7 @@ async function runIndexer(store2, opts) {
16337
16333
  parentId = fid2;
16338
16334
  }
16339
16335
  const fid = fileNodeId(opts.workspaceId, f.relPath);
16340
- const skip = !f.provider ? "no-provider" : f.size > maxBytes ? "oversize" : void 0;
16341
- upsertFile(store2, fid, f, opts.workspaceId, skip);
16336
+ upsertFile(store2, fid, f, opts.workspaceId);
16342
16337
  report.nodesEmitted++;
16343
16338
  upsertEdge(store2, parentId, "CONTAINS", fid, 1);
16344
16339
  report.edgesEmitted++;
@@ -16383,7 +16378,6 @@ async function runIndexer(store2, opts) {
16383
16378
  symbols = f.provider.extractSymbols(source, f.absPath);
16384
16379
  } catch {
16385
16380
  report.filesSkipped++;
16386
- stampIndexOutcome(store2, fileNodeId(opts.workspaceId, f.relPath), { indexSkipped: "parse-error" });
16387
16381
  continue;
16388
16382
  }
16389
16383
  reExports = scanReExports(source);
@@ -16785,12 +16779,6 @@ async function runIndexer(store2, opts) {
16785
16779
  }
16786
16780
  }
16787
16781
  perf("flush cross-file edges");
16788
- for (const relPath of symbolsByFile.keys()) {
16789
- const fid = fileNodeId(opts.workspaceId, relPath);
16790
- if (store2.outEdges(fid, ["DEFINES", "CONTAINS"]).length === 0) {
16791
- stampIndexOutcome(store2, fid, { symbolCount: 0 });
16792
- }
16793
- }
16794
16782
  report.durationMs = Date.now() - started;
16795
16783
  indexNow = null;
16796
16784
  return report;
@@ -16899,7 +16887,7 @@ function gitListFiles(root, ignores, providers) {
16899
16887
  }
16900
16888
  return out2;
16901
16889
  }
16902
- function upsertFile(store2, id, f, workspaceId, skip) {
16890
+ function upsertFile(store2, id, f, workspaceId) {
16903
16891
  const now = nowTs();
16904
16892
  let contentHash;
16905
16893
  try {
@@ -16929,17 +16917,11 @@ function upsertFile(store2, id, f, workspaceId, skip) {
16929
16917
  size: f.size,
16930
16918
  language: f.language ?? null,
16931
16919
  workspaceId,
16932
- ...contentHash ? { contentHash } : {},
16933
- ...skip ? { indexSkipped: skip } : {}
16920
+ ...contentHash ? { contentHash } : {}
16934
16921
  }
16935
16922
  };
16936
16923
  store2.mergeNode(node);
16937
16924
  }
16938
- function stampIndexOutcome(store2, fileId, outcome) {
16939
- const fnode = store2.getNode(fileId);
16940
- if (!fnode) return;
16941
- store2.updateNode(fileId, { attrs: { ...fnode.attrs, ...outcome } });
16942
- }
16943
16925
  function upsertFolder(store2, id, name2, workspaceId, relPath) {
16944
16926
  const now = nowTs();
16945
16927
  const node = {
@@ -27299,14 +27281,6 @@ import { readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
27299
27281
  import { join as join5, relative as relative2, sep as sep2 } from "node:path";
27300
27282
  var IGNORED = /[\\/](?:\.git|node_modules|\.errata|dist|__pycache__)(?:[\\/]|$)/;
27301
27283
  var SOURCE_RE = /\.(ts|tsx|js|jsx|mjs|cjs|py)$/i;
27302
- function indexerWouldScan(rel) {
27303
- for (const seg of rel.split(/[\\/]/)) {
27304
- if (seg.length === 0) continue;
27305
- if (DEFAULT_IGNORES.has(seg)) return false;
27306
- if (seg.startsWith(".") && seg !== ".") return false;
27307
- }
27308
- return true;
27309
- }
27310
27284
  function gitSourceFiles(root) {
27311
27285
  let stdout;
27312
27286
  try {
@@ -27320,7 +27294,7 @@ function gitSourceFiles(root) {
27320
27294
  }
27321
27295
  const out2 = [];
27322
27296
  for (const rel of stdout.split("\0")) {
27323
- if (!rel || !SOURCE_RE.test(rel) || !indexerWouldScan(rel)) continue;
27297
+ if (!rel || !SOURCE_RE.test(rel)) continue;
27324
27298
  const abs = join5(root, rel);
27325
27299
  if (IGNORED.test(abs)) continue;
27326
27300
  out2.push(abs);
@@ -27338,7 +27312,6 @@ function* walkSource(dir) {
27338
27312
  const name2 = String(e.name);
27339
27313
  const full = join5(dir, name2);
27340
27314
  if (IGNORED.test(full)) continue;
27341
- if (!indexerWouldScan(name2)) continue;
27342
27315
  if (e.isDirectory()) yield* walkSource(full);
27343
27316
  else if (SOURCE_RE.test(name2)) yield full;
27344
27317
  }
@@ -27372,8 +27345,7 @@ async function findStaleFiles(store2, rootPath, workspaceId) {
27372
27345
  } else {
27373
27346
  const edges = store2.outEdges(fnode.id, ["DEFINES", "CONTAINS"]);
27374
27347
  if (edges.length === 0) {
27375
- const converged = fnode.attrs["symbolCount"] === 0 || typeof fnode.attrs["indexSkipped"] === "string";
27376
- if (!converged) stale.push(abs);
27348
+ stale.push(abs);
27377
27349
  } else {
27378
27350
  const targets = edges.map((e) => e.to);
27379
27351
  pending.push({ abs, targets });