@inerrata-corporation/errata 2.0.22-dev.4578 → 2.0.22-dev.4617

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
@@ -86711,7 +86711,7 @@ function createWatchBreaker(deps) {
86711
86711
  }
86712
86712
 
86713
86713
  // src/engine.ts
86714
- var DAEMON_VERSION = true ? "2.0.22-dev.4578" : "2.0.0-alpha.0";
86714
+ var DAEMON_VERSION = true ? "2.0.22-dev.4617" : "2.0.0-alpha.0";
86715
86715
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
86716
86716
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
86717
86717
  var GIT_OP_MUTE_MS = 4e3;
@@ -86862,6 +86862,7 @@ function createWorkspaceEngine(opts) {
86862
86862
  let watchBreaker = null;
86863
86863
  let lastActivityTs = Date.now();
86864
86864
  let storeReconciled = !!opts.skipWatchers;
86865
+ let lastGitEventTs = 0;
86865
86866
  let stopGit = null;
86866
86867
  let fsReindex;
86867
86868
  let stopping = false;
@@ -86986,6 +86987,7 @@ function createWorkspaceEngine(opts) {
86986
86987
  watcher.on("change", markDirty);
86987
86988
  watcher.on("unlink", markDirty);
86988
86989
  const handleGitEvent = async (ev) => {
86990
+ lastGitEventTs = Date.now();
86989
86991
  if (ev.kind !== "commit") {
86990
86992
  gitOpMuteUntil = Date.now() + GIT_OP_MUTE_MS;
86991
86993
  fsReindex.clear();
@@ -89063,6 +89065,7 @@ B: ${b}`,
89063
89065
  return lastActivityTs;
89064
89066
  },
89065
89067
  storeReconciled: () => storeReconciled,
89068
+ lastGitEventAt: () => lastGitEventTs,
89066
89069
  quarantinedSessions: () => sessions.originSessions(),
89067
89070
  markContextDirty() {
89068
89071
  contextDirty = true;
@@ -92921,10 +92924,16 @@ async function enumerateUnits(root, opts = {}) {
92921
92924
  const branch = opts.branch ?? "HEAD";
92922
92925
  const line = await firstParentLine(root, branch);
92923
92926
  let start2 = 0;
92927
+ let covered = null;
92924
92928
  if (opts.since) {
92925
92929
  const at = line.findIndex((c) => c.sha === opts.since);
92926
- if (at < 0) throw new Error(`history-walk: watermark ${opts.since} is not on the first-parent line of ${branch}`);
92927
- start2 = at + 1;
92930
+ if (at >= 0) start2 = at + 1;
92931
+ else {
92932
+ const ancestors = await git(root, [...GIT_OPTS, "rev-list", opts.since]).catch(() => null);
92933
+ if (ancestors === null) throw new Error(`history-walk: watermark ${opts.since} is not a commit in this repository`);
92934
+ covered = new Set(ancestors.split(/\r?\n/).filter(Boolean));
92935
+ while (start2 < line.length && covered.has(line[start2].sha)) start2++;
92936
+ }
92928
92937
  }
92929
92938
  const tags = await tagsByCommit(root);
92930
92939
  const tagsOf = (sha2) => tags.get(sha2) ?? [];
@@ -92958,7 +92967,7 @@ async function enumerateUnits(root, opts = {}) {
92958
92967
  continue;
92959
92968
  }
92960
92969
  const side = sides.get(sha2) ?? await mergeSide(root, parents[0], parents[1]);
92961
- const group = [];
92970
+ let group = [];
92962
92971
  for (const s of side) {
92963
92972
  if (s.parents.length >= 2) continue;
92964
92973
  const c = await commit(s.sha);
@@ -92995,6 +93004,7 @@ async function enumerateUnits(root, opts = {}) {
92995
93004
  groupSha: sha2
92996
93005
  });
92997
93006
  }
93007
+ if (covered) group = group.filter((g) => !covered.has(g.sha));
92998
93008
  if (group.length === 0) {
92999
93009
  group.push({
93000
93010
  index,
@@ -93244,7 +93254,7 @@ function isDoorDeferral(outcome) {
93244
93254
  return outcome.status === "error" && !!outcome.parked && !!outcome.runId && ["deferred-context", "deferred-budget"].includes(outcome.errorCode ?? "");
93245
93255
  }
93246
93256
  var DEFAULT_LOOKAHEAD = 2;
93247
- var CONTENT_TRANSPORT_VERSION = 1;
93257
+ var CONTENT_TRANSPORT_VERSION = 2;
93248
93258
  async function defaultGit(root, args2) {
93249
93259
  const { stdout } = await execFileAsync2("git", ["-C", root, ...args2], { maxBuffer: 64 * 1024 * 1024, windowsHide: true });
93250
93260
  return stdout;
@@ -93806,6 +93816,9 @@ function applyStopRequest(profile, now = () => /* @__PURE__ */ new Date()) {
93806
93816
  }
93807
93817
  };
93808
93818
  }
93819
+ function historyIngestEnabled() {
93820
+ return process.env.ERRATA_HISTORY === "1";
93821
+ }
93809
93822
  async function startHistoryStage(root, input, client, walk11 = {}) {
93810
93823
  let profile = input;
93811
93824
  if (!profile.projectId) return { started: false, reason: "no-project", profile };
@@ -93819,6 +93832,7 @@ async function startHistoryStage(root, input, client, walk11 = {}) {
93819
93832
  await reportHistoryStage(client, stopped);
93820
93833
  return { started: false, reason: "stopped", profile: stopped };
93821
93834
  }
93835
+ if (!historyIngestEnabled()) return { started: false, reason: "disabled", profile };
93822
93836
  if (!consents.mineHistory) return { started: false, reason: "consent-pending", profile };
93823
93837
  const outcome = await runHistoryWalk(root, profile, client, walk11);
93824
93838
  return { started: true, profile: outcome.profile };
@@ -95534,7 +95548,8 @@ async function startMultiDaemon(opts = {}) {
95534
95548
  for (const record2 of records) record2.engine.markContextDirty();
95535
95549
  }
95536
95550
  try {
95537
- if (!r.engine.storeReconciled()) revisionBacklog.add(r.root);
95551
+ if (!historyIngestEnabled()) revisionBacklog.delete(r.root);
95552
+ else if (!r.engine.storeReconciled()) revisionBacklog.add(r.root);
95538
95553
  else {
95539
95554
  const revision = await syncHistoryRevision({ root: r.root, profile: r.engine.profile, store: r.engine.store, cloud: client, salt });
95540
95555
  if (revision.remaining) revisionBacklog.add(r.root);
@@ -95576,7 +95591,8 @@ async function startMultiDaemon(opts = {}) {
95576
95591
  const c = loadConfig();
95577
95592
  if (registryCorrupt()) return;
95578
95593
  for (const r of records) {
95579
- if (!revisionBacklog.has(r.root) && Date.now() - (lastAnchorPull.get(r.root) ?? 0) < ANCHOR_PULL_INTERVAL_MS) continue;
95594
+ const lastPull = lastAnchorPull.get(r.root) ?? 0;
95595
+ if (!revisionBacklog.has(r.root) && r.engine.lastGitEventAt() <= lastPull && Date.now() - lastPull < ANCHOR_PULL_INTERVAL_MS) continue;
95580
95596
  const projectId = r.engine.profile.projectId;
95581
95597
  if (!projectId || !effectiveConsent(c, r.engine.profile).sync) continue;
95582
95598
  const identity = identityFor(liveWorkspaceEntry(r.entry));
@@ -95588,8 +95604,9 @@ async function startMultiDaemon(opts = {}) {
95588
95604
  const client = cloudForIdentity(identity);
95589
95605
  try {
95590
95606
  const { salt } = await resolveProjectSymbolSalt(client, projectId);
95607
+ const pullStartedAt = Date.now();
95591
95608
  await pullProjectAnchors(r, client, salt);
95592
- lastAnchorPull.set(r.root, Date.now());
95609
+ lastAnchorPull.set(r.root, pullStartedAt);
95593
95610
  } catch (err2) {
95594
95611
  console.warn(`[errata] anchor pull skipped for ${r.engine.profile.name}: ${err2 instanceof Error ? err2.message : String(err2)}`);
95595
95612
  }
@@ -95716,6 +95733,10 @@ async function startMultiDaemon(opts = {}) {
95716
95733
  Object.assign(engine.profile, stage2.profile);
95717
95734
  saveProfile(root, engine.profile);
95718
95735
  }
95736
+ if (!stage2.started && stage2.reason === "disabled") {
95737
+ console.log(`[errata] history ingestion is off in this build (v1.1); no walk for ${engine.profile.name}`);
95738
+ return;
95739
+ }
95719
95740
  const state = engine.profile.historyStage?.state ?? "consent-pending";
95720
95741
  const c2 = engine.profile.historyStage?.counts;
95721
95742
  console.log(
@@ -95734,7 +95755,7 @@ async function startMultiDaemon(opts = {}) {
95734
95755
  void ambientLinkAll();
95735
95756
  let historyRetryRunning = false;
95736
95757
  const historyRetry = setInterval(() => {
95737
- if (stopping || historyRetryRunning) return;
95758
+ if (stopping || historyRetryRunning || !historyIngestEnabled()) return;
95738
95759
  historyRetryRunning = true;
95739
95760
  void ambientLinkAll(true).catch((err2) => {
95740
95761
  console.warn(`[errata] history retry pass failed: ${err2 instanceof Error ? err2.message : err2}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.22-dev.4578",
3
+ "version": "2.0.22-dev.4617",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.22-dev.4578",
3
+ "version": "2.0.22-dev.4617",
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
- ca4d68d0efc2998562b8c7a86e88495dc7e0c2dbe4ae6a9568071f403f15d903 .codex-plugin/plugin.json
1
+ 81a5a7875eb137fa180465a687ecfd2fd76f67967cec97962a20f6e695c81d2f .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js