@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.
@@ -121453,6 +121453,7 @@ ${prompt}`,
121453
121453
  const requiredPhrases = input.requiredPhrases ?? (input.queryMode === "task" ? [] : [...input.query.matchAll(/"([^"\n]+)"/gu)].map((match) => match[1]));
121454
121454
  const urls = new Set;
121455
121455
  const queries = new Set;
121456
+ const discoveredLinks = new Map;
121456
121457
  let evidenceChars = 0;
121457
121458
  const sourceText = new Map;
121458
121459
  const rebalanceEvidence = () => {
@@ -121524,7 +121525,7 @@ ${prompt}`,
121524
121525
  const doRead = async (url) => {
121525
121526
  if (urls.has(url) || urls.size >= limits.reads)
121526
121527
  return;
121527
- if (!result.searches.some((search) => search.sources.some((source) => source.url === url)))
121528
+ if (!discoveredLinks.has(url) && !result.searches.some((search) => search.sources.some((source) => source.url === url)))
121528
121529
  return;
121529
121530
  urls.add(url);
121530
121531
  const page = await operate("read", () => (config.reader ?? readRAGWebpage)({
@@ -121537,6 +121538,16 @@ ${prompt}`,
121537
121538
  if (page.status !== "ok")
121538
121539
  result.limitations.push(`Page read ${page.status}: ${url}`);
121539
121540
  if (page.text && page.status !== "error") {
121541
+ for (const link of page.evidence.links) {
121542
+ if (discoveredLinks.size >= 64)
121543
+ break;
121544
+ try {
121545
+ const target = validatePublicWebUrl(new URL(link.url, page.finalUrl).href);
121546
+ target.hash = "";
121547
+ if (!discoveredLinks.has(target.href))
121548
+ discoveredLinks.set(target.href, { url: target.href, label: link.label.slice(0, 200), discoveredOn: page.finalUrl });
121549
+ } catch {}
121550
+ }
121540
121551
  const prior = result.sources.find((source) => source.url === url);
121541
121552
  if (prior) {
121542
121553
  sourceText.set(prior.url, page.text.slice(0, limits.evidenceChars));
@@ -121575,11 +121586,12 @@ ${prompt}`,
121575
121586
  break;
121576
121587
  let plan;
121577
121588
  try {
121578
- 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.", {
121589
+ 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.", {
121579
121590
  query: input.query,
121580
121591
  schema: task.schema,
121581
121592
  instructions: task.instructions,
121582
121593
  sources: result.sources,
121594
+ discoveredLinks: [...discoveredLinks.values()].filter((link) => !urls.has(link.url)),
121583
121595
  searched: [...queries],
121584
121596
  read: [...urls],
121585
121597
  remainingSearches: limits.searches - queries.size,
@@ -122499,5 +122511,5 @@ export {
122499
122511
  selectResearchMonitorEvents
122500
122512
  };
122501
122513
 
122502
- //# debugId=F48D3A6490A0A2CE64756E2164756E21
122514
+ //# debugId=98A81F60666A9C0F64756E2164756E21
122503
122515
  //# sourceMappingURL=index.js.map