@absolutejs/rag 0.22.7 → 0.22.8

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.
@@ -122736,6 +122736,7 @@ ${prompt}`,
122736
122736
  const requiredPhrases = input.requiredPhrases ?? (input.queryMode === "task" ? [] : [...input.query.matchAll(/"([^"\n]+)"/gu)].map((match) => match[1]));
122737
122737
  const urls = new Set;
122738
122738
  const queries = new Set;
122739
+ const discoveredLinks = new Map;
122739
122740
  let evidenceChars = 0;
122740
122741
  const sourceText = new Map;
122741
122742
  const rebalanceEvidence = () => {
@@ -122807,7 +122808,7 @@ ${prompt}`,
122807
122808
  const doRead = async (url) => {
122808
122809
  if (urls.has(url) || urls.size >= limits.reads)
122809
122810
  return;
122810
- if (!result.searches.some((search) => search.sources.some((source) => source.url === url)))
122811
+ if (!discoveredLinks.has(url) && !result.searches.some((search) => search.sources.some((source) => source.url === url)))
122811
122812
  return;
122812
122813
  urls.add(url);
122813
122814
  const page = await operate("read", () => (config.reader ?? readRAGWebpage)({
@@ -122820,6 +122821,16 @@ ${prompt}`,
122820
122821
  if (page.status !== "ok")
122821
122822
  result.limitations.push(`Page read ${page.status}: ${url}`);
122822
122823
  if (page.text && page.status !== "error") {
122824
+ for (const link of page.evidence.links) {
122825
+ if (discoveredLinks.size >= 64)
122826
+ break;
122827
+ try {
122828
+ const target = validatePublicWebUrl(new URL(link.url, page.finalUrl).href);
122829
+ target.hash = "";
122830
+ if (!discoveredLinks.has(target.href))
122831
+ discoveredLinks.set(target.href, { url: target.href, label: link.label.slice(0, 200), discoveredOn: page.finalUrl });
122832
+ } catch {}
122833
+ }
122823
122834
  const prior = result.sources.find((source) => source.url === url);
122824
122835
  if (prior) {
122825
122836
  sourceText.set(prior.url, page.text.slice(0, limits.evidenceChars));
@@ -122858,11 +122869,12 @@ ${prompt}`,
122858
122869
  break;
122859
122870
  let plan;
122860
122871
  try {
122861
- plan = await generate("plan", PlanSchema, "Select follow-up searches for missing evidence and primary-source URLs to read. For current people or roles, seek the organization\u2019s own leadership/about/team pages; testimonials, package authors, and job listings are not staff identity evidence. For policies, read the full policy or agreement to preserve section scope and exceptions. URLs must come from the supplied search results. done means available evidence addresses the requested schema, not merely that some results exist. Return no actions if further work is not useful.", {
122872
+ plan = await generate("plan", PlanSchema, "Select follow-up searches for missing evidence and primary-source URLs to read. For current people or roles, seek the organization\u2019s own leadership/about/team pages; testimonials, package authors, and job listings are not staff identity evidence. For policies, read the full policy or agreement to preserve section scope and exceptions. URLs must come from the supplied search results or discoveredLinks. Discovered links are unread navigation hints, not evidence; read relevant product, pricing, checkout or policy details before concluding information is absent. done means available evidence addresses the requested schema, not merely that some results exist. Return no actions if further work is not useful.", {
122862
122873
  query: input.query,
122863
122874
  schema: task.schema,
122864
122875
  instructions: task.instructions,
122865
122876
  sources: result.sources,
122877
+ discoveredLinks: [...discoveredLinks.values()].filter((link) => !urls.has(link.url)),
122866
122878
  searched: [...queries],
122867
122879
  read: [...urls],
122868
122880
  remainingSearches: limits.searches - queries.size,
@@ -123038,5 +123050,5 @@ export {
123038
123050
  webIndexPostgresSchemaSql
123039
123051
  };
123040
123052
 
123041
- //# debugId=977A90765872948B64756E2164756E21
123053
+ //# debugId=FF54FBCBBDBC8F3C64756E2164756E21
123042
123054
  //# sourceMappingURL=index.js.map