@inerrata-corporation/errata 2.0.0-dev.49 → 2.0.0-dev.50

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 +38 -3
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -21200,6 +21200,12 @@ var init_client = __esm({
21200
21200
  async sendFeedback(payload) {
21201
21201
  return this.json("POST", "/v2/feedback", payload);
21202
21202
  }
21203
+ /** Transport `(failed:[handle])` refutes to the cloud's contradictionPressure.
21204
+ * Metadata-only (node ids + witness keys); the cloud gates each on cross-origin
21205
+ * independence (this project vs the refuted node's author). Best-effort. */
21206
+ async reportContradictions(payload) {
21207
+ return this.json("POST", "/v2/contradict", payload);
21208
+ }
21203
21209
  async pushPrinciples(payload) {
21204
21210
  return this.json("POST", "/v2/private/principles", payload);
21205
21211
  }
@@ -41052,10 +41058,23 @@ function parseInlineTags(text) {
41052
41058
  const raw3 = a[3].replace(/\s+/g, " ").trim();
41053
41059
  if (raw3.length >= CONSTRAINT_MIN) {
41054
41060
  const statement = raw3.length > FLAG_MAX ? `${raw3.slice(0, FLAG_MAX - 1).trimEnd()}\u2026` : raw3;
41061
+ const isFailure = a[1].toLowerCase() === "failed";
41062
+ let refuteHandles;
41063
+ if (isFailure) {
41064
+ HANDLE_RE.lastIndex = 0;
41065
+ const hs = [];
41066
+ let hm;
41067
+ while ((hm = HANDLE_RE.exec(statement)) !== null) {
41068
+ const h = hm[1] ?? hm[2];
41069
+ if (h && !hs.includes(h)) hs.push(h);
41070
+ }
41071
+ if (hs.length) refuteHandles = hs;
41072
+ }
41055
41073
  out2.push({
41056
- kind: a[1].toLowerCase() === "tried" ? "attempt" : "failure",
41074
+ kind: isFailure ? "failure" : "attempt",
41057
41075
  statement,
41058
41076
  ...a[2] ? { threadId: a[2] } : {},
41077
+ ...refuteHandles ? { refuteHandles } : {},
41059
41078
  sentence: sfield
41060
41079
  });
41061
41080
  }
@@ -41197,7 +41216,7 @@ function harvestInlineTags(store, text, opts) {
41197
41216
  const source = opts.sourceId ? store.getNode(opts.sourceId) : null;
41198
41217
  const mintPriors = opts.mintPriors ?? true;
41199
41218
  const touched = opts.sessionTouchedIds ?? /* @__PURE__ */ new Set();
41200
- const plan = { priorEdges: 0, problems: [], fixes: [], triages: [], attempts: [], unresolvedFixes: [], transfers: [], instances: [], patterns: [] };
41219
+ const plan = { priorEdges: 0, problems: [], fixes: [], triages: [], attempts: [], unresolvedFixes: [], transfers: [], instances: [], patterns: [], refutes: [] };
41201
41220
  const tags = parseInlineTags(text);
41202
41221
  const symptomSeqs = tags.filter((t) => (t.kind === "problem" || t.kind === "todo" || t.kind === "constraint") && t.statement).map((t) => ({ seq: t.seq ?? -1, statement: t.statement, threadId: t.threadId })).sort((a, b) => a.seq - b.seq);
41203
41222
  const bindSymptom = (seq, threadId) => {
@@ -41308,6 +41327,15 @@ function harvestInlineTags(store, text, opts) {
41308
41327
  plan.patterns.push({ patternText: tag.patternText, ...bound });
41309
41328
  }
41310
41329
  } else if (tag.kind === "attempt" || tag.kind === "failure") {
41330
+ for (const h of tag.refuteHandles ?? []) {
41331
+ const nodeId = resolveHandle(store, h, opts.handleMap);
41332
+ if (nodeId) {
41333
+ const witnessKey = `refute:${nodeId}:${digest({ s: tag.statement ?? "" })}`.slice(0, 72);
41334
+ if (!plan.refutes.some((r) => r.witnessKey === witnessKey)) {
41335
+ plan.refutes.push({ nodeId, witnessKey });
41336
+ }
41337
+ }
41338
+ }
41311
41339
  const b = bindSymptom(tag.seq, tag.threadId);
41312
41340
  const outcome = tag.kind === "attempt" ? "tried" : "failed";
41313
41341
  if (b.problemId) {
@@ -42696,7 +42724,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42696
42724
  }
42697
42725
 
42698
42726
  // src/engine.ts
42699
- var DAEMON_VERSION = true ? "2.0.0-dev.49" : "2.0.0-alpha.0";
42727
+ var DAEMON_VERSION = true ? "2.0.0-dev.50" : "2.0.0-alpha.0";
42700
42728
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42701
42729
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42702
42730
  var GIT_OP_MUTE_MS = 4e3;
@@ -43503,6 +43531,13 @@ function createWorkspaceEngine(opts) {
43503
43531
  mintCiteEdge(solId, targetId, "MAY_RESOLVE", 0.3, { transfer: true, hypothesis: true });
43504
43532
  }
43505
43533
  }
43534
+ if (plan.refutes.length > 0 && typeof cloud.reportContradictions === "function") {
43535
+ void cloud.reportContradictions({ daemonVersion: DAEMON_VERSION, projectId: profile.id, items: plan.refutes }).then((r) => {
43536
+ if (r?.recorded) console.log(`[errata] refute: ${r.recorded} contradiction(s) recorded`);
43537
+ }).catch(
43538
+ (err2) => console.warn("[errata] refute transport failed (continuing):", err2 instanceof Error ? err2.message : err2)
43539
+ );
43540
+ }
43506
43541
  } catch (err2) {
43507
43542
  console.warn("[errata] inline-tag harvest failed:", err2);
43508
43543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.0-dev.49",
3
+ "version": "2.0.0-dev.50",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {