@inerrata-corporation/errata 2.0.6-dev.1877 → 2.0.6-dev.1986

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.
@@ -15375,7 +15375,17 @@ var init_wire = __esm({
15375
15375
  extractedBy: external_exports.enum(INGEST_EXTRACTION_SOURCES).optional(),
15376
15376
  /** Triage route per-context counts (T3 induction). Carried as structured data
15377
15377
  * here; stored JSON-encoded on the Neo4j rel (`perContextJson`). */
15378
- perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional()
15378
+ perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional(),
15379
+ /** PJ-anchor-version: WHICH version of a symbol an `ANCHORED_AT` was
15380
+ * witnessed against. Both opaque — the observing checkout's HEAD sha and
15381
+ * the indexer's 16-hex sha256 of the symbol body. Neither is reversible
15382
+ * to code or names (a sha identifies a commit only to someone holding the
15383
+ * repo), so they add nothing to the §6c disclosure surface. A consumer
15384
+ * (reanchor) compares the hash with its local symbol's `bodyHash` to
15385
+ * classify the anchor current / pre-change; absent ⇒ the pre-versioning
15386
+ * contract, unverified. Only meaningful on `ANCHORED_AT`. */
15387
+ observedAtCommit: external_exports.string().regex(/^[0-9a-f]{7,40}$/).optional(),
15388
+ symbolContentHash: external_exports.string().regex(/^[0-9a-f]{8,64}$/).optional()
15379
15389
  }).optional()
15380
15390
  });
15381
15391
  SymbolSummarySidecarSchema = external_exports.record(
package/errata.mjs CHANGED
@@ -15818,7 +15818,17 @@ var init_wire = __esm({
15818
15818
  extractedBy: external_exports.enum(INGEST_EXTRACTION_SOURCES).optional(),
15819
15819
  /** Triage route per-context counts (T3 induction). Carried as structured data
15820
15820
  * here; stored JSON-encoded on the Neo4j rel (`perContextJson`). */
15821
- perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional()
15821
+ perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional(),
15822
+ /** PJ-anchor-version: WHICH version of a symbol an `ANCHORED_AT` was
15823
+ * witnessed against. Both opaque — the observing checkout's HEAD sha and
15824
+ * the indexer's 16-hex sha256 of the symbol body. Neither is reversible
15825
+ * to code or names (a sha identifies a commit only to someone holding the
15826
+ * repo), so they add nothing to the §6c disclosure surface. A consumer
15827
+ * (reanchor) compares the hash with its local symbol's `bodyHash` to
15828
+ * classify the anchor current / pre-change; absent ⇒ the pre-versioning
15829
+ * contract, unverified. Only meaningful on `ANCHORED_AT`. */
15830
+ observedAtCommit: external_exports.string().regex(/^[0-9a-f]{7,40}$/).optional(),
15831
+ symbolContentHash: external_exports.string().regex(/^[0-9a-f]{8,64}$/).optional()
15822
15832
  }).optional()
15823
15833
  });
15824
15834
  SymbolSummarySidecarSchema = external_exports.record(
@@ -19716,7 +19726,16 @@ function anchorProblemToWorkingFile(store, problemId, relPath, workspaceId2, ts,
19716
19726
  captureTime: true,
19717
19727
  anchorProvenance: provenance,
19718
19728
  anchorLine: opts.line,
19719
- enclosingSymbol: true
19729
+ enclosingSymbol: true,
19730
+ // PJ-anchor-version: WHICH version of the symbol this was witnessed
19731
+ // against. `bodyHash` is the indexer's 16-hex sha256 of the body;
19732
+ // `headSha` is the checkout's HEAD at capture. Both opaque, both
19733
+ // cross the membrane on the anchor edge, and a teammate's reanchor
19734
+ // compares the hash with their own symbol to tell "current" from
19735
+ // "pre-change" — the branch hazard where a fix witnessed on feat/x
19736
+ // would otherwise read as a fact about the unchanged symbol on dev.
19737
+ ...typeof sym.attrs["bodyHash"] === "string" ? { symbolContentHash: sym.attrs["bodyHash"] } : {},
19738
+ ...opts.headSha ? { observedAtCommit: opts.headSha } : {}
19720
19739
  }
19721
19740
  });
19722
19741
  }
@@ -19726,15 +19745,14 @@ function anchorProblemToWorkingFile(store, problemId, relPath, workspaceId2, ts,
19726
19745
  function resolveEnclosingSymbol(store, fileId, line, fileText) {
19727
19746
  if (!Number.isFinite(line) || line < 1) return null;
19728
19747
  const row = Math.floor(line) - 1;
19729
- const bytes = Buffer.from(fileText, "utf8");
19730
19748
  const lineStarts = [0];
19731
- for (let i2 = 0; i2 < bytes.length; i2++) if (bytes[i2] === 10) lineStarts.push(i2 + 1);
19732
- const rowOf = (byte) => {
19749
+ for (let i2 = 0; i2 < fileText.length; i2++) if (fileText.charCodeAt(i2) === 10) lineStarts.push(i2 + 1);
19750
+ const rowOf = (index) => {
19733
19751
  let lo = 0;
19734
19752
  let hi = lineStarts.length - 1;
19735
19753
  while (lo < hi) {
19736
19754
  const mid = lo + hi + 1 >> 1;
19737
- if (lineStarts[mid] <= byte) lo = mid;
19755
+ if (lineStarts[mid] <= index) lo = mid;
19738
19756
  else hi = mid - 1;
19739
19757
  }
19740
19758
  return lo;
@@ -19759,7 +19777,7 @@ function resolveEnclosingSymbol(store, fileId, line, fileText) {
19759
19777
  const endByte = n.attrs["endByte"];
19760
19778
  if (typeof startRow !== "number" || typeof startByte !== "number" || typeof endByte !== "number") continue;
19761
19779
  if (startRow < 0 || endByte < startByte) continue;
19762
- const endRow = rowOf(Math.max(startByte, Math.min(endByte, bytes.length) - 1));
19780
+ const endRow = rowOf(Math.max(startByte, Math.min(endByte, fileText.length) - 1));
19763
19781
  if (row < startRow || row > endRow) continue;
19764
19782
  const span = endByte - startByte;
19765
19783
  if (startRow > bestStart || startRow === bestStart && span < bestSpan) {
@@ -24269,7 +24287,9 @@ function toWirePayload(batch, runId) {
24269
24287
  type: e.type,
24270
24288
  attrs: {
24271
24289
  ...typeof e.confidence === "number" ? { confidence: clamp012(e.confidence) } : {},
24272
- ...perContext ? { perContext } : {}
24290
+ ...perContext ? { perContext } : {},
24291
+ // PJ-anchor-version: the two opaque version stamps ride on anchors only.
24292
+ ...e.type === "ANCHORED_AT" ? wireAnchorVersion(e.attrs) : {}
24273
24293
  }
24274
24294
  };
24275
24295
  });
@@ -24305,6 +24325,15 @@ function textOrThrow(value, field) {
24305
24325
  if (!text) throw new TypeError(`${field} must be a non-empty string`);
24306
24326
  return text;
24307
24327
  }
24328
+ function wireAnchorVersion(attrs) {
24329
+ if (!attrs) return {};
24330
+ const commit = attrs["observedAtCommit"];
24331
+ const hash2 = attrs["symbolContentHash"];
24332
+ return {
24333
+ ...typeof commit === "string" && HEX_SHA.test(commit) ? { observedAtCommit: commit } : {},
24334
+ ...typeof hash2 === "string" && HEX_BODY.test(hash2) ? { symbolContentHash: hash2 } : {}
24335
+ };
24336
+ }
24308
24337
  function optionalEdgeAttrs(confidence) {
24309
24338
  return typeof confidence === "number" ? { confidence: clamp012(confidence) } : void 0;
24310
24339
  }
@@ -24430,13 +24459,15 @@ function provenanceHeaders(provenance) {
24430
24459
  ...provenance.agentModel ? { "x-inerrata-agent-model": provenance.agentModel } : {}
24431
24460
  };
24432
24461
  }
24433
- var asWireCount, INGEST_NODE_CHUNK, E6B_PUBLIC_CONTEXT_SENTINEL, CloudClient, CloudError;
24462
+ var asWireCount, HEX_SHA, HEX_BODY, INGEST_NODE_CHUNK, E6B_PUBLIC_CONTEXT_SENTINEL, CloudClient, CloudError;
24434
24463
  var init_client = __esm({
24435
24464
  "../../packages/cloud-client/src/client.ts"() {
24436
24465
  "use strict";
24437
24466
  init_oauth();
24438
24467
  init_src();
24439
24468
  asWireCount = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : null;
24469
+ HEX_SHA = /^[0-9a-f]{7,40}$/;
24470
+ HEX_BODY = /^[0-9a-f]{8,64}$/;
24440
24471
  INGEST_NODE_CHUNK = 8;
24441
24472
  E6B_PUBLIC_CONTEXT_SENTINEL = "00000000-0000-4e6b-8000-000000000e6b";
24442
24473
  CloudClient = class {
@@ -57935,7 +57966,7 @@ function createWatchBreaker(deps) {
57935
57966
  }
57936
57967
 
57937
57968
  // src/engine.ts
57938
- var DAEMON_VERSION = true ? "2.0.6-dev.1877" : "2.0.0-alpha.0";
57969
+ var DAEMON_VERSION = true ? "2.0.6-dev.1986" : "2.0.0-alpha.0";
57939
57970
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
57940
57971
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
57941
57972
  var GIT_OP_MUTE_MS = 4e3;
@@ -59090,7 +59121,12 @@ function createWorkspaceEngine(opts) {
59090
59121
  let enclosing = {};
59091
59122
  if (p.location?.line !== void 0) {
59092
59123
  try {
59093
- enclosing = { line: p.location.line, fileText: readFileSync24(join29(opts.workspaceRoot, anchorPath), "utf8") };
59124
+ const headSha = readGitRefState(join29(opts.workspaceRoot, ".git")).sha ?? void 0;
59125
+ enclosing = {
59126
+ line: p.location.line,
59127
+ fileText: readFileSync24(join29(opts.workspaceRoot, anchorPath), "utf8"),
59128
+ ...headSha ? { headSha } : {}
59129
+ };
59094
59130
  } catch {
59095
59131
  enclosing = {};
59096
59132
  }
@@ -60654,6 +60690,15 @@ function contributedWireId(n) {
60654
60690
  }
60655
60691
  var WIRE_CANONICAL_ID_MIN = 6;
60656
60692
  var SHIP_TERMINAL_REFUSALS = 3;
60693
+ function anchorVersionAttrs(attrs) {
60694
+ if (!attrs) return {};
60695
+ const commit = attrs["observedAtCommit"];
60696
+ const hash2 = attrs["symbolContentHash"];
60697
+ return {
60698
+ ...typeof commit === "string" && /^[0-9a-f]{7,40}$/.test(commit) ? { observedAtCommit: commit } : {},
60699
+ ...typeof hash2 === "string" && /^[0-9a-f]{8,64}$/.test(hash2) ? { symbolContentHash: hash2 } : {}
60700
+ };
60701
+ }
60657
60702
  function refusalFingerprint(reason, description) {
60658
60703
  return digest(`${reason}\0${description}`);
60659
60704
  }
@@ -60936,7 +60981,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
60936
60981
  stability: "unstable"
60937
60982
  });
60938
60983
  }
60939
- anchorEdges.push({ ...e, from: wireFrom, to: symId, attrs: {} });
60984
+ anchorEdges.push({ ...e, from: wireFrom, to: symId, attrs: anchorVersionAttrs(e.attrs) });
60940
60985
  }
60941
60986
  }
60942
60987
  }
@@ -61418,6 +61463,12 @@ var ANCHOR_SYMBOL_KINDS = [
61418
61463
  "Namespace",
61419
61464
  "Property"
61420
61465
  ];
61466
+ function classifyAnchorVersion(cloudAttrs, localSymbol) {
61467
+ const seen = cloudAttrs["symbolContentHash"];
61468
+ const have = localSymbol?.attrs["bodyHash"];
61469
+ if (typeof seen !== "string" || typeof have !== "string") return "unverified";
61470
+ return seen === have ? "current" : "pre-change";
61471
+ }
61421
61472
  function buildReverseSymbolMap(opts) {
61422
61473
  const { store, salt, projectId } = opts;
61423
61474
  const reverse = /* @__PURE__ */ new Map();
@@ -61470,7 +61521,7 @@ async function reanchorProject(opts) {
61470
61521
  // Tagged `source: 'cloud'` (C7 — never re-shipped outward). GUARDRAIL 2 holds
61471
61522
  // by construction: we merge the EDGE onto the LOCAL node id, never the `sym_`
61472
61523
  // Symbol node — that stayed a translation key and never enters the store.
61473
- attrs: { ...a.attrs, source: "cloud" }
61524
+ attrs: { ...a.attrs, source: "cloud", anchorState: classifyAnchorVersion(a.attrs, store.getNode(localTo)) }
61474
61525
  };
61475
61526
  store.mergeEdge(edge2);
61476
61527
  anchors++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.6-dev.1877",
3
+ "version": "2.0.6-dev.1986",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -15248,7 +15248,17 @@ var init_wire = __esm({
15248
15248
  extractedBy: external_exports.enum(INGEST_EXTRACTION_SOURCES).optional(),
15249
15249
  /** Triage route per-context counts (T3 induction). Carried as structured data
15250
15250
  * here; stored JSON-encoded on the Neo4j rel (`perContextJson`). */
15251
- perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional()
15251
+ perContext: external_exports.record(external_exports.string(), RouteContextCountWireSchema).optional(),
15252
+ /** PJ-anchor-version: WHICH version of a symbol an `ANCHORED_AT` was
15253
+ * witnessed against. Both opaque — the observing checkout's HEAD sha and
15254
+ * the indexer's 16-hex sha256 of the symbol body. Neither is reversible
15255
+ * to code or names (a sha identifies a commit only to someone holding the
15256
+ * repo), so they add nothing to the §6c disclosure surface. A consumer
15257
+ * (reanchor) compares the hash with its local symbol's `bodyHash` to
15258
+ * classify the anchor current / pre-change; absent ⇒ the pre-versioning
15259
+ * contract, unverified. Only meaningful on `ANCHORED_AT`. */
15260
+ observedAtCommit: external_exports.string().regex(/^[0-9a-f]{7,40}$/).optional(),
15261
+ symbolContentHash: external_exports.string().regex(/^[0-9a-f]{8,64}$/).optional()
15252
15262
  }).optional()
15253
15263
  });
15254
15264
  SymbolSummarySidecarSchema = external_exports.record(