@inerrata-corporation/errata 2.0.17-dev.3477 → 2.0.17-dev.3483

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 +27 -3
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -82234,7 +82234,7 @@ function createWatchBreaker(deps) {
82234
82234
  }
82235
82235
 
82236
82236
  // src/engine.ts
82237
- var DAEMON_VERSION = true ? "2.0.17-dev.3477" : "2.0.0-alpha.0";
82237
+ var DAEMON_VERSION = true ? "2.0.17-dev.3483" : "2.0.0-alpha.0";
82238
82238
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
82239
82239
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
82240
82240
  var GIT_OP_MUTE_MS = 4e3;
@@ -88168,6 +88168,12 @@ function historyConsents(profile) {
88168
88168
  contributeHistory: Boolean(c?.contributeHistory) && profile.syncConsent !== "disabled"
88169
88169
  };
88170
88170
  }
88171
+ var HISTORY_RETRY_INTERVAL_MS = 5 * 60 * 1e3;
88172
+ function historyRetryDue(profile, now, lastAttempt = 0) {
88173
+ if (!profile.projectId || !profile.projectHydratedAt || profile.historyStage?.state !== "paused" || !historyConsents(profile).mineHistory || profile.syncConsent === "disabled") return false;
88174
+ const pausedAt = Date.parse(profile.historyStage.updatedAt);
88175
+ return Number.isFinite(pausedAt) && now - Math.max(pausedAt, lastAttempt) >= HISTORY_RETRY_INTERVAL_MS;
88176
+ }
88171
88177
  function buildHistoryReport(profile) {
88172
88178
  const stage2 = profile.historyStage;
88173
88179
  return {
@@ -89928,11 +89934,17 @@ async function startMultiDaemon(opts = {}) {
89928
89934
  const anchorPull = setInterval(() => {
89929
89935
  void anchorPullAll();
89930
89936
  }, 6e4);
89931
- const ambientLinkAll = async () => {
89937
+ const historyRetryAttempts = /* @__PURE__ */ new Map();
89938
+ const ambientLinkAll = async (retryPausedOnly = false) => {
89932
89939
  const c = loadConfig();
89933
89940
  if (registryCorrupt()) return;
89934
89941
  for (const r of records) {
89942
+ if (stopping) return;
89935
89943
  const working = loadProfile(r.root) ?? r.engine.profile;
89944
+ if (retryPausedOnly) {
89945
+ if (historyInFlight.has(r.root) || !historyRetryDue(working, Date.now(), historyRetryAttempts.get(r.root))) continue;
89946
+ historyRetryAttempts.set(r.root, Date.now());
89947
+ }
89936
89948
  if (!effectiveConsent(c, working).sync) continue;
89937
89949
  const identity = identityFor(liveWorkspaceEntry(r.entry));
89938
89950
  if (identity.invalid) {
@@ -89996,8 +90008,9 @@ async function startMultiDaemon(opts = {}) {
89996
90008
  console.warn(`[errata] project reanchor failed for ${r.engine.profile.name}: ${re.detail}`);
89997
90009
  }
89998
90010
  await pullProjectAnchors(r, client, salt);
89999
- if (r.engine.profile.projectHydratedAt && !historyInFlight.has(r.root)) {
90011
+ if (!stopping && records.includes(r) && r.engine.profile.projectHydratedAt && !historyInFlight.has(r.root)) {
90000
90012
  historyInFlight.add(r.root);
90013
+ if (retryPausedOnly) console.log(`[errata] resuming paused history for ${r.engine.profile.name} from its acknowledged watermark`);
90001
90014
  const engine = r.engine;
90002
90015
  const root = r.root;
90003
90016
  const anchorIndex = {
@@ -90052,6 +90065,16 @@ async function startMultiDaemon(opts = {}) {
90052
90065
  };
90053
90066
  const historyInFlight = /* @__PURE__ */ new Set();
90054
90067
  void ambientLinkAll();
90068
+ let historyRetryRunning = false;
90069
+ const historyRetry = setInterval(() => {
90070
+ if (stopping || historyRetryRunning) return;
90071
+ historyRetryRunning = true;
90072
+ void ambientLinkAll(true).catch((err2) => {
90073
+ console.warn(`[errata] history retry pass failed: ${err2 instanceof Error ? err2.message : err2}`);
90074
+ }).finally(() => {
90075
+ historyRetryRunning = false;
90076
+ });
90077
+ }, 6e4);
90055
90078
  const packageAutoAll = async () => {
90056
90079
  const out2 = /* @__PURE__ */ new Map();
90057
90080
  for (const r of records) {
@@ -90804,6 +90827,7 @@ async function startMultiDaemon(opts = {}) {
90804
90827
  clearInterval(idleSweep);
90805
90828
  clearInterval(codexWake);
90806
90829
  clearInterval(anchorPull);
90830
+ clearInterval(historyRetry);
90807
90831
  clearTimeout(codexWakeBoot);
90808
90832
  try {
90809
90833
  const cur = readFileSync36(lockPath, "utf8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.17-dev.3477",
3
+ "version": "2.0.17-dev.3483",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {