@inerrata-corporation/errata 2.0.6-dev.2581 → 2.0.6-dev.2602

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
@@ -33879,8 +33879,11 @@ async function scan(root, current, ignores, providers, out2) {
33879
33879
  const provider = providers.find((p) => p.fileExtensions.includes(ext)) ?? null;
33880
33880
  const rel = relative2(root, abs).split(sep).join("/");
33881
33881
  let size = 0;
33882
+ let mtimeMs;
33882
33883
  try {
33883
- size = statSync3(abs).size;
33884
+ const st = statSync3(abs);
33885
+ size = st.size;
33886
+ mtimeMs = st.mtimeMs;
33884
33887
  } catch {
33885
33888
  continue;
33886
33889
  }
@@ -33888,6 +33891,7 @@ async function scan(root, current, ignores, providers, out2) {
33888
33891
  absPath: abs,
33889
33892
  relPath: rel,
33890
33893
  size,
33894
+ mtimeMs,
33891
33895
  language: provider?.id ?? null,
33892
33896
  provider
33893
33897
  });
@@ -33928,8 +33932,11 @@ function gitListFiles(root, ignores, providers) {
33928
33932
  for (const rel of rels) {
33929
33933
  const abs = join12(root, rel);
33930
33934
  let size;
33935
+ let mtimeMs;
33931
33936
  try {
33932
- size = statSync3(abs).size;
33937
+ const st = statSync3(abs);
33938
+ size = st.size;
33939
+ mtimeMs = st.mtimeMs;
33933
33940
  } catch {
33934
33941
  continue;
33935
33942
  }
@@ -33939,6 +33946,7 @@ function gitListFiles(root, ignores, providers) {
33939
33946
  absPath: abs,
33940
33947
  relPath: rel,
33941
33948
  size,
33949
+ mtimeMs,
33942
33950
  language: provider?.id ?? null,
33943
33951
  provider
33944
33952
  });
@@ -33947,12 +33955,14 @@ function gitListFiles(root, ignores, providers) {
33947
33955
  }
33948
33956
  function upsertFile(store, id, f, workspaceId2, skip) {
33949
33957
  const now = nowTs();
33958
+ const existing = store.getNode(id);
33959
+ if (existing && fileUnchanged(existing.attrs, f, skip)) return;
33950
33960
  let contentHash;
33951
33961
  try {
33952
33962
  contentHash = createHash5("sha256").update(readFileSync11(f.absPath)).digest("hex");
33953
33963
  } catch {
33954
33964
  }
33955
- const carried = { ...store.getNode(id)?.attrs ?? {} };
33965
+ const carried = { ...existing?.attrs ?? {} };
33956
33966
  for (const owned of ["contentHash", "indexSkipped", "symbolCount"]) delete carried[owned];
33957
33967
  const node2 = {
33958
33968
  id,
@@ -33976,6 +33986,7 @@ function upsertFile(store, id, f, workspaceId2, skip) {
33976
33986
  absPath: f.absPath,
33977
33987
  relPath: f.relPath,
33978
33988
  size: f.size,
33989
+ ...f.mtimeMs !== void 0 ? { mtimeMs: f.mtimeMs } : {},
33979
33990
  language: f.language ?? null,
33980
33991
  workspaceId: workspaceId2,
33981
33992
  ...contentHash ? { contentHash } : {},
@@ -33984,6 +33995,15 @@ function upsertFile(store, id, f, workspaceId2, skip) {
33984
33995
  };
33985
33996
  store.mergeNode(node2);
33986
33997
  }
33998
+ function fileUnchanged(attrs, f, skip) {
33999
+ if (f.mtimeMs === void 0 || attrs["mtimeMs"] !== f.mtimeMs) return false;
34000
+ if (attrs["size"] !== f.size || typeof attrs["contentHash"] !== "string") return false;
34001
+ if (attrs["relPath"] !== f.relPath || attrs["absPath"] !== f.absPath) return false;
34002
+ if ((attrs["language"] ?? null) !== (f.language ?? null)) return false;
34003
+ const stored = attrs["indexSkipped"];
34004
+ const scanOwned = stored === "no-provider" || stored === "oversize" ? stored : void 0;
34005
+ return scanOwned === skip;
34006
+ }
33987
34007
  function stampIndexOutcome(store, fileId, outcome) {
33988
34008
  const fnode = store.getNode(fileId);
33989
34009
  if (!fnode) return;
@@ -41289,6 +41309,7 @@ __export(src_exports5, {
41289
41309
  defaultProviders: () => defaultProviders,
41290
41310
  edgeId: () => edgeId,
41291
41311
  fileNodeId: () => fileNodeId,
41312
+ fileUnchanged: () => fileUnchanged,
41292
41313
  findInnermostScope: () => findInnermostScope,
41293
41314
  folderNodeId: () => folderNodeId,
41294
41315
  fromHex: () => fromHex,
@@ -78120,6 +78141,14 @@ function passState() {
78120
78141
  recent: [...recent]
78121
78142
  };
78122
78143
  }
78144
+ function describeHolders(running, finished, windowStart, now) {
78145
+ const parts2 = [...running].map((p) => `${p.name} +${((now - p.startedAt) / 1e3).toFixed(1)}s`);
78146
+ for (const p of finished) {
78147
+ if (p.endedAt < windowStart) break;
78148
+ parts2.push(`${p.name} ended ${(p.ms / 1e3).toFixed(1)}s`);
78149
+ }
78150
+ return parts2.length === 0 ? "idle" : parts2.join(" | ");
78151
+ }
78123
78152
  function startLoopLagMonitor(thresholdMs = 1e3) {
78124
78153
  if (started) return;
78125
78154
  started = true;
@@ -78128,8 +78157,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
78128
78157
  const now = Date.now();
78129
78158
  const lag = now - last - HEARTBEAT_MS;
78130
78159
  if (lag > thresholdMs) {
78131
- const holders = [...active.values()];
78132
- const who = holders.length === 0 ? "idle" : holders.map((p) => `${p.name} +${((now - p.startedAt) / 1e3).toFixed(1)}s`).join(" | ");
78160
+ const who = describeHolders(active.values(), recent, last, now);
78133
78161
  console.warn(
78134
78162
  `[loop-lag] ${(/* @__PURE__ */ new Date()).toISOString()} event loop held ~${(lag / 1e3).toFixed(1)}s during "${who}"`
78135
78163
  );
@@ -78389,7 +78417,7 @@ function createWatchBreaker(deps) {
78389
78417
  }
78390
78418
 
78391
78419
  // src/engine.ts
78392
- var DAEMON_VERSION = true ? "2.0.6-dev.2581" : "2.0.0-alpha.0";
78420
+ var DAEMON_VERSION = true ? "2.0.6-dev.2602" : "2.0.0-alpha.0";
78393
78421
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
78394
78422
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
78395
78423
  var GIT_OP_MUTE_MS = 4e3;
@@ -85019,6 +85047,11 @@ async function startMultiDaemon(opts = {}) {
85019
85047
  let boundaryFlushUnits = 0;
85020
85048
  let boundaryFlushLastAdvanceAt = 0;
85021
85049
  let boundaryFlushBatches = 0;
85050
+ let endFlushPass = null;
85051
+ const markFlushStage = (stage2) => {
85052
+ endFlushPass?.();
85053
+ endFlushPass = markPass(`flush:${stage2}`);
85054
+ };
85022
85055
  const beginFlush = (stage2) => {
85023
85056
  boundaryFlushing = true;
85024
85057
  boundaryFlushStartedAt = Date.now();
@@ -85028,9 +85061,11 @@ async function startMultiDaemon(opts = {}) {
85028
85061
  boundaryFlushItems = 0;
85029
85062
  boundaryFlushDetail = "";
85030
85063
  boundaryFlushStage = stage2;
85064
+ markFlushStage(stage2);
85031
85065
  };
85032
85066
  const flushStage = (stage2) => {
85033
85067
  boundaryFlushStage = stage2;
85068
+ markFlushStage(stage2);
85034
85069
  };
85035
85070
  let boundaryFlushItems = 0;
85036
85071
  let boundaryFlushDetail = "";
@@ -85073,6 +85108,8 @@ async function startMultiDaemon(opts = {}) {
85073
85108
  const endFlush = () => {
85074
85109
  boundaryFlushing = false;
85075
85110
  boundaryFlushStage = "";
85111
+ endFlushPass?.();
85112
+ endFlushPass = null;
85076
85113
  };
85077
85114
  const fireBoundary = () => {
85078
85115
  for (const l of boundaryListeners) {
@@ -85557,13 +85594,14 @@ async function startMultiDaemon(opts = {}) {
85557
85594
  log: (line) => console.log(line)
85558
85595
  });
85559
85596
  const pullProjectAnchors = async (r, client, salt) => {
85597
+ const donePass = markPass(`anchor-pull:${r.engine.profile.name}`);
85560
85598
  const sync = await syncProjectAnchors({
85561
85599
  root: r.root,
85562
85600
  profile: r.engine.profile,
85563
85601
  store: r.engine.store,
85564
85602
  cloud: client,
85565
85603
  salt
85566
- });
85604
+ }).finally(donePass);
85567
85605
  if (sync.synced) {
85568
85606
  if (sync.anchors + sync.updated > 0) {
85569
85607
  r.engine.markContextDirty();
@@ -86356,7 +86394,8 @@ async function startMultiDaemon(opts = {}) {
86356
86394
  settleRunning = true;
86357
86395
  try {
86358
86396
  for (const r of records) {
86359
- await r.engine.embedSettled();
86397
+ const donePass = markPass(`settle:${r.engine.profile.name}`);
86398
+ await r.engine.embedSettled().finally(donePass);
86360
86399
  }
86361
86400
  } finally {
86362
86401
  settleRunning = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.2581",
3
+ "version": "2.0.6-dev.2602",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -16895,8 +16895,11 @@ async function scan(root, current, ignores, providers, out2) {
16895
16895
  const provider = providers.find((p) => p.fileExtensions.includes(ext)) ?? null;
16896
16896
  const rel = relative(root, abs).split(sep).join("/");
16897
16897
  let size = 0;
16898
+ let mtimeMs;
16898
16899
  try {
16899
- size = statSync2(abs).size;
16900
+ const st = statSync2(abs);
16901
+ size = st.size;
16902
+ mtimeMs = st.mtimeMs;
16900
16903
  } catch {
16901
16904
  continue;
16902
16905
  }
@@ -16904,6 +16907,7 @@ async function scan(root, current, ignores, providers, out2) {
16904
16907
  absPath: abs,
16905
16908
  relPath: rel,
16906
16909
  size,
16910
+ mtimeMs,
16907
16911
  language: provider?.id ?? null,
16908
16912
  provider
16909
16913
  });
@@ -16944,8 +16948,11 @@ function gitListFiles(root, ignores, providers) {
16944
16948
  for (const rel of rels) {
16945
16949
  const abs = join2(root, rel);
16946
16950
  let size;
16951
+ let mtimeMs;
16947
16952
  try {
16948
- size = statSync2(abs).size;
16953
+ const st = statSync2(abs);
16954
+ size = st.size;
16955
+ mtimeMs = st.mtimeMs;
16949
16956
  } catch {
16950
16957
  continue;
16951
16958
  }
@@ -16955,6 +16962,7 @@ function gitListFiles(root, ignores, providers) {
16955
16962
  absPath: abs,
16956
16963
  relPath: rel,
16957
16964
  size,
16965
+ mtimeMs,
16958
16966
  language: provider?.id ?? null,
16959
16967
  provider
16960
16968
  });
@@ -16963,12 +16971,14 @@ function gitListFiles(root, ignores, providers) {
16963
16971
  }
16964
16972
  function upsertFile(store2, id, f, workspaceId, skip) {
16965
16973
  const now = nowTs();
16974
+ const existing = store2.getNode(id);
16975
+ if (existing && fileUnchanged(existing.attrs, f, skip)) return;
16966
16976
  let contentHash;
16967
16977
  try {
16968
16978
  contentHash = createHash3("sha256").update(readFileSync2(f.absPath)).digest("hex");
16969
16979
  } catch {
16970
16980
  }
16971
- const carried = { ...store2.getNode(id)?.attrs ?? {} };
16981
+ const carried = { ...existing?.attrs ?? {} };
16972
16982
  for (const owned of ["contentHash", "indexSkipped", "symbolCount"]) delete carried[owned];
16973
16983
  const node = {
16974
16984
  id,
@@ -16992,6 +17002,7 @@ function upsertFile(store2, id, f, workspaceId, skip) {
16992
17002
  absPath: f.absPath,
16993
17003
  relPath: f.relPath,
16994
17004
  size: f.size,
17005
+ ...f.mtimeMs !== void 0 ? { mtimeMs: f.mtimeMs } : {},
16995
17006
  language: f.language ?? null,
16996
17007
  workspaceId,
16997
17008
  ...contentHash ? { contentHash } : {},
@@ -17000,6 +17011,15 @@ function upsertFile(store2, id, f, workspaceId, skip) {
17000
17011
  };
17001
17012
  store2.mergeNode(node);
17002
17013
  }
17014
+ function fileUnchanged(attrs, f, skip) {
17015
+ if (f.mtimeMs === void 0 || attrs["mtimeMs"] !== f.mtimeMs) return false;
17016
+ if (attrs["size"] !== f.size || typeof attrs["contentHash"] !== "string") return false;
17017
+ if (attrs["relPath"] !== f.relPath || attrs["absPath"] !== f.absPath) return false;
17018
+ if ((attrs["language"] ?? null) !== (f.language ?? null)) return false;
17019
+ const stored = attrs["indexSkipped"];
17020
+ const scanOwned = stored === "no-provider" || stored === "oversize" ? stored : void 0;
17021
+ return scanOwned === skip;
17022
+ }
17003
17023
  function stampIndexOutcome(store2, fileId, outcome) {
17004
17024
  const fnode = store2.getNode(fileId);
17005
17025
  if (!fnode) return;
@@ -24305,6 +24325,7 @@ __export(src_exports, {
24305
24325
  defaultProviders: () => defaultProviders,
24306
24326
  edgeId: () => edgeId,
24307
24327
  fileNodeId: () => fileNodeId,
24328
+ fileUnchanged: () => fileUnchanged,
24308
24329
  findInnermostScope: () => findInnermostScope,
24309
24330
  folderNodeId: () => folderNodeId,
24310
24331
  fromHex: () => fromHex,