@inerrata-corporation/errata 2.0.2-dev.606 → 2.0.2-dev.612

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 +53 -2
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -47833,6 +47833,15 @@ function extractExecutables(command) {
47833
47833
  }
47834
47834
  return out2;
47835
47835
  }
47836
+ function commandToolNodeIds(command) {
47837
+ const out2 = [];
47838
+ for (const name2 of extractExecutables(command)) {
47839
+ if (!PUBLIC_TOOLS.has(name2)) continue;
47840
+ if (PLUMBING.has(name2)) continue;
47841
+ out2.push(toolNodeId(name2));
47842
+ }
47843
+ return out2;
47844
+ }
47836
47845
  function observeCommandTools(store, command, ts) {
47837
47846
  const result = { minted: [], reinforced: [], nodeIds: [] };
47838
47847
  const osName = currentOsName();
@@ -51728,6 +51737,7 @@ function parseAssistantTurns(raw2, includeThinking) {
51728
51737
  }
51729
51738
  if (obj.type !== "assistant" || !Array.isArray(obj.message?.content)) continue;
51730
51739
  const parts2 = [];
51740
+ const commands = [];
51731
51741
  for (const b of obj.message.content) {
51732
51742
  if (b["type"] === "text" && typeof b["text"] === "string") parts2.push(b["text"]);
51733
51743
  else if (includeThinking && b["type"] === "thinking" && typeof b["thinking"] === "string")
@@ -51744,6 +51754,10 @@ function parseAssistantTurns(raw2, includeThinking) {
51744
51754
  editedFileTurnSeq = turnSeq;
51745
51755
  }
51746
51756
  }
51757
+ } else if (b["type"] === "tool_use" && b["name"] === "Bash") {
51758
+ const input = b["input"];
51759
+ const cmd2 = input && typeof input === "object" ? input["command"] : void 0;
51760
+ if (typeof cmd2 === "string" && cmd2) commands.push(cmd2);
51747
51761
  }
51748
51762
  }
51749
51763
  const provenance = lastFile ? lastFileTurnSeq === turnSeq ? lastFileIsWrite ? "edited" : "read" : "carried" : void 0;
@@ -51752,7 +51766,8 @@ function parseAssistantTurns(raw2, includeThinking) {
51752
51766
  text: parts2.join("\n\n"),
51753
51767
  ...lastFile ? { workingFile: lastFile } : {},
51754
51768
  ...provenance ? { workingFileProvenance: provenance } : {},
51755
- ...editedFile && editedFileTurnSeq === turnSeq ? { editedFile } : {}
51769
+ ...editedFile && editedFileTurnSeq === turnSeq ? { editedFile } : {},
51770
+ ...commands.length > 0 ? { commands } : {}
51756
51771
  });
51757
51772
  }
51758
51773
  return turns;
@@ -52172,6 +52187,19 @@ var TIEBREAK = [
52172
52187
  { re: /same (issue|problem|pattern|root cause) as|instance of|an example of/i, type: "INSTANCE_OF" },
52173
52188
  { re: /depends on|requires|relies on/i, type: "DEPENDS_ON" }
52174
52189
  ];
52190
+ function packageName(description) {
52191
+ const at = description.lastIndexOf("@");
52192
+ return at > 0 ? description.slice(0, at) : description;
52193
+ }
52194
+ function fileImportsPackage(store, fileId, pkg) {
52195
+ for (const e of store.outEdges(fileId, ["IMPORTS"])) {
52196
+ const spec = store.getNode(e.to)?.description;
52197
+ if (!spec || spec.startsWith(".") || spec.startsWith("/")) continue;
52198
+ const specPkg = spec.startsWith("@") ? spec.split("/").slice(0, 2).join("/") : spec.split("/")[0];
52199
+ if (specPkg === pkg) return true;
52200
+ }
52201
+ return false;
52202
+ }
52175
52203
  function tagEdgeCorroborated(targetAnchorIds, sessionTouchedNodeIds, independentReassert = false) {
52176
52204
  if (independentReassert) return true;
52177
52205
  for (const a of targetAnchorIds) if (sessionTouchedNodeIds.has(a)) return true;
@@ -52237,6 +52265,18 @@ function mintPriorEdge(store, source, target, sentence, touched, ts) {
52237
52265
  if (anchorIds.size === 0 && (target.label === "Language" || target.label === "Package")) {
52238
52266
  for (const e of store.inEdges(target.id, STACK_GROUNDING_EDGES)) anchorIds.add(e.from);
52239
52267
  }
52268
+ if ((target.label === "Language" || target.label === "Package") && target.description) {
52269
+ const targetName = target.description;
52270
+ for (const tid of touched) {
52271
+ const tn = store.getNode(tid);
52272
+ if (tn?.label !== "File") continue;
52273
+ const grounded = target.label === "Language" ? String(tn.attrs["language"] ?? "").toLowerCase() === targetName.toLowerCase() : fileImportsPackage(store, tid, packageName(targetName));
52274
+ if (grounded) {
52275
+ anchorIds.add(tid);
52276
+ break;
52277
+ }
52278
+ }
52279
+ }
52240
52280
  if (anchorIds.size === 0 && target.label === "Tool") anchorIds.add(target.id);
52241
52281
  const corroborated = tagEdgeCorroborated(anchorIds, touched, false);
52242
52282
  store.mergeEdge({
@@ -54126,6 +54166,7 @@ function createToolRunState() {
54126
54166
  }
54127
54167
 
54128
54168
  // src/engine.ts
54169
+ init_tool_index();
54129
54170
  init_paths();
54130
54171
 
54131
54172
  // src/profile.ts
@@ -54644,7 +54685,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
54644
54685
  }
54645
54686
 
54646
54687
  // src/engine.ts
54647
- var DAEMON_VERSION = true ? "2.0.2-dev.606" : "2.0.0-alpha.0";
54688
+ var DAEMON_VERSION = true ? "2.0.2-dev.612" : "2.0.0-alpha.0";
54648
54689
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
54649
54690
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
54650
54691
  var GIT_OP_MUTE_MS = 4e3;
@@ -55476,6 +55517,10 @@ function createWorkspaceEngine(opts) {
55476
55517
  }
55477
55518
  try {
55478
55519
  const touchedFileId = turnFile ? resolveFileId(turnFile) : void 0;
55520
+ if (turn.commands) {
55521
+ const ids = turn.commands.flatMap(commandToolNodeIds);
55522
+ if (ids.length > 0) toolRuns.record(sessionId, ids);
55523
+ }
55479
55524
  const touched = new Set(toolRuns.get(sessionId));
55480
55525
  if (touchedFileId) touched.add(touchedFileId);
55481
55526
  for (const fence of parseIntentFences(turn.text)) {
@@ -57826,6 +57871,12 @@ async function startMultiDaemon(opts = {}) {
57826
57871
  onHook: engine.webHooks.onHook,
57827
57872
  onHookEvent: engine.webHooks.onHookEvent,
57828
57873
  onShellEvent: engine.webHooks.onShellEvent,
57874
+ // The tool-run RECORD seam (SP-tool-ground). The single-engine path wired
57875
+ // this in #1172; this sibling builder never did, so on every multi
57876
+ // deployment (i.e. every real one) the webui logged "tool-run recorded"
57877
+ // and dropped the record on the floor — toolSessionsTracked read 0 across
57878
+ // 936 turns while the log showed records landing (VS-corroboration-rate).
57879
+ onToolsObserved: engine.webHooks.onToolsObserved,
57829
57880
  onToolError: engine.webHooks.onToolError,
57830
57881
  onDiagnostics: engine.webHooks.onDiagnostics,
57831
57882
  onTurn: engine.webHooks.onTurn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.606",
3
+ "version": "2.0.2-dev.612",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {