@inerrata-corporation/errata 2.0.6-dev.2710 → 2.0.6-dev.2734

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 +17 -12
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -79905,7 +79905,7 @@ function createWatchBreaker(deps) {
79905
79905
  }
79906
79906
 
79907
79907
  // src/engine.ts
79908
- var DAEMON_VERSION = true ? "2.0.6-dev.2710" : "2.0.0-alpha.0";
79908
+ var DAEMON_VERSION = true ? "2.0.6-dev.2734" : "2.0.0-alpha.0";
79909
79909
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
79910
79910
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
79911
79911
  var GIT_OP_MUTE_MS = 4e3;
@@ -84480,7 +84480,6 @@ async function spineForUnit(git3, root, unit, readBlob) {
84480
84480
  const wire = (d) => ({ ecosystem: d.ecosystem, name: d.name, version: d.version, kind: d.kind, manifest: d.manifest });
84481
84481
  return { declared: rings.declared.map(wire), context: rings.context.map(wire) };
84482
84482
  }
84483
- var HEX_BODY_HASH = /^[0-9a-f]{8,64}$/;
84484
84483
  function anchorsFor(pathTokens, ignoreLines, projectId, anchors) {
84485
84484
  if (!anchors) return void 0;
84486
84485
  const out2 = {};
@@ -84492,11 +84491,9 @@ function anchorsFor(pathTokens, ignoreLines, projectId, anchors) {
84492
84491
  for (const n of nodes) {
84493
84492
  const qname = n.attrs["qname"];
84494
84493
  if (typeof qname !== "string") continue;
84495
- const bodyHash = n.attrs["bodyHash"];
84496
84494
  list.push({
84497
84495
  symbolId: projectSymbolId(anchors.salt, projectId, relPath, qname, n.label),
84498
- kind: n.label,
84499
- ...typeof bodyHash === "string" && HEX_BODY_HASH.test(bodyHash) ? { contentHash: bodyHash } : {}
84496
+ kind: n.label
84500
84497
  });
84501
84498
  if (list.length >= MAX_ANCHORS_PER_TOKEN) break;
84502
84499
  }
@@ -84520,7 +84517,8 @@ function stage(profile, patch, now) {
84520
84517
  // `lastError: undefined` in the patch CLEARS it (a resumed walk must not
84521
84518
  // keep showing the error it recovered from); an absent key keeps it.
84522
84519
  ..."lastError" in patch ? patch.lastError ? { lastError: patch.lastError } : {} : prev?.lastError ? { lastError: prev.lastError } : {},
84523
- ...patch.counts ? { counts: patch.counts } : prev?.counts ? { counts: prev.counts } : {}
84520
+ ...patch.counts ? { counts: patch.counts } : prev?.counts ? { counts: prev.counts } : {},
84521
+ ...patch.backfillAnchor ? { backfillAnchor: patch.backfillAnchor } : prev?.backfillAnchor ? { backfillAnchor: prev.backfillAnchor } : {}
84524
84522
  }
84525
84523
  };
84526
84524
  }
@@ -84570,7 +84568,8 @@ async function walk10(root, input, client, opts, readBlob) {
84570
84568
  const since = profile.historyStage?.watermarkSha ?? null;
84571
84569
  const units = await (opts.enumerate ?? enumerateUnits)(root, since ? { since } : {});
84572
84570
  const total = (profile.historyStage?.unitsDone ?? 0) + units.length;
84573
- profile = stage(profile, { state: "scanning", unitsTotal: total, headSha, lastError: void 0 }, now);
84571
+ const anchor = profile.historyStage?.backfillAnchor ? { ...profile.historyStage.backfillAnchor } : { index: Number((await git3(root, ["rev-list", "--first-parent", "--count", headSha])).trim()) - 1 };
84572
+ profile = stage(profile, { state: "scanning", unitsTotal: total, headSha, lastError: void 0, backfillAnchor: anchor }, now);
84574
84573
  persist(profile);
84575
84574
  let response = await reportHistoryStage(client, profile, log);
84576
84575
  if (response?.stopRequested) {
@@ -84628,15 +84627,13 @@ async function walk10(root, input, client, opts, readBlob) {
84628
84627
  extractorVersion: HISTORY_EXTRACTOR_VERSION,
84629
84628
  ...opts.frame ? { frame: opts.frame } : {},
84630
84629
  ...dryRun ? { dryRun: true } : {},
84631
- ...prev ? { after: { sha: prev.sha, subIndex: prev.subIndex } } : {}
84630
+ ...prev ? { after: { sha: prev.sha, subIndex: prev.subIndex } } : {},
84631
+ ...!dryRun && u.index <= anchor.index ? { backfill: { anchorIndex: anchor.index, ...anchor.seq !== void 0 ? { anchorSeq: anchor.seq } : {} } } : {}
84632
84632
  };
84633
84633
  const spine = await spineForUnit(git3, root, u, readBlob);
84634
84634
  if (spine) body2.spine = spine;
84635
84635
  const anchors = anchorsFor(bundle.pathTokens, ignoreLines, projectId, opts.anchors);
84636
- if (anchors) {
84637
- body2.anchors = anchors;
84638
- body2.observedAtCommit = headSha;
84639
- }
84636
+ if (anchors) body2.anchors = anchors;
84640
84637
  return { body: body2, prepMs: Date.now() - prepStarted };
84641
84638
  })();
84642
84639
  prepared.set(k, p);
@@ -84695,6 +84692,9 @@ async function walk10(root, input, client, opts, readBlob) {
84695
84692
  let attempt = 0;
84696
84693
  while (outcome === null) {
84697
84694
  attempt += 1;
84695
+ if (!first && body2.backfill && body2.backfill.anchorSeq === void 0 && anchor.seq !== void 0) {
84696
+ body2.backfill = { ...body2.backfill, anchorSeq: anchor.seq };
84697
+ }
84698
84698
  const settled = await (first ?? settle(Promise.resolve().then(() => post(projectId, body2))));
84699
84699
  first = null;
84700
84700
  if ("err" in settled) {
@@ -84714,6 +84714,11 @@ async function walk10(root, input, client, opts, readBlob) {
84714
84714
  }
84715
84715
  const res = settled.res;
84716
84716
  if (res.ordered) doorOrders = true;
84717
+ if (res.backfill && anchor.seq === void 0) {
84718
+ anchor.seq = res.backfill.anchorSeq;
84719
+ profile = stage(profile, { backfillAnchor: { ...anchor } }, now);
84720
+ persist(profile);
84721
+ }
84717
84722
  if (res.status === "in_progress") {
84718
84723
  const retryAt = new Date(Date.now() + res.retryAfterMs).toISOString();
84719
84724
  if (Date.now() - started2 > RECOVERY_DEADLINE_MS) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2710",
3
+ "version": "2.0.6-dev.2734",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {