@inerrata-corporation/errata 2.0.21-dev.3931 → 2.0.21-dev.3946

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.
package/errata.mjs CHANGED
@@ -77882,11 +77882,27 @@ var CONFIRM_PREFIX = /^\s*confirm:\s*/i;
77882
77882
  var REFUTE_PREFIX = /^\s*refute:\s*/i;
77883
77883
  var REFUTE_REASON_MIN = 4;
77884
77884
  var PATTERN_RE = /\(\s*pattern:\s*([^()\n]{3,}?)\s*\)/gi;
77885
- var DOMAIN_RE = /\(\s*domain:\s*([^()\n]{3,}?)\s*\)/gi;
77885
+ var DOMAIN_RE = /\(\s*domain:\s*([^()\n]{2,}?)\s*\)/gi;
77886
77886
  var PACKAGE_RE = /\(\s*package:\s*([^()\n]{2,}?)\s*\)/gi;
77887
77887
  var COMPONENT_RE = /\(\s*component:\s*([^()\n]{2,}?)\s*\)/gi;
77888
77888
  var CAUSE_TEXT_MIN = 8;
77889
- var FLAG_RE = /\[([!?])(?:#([a-z][\w-]{0,63})\s+)?\s*((?:\[[^\]\n]*\]|[^\]\n])*?)\s*(?:@\s*([^\s\]]+?)(?::(\d+))?\s*)?\]/g;
77889
+ var FLAG_RE = /\[([!?])(?:#([a-z][\w-]{0,63})\s+)?\s*((?:\[[^[\]\n]*\]|[^\]\n])*?)\s*(?:@\s*([^\s\]]+?)(?::(\d+))?\s*)?\]/dg;
77890
+ function flagScanView(source) {
77891
+ const text = source.replace(/`[^`\n]*`/g, (m) => m.replace(/[[\]]/g, " "));
77892
+ let out2 = "";
77893
+ let from = 0;
77894
+ for (; ; ) {
77895
+ const nl = text.indexOf("\n", from);
77896
+ const end = nl < 0 ? text.length : nl;
77897
+ const close = text.lastIndexOf("]", end - 1);
77898
+ const keep = close >= from ? close + 1 : from;
77899
+ out2 += text.slice(from, keep) + " ".repeat(end - keep);
77900
+ if (nl < 0) return out2;
77901
+ out2 += "\n";
77902
+ from = nl + 1;
77903
+ }
77904
+ }
77905
+ var MARKDOWN_LINK_RE = /\[([^[\]\n]+)\]\(([^()\s[\]]*[./][^()\s[\]]*)\)/g;
77890
77906
  var CONSTRAINT_MIN = 8;
77891
77907
  function clauseBefore(sentence, idx) {
77892
77908
  const win = sentence.slice(Math.max(0, idx - 80), idx);
@@ -77906,13 +77922,15 @@ var SIBLING_MARKUP_SOURCES = [
77906
77922
  CONSTRAINT_RE
77907
77923
  ].map((re) => ({ source: re.source, flags: re.flags.includes("g") ? re.flags : `${re.flags}g` }));
77908
77924
  function maskSiblingMarkup(sentence, tagStart, tagEnd) {
77909
- let masked = sentence;
77925
+ let masked = sentence.replace(MARKDOWN_LINK_RE, (m, label, _target, at) => at <= tagStart && at + m.length >= tagEnd ? m : ` ${label}${" ".repeat(m.length - label.length - 1)}`);
77910
77926
  for (const { source, flags: flags2 } of SIBLING_MARKUP_SOURCES) {
77911
- masked = masked.replace(new RegExp(source, flags2), (m, ...rest2) => {
77912
- const at = rest2.find((v) => typeof v === "number");
77913
- if (at <= tagStart && at + m.length >= tagEnd) return m;
77914
- return " ".repeat(m.length);
77915
- });
77927
+ const view = source === FLAG_RE.source ? flagScanView(masked) : masked;
77928
+ const spans = [];
77929
+ for (const m of view.matchAll(new RegExp(source, flags2))) {
77930
+ const at = m.index;
77931
+ if (!(at <= tagStart && at + m[0].length >= tagEnd)) spans.push([at, at + m[0].length]);
77932
+ }
77933
+ for (const [from, to] of spans) masked = masked.slice(0, from) + " ".repeat(to - from) + masked.slice(to);
77916
77934
  }
77917
77935
  return masked;
77918
77936
  }
@@ -77928,7 +77946,7 @@ function fixRationaleBefore(sentence, idx) {
77928
77946
  start2 = ws < 0 ? idx : start2 + ws;
77929
77947
  }
77930
77948
  const win = masked.slice(start2, idx).replace(/\s+$/, "").replace(/[.!?]$/, "");
77931
- const scan2 = win.replace(/`[^`]*`/g, (s) => s.replace(/[.;!?—]/g, "_"));
77949
+ const scan2 = win.replace(/`[^`]*`/g, (s) => s.replace(/[.;!?—]/g, "_")).replace(/\.(?=[\w/])/g, "_");
77932
77950
  const m = /[.;!?—][^.;!?—]*$/.exec(scan2);
77933
77951
  const clause = (m ? win.slice(m.index + 1) : win).replace(/\*\*|__/g, "").replace(/^\s*(?:[-*+]|\d+[.)])\s+/, "").replace(/\s+([:;,])/g, "$1").replace(/\s+/g, " ").trim();
77934
77952
  if (clause.endsWith(":")) return "";
@@ -77946,7 +77964,7 @@ function fixRationaleAfter(sentence, endIdx) {
77946
77964
  const residual = RESIDUAL_OPENER_RE.exec(win);
77947
77965
  if (residual) win = win.slice(0, residual.index);
77948
77966
  const stripped = win.replace(/^[\s—:–,-]+/, "");
77949
- const m = /^[^.;!?—]*/.exec(stripped);
77967
+ const m = /^(?:[^.;!?]|\.(?=[\w/]))*/.exec(stripped);
77950
77968
  const clause = (m ? m[0] : stripped).replace(/\s+/g, " ").trim();
77951
77969
  if (/^(and|but|or|nor|so|yet|also|plus)\b/i.test(clause)) return "";
77952
77970
  return clause;
@@ -78042,6 +78060,17 @@ function emptyTagDispositions() {
78042
78060
  flagAsHandle: 0
78043
78061
  };
78044
78062
  }
78063
+ function splitJoinedCause(content, sentence, threadId, dispositions, out2) {
78064
+ const joined = /[,;]\s*cause:\s*/i.exec(content);
78065
+ if (!joined) return content;
78066
+ const causeBody = content.slice(joined.index + joined[0].length);
78067
+ const fix = content.slice(0, joined.index);
78068
+ const fixed = new RegExp(HANDLE_RE.source, "i").exec(fix);
78069
+ const symptom = fixed && !/^\s*\[/.test(causeBody) ? `${fixed[0]} ` : "";
78070
+ const cause = parseCauseTag(`${symptom}${causeBody}`, sentence, threadId, dispositions);
78071
+ if (cause) out2.push(cause);
78072
+ return fix;
78073
+ }
78045
78074
  function parseCauseTag(content, sentence, threadId, dispositions) {
78046
78075
  const body2 = content.replace(/\s+/g, " ").trim();
78047
78076
  const cited = new RegExp(HANDLE_RE.source, "i").exec(body2);
@@ -78089,7 +78118,7 @@ function* captureSentences(text) {
78089
78118
  yield line;
78090
78119
  continue;
78091
78120
  }
78092
- const flags2 = [...line.matchAll(new RegExp(FLAG_RE.source, FLAG_RE.flags))].map((m) => ({ start: m.index, end: m.index + m[0].length }));
78121
+ const flags2 = [...flagScanView(line).matchAll(new RegExp(FLAG_RE.source, FLAG_RE.flags))].map((m) => ({ start: m.index, end: m.index + m[0].length }));
78093
78122
  let flag = 0;
78094
78123
  let start2 = 0;
78095
78124
  for (const boundary of line.matchAll(/(?<=[.!?])\s+(?!\(fix:)/g)) {
@@ -78116,17 +78145,23 @@ function parseInlineTagsWithDispositions(text) {
78116
78145
  const seqStart = out2.length;
78117
78146
  const sentence = raw2.replace(/`[^`]*`/g, (m) => {
78118
78147
  if (!/\[[!?]|\((?:fix|cause|constraint|tried|failed|confirm|refute):|\(\[/.test(m)) return m;
78148
+ if (!/\((?:fix|cause|constraint|tried|failed|confirm|refute):|\(\[/.test(m)) {
78149
+ dispositions.codeSpanNeutralized++;
78150
+ return m;
78151
+ }
78119
78152
  dispositions.codeSpanNeutralized++;
78120
78153
  return " ";
78121
78154
  });
78122
78155
  const sfield = sentence.replace(/\s+/g, " ").trim().slice(0, 160);
78123
78156
  const citeMatched = /* @__PURE__ */ new Set();
78157
+ const flagSpans = [...flagScanView(sentence).matchAll(new RegExp(FLAG_RE.source, FLAG_RE.flags))].map((m) => [m.index, m.index + m[0].length]);
78124
78158
  CITE_GROUP_RE.lastIndex = 0;
78125
78159
  let g;
78126
78160
  while ((g = CITE_GROUP_RE.exec(sentence)) !== null) {
78127
78161
  citeMatched.add(g.index);
78128
78162
  let content = g[1];
78129
78163
  if (/^\s*pattern:/i.test(content)) continue;
78164
+ if (/^\s*failed:/i.test(content)) continue;
78130
78165
  const fixM = FIX_PREFIX.exec(content);
78131
78166
  const causeM = fixM ? null : CAUSE_PREFIX.exec(content);
78132
78167
  const aidsM = fixM || causeM ? null : AIDS_PREFIX.exec(content);
@@ -78189,6 +78224,7 @@ function parseInlineTagsWithDispositions(text) {
78189
78224
  const verbThread = fixM?.[1] ?? causeM?.[1] ?? void 0;
78190
78225
  if (isFix) content = content.replace(FIX_PREFIX, "");
78191
78226
  else if (isCause) content = content.replace(CAUSE_PREFIX, "");
78227
+ if (isFix) content = splitJoinedCause(content, sfield, verbThread, dispositions, out2);
78192
78228
  if (isCause) {
78193
78229
  const cause = parseCauseTag(content, sfield, verbThread, dispositions);
78194
78230
  if (cause) out2.push(cause);
@@ -78227,6 +78263,8 @@ function parseInlineTagsWithDispositions(text) {
78227
78263
  const note = content.replace(/\s+/g, " ").trim();
78228
78264
  if (note.length >= FIX_RATIONALE_MIN)
78229
78265
  out2.push({ kind: "fix", fixRationale: note, sentence: sfield, ...verbThread ? { threadId: verbThread } : {} });
78266
+ else if (verbThread && fixRationale && !flagSpans.some(([a2, b]) => a2 < g.index && g.index < b))
78267
+ out2.push({ kind: "fix", fixRationale, sentence: sfield, threadId: verbThread });
78230
78268
  else dispositions.unparseable++;
78231
78269
  } else if (!isFix && !emittedHandle && BRACKETED_TOKEN_RE.test(content)) {
78232
78270
  dispositions.unparseable++;
@@ -78241,12 +78279,12 @@ function parseInlineTagsWithDispositions(text) {
78241
78279
  while ((lm = pass.re.exec(sentence)) !== null) {
78242
78280
  if (citeMatched.has(lm.index)) continue;
78243
78281
  const verbThread = lm[1] ?? void 0;
78244
- const content = lm[2];
78245
78282
  if (!pass.isFix) {
78246
- const cause = parseCauseTag(content, sfield, verbThread, dispositions);
78283
+ const cause = parseCauseTag(lm[2], sfield, verbThread, dispositions);
78247
78284
  if (cause) out2.push(cause);
78248
78285
  continue;
78249
78286
  }
78287
+ const content = splitJoinedCause(lm[2], sfield, verbThread, dispositions, out2);
78250
78288
  HANDLE_RE.lastIndex = 0;
78251
78289
  const h = HANDLE_RE.exec(content);
78252
78290
  let handle2 = h ? h[1] ?? h[2] : void 0;
@@ -78310,8 +78348,10 @@ function parseInlineTagsWithDispositions(text) {
78310
78348
  }
78311
78349
  }
78312
78350
  FLAG_RE.lastIndex = 0;
78351
+ const flagView = flagScanView(sentence);
78313
78352
  let f;
78314
- while ((f = FLAG_RE.exec(sentence)) !== null) {
78353
+ while ((f = FLAG_RE.exec(flagView)) !== null) {
78354
+ f[3] = sentence.slice(...f.indices[3]);
78315
78355
  const flagThread = f[2];
78316
78356
  const raw3 = f[3].trim();
78317
78357
  if (/^vuln\b/i.test(raw3)) {
@@ -78428,7 +78468,7 @@ function parseInlineTagsWithDispositions(text) {
78428
78468
  let dm;
78429
78469
  while ((dm = DOMAIN_RE.exec(sentence)) !== null) {
78430
78470
  const raw3 = dm[1].replace(/\s+/g, " ").trim();
78431
- if (raw3.length >= 3) out2.push({ kind: "domain", domainText: raw3, sentence: sfield });
78471
+ if (raw3.length >= 2) out2.push({ kind: "domain", domainText: raw3, sentence: sfield });
78432
78472
  }
78433
78473
  PACKAGE_RE.lastIndex = 0;
78434
78474
  let pk;
@@ -83416,7 +83456,7 @@ function createWatchBreaker(deps) {
83416
83456
  }
83417
83457
 
83418
83458
  // src/engine.ts
83419
- var DAEMON_VERSION = true ? "2.0.21-dev.3931" : "2.0.0-alpha.0";
83459
+ var DAEMON_VERSION = true ? "2.0.21-dev.3946" : "2.0.0-alpha.0";
83420
83460
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
83421
83461
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
83422
83462
  var GIT_OP_MUTE_MS = 4e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.21-dev.3931",
3
+ "version": "2.0.21-dev.3946",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.21-dev.3931",
3
+ "version": "2.0.21-dev.3946",
4
4
  "description": "A minimal 3D view of loaded Errata priors and recent graph bursts.",
5
5
  "author": {
6
6
  "name": "inErrata"
@@ -1,4 +1,4 @@
1
- 1880a992e2654df1357cca75d255d6fc5019614e0ae2531a822e3c03c7191d6f .codex-plugin/plugin.json
1
+ dab821a49e5e3741ffc487cf84bd1fa41c5ca0979222059482979299ea69fd7f .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js