@inerrata-corporation/errata 2.0.21-dev.3896 → 2.0.21-dev.3904

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
@@ -27398,6 +27398,9 @@ var init_client = __esm({
27398
27398
  if (q.q) qs.set("q", q.q);
27399
27399
  if (q.channel) qs.set("channel", q.channel);
27400
27400
  if (q.includeTriage) qs.set("includeTriage", "true");
27401
+ if (q.scope) qs.set("scope", q.scope);
27402
+ if (q.community) qs.set("community", "true");
27403
+ if (q.bridges) qs.set("bridges", "true");
27401
27404
  const publicCtx = process.env["ERRATA_PRIMING_PUBLIC_CONTEXT"];
27402
27405
  const usePublicCtx = Boolean(publicCtx && publicCtx !== "0" && q.channel === "priming");
27403
27406
  const UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -34969,6 +34972,7 @@ function mergeDualBurst(local, cloud, opts = {}) {
34969
34972
  provenance: corroborated ? "corroborated" : "local",
34970
34973
  ...twin?.usageCount != null ? { usageCount: twin.usageCount } : {},
34971
34974
  ...twin?.rel ? { rel: twin.rel } : {},
34975
+ ...twin?.community ? { community: twin.community } : {},
34972
34976
  why: l.components,
34973
34977
  ...l.via ? { via: l.via } : {}
34974
34978
  });
@@ -34986,7 +34990,8 @@ function mergeDualBurst(local, cloud, opts = {}) {
34986
34990
  // adapters surface 1-hop neighbors of the seed
34987
34991
  provenance: "collective",
34988
34992
  ...c.usageCount != null ? { usageCount: c.usageCount } : {},
34989
- ...c.rel ? { rel: c.rel } : {}
34993
+ ...c.rel ? { rel: c.rel } : {},
34994
+ ...c.community ? { community: c.community } : {}
34990
34995
  });
34991
34996
  }
34992
34997
  nodes.sort((a, b) => b.score - a.score);
@@ -35023,12 +35028,15 @@ function searchResultToCloudHits(result) {
35023
35028
  const usage = node2.attrs?.["usageCount"];
35024
35029
  const s = scores[i2];
35025
35030
  const cloudScore = !Number.isNaN(s) && maxScore > 0 ? s / maxScore : n > 0 ? (n - i2) / n : 0;
35031
+ const communityId = node2.attrs?.["community"];
35032
+ const communityLabel = node2.attrs?.["communityLabel"];
35026
35033
  return {
35027
35034
  id: node2.id,
35028
35035
  label: node2.label,
35029
35036
  description: node2.description,
35030
35037
  cloudScore,
35031
- ...typeof usage === "number" ? { usageCount: usage } : {}
35038
+ ...typeof usage === "number" ? { usageCount: usage } : {},
35039
+ ...typeof communityId === "number" ? { community: { id: communityId, label: typeof communityLabel === "string" ? communityLabel : null } } : {}
35032
35040
  };
35033
35041
  });
35034
35042
  }
@@ -35075,7 +35083,7 @@ async function dualAugment(opts) {
35075
35083
  }
35076
35084
  if (hardIds.length > 0 || softQ) {
35077
35085
  calls.push(
35078
- cloud.search({ stack: [], domains: [], kinds: [], seed: hardIds, ...softQ ? { q: softQ } : {}, limit }).then((res) => {
35086
+ cloud.search({ stack: [], domains: [], kinds: [], seed: hardIds, ...softQ ? { q: softQ } : {}, limit, community: true }).then((res) => {
35079
35087
  cloudHits.push(...searchResultToCloudHits(res));
35080
35088
  })
35081
35089
  );
@@ -35116,10 +35124,28 @@ function federationHint(status) {
35116
35124
  function hasCloudNodeShape(id) {
35117
35125
  return CANONICAL_KNOWLEDGE_ID.test(id) || UUID_ID.test(id) || id.startsWith("pkg:");
35118
35126
  }
35119
- async function collectiveDrilldown(cloud, seedId, limit) {
35127
+ function attrsCommunity(attrs) {
35128
+ const id = attrs?.["community"];
35129
+ if (typeof id !== "number") return void 0;
35130
+ const label = attrs?.["communityLabel"];
35131
+ return { id, label: typeof label === "string" ? label : null };
35132
+ }
35133
+ function walkerCommunity(c) {
35134
+ return c ? { id: c.communityId, label: c.label } : null;
35135
+ }
35136
+ async function collectiveDrilldown(cloud, seedId, limit, opts = {}) {
35120
35137
  let res;
35121
35138
  try {
35122
- res = await cloud.search({ stack: [], domains: [], kinds: [], seed: [seedId], limit });
35139
+ res = await cloud.search({
35140
+ stack: [],
35141
+ domains: [],
35142
+ kinds: [],
35143
+ seed: [seedId],
35144
+ limit,
35145
+ community: true,
35146
+ ...opts.bridges ? { bridges: true } : {},
35147
+ ...opts.scope ? { scope: opts.scope } : {}
35148
+ });
35123
35149
  } catch (err2) {
35124
35150
  if (isQuotaError(err2)) {
35125
35151
  console.warn("[errata] collectiveDrilldown: collective read QUOTA EXCEEDED \u2014 the id's existence is unknown, not refuted.");
@@ -35144,17 +35170,21 @@ async function collectiveDrilldown(cloud, seedId, limit) {
35144
35170
  nodes: res.nodes.map((n) => {
35145
35171
  const score2 = n.attrs["score"];
35146
35172
  const uncertainty = n.attrs["uncertainty"];
35173
+ const community = attrsCommunity(n.attrs);
35147
35174
  return {
35148
35175
  id: n.id,
35149
35176
  label: n.label,
35150
35177
  name: n.description,
35151
35178
  ...typeof score2 === "number" ? { score: Number(score2.toFixed(4)) } : {},
35152
35179
  ...typeof uncertainty === "number" ? { uncertainty: Number(uncertainty.toFixed(4)) } : {},
35180
+ ...community ? { community } : {},
35153
35181
  hops: 1,
35154
35182
  provenance: "collective"
35155
35183
  };
35156
35184
  }),
35157
- edges: res.edges.map((e) => ({ from: e.from, to: e.to, type: e.type }))
35185
+ edges: res.edges.map((e) => ({ from: e.from, to: e.to, type: e.type })),
35186
+ ...seedEntry && "community" in seedEntry ? { seedCommunity: walkerCommunity(seedEntry.community) } : {},
35187
+ ...seedEntry?.bridges ? { bridges: seedEntry.bridges } : {}
35158
35188
  }
35159
35189
  };
35160
35190
  }
@@ -35203,6 +35233,7 @@ async function collectiveNodeDetail(cloud, id) {
35203
35233
  createdAtMs: row.createdAtMs,
35204
35234
  lastValidatedAtMs: row.lastValidatedAtMs,
35205
35235
  visibility: row.visibility,
35236
+ ...row.community !== void 0 ? { community: walkerCommunity(row.community) } : {},
35206
35237
  resolvedBy: row.resolvedBy,
35207
35238
  causalChain: row.causalChain ?? [],
35208
35239
  related: row.related
@@ -35219,6 +35250,7 @@ function formatDualNodes(merged) {
35219
35250
  provenance: n.provenance,
35220
35251
  ...n.usageCount != null ? { usageCount: n.usageCount } : {},
35221
35252
  ...n.rel ? { rel: n.rel } : {},
35253
+ ...n.community ? { community: n.community } : {},
35222
35254
  ...n.why ? {
35223
35255
  why: {
35224
35256
  semantic: Number(n.why.semantic.toFixed(3)),
@@ -44493,11 +44525,21 @@ function cosine3(a, b) {
44493
44525
  for (let i2 = 0; i2 < a.length; i2++) dot += a[i2] * b[i2];
44494
44526
  return dot;
44495
44527
  }
44496
- async function collectiveSeedFallback(args2, ctx, defaultLimit) {
44528
+ async function collectiveSeedFallback(args2, ctx, defaultLimit, opts = {}) {
44497
44529
  const seedId = typeof args2["nodeId"] === "string" ? args2["nodeId"] : null;
44498
44530
  if (!seedId || !ctx.cloud || !hasCloudNodeShape(seedId)) return null;
44499
44531
  const limit = Math.max(1, Math.min(100, Number(args2["limit"] ?? defaultLimit)));
44500
- return collectiveDrilldown(ctx.cloud, seedId, limit);
44532
+ const scope = args2["scope"];
44533
+ return collectiveDrilldown(ctx.cloud, seedId, limit, {
44534
+ ...opts.allowScope && (scope === "community" || scope === "neighborhood" || scope === "global") ? { scope } : {},
44535
+ ...opts.allowBridges && args2["bridges"] === true ? { bridges: true } : {}
44536
+ });
44537
+ }
44538
+ function collectiveCommunityFields(cn) {
44539
+ return {
44540
+ ...cn.seedCommunity !== void 0 ? { seedCommunity: cn.seedCommunity } : {},
44541
+ ...cn.bridges ? { bridges: cn.bridges } : {}
44542
+ };
44501
44543
  }
44502
44544
  function collectiveSeedStatus(cn) {
44503
44545
  return cn.nodes.length > 0 ? "cloud-seed" : "cloud-seed-empty";
@@ -44879,7 +44921,8 @@ var init_mcp = __esm({
44879
44921
  // 1-hop neighborhood + its internal topology instead of the local
44880
44922
  // contract's typed out/in lists.
44881
44923
  nearby: cn.nodes,
44882
- edges: cn.edges
44924
+ edges: cn.edges,
44925
+ ...collectiveCommunityFields(cn)
44883
44926
  };
44884
44927
  }
44885
44928
  return collectiveSeedMiss(args2, cs);
@@ -44917,20 +44960,29 @@ var init_mcp = __esm({
44917
44960
  },
44918
44961
  {
44919
44962
  name: "errata.burst",
44920
- description: "Burst-grade local retrieval \u2014 the INTELLIGENT, seed-relative neighborhood (not a flat list). Given a SEED (`nodeId` or `qname`), expand its neighborhood and return the RELEVANT scored subset, ranked by burst-style relevance: semantic similarity to the seed \xD7 centrality \xD7 trust, hop-decayed; semantically-unrelated nodes are gated out. Prefer this over errata.neighbors when you want signal-ranked CONTEXT rather than raw edges. When the SEED is a package and the collective is reachable, results BLEND cross-project knowledge \u2014 each carries `provenance` (local | collective | corroborated) and `usageCount` (projects using it); `corroborated` means your graph and the collective agree (trust it most), `collective` is a cross-project prior to verify. Returns {seed, count, results:[{id,label,name,score,hops,provenance,usageCount?,why?,via?}]} \u2014 `via` is the TOPOLOGY: the edge that reached this result in the walk ({edgeType, parentId, forward}; forward: true \u21D2 parent \u2014edgeType\u2192 node), so you can tell 'FIXED_BY your seed' from 'two hops away via a shared package' and choose whether to dig down a causal chain or turn elsewhere.",
44963
+ description: "Burst-grade local retrieval \u2014 the INTELLIGENT, seed-relative neighborhood (not a flat list). Given a SEED (`nodeId` or `qname`), expand its neighborhood and return the RELEVANT scored subset, ranked by burst-style relevance: semantic similarity to the seed \xD7 centrality \xD7 trust, hop-decayed; semantically-unrelated nodes are gated out. Prefer this over errata.neighbors when you want signal-ranked CONTEXT rather than raw edges. When the SEED is a package and the collective is reachable, results BLEND cross-project knowledge \u2014 each carries `provenance` (local | collective | corroborated) and `usageCount` (projects using it); `corroborated` means your graph and the collective agree (trust it most), `collective` is a cross-project prior to verify. Returns {seed, count, results:[{id,label,name,score,hops,provenance,usageCount?,why?,via?}]} \u2014 `via` is the TOPOLOGY: the edge that reached this result in the walk ({edgeType, parentId, forward}; forward: true \u21D2 parent \u2014edgeType\u2192 node), so you can tell 'FIXED_BY your seed' from 'two hops away via a shared package' and choose whether to dig down a causal chain or turn elsewhere. A COLLECTIVE seed (a cloud id not in your graph) also reports `seedCommunity` {id,label} and each result's `community`; ids are tonight's partition (renumbered nightly \u2014 compare within one walk, never store). Pass `scope` to stay in / leave the seed's community and `bridges:true` for the bordering communities and their crossing edges.",
44921
44964
  inputSchema: {
44922
44965
  type: "object",
44923
44966
  properties: {
44924
44967
  nodeId: { type: "string" },
44925
44968
  qname: { type: "string", description: "Symbol qname (resolved to a node)." },
44926
44969
  maxHops: { type: "number", description: "Neighborhood radius (default 2)." },
44927
- limit: { type: "number", description: "Max results (default 20)." }
44970
+ limit: { type: "number", description: "Max results (default 20)." },
44971
+ scope: {
44972
+ type: "string",
44973
+ enum: ["community", "neighborhood", "global"],
44974
+ description: "Collective seeds only: `community` keeps only the seed's community, `global` ranks cross-community neighbours on par; default `neighborhood`."
44975
+ },
44976
+ bridges: {
44977
+ type: "boolean",
44978
+ description: "Collective seeds only: also return `bridges` \u2014 the communities bordering the seed's, each with its strongest crossing edges (where to go next)."
44979
+ }
44928
44980
  }
44929
44981
  },
44930
44982
  handler: async (args2, store, ctx) => {
44931
44983
  const id = resolveSymbol2(store, args2);
44932
44984
  if (!id) {
44933
- const cs = await collectiveSeedFallback(args2, ctx, 20);
44985
+ const cs = await collectiveSeedFallback(args2, ctx, 20, { allowScope: true, allowBridges: true });
44934
44986
  if (cs?.status === "resolved") {
44935
44987
  const cn = cs.neighborhood;
44936
44988
  return {
@@ -44941,7 +44993,8 @@ var init_mcp = __esm({
44941
44993
  collectiveStatus: collectiveSeedStatus(cn),
44942
44994
  count: cn.nodes.length,
44943
44995
  results: cn.nodes,
44944
- edges: cn.edges
44996
+ edges: cn.edges,
44997
+ ...collectiveCommunityFields(cn)
44945
44998
  };
44946
44999
  }
44947
45000
  return collectiveSeedMiss(args2, cs);
@@ -45129,9 +45182,11 @@ var init_mcp = __esm({
45129
45182
  description: n.name,
45130
45183
  hops: n.hops,
45131
45184
  relevance: n.score,
45132
- provenance: n.provenance
45185
+ provenance: n.provenance,
45186
+ ...n.community ? { community: n.community } : {}
45133
45187
  })),
45134
- edges: cn.edges
45188
+ edges: cn.edges,
45189
+ ...collectiveCommunityFields(cn)
45135
45190
  };
45136
45191
  }
45137
45192
  return collectiveSeedMiss(args2, cs);
@@ -83124,7 +83179,7 @@ function createWatchBreaker(deps) {
83124
83179
  }
83125
83180
 
83126
83181
  // src/engine.ts
83127
- var DAEMON_VERSION = true ? "2.0.21-dev.3896" : "2.0.0-alpha.0";
83182
+ var DAEMON_VERSION = true ? "2.0.21-dev.3904" : "2.0.0-alpha.0";
83128
83183
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
83129
83184
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
83130
83185
  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.3896",
3
+ "version": "2.0.21-dev.3904",
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.3896",
3
+ "version": "2.0.21-dev.3904",
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
- 318e19fc332a3ee22b8c6f8318ee7c7c82b37b03b0624fee47dcabbdee5ddaa9 .codex-plugin/plugin.json
1
+ 80437cb509261f3ab983d93240320f8ef99241c2b0709ccca75d3052035b27a7 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js