@inerrata-corporation/errata 2.0.2-dev.1166 → 2.0.2-dev.1172

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 +66 -4
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -22357,6 +22357,24 @@ var init_mechanism_liveness = __esm({
22357
22357
  STALL_MIN_RUNS = 3;
22358
22358
  STALL_MIN_SPAN_MS = 60 * 60 * 1e3;
22359
22359
  MECHANISMS = [
22360
+ {
22361
+ id: "refute-local-stamp",
22362
+ what: "stamps a harvested refute witness onto the LOCAL node (refutedAt/refutations/reason)",
22363
+ // Stamped at harvest, so the capture pass carries the effect counter.
22364
+ pass: "capture",
22365
+ // Refutes are rare by design (a verdict, not a lean-on) — the bar is "the
22366
+ // field is written at all", the revisitAnsweredWhen precedent. RG-mark
22367
+ // ships the producer; RG-recall is the ranking consumer — until it lands,
22368
+ // THIS descriptor is the consumer, which is exactly the condition the
22369
+ // probe exists to keep visible rather than let rot silently.
22370
+ fed: {
22371
+ labels: ["Problem", "Solution", "RootCause", "Pattern"],
22372
+ attr: "refutedAt",
22373
+ minFraction: 0
22374
+ },
22375
+ effectCounter: "refutesStamped",
22376
+ note: "RG-mark; reason text is local-only (wire ships nodeId+witnessKey)"
22377
+ },
22360
22378
  {
22361
22379
  id: "fix-candidate-ask",
22362
22380
  what: "asks an agent whether an edit to a problem's anchor fixed it",
@@ -53880,6 +53898,43 @@ function typePriorEdge(sourceLabel, targetLabel2, sentence = "") {
53880
53898
  }
53881
53899
  return "RELATES_TO";
53882
53900
  }
53901
+ function refuteReason(statement) {
53902
+ const s = (statement ?? "").trim();
53903
+ return s.length > 0 ? s.slice(0, 240) : void 0;
53904
+ }
53905
+ function wireWitnessItems(items) {
53906
+ return items.map(({ nodeId, witnessKey }) => ({ nodeId, witnessKey }));
53907
+ }
53908
+ var REFUTE_REASONS_CAP = 5;
53909
+ var REFUTE_WITNESS_KEYS_CAP = 16;
53910
+ function applyLocalRefutations(store, refutes, ts) {
53911
+ const out2 = { stamped: 0, duplicate: 0, unknownNode: 0 };
53912
+ for (const r of refutes) {
53913
+ const node2 = store.getNode(r.nodeId);
53914
+ if (!node2) {
53915
+ out2.unknownNode++;
53916
+ continue;
53917
+ }
53918
+ const keys = node2.attrs["refuteWitnessKeys"] ?? [];
53919
+ if (keys.includes(r.witnessKey)) {
53920
+ out2.duplicate++;
53921
+ continue;
53922
+ }
53923
+ const reasons = node2.attrs["refuteReasons"] ?? [];
53924
+ store.updateNode(r.nodeId, {
53925
+ attrs: {
53926
+ ...node2.attrs,
53927
+ refutedAt: ts,
53928
+ refutations: (Number(node2.attrs["refutations"]) || 0) + 1,
53929
+ ...r.reason ? { refuteReasons: [r.reason, ...reasons].slice(0, REFUTE_REASONS_CAP) } : {},
53930
+ refuteWitnessKeys: [...keys, r.witnessKey].slice(-REFUTE_WITNESS_KEYS_CAP)
53931
+ },
53932
+ lastUpdatedAt: ts
53933
+ });
53934
+ out2.stamped++;
53935
+ }
53936
+ return out2;
53937
+ }
53883
53938
  var PRIOR_TAG_INSTRUCTION = buildAgentInstruction();
53884
53939
  function isEdgeElicitationEnabled() {
53885
53940
  return (process.env["EDGE_ELICITATION_ENABLED"] ?? "true").toLowerCase() !== "false";
@@ -54140,7 +54195,8 @@ function harvestInlineTags(store, text, opts) {
54140
54195
  if (nodeId) {
54141
54196
  const witnessKey = `refute:${nodeId}:${digest({ s: tag.statement ?? "" })}`.slice(0, 72);
54142
54197
  if (!plan.refutes.some((r) => r.witnessKey === witnessKey)) {
54143
- plan.refutes.push({ nodeId, witnessKey });
54198
+ const reason = refuteReason(tag.statement);
54199
+ plan.refutes.push({ nodeId, witnessKey, ...reason ? { reason } : {} });
54144
54200
  }
54145
54201
  }
54146
54202
  }
@@ -54175,7 +54231,8 @@ function harvestInlineTags(store, text, opts) {
54175
54231
  } else {
54176
54232
  const witnessKey = `refute:${targetId}:${digest({ s: tag.statement ?? "" })}`.slice(0, 72);
54177
54233
  if (!plan.refutes.some((r) => r.witnessKey === witnessKey)) {
54178
- plan.refutes.push({ nodeId: targetId, witnessKey });
54234
+ const reason = refuteReason(tag.statement);
54235
+ plan.refutes.push({ nodeId: targetId, witnessKey, ...reason ? { reason } : {} });
54179
54236
  }
54180
54237
  }
54181
54238
  }
@@ -56761,7 +56818,7 @@ function createWatchBreaker(deps) {
56761
56818
  }
56762
56819
 
56763
56820
  // src/engine.ts
56764
- var DAEMON_VERSION = true ? "2.0.2-dev.1166" : "2.0.0-alpha.0";
56821
+ var DAEMON_VERSION = true ? "2.0.2-dev.1172" : "2.0.0-alpha.0";
56765
56822
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
56766
56823
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
56767
56824
  var GIT_OP_MUTE_MS = 4e3;
@@ -57596,6 +57653,7 @@ function createWorkspaceEngine(opts) {
57596
57653
  let exposureEvicted = 0;
57597
57654
  let exposureUnshown = 0;
57598
57655
  let corroboratedEdges = 0;
57656
+ let refutesStamped = 0;
57599
57657
  const dispositions = emptyTagDispositions();
57600
57658
  let unresolvedHandles = 0;
57601
57659
  let priorEdgesFlagOff = 0;
@@ -57737,6 +57795,7 @@ function createWorkspaceEngine(opts) {
57737
57795
  });
57738
57796
  priorEdges += plan.priorEdges;
57739
57797
  corroboratedEdges += plan.corroboratedEdges;
57798
+ refutesStamped += applyLocalRefutations(store, plan.refutes, t).stamped;
57740
57799
  addTagDispositions(dispositions, plan.dispositions);
57741
57800
  unresolvedHandles += plan.unresolvedHandles.length;
57742
57801
  priorEdgesFlagOff += plan.priorEdgesSuppressed.flagOff;
@@ -58112,7 +58171,7 @@ function createWorkspaceEngine(opts) {
58112
58171
  if (typeof cloud.reportContradictions === "function") {
58113
58172
  await sendWitnesses(
58114
58173
  "contradict",
58115
- plan.refutes,
58174
+ wireWitnessItems(plan.refutes),
58116
58175
  (items2, session) => cloud.reportContradictions({
58117
58176
  daemonVersion: DAEMON_VERSION,
58118
58177
  projectId: profile.id,
@@ -58180,6 +58239,9 @@ function createWorkspaceEngine(opts) {
58180
58239
  triaged,
58181
58240
  priorEdges,
58182
58241
  corroboratedEdges,
58242
+ // RG-mark: refute witnesses stamped onto local nodes (the local half of
58243
+ // the contradict channel; the wire half rides the witness ledger).
58244
+ refutesStamped,
58183
58245
  // WM-labels calibration cells (see prior-tags exposure split).
58184
58246
  exposureShown,
58185
58247
  exposureEvicted,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.1166",
3
+ "version": "2.0.2-dev.1172",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {