@inerrata-corporation/errata 2.0.1-dev.102 → 2.0.1-dev.103
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 +65 -2
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -51664,7 +51664,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
51664
51664
|
}
|
|
51665
51665
|
|
|
51666
51666
|
// src/engine.ts
|
|
51667
|
-
var DAEMON_VERSION = true ? "2.0.1-dev.
|
|
51667
|
+
var DAEMON_VERSION = true ? "2.0.1-dev.103" : "2.0.0-alpha.0";
|
|
51668
51668
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
51669
51669
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
51670
51670
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -53546,6 +53546,46 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53546
53546
|
return { ...base, payloadDigest: digest(base), anchorDigests };
|
|
53547
53547
|
}
|
|
53548
53548
|
|
|
53549
|
+
// src/backfill-edges.ts
|
|
53550
|
+
init_src();
|
|
53551
|
+
init_src2();
|
|
53552
|
+
var CAUSAL_LABELS = ["Problem", "Solution", "RootCause"];
|
|
53553
|
+
var CAUSAL_EDGES2 = ["SOLVED_BY", "CAUSED_BY", "FIXED_BY"];
|
|
53554
|
+
function cloudWireId(store, id) {
|
|
53555
|
+
const n = store.getNode(id);
|
|
53556
|
+
if (!n || !CAUSAL_LABELS.includes(n.label)) return null;
|
|
53557
|
+
if (n.label === "Problem" && n.attrs["resolvedAs"] === PROBLEM_RESOLUTION.FALSE_POSITIVE) return null;
|
|
53558
|
+
const cloudNodeId = n.attrs["cloudNodeId"];
|
|
53559
|
+
if (typeof cloudNodeId === "string" && cloudNodeId.length > 0) return cloudNodeId;
|
|
53560
|
+
if (n.attrs["source"] === "cloud") return n.id;
|
|
53561
|
+
return typeof n.attrs["contributedAtSeq"] === "number" ? n.id : null;
|
|
53562
|
+
}
|
|
53563
|
+
function buildCausalEdgeBackfill(store, profile, daemonVersion) {
|
|
53564
|
+
const edges = [];
|
|
53565
|
+
const seenEdge = /* @__PURE__ */ new Set();
|
|
53566
|
+
for (const label of CAUSAL_LABELS) {
|
|
53567
|
+
for (const n of store.findNodesByLabel(label)) {
|
|
53568
|
+
for (const e of store.outEdges(n.id, [...CAUSAL_EDGES2])) {
|
|
53569
|
+
if (seenEdge.has(e.id)) continue;
|
|
53570
|
+
seenEdge.add(e.id);
|
|
53571
|
+
const from = cloudWireId(store, e.from);
|
|
53572
|
+
const to = cloudWireId(store, e.to);
|
|
53573
|
+
if (!from || !to) continue;
|
|
53574
|
+
edges.push({ ...e, from, to, attrs: {} });
|
|
53575
|
+
}
|
|
53576
|
+
}
|
|
53577
|
+
}
|
|
53578
|
+
if (edges.length === 0) return null;
|
|
53579
|
+
const base = {
|
|
53580
|
+
daemonVersion,
|
|
53581
|
+
profile: { stack: profile.stack, languages: profile.languages, domains: profile.domains },
|
|
53582
|
+
originProject: profile.id,
|
|
53583
|
+
nodes: [],
|
|
53584
|
+
edges
|
|
53585
|
+
};
|
|
53586
|
+
return { ...base, payloadDigest: digest(base) };
|
|
53587
|
+
}
|
|
53588
|
+
|
|
53549
53589
|
// src/multi.ts
|
|
53550
53590
|
init_generalize_graph();
|
|
53551
53591
|
init_symbol_summaries();
|
|
@@ -54631,6 +54671,28 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54631
54671
|
}
|
|
54632
54672
|
return { uploaded, ...errors.length > 0 ? { errors } : {} };
|
|
54633
54673
|
},
|
|
54674
|
+
async backfillCausalEdges() {
|
|
54675
|
+
if (!loadConfig().consent.sync) return { accepted: 0, rejected: 0, skipped: "consent-off" };
|
|
54676
|
+
const client = cloudNow();
|
|
54677
|
+
let accepted = 0;
|
|
54678
|
+
let rejected = 0;
|
|
54679
|
+
const errors = [];
|
|
54680
|
+
for (const r of records) {
|
|
54681
|
+
const payload = buildCausalEdgeBackfill(r.engine.store, r.engine.profile, DAEMON_VERSION);
|
|
54682
|
+
if (!payload) continue;
|
|
54683
|
+
try {
|
|
54684
|
+
const res = await client.ingest(payload);
|
|
54685
|
+
accepted += res.accepted;
|
|
54686
|
+
rejected += res.rejected;
|
|
54687
|
+
if (res.rejected > 0) errors.push(...res.violations.slice(0, 5));
|
|
54688
|
+
} catch (err2) {
|
|
54689
|
+
errors.push(
|
|
54690
|
+
`[${r.engine.profile.name ?? r.engine.profile.id}] backfill: ${err2 instanceof Error ? err2.message : String(err2)}`
|
|
54691
|
+
);
|
|
54692
|
+
}
|
|
54693
|
+
}
|
|
54694
|
+
return { accepted, rejected, ...errors.length > 0 ? { errors } : {} };
|
|
54695
|
+
},
|
|
54634
54696
|
async pullTriagePublic() {
|
|
54635
54697
|
if (!loadConfig().consent.sync) return { merged: 0, skipped: "consent-off" };
|
|
54636
54698
|
const stack = /* @__PURE__ */ new Set();
|
|
@@ -54715,7 +54777,8 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54715
54777
|
const principles = await daemon.syncPrinciplesPublic();
|
|
54716
54778
|
const triage = await daemon.syncTriagePublic();
|
|
54717
54779
|
const instances = await daemon.syncInstancesPublic();
|
|
54718
|
-
|
|
54780
|
+
const edgeBackfill = await daemon.backfillCausalEdges();
|
|
54781
|
+
return c.json({ principles, triage, instances, edgeBackfill });
|
|
54719
54782
|
} catch (err2) {
|
|
54720
54783
|
return c.json({ error: err2 instanceof Error ? err2.message : String(err2) }, 500);
|
|
54721
54784
|
}
|