@inerrata-corporation/errata 2.0.2-dev.556 → 2.0.2-dev.560

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 +57 -8
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -18961,7 +18961,7 @@ function ingestDesignProblem(store, flag, opts) {
18961
18961
  mergeEdge(store, problemId, rootCauseId, "CAUSED_BY", opts.ts);
18962
18962
  }
18963
18963
  let solutionId = null;
18964
- if (flag.fix?.trim()) {
18964
+ if (flag.fix?.trim() && !isFragmentFixNote(flag.fix)) {
18965
18965
  solutionId = `dfix_${digest({ problemId, fix: flag.fix })}`.slice(0, 56);
18966
18966
  store.mergeNode(
18967
18967
  buildNode(store, solutionId, "Solution", flag.fix.trim(), opts.ts, {
@@ -19164,6 +19164,12 @@ function reinforceSameAnchorProblem(store, relPath, workspaceId2, statement, sou
19164
19164
  }
19165
19165
  return existing.id;
19166
19166
  }
19167
+ function isFragmentFixNote(note) {
19168
+ const t = note.trim();
19169
+ if (t.length === 0) return true;
19170
+ if (/^[)\]},;:.!?]/.test(t)) return true;
19171
+ return /^(and|but|or|nor|so|yet|also|plus)\b/i.test(t);
19172
+ }
19167
19173
  function isAutoMinted(n) {
19168
19174
  return n.label === "Solution" && String(n.description ?? "").startsWith(AUTO_MINT_PREFIX);
19169
19175
  }
@@ -19297,7 +19303,7 @@ function closeDesignProblem(store, problemId, fixNote, t) {
19297
19303
  const p = store.getNode(problemId);
19298
19304
  if (!p || p.label !== "Problem") return false;
19299
19305
  if (p.attrs["resolvedAs"]) return false;
19300
- if (fixNote?.trim()) {
19306
+ if (fixNote?.trim() && !isFragmentFixNote(fixNote)) {
19301
19307
  const sols = store.outEdges(problemId, ["SOLVED_BY"]).map((e) => store.getNode(e.to)).filter((n) => n !== null);
19302
19308
  if (sols.every((s) => isAutoMinted(s))) {
19303
19309
  const solId = `dfix_${digest({ problemId, fix: fixNote })}`.slice(0, 56);
@@ -22133,6 +22139,7 @@ __export(src_exports2, {
22133
22139
  induceTriage: () => induceTriage,
22134
22140
  ingestDesignProblem: () => ingestDesignProblem,
22135
22141
  isConstraintProblem: () => isConstraintProblem,
22142
+ isFragmentFixNote: () => isFragmentFixNote,
22136
22143
  isPlaceholderStatement: () => isPlaceholderStatement,
22137
22144
  isUnfilledPlaceholder: () => isUnfilledPlaceholder,
22138
22145
  linkProblemToLanguages: () => linkProblemToLanguages,
@@ -47578,9 +47585,18 @@ function currentOsName() {
47578
47585
  }
47579
47586
  function extractExecutables(command) {
47580
47587
  const out2 = [];
47581
- for (const segment of command.split(SEGMENT_SPLIT)) {
47588
+ outer: for (const segment of command.split(SEGMENT_SPLIT)) {
47582
47589
  const tokens = segment.trim().split(/\s+/);
47583
47590
  let i2 = 0;
47591
+ while (i2 < tokens.length) {
47592
+ const t = tokens[i2];
47593
+ if (SHELL_HEADERS.has(t)) continue outer;
47594
+ if (SHELL_CONNECTORS.has(t) || SHELL_CONDITIONS.has(t)) {
47595
+ i2++;
47596
+ continue;
47597
+ }
47598
+ break;
47599
+ }
47584
47600
  while (i2 < tokens.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[i2])) i2++;
47585
47601
  let steps = 0;
47586
47602
  while (i2 < tokens.length && steps < 3) {
@@ -47657,7 +47673,7 @@ function observeCommandTools(store, command, ts) {
47657
47673
  }
47658
47674
  return result;
47659
47675
  }
47660
- var PUBLIC_TOOLS, PLUMBING, PASSTHROUGH, SEGMENT_SPLIT;
47676
+ var PUBLIC_TOOLS, PLUMBING, PASSTHROUGH, SEGMENT_SPLIT, SHELL_CONNECTORS, SHELL_CONDITIONS, SHELL_HEADERS;
47661
47677
  var init_tool_index = __esm({
47662
47678
  "src/tool-index.ts"() {
47663
47679
  "use strict";
@@ -47692,6 +47708,23 @@ var init_tool_index = __esm({
47692
47708
  ]);
47693
47709
  PASSTHROUGH = /* @__PURE__ */ new Set(["sudo", "npx", "pnpx", "bunx", "uvx", "time", "nohup", "xargs", "watch"]);
47694
47710
  SEGMENT_SPLIT = /\|\|?|&&|;|\r?\n/;
47711
+ SHELL_CONNECTORS = /* @__PURE__ */ new Set([
47712
+ "do",
47713
+ "done",
47714
+ "then",
47715
+ "else",
47716
+ "fi",
47717
+ "esac",
47718
+ "in",
47719
+ "function",
47720
+ "coproc",
47721
+ "time",
47722
+ "!",
47723
+ "{",
47724
+ "}"
47725
+ ]);
47726
+ SHELL_CONDITIONS = /* @__PURE__ */ new Set(["while", "until", "if", "elif"]);
47727
+ SHELL_HEADERS = /* @__PURE__ */ new Set(["for", "case", "select"]);
47695
47728
  }
47696
47729
  });
47697
47730
 
@@ -48095,7 +48128,12 @@ function buildWebUi(deps) {
48095
48128
  });
48096
48129
  try {
48097
48130
  const observed = observeCommandTools(deps.store, input["command"], Date.now());
48098
- deps.onToolsObserved?.(String(body2["session_id"] ?? ""), observed.nodeIds);
48131
+ const toolSid = String(body2["session_id"] ?? "");
48132
+ if (observed.nodeIds.length > 0 && !loggedToolSessions.has(toolSid)) {
48133
+ loggedToolSessions.add(toolSid);
48134
+ console.log(`[errata] tool-run recorded: session ${toolSid.slice(0, 8) || "(empty)"} +${observed.nodeIds.length}`);
48135
+ }
48136
+ deps.onToolsObserved?.(toolSid, observed.nodeIds);
48099
48137
  } catch {
48100
48138
  }
48101
48139
  if (failed) recallCtx = recallForError(deps.store, stderr || combined);
@@ -48399,7 +48437,7 @@ function proposalToIngest(p, profile, daemonVersion) {
48399
48437
  payloadDigest: p.id
48400
48438
  };
48401
48439
  }
48402
- var wsPackagesCache, WS_PACKAGES_TTL_MS, META_LABELS;
48440
+ var wsPackagesCache, WS_PACKAGES_TTL_MS, loggedToolSessions, META_LABELS;
48403
48441
  var init_webui = __esm({
48404
48442
  "src/webui.ts"() {
48405
48443
  "use strict";
@@ -48413,6 +48451,7 @@ var init_webui = __esm({
48413
48451
  init_outbox();
48414
48452
  wsPackagesCache = /* @__PURE__ */ new WeakMap();
48415
48453
  WS_PACKAGES_TTL_MS = 6e4;
48454
+ loggedToolSessions = /* @__PURE__ */ new Set();
48416
48455
  META_LABELS = /* @__PURE__ */ new Set([
48417
48456
  "Pattern",
48418
48457
  "Technique",
@@ -51603,9 +51642,12 @@ function fixRationaleBefore(sentence, idx) {
51603
51642
  }
51604
51643
  function fixRationaleAfter(sentence, endIdx) {
51605
51644
  const win = sentence.slice(endIdx, endIdx + FIX_RATIONALE_WINDOW).replace(new RegExp(CITE_GROUP_RE.source, "g"), " ").replace(new RegExp(FLAG_RE.source, "g"), " ");
51645
+ if (/^\s*[)\]}]/.test(win)) return "";
51606
51646
  const stripped = win.replace(/^[\s—:–,-]+/, "");
51607
51647
  const m = /^[^.;!?—]*/.exec(stripped);
51608
- return (m ? m[0] : stripped).replace(/\s+/g, " ").trim();
51648
+ const clause = (m ? m[0] : stripped).replace(/\s+/g, " ").trim();
51649
+ if (/^(and|but|or|nor|so|yet|also|plus)\b/i.test(clause)) return "";
51650
+ return clause;
51609
51651
  }
51610
51652
  function deriveFixRationale(sentence, startIdx, endIdx) {
51611
51653
  const before = fixRationaleBefore(sentence, startIdx);
@@ -53852,6 +53894,9 @@ function createToolRunState() {
53852
53894
  },
53853
53895
  get(sessionId) {
53854
53896
  return bySession.get(sessionId) ?? /* @__PURE__ */ new Set();
53897
+ },
53898
+ sessions() {
53899
+ return bySession.size;
53855
53900
  }
53856
53901
  };
53857
53902
  }
@@ -54374,7 +54419,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54374
54419
  }
54375
54420
 
54376
54421
  // src/engine.ts
54377
- var DAEMON_VERSION = true ? "2.0.2-dev.556" : "2.0.0-alpha.0";
54422
+ var DAEMON_VERSION = true ? "2.0.2-dev.560" : "2.0.0-alpha.0";
54378
54423
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54379
54424
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54380
54425
  var GIT_OP_MUTE_MS = 4e3;
@@ -55584,6 +55629,10 @@ function createWorkspaceEngine(opts) {
55584
55629
  corroboratedEdges,
55585
55630
  touchedFileTurns,
55586
55631
  touchedToolTurns,
55632
+ // Seam diagnostic: sessions holding tool-run records at harvest time.
55633
+ // touchedToolTurns 0 with this >0 = the hook and harvest disagree on
55634
+ // the session key; 0 with 0 = records never happen.
55635
+ toolSessionsTracked: toolRuns.sessions(),
55587
55636
  seqAdvanced: store.currentIngestSeq() - seqAtStart
55588
55637
  });
55589
55638
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.556",
3
+ "version": "2.0.2-dev.560",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {