@inerrata-corporation/errata 2.0.0-dev.95 → 2.0.0-dev.96

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 +17 -10
  2. package/package.json +1 -1
package/errata.mjs CHANGED
@@ -22477,10 +22477,7 @@ function evaluateCloudEndpoint(url2, inspection) {
22477
22477
  if (inspection?.kind === "gateway") {
22478
22478
  return { allowed: true, label: "gateway-metered" };
22479
22479
  }
22480
- if (inspection && !inspection.reachable && looksLikeGatewayCloudUrl(url2)) {
22481
- return { allowed: true, label: "gateway-configured" };
22482
- }
22483
- if (!inspection && looksLikeGatewayCloudUrl(url2)) {
22480
+ if (looksLikeGatewayCloudUrl(url2)) {
22484
22481
  return { allowed: true, label: "gateway-configured" };
22485
22482
  }
22486
22483
  if (isDirectV1OverrideEnabled()) {
@@ -22526,7 +22523,10 @@ async function inspectCloudEndpoint(baseUrl, opts = {}) {
22526
22523
  const local = isLocalCloudUrl(normalized);
22527
22524
  const fetchFn = opts.fetchFn ?? fetch;
22528
22525
  const timeoutMs = opts.timeoutMs ?? PROBE_TIMEOUT_MS;
22529
- const root = await fetchHealthJson(fetchFn, `${normalized}/health`, timeoutMs);
22526
+ let root = await fetchHealthJson(fetchFn, `${normalized}/health`, timeoutMs);
22527
+ if (!root.ok) {
22528
+ root = await fetchHealthJson(fetchFn, `${normalized}/health`, timeoutMs);
22529
+ }
22530
22530
  if (root.ok && root.body?.service === GATEWAY_SERVICE) {
22531
22531
  return {
22532
22532
  baseUrl: normalized,
@@ -22568,11 +22568,17 @@ async function inspectCloudEndpoint(baseUrl, opts = {}) {
22568
22568
  function guardCloudFetch(baseUrl, fetchFn = fetch) {
22569
22569
  const normalized = normalizeCloudUrl(baseUrl);
22570
22570
  let checked = null;
22571
+ let blockedAt = 0;
22571
22572
  return (async (input, init2) => {
22572
22573
  if (isProtectedCloudRequest(normalized, input)) {
22573
- checked ??= inspectCloudEndpoint(normalized, { fetchFn }).then(
22574
- (inspection) => evaluateCloudEndpoint(normalized, inspection)
22575
- );
22574
+ if (checked && blockedAt && Date.now() - blockedAt >= BLOCKED_RECHECK_MS) {
22575
+ checked = null;
22576
+ }
22577
+ checked ??= inspectCloudEndpoint(normalized, { fetchFn }).then((inspection) => {
22578
+ const decision2 = evaluateCloudEndpoint(normalized, inspection);
22579
+ blockedAt = decision2.allowed ? 0 : Date.now();
22580
+ return decision2;
22581
+ });
22576
22582
  const decision = await checked;
22577
22583
  if (!decision.allowed) {
22578
22584
  throw new CloudEndpointPolicyError(formatCloudEndpointBlock(normalized, decision), decision);
@@ -22628,7 +22634,7 @@ async function fetchHealthJson(fetchFn, url2, timeoutMs) {
22628
22634
  clearTimeout(tid);
22629
22635
  }
22630
22636
  }
22631
- var DIRECT_V1_OVERRIDE_ENV, GATEWAY_SERVICE, PROBE_TIMEOUT_MS, CloudEndpointPolicyError;
22637
+ var DIRECT_V1_OVERRIDE_ENV, GATEWAY_SERVICE, PROBE_TIMEOUT_MS, CloudEndpointPolicyError, BLOCKED_RECHECK_MS;
22632
22638
  var init_cloud_endpoint_policy = __esm({
22633
22639
  "src/cloud-endpoint-policy.ts"() {
22634
22640
  "use strict";
@@ -22643,6 +22649,7 @@ var init_cloud_endpoint_policy = __esm({
22643
22649
  this.decision = decision;
22644
22650
  }
22645
22651
  };
22652
+ BLOCKED_RECHECK_MS = 6e4;
22646
22653
  }
22647
22654
  });
22648
22655
 
@@ -51464,7 +51471,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
51464
51471
  }
51465
51472
 
51466
51473
  // src/engine.ts
51467
- var DAEMON_VERSION = true ? "2.0.0-dev.95" : "2.0.0-alpha.0";
51474
+ var DAEMON_VERSION = true ? "2.0.0-dev.96" : "2.0.0-alpha.0";
51468
51475
  var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
51469
51476
  var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
51470
51477
  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.95",
3
+ "version": "2.0.0-dev.96",
4
4
  "description": "errata - local-first observation engine for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {