@inerrata-corporation/errata 2.0.0-dev.94 → 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.
- package/errata.mjs +44 -11
- 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 (
|
|
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
|
-
|
|
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
|
|
22574
|
-
|
|
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
|
|
|
@@ -25573,6 +25580,11 @@ var init_dual_burst = __esm({
|
|
|
25573
25580
|
function isHardBridge(n) {
|
|
25574
25581
|
return n.label === "Package" || n.label === "Language" || n.label === "Claim" && Number(n.attrs["abstractionLevel"] ?? 0) >= 2;
|
|
25575
25582
|
}
|
|
25583
|
+
function isQuotaError(err2) {
|
|
25584
|
+
const status = err2?.status;
|
|
25585
|
+
const msg = err2 instanceof Error ? err2.message : String(err2);
|
|
25586
|
+
return status === 403 && /quota/i.test(msg);
|
|
25587
|
+
}
|
|
25576
25588
|
async function dualAugment(opts) {
|
|
25577
25589
|
const { store, cloud, localHits, seedNode, queryText, limit } = opts;
|
|
25578
25590
|
const cloudHits = [];
|
|
@@ -25613,6 +25625,10 @@ async function dualAugment(opts) {
|
|
|
25613
25625
|
try {
|
|
25614
25626
|
await Promise.all(calls);
|
|
25615
25627
|
} catch (err2) {
|
|
25628
|
+
if (isQuotaError(err2)) {
|
|
25629
|
+
console.warn("[errata] dualAugment: collective read QUOTA EXCEEDED \u2014 the collective is up; this key hit its cap. Bump the tier or wait for the window to reset.");
|
|
25630
|
+
return { status: "quota" };
|
|
25631
|
+
}
|
|
25616
25632
|
console.error("[errata] dualAugment: collective bridge call failed \u2014", err2 instanceof Error ? err2.message : err2);
|
|
25617
25633
|
return { status: "offline" };
|
|
25618
25634
|
}
|
|
@@ -25624,6 +25640,16 @@ async function dualAugment(opts) {
|
|
|
25624
25640
|
seedUsageCount
|
|
25625
25641
|
};
|
|
25626
25642
|
}
|
|
25643
|
+
function federationHint(status) {
|
|
25644
|
+
switch (status) {
|
|
25645
|
+
case "quota":
|
|
25646
|
+
return "collective read quota exceeded \u2014 the network is up but this key hit its cap; raise the tier or wait for the window to reset";
|
|
25647
|
+
case "offline":
|
|
25648
|
+
return "collective unreachable \u2014 staying local-only (offline / timeout)";
|
|
25649
|
+
default:
|
|
25650
|
+
return void 0;
|
|
25651
|
+
}
|
|
25652
|
+
}
|
|
25627
25653
|
function formatDualNodes(merged) {
|
|
25628
25654
|
return merged.nodes.map((n) => ({
|
|
25629
25655
|
id: n.id,
|
|
@@ -36836,6 +36862,7 @@ var init_mcp = __esm({
|
|
|
36836
36862
|
query,
|
|
36837
36863
|
collectiveReachable: dual.status === "empty",
|
|
36838
36864
|
collectiveStatus: dual.status,
|
|
36865
|
+
...federationHint(dual.status) ? { collectiveHint: federationHint(dual.status) } : {},
|
|
36839
36866
|
count: hits.length,
|
|
36840
36867
|
results: hits
|
|
36841
36868
|
};
|
|
@@ -37016,6 +37043,7 @@ var init_mcp = __esm({
|
|
|
37016
37043
|
// reached-but-empty counts as reachable; offline/no-portal/local-only do not.
|
|
37017
37044
|
collectiveReachable: collectiveStatus === "empty",
|
|
37018
37045
|
collectiveStatus,
|
|
37046
|
+
...federationHint(collectiveStatus) ? { collectiveHint: federationHint(collectiveStatus) } : {},
|
|
37019
37047
|
count: ranked.length,
|
|
37020
37048
|
results: ranked.map((r) => ({
|
|
37021
37049
|
id: r.id,
|
|
@@ -37528,7 +37556,12 @@ var init_mcp = __esm({
|
|
|
37528
37556
|
results: formatDualNodes(dual.merged)
|
|
37529
37557
|
};
|
|
37530
37558
|
}
|
|
37531
|
-
return {
|
|
37559
|
+
return {
|
|
37560
|
+
...local,
|
|
37561
|
+
collectiveReachable: dual.status === "empty",
|
|
37562
|
+
collectiveStatus: dual.status,
|
|
37563
|
+
...federationHint(dual.status) ? { collectiveHint: federationHint(dual.status) } : {}
|
|
37564
|
+
};
|
|
37532
37565
|
}
|
|
37533
37566
|
return local;
|
|
37534
37567
|
}
|
|
@@ -51438,7 +51471,7 @@ function startLoopLagMonitor(thresholdMs = 1e3) {
|
|
|
51438
51471
|
}
|
|
51439
51472
|
|
|
51440
51473
|
// src/engine.ts
|
|
51441
|
-
var DAEMON_VERSION = true ? "2.0.0-dev.
|
|
51474
|
+
var DAEMON_VERSION = true ? "2.0.0-dev.96" : "2.0.0-alpha.0";
|
|
51442
51475
|
var IGNORED_PATH = /[\\/](?:\.git|node_modules|\.errata|\.claude|\.codex|\.cursor|\.turbo|\.next|dist|coverage|test-results|playwright-report|__pycache__)(?:[\\/]|$)/;
|
|
51443
51476
|
var IGNORED_NOISE = /castalia\.db|eventlog\.sqlite|turn-cursors/;
|
|
51444
51477
|
var GIT_OP_MUTE_MS = 4e3;
|