@inerrata-corporation/errata 2.0.2-dev.867 → 2.0.2-dev.873

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 +39 -31
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -21182,7 +21182,7 @@ function triageOf(l2, q, mathOpts) {
21182
21182
  if (!triage) return { triage: "", presenting: presentingId, routes: [] };
21183
21183
  const seen = triage.attrs["perContextSeen"] ?? {};
21184
21184
  const buckets = q.context ? triageContextBuckets(canonicalizeContext(q.context)) : [];
21185
- const active = new Set(q.activeProblemIds ?? []);
21185
+ const active2 = new Set(q.activeProblemIds ?? []);
21186
21186
  const routes = [];
21187
21187
  for (const e of l2.outEdges(triageId, [...ROUTE_EDGE_TYPES])) {
21188
21188
  const perContext = e.attrs["perContext"] ?? {};
@@ -21203,13 +21203,13 @@ function triageOf(l2, q, mathOpts) {
21203
21203
  }
21204
21204
  const post = triagePosterior(counts, buckets, mathOpts);
21205
21205
  let probability = post.probability;
21206
- if (active.size > 0) {
21206
+ if (active2.size > 0) {
21207
21207
  const neighbors = /* @__PURE__ */ new Set([
21208
21208
  ...l2.outEdges(e.to).map((x) => x.to),
21209
21209
  ...l2.inEdges(e.to).map((x) => x.from)
21210
21210
  ]);
21211
21211
  let hits = 0;
21212
- for (const id of active) if (neighbors.has(id)) hits++;
21212
+ for (const id of active2) if (neighbors.has(id)) hits++;
21213
21213
  if (hits > 0) probability = Math.min(1, probability * (1 + COOCCUR_BONUS * Math.tanh(hits)));
21214
21214
  }
21215
21215
  const cause = l2.getNode(e.to);
@@ -56084,30 +56084,34 @@ function createLivenessWatch(deps) {
56084
56084
  // src/loop-lag.ts
56085
56085
  var HEARTBEAT_MS = 500;
56086
56086
  var RECENT_PASS_LIMIT = 12;
56087
- var currentPass = "idle";
56088
- var currentPassStartedAt = null;
56087
+ var active = /* @__PURE__ */ new Map();
56088
+ var nextPassId = 1;
56089
56089
  var started = false;
56090
56090
  var recent = [];
56091
56091
  function markPass(name2) {
56092
- const prev = currentPass;
56093
- const prevStart = currentPassStartedAt;
56092
+ const id = nextPassId++;
56094
56093
  const startedAt = Date.now();
56095
- currentPass = name2;
56096
- currentPassStartedAt = startedAt;
56097
- let restored = false;
56094
+ active.set(id, { name: name2, startedAt });
56095
+ let ended = false;
56098
56096
  return () => {
56099
- if (restored) return;
56100
- restored = true;
56097
+ if (ended) return;
56098
+ ended = true;
56099
+ active.delete(id);
56101
56100
  recent.unshift({ name: name2, ms: Date.now() - startedAt, endedAt: Date.now() });
56102
56101
  if (recent.length > RECENT_PASS_LIMIT) recent.pop();
56103
- currentPass = prev;
56104
- currentPassStartedAt = prevStart;
56105
56102
  };
56106
56103
  }
56104
+ function oldestActive() {
56105
+ for (const p of active.values()) return p;
56106
+ return null;
56107
+ }
56107
56108
  function passState() {
56109
+ const now = Date.now();
56110
+ const oldest = oldestActive();
56108
56111
  return {
56109
- current: currentPass,
56110
- runningMs: currentPassStartedAt === null ? null : Date.now() - currentPassStartedAt,
56112
+ current: oldest?.name ?? "idle",
56113
+ runningMs: oldest === null ? null : now - oldest.startedAt,
56114
+ active: [...active.values()].map((p) => ({ name: p.name, runningMs: now - p.startedAt })),
56111
56115
  recent: [...recent]
56112
56116
  };
56113
56117
  }
@@ -56119,8 +56123,10 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
56119
56123
  const now = Date.now();
56120
56124
  const lag = now - last - HEARTBEAT_MS;
56121
56125
  if (lag > thresholdMs) {
56126
+ const holders = [...active.values()];
56127
+ const who = holders.length === 0 ? "idle" : holders.map((p) => `${p.name} +${((now - p.startedAt) / 1e3).toFixed(1)}s`).join(" | ");
56122
56128
  console.warn(
56123
- `[loop-lag] ${(/* @__PURE__ */ new Date()).toISOString()} event loop held ~${(lag / 1e3).toFixed(1)}s during "${currentPass}"`
56129
+ `[loop-lag] ${(/* @__PURE__ */ new Date()).toISOString()} event loop held ~${(lag / 1e3).toFixed(1)}s during "${who}"`
56124
56130
  );
56125
56131
  }
56126
56132
  last = now;
@@ -56149,7 +56155,7 @@ function watchCensusLine(c = watchCensus()) {
56149
56155
  }
56150
56156
 
56151
56157
  // src/engine.ts
56152
- var DAEMON_VERSION = true ? "2.0.2-dev.867" : "2.0.0-alpha.0";
56158
+ var DAEMON_VERSION = true ? "2.0.2-dev.873" : "2.0.0-alpha.0";
56153
56159
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
56154
56160
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
56155
56161
  var GIT_OP_MUTE_MS = 4e3;
@@ -60675,18 +60681,18 @@ async function runUse(action, ctx) {
60675
60681
  }
60676
60682
  }
60677
60683
  function runClear(ctx) {
60678
- const active = ctx.getActiveAgent();
60684
+ const active2 = ctx.getActiveAgent();
60679
60685
  ctx.clearActiveAgent();
60680
- if (active) {
60681
- ctx.log(`no longer acting as ${active.handle} \u2014 the daemon acts as your default identity`);
60686
+ if (active2) {
60687
+ ctx.log(`no longer acting as ${active2.handle} \u2014 the daemon acts as your default identity`);
60682
60688
  } else {
60683
60689
  ctx.log(`already on the default identity \u2014 nothing to clear`);
60684
60690
  }
60685
60691
  return 0;
60686
60692
  }
60687
60693
  async function runShow(ctx) {
60688
- const active = ctx.getActiveAgent();
60689
- ctx.log(active ? `active agent: ${active.handle} (id ${active.id})` : `active agent: (default identity)`);
60694
+ const active2 = ctx.getActiveAgent();
60695
+ ctx.log(active2 ? `active agent: ${active2.handle} (id ${active2.id})` : `active agent: (default identity)`);
60690
60696
  if (!ctx.loggedIn) {
60691
60697
  ctx.log(` log in to list the agents you can act as: errata login`);
60692
60698
  return 0;
@@ -60698,7 +60704,7 @@ async function runShow(ctx) {
60698
60704
  ctx.log(` couldn't list actable agents: ${errText(err2)}`);
60699
60705
  return 1;
60700
60706
  }
60701
- printActable(resp, active, ctx);
60707
+ printActable(resp, active2, ctx);
60702
60708
  return 0;
60703
60709
  }
60704
60710
  async function runSet(handle2, ctx) {
@@ -60727,7 +60733,7 @@ async function runSet(handle2, ctx) {
60727
60733
  ctx.log(`now acting as ${match2.handle} (id ${match2.id}) \u2014 saved; persists across daemon restarts`);
60728
60734
  return 0;
60729
60735
  }
60730
- function printActable(resp, active, ctx) {
60736
+ function printActable(resp, active2, ctx) {
60731
60737
  if (resp.agents.length === 0) {
60732
60738
  ctx.log(` (no agents you can act as)`);
60733
60739
  return;
@@ -60735,7 +60741,7 @@ function printActable(resp, active, ctx) {
60735
60741
  ctx.log(` agents you can act as:`);
60736
60742
  for (const a of resp.agents) {
60737
60743
  const marks = [];
60738
- if (active && a.id === active.id) marks.push("active");
60744
+ if (active2 && a.id === active2.id) marks.push("active");
60739
60745
  if (a.id === resp.defaultAgentId) marks.push("default");
60740
60746
  const suffix = marks.length ? ` (${marks.join(", ")})` : "";
60741
60747
  const scope = a.scope ? ` \xB7 ${a.scope}` : "";
@@ -61876,8 +61882,10 @@ async function cmdStatus() {
61876
61882
  const h = await res.json();
61877
61883
  if (h.pass) {
61878
61884
  const held = h.pass.runningMs !== null && h.pass.current !== "idle" ? ` (${(h.pass.runningMs / 1e3).toFixed(1)}s)` : "";
61885
+ const alsoCount = Math.max(0, (h.pass.active?.length ?? 0) - 1);
61886
+ const also = alsoCount > 0 ? ` +${alsoCount} concurrent` : "";
61879
61887
  const last = (h.pass.recent ?? []).slice(0, 3).map((p) => `${p.name} ${(p.ms / 1e3).toFixed(1)}s`).join(", ");
61880
- console.log(` pass: ${h.pass.current}${held}${last ? ` \xB7 recent: ${last}` : ""}`);
61888
+ console.log(` pass: ${h.pass.current}${held}${also}${last ? ` \xB7 recent: ${last}` : ""}`);
61881
61889
  }
61882
61890
  if (h.watch) {
61883
61891
  const line = watchCensusLine(h.watch);
@@ -61906,9 +61914,9 @@ async function cmdStatus() {
61906
61914
  } else {
61907
61915
  console.log(` logged in: yes (${cfg.email}) \u2014 key capability enforced by Console installation/scopes`);
61908
61916
  }
61909
- const active = getActiveAgent(cfg);
61917
+ const active2 = getActiveAgent(cfg);
61910
61918
  console.log(
61911
- ` active agent: ${active ? `${active.handle} (acting-as; \`errata use --none\` to clear)` : "default identity"}`
61919
+ ` active agent: ${active2 ? `${active2.handle} (acting-as; \`errata use --none\` to clear)` : "default identity"}`
61912
61920
  );
61913
61921
  const inspection = await inspectCloudEndpoint(cfg.cloudUrl);
61914
61922
  const decision = evaluateCloudEndpoint(cfg.cloudUrl, inspection);
@@ -62028,8 +62036,8 @@ async function cmdWhoami(args2) {
62028
62036
  return;
62029
62037
  }
62030
62038
  try {
62031
- const active = getActiveAgent(cfg);
62032
- const response = await resolveWhoami(authedCloudClient(cfg), active?.handle ?? null);
62039
+ const active2 = getActiveAgent(cfg);
62040
+ const response = await resolveWhoami(authedCloudClient(cfg), active2?.handle ?? null);
62033
62041
  if (args2.includes("--json")) {
62034
62042
  console.log(JSON.stringify(response, null, 2));
62035
62043
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.867",
3
+ "version": "2.0.2-dev.873",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {