@inerrata-corporation/errata 2.0.2-dev.554 → 2.0.2-dev.558
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 +75 -20
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -47578,9 +47578,18 @@ function currentOsName() {
|
|
|
47578
47578
|
}
|
|
47579
47579
|
function extractExecutables(command) {
|
|
47580
47580
|
const out2 = [];
|
|
47581
|
-
for (const segment of command.split(SEGMENT_SPLIT)) {
|
|
47581
|
+
outer: for (const segment of command.split(SEGMENT_SPLIT)) {
|
|
47582
47582
|
const tokens = segment.trim().split(/\s+/);
|
|
47583
47583
|
let i2 = 0;
|
|
47584
|
+
while (i2 < tokens.length) {
|
|
47585
|
+
const t = tokens[i2];
|
|
47586
|
+
if (SHELL_HEADERS.has(t)) continue outer;
|
|
47587
|
+
if (SHELL_CONNECTORS.has(t) || SHELL_CONDITIONS.has(t)) {
|
|
47588
|
+
i2++;
|
|
47589
|
+
continue;
|
|
47590
|
+
}
|
|
47591
|
+
break;
|
|
47592
|
+
}
|
|
47584
47593
|
while (i2 < tokens.length && /^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[i2])) i2++;
|
|
47585
47594
|
let steps = 0;
|
|
47586
47595
|
while (i2 < tokens.length && steps < 3) {
|
|
@@ -47657,7 +47666,7 @@ function observeCommandTools(store, command, ts) {
|
|
|
47657
47666
|
}
|
|
47658
47667
|
return result;
|
|
47659
47668
|
}
|
|
47660
|
-
var PUBLIC_TOOLS, PLUMBING, PASSTHROUGH, SEGMENT_SPLIT;
|
|
47669
|
+
var PUBLIC_TOOLS, PLUMBING, PASSTHROUGH, SEGMENT_SPLIT, SHELL_CONNECTORS, SHELL_CONDITIONS, SHELL_HEADERS;
|
|
47661
47670
|
var init_tool_index = __esm({
|
|
47662
47671
|
"src/tool-index.ts"() {
|
|
47663
47672
|
"use strict";
|
|
@@ -47692,6 +47701,23 @@ var init_tool_index = __esm({
|
|
|
47692
47701
|
]);
|
|
47693
47702
|
PASSTHROUGH = /* @__PURE__ */ new Set(["sudo", "npx", "pnpx", "bunx", "uvx", "time", "nohup", "xargs", "watch"]);
|
|
47694
47703
|
SEGMENT_SPLIT = /\|\|?|&&|;|\r?\n/;
|
|
47704
|
+
SHELL_CONNECTORS = /* @__PURE__ */ new Set([
|
|
47705
|
+
"do",
|
|
47706
|
+
"done",
|
|
47707
|
+
"then",
|
|
47708
|
+
"else",
|
|
47709
|
+
"fi",
|
|
47710
|
+
"esac",
|
|
47711
|
+
"in",
|
|
47712
|
+
"function",
|
|
47713
|
+
"coproc",
|
|
47714
|
+
"time",
|
|
47715
|
+
"!",
|
|
47716
|
+
"{",
|
|
47717
|
+
"}"
|
|
47718
|
+
]);
|
|
47719
|
+
SHELL_CONDITIONS = /* @__PURE__ */ new Set(["while", "until", "if", "elif"]);
|
|
47720
|
+
SHELL_HEADERS = /* @__PURE__ */ new Set(["for", "case", "select"]);
|
|
47695
47721
|
}
|
|
47696
47722
|
});
|
|
47697
47723
|
|
|
@@ -48095,7 +48121,12 @@ function buildWebUi(deps) {
|
|
|
48095
48121
|
});
|
|
48096
48122
|
try {
|
|
48097
48123
|
const observed = observeCommandTools(deps.store, input["command"], Date.now());
|
|
48098
|
-
|
|
48124
|
+
const toolSid = String(body2["session_id"] ?? "");
|
|
48125
|
+
if (observed.nodeIds.length > 0 && !loggedToolSessions.has(toolSid)) {
|
|
48126
|
+
loggedToolSessions.add(toolSid);
|
|
48127
|
+
console.log(`[errata] tool-run recorded: session ${toolSid.slice(0, 8) || "(empty)"} +${observed.nodeIds.length}`);
|
|
48128
|
+
}
|
|
48129
|
+
deps.onToolsObserved?.(toolSid, observed.nodeIds);
|
|
48099
48130
|
} catch {
|
|
48100
48131
|
}
|
|
48101
48132
|
if (failed) recallCtx = recallForError(deps.store, stderr || combined);
|
|
@@ -48399,7 +48430,7 @@ function proposalToIngest(p, profile, daemonVersion) {
|
|
|
48399
48430
|
payloadDigest: p.id
|
|
48400
48431
|
};
|
|
48401
48432
|
}
|
|
48402
|
-
var wsPackagesCache, WS_PACKAGES_TTL_MS, META_LABELS;
|
|
48433
|
+
var wsPackagesCache, WS_PACKAGES_TTL_MS, loggedToolSessions, META_LABELS;
|
|
48403
48434
|
var init_webui = __esm({
|
|
48404
48435
|
"src/webui.ts"() {
|
|
48405
48436
|
"use strict";
|
|
@@ -48413,6 +48444,7 @@ var init_webui = __esm({
|
|
|
48413
48444
|
init_outbox();
|
|
48414
48445
|
wsPackagesCache = /* @__PURE__ */ new WeakMap();
|
|
48415
48446
|
WS_PACKAGES_TTL_MS = 6e4;
|
|
48447
|
+
loggedToolSessions = /* @__PURE__ */ new Set();
|
|
48416
48448
|
META_LABELS = /* @__PURE__ */ new Set([
|
|
48417
48449
|
"Pattern",
|
|
48418
48450
|
"Technique",
|
|
@@ -53852,6 +53884,9 @@ function createToolRunState() {
|
|
|
53852
53884
|
},
|
|
53853
53885
|
get(sessionId) {
|
|
53854
53886
|
return bySession.get(sessionId) ?? /* @__PURE__ */ new Set();
|
|
53887
|
+
},
|
|
53888
|
+
sessions() {
|
|
53889
|
+
return bySession.size;
|
|
53855
53890
|
}
|
|
53856
53891
|
};
|
|
53857
53892
|
}
|
|
@@ -54374,7 +54409,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
54374
54409
|
}
|
|
54375
54410
|
|
|
54376
54411
|
// src/engine.ts
|
|
54377
|
-
var DAEMON_VERSION = true ? "2.0.2-dev.
|
|
54412
|
+
var DAEMON_VERSION = true ? "2.0.2-dev.558" : "2.0.0-alpha.0";
|
|
54378
54413
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
54379
54414
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
54380
54415
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -55584,6 +55619,10 @@ function createWorkspaceEngine(opts) {
|
|
|
55584
55619
|
corroboratedEdges,
|
|
55585
55620
|
touchedFileTurns,
|
|
55586
55621
|
touchedToolTurns,
|
|
55622
|
+
// Seam diagnostic: sessions holding tool-run records at harvest time.
|
|
55623
|
+
// touchedToolTurns 0 with this >0 = the hook and harvest disagree on
|
|
55624
|
+
// the session key; 0 with 0 = records never happen.
|
|
55625
|
+
toolSessionsTracked: toolRuns.sessions(),
|
|
55587
55626
|
seqAdvanced: store.currentIngestSeq() - seqAtStart
|
|
55588
55627
|
});
|
|
55589
55628
|
}
|
|
@@ -56637,7 +56676,8 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
56637
56676
|
for (const label of INSTANCE_LABELS) {
|
|
56638
56677
|
const ref = [];
|
|
56639
56678
|
includedByLabel.set(label, ref);
|
|
56640
|
-
|
|
56679
|
+
const population = label === "RootCause" && opts.sharedStore ? [...store.findNodesByLabel(label), ...opts.sharedStore.findNodesByLabel(label)] : store.findNodesByLabel(label);
|
|
56680
|
+
for (const n of population) {
|
|
56641
56681
|
if (seen.has(n.id)) continue;
|
|
56642
56682
|
if (n.attrs["source"] === "cloud") continue;
|
|
56643
56683
|
if (label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) continue;
|
|
@@ -56772,10 +56812,17 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
56772
56812
|
const edges = [];
|
|
56773
56813
|
const semanticEdgeDigests = {};
|
|
56774
56814
|
for (const [sourceId, wireFrom] of semanticEndpoints) {
|
|
56775
|
-
const
|
|
56815
|
+
const rawOuts = [
|
|
56816
|
+
...store.outEdges(sourceId, [...INSTANCE_EDGES]),
|
|
56817
|
+
...opts.sharedStore?.outEdges(sourceId, [...INSTANCE_EDGES]) ?? []
|
|
56818
|
+
];
|
|
56819
|
+
const dedup = /* @__PURE__ */ new Map();
|
|
56820
|
+
for (const e of rawOuts) dedup.set(`${e.type}>${e.to}`, e);
|
|
56821
|
+
const outs = [...dedup.values()].map((e) => ({ e, wireTo: semanticEndpoints.get(e.to) })).filter((x) => x.wireTo != null);
|
|
56776
56822
|
if (outs.length === 0) continue;
|
|
56777
56823
|
const dg = digest(outs.map(({ e, wireTo }) => `${e.type}>${wireTo}`).sort());
|
|
56778
|
-
|
|
56824
|
+
const owner = store.getNode(sourceId) ?? opts.sharedStore?.getNode(sourceId);
|
|
56825
|
+
if (owner?.attrs["semanticEdgesContributedDigest"] === dg) continue;
|
|
56779
56826
|
semanticEdgeDigests[sourceId] = dg;
|
|
56780
56827
|
for (const { e, wireTo } of outs) edges.push({ ...e, from: wireFrom, to: wireTo, attrs: {} });
|
|
56781
56828
|
}
|
|
@@ -58092,6 +58139,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
58092
58139
|
const instances = buildInstanceIngest(store, r.engine.profile, DAEMON_VERSION, ignore, {
|
|
58093
58140
|
includePackages: cfg2.consent.contributePackages,
|
|
58094
58141
|
workspaceRoot: r.root,
|
|
58142
|
+
sharedStore,
|
|
58095
58143
|
...lexicon ? { lexicon } : {},
|
|
58096
58144
|
...project ? { project } : {}
|
|
58097
58145
|
});
|
|
@@ -58115,31 +58163,38 @@ async function startMultiDaemon(opts = {}) {
|
|
|
58115
58163
|
const cloudIdByLocal = new Map(
|
|
58116
58164
|
res.result.nodes.filter((rn) => rn.nodeId).map((rn) => [rn.canonicalId, rn.nodeId])
|
|
58117
58165
|
);
|
|
58166
|
+
const owningStore = (id) => {
|
|
58167
|
+
const w = store.getNode(id);
|
|
58168
|
+
if (w) return { s: store, n: w };
|
|
58169
|
+
const sh = sharedStore.getNode(id);
|
|
58170
|
+
if (sh) return { s: sharedStore, n: sh };
|
|
58171
|
+
return null;
|
|
58172
|
+
};
|
|
58118
58173
|
for (const n of instances.nodes) {
|
|
58119
|
-
const
|
|
58120
|
-
if (!
|
|
58174
|
+
const owner = owningStore(n.id);
|
|
58175
|
+
if (!owner || !["Problem", "Solution", "RootCause"].includes(owner.n.label)) continue;
|
|
58121
58176
|
if (blocked.has(n.id)) continue;
|
|
58122
58177
|
const cloudNodeId = cloudIdByLocal.get(n.id);
|
|
58123
|
-
|
|
58178
|
+
owner.s.updateNode(n.id, {
|
|
58124
58179
|
attrs: {
|
|
58125
|
-
...
|
|
58180
|
+
...owner.n.attrs,
|
|
58126
58181
|
contributedAtSeq: seq,
|
|
58127
58182
|
...cloudNodeId && cloudNodeId !== n.id ? { cloudNodeId } : {}
|
|
58128
58183
|
}
|
|
58129
58184
|
});
|
|
58130
58185
|
}
|
|
58131
58186
|
for (const [localId, dg] of Object.entries(instances.anchorDigests)) {
|
|
58132
|
-
const
|
|
58133
|
-
if (!
|
|
58134
|
-
|
|
58135
|
-
attrs: { ...
|
|
58187
|
+
const owner = owningStore(localId);
|
|
58188
|
+
if (!owner) continue;
|
|
58189
|
+
owner.s.updateNode(localId, {
|
|
58190
|
+
attrs: { ...owner.n.attrs, anchorsContributedDigest: dg }
|
|
58136
58191
|
});
|
|
58137
58192
|
}
|
|
58138
58193
|
for (const [localId, dg] of Object.entries(instances.semanticEdgeDigests)) {
|
|
58139
|
-
const
|
|
58140
|
-
if (!
|
|
58141
|
-
|
|
58142
|
-
attrs: { ...
|
|
58194
|
+
const owner = owningStore(localId);
|
|
58195
|
+
if (!owner) continue;
|
|
58196
|
+
owner.s.updateNode(localId, {
|
|
58197
|
+
attrs: { ...owner.n.attrs, semanticEdgesContributedDigest: dg }
|
|
58143
58198
|
});
|
|
58144
58199
|
}
|
|
58145
58200
|
return res.accepted;
|