@inerrata-corporation/errata 2.0.2-dev.886 → 2.0.2-dev.906

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 +51 -12
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -49857,19 +49857,32 @@ function summarizeWitnessLedger(configDir, nowMs) {
49857
49857
  if (entries.length === 0) return [];
49858
49858
  const byChannel = /* @__PURE__ */ new Map();
49859
49859
  for (const e of entries) {
49860
- const c = byChannel.get(e.channel) ?? { recorded: 0, selfSkipped: 0, selfGated: 0, unmatched: 0, lastTs: 0 };
49860
+ const c = byChannel.get(e.channel) ?? {
49861
+ recorded: 0,
49862
+ selfSkipped: 0,
49863
+ selfGated: 0,
49864
+ unmatchedAttempts: 0,
49865
+ parked: -1,
49866
+ awaitingDrain: -1,
49867
+ lastTs: 0
49868
+ };
49861
49869
  c.recorded += e.recorded ?? 0;
49862
49870
  c.selfSkipped += e.clientSelfSkipped ?? 0;
49863
49871
  c.selfGated += e.selfGated ?? 0;
49864
- c.unmatched += e.unmatched ?? 0;
49872
+ c.unmatchedAttempts += e.unmatched ?? 0;
49873
+ if (e.ts >= c.lastTs) {
49874
+ if (e.parked !== void 0) c.parked = e.parked;
49875
+ if (e.awaitingDrain !== void 0) c.awaitingDrain = e.awaitingDrain;
49876
+ }
49865
49877
  c.lastTs = Math.max(c.lastTs, e.ts);
49866
49878
  byChannel.set(e.channel, c);
49867
49879
  }
49868
49880
  const out2 = [];
49869
49881
  for (const [channel, c] of byChannel) {
49870
49882
  const ageH = Math.round((nowMs - c.lastTs) / 36e5);
49883
+ const depth = c.parked < 0 ? "parked ?" : `parked ${c.parked}${c.awaitingDrain > 0 ? ` (${c.awaitingDrain} awaiting drain)` : ""}`;
49871
49884
  out2.push(
49872
- `${channel}: recorded ${c.recorded} \xB7 self-gated ${c.selfSkipped + c.selfGated} \xB7 unmatched ${c.unmatched} \xB7 last activity ${ageH}h ago`
49885
+ `${channel}: recorded ${c.recorded} \xB7 self-gated ${c.selfSkipped + c.selfGated} \xB7 ${depth} \xB7 ${c.unmatchedAttempts} unmatched attempt(s) \xB7 last activity ${ageH}h ago`
49873
49886
  );
49874
49887
  }
49875
49888
  return out2;
@@ -56179,7 +56192,7 @@ function createLivenessWatch(deps) {
56179
56192
  }
56180
56193
 
56181
56194
  // src/engine.ts
56182
- var DAEMON_VERSION = true ? "2.0.2-dev.886" : "2.0.0-alpha.0";
56195
+ var DAEMON_VERSION = true ? "2.0.2-dev.906" : "2.0.0-alpha.0";
56183
56196
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
56184
56197
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
56185
56198
  var GIT_OP_MUTE_MS = 4e3;
@@ -58572,6 +58585,10 @@ function contributedWireId(n) {
58572
58585
  return isMembraneSaltedId(cloudId) ? cloudId : n.id;
58573
58586
  }
58574
58587
  var WIRE_CANONICAL_ID_MIN = 6;
58588
+ var SHIP_TERMINAL_REFUSALS = 3;
58589
+ function refusalFingerprint(reason, description) {
58590
+ return digest(`${reason}\0${description}`);
58591
+ }
58575
58592
  function unshippableReason(canonical, label) {
58576
58593
  void label;
58577
58594
  if (canonical.length < WIRE_CANONICAL_ID_MIN) {
@@ -58681,6 +58698,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
58681
58698
  notNovel: 0,
58682
58699
  unshippable: 0,
58683
58700
  heldOrphans: 0,
58701
+ terminalRefused: 0,
58684
58702
  privacyRewritten: 0,
58685
58703
  sidecarDropped: 0,
58686
58704
  sidecarDropReasons: {},
@@ -58720,6 +58738,13 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
58720
58738
  composition.autoMint++;
58721
58739
  continue;
58722
58740
  }
58741
+ if (typeof n.attrs["shipRefusedCount"] === "number" && n.attrs["shipRefusedCount"] >= SHIP_TERMINAL_REFUSALS && n.attrs["shipRefusedFingerprint"] === refusalFingerprint(
58742
+ String(n.attrs["shipRefusedReason"] ?? ""),
58743
+ n.description
58744
+ )) {
58745
+ composition.terminalRefused++;
58746
+ continue;
58747
+ }
58723
58748
  if (!noveltyAgainst(n, ref, noveltyOpts).ready) {
58724
58749
  composition.notNovel++;
58725
58750
  continue;
@@ -60507,24 +60532,38 @@ async function startMultiDaemon(opts = {}) {
60507
60532
  };
60508
60533
  let blockedRepeat = 0;
60509
60534
  let rejectedRepeat = 0;
60510
- const noteRefused = (id, repeat) => {
60535
+ const noteRefused = (id, reason, repeat) => {
60511
60536
  const owner = owningStore(id);
60512
60537
  if (!owner) return;
60538
+ const fp = refusalFingerprint(reason, owner.n.description);
60539
+ const same = owner.n.attrs["shipRefusedFingerprint"] === fp;
60540
+ const count = same ? Number(owner.n.attrs["shipRefusedCount"] ?? 0) + 1 : 1;
60513
60541
  if (owner.n.attrs["shipRefusedSinceSeq"] !== void 0) repeat();
60514
- else
60515
- owner.s.updateNode(id, {
60516
- attrs: { ...owner.n.attrs, shipRefusedSinceSeq: seq }
60517
- });
60542
+ owner.s.updateNode(id, {
60543
+ attrs: {
60544
+ ...owner.n.attrs,
60545
+ ...same && owner.n.attrs["shipRefusedSinceSeq"] !== void 0 ? {} : { shipRefusedSinceSeq: seq },
60546
+ shipRefusedCount: count,
60547
+ shipRefusedReason: reason,
60548
+ shipRefusedFingerprint: fp
60549
+ }
60550
+ });
60518
60551
  };
60519
- for (const id of blocked) noteRefused(id, () => blockedRepeat++);
60520
- for (const id of rejected.keys()) noteRefused(id, () => rejectedRepeat++);
60552
+ for (const id of blocked) noteRefused(id, "blocked", () => blockedRepeat++);
60553
+ for (const [id, why] of rejected) noteRefused(id, why, () => rejectedRepeat++);
60521
60554
  for (const n of instances.nodes) {
60522
60555
  const owner = owningStore(n.id);
60523
60556
  if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) continue;
60524
60557
  if (blocked.has(n.id)) continue;
60525
60558
  if (rejected.has(n.id)) continue;
60526
60559
  const cloudNodeId = cloudIdByLocal.get(n.id);
60527
- const { shipRefusedSinceSeq: _cleared, ...carried } = owner.n.attrs;
60560
+ const {
60561
+ shipRefusedSinceSeq: _clearedSeq,
60562
+ shipRefusedCount: _clearedCount,
60563
+ shipRefusedReason: _clearedReason,
60564
+ shipRefusedFingerprint: _clearedFp,
60565
+ ...carried
60566
+ } = owner.n.attrs;
60528
60567
  owner.s.updateNode(n.id, {
60529
60568
  attrs: {
60530
60569
  ...carried,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.886",
3
+ "version": "2.0.2-dev.906",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {