@absolutejs/rag 0.10.0 → 0.12.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.
@@ -0,0 +1,24 @@
1
+ export type WebLink = {
2
+ url: string;
3
+ label: string;
4
+ };
5
+ export type WebImage = {
6
+ url: string | null;
7
+ label: string;
8
+ context: string;
9
+ };
10
+ export type WebMedia = {
11
+ kind: "video" | "audio" | "embed" | "captions";
12
+ url: string;
13
+ label: string;
14
+ };
15
+ export type WebEvidence = {
16
+ links: WebLink[];
17
+ images: WebImage[];
18
+ media: WebMedia[];
19
+ canonicalUrl: string | null;
20
+ };
21
+ /** Preserve semantic evidence that visible body text omits. Labels are not verified customer relationships. */
22
+ export declare const extractWebEvidence: (html: string, url: string) => WebEvidence;
23
+ /** Navigation/footer text alone must not mask an empty or loading app root. */
24
+ export declare const hasIncompleteAppContent: (html: string) => boolean;
@@ -0,0 +1,52 @@
1
+ import { type WebEvidence } from "./evidence";
2
+ import type { WebRedirect } from "./transport";
3
+ export type { WebEvidence, WebLink, WebImage, WebMedia } from "./evidence";
4
+ export type { WebRedirect } from "./transport";
5
+ import { fetchPublicWebResource } from "./transport";
6
+ export { fetchPublicWebResource, validatePublicWebUrl, isPublicWebAddress, WebReadError, } from "./transport";
7
+ export type { WebFetchResult, WebFetchOptions } from "./transport";
8
+ export type WebReadAttempt = {
9
+ method: "http" | "browser";
10
+ status: string;
11
+ httpStatus?: number;
12
+ extractedChars?: number;
13
+ };
14
+ export type WebReadResult = {
15
+ status: "ok" | "partial" | "error";
16
+ url: string;
17
+ finalUrl: string;
18
+ title: string | null;
19
+ text: string;
20
+ method: "http" | "browser";
21
+ truncated: boolean;
22
+ attempts: WebReadAttempt[];
23
+ error?: {
24
+ code: string;
25
+ message: string;
26
+ };
27
+ fetchedAt: string;
28
+ redirects: WebRedirect[];
29
+ evidence: WebEvidence;
30
+ limitations: string[];
31
+ };
32
+ export type WebRenderer = (url: string, options: {
33
+ signal: AbortSignal;
34
+ }) => Promise<{
35
+ html: string;
36
+ text?: string;
37
+ url: string;
38
+ status: number;
39
+ redirects?: WebRedirect[];
40
+ settled?: boolean;
41
+ }>;
42
+ export type ReadWebpageOptions = {
43
+ url: string;
44
+ render?: WebRenderer;
45
+ signal?: AbortSignal;
46
+ maxChars?: number;
47
+ mode?: "auto" | "browser";
48
+ fetchResource?: typeof fetchPublicWebResource;
49
+ };
50
+ /** Read prepared evidence, escalating thin HTML shells to a host-supplied browser. */
51
+ export declare const readRAGWebpage: (options: ReadWebpageOptions) => Promise<WebReadResult>;
52
+ export { readRAGWebsite } from "./website";
@@ -0,0 +1,9 @@
1
+ import type { WebRenderer } from "./index";
2
+ /** Fresh contexts share a browser, never cookies; all HTTP traffic uses pinned public DNS. */
3
+ export declare const createPlaywrightWebRenderer: (options?: {
4
+ executablePath?: string;
5
+ }) => {
6
+ render: WebRenderer;
7
+ ready: () => Promise<void>;
8
+ close: () => Promise<void>;
9
+ };
@@ -0,0 +1,29 @@
1
+ export declare class WebReadError extends Error {
2
+ code: string;
3
+ constructor(code: string, message: string);
4
+ }
5
+ export declare const isPublicWebAddress: (address: string) => boolean;
6
+ export type WebRedirect = {
7
+ from: string;
8
+ to: string;
9
+ kind: "http" | "client";
10
+ status?: number;
11
+ };
12
+ export type WebFetchResult = {
13
+ redirects?: WebRedirect[];
14
+ url: string;
15
+ status: number;
16
+ headers: Record<string, string>;
17
+ body: Uint8Array;
18
+ };
19
+ export type WebFetchOptions = {
20
+ signal?: AbortSignal;
21
+ redirect?: "follow" | "manual";
22
+ maxBytes?: number;
23
+ method?: string;
24
+ body?: string;
25
+ headers?: Record<string, string>;
26
+ };
27
+ export declare const validatePublicWebUrl: (raw: string) => URL;
28
+ /** Pin the validated DNS answer into the connection, including every redirect. */
29
+ export declare const fetchPublicWebResource: (raw: string, options?: WebFetchOptions) => Promise<WebFetchResult>;
@@ -0,0 +1,52 @@
1
+ import { type ReadWebpageOptions, type WebReadResult } from "./index";
2
+ /** Bounded company research: preserve citations and follow relevant same-origin links. */
3
+ export declare const readRAGWebsite: (options: ReadWebpageOptions & {
4
+ maxPages?: number;
5
+ }) => Promise<{
6
+ status: WebReadResult["status"];
7
+ text: string;
8
+ truncated: boolean;
9
+ pages: {
10
+ status: "ok" | "partial" | "error";
11
+ url: string;
12
+ finalUrl: string;
13
+ title: string | null;
14
+ method: "http" | "browser";
15
+ truncated: boolean;
16
+ attempts: import("./index").WebReadAttempt[];
17
+ error?: {
18
+ code: string;
19
+ message: string;
20
+ };
21
+ fetchedAt: string;
22
+ redirects: import("./transport").WebRedirect[];
23
+ evidence: import("./evidence").WebEvidence;
24
+ limitations: string[];
25
+ }[];
26
+ captionEvidence: {
27
+ url: string;
28
+ text: string;
29
+ error?: string;
30
+ }[];
31
+ coverage: {
32
+ pagesRead: number;
33
+ pageLimit: number;
34
+ remainingRelevantLinks: string[];
35
+ deadlineReached: boolean;
36
+ exhaustive: boolean;
37
+ };
38
+ citationGuidance: string;
39
+ url: string;
40
+ finalUrl: string;
41
+ title: string | null;
42
+ method: "http" | "browser";
43
+ attempts: import("./index").WebReadAttempt[];
44
+ error?: {
45
+ code: string;
46
+ message: string;
47
+ };
48
+ fetchedAt: string;
49
+ redirects: import("./transport").WebRedirect[];
50
+ evidence: import("./evidence").WebEvidence;
51
+ limitations: string[];
52
+ }>;