@inerrata-corporation/errata 2.0.0-dev.36 → 2.0.0-dev.37

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 +44 -13
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -20608,6 +20608,24 @@ var init_oauth = __esm({
20608
20608
 
20609
20609
  // ../../packages/cloud-client/src/client.ts
20610
20610
  import { randomUUID } from "node:crypto";
20611
+ function wirePerContext(value) {
20612
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
20613
+ const out2 = {};
20614
+ for (const [bucket, entry] of Object.entries(value)) {
20615
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) continue;
20616
+ const e = entry;
20617
+ const confirmed = asWireCount(e["confirmed"]);
20618
+ if (confirmed === null) continue;
20619
+ const independent = asWireCount(e["independent"]);
20620
+ const inferredIndependent = asWireCount(e["inferredIndependent"]);
20621
+ out2[bucket] = {
20622
+ confirmed,
20623
+ ...independent !== null ? { independent } : {},
20624
+ ...inferredIndependent !== null ? { inferredIndependent } : {}
20625
+ };
20626
+ }
20627
+ return Object.keys(out2).length > 0 ? out2 : null;
20628
+ }
20611
20629
  function sidecarForNodes(sidecar, nodes) {
20612
20630
  if (!sidecar) return void 0;
20613
20631
  const present = /* @__PURE__ */ new Set();
@@ -20632,14 +20650,18 @@ function toWirePayload(batch, runId) {
20632
20650
  attrs: n.attrs ?? {},
20633
20651
  extractionSource: n.extractionSource
20634
20652
  }));
20635
- const edges = batch.edges.map((e) => ({
20636
- fromCanonicalId: e.from,
20637
- toCanonicalId: e.to,
20638
- type: e.type,
20639
- attrs: {
20640
- ...typeof e.confidence === "number" ? { confidence: clamp012(e.confidence) } : {}
20641
- }
20642
- }));
20653
+ const edges = batch.edges.map((e) => {
20654
+ const perContext = wirePerContext(e.attrs?.["perContext"]);
20655
+ return {
20656
+ fromCanonicalId: e.from,
20657
+ toCanonicalId: e.to,
20658
+ type: e.type,
20659
+ attrs: {
20660
+ ...typeof e.confidence === "number" ? { confidence: clamp012(e.confidence) } : {},
20661
+ ...perContext ? { perContext } : {}
20662
+ }
20663
+ };
20664
+ });
20643
20665
  const symbolSummaries = sidecarForNodes(batch.symbolSummaries, nodes);
20644
20666
  return { runId, source: "daemon", nodes, edges, ...symbolSummaries ? { symbolSummaries } : {} };
20645
20667
  }
@@ -20652,12 +20674,13 @@ function chunkArray(items, size) {
20652
20674
  for (let i2 = 0; i2 < items.length; i2 += size) out2.push(items.slice(i2, i2 + size));
20653
20675
  return out2;
20654
20676
  }
20655
- var INGEST_NODE_CHUNK, CloudClient, CloudError;
20677
+ var asWireCount, INGEST_NODE_CHUNK, CloudClient, CloudError;
20656
20678
  var init_client = __esm({
20657
20679
  "../../packages/cloud-client/src/client.ts"() {
20658
20680
  "use strict";
20659
20681
  init_oauth();
20660
20682
  init_src();
20683
+ asWireCount = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : null;
20661
20684
  INGEST_NODE_CHUNK = 25;
20662
20685
  CloudClient = class {
20663
20686
  baseUrl;
@@ -41397,13 +41420,21 @@ function isSyncableRoute(edge2, shared, triage, ignorePatterns = []) {
41397
41420
  function generalizeRouteForSync(edge2, level) {
41398
41421
  const disc = edge2.attrs["discriminator"];
41399
41422
  const local = edge2.attrs["perContext"] ?? {};
41400
- const confirmed = {};
41401
- for (const [b, c] of Object.entries(local)) confirmed[b] = c.confirmed;
41423
+ const perContext = {};
41424
+ for (const [b, c] of Object.entries(local)) {
41425
+ const independent = c.independent ?? c.contributors?.length;
41426
+ const inferredIndependent = c.inferredIndependent ?? c.inferredContributors?.length;
41427
+ perContext[b] = {
41428
+ confirmed: c.confirmed,
41429
+ ...typeof independent === "number" && independent > 0 ? { independent } : {},
41430
+ ...typeof inferredIndependent === "number" && inferredIndependent > 0 ? { inferredIndependent } : {}
41431
+ };
41432
+ }
41402
41433
  return {
41403
41434
  ...edge2,
41404
41435
  attrs: {
41405
41436
  driftKind: edge2.attrs["driftKind"],
41406
- perContext: confirmed,
41437
+ perContext,
41407
41438
  provisional: false,
41408
41439
  ...typeof disc === "string" && disc.trim() ? { discriminator: generalize(disc, { level }).text } : {}
41409
41440
  },
@@ -42216,7 +42247,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
42216
42247
  }
42217
42248
 
42218
42249
  // src/engine.ts
42219
- var DAEMON_VERSION = true ? "2.0.0-dev.36" : "2.0.0-alpha.0";
42250
+ var DAEMON_VERSION = true ? "2.0.0-dev.37" : "2.0.0-alpha.0";
42220
42251
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
42221
42252
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
42222
42253
  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.0-dev.36",
3
+ "version": "2.0.0-dev.37",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {