@inerrata-corporation/errata 2.0.1-dev.57 → 2.0.1-dev.99
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 +39 -83
- 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.99" : "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;
|
|
@@ -53253,13 +53238,10 @@ function buildContextIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53253
53238
|
// Package ids are already the purl (= the cross-stratum canonicalId).
|
|
53254
53239
|
id: label === "Language" ? languageCanonicalId(String(n.attrs["name"] ?? "").trim() || n.description) : n.id,
|
|
53255
53240
|
embedding: [],
|
|
53256
|
-
// No `version` attr on the wire: the purl already encodes the resolved
|
|
53257
|
-
// version, and the door's temporal guard rejects ANY `attrs.version` as
|
|
53258
|
-
// bi-temporal bookkeeping (ingest-temporal-guard.ts) — shipping it 422s
|
|
53259
|
-
// the whole batch. `resolved` still travels (range-vs-lockfile signal).
|
|
53260
53241
|
attrs: label === "Package" ? {
|
|
53261
53242
|
purl: n.attrs["purl"],
|
|
53262
53243
|
name: n.attrs["name"],
|
|
53244
|
+
version: n.attrs["version"],
|
|
53263
53245
|
ecosystem: n.attrs["ecosystem"],
|
|
53264
53246
|
resolved: n.attrs["resolved"]
|
|
53265
53247
|
} : { name: n.attrs["name"] }
|
|
@@ -53374,10 +53356,9 @@ function wireContextId(n) {
|
|
|
53374
53356
|
}
|
|
53375
53357
|
function shareableContext(n, wireId) {
|
|
53376
53358
|
const attrs = n.label === "Package" ? {
|
|
53377
|
-
// No `version` attr: the purl encodes it, and the door's temporal
|
|
53378
|
-
// guard 422s any `attrs.version` (mirrors buildContextIngest).
|
|
53379
53359
|
purl: n.attrs["purl"],
|
|
53380
53360
|
name: n.attrs["name"],
|
|
53361
|
+
version: n.attrs["version"],
|
|
53381
53362
|
ecosystem: n.attrs["ecosystem"],
|
|
53382
53363
|
resolved: n.attrs["resolved"]
|
|
53383
53364
|
} : n.label === "Domain" ? { name: n.description, canonicalId: n.attrs["canonicalId"] } : { name: n.attrs["name"] };
|
|
@@ -53444,13 +53425,10 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53444
53425
|
}
|
|
53445
53426
|
if (targets.length === 0) continue;
|
|
53446
53427
|
const dg = digest(targets.map(({ e, wireId }) => `${e.type}>${wireId}`).sort());
|
|
53447
|
-
|
|
53448
|
-
if (sourceNode?.attrs["anchorsContributedDigest"] === dg) continue;
|
|
53428
|
+
if (store.getNode(sourceId)?.attrs["anchorsContributedDigest"] === dg) continue;
|
|
53449
53429
|
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
53430
|
for (const { e, t, wireId } of targets) {
|
|
53453
|
-
anchorEdges.push({ ...e,
|
|
53431
|
+
anchorEdges.push({ ...e, to: wireId, attrs: {} });
|
|
53454
53432
|
if (t.attrs["source"] === "cloud" || contextSeen.has(wireId)) continue;
|
|
53455
53433
|
contextSeen.add(wireId);
|
|
53456
53434
|
contextNodes.push(shareableContext(t, wireId));
|
|
@@ -53462,8 +53440,6 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53462
53440
|
for (const sourceId of anchorSources) {
|
|
53463
53441
|
const source = store.getNode(sourceId);
|
|
53464
53442
|
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
53443
|
for (const e of store.outEdges(sourceId, ["ANCHORED_AT"])) {
|
|
53468
53444
|
const target = store.getNode(e.to);
|
|
53469
53445
|
if (!target) continue;
|
|
@@ -53498,7 +53474,7 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
|
|
|
53498
53474
|
stability: "unstable"
|
|
53499
53475
|
});
|
|
53500
53476
|
}
|
|
53501
|
-
anchorEdges.push({ ...e,
|
|
53477
|
+
anchorEdges.push({ ...e, to: symId, attrs: {} });
|
|
53502
53478
|
}
|
|
53503
53479
|
}
|
|
53504
53480
|
}
|
|
@@ -54557,27 +54533,14 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54557
54533
|
const ignore = loadClaimIgnorePatterns(globalDir());
|
|
54558
54534
|
const client = cloudNow();
|
|
54559
54535
|
let uploaded = 0;
|
|
54560
|
-
const errors = [];
|
|
54561
|
-
const lane = async (name2, projectName, run3) => {
|
|
54562
|
-
try {
|
|
54563
|
-
await run3();
|
|
54564
|
-
} catch (err2) {
|
|
54565
|
-
const msg = `[${projectName}] ${name2}: ${err2 instanceof Error ? err2.message : String(err2)}`;
|
|
54566
|
-
errors.push(msg);
|
|
54567
|
-
console.error(`[sync\u2192cloud] ${msg}`);
|
|
54568
|
-
}
|
|
54569
|
-
};
|
|
54570
54536
|
for (const r of records) {
|
|
54571
54537
|
const store = r.engine.store;
|
|
54572
|
-
const projectName = r.engine.profile.name ?? r.engine.profile.id;
|
|
54573
54538
|
const context = buildContextIngest(store, r.engine.profile, DAEMON_VERSION, ignore, {
|
|
54574
54539
|
includePackages: cfg2.consent.contributePackages
|
|
54575
54540
|
});
|
|
54576
54541
|
if (context) {
|
|
54577
|
-
|
|
54578
|
-
|
|
54579
|
-
uploaded += res.accepted;
|
|
54580
|
-
});
|
|
54542
|
+
const res = await client.ingest(context);
|
|
54543
|
+
uploaded += res.accepted;
|
|
54581
54544
|
}
|
|
54582
54545
|
let lexicon;
|
|
54583
54546
|
try {
|
|
@@ -54600,36 +54563,34 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54600
54563
|
});
|
|
54601
54564
|
if (instances) {
|
|
54602
54565
|
if (project) instances.projectId = project.projectId;
|
|
54603
|
-
|
|
54604
|
-
|
|
54605
|
-
|
|
54606
|
-
|
|
54607
|
-
|
|
54608
|
-
|
|
54609
|
-
|
|
54610
|
-
|
|
54611
|
-
|
|
54612
|
-
|
|
54613
|
-
|
|
54614
|
-
|
|
54615
|
-
attrs
|
|
54616
|
-
|
|
54617
|
-
|
|
54618
|
-
|
|
54619
|
-
|
|
54620
|
-
|
|
54621
|
-
|
|
54622
|
-
|
|
54623
|
-
|
|
54624
|
-
|
|
54625
|
-
|
|
54626
|
-
|
|
54627
|
-
|
|
54628
|
-
}
|
|
54629
|
-
});
|
|
54566
|
+
const res = await client.ingest(instances);
|
|
54567
|
+
uploaded += res.accepted;
|
|
54568
|
+
const seq = store.currentIngestSeq();
|
|
54569
|
+
const cloudIdByLocal = new Map(
|
|
54570
|
+
res.result.nodes.filter((rn) => rn.nodeId).map((rn) => [rn.canonicalId, rn.nodeId])
|
|
54571
|
+
);
|
|
54572
|
+
for (const n of instances.nodes) {
|
|
54573
|
+
const local = store.getNode(n.id);
|
|
54574
|
+
if (!local || !["Problem", "Solution", "RootCause"].includes(local.label)) continue;
|
|
54575
|
+
const cloudNodeId = cloudIdByLocal.get(n.id);
|
|
54576
|
+
store.updateNode(n.id, {
|
|
54577
|
+
attrs: {
|
|
54578
|
+
...local.attrs,
|
|
54579
|
+
contributedAtSeq: seq,
|
|
54580
|
+
...cloudNodeId && cloudNodeId !== n.id ? { cloudNodeId } : {}
|
|
54581
|
+
}
|
|
54582
|
+
});
|
|
54583
|
+
}
|
|
54584
|
+
for (const [localId, dg] of Object.entries(instances.anchorDigests)) {
|
|
54585
|
+
const local = store.getNode(localId);
|
|
54586
|
+
if (!local) continue;
|
|
54587
|
+
store.updateNode(localId, {
|
|
54588
|
+
attrs: { ...local.attrs, anchorsContributedDigest: dg }
|
|
54589
|
+
});
|
|
54590
|
+
}
|
|
54630
54591
|
}
|
|
54631
54592
|
}
|
|
54632
|
-
return { uploaded
|
|
54593
|
+
return { uploaded };
|
|
54633
54594
|
},
|
|
54634
54595
|
async pullTriagePublic() {
|
|
54635
54596
|
if (!loadConfig().consent.sync) return { merged: 0, skipped: "consent-off" };
|
|
@@ -54679,12 +54640,7 @@ async function startMultiDaemon(opts = {}) {
|
|
|
54679
54640
|
}
|
|
54680
54641
|
const inst = await daemon.syncInstancesPublic();
|
|
54681
54642
|
const skills = await daemon.syncSkillsAll();
|
|
54682
|
-
return {
|
|
54683
|
-
uploaded: inst.uploaded,
|
|
54684
|
-
written: skills.written,
|
|
54685
|
-
pruned: skills.pruned,
|
|
54686
|
-
...inst.errors ? { errors: inst.errors } : {}
|
|
54687
|
-
};
|
|
54643
|
+
return { uploaded: inst.uploaded, written: skills.written, pruned: skills.pruned };
|
|
54688
54644
|
} finally {
|
|
54689
54645
|
boundaryFlushing = false;
|
|
54690
54646
|
}
|