@absolutejs/rag 0.22.1 → 0.22.2

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/CHANGELOG.md CHANGED
@@ -6,6 +6,12 @@ This file is generated by `absolute-changelog` from the entries in
6
6
  `changelog/`. Edit an entry, not this file — and add new ones under
7
7
  `changelog/unreleased/`.
8
8
 
9
+ ## 0.22.2 — 2026-09-24
10
+
11
+ ### Fixed
12
+
13
+ - **Replace backtracking HTML app-shell detection with DOM inspection and allow isolated reader clients to fail without in-process parsing** (`readRAGWebpage`, `createWebsiteReaderClient`, `createWebpageReaderClient`)
14
+
9
15
  ## 0.22.1 — 2026-09-24
10
16
 
11
17
  ### Fixed
package/changelog.json CHANGED
@@ -2,6 +2,21 @@
2
2
  "contract": 1,
3
3
  "name": "@absolutejs/rag",
4
4
  "releases": [
5
+ {
6
+ "changes": [
7
+ {
8
+ "kind": "fixed",
9
+ "summary": "Replace backtracking HTML app-shell detection with DOM inspection and allow isolated reader clients to fail without in-process parsing",
10
+ "symbols": [
11
+ "readRAGWebpage",
12
+ "createWebsiteReaderClient",
13
+ "createWebpageReaderClient"
14
+ ]
15
+ }
16
+ ],
17
+ "date": "2026-09-24",
18
+ "version": "0.22.2"
19
+ },
5
20
  {
6
21
  "changes": [
7
22
  {
@@ -111227,6 +111227,15 @@ var hasIncompleteAppContent = (html) => {
111227
111227
  const text = compact(main.textContent);
111228
111228
  return text.length < 100 || /^(?:loading|please wait)(?:[.\s]|$)/iu.test(text);
111229
111229
  };
111230
+ var hasEmptyAppRoot = (html) => {
111231
+ const { document: document2 } = parseHTML(html);
111232
+ return Array.from(document2.querySelectorAll("div,main,section")).some((element) => {
111233
+ const attributes = Array.from(element.attributes);
111234
+ const id = attributes.find((attribute2) => attribute2.name.toLowerCase() === "id")?.value.toLowerCase();
111235
+ const classes = attributes.find((attribute2) => attribute2.name.toLowerCase() === "class")?.value.toLowerCase().split(/\s+/u) ?? [];
111236
+ return (id !== undefined && ["root", "app", "__next"].includes(id) || classes.includes("todoapp")) && element.children.length === 0 && !element.textContent?.trim();
111237
+ });
111238
+ };
111230
111239
 
111231
111240
  // src/web/text.ts
111232
111241
  var websiteHtmlText = (html) => {
@@ -117855,8 +117864,8 @@ var parseWebsiteServiceResult = (value) => {
117855
117864
  return row;
117856
117865
  };
117857
117866
  var createWebsiteReaderClient = (options) => async (input) => {
117858
- const timeoutMs = options.timeoutMs ?? 85000, reserveMs = options.fallbackReserveMs ?? 15000;
117859
- if (!(reserveMs > 0 && timeoutMs > reserveMs))
117867
+ const timeoutMs = options.timeoutMs ?? 85000, reserveMs = options.fallback ? options.fallbackReserveMs ?? 15000 : 0;
117868
+ if (!(reserveMs >= 0 && timeoutMs > reserveMs))
117860
117869
  throw new Error("Reader deadline must reserve fallback time");
117861
117870
  const signal = AbortSignal.any([
117862
117871
  ...input.signal ? [input.signal] : [],
@@ -117897,6 +117906,15 @@ var createWebsiteReaderClient = (options) => async (input) => {
117897
117906
  return result;
117898
117907
  } catch (error) {
117899
117908
  signal.throwIfAborted();
117909
+ if (!options.fallback)
117910
+ return {
117911
+ status: "error",
117912
+ text: "",
117913
+ error: {
117914
+ code: "reader_unavailable",
117915
+ message: "Website reader unavailable. Retry shortly; no website evidence was retrieved."
117916
+ }
117917
+ };
117900
117918
  const result = parseWebsiteServiceResult(await options.fallback({ ...request, signal }));
117901
117919
  signal.throwIfAborted();
117902
117920
  return {
@@ -117956,7 +117974,7 @@ var titleOf = (html) => {
117956
117974
  const title = /<title\b[^>]*>([\s\S]*?)<\/title>/iu.exec(html)?.[1];
117957
117975
  return title ? prepareRAGDocument({ text: title, format: "html" }).normalizedText : null;
117958
117976
  };
117959
- var isShell = (html, text) => text.length < 300 || hasIncompleteAppContent(html) || /(?:enable|requires?|turn on)\s+javascript|javascript\s+(?:is\s+)?(?:disabled|required)/iu.test(text) || /<(?:div|main|section)[^>]*(?:id=["'](?:root|app|__next)["']|class=["']todoapp["'])[^>]*>\s*<\//iu.test(html);
117977
+ var isShell = (html, text) => text.length < 300 || hasIncompleteAppContent(html) || /(?:enable|requires?|turn on)\s+javascript|javascript\s+(?:is\s+)?(?:disabled|required)/iu.test(text) || hasEmptyAppRoot(html);
117960
117978
  var isChallenge = (text) => /verify (?:that )?you are human|checking your browser|just a moment|enable javascript and cookies to continue|access denied/iu.test(text.slice(0, 1000));
117961
117979
  var readRAGWebpage = async (options) => {
117962
117980
  const attempts = [];
@@ -125413,5 +125431,5 @@ export {
125413
125431
  selectResearchMonitorEvents
125414
125432
  };
125415
125433
 
125416
- //# debugId=9DCC894B3A3B129664756E2164756E21
125434
+ //# debugId=9B57E533D9808F8964756E2164756E21
125417
125435
  //# sourceMappingURL=index.js.map