@inerrata-corporation/errata 2.0.0-dev.29 → 2.0.0-dev.30

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
@@ -20569,6 +20569,7 @@ var init_env_paths = __esm({
20569
20569
  // src/paths.ts
20570
20570
  var paths_exports = {};
20571
20571
  __export(paths_exports, {
20572
+ daemonLogPath: () => daemonLogPath,
20572
20573
  ensureDir: () => ensureDir,
20573
20574
  ensureParent: () => ensureParent,
20574
20575
  globalConfigPath: () => globalConfigPath,
@@ -20587,6 +20588,10 @@ function globalDir() {
20587
20588
  function globalConfigPath() {
20588
20589
  return process.env["ERRATA_CONFIG_PATH"] ?? join3(globalDir(), "config.json");
20589
20590
  }
20591
+ function daemonLogPath() {
20592
+ mkdirSync3(globalDir(), { recursive: true });
20593
+ return join3(globalDir(), "daemon.log");
20594
+ }
20590
20595
  function globalDaemonLock() {
20591
20596
  return process.env["ERRATA_DAEMON_LOCK"] ?? join3(globalDir(), "daemon.lock");
20592
20597
  }
@@ -25876,7 +25881,9 @@ async function incrementalReindex(store, rootPath, workspaceId2, changedAbsPaths
25876
25881
  });
25877
25882
  }
25878
25883
  const after = /* @__PURE__ */ new Map();
25884
+ let parsedFiles = 0;
25879
25885
  for (const rel of changedRelPaths) {
25886
+ if (parsedFiles++ > 0) await new Promise((r2) => setImmediate(r2));
25880
25887
  const abs = join6(rootPath, ...rel.split("/"));
25881
25888
  const ext = extname(abs).toLowerCase();
25882
25889
  const provider = providers.find((p) => p.fileExtensions.includes(ext));
@@ -37111,7 +37118,7 @@ var init_report_render = __esm({
37111
37118
 
37112
37119
  // src/cli.ts
37113
37120
  init_src5();
37114
- import { existsSync as existsSync19, readFileSync as readFileSync18 } from "node:fs";
37121
+ import { closeSync as closeSync2, existsSync as existsSync19, openSync as openSync2, readFileSync as readFileSync18, renameSync as renameSync3, statSync as statSync5 } from "node:fs";
37115
37122
  import { join as join22 } from "node:path";
37116
37123
  import { spawn as spawn3 } from "node:child_process";
37117
37124
 
@@ -41327,8 +41334,36 @@ function maybeFlushDigests() {
41327
41334
  }
41328
41335
  }
41329
41336
 
41337
+ // src/loop-lag.ts
41338
+ var HEARTBEAT_MS = 500;
41339
+ var currentPass = "idle";
41340
+ var started = false;
41341
+ function markPass(name2) {
41342
+ const prev = currentPass;
41343
+ currentPass = name2;
41344
+ return () => {
41345
+ currentPass = prev;
41346
+ };
41347
+ }
41348
+ function startLoopLagMonitor(thresholdMs = 1e3) {
41349
+ if (started) return;
41350
+ started = true;
41351
+ let last = Date.now();
41352
+ const timer = setInterval(() => {
41353
+ const now = Date.now();
41354
+ const lag = now - last - HEARTBEAT_MS;
41355
+ if (lag > thresholdMs) {
41356
+ console.warn(
41357
+ `[loop-lag] ${(/* @__PURE__ */ new Date()).toISOString()} event loop held ~${(lag / 1e3).toFixed(1)}s during "${currentPass}"`
41358
+ );
41359
+ }
41360
+ last = now;
41361
+ }, HEARTBEAT_MS);
41362
+ timer.unref();
41363
+ }
41364
+
41330
41365
  // src/engine.ts
41331
- var DAEMON_VERSION = true ? "2.0.0-dev.29" : "2.0.0-alpha.0";
41366
+ var DAEMON_VERSION = true ? "2.0.0-dev.30" : "2.0.0-alpha.0";
41332
41367
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
41333
41368
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
41334
41369
  var GIT_OP_MUTE_MS = 4e3;
@@ -41461,12 +41496,13 @@ function createWorkspaceEngine(opts) {
41461
41496
  const t = Date.now();
41462
41497
  const relChanged = changed.map((p) => relative6(opts.workspaceRoot, p).split(sep4).join("/"));
41463
41498
  const causal = causalBuffer.correlate(relChanged, t) ?? void 0;
41499
+ const doneReindex = markPass(`fs-reindex:${profile.name} (${changed.length} files)`);
41464
41500
  void incrementalReindex(store, opts.workspaceRoot, profile.id, changed, t, {
41465
41501
  onIdentityEvaluate: (e) => {
41466
41502
  appendIdentityAudit(identityAuditPath, e, JSON.stringify({ t, ...e }) + "\n");
41467
41503
  },
41468
41504
  declaredRenames: causal?.declaredRenames
41469
- }).then((r) => {
41505
+ }).finally(doneReindex).then((r) => {
41470
41506
  if (r.filesReindexed > 0) {
41471
41507
  console.log(
41472
41508
  `[errata] incremental reindex: ${r.filesReindexed} file(s), +${r.nodesEmitted} nodes / +${r.edgesEmitted} edges`
@@ -41524,6 +41560,7 @@ function createWorkspaceEngine(opts) {
41524
41560
  let episodeId2;
41525
41561
  if (srcPaths.length > 0) {
41526
41562
  const abs = srcPaths.map((p) => join19(opts.workspaceRoot, p));
41563
+ const doneReindex = markPass(`git-reindex:${profile.name} (${abs.length} files)`);
41527
41564
  try {
41528
41565
  const r = await incrementalReindex(store, opts.workspaceRoot, profile.id, abs, t, { declaredRenames });
41529
41566
  if (r.filesReindexed > 0) {
@@ -41536,6 +41573,8 @@ function createWorkspaceEngine(opts) {
41536
41573
  }
41537
41574
  } catch (err2) {
41538
41575
  console.warn("[errata] git reindex failed:", err2);
41576
+ } finally {
41577
+ doneReindex();
41539
41578
  }
41540
41579
  }
41541
41580
  recordGitCommit(store, {
@@ -41605,6 +41644,7 @@ function createWorkspaceEngine(opts) {
41605
41644
  skills: readSkillManifest(paths.skillsManifest)
41606
41645
  };
41607
41646
  const prebuilt = passWorker ? await passWorker.snapshot(snapOpts).catch(() => null) : null;
41647
+ const doneRender = prebuilt ? null : markPass(`context-render-inline:${profile.name}`);
41608
41648
  const { body: body2, snapshot } = assembleAgentContext({
41609
41649
  store,
41610
41650
  ...snapOpts,
@@ -41612,6 +41652,7 @@ function createWorkspaceEngine(opts) {
41612
41652
  ...elicit ? { edgeElicitation: { instruction: PRIOR_TAG_INSTRUCTION } } : {},
41613
41653
  ...prebuilt ? { snapshot: prebuilt } : {}
41614
41654
  });
41655
+ doneRender?.();
41615
41656
  const target = join19(opts.workspaceRoot, "AGENTS.md");
41616
41657
  writeManagedBlock(target, { body: body2 });
41617
41658
  if (elicit) {
@@ -41791,6 +41832,14 @@ function createWorkspaceEngine(opts) {
41791
41832
  const sessionThreads = /* @__PURE__ */ new Map();
41792
41833
  const harvestTexts = async (sessionId, items) => {
41793
41834
  if (items.length === 0) return;
41835
+ const doneHarvest = markPass(`turn-harvest:${profile.name} (${items.length} turns)`);
41836
+ try {
41837
+ await harvestTextsInner(sessionId, items);
41838
+ } finally {
41839
+ doneHarvest();
41840
+ }
41841
+ };
41842
+ const harvestTextsInner = async (sessionId, items) => {
41794
41843
  let minted = 0;
41795
41844
  let resolved = 0;
41796
41845
  let abstracted = 0;
@@ -43094,32 +43143,6 @@ var ConsolidateWorker = class {
43094
43143
  }
43095
43144
  };
43096
43145
 
43097
- // src/loop-lag.ts
43098
- var HEARTBEAT_MS = 500;
43099
- var currentPass = "idle";
43100
- var started = false;
43101
- function markPass(name2) {
43102
- const prev = currentPass;
43103
- currentPass = name2;
43104
- return () => {
43105
- currentPass = prev;
43106
- };
43107
- }
43108
- function startLoopLagMonitor(thresholdMs = 1e3) {
43109
- if (started) return;
43110
- started = true;
43111
- let last = Date.now();
43112
- const timer = setInterval(() => {
43113
- const now = Date.now();
43114
- const lag = now - last - HEARTBEAT_MS;
43115
- if (lag > thresholdMs) {
43116
- console.warn(`[loop-lag] event loop held ~${(lag / 1e3).toFixed(1)}s during "${currentPass}"`);
43117
- }
43118
- last = now;
43119
- }, HEARTBEAT_MS);
43120
- timer.unref();
43121
- }
43122
-
43123
43146
  // src/multi.ts
43124
43147
  init_paths();
43125
43148
 
@@ -44334,6 +44357,7 @@ async function cmdStart() {
44334
44357
  const up = await waitForDaemon(globalDaemonLock(), 12e3);
44335
44358
  if (up) {
44336
44359
  console.log(` daemon: running \xB7 pid ${up.pid} \xB7 ${up.webUiUrl ?? "(running)"}`);
44360
+ console.log(` logs: ${daemonLogPath()}`);
44337
44361
  console.log(` watch it: errata dash \xB7 check it: errata status`);
44338
44362
  } else {
44339
44363
  console.log(` \u26A0 daemon did not come up within 12s.`);
@@ -45309,12 +45333,23 @@ function selfArgv(sub) {
45309
45333
  }
45310
45334
  function spawnDaemonDetached() {
45311
45335
  const { cmd: cmd2, args: args2 } = selfArgv("dash");
45336
+ let out2 = "ignore";
45337
+ try {
45338
+ const logPath = daemonLogPath();
45339
+ try {
45340
+ if (statSync5(logPath).size > 5 * 1024 * 1024) renameSync3(logPath, `${logPath}.1`);
45341
+ } catch {
45342
+ }
45343
+ out2 = openSync2(logPath, "a");
45344
+ } catch {
45345
+ }
45312
45346
  spawn3(cmd2, args2, {
45313
45347
  detached: true,
45314
- stdio: "ignore",
45348
+ stdio: ["ignore", out2, out2],
45315
45349
  windowsHide: true,
45316
45350
  cwd: ROOT
45317
45351
  }).unref();
45352
+ if (out2 !== "ignore") closeSync2(out2);
45318
45353
  }
45319
45354
  function ensureSingletonRunning() {
45320
45355
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.29",
3
+ "version": "2.0.0-dev.30",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15555,7 +15555,9 @@ async function incrementalReindex(store2, rootPath, workspaceId, changedAbsPaths
15555
15555
  });
15556
15556
  }
15557
15557
  const after = /* @__PURE__ */ new Map();
15558
+ let parsedFiles = 0;
15558
15559
  for (const rel of changedRelPaths) {
15560
+ if (parsedFiles++ > 0) await new Promise((r2) => setImmediate(r2));
15559
15561
  const abs = join2(rootPath, ...rel.split("/"));
15560
15562
  const ext = extname(abs).toLowerCase();
15561
15563
  const provider = providers.find((p) => p.fileExtensions.includes(ext));