@inerrata-corporation/errata 2.0.2-dev.247 → 2.0.2-dev.260

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 +30 -40
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -18509,14 +18509,19 @@ function mintCitedPackageNode(store, ref, ts) {
18509
18509
  function mintComponentNode(store, name2, ts) {
18510
18510
  const display = name2.replace(/\s+/g, " ").trim();
18511
18511
  const slug2 = display.toLowerCase();
18512
- if (!store.getNode(slug2)) {
18512
+ const canonicalId = genericCanonicalId("comp", { type: "Component", description: display });
18513
+ const existing = store.getNode(slug2);
18514
+ if (!existing) {
18513
18515
  store.mergeNode(
18514
18516
  buildNode(slug2, "Component", display, ts, {
18515
18517
  name: display,
18516
18518
  source: "convo",
18517
- provisional: true
18519
+ provisional: true,
18520
+ canonicalId
18518
18521
  })
18519
18522
  );
18523
+ } else if (typeof existing.attrs["canonicalId"] !== "string") {
18524
+ store.updateNode(slug2, { attrs: { ...existing.attrs, canonicalId }, lastUpdatedAt: ts });
18520
18525
  }
18521
18526
  return slug2;
18522
18527
  }
@@ -21740,7 +21745,6 @@ var init_oauth = __esm({
21740
21745
 
21741
21746
  // ../../packages/cloud-client/src/client.ts
21742
21747
  import { randomUUID } from "node:crypto";
21743
- import { gzipSync } from "node:zlib";
21744
21748
  function wirePerContext(value) {
21745
21749
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
21746
21750
  const out2 = {};
@@ -21960,7 +21964,7 @@ function provenanceHeaders(provenance) {
21960
21964
  ...provenance.agentModel ? { "x-inerrata-agent-model": provenance.agentModel } : {}
21961
21965
  };
21962
21966
  }
21963
- var asWireCount, INGEST_NODE_CHUNK, COMPRESS_MIN_BYTES, CloudClient, CloudError;
21967
+ var asWireCount, INGEST_NODE_CHUNK, CloudClient, CloudError;
21964
21968
  var init_client = __esm({
21965
21969
  "../../packages/cloud-client/src/client.ts"() {
21966
21970
  "use strict";
@@ -21968,7 +21972,6 @@ var init_client = __esm({
21968
21972
  init_src();
21969
21973
  asWireCount = (n) => typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : null;
21970
21974
  INGEST_NODE_CHUNK = 8;
21971
- COMPRESS_MIN_BYTES = 4096;
21972
21975
  CloudClient = class {
21973
21976
  baseUrl;
21974
21977
  apiKey;
@@ -21983,8 +21986,6 @@ var init_client = __esm({
21983
21986
  daemonVersion;
21984
21987
  daemonChannel;
21985
21988
  provenance;
21986
- /** Cleared for the process once a server proves it cannot inflate (see `json`). */
21987
- compressRequests;
21988
21989
  constructor(opts) {
21989
21990
  this.baseUrl = opts.baseUrl.replace(/\/+$/, "");
21990
21991
  if (opts.apiKey !== void 0) this.apiKey = opts.apiKey;
@@ -21998,7 +21999,6 @@ var init_client = __esm({
21998
21999
  this.timeoutMs = opts.timeoutMs ?? 15e3;
21999
22000
  this.daemonVersion = opts.daemonVersion;
22000
22001
  this.daemonChannel = opts.daemonChannel;
22001
- this.compressRequests = opts.compressRequests ?? true;
22002
22002
  this.provenance = opts.provenance ?? {
22003
22003
  clientProduct: "inerrata_cloud_client",
22004
22004
  clientKind: "sdk",
@@ -22527,43 +22527,15 @@ var init_client = __esm({
22527
22527
  const token = opts?.bearerToken ?? await this.authToken();
22528
22528
  if (token) headers["authorization"] = `Bearer ${token}`;
22529
22529
  }
22530
- let payload;
22531
- if (body2 !== void 0) {
22532
- const raw2 = JSON.stringify(body2);
22533
- if (this.compressRequests && Buffer.byteLength(raw2) >= COMPRESS_MIN_BYTES) {
22534
- payload = gzipSync(Buffer.from(raw2));
22535
- headers["content-encoding"] = "gzip";
22536
- } else {
22537
- payload = raw2;
22538
- }
22539
- }
22540
22530
  const ac = new AbortController();
22541
22531
  const tid = setTimeout(() => ac.abort(), this.timeoutMs);
22542
22532
  try {
22543
22533
  const res = await this.fetchFn(url2, {
22544
22534
  method,
22545
22535
  headers,
22546
- body: payload,
22536
+ body: body2 === void 0 ? void 0 : JSON.stringify(body2),
22547
22537
  signal: ac.signal
22548
22538
  });
22549
- if (res.status === 400 && headers["content-encoding"] === "gzip") {
22550
- delete headers["content-encoding"];
22551
- const retry = await this.fetchFn(url2, {
22552
- method,
22553
- headers,
22554
- body: JSON.stringify(body2),
22555
- signal: ac.signal
22556
- });
22557
- if (!retry.ok) {
22558
- const text = await retry.text();
22559
- throw new CloudError(
22560
- `${method} ${path2} failed: HTTP ${retry.status} ${text.slice(0, 200)}`,
22561
- retry.status
22562
- );
22563
- }
22564
- this.compressRequests = false;
22565
- return await retry.json();
22566
- }
22567
22539
  if (!res.ok) {
22568
22540
  const text = await res.text();
22569
22541
  throw new CloudError(
@@ -26787,7 +26759,7 @@ function bindCanonicalNeighbors(store, opts) {
26787
26759
  picked.push(cand);
26788
26760
  }
26789
26761
  for (const { c, s } of picked) {
26790
- const type = c.label === "Pattern" ? "INSTANCE_OF" : "MATCHES";
26762
+ const type = c.label === "Pattern" ? "INSTANCE_OF" : "RELATES_TO";
26791
26763
  store.mergeEdge({
26792
26764
  id: `edge_${digest({ from: p.id, type, to: c.id, k: "canonBind" })}`.slice(0, 24),
26793
26765
  from: p.id,
@@ -52692,7 +52664,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
52692
52664
  }
52693
52665
 
52694
52666
  // src/engine.ts
52695
- var DAEMON_VERSION = true ? "2.0.2-dev.247" : "2.0.0-alpha.0";
52667
+ var DAEMON_VERSION = true ? "2.0.2-dev.260" : "2.0.0-alpha.0";
52696
52668
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
52697
52669
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
52698
52670
  var GIT_OP_MUTE_MS = 4e3;
@@ -54564,6 +54536,14 @@ function contributedWireId(n) {
54564
54536
  const cloudId = n.attrs["cloudNodeId"];
54565
54537
  return isMembraneSaltedId(cloudId) ? cloudId : n.id;
54566
54538
  }
54539
+ var WIRE_CANONICAL_ID_MIN = 6;
54540
+ function unshippableReason(n) {
54541
+ const canonical = typeof n.attrs?.["canonicalId"] === "string" ? n.attrs["canonicalId"] : n.id;
54542
+ if (canonical.length < WIRE_CANONICAL_ID_MIN) {
54543
+ return `canonicalId "${canonical}" is ${canonical.length} chars; the door requires >= ${WIRE_CANONICAL_ID_MIN}`;
54544
+ }
54545
+ return null;
54546
+ }
54567
54547
  function wireContextId(n) {
54568
54548
  if (n.label === "Language" && n.attrs["source"] !== "cloud") {
54569
54549
  const name2 = String(n.attrs["name"] ?? "").trim() || n.description.trim() || n.id.replace(/^lang:/, "");
@@ -54586,7 +54566,7 @@ function shareableContext(n, wireId) {
54586
54566
  name: n.attrs["name"],
54587
54567
  ecosystem: n.attrs["ecosystem"],
54588
54568
  resolved: n.attrs["resolved"]
54589
- } : n.label === "Domain" ? { name: n.description, canonicalId: n.attrs["canonicalId"] } : { name: n.attrs["name"] };
54569
+ } : n.label === "Domain" ? { name: n.description, canonicalId: n.attrs["canonicalId"] } : n.label === "Component" ? { name: n.attrs["name"], canonicalId: n.attrs["canonicalId"] } : { name: n.attrs["name"] };
54590
54570
  return {
54591
54571
  ...n,
54592
54572
  id: wireId,
@@ -54647,6 +54627,11 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
54647
54627
  if (!problemShippable) continue;
54648
54628
  }
54649
54629
  if (!noveltyAgainst(n, ref, noveltyOpts).ready) continue;
54630
+ const reject = unshippableReason(n);
54631
+ if (reject) {
54632
+ console.warn(`[errata] skipping unshippable node ${n.id} (${n.label}): ${reject}`);
54633
+ continue;
54634
+ }
54650
54635
  ref.push(n);
54651
54636
  const wireNode = shareable(n);
54652
54637
  nodes.push(wireNode);
@@ -54696,6 +54681,11 @@ function buildInstanceIngest(store, profile, daemonVersion, ignorePatterns = [],
54696
54681
  anchorDigests[sourceId] = dg;
54697
54682
  const wireFrom = seen.has(sourceId) || !sourceNode ? sourceId : contributedWireId(sourceNode);
54698
54683
  for (const { e, t, wireId } of targets) {
54684
+ const reject = unshippableReason({ id: wireId, label: t.label, attrs: t.attrs });
54685
+ if (reject) {
54686
+ console.warn(`[errata] skipping unshippable anchor ${wireId} (${t.label}): ${reject}`);
54687
+ continue;
54688
+ }
54699
54689
  anchorEdges.push({ ...e, from: wireFrom, to: wireId, attrs: {} });
54700
54690
  if (t.attrs["source"] === "cloud" || contextSeen.has(wireId)) continue;
54701
54691
  contextSeen.add(wireId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.2-dev.247",
3
+ "version": "2.0.2-dev.260",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {