@inerrata-corporation/errata 2.0.22-dev.4534 → 2.0.22-dev.4554

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.
@@ -19814,6 +19814,22 @@ init_src3();
19814
19814
  function findStrandedSymbols(store) {
19815
19815
  return store.strandedSymbols();
19816
19816
  }
19817
+ var FILE_DECLARATION_LABELS = [
19818
+ "Function",
19819
+ "Class",
19820
+ "Method",
19821
+ "Module",
19822
+ "Interface",
19823
+ "Const",
19824
+ "Static",
19825
+ "Property",
19826
+ "TypeAlias",
19827
+ "Namespace",
19828
+ "Enum",
19829
+ "Annotation",
19830
+ "Comment"
19831
+ ];
19832
+ var DECLARATION_LABEL_SET = new Set(FILE_DECLARATION_LABELS);
19817
19833
 
19818
19834
  // src/package-index.ts
19819
19835
  init_src();
package/errata.mjs CHANGED
@@ -47007,6 +47007,12 @@ function reapOrphanedFiles(store, rootPath, workspaceId2, ignoreDirs = []) {
47007
47007
  candidates: orphans.length
47008
47008
  };
47009
47009
  }
47010
+ const repairDue = store.getMeta?.(NESTED_REAP_REPAIRED_KEY) == null;
47011
+ const stranded = repairDue ? store.selectNodes({ labels: [...FILE_DECLARATION_LABELS], attrs: ["workspaceId", "relPath"] }).filter((n) => n.attrs["workspaceId"] === workspaceId2 && typeof n.attrs["relPath"] === "string" && !onDisk.has(n.attrs["relPath"])) : [];
47012
+ const strandedPaths = new Set(stranded.map((n) => n.attrs["relPath"]));
47013
+ if (strandedPaths.size > allowance) {
47014
+ return { reaped: 0, symbolsClosed: 0, skipped: "over-fraction", candidates: strandedPaths.size };
47015
+ }
47010
47016
  const t = Date.now();
47011
47017
  let symbolsClosed = 0;
47012
47018
  store.transaction(() => {
@@ -47021,6 +47027,18 @@ function reapOrphanedFiles(store, rootPath, workspaceId2, ignoreDirs = []) {
47021
47027
  }
47022
47028
  store.closeNode(f.id, t);
47023
47029
  }
47030
+ const gone = orphans.map((f) => f.attrs["relPath"]);
47031
+ for (const n of store.nodesByRelPath(gone)) {
47032
+ if (!DECLARATION_LABEL_SET.has(n.label) || n.attrs["workspaceId"] !== workspaceId2) continue;
47033
+ store.closeNode(n.id, t);
47034
+ symbolsClosed++;
47035
+ }
47036
+ for (const n of stranded) {
47037
+ if ((store.getNode(n.id)?.validTo ?? null) !== null) continue;
47038
+ store.closeNode(n.id, t);
47039
+ symbolsClosed++;
47040
+ }
47041
+ if (repairDue) store.setMeta?.(NESTED_REAP_REPAIRED_KEY, String(t));
47024
47042
  });
47025
47043
  return { reaped: orphans.length, symbolsClosed };
47026
47044
  }
@@ -47057,7 +47075,7 @@ async function reconcileStaleFiles(store, rootPath, workspaceId2) {
47057
47075
  }
47058
47076
  return total;
47059
47077
  }
47060
- var IGNORED, SOURCE_RE, SCAN_YIELD_EVERY, STRANDED_KEY, STRANDED_WINDOW_MAX, ORPHAN_REAP_MAX_FRACTION, ORPHAN_REAP_MIN_ALLOWANCE, LINEAGE_VERIFIED_KEY;
47078
+ var IGNORED, SOURCE_RE, SCAN_YIELD_EVERY, STRANDED_KEY, STRANDED_WINDOW_MAX, ORPHAN_REAP_MAX_FRACTION, ORPHAN_REAP_MIN_ALLOWANCE, FILE_DECLARATION_LABELS, DECLARATION_LABEL_SET, NESTED_REAP_REPAIRED_KEY, LINEAGE_VERIFIED_KEY;
47061
47079
  var init_reconcile = __esm({
47062
47080
  "src/reconcile.ts"() {
47063
47081
  "use strict";
@@ -47069,6 +47087,23 @@ var init_reconcile = __esm({
47069
47087
  STRANDED_WINDOW_MAX = 2e4;
47070
47088
  ORPHAN_REAP_MAX_FRACTION = 0.25;
47071
47089
  ORPHAN_REAP_MIN_ALLOWANCE = 50;
47090
+ FILE_DECLARATION_LABELS = [
47091
+ "Function",
47092
+ "Class",
47093
+ "Method",
47094
+ "Module",
47095
+ "Interface",
47096
+ "Const",
47097
+ "Static",
47098
+ "Property",
47099
+ "TypeAlias",
47100
+ "Namespace",
47101
+ "Enum",
47102
+ "Annotation",
47103
+ "Comment"
47104
+ ];
47105
+ DECLARATION_LABEL_SET = new Set(FILE_DECLARATION_LABELS);
47106
+ NESTED_REAP_REPAIRED_KEY = "orphan-reap:nested-declarations-v1";
47072
47107
  LINEAGE_VERIFIED_KEY = "pass-inputs:reconcile-lineage";
47073
47108
  }
47074
47109
  });
@@ -86676,7 +86711,7 @@ function createWatchBreaker(deps) {
86676
86711
  }
86677
86712
 
86678
86713
  // src/engine.ts
86679
- var DAEMON_VERSION = true ? "2.0.22-dev.4534" : "2.0.0-alpha.0";
86714
+ var DAEMON_VERSION = true ? "2.0.22-dev.4554" : "2.0.0-alpha.0";
86680
86715
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
86681
86716
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
86682
86717
  var GIT_OP_MUTE_MS = 4e3;
@@ -92415,7 +92450,7 @@ async function syncHistoryRevisionPage(opts, resolve10) {
92415
92450
  const key = `${root}|${atCommit}|${ignoreKey}|${[...manifestIds].sort().join(",")}`;
92416
92451
  let snapshot = caches.dependencies.get(key);
92417
92452
  if (!snapshot) {
92418
- const listed = (args2) => {
92453
+ const listed2 = (args2) => {
92419
92454
  if (args2[0] !== "ls-tree") return git3(args2);
92420
92455
  const k = `${root}|${args2.join(" ")}`;
92421
92456
  let out2 = caches.listings.get(k);
@@ -92441,7 +92476,7 @@ async function syncHistoryRevisionPage(opts, resolve10) {
92441
92476
  commit: atCommit,
92442
92477
  side: "after",
92443
92478
  manifestIds,
92444
- git: listed,
92479
+ git: listed2,
92445
92480
  readBlob: blob,
92446
92481
  allowPath: (p) => pathAllowedByFloor(p) && !isPathBlocked(ignore2, p)
92447
92482
  });
@@ -92460,8 +92495,13 @@ async function syncHistoryRevisionPage(opts, resolve10) {
92460
92495
  caches.trees.set(treeKey, tree);
92461
92496
  tree.catch(() => caches.trees.delete(treeKey));
92462
92497
  }
92463
- const blobs = await (tree ?? Promise.resolve(/* @__PURE__ */ new Map())).catch(() => /* @__PURE__ */ new Map());
92498
+ let listed = !!tree;
92499
+ const blobs = await (tree ?? Promise.resolve(/* @__PURE__ */ new Map())).catch(() => {
92500
+ listed = false;
92501
+ return /* @__PURE__ */ new Map();
92502
+ });
92464
92503
  const fileId = (path3) => blobs.get(path3) ?? `commit:${atCommit}`;
92504
+ let heldBack = 0;
92465
92505
  for (const occurrence of toPost) {
92466
92506
  const anchors = occurrence.quality["historicalAnchors"];
92467
92507
  const paths = /* @__PURE__ */ new Set(), symbols = [];
@@ -92471,9 +92511,10 @@ async function syncHistoryRevisionPage(opts, resolve10) {
92471
92511
  const path3 = local?.attrs["relPath"];
92472
92512
  if (typeof path3 !== "string" || !pathAllowedByFloor(path3) || isPathBlocked(ignore2, path3) || /[\r\n]/.test(path3)) continue;
92473
92513
  paths.add(path3);
92474
- const hashes = await fileSymbols({ caches, providers, root, salt, projectId }, path3, fileId(path3), () => git3(["show", `${atCommit}:${path3}`]));
92475
- if (!hashes) partial2 = true;
92476
- const bodyHash = hashes?.get(anchor.symbolId);
92514
+ if (listed && !blobs.has(path3)) continue;
92515
+ const file2 = await fileSymbols({ caches, providers, root, salt, projectId }, path3, fileId(path3), () => git3(["show", `${atCommit}:${path3}`]));
92516
+ if (!file2) partial2 = true;
92517
+ const bodyHash = file2?.hashes.get(anchor.symbolId);
92477
92518
  if (bodyHash) symbols.push({ symbolId: anchor.symbolId, bodyHash });
92478
92519
  }
92479
92520
  const source = occurrenceSourceCommit(occurrence);
@@ -92508,9 +92549,13 @@ async function syncHistoryRevisionPage(opts, resolve10) {
92508
92549
  complete: old.data.dependencies.length === 0 || currentDependencies?.complete === true,
92509
92550
  dependencies: currentDependencies?.dependencies.filter((d) => old.data.dependencies.some((o) => o.packageId === d.packageId && o.manifestId === d.manifestId)) ?? []
92510
92551
  } : void 0;
92511
- if (partial2) continue;
92552
+ if (partial2) {
92553
+ heldBack++;
92554
+ continue;
92555
+ }
92512
92556
  observations.push({ occurrenceId: occurrence.occurrenceId, symbols, ...diff ? { diff } : {}, ...dependencyContext ? { dependencyContext } : {} });
92513
92557
  }
92558
+ if (heldBack) console.warn(`[errata] history revision held back ${heldBack} occurrence(s) at ${atCommit.slice(0, 12)} for ${profile.name}: a Git read failed; retried next sweep`);
92514
92559
  const response = observations.length ? await cloud.reconcileHistory(projectId, { atCommit, parents, observations }) : { atCommit, receipts: [] };
92515
92560
  if (response.atCommit !== atCommit || response.receipts.length !== observations.length || new Set(response.receipts.map((r) => r.occurrenceId)).size !== response.receipts.length || response.receipts.some((r) => r.atCommit !== atCommit || !observations.some((o) => o.occurrenceId === r.occurrenceId))) throw new Error("incomplete history reconciliation response");
92516
92561
  const receipts = new Map(response.receipts.map((r) => [r.occurrenceId, r]));
@@ -92576,22 +92621,28 @@ async function fileSymbols(ctx, path3, fileId, read2) {
92576
92621
  const fileKey = `${ctx.root}|${ctx.salt}|${ctx.projectId}|${fileId}|${path3}`;
92577
92622
  const cached2 = ctx.caches.symbols.get(fileKey);
92578
92623
  if (cached2) return cached2;
92579
- const hashes = /* @__PURE__ */ new Map();
92624
+ const out2 = { ids: /* @__PURE__ */ new Set(), hashes: /* @__PURE__ */ new Map(), parsed: true };
92580
92625
  const provider = ctx.providers.find((p) => p.fileExtensions.includes(extname3(path3).toLowerCase()));
92581
92626
  if (!provider) {
92582
- ctx.caches.symbols.set(fileKey, hashes);
92583
- return hashes;
92627
+ ctx.caches.symbols.set(fileKey, out2);
92628
+ return out2;
92584
92629
  }
92585
92630
  const source = await read2().catch(() => null);
92586
92631
  if (source === null) return void 0;
92587
- ctx.caches.symbols.set(fileKey, hashes);
92588
- if (Buffer.byteLength(source) > 1e6 || source.includes("\0")) return hashes;
92632
+ ctx.caches.symbols.set(fileKey, out2);
92633
+ if (Buffer.byteLength(source) > 1e6 || source.includes("\0")) {
92634
+ out2.parsed = false;
92635
+ return out2;
92636
+ }
92589
92637
  await provider.preload?.();
92590
92638
  for (const symbol2 of provider.extractSymbols(source, path3)) {
92591
92639
  const kind = KINDS[symbol2.kind];
92592
- if (kind && symbol2.bodyHash) hashes.set(projectSymbolId(ctx.salt, ctx.projectId, path3, symbol2.qname ?? symbol2.name, kind), symbol2.bodyHash);
92640
+ if (!kind) continue;
92641
+ const id = projectSymbolId(ctx.salt, ctx.projectId, path3, symbol2.qname ?? symbol2.name, kind);
92642
+ out2.ids.add(id);
92643
+ if (symbol2.bodyHash) out2.hashes.set(id, symbol2.bodyHash);
92593
92644
  }
92594
- return hashes;
92645
+ return out2;
92595
92646
  }
92596
92647
  var CARRY_MAX_CODE_FILES = 400;
92597
92648
  var CARRY_MAX_SYMBOLS = 5e3;
@@ -92626,12 +92677,12 @@ ${await git3(["rev-list", "--parents", "-1", from])}`.split("\n").map((row) => r
92626
92677
  }
92627
92678
  for (const change of allSymbols ? [] : code) {
92628
92679
  for (const blob of change.blobs) {
92629
- const hashes = await fileSymbols(o, change.path, blob, () => git3(["show", blob]));
92630
- if (!hashes) {
92680
+ const file2 = await fileSymbols(o, change.path, blob, () => git3(["show", blob]));
92681
+ if (!file2 || !file2.parsed) {
92631
92682
  allSymbols = true;
92632
92683
  break;
92633
92684
  }
92634
- for (const id of hashes.keys()) symbols.add(id);
92685
+ for (const id of file2.ids) symbols.add(id);
92635
92686
  }
92636
92687
  if (allSymbols) break;
92637
92688
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.22-dev.4534",
3
+ "version": "2.0.22-dev.4554",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -31152,6 +31152,22 @@ async function findStaleFiles(store2, rootPath, workspaceId, lineageVerifiedAt)
31152
31152
  check2();
31153
31153
  return stale;
31154
31154
  }
31155
+ var FILE_DECLARATION_LABELS = [
31156
+ "Function",
31157
+ "Class",
31158
+ "Method",
31159
+ "Module",
31160
+ "Interface",
31161
+ "Const",
31162
+ "Static",
31163
+ "Property",
31164
+ "TypeAlias",
31165
+ "Namespace",
31166
+ "Enum",
31167
+ "Annotation",
31168
+ "Comment"
31169
+ ];
31170
+ var DECLARATION_LABEL_SET = new Set(FILE_DECLARATION_LABELS);
31155
31171
  var LINEAGE_VERIFIED_KEY = "pass-inputs:reconcile-lineage";
31156
31172
  async function reconcileStaleFiles(store2, rootPath, workspaceId) {
31157
31173
  const startedAt = store2.changeSeq?.();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.22-dev.4534",
3
+ "version": "2.0.22-dev.4554",
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
- a7ccdd68670f09f9a8d6888aff3aea5100bd616d3fd76877b8372bdadf019523 .codex-plugin/plugin.json
1
+ b640d2d37f65c14b9a0922dd9c7e4bf32f2e27bf121f472295c6b8c7cbbd8883 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js