@inerrata-corporation/errata 2.0.1-dev.103 → 2.0.1-dev.47
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 +9 -92
- package/package.json +1 -1
package/errata.mjs
CHANGED
|
@@ -21851,14 +21851,8 @@ var init_client = __esm({
|
|
|
21851
21851
|
* the per-decision response into flush accounting.
|
|
21852
21852
|
*
|
|
21853
21853
|
* The v1 door caps a payload at `MAX_NODES_PER_PAYLOAD` / `MAX_EDGES_PER_PAYLOAD`
|
|
21854
|
-
* (413 over). A batch above the cap is split and drained across calls
|
|
21855
|
-
* NODE chunk first (edges empty), then EDGE chunks (nodes empty).
|
|
21856
|
-
* gets its OWN runId: the door's durable idempotency claim is keyed on
|
|
21857
|
-
* (agent, org, runId) with the payload digest, so reusing one runId across
|
|
21858
|
-
* different chunk payloads 409s "runId was already used with a different
|
|
21859
|
-
* payload" on the second chunk — exactly how the first real >25-node drain
|
|
21860
|
-
* died (2026-07-22). The runId never grouped anything server-side; it exists
|
|
21861
|
-
* for duplicate-POST protection, which is per-request by nature.
|
|
21854
|
+
* (413 over). A batch above the cap is split and drained across calls under ONE
|
|
21855
|
+
* runId: every NODE chunk first (edges empty), then EDGE chunks (nodes empty).
|
|
21862
21856
|
* Recognition resolves an edge's endpoints against nodes already ingested this
|
|
21863
21857
|
* drain (endpoint-label validation is deferred to the service when an endpoint
|
|
21864
21858
|
* isn't in-payload), so the split never orphans an edge. Sub-results concat into
|
|
@@ -21871,7 +21865,6 @@ var init_client = __esm({
|
|
|
21871
21865
|
}
|
|
21872
21866
|
const merged = { runId, nodes: [], edges: [] };
|
|
21873
21867
|
let pendingEdges = [...batch.edges];
|
|
21874
|
-
const echoedCloudId = /* @__PURE__ */ new Map();
|
|
21875
21868
|
for (const nodeChunk of chunkArray(batch.nodes, INGEST_NODE_CHUNK)) {
|
|
21876
21869
|
const ids = new Set(nodeChunk.map((n) => n.id));
|
|
21877
21870
|
const inChunk = pendingEdges.filter((e) => ids.has(e.from) && ids.has(e.to)).slice(0, MAX_EDGES_PER_PAYLOAD);
|
|
@@ -21879,23 +21872,15 @@ var init_client = __esm({
|
|
|
21879
21872
|
const shipped = new Set(inChunk);
|
|
21880
21873
|
pendingEdges = pendingEdges.filter((e) => !shipped.has(e));
|
|
21881
21874
|
}
|
|
21882
|
-
const r = await this.ingestWire(toWirePayload({ ...batch, nodes: nodeChunk, edges: inChunk },
|
|
21875
|
+
const r = await this.ingestWire(toWirePayload({ ...batch, nodes: nodeChunk, edges: inChunk }, runId));
|
|
21883
21876
|
merged.nodes.push(...r.nodes);
|
|
21884
21877
|
merged.edges.push(...r.edges);
|
|
21885
|
-
for (const rn of r.nodes) {
|
|
21886
|
-
if (rn.nodeId && rn.nodeId !== rn.canonicalId) echoedCloudId.set(rn.canonicalId, rn.nodeId);
|
|
21887
|
-
}
|
|
21888
21878
|
if (r.patternReconciliation) {
|
|
21889
21879
|
merged.patternReconciliation = { ...merged.patternReconciliation, ...r.patternReconciliation };
|
|
21890
21880
|
}
|
|
21891
21881
|
}
|
|
21892
21882
|
for (const edgeChunk of chunkArray(pendingEdges, MAX_EDGES_PER_PAYLOAD)) {
|
|
21893
|
-
const
|
|
21894
|
-
...e,
|
|
21895
|
-
from: echoedCloudId.get(e.from) ?? e.from,
|
|
21896
|
-
to: echoedCloudId.get(e.to) ?? e.to
|
|
21897
|
-
}));
|
|
21898
|
-
const r = await this.ingestWire(toWirePayload({ ...batch, nodes: [], edges: rewritten }, randomUUID()));
|
|
21883
|
+
const r = await this.ingestWire(toWirePayload({ ...batch, nodes: [], edges: edgeChunk }, runId));
|
|
21899
21884
|
merged.edges.push(...r.edges);
|
|
21900
21885
|
}
|
|
21901
21886
|
return { ...summarizeIngestResult(merged), result: merged };
|
|
@@ -51664,7 +51649,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
51664
51649
|
}
|
|
51665
51650
|
|
|
51666
51651
|
// src/engine.ts
|
|
51667
|
-
var DAEMON_VERSION = true ? "2.0.1-dev.
|
|
51652
|
+
var DAEMON_VERSION = true ? "2.0.1-dev.47" : "2.0.0-alpha.0";
|
|
51668
51653
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
51669
51654
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
51670
51655
|
var GIT_OP_MUTE_MS = 4e3;
|
|
@@ -53444,13 +53429,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53444
53429
|
}
|
|
53445
53430
|
if (targets.length === 0) continue;
|
|
53446
53431
|
const dg = digest(targets.map(({ e, wireId }) => `${e.type}>${wireId}`).sort());
|
|
53447
|
-
|
|
53448
|
-
if (sourceNode?.attrs["anchorsContributedDigest"] === dg) continue;
|
|
53432
|
+
if (store.getNode(sourceId)?.attrs["anchorsContributedDigest"] === dg) continue;
|
|
53449
53433
|
anchorDigests[sourceId] = dg;
|
|
53450
|
-
const skippedCloudId = !seen.has(sourceId) ? sourceNode?.attrs["cloudNodeId"] : void 0;
|
|
53451
|
-
const wireFrom = typeof skippedCloudId === "string" && skippedCloudId.length > 0 ? skippedCloudId : sourceId;
|
|
53452
53434
|
for (const { e, t, wireId } of targets) {
|
|
53453
|
-
anchorEdges.push({ ...e,
|
|
53435
|
+
anchorEdges.push({ ...e, to: wireId, attrs: {} });
|
|
53454
53436
|
if (t.attrs["source"] === "cloud" || contextSeen.has(wireId)) continue;
|
|
53455
53437
|
contextSeen.add(wireId);
|
|
53456
53438
|
contextNodes.push(shareableContext(t, wireId));
|
|
@@ -53462,8 +53444,6 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53462
53444
|
for (const sourceId of anchorSources) {
|
|
53463
53445
|
const source = store.getNode(sourceId);
|
|
53464
53446
|
if (!source) continue;
|
|
53465
|
-
const skippedCloudId = !seen.has(sourceId) ? source.attrs["cloudNodeId"] : void 0;
|
|
53466
|
-
const wireFrom = typeof skippedCloudId === "string" && skippedCloudId.length > 0 ? skippedCloudId : sourceId;
|
|
53467
53447
|
for (const e of store.outEdges(sourceId, ["ANCHORED_AT"])) {
|
|
53468
53448
|
const target = store.getNode(e.to);
|
|
53469
53449
|
if (!target) continue;
|
|
@@ -53498,7 +53478,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53498
53478
|
stability: "unstable"
|
|
53499
53479
|
});
|
|
53500
53480
|
}
|
|
53501
|
-
anchorEdges.push({ ...e,
|
|
53481
|
+
anchorEdges.push({ ...e, to: symId, attrs: {} });
|
|
53502
53482
|
}
|
|
53503
53483
|
}
|
|
53504
53484
|
}
|
|
@@ -53546,46 +53526,6 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53546
53526
|
return { ...base, payloadDigest: digest(base), anchorDigests };
|
|
53547
53527
|
}
|
|
53548
53528
|
|
|
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
|
-
|
|
53589
53529
|
// src/multi.ts
|
|
53590
53530
|
init_generalize_graph();
|
|
53591
53531
|
init_symbol_summaries();
|
|
@@ -54671,28 +54611,6 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54671
54611
|
}
|
|
54672
54612
|
return { uploaded, ...errors.length > 0 ? { errors } : {} };
|
|
54673
54613
|
},
|
|
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
|
-
},
|
|
54696
54614
|
async pullTriagePublic() {
|
|
54697
54615
|
if (!loadConfig().consent.sync) return { merged: 0, skipped: "consent-off" };
|
|
54698
54616
|
const stack = /* @__PURE__ */ new Set();
|
|
@@ -54777,8 +54695,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54777
54695
|
const principles = await daemon.syncPrinciplesPublic();
|
|
54778
54696
|
const triage = await daemon.syncTriagePublic();
|
|
54779
54697
|
const instances = await daemon.syncInstancesPublic();
|
|
54780
|
-
|
|
54781
|
-
return c.json({ principles, triage, instances, edgeBackfill });
|
|
54698
|
+
return c.json({ principles, triage, instances });
|
|
54782
54699
|
} catch (err2) {
|
|
54783
54700
|
return c.json({ error: err2 instanceof Error ? err2.message : String(err2) }, 500);
|
|
54784
54701
|
}
|