@inerrata-corporation/errata 2.0.2-dev.631 → 2.0.2-dev.633

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 +81 -24
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -18178,10 +18178,10 @@ function matchPackagesInText(text, index) {
18178
18178
  for (const [key, node2] of index) {
18179
18179
  if (key.length < MIN_NAME_LEN) continue;
18180
18180
  if (!hay.includes(key)) continue;
18181
- const esc3 = escapeRe3(key);
18182
- const bounded = new RegExp(`(?<![\\w@/.\\-])${esc3}(?![\\w])`);
18181
+ const esc4 = escapeRe3(key);
18182
+ const bounded = new RegExp(`(?<![\\w@/.\\-])${esc4}(?![\\w])`);
18183
18183
  if (!bounded.test(hay)) continue;
18184
- const verMatch = new RegExp(`${esc3}\\s*@?\\s*v?(\\d+(?:\\.\\d+){0,2})\\b`).exec(hay);
18184
+ const verMatch = new RegExp(`${esc4}\\s*@?\\s*v?(\\d+(?:\\.\\d+){0,2})\\b`).exec(hay);
18185
18185
  const hasSep = NAME_SEPARATOR.test(key);
18186
18186
  if (!hasSep && !verMatch) continue;
18187
18187
  if (seen.has(node2.id)) continue;
@@ -27403,6 +27403,54 @@ var init_src8 = __esm({
27403
27403
  }
27404
27404
  });
27405
27405
 
27406
+ // ../../packages/privacy-edge/src/self-reference.ts
27407
+ function locatorTerms(loc, full, part) {
27408
+ if (!loc) return;
27409
+ full.add(loc);
27410
+ const segs = loc.split("/").filter(Boolean);
27411
+ if (segs.length >= 2) {
27412
+ part.add(segs[segs.length - 1]);
27413
+ part.add(segs[segs.length - 2]);
27414
+ }
27415
+ }
27416
+ function scrubSelfReferences(text, project) {
27417
+ let out2 = text;
27418
+ out2 = out2.replace(
27419
+ /\b(MRs?|PRs?|merge requests?|pull requests?|issues?|tickets?)\s+#?[0-9]+\b/gi,
27420
+ (_m, kind) => {
27421
+ const k = kind.toLowerCase();
27422
+ if (k.startsWith("p")) return "a pull request";
27423
+ if (k.startsWith("i")) return "an issue";
27424
+ if (k.startsWith("t")) return "a ticket";
27425
+ return "a merge request";
27426
+ }
27427
+ ).replace(new RegExp(`${L}![0-9]{1,6}(?![0-9])`, "g"), "a merge request").replace(new RegExp(`(?<![A-Za-z0-9#])#[0-9]{2,6}(?![0-9])`, "g"), "an issue");
27428
+ const full = /* @__PURE__ */ new Set();
27429
+ const part = /* @__PURE__ */ new Set();
27430
+ locatorTerms(project.repoLocator, full, part);
27431
+ for (const a of project.aliases ?? []) locatorTerms(a, full, part);
27432
+ if (project.name) part.add(project.name);
27433
+ for (const a of project.aka ?? []) part.add(a);
27434
+ const ordered = [
27435
+ ...[...full].map((t) => ({ t, repl: "the repository" })),
27436
+ ...[...part].map((t) => ({ t, repl: "the project" }))
27437
+ ].filter((x) => x.t && x.t.length >= 2).sort((a, b) => b.t.length - a.t.length);
27438
+ for (const { t, repl } of ordered) {
27439
+ out2 = out2.replace(new RegExp(`${L}${esc2(t)}${R}`, "gi"), repl);
27440
+ }
27441
+ out2 = out2.replace(/\b(the|a|an|its|our|this)\s+the\s+(project|repository)\b/gi, "the $2");
27442
+ return out2;
27443
+ }
27444
+ var L, R, esc2;
27445
+ var init_self_reference = __esm({
27446
+ "../../packages/privacy-edge/src/self-reference.ts"() {
27447
+ "use strict";
27448
+ L = "(?<![A-Za-z0-9])";
27449
+ R = "(?![A-Za-z0-9])";
27450
+ esc2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
27451
+ }
27452
+ });
27453
+
27406
27454
  // ../../packages/privacy-edge/src/generalize.ts
27407
27455
  function generalize(text, opts = {}) {
27408
27456
  const level = opts.level ?? 1;
@@ -27415,6 +27463,7 @@ function generalize(text, opts = {}) {
27415
27463
  return generalizePhrase(cls, level);
27416
27464
  });
27417
27465
  }
27466
+ if (opts.project) out2 = scrubSelfReferences(out2, opts.project);
27418
27467
  return { text: out2, report: { level, classes: [...seen] } };
27419
27468
  }
27420
27469
  var TOKEN_RULES;
@@ -27424,6 +27473,7 @@ var init_generalize = __esm({
27424
27473
  init_src8();
27425
27474
  init_date_shapes();
27426
27475
  init_ontology();
27476
+ init_self_reference();
27427
27477
  TOKEN_RULES = [
27428
27478
  { re: /<api-key:[0-9a-f]+>/gi, cls: "credential" },
27429
27479
  { re: /<email:[0-9a-f]+>/gi, cls: "email" },
@@ -27445,6 +27495,7 @@ var init_src9 = __esm({
27445
27495
  init_ontology();
27446
27496
  init_date_shapes();
27447
27497
  init_generalize();
27498
+ init_self_reference();
27448
27499
  }
27449
27500
  });
27450
27501
 
@@ -48889,13 +48940,13 @@ var init_witness_ledger = __esm({
48889
48940
  var report_render_exports = {};
48890
48941
  __export(report_render_exports, {
48891
48942
  LIVE_VERBS: () => LIVE_VERBS,
48892
- esc: () => esc2,
48943
+ esc: () => esc3,
48893
48944
  renderRepoPage: () => renderRepoPage,
48894
48945
  renderReport: () => renderReport,
48895
48946
  renderRollupIndex: () => renderRollupIndex,
48896
48947
  slug: () => slug
48897
48948
  });
48898
- function esc2(s) {
48949
+ function esc3(s) {
48899
48950
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
48900
48951
  }
48901
48952
  function slug(name2) {
@@ -48909,9 +48960,9 @@ function nextHtml(n, opts) {
48909
48960
  const cmd2 = `errata ${n.verb}${n.arg ? " " + n.arg : ""}`;
48910
48961
  const live = isLive2(n.verb);
48911
48962
  if (!live && !opts.includeFutureVerbs) return "";
48912
- const hint = n.hint ? ` \u2014 ${esc2(n.hint)}` : "";
48963
+ const hint = n.hint ? ` \u2014 ${esc3(n.hint)}` : "";
48913
48964
  const cls = live ? "next" : "next soon";
48914
- const tag = live ? `<code>${esc2(cmd2)}</code>` : `<span class="vsoon">${esc2(cmd2)} \xB7 soon</span>`;
48965
+ const tag = live ? `<code>${esc3(cmd2)}</code>` : `<span class="vsoon">${esc3(cmd2)} \xB7 soon</span>`;
48915
48966
  return `<div class="${cls}">next: ${tag}${hint}</div>`;
48916
48967
  }
48917
48968
  function shell(title, body2) {
@@ -48921,7 +48972,7 @@ function shell(title, body2) {
48921
48972
  <meta charset="utf-8">
48922
48973
  <meta name="viewport" content="width=device-width, initial-scale=1">
48923
48974
  <meta name="robots" content="noindex">
48924
- <title>${esc2(title)}</title>
48975
+ <title>${esc3(title)}</title>
48925
48976
  <style>
48926
48977
  :root{
48927
48978
  --bg:#0c0809; --panel:#160f10; --panel2:#1d1416; --line:#2c1f22; --ink:#efe7e9; --mut:#a6939a; --faint:#7c6a70;
@@ -49032,17 +49083,17 @@ function trustHtml(t, note) {
49032
49083
  function learnedCard(c, opts) {
49033
49084
  const segs = [];
49034
49085
  if (c.chain.causedBy)
49035
- segs.push(`<span class="e">CAUSED_BY</span> <span class="rc">${esc2(c.chain.causedBy)}</span>`);
49086
+ segs.push(`<span class="e">CAUSED_BY</span> <span class="rc">${esc3(c.chain.causedBy)}</span>`);
49036
49087
  if (c.chain.fixedBy) {
49037
49088
  const verified = c.chain.verified ? " \xB7 verified" : "";
49038
- segs.push(`<span class="e">FIXED_BY</span> <span class="fix">${esc2(c.chain.fixedBy)}${verified}</span>`);
49089
+ segs.push(`<span class="e">FIXED_BY</span> <span class="fix">${esc3(c.chain.fixedBy)}${verified}</span>`);
49039
49090
  }
49040
49091
  if (c.chain.instanceOf)
49041
- segs.push(`<span class="e">INSTANCE_OF</span> <span class="rc">${esc2(c.chain.instanceOf)}</span>`);
49092
+ segs.push(`<span class="e">INSTANCE_OF</span> <span class="rc">${esc3(c.chain.instanceOf)}</span>`);
49042
49093
  const chain = segs.length > 0 ? `\u2514\u2500 ${segs.join(" \u2500 ")}` : '\u2514\u2500 <span class="rc">(no causal chain yet)</span>';
49043
49094
  return `<div class="lcard">
49044
49095
  <div class="row1">
49045
- <span class="prob">${esc2(c.problem)}</span>
49096
+ <span class="prob">${esc3(c.problem)}</span>
49046
49097
  <span class="badge ${PROV_CLASS[c.provenance]}">${BADGE2[c.provenance]} ${PROV_LABEL[c.provenance]}</span>
49047
49098
  </div>
49048
49099
  <div class="chain">${chain}</div>
@@ -49051,9 +49102,9 @@ function learnedCard(c, opts) {
49051
49102
  }
49052
49103
  function hotspotsPanel(hs) {
49053
49104
  const rows = hs.map(
49054
- (h) => `<div class="hs"><span class="f">${esc2(h.file)}</span><div class="bar"><i style="width:${Math.round(
49105
+ (h) => `<div class="hs"><span class="f">${esc3(h.file)}</span><div class="bar"><i style="width:${Math.round(
49055
49106
  Math.max(0, Math.min(1, h.weight)) * 100
49056
- )}%"></i></div><span class="n">${h.problemCount} ${esc2(h.unit ?? "probs")}</span></div>`
49107
+ )}%"></i></div><span class="n">${h.problemCount} ${esc3(h.unit ?? "probs")}</span></div>`
49057
49108
  ).join("\n ");
49058
49109
  return `<div class="panel">
49059
49110
  <h3>hotspots \xB7 risk concentration</h3>
@@ -49062,7 +49113,7 @@ function hotspotsPanel(hs) {
49062
49113
  }
49063
49114
  function revisitPanel(items) {
49064
49115
  const rows = items.map(
49065
- (r) => `<div class="rev"><span class="id">${esc2(r.id)}</span><p><b>${esc2(r.claim)}</b> \u2014 ${esc2(
49116
+ (r) => `<div class="rev"><span class="id">${esc3(r.id)}</span><p><b>${esc3(r.claim)}</b> \u2014 ${esc3(
49066
49117
  r.reason
49067
49118
  )}</p></div>`
49068
49119
  ).join("\n ");
@@ -49155,7 +49206,7 @@ function spineViz(spine, idSuffix) {
49155
49206
  </script>`;
49156
49207
  }
49157
49208
  function renderRepoPage(repo, data, opts = {}) {
49158
- const consent = `consent in/out: <span style="color:var(--grn)">${esc2(data.consent.inbound)}</span> / <span style="color:var(--grn)">${esc2(
49209
+ const consent = `consent in/out: <span style="color:var(--grn)">${esc3(data.consent.inbound)}</span> / <span style="color:var(--grn)">${esc3(
49159
49210
  data.consent.outbound
49160
49211
  )}</span>`;
49161
49212
  const learned = repo.learned.length > 0 ? `<div class="learn">
@@ -49164,8 +49215,8 @@ ${repo.learned.map((c) => learnedCard(c, opts)).join("\n")}
49164
49215
  const body2 = `<p class="next"><a href="report.html">\u2190 all repos</a></p>
49165
49216
  <div class="rhead">
49166
49217
  <div class="rh-top">
49167
- <div class="rh-title">errata report \xB7 <span class="repo">${esc2(repo.name)}</span></div>
49168
- <div class="rh-stamp">snapshot ${esc2(data.generatedAt)}<br>static html \xB7 generated by the daemon \xB7 ${consent}</div>
49218
+ <div class="rh-title">errata report \xB7 <span class="repo">${esc3(repo.name)}</span></div>
49219
+ <div class="rh-stamp">snapshot ${esc3(data.generatedAt)}<br>static html \xB7 generated by the daemon \xB7 ${consent}</div>
49169
49220
  </div>
49170
49221
  ${statRow(repo.stats)}
49171
49222
  </div>
@@ -49193,21 +49244,21 @@ ${healthStrip(repo.health)}
49193
49244
  }
49194
49245
  function renderRollupIndex(data, opts = {}) {
49195
49246
  const r = data.rollup;
49196
- const consent = `consent in/out: <span style="color:var(--grn)">${esc2(data.consent.inbound)}</span> / <span style="color:var(--grn)">${esc2(
49247
+ const consent = `consent in/out: <span style="color:var(--grn)">${esc3(data.consent.inbound)}</span> / <span style="color:var(--grn)">${esc3(
49197
49248
  data.consent.outbound
49198
49249
  )}</span>`;
49199
49250
  const rows = data.repos.map((repo) => {
49200
49251
  const href = `report-${slug(repo.name)}.html`;
49201
49252
  return `<a class="rrow" href="${href}">
49202
49253
  <span class="live ${repo.live ? "on" : "off"}">${repo.live ? "\u25CF live" : "\u25CB idle"}</span>
49203
- <span><span class="nm">${esc2(repo.name)}</span><br><span class="pth">${esc2(repo.path)}</span></span>
49254
+ <span><span class="nm">${esc3(repo.name)}</span><br><span class="pth">${esc3(repo.path)}</span></span>
49204
49255
  <span class="mini">${repo.stats.nodes.toLocaleString("en-US")} nodes \xB7 ${repo.health.openProblems} open \xB7 ${repo.health.humanValidated}<span style="color:var(--gold)">\u25B2h</span></span>
49205
49256
  </a>`;
49206
49257
  }).join("\n ");
49207
49258
  const body2 = `<div class="rhead">
49208
49259
  <div class="rh-top">
49209
49260
  <div class="rh-title">errata report \xB7 <span class="repo">${data.repos.length} repo${data.repos.length === 1 ? "" : "s"}</span></div>
49210
- <div class="rh-stamp">snapshot ${esc2(data.generatedAt)}<br>static html \xB7 generated by the daemon \xB7 ${consent}</div>
49261
+ <div class="rh-stamp">snapshot ${esc3(data.generatedAt)}<br>static html \xB7 generated by the daemon \xB7 ${consent}</div>
49211
49262
  </div>
49212
49263
  <div class="statrow">
49213
49264
  <div class="stat"><div class="v">${r.nodes.toLocaleString("en-US")}</div><div class="k">nodes</div></div>
@@ -54857,7 +54908,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54857
54908
  }
54858
54909
 
54859
54910
  // src/engine.ts
54860
- var DAEMON_VERSION = true ? "2.0.2-dev.631" : "2.0.0-alpha.0";
54911
+ var DAEMON_VERSION = true ? "2.0.2-dev.633" : "2.0.0-alpha.0";
54861
54912
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54862
54913
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54863
54914
  var GIT_OP_MUTE_MS = 4e3;
@@ -57214,10 +57265,16 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
57214
57265
  };
57215
57266
  const symbolIndex = opts.workspaceRoot ? publicSymbolIndex(store, opts.workspaceRoot) : null;
57216
57267
  const ownLexicon = buildSymbolLexicon(store);
57268
+ const projectIdentity = {
57269
+ ...profile.name ? { name: profile.name } : {},
57270
+ ...profile.repoLocator ? { repoLocator: profile.repoLocator } : {},
57271
+ ...profile.repoLocatorAliases ? { aliases: profile.repoLocatorAliases } : {},
57272
+ ...profile.aka ? { aka: profile.aka } : {}
57273
+ };
57217
57274
  const fileLexicon = buildFileLexicon(store);
57218
57275
  const shareable = (n) => {
57219
57276
  const preserved = symbolIndex ? preservedSymbolsFor(n.description, symbolIndex) : [];
57220
- const shippedText = generalize(n.description, { level }).text;
57277
+ const shippedText = generalize(n.description, { level, project: projectIdentity }).text;
57221
57278
  const internalSyms = internalSymbolsFor(shippedText, (t) => ownLexicon.has(t), symbolIndex);
57222
57279
  const internalFiles = internalFilesFor(shippedText, fileLexicon);
57223
57280
  const internal = [.../* @__PURE__ */ new Set([...internalFiles, ...internalSyms])].slice(
@@ -57413,7 +57470,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
57413
57470
  if (sidecar[tok]) continue;
57414
57471
  const entry = lexicon.get(tok);
57415
57472
  if (!entry?.summary) continue;
57416
- const scrubbed = generalize(entry.summary, { level }).text.trim();
57473
+ const scrubbed = generalize(entry.summary, { level, project: projectIdentity }).text.trim();
57417
57474
  if (!scrubbed || summaryRejectionReason(scrubbed, isKnown) !== null) continue;
57418
57475
  if (count >= MAX_SIDECAR_SYMBOLS) break outer;
57419
57476
  sidecar[tok] = { kind: entry.kind, summary: scrubbed };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.631",
3
+ "version": "2.0.2-dev.633",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {