@inerrata-corporation/errata 2.0.2-dev.211 → 2.0.2-dev.214

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 +36 -4
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -21852,7 +21852,7 @@ var init_client = __esm({
21852
21852
  init_oauth();
21853
21853
  init_src();
21854
21854
  asWireCount = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : null;
21855
- INGEST_NODE_CHUNK = 25;
21855
+ INGEST_NODE_CHUNK = 8;
21856
21856
  CloudClient = class {
21857
21857
  baseUrl;
21858
21858
  apiKey;
@@ -22015,7 +22015,7 @@ var init_client = __esm({
22015
22015
  async ingest(batch) {
22016
22016
  const runId = randomUUID();
22017
22017
  if (batch.nodes.length <= INGEST_NODE_CHUNK && batch.edges.length <= MAX_EDGES_PER_PAYLOAD) {
22018
- const result = await this.ingestWire(toWirePayload(batch, runId));
22018
+ const result = await this.ingestWithSplit(batch, batch.nodes, batch.edges);
22019
22019
  return { ...summarizeIngestResult(result), result };
22020
22020
  }
22021
22021
  const merged = { runId, nodes: [], edges: [] };
@@ -22028,7 +22028,7 @@ var init_client = __esm({
22028
22028
  const shipped = new Set(inChunk);
22029
22029
  pendingEdges = pendingEdges.filter((e) => !shipped.has(e));
22030
22030
  }
22031
- const r = await this.ingestWire(toWirePayload({ ...batch, nodes: nodeChunk, edges: inChunk }, randomUUID()));
22031
+ const r = await this.ingestWithSplit(batch, nodeChunk, inChunk);
22032
22032
  merged.nodes.push(...r.nodes);
22033
22033
  merged.edges.push(...r.edges);
22034
22034
  for (const rn of r.nodes) {
@@ -22055,6 +22055,38 @@ var init_client = __esm({
22055
22055
  async ingestWire(payload) {
22056
22056
  return this.json("POST", "/v2/ingest", payload);
22057
22057
  }
22058
+ /**
22059
+ * Ship a node chunk, and on an EDGE TIMEOUT split it and retry the halves.
22060
+ *
22061
+ * `INGEST_NODE_CHUNK` is a guess about how long the server takes per node, and
22062
+ * that number moves with the size of the graph — so any fixed value eventually
22063
+ * drifts into the proxy's timeout and the lane dies silently (the 2026-07-31
22064
+ * three-day instances-lane outage). This makes the client self-correcting
22065
+ * instead: a chunk that times out is halved and retried, down to a single node,
22066
+ * so the drain degrades to slower rather than to stopped.
22067
+ *
22068
+ * ONLY on timeout-shaped failures (502/504/408, or a transport abort). A 4xx is
22069
+ * a verdict about the payload — splitting it would just re-send a rejected batch
22070
+ * N more times — and a 409/413 has its own handling upstream.
22071
+ */
22072
+ async ingestWithSplit(batch, nodes, edges) {
22073
+ try {
22074
+ return await this.ingestWire(toWirePayload({ ...batch, nodes, edges }, randomUUID()));
22075
+ } catch (err2) {
22076
+ const status = err2 instanceof CloudError ? err2.status : 0;
22077
+ const timedOut = status === 502 || status === 504 || status === 408 || status === 0;
22078
+ if (!timedOut || nodes.length <= 1) throw err2;
22079
+ const mid = Math.ceil(nodes.length / 2);
22080
+ const a = await this.ingestWithSplit(batch, nodes.slice(0, mid), edges);
22081
+ const b = await this.ingestWithSplit(batch, nodes.slice(mid), []);
22082
+ return {
22083
+ runId: a.runId,
22084
+ nodes: [...a.nodes, ...b.nodes],
22085
+ edges: [...a.edges, ...b.edges],
22086
+ ...a.patternReconciliation || b.patternReconciliation ? { patternReconciliation: { ...a.patternReconciliation, ...b.patternReconciliation } } : {}
22087
+ };
22088
+ }
22089
+ }
22058
22090
  /**
22059
22091
  * SDK v2 graph-native write. It remembers a typed diagnostic spine through
22060
22092
  * `/v2/ingest` instead of the legacy forum question/answer routes:
@@ -52342,7 +52374,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
52342
52374
  }
52343
52375
 
52344
52376
  // src/engine.ts
52345
- var DAEMON_VERSION = true ? "2.0.2-dev.211" : "2.0.0-alpha.0";
52377
+ var DAEMON_VERSION = true ? "2.0.2-dev.214" : "2.0.0-alpha.0";
52346
52378
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
52347
52379
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
52348
52380
  var GIT_OP_MUTE_MS = 4e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.211",
3
+ "version": "2.0.2-dev.214",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {