@absolutejs/rag 0.14.0 → 0.15.0

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.15.0 — 2026-09-18
10
+
11
+ ### Added
12
+
13
+ - **Expose bounded website documents bound to source IDs and compact inline citation links for native MCP evidence presentation.** (`readRAGWebsite`)
14
+
9
15
  ## 0.14.0 — 2026-09-18
10
16
 
11
17
  ### Added
package/README.md CHANGED
@@ -191,3 +191,9 @@ evidence text. Failed pages and unvisited links are not citable source entries.
191
191
  `citationRequirements` asks consumers to place links beside supported claims,
192
192
  avoid unsupported exclusions or ownership relationships, and keep verified brand
193
193
  changes brief. Host applications still control their generated final answers.
194
+
195
+ `kind: "website_evidence"` identifies a website research result. `documents`
196
+ binds each bounded text excerpt to a source ID, while source entries provide
197
+ compact numbered `inlineCitation` links. This lets adapters present source-local
198
+ evidence without dumping raw retrieval metadata into a model's response context.
199
+ The combined document text respects `maxChars`; truncated excerpts are marked.
package/changelog.json CHANGED
@@ -2,6 +2,19 @@
2
2
  "contract": 1,
3
3
  "name": "@absolutejs/rag",
4
4
  "releases": [
5
+ {
6
+ "changes": [
7
+ {
8
+ "kind": "added",
9
+ "summary": "Expose bounded website documents bound to source IDs and compact inline citation links for native MCP evidence presentation.",
10
+ "symbols": [
11
+ "readRAGWebsite"
12
+ ]
13
+ }
14
+ ],
15
+ "date": "2026-09-18",
16
+ "version": "0.15.0"
17
+ },
5
18
  {
6
19
  "changes": [
7
20
  {
@@ -59,10 +59,18 @@ export declare const readRAGWebsite: (options: ReadWebpageOptions & {
59
59
  redirects: import("./transport").WebRedirect[];
60
60
  evidence: import("./evidence").WebEvidence;
61
61
  limitations: string[];
62
+ kind: "website_evidence";
63
+ documents: {
64
+ sourceId: string;
65
+ text: string;
66
+ truncated: boolean;
67
+ }[];
62
68
  sources: {
69
+ id: string;
63
70
  title: string;
64
71
  url: string;
65
72
  citation: string;
73
+ inlineCitation: string;
66
74
  }[];
67
75
  citationRequirements: string;
68
76
  }>;
package/dist/web/index.js CHANGED
@@ -17786,11 +17786,32 @@ var readRAGWebsite = async (options) => {
17786
17786
  });
17787
17787
  }
17788
17788
  }
17789
- const sources = pages.filter((page) => page.status !== "error" && page.text).map((page) => {
17789
+ const sources = pages.filter((page) => page.status !== "error" && page.text).map((page, index) => {
17790
17790
  const title = (page.title || new URL(page.finalUrl).hostname).replace(/\s+/gu, " ").trim();
17791
17791
  const label = title.replace(/[\\[\]]/gu, "\\$&");
17792
17792
  const href = page.finalUrl.replace(/[<>]/gu, encodeURIComponent);
17793
- return { title, url: page.finalUrl, citation: `[${label}](<${href}>)` };
17793
+ return {
17794
+ id: `source-${index + 1}`,
17795
+ title,
17796
+ url: page.finalUrl,
17797
+ citation: `[${label}](<${href}>)`,
17798
+ inlineCitation: `[${index + 1}](<${href}>)`
17799
+ };
17800
+ });
17801
+ let remainingDocumentChars = maxChars;
17802
+ const documents = sources.flatMap((source) => {
17803
+ const page = pages.find((item) => item.finalUrl === source.url && item.text);
17804
+ if (!page || remainingDocumentChars <= 0)
17805
+ return [];
17806
+ const text = page.text.slice(0, remainingDocumentChars);
17807
+ remainingDocumentChars -= text.length;
17808
+ return [
17809
+ {
17810
+ sourceId: source.id,
17811
+ text,
17812
+ truncated: page.truncated || text.length < page.text.length
17813
+ }
17814
+ ];
17794
17815
  });
17795
17816
  const evidenceText = pages.filter((page) => page.status !== "error").map((page) => `SOURCE: ${page.finalUrl}
17796
17817
  CITATION: ${sources.find((source) => source.url === page.finalUrl)?.citation ?? page.finalUrl}
@@ -17802,6 +17823,8 @@ ${page.text}`).join(`
17802
17823
  const incomplete = pages.some((page) => page.status !== "ok") || signal.aborted;
17803
17824
  const unvisited = queue.filter((link) => !visited.has(link.url.split("#")[0]));
17804
17825
  return {
17826
+ kind: "website_evidence",
17827
+ documents,
17805
17828
  sources,
17806
17829
  citationRequirements: "The final answer must contain clickable Markdown source links, not just source names or bare domain mentions. Reuse sources[].citation beside the factual paragraph, list or table row it supports. Cite the actual supporting page, not the homepage for everything. Every factual section needs its supporting links. Do not invent sources or use unread links as evidence. Before responding, check that company facts, service descriptions, customer examples and numerical claims have supporting links; retrieve or omit unsupported claims. A list of large customers does not prove smaller customers are excluded. Preserve the brands actually named in the evidence; do not append parent companies, ownership relationships, current-account status, market rankings or rebrand history from memory. Label reasoned inferences as such. A verified brand change needs at most one short, cited sentence unless the user asks for its history.",
17807
17830
  ...first,
@@ -18002,5 +18025,5 @@ export {
18002
18025
  validatePublicWebUrl
18003
18026
  };
18004
18027
 
18005
- //# debugId=C770BC61DAD3A78A64756E2164756E21
18028
+ //# debugId=3F4B779525714ED064756E2164756E21
18006
18029
  //# sourceMappingURL=index.js.map