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

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.
@@ -15169,6 +15169,12 @@ var init_wire = __esm({
15169
15169
  /** Client-supplied UUID — one batch; pairs with the payload digest for replay. */
15170
15170
  runId: external_exports.string().uuid(),
15171
15171
  source: external_exports.enum(INGEST_SOURCES),
15172
+ /** The contributing project (origin key = project; the salted `wp_…` the
15173
+ * daemon already sends as telemetry workspaceId). Stamped onto created nodes
15174
+ * as `authoringProject` so the refute channel's cross-origin gate can tell a
15175
+ * self-refute from an independent one. Optional + additive — absent is
15176
+ * exactly today's wire (and leaves the gate fail-open for that node). */
15177
+ originProject: external_exports.string().min(1).max(120).optional(),
15172
15178
  nodes: external_exports.array(CastaliaIngestNodeSchema).max(1e3),
15173
15179
  edges: external_exports.array(CastaliaIngestEdgeSchema).max(5e3),
15174
15180
  /** Optional symbol→intent-summary sidecar (PP-symbol-intent). Only symbols
package/errata.mjs CHANGED
@@ -15472,6 +15472,12 @@ var init_wire = __esm({
15472
15472
  /** Client-supplied UUID — one batch; pairs with the payload digest for replay. */
15473
15473
  runId: external_exports.string().uuid(),
15474
15474
  source: external_exports.enum(INGEST_SOURCES),
15475
+ /** The contributing project (origin key = project; the salted `wp_…` the
15476
+ * daemon already sends as telemetry workspaceId). Stamped onto created nodes
15477
+ * as `authoringProject` so the refute channel's cross-origin gate can tell a
15478
+ * self-refute from an independent one. Optional + additive — absent is
15479
+ * exactly today's wire (and leaves the gate fail-open for that node). */
15480
+ originProject: external_exports.string().min(1).max(120).optional(),
15475
15481
  nodes: external_exports.array(CastaliaIngestNodeSchema).max(1e3),
15476
15482
  edges: external_exports.array(CastaliaIngestEdgeSchema).max(5e3),
15477
15483
  /** Optional symbol→intent-summary sidecar (PP-symbol-intent). Only symbols
@@ -20725,7 +20731,16 @@ function toWirePayload(batch, runId) {
20725
20731
  };
20726
20732
  });
20727
20733
  const symbolSummaries = sidecarForNodes(batch.symbolSummaries, nodes);
20728
- return { runId, source: "daemon", nodes, edges, ...symbolSummaries ? { symbolSummaries } : {} };
20734
+ return {
20735
+ runId,
20736
+ source: "daemon",
20737
+ // Origin key (= project) for the refute channel's cross-origin gate; absent
20738
+ // for id-less batches (principle sync) → those nodes stay fail-open.
20739
+ ...batch.originProject ? { originProject: batch.originProject } : {},
20740
+ nodes,
20741
+ edges,
20742
+ ...symbolSummaries ? { symbolSummaries } : {}
20743
+ };
20729
20744
  }
20730
20745
  function clamp012(x) {
20731
20746
  return Math.max(0, Math.min(1, x));
@@ -21200,6 +21215,18 @@ var init_client = __esm({
21200
21215
  async sendFeedback(payload) {
21201
21216
  return this.json("POST", "/v2/feedback", payload);
21202
21217
  }
21218
+ /** Transport `(failed:[handle])` refutes to the cloud's contradictionPressure.
21219
+ * Metadata-only (node ids + witness keys); the cloud gates each on cross-origin
21220
+ * independence (this project vs the refuted node's author). Best-effort. */
21221
+ async reportContradictions(payload) {
21222
+ return this.json("POST", "/v2/contradict", payload);
21223
+ }
21224
+ /** Transport corroborations (an agent leaned on / resolved a shown prior) to
21225
+ * the cloud's corroborationCount (§5.4). Cross-origin gated (this project vs
21226
+ * the node's author — no self-corroboration). Best-effort. */
21227
+ async reportCorroborations(payload) {
21228
+ return this.json("POST", "/v2/corroborate", payload);
21229
+ }
21203
21230
  async pushPrinciples(payload) {
21204
21231
  return this.json("POST", "/v2/private/principles", payload);
21205
21232
  }
@@ -41052,10 +41079,23 @@ function parseInlineTags(text) {
41052
41079
  const raw3 = a[3].replace(/\s+/g, " ").trim();
41053
41080
  if (raw3.length >= CONSTRAINT_MIN) {
41054
41081
  const statement = raw3.length > FLAG_MAX ? `${raw3.slice(0, FLAG_MAX - 1).trimEnd()}\u2026` : raw3;
41082
+ const isFailure = a[1].toLowerCase() === "failed";
41083
+ let refuteHandles;
41084
+ if (isFailure) {
41085
+ HANDLE_RE.lastIndex = 0;
41086
+ const hs = [];
41087
+ let hm;
41088
+ while ((hm = HANDLE_RE.exec(statement)) !== null) {
41089
+ const h = hm[1] ?? hm[2];
41090
+ if (h && !hs.includes(h)) hs.push(h);
41091
+ }
41092
+ if (hs.length) refuteHandles = hs;
41093
+ }
41055
41094
  out2.push({
41056
- kind: a[1].toLowerCase() === "tried" ? "attempt" : "failure",
41095
+ kind: isFailure ? "failure" : "attempt",
41057
41096
  statement,
41058
41097
  ...a[2] ? { threadId: a[2] } : {},
41098
+ ...refuteHandles ? { refuteHandles } : {},
41059
41099
  sentence: sfield
41060
41100
  });
41061
41101
  }
@@ -41197,7 +41237,7 @@ function harvestInlineTags(store, text, opts) {
41197
41237
  const source = opts.sourceId ? store.getNode(opts.sourceId) : null;
41198
41238
  const mintPriors = opts.mintPriors ?? true;
41199
41239
  const touched = opts.sessionTouchedIds ?? /* @__PURE__ */ new Set();
41200
- const plan = { priorEdges: 0, problems: [], fixes: [], triages: [], attempts: [], unresolvedFixes: [], transfers: [], instances: [], patterns: [] };
41240
+ const plan = { priorEdges: 0, problems: [], fixes: [], triages: [], attempts: [], unresolvedFixes: [], transfers: [], instances: [], patterns: [], refutes: [], corroborations: [] };
41201
41241
  const tags = parseInlineTags(text);
41202
41242
  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
41243
  const bindSymptom = (seq, threadId) => {
@@ -41233,8 +41273,13 @@ function harvestInlineTags(store, text, opts) {
41233
41273
  } else if (tag.kind === "fix") {
41234
41274
  if (tag.handle) {
41235
41275
  const problemId = resolveHandle(store, tag.handle, opts.handleMap);
41236
- if (problemId) plan.fixes.push({ problemId, ...tag.fixRationale ? { fixNote: tag.fixRationale } : {} });
41237
- else plan.unresolvedFixes.push({ handle: tag.handle, ...tag.fixRationale ? { fixNote: tag.fixRationale } : {} });
41276
+ if (problemId) {
41277
+ plan.fixes.push({ problemId, ...tag.fixRationale ? { fixNote: tag.fixRationale } : {} });
41278
+ const witnessKey = `corrob:${problemId}:${digest({ h: tag.handle })}`.slice(0, 72);
41279
+ if (!plan.corroborations.some((c) => c.witnessKey === witnessKey)) {
41280
+ plan.corroborations.push({ nodeId: problemId, witnessKey });
41281
+ }
41282
+ } else plan.unresolvedFixes.push({ handle: tag.handle, ...tag.fixRationale ? { fixNote: tag.fixRationale } : {} });
41238
41283
  } else if (tag.fixRationale) {
41239
41284
  const b = bindSymptom(tag.seq, tag.threadId);
41240
41285
  if (b.problemId) {
@@ -41308,6 +41353,15 @@ function harvestInlineTags(store, text, opts) {
41308
41353
  plan.patterns.push({ patternText: tag.patternText, ...bound });
41309
41354
  }
41310
41355
  } else if (tag.kind === "attempt" || tag.kind === "failure") {
41356
+ for (const h of tag.refuteHandles ?? []) {
41357
+ const nodeId = resolveHandle(store, h, opts.handleMap);
41358
+ if (nodeId) {
41359
+ const witnessKey = `refute:${nodeId}:${digest({ s: tag.statement ?? "" })}`.slice(0, 72);
41360
+ if (!plan.refutes.some((r) => r.witnessKey === witnessKey)) {
41361
+ plan.refutes.push({ nodeId, witnessKey });
41362
+ }
41363
+ }
41364
+ }
41311
41365
  const b = bindSymptom(tag.seq, tag.threadId);
41312
41366
  const outcome = tag.kind === "attempt" ? "tried" : "failed";
41313
41367
  if (b.problemId) {
@@ -41662,6 +41716,8 @@ function buildClaimIngest(store, profile, daemonVersion, level = 1, ignorePatter
41662
41716
  const base = {
41663
41717
  daemonVersion,
41664
41718
  profile: { stack: profile.stack, languages: profile.languages, domains: profile.domains },
41719
+ // origin key (= project) for the refute channel's cross-origin gate.
41720
+ originProject: profile.id,
41665
41721
  nodes,
41666
41722
  edges: []
41667
41723
  };
@@ -41706,6 +41762,8 @@ function buildDesignProblemIngest(store, profile, daemonVersion, ignorePatterns
41706
41762
  const base = {
41707
41763
  daemonVersion,
41708
41764
  profile: { stack: profile.stack, languages: profile.languages, domains: profile.domains },
41765
+ // origin key (= project) for the refute channel's cross-origin gate.
41766
+ originProject: profile.id,
41709
41767
  nodes,
41710
41768
  edges
41711
41769
  };
@@ -42696,7 +42754,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42696
42754
  }
42697
42755
 
42698
42756
  // src/engine.ts
42699
- var DAEMON_VERSION = true ? "2.0.0-dev.49" : "2.0.0-alpha.0";
42757
+ var DAEMON_VERSION = true ? "2.0.0-dev.51" : "2.0.0-alpha.0";
42700
42758
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42701
42759
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42702
42760
  var GIT_OP_MUTE_MS = 4e3;
@@ -43503,6 +43561,20 @@ function createWorkspaceEngine(opts) {
43503
43561
  mintCiteEdge(solId, targetId, "MAY_RESOLVE", 0.3, { transfer: true, hypothesis: true });
43504
43562
  }
43505
43563
  }
43564
+ if (plan.refutes.length > 0 && typeof cloud.reportContradictions === "function") {
43565
+ void cloud.reportContradictions({ daemonVersion: DAEMON_VERSION, projectId: profile.id, items: plan.refutes }).then((r) => {
43566
+ if (r?.recorded) console.log(`[errata] refute: ${r.recorded} contradiction(s) recorded`);
43567
+ }).catch(
43568
+ (err2) => console.warn("[errata] refute transport failed (continuing):", err2 instanceof Error ? err2.message : err2)
43569
+ );
43570
+ }
43571
+ if (plan.corroborations.length > 0 && typeof cloud.reportCorroborations === "function") {
43572
+ void cloud.reportCorroborations({ daemonVersion: DAEMON_VERSION, projectId: profile.id, items: plan.corroborations }).then((r) => {
43573
+ if (r?.recorded) console.log(`[errata] corroborate: ${r.recorded} corroboration(s) recorded`);
43574
+ }).catch(
43575
+ (err2) => console.warn("[errata] corroboration transport failed (continuing):", err2 instanceof Error ? err2.message : err2)
43576
+ );
43577
+ }
43506
43578
  } catch (err2) {
43507
43579
  console.warn("[errata] inline-tag harvest failed:", err2);
43508
43580
  }
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.51",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15015,6 +15015,12 @@ var init_wire = __esm({
15015
15015
  /** Client-supplied UUID — one batch; pairs with the payload digest for replay. */
15016
15016
  runId: external_exports.string().uuid(),
15017
15017
  source: external_exports.enum(INGEST_SOURCES),
15018
+ /** The contributing project (origin key = project; the salted `wp_…` the
15019
+ * daemon already sends as telemetry workspaceId). Stamped onto created nodes
15020
+ * as `authoringProject` so the refute channel's cross-origin gate can tell a
15021
+ * self-refute from an independent one. Optional + additive — absent is
15022
+ * exactly today's wire (and leaves the gate fail-open for that node). */
15023
+ originProject: external_exports.string().min(1).max(120).optional(),
15018
15024
  nodes: external_exports.array(CastaliaIngestNodeSchema).max(1e3),
15019
15025
  edges: external_exports.array(CastaliaIngestEdgeSchema).max(5e3),
15020
15026
  /** Optional symbol→intent-summary sidecar (PP-symbol-intent). Only symbols