@inerrata-corporation/errata 2.0.22-dev.4074 → 2.0.22-dev.4122

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 CHANGED
@@ -580,11 +580,20 @@ var init_graph_events = __esm({
580
580
  // silently admitted, so the next graph-health pass either gives them a
581
581
  // trigger or retires them (D12: a record nothing reads is the defect).
582
582
  prefixes: ["ingest.", "sanitize.", "queue.", "skew."],
583
+ keys: ["inerrata.request_id"],
583
584
  consumer: "graph-health.mjs ingest triggers (edge-reject RATE, reinforcedFraction band, the volume floor) + the 'Graph \u2014 Ingest funnel & integrity' board. queue.*/skew.* currently have NO standing consumer (found unread 2026-08-14) \u2014 trigger or retirement owed"
584
585
  },
585
586
  "graph.twin": {
586
587
  prefixes: [],
587
- keys: ["rewritten", "already-generic", "rejected", "failed", "low-content", "threw", "failureFraction"],
588
+ keys: [
589
+ "rewritten",
590
+ "already-generic",
591
+ "rejected",
592
+ "failed",
593
+ "low-content",
594
+ "threw",
595
+ "failureFraction"
596
+ ],
588
597
  consumer: "failureFraction is the alertable number (twin-outcomes.ts); its graph-health.mjs trigger is pending a live baseline"
589
598
  },
590
599
  "graph.burst": {
@@ -85053,7 +85062,7 @@ function createWatchBreaker(deps) {
85053
85062
  }
85054
85063
 
85055
85064
  // src/engine.ts
85056
- var DAEMON_VERSION = true ? "2.0.22-dev.4074" : "2.0.0-alpha.0";
85065
+ var DAEMON_VERSION = true ? "2.0.22-dev.4122" : "2.0.0-alpha.0";
85057
85066
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
85058
85067
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
85059
85068
  var GIT_OP_MUTE_MS = 4e3;
@@ -87723,6 +87732,39 @@ B: ${b}`,
87723
87732
  };
87724
87733
  }
87725
87734
 
87735
+ // src/loopback-guard.ts
87736
+ var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "[::1]"]);
87737
+ function isLoopbackHost(host) {
87738
+ const h = host.trim().toLowerCase();
87739
+ const m = /^(\[[^\]]+\]|[^:]+)(?::(\d+))?$/.exec(h);
87740
+ return !!m && LOOPBACK_HOSTNAMES.has(m[1]);
87741
+ }
87742
+ function isLoopbackOrigin(origin) {
87743
+ try {
87744
+ const u = new URL(origin);
87745
+ return u.protocol === "http:" && LOOPBACK_HOSTNAMES.has(u.hostname);
87746
+ } catch {
87747
+ return false;
87748
+ }
87749
+ }
87750
+ function loopbackRefusal(headers) {
87751
+ const host = headers.get("host");
87752
+ if (host !== null && host !== "" && !isLoopbackHost(host)) return "non-loopback Host";
87753
+ const origin = headers.get("origin");
87754
+ if (origin !== null && !isLoopbackOrigin(origin)) return "non-loopback Origin";
87755
+ return null;
87756
+ }
87757
+ function withLoopbackGuard(fetchFn) {
87758
+ return (req) => {
87759
+ const refusal = loopbackRefusal(req.headers);
87760
+ if (refusal) return new Response(JSON.stringify({ error: "forbidden", reason: refusal }), {
87761
+ status: 403,
87762
+ headers: { "content-type": "application/json" }
87763
+ });
87764
+ return fetchFn(req);
87765
+ };
87766
+ }
87767
+
87726
87768
  // src/daemon.ts
87727
87769
  async function startDaemon(opts) {
87728
87770
  const processStartedAt = Date.now();
@@ -87804,7 +87846,7 @@ async function startDaemon(opts) {
87804
87846
  }
87805
87847
  async function listenServer(fetchFn, port) {
87806
87848
  return new Promise((resolve10, reject) => {
87807
- const server = serve({ fetch: fetchFn, hostname: "127.0.0.1", port }, (info2) => {
87849
+ const server = serve({ fetch: withLoopbackGuard(fetchFn), hostname: "127.0.0.1", port }, (info2) => {
87808
87850
  resolve10({ server, port: info2.port });
87809
87851
  });
87810
87852
  server.once(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inerrata-corporation/errata",
3
- "version": "2.0.22-dev.4074",
3
+ "version": "2.0.22-dev.4122",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "errata-context",
3
- "version": "2.0.22-dev.4074",
3
+ "version": "2.0.22-dev.4122",
4
4
  "description": "A minimal 3D view of loaded Errata priors and recent graph bursts.",
5
5
  "author": {
6
6
  "name": "inErrata"
@@ -1,4 +1,4 @@
1
- fe984b8b1cdd56eb598e74a61485e191c89e632163f5e27d35184130dafdb81c .codex-plugin/plugin.json
1
+ 5ba58327da38d3a9b52ab2bc97c6999d2015ca1e410205e55f10e0e24a197693 .codex-plugin/plugin.json
2
2
  a7bebae9fb01c838d6c75fc784129e28be571233fa66ff5ee8039b574f35ccf7 assets/icon.png
3
3
  fc38b64e4df1e0b72c35764bef6c4c05430d97c9009ad0ecc8a9e75b4deab232 configure-local.mjs
4
4
  73dc6028b3b070257c7c31f252d11e55a9e096f4aed0f187f10cb21716e1e6d7 dist/client.js