@inerrata-corporation/errata 2.0.2-dev.192 → 2.0.2-dev.201

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 (3) hide show
  1. package/errata.mjs +407 -198
  2. package/package.json +1 -1
  3. package/pass-worker.mjs +18 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.192",
3
+ "version": "2.0.2-dev.201",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
package/pass-worker.mjs CHANGED
@@ -25145,6 +25145,9 @@ function backfillProblemContext(store2, ts) {
25145
25145
  }
25146
25146
 
25147
25147
  // ../../packages/local-graph/src/design-problem.ts
25148
+ function isConstraintProblem(node) {
25149
+ return node.attrs["kind"] === "constraint";
25150
+ }
25148
25151
  function buildNode(id, label, description, ts, attrs) {
25149
25152
  return {
25150
25153
  id,
@@ -25200,6 +25203,7 @@ function priorsForFile(store2, relPath) {
25200
25203
  }
25201
25204
  if (!file2) return null;
25202
25205
  const openProblems = [];
25206
+ const constraints = [];
25203
25207
  const seenProblem = /* @__PURE__ */ new Set();
25204
25208
  const related = /* @__PURE__ */ new Map();
25205
25209
  for (const e of store2.inEdges(file2.id, ["ANCHORED_AT"])) {
@@ -25208,14 +25212,14 @@ function priorsForFile(store2, relPath) {
25208
25212
  if (n.label === "Problem") {
25209
25213
  if (!n.attrs["resolvedAt"] && !seenProblem.has(n.id)) {
25210
25214
  seenProblem.add(n.id);
25211
- openProblems.push(n);
25215
+ (isConstraintProblem(n) ? constraints : openProblems).push(n);
25212
25216
  }
25213
25217
  } else if (CITABLE_PRIOR_LABELS.has(n.label)) {
25214
25218
  related.set(n.id, n);
25215
25219
  }
25216
25220
  }
25217
25221
  const solutionsByProblem = /* @__PURE__ */ new Map();
25218
- for (const p of openProblems) {
25222
+ for (const p of [...openProblems, ...constraints]) {
25219
25223
  for (const e of store2.outEdges(p.id, ["SOLVED_BY", "CAUSED_BY", "INSTANCE_OF"])) {
25220
25224
  const n = store2.getNode(e.to);
25221
25225
  if (n && CITABLE_PRIOR_LABELS.has(n.label)) related.set(n.id, n);
@@ -25226,9 +25230,11 @@ function priorsForFile(store2, relPath) {
25226
25230
  }
25227
25231
  }
25228
25232
  }
25229
- if (openProblems.length === 0 && related.size === 0) return null;
25230
- openProblems.sort((a, b) => (b.lastUpdatedAt ?? 0) - (a.lastUpdatedAt ?? 0));
25231
- return { file: file2, openProblems, related: [...related.values()], solutionsByProblem };
25233
+ if (openProblems.length === 0 && constraints.length === 0 && related.size === 0) return null;
25234
+ const recentFirst = (a, b) => (b.lastUpdatedAt ?? 0) - (a.lastUpdatedAt ?? 0);
25235
+ openProblems.sort(recentFirst);
25236
+ constraints.sort(recentFirst);
25237
+ return { file: file2, openProblems, constraints, related: [...related.values()], solutionsByProblem };
25232
25238
  }
25233
25239
  function recordAnchorHint(store2, problemId, relPath, provenance, ts) {
25234
25240
  const p = store2.getNode(problemId);
@@ -25245,6 +25251,7 @@ function resolveDesignProblems(store2, t) {
25245
25251
  for (const p of store2.findNodesByLabel("Problem")) {
25246
25252
  if (!p.id.startsWith("dprob_")) continue;
25247
25253
  if (p.attrs["resolvedAt"]) continue;
25254
+ if (isConstraintProblem(p)) continue;
25248
25255
  let symName = "";
25249
25256
  let symRelPath;
25250
25257
  let edited = false;
@@ -25731,6 +25738,7 @@ function mergeDuplicateProblems(store2, opts) {
25731
25738
  if (consumed.has(b.id)) continue;
25732
25739
  const tb = tokens.get(b.id);
25733
25740
  if (Math.min(ta.size, tb.size) < minTokens) continue;
25741
+ if (isConstraintProblem(a) !== isConstraintProblem(b)) continue;
25734
25742
  if (overlap(ta, tb) >= minOverlap) {
25735
25743
  cluster.push(b);
25736
25744
  consumed.add(b.id);
@@ -26063,12 +26071,14 @@ var AGENTS_POINTER_BODY = [
26063
26071
  init_src2();
26064
26072
  function buildSnapshot(opts) {
26065
26073
  const problems = opts.store.findNodesByLabel("Problem").filter((p) => p.attrs["mergedInto"] === void 0);
26066
- const allProblems = problems.filter((p) => p.attrs["resolvedAt"] == null);
26074
+ const stillOpen = problems.filter((p) => p.attrs["resolvedAt"] == null);
26075
+ const allProblems = stillOpen.filter((p) => !isConstraintProblem(p));
26067
26076
  allProblems.sort((a, b) => b.lastUpdatedAt - a.lastUpdatedAt);
26068
26077
  const recent = allProblems.slice(0, 8).map((p) => ({
26069
26078
  node: p,
26070
26079
  anchors: opts.store.outEdges(p.id, ["MANIFESTED_IN", "EVIDENCED_BY"])
26071
26080
  }));
26081
+ const recentConstraints = stillOpen.filter((p) => isConstraintProblem(p)).sort((a, b) => b.lastUpdatedAt - a.lastUpdatedAt).slice(0, 3);
26072
26082
  const recentResolved = problems.filter((p) => p.attrs["resolvedAt"] != null && p.attrs["resolvedAs"] == null).sort((a, b) => Number(b.attrs["resolvedAt"] ?? 0) - Number(a.attrs["resolvedAt"] ?? 0)).slice(0, 4).map((p) => {
26073
26083
  const solEdge = opts.store.outEdges(p.id, ["SOLVED_BY"])[0];
26074
26084
  const solution = solEdge ? opts.store.getNode(solEdge.to) ?? void 0 : void 0;
@@ -26135,6 +26145,7 @@ function buildSnapshot(opts) {
26135
26145
  profileContext,
26136
26146
  recentProblems: recent,
26137
26147
  recentResolved,
26148
+ recentConstraints,
26138
26149
  ...causalNudge ? { causalNudge } : {},
26139
26150
  ...domainNudge ? { domainNudge } : {},
26140
26151
  motifs,
@@ -26187,6 +26198,7 @@ function sliceForFile(store2, relPath) {
26187
26198
  const fp = priorsForFile(store2, relPath);
26188
26199
  const priors = fp ? {
26189
26200
  openProblems: fp.openProblems.slice(0, 3).map((p) => ({ id: p.id, description: p.description })),
26201
+ constraints: fp.constraints.slice(0, 2).map((c) => ({ id: c.id, description: c.description })),
26190
26202
  related: fp.related.slice(0, 4).map((n) => ({ id: n.id, label: n.label, description: n.description })),
26191
26203
  solutionsByProblem: Object.fromEntries(
26192
26204
  fp.openProblems.slice(0, 3).map((p) => [