@autorag/librarian 2.5.1 → 2.5.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/NOTICE +3 -0
- package/README.md +229 -490
- package/dist/agent/agent.d.ts +44 -2
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/search-datasource-tool.d.ts +1 -0
- package/dist/agent/search-single-datasource-tool.d.ts +57 -0
- package/dist/agent/web-fetch-tool.d.ts +32 -0
- package/dist/agent/web-search-tool.d.ts +48 -0
- package/dist/cli/commands/lite-retrieve.d.ts +15 -0
- package/dist/cli/commands/search.d.ts +6 -0
- package/dist/cli/config.d.ts +20 -0
- package/dist/cli/index.js +6478 -372
- package/dist/core.d.ts +3 -1
- package/dist/core.js +6499 -409
- package/dist/datasource/connector-skill.d.ts +6 -0
- package/dist/datasource/crawler-skill.d.ts +2 -0
- package/dist/datasource/errors.d.ts +26 -0
- package/dist/datasource/skills/slack/index.d.ts +8 -0
- package/dist/datasource/tool-naming.d.ts +11 -0
- package/dist/index.js +6508 -419
- package/dist/minsync/types.d.ts +7 -0
- package/dist/retrieval/engine.d.ts +14 -5
- package/dist/retrieval/index.d.ts +2 -1
- package/dist/retrieval/merger.d.ts +30 -5
- package/dist/retrieval/skip.d.ts +41 -0
- package/dist/retrieval/types.d.ts +23 -2
- package/dist/web/entities.d.ts +10 -0
- package/dist/web/fetch/convert.d.ts +35 -0
- package/dist/web/fetch/feeds.d.ts +37 -0
- package/dist/web/fetch/html-renderer.d.ts +54 -0
- package/dist/web/fetch/index.d.ts +12 -0
- package/dist/web/fetch/negotiate.d.ts +27 -0
- package/dist/web/fetch/page-loader.d.ts +60 -0
- package/dist/web/fetch/render.d.ts +23 -0
- package/dist/web/fetch/turndown/gfm.d.ts +11 -0
- package/dist/web/fetch/turndown/html.d.ts +5 -0
- package/dist/web/fetch/turndown/index.d.ts +10 -0
- package/dist/web/fetch/turndown/service.d.ts +21 -0
- package/dist/web/fetch/turndown/types.d.ts +73 -0
- package/dist/web/fetch/url-target.d.ts +29 -0
- package/dist/web/search/browser-headers.d.ts +17 -0
- package/dist/web/search/browser-loader.d.ts +56 -0
- package/dist/web/search/browser-page.d.ts +41 -0
- package/dist/web/search/credentials.d.ts +10 -0
- package/dist/web/search/format.d.ts +30 -0
- package/dist/web/search/index.d.ts +46 -0
- package/dist/web/search/model-auth.d.ts +36 -0
- package/dist/web/search/provider.d.ts +62 -0
- package/dist/web/search/providers/anthropic.d.ts +9 -0
- package/dist/web/search/providers/base.d.ts +106 -0
- package/dist/web/search/providers/codex.d.ts +9 -0
- package/dist/web/search/providers/duckduckgo.d.ts +22 -0
- package/dist/web/search/providers/ecosia.d.ts +29 -0
- package/dist/web/search/providers/gemini.d.ts +9 -0
- package/dist/web/search/providers/google.d.ts +22 -0
- package/dist/web/search/providers/mojeek.d.ts +24 -0
- package/dist/web/search/providers/parallel.d.ts +10 -0
- package/dist/web/search/providers/perplexity.d.ts +10 -0
- package/dist/web/search/providers/public.d.ts +15 -0
- package/dist/web/search/providers/responses-api.d.ts +26 -0
- package/dist/web/search/providers/searxng.d.ts +19 -0
- package/dist/web/search/providers/startpage.d.ts +25 -0
- package/dist/web/search/providers/utils.d.ts +39 -0
- package/dist/web/search/providers/xai.d.ts +9 -0
- package/dist/web/search/query.d.ts +193 -0
- package/dist/web/search/types.d.ts +198 -0
- package/dist/web/search/utils.d.ts +8 -0
- package/package.json +2 -1
- package/skills/autorag/SKILL.md +2 -1
- package/skills/autorag-doctor/SKILL.md +237 -0
- package/skills/autorag-lite-search/SKILL.md +29 -7
- package/skills/autorag-lite-setup/SKILL.md +20 -13
- package/skills/autorag-setup/SKILL.md +32 -14
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startpage proxies Google's index behind a privacy frontend and serves fully
|
|
3
|
+
* server-rendered result pages — no JS challenge on the happy path. Its bot
|
|
4
|
+
* defense keys on requests that skip the homepage handshake: the search form
|
|
5
|
+
* carries a session token (`sc`) plus sibling hidden inputs, and posting the
|
|
6
|
+
* form with a stale/absent token 302s to the `/en/errors/` CAPTCHA shell.
|
|
7
|
+
* The robust flow is therefore the same dance a real browser performs: GET
|
|
8
|
+
* the homepage, lift the form's hidden inputs, POST them back with the query.
|
|
9
|
+
*
|
|
10
|
+
* Ported from oh-my-pi (can1357/oh-my-pi, MIT)
|
|
11
|
+
* `packages/coding-agent/src/web/search/providers/startpage.ts`.
|
|
12
|
+
*/
|
|
13
|
+
import type { SearchProviderId, SearchResponse } from "../types.js";
|
|
14
|
+
import type { SearchParams } from "./base.js";
|
|
15
|
+
import { SearchProvider } from "./base.js";
|
|
16
|
+
/** Execute a Startpage web search via the homepage-token form flow. */
|
|
17
|
+
export declare function searchStartpage(params: SearchParams): Promise<SearchResponse>;
|
|
18
|
+
/** Search provider for Startpage (no API key required). */
|
|
19
|
+
export declare class StartpageProvider extends SearchProvider {
|
|
20
|
+
readonly id: SearchProviderId;
|
|
21
|
+
readonly label = "Startpage";
|
|
22
|
+
isAvailable(): boolean;
|
|
23
|
+
isExplicitlyAvailable(): boolean;
|
|
24
|
+
search(params: SearchParams): Promise<SearchResponse>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for web search providers.
|
|
3
|
+
*
|
|
4
|
+
* Ported from oh-my-pi (can1357/oh-my-pi, MIT) `web/search/providers/utils.ts`.
|
|
5
|
+
*/
|
|
6
|
+
import { SearchProviderError, type SearchProviderId, type SearchSource } from "../types.js";
|
|
7
|
+
/**
|
|
8
|
+
* The 60-second default tolerates legitimate slow LLM-mediated responses
|
|
9
|
+
* while bounding stalls when the runtime's `AbortSignal` fails to propagate.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SEARCH_HARD_TIMEOUT_MS: number;
|
|
12
|
+
/**
|
|
13
|
+
* Compose a caller-supplied {@link AbortSignal} with a hard timeout so an
|
|
14
|
+
* outbound `fetch()` is guaranteed to settle within `ms` even when the
|
|
15
|
+
* runtime fails to propagate cancellation to the underlying transport.
|
|
16
|
+
*/
|
|
17
|
+
export declare function withHardTimeout(signal: AbortSignal | undefined, ms?: number): AbortSignal;
|
|
18
|
+
/**
|
|
19
|
+
* Map a provider's raw source list to the unified SearchSource shape,
|
|
20
|
+
* clamped to the requested result count and annotated with ageSeconds.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toSearchSources(sources: ReadonlyArray<{
|
|
23
|
+
title: string;
|
|
24
|
+
url: string;
|
|
25
|
+
snippet?: string;
|
|
26
|
+
publishedDate?: string;
|
|
27
|
+
}>, numResults: number): SearchSource[];
|
|
28
|
+
export declare function classifyProviderHttpError(provider: SearchProviderId, status: number, body: string): SearchProviderError | null;
|
|
29
|
+
/**
|
|
30
|
+
* Collapse runs of whitespace in a loosely-typed provider field, returning
|
|
31
|
+
* `undefined` for missing/non-string/blank values. Shared so tab/newline
|
|
32
|
+
* folding cannot drift between providers.
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeSearchText(value: unknown): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Read a provider response body up to a byte cap, truncating or throwing when
|
|
37
|
+
* the limit is exceeded. Shared so streaming-cap fixes land in one place.
|
|
38
|
+
*/
|
|
39
|
+
export declare function readLimitedText(response: Response, provider: SearchProviderId, maxBytes: number, truncate?: boolean): Promise<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SearchResponse } from "../types.js";
|
|
2
|
+
import type { SearchAvailabilityContext, SearchParams } from "./base.js";
|
|
3
|
+
import { SearchProvider } from "./base.js";
|
|
4
|
+
export declare class XaiProvider extends SearchProvider {
|
|
5
|
+
readonly id: "xai";
|
|
6
|
+
readonly label = "xAI";
|
|
7
|
+
isAvailable(context?: SearchAvailabilityContext): boolean;
|
|
8
|
+
search(params: SearchParams): Promise<SearchResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured web-search query parsing.
|
|
3
|
+
*
|
|
4
|
+
* Agents habitually embed Google-style directives in search queries —
|
|
5
|
+
* `site:`, `before:`/`after:`, `inurl:`, `filetype:`, quoted phrases, `OR`
|
|
6
|
+
* groups, `-exclusions` — regardless of whether the backing engine parses
|
|
7
|
+
* them. This module turns a raw query into a {@link StructuredQuery} so each
|
|
8
|
+
* provider can:
|
|
9
|
+
*
|
|
10
|
+
* 1. map constraints onto native API parameters where they exist (Tavily
|
|
11
|
+
* `include_domains`, Exa date bounds, …),
|
|
12
|
+
* 2. rebuild a query string containing only the syntax the target engine
|
|
13
|
+
* understands ({@link formatQuery}), and
|
|
14
|
+
* 3. post-filter returned sources leniently ({@link applyQueryConstraints}):
|
|
15
|
+
* a constraint dimension that would eliminate every result is dropped and
|
|
16
|
+
* reported rather than returning nothing.
|
|
17
|
+
*
|
|
18
|
+
* Ported from oh-my-pi (can1357/oh-my-pi, MIT)
|
|
19
|
+
* `packages/coding-agent/src/web/search/query.ts`.
|
|
20
|
+
*/
|
|
21
|
+
import type { SearchSource } from "./types.js";
|
|
22
|
+
/** One free-text token of the query (everything that is not a recognized directive). */
|
|
23
|
+
export interface QueryTerm {
|
|
24
|
+
/** Term text without quotes or operator prefixes. */
|
|
25
|
+
text: string;
|
|
26
|
+
/** Quoted exact phrase (`"like this"`) or verbatim-required (`+term`). */
|
|
27
|
+
phrase?: boolean;
|
|
28
|
+
/** Excluded via `-term` or `NOT term`. */
|
|
29
|
+
negated?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* OR-group id. Terms sharing an id are alternatives (`a OR b`); terms
|
|
32
|
+
* without a group are implicitly AND-ed. Groups are always contiguous
|
|
33
|
+
* runs in {@link StructuredQuery.terms}.
|
|
34
|
+
*/
|
|
35
|
+
group?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A raw query decomposed into free text plus every recognized constraint.
|
|
39
|
+
*
|
|
40
|
+
* All list fields are always present (possibly empty) so consumers can map
|
|
41
|
+
* over them without null checks. Values are stored as typed by the user
|
|
42
|
+
* except for normalization noted per field.
|
|
43
|
+
*/
|
|
44
|
+
export interface StructuredQuery {
|
|
45
|
+
/** Original query string, verbatim. */
|
|
46
|
+
raw: string;
|
|
47
|
+
/**
|
|
48
|
+
* Free-text remainder with all recognized directives removed; phrases
|
|
49
|
+
* stay quoted, exclusions keep `-`, OR groups keep `OR`. Empty when the
|
|
50
|
+
* query was directives only — use {@link formatQuery} for a never-empty
|
|
51
|
+
* engine query.
|
|
52
|
+
*/
|
|
53
|
+
text: string;
|
|
54
|
+
/** Ordered free-text terms (phrases, exclusions, OR groups). */
|
|
55
|
+
terms: QueryTerm[];
|
|
56
|
+
/** `site:`/`domain:`/`host:` includes — any-of. Lowercased, scheme stripped, may carry a path (`github.com/anthropics`). */
|
|
57
|
+
sites: string[];
|
|
58
|
+
/** `-site:` exclusions, same normalization as {@link sites}. */
|
|
59
|
+
excludedSites: string[];
|
|
60
|
+
/** `inurl:`/`url:`/`allinurl:` substrings — all must appear in the URL. */
|
|
61
|
+
inUrl: string[];
|
|
62
|
+
/** `-inurl:` substrings — none may appear in the URL. */
|
|
63
|
+
excludedInUrl: string[];
|
|
64
|
+
/** `intitle:`/`title:`/`allintitle:` substrings — all must appear in the title. */
|
|
65
|
+
inTitle: string[];
|
|
66
|
+
/** `-intitle:` substrings — none may appear in the title. */
|
|
67
|
+
excludedInTitle: string[];
|
|
68
|
+
/** `intext:`/`inbody:`/`inanchor:`/`allintext:` body substrings. Not post-filterable (snippets are partial); query-building only. */
|
|
69
|
+
inText: string[];
|
|
70
|
+
/** `-intext:` body exclusions. Query-building only. */
|
|
71
|
+
excludedInText: string[];
|
|
72
|
+
/** `filetype:`/`ext:` extensions — any-of. Lowercased, no leading dot. */
|
|
73
|
+
filetypes: string[];
|
|
74
|
+
/** `-filetype:`/`-ext:` extensions — none may match. */
|
|
75
|
+
excludedFiletypes: string[];
|
|
76
|
+
/** Inclusive lower publish-date bound from `after:`/`since:`, ISO `YYYY-MM-DD`. */
|
|
77
|
+
after?: string;
|
|
78
|
+
/** Exclusive upper publish-date bound from `before:`/`until:`, ISO `YYYY-MM-DD`. */
|
|
79
|
+
before?: string;
|
|
80
|
+
/** Language code from `lang:`/`language:`, lowercased (e.g. `en`, `en-us`). */
|
|
81
|
+
lang?: string;
|
|
82
|
+
/** True when any directive or boolean operator was recognized. */
|
|
83
|
+
hasDirectives: boolean;
|
|
84
|
+
/** True when any post-filterable constraint is set (sites, url/title terms, filetypes, date bounds). */
|
|
85
|
+
hasConstraints: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Query-syntax capabilities of a target engine, used by {@link formatQuery}
|
|
89
|
+
* to decide which parsed features are re-emitted as query text. Everything
|
|
90
|
+
* defaults to `false`: the zero-value produces plain keywords suitable for
|
|
91
|
+
* natural-language APIs.
|
|
92
|
+
*/
|
|
93
|
+
export interface QuerySyntax {
|
|
94
|
+
/** Emit `"quoted phrases"`. */
|
|
95
|
+
phrases?: boolean;
|
|
96
|
+
/** Emit `-term` exclusions (negated terms are dropped otherwise). */
|
|
97
|
+
negation?: boolean;
|
|
98
|
+
/** Emit `OR` between alternatives (groups are flattened to keywords otherwise). */
|
|
99
|
+
or?: boolean;
|
|
100
|
+
/** Emit `site:`/`-site:`. */
|
|
101
|
+
site?: boolean;
|
|
102
|
+
/** Emit `inurl:`/`-inurl:`. */
|
|
103
|
+
inUrl?: boolean;
|
|
104
|
+
/** Emit `intitle:`/`-intitle:`. */
|
|
105
|
+
inTitle?: boolean;
|
|
106
|
+
/** Emit `intext:`/`-intext:`. */
|
|
107
|
+
inText?: boolean;
|
|
108
|
+
/** Emit `filetype:`/`-filetype:`. */
|
|
109
|
+
filetype?: boolean;
|
|
110
|
+
/** Emit `before:`/`after:` ISO date bounds. */
|
|
111
|
+
dateRange?: boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Full Google-style syntax: engines that parse the classic operator set (Google, Startpage, Ecosia, Brave, Kagi, Mojeek, SearXNG…). */
|
|
114
|
+
export declare const GOOGLE_QUERY_SYNTAX: QuerySyntax;
|
|
115
|
+
/** Result of {@link applyQueryConstraints}. */
|
|
116
|
+
export interface ConstraintFilterResult {
|
|
117
|
+
/** Sources surviving the lenient filter — never empty when the input was non-empty. */
|
|
118
|
+
sources: SearchSource[];
|
|
119
|
+
/**
|
|
120
|
+
* Directive renderings (`site:arxiv.org`, `before:2024-01-01`, …) of the
|
|
121
|
+
* constraint dimensions that matched zero sources and were therefore
|
|
122
|
+
* relaxed instead of enforced.
|
|
123
|
+
*/
|
|
124
|
+
dropped: string[];
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Parse a `before:`/`after:` value into ISO `YYYY-MM-DD`.
|
|
128
|
+
* Accepts `YYYY`, `YYYY-MM`, `YYYY-MM-DD` (also `/` and `.` separators) and
|
|
129
|
+
* `MM/DD/YYYY` (day-first assumed when the first field exceeds 12).
|
|
130
|
+
* Bare years/months resolve to the first day of the period, matching
|
|
131
|
+
* Google's `after:2024` ≙ `after:2024-01-01` semantics.
|
|
132
|
+
*/
|
|
133
|
+
export declare function parseDateValue(value: string): string | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Parse a raw query into a {@link StructuredQuery}.
|
|
136
|
+
*
|
|
137
|
+
* Lenient by construction: unknown `name:value` tokens (URLs, `C:\paths`,
|
|
138
|
+
* `TS2345:`, jargon) stay in the free text verbatim, and a directive with an
|
|
139
|
+
* unparseable value (`before:someday`) degrades to a plain term instead of
|
|
140
|
+
* being dropped.
|
|
141
|
+
*/
|
|
142
|
+
export declare function parseSearchQuery(raw: string): StructuredQuery;
|
|
143
|
+
/**
|
|
144
|
+
* Rebuild a query string for an engine with the given {@link QuerySyntax}.
|
|
145
|
+
*
|
|
146
|
+
* Constraints whose syntax the engine lacks are omitted (the caller maps
|
|
147
|
+
* them onto API parameters or relies on {@link applyQueryConstraints}).
|
|
148
|
+
* Never returns an empty string for a non-empty input: a directives-only
|
|
149
|
+
* query falls back to the constraint values as keywords, then to `raw` — an
|
|
150
|
+
* engine searching *something* beats an empty-query error.
|
|
151
|
+
*/
|
|
152
|
+
export declare function formatQuery(q: StructuredQuery, syntax?: QuerySyntax): string;
|
|
153
|
+
/**
|
|
154
|
+
* Build the engine query for a credential-free HTML engine (Google,
|
|
155
|
+
* Startpage, DuckDuckGo, Ecosia, Mojeek, SearXNG, and the Public Web
|
|
156
|
+
* fan-out over them).
|
|
157
|
+
*
|
|
158
|
+
* Canonicalizes directives via {@link formatQuery} with the engine's
|
|
159
|
+
* {@link QuerySyntax} (default: full Google syntax), after demoting the
|
|
160
|
+
* operators that zero-match across the scraper set: engines only match
|
|
161
|
+
* `site:` against a bare domain (a path yields zero results everywhere),
|
|
162
|
+
* and DuckDuckGo ignores `inurl:` entirely — so either operator silently
|
|
163
|
+
* empties the result set. The raw URL as a plain term matches fine, so
|
|
164
|
+
* bare-domain `site:` filters are kept while path-carrying `site:` and all
|
|
165
|
+
* `inurl:` values become plain keywords; the demotion is structural (before
|
|
166
|
+
* formatting), so OR-grouped and quoted directives are covered. Negated
|
|
167
|
+
* forms (`-site:`, `-inurl:`) pass through untouched — demoting them would
|
|
168
|
+
* invert an exclusion into a search term; the pipeline post-filter
|
|
169
|
+
* ({@link applyQueryConstraints}) enforces every demoted or unsupported
|
|
170
|
+
* constraint on the returned sources. Directive-free queries pass through
|
|
171
|
+
* byte-identical.
|
|
172
|
+
*/
|
|
173
|
+
export declare function formatScraperQuery(query: string, parsedQuery?: StructuredQuery, syntax?: QuerySyntax): string;
|
|
174
|
+
/**
|
|
175
|
+
* `site:` matcher: exact host or subdomain of `site`; when `site` carries a
|
|
176
|
+
* path (`github.com/anthropics`), the URL path must start with it.
|
|
177
|
+
*/
|
|
178
|
+
export declare function matchesSite(url: string, site: string): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Strict per-source constraint check: every filterable dimension of `q` must
|
|
181
|
+
* pass. Sources without a resolvable date pass date bounds (a missing date
|
|
182
|
+
* is not proof of violation). For custom provider flows; the standard path
|
|
183
|
+
* is {@link applyQueryConstraints}.
|
|
184
|
+
*/
|
|
185
|
+
export declare function matchesQueryConstraints(source: SearchSource, q: StructuredQuery): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Lenient post-filter: applies each constraint dimension of `q` in turn,
|
|
188
|
+
* skipping (and reporting) any dimension that would eliminate every
|
|
189
|
+
* remaining source. Guarantees a non-empty result for a non-empty input, so
|
|
190
|
+
* a mis-scoped directive degrades to unfiltered results plus a note instead
|
|
191
|
+
* of a dead search.
|
|
192
|
+
*/
|
|
193
|
+
export declare function applyQueryConstraints(sources: readonly SearchSource[], q: StructuredQuery): ConstraintFilterResult;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Search Types
|
|
3
|
+
*
|
|
4
|
+
* Unified types for web search responses across supported providers.
|
|
5
|
+
* Ported from oh-my-pi (can1357/oh-my-pi, MIT) `web/search/types.ts`,
|
|
6
|
+
* trimmed to a credential-free-only surface: model-native providers that
|
|
7
|
+
* reuse the agent's own model credentials (gemini, anthropic, codex, xai —
|
|
8
|
+
* see `model-auth.ts`), the always-keyless routes (perplexity anonymous ask,
|
|
9
|
+
* parallel MCP), the explicitly-advanced SearXNG endpoint, and the
|
|
10
|
+
* credential-free scraped engines. oh-my-pi's vendor-key providers (brave,
|
|
11
|
+
* tavily, exa, jina, kagi, kimi, zai, tinyfish, synthetic, ollama,
|
|
12
|
+
* firecrawl) are intentionally absent: a default AutoRAG install must never
|
|
13
|
+
* require a user-issued search key or signup.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SEARCH_PROVIDER_OPTIONS: readonly [{
|
|
16
|
+
readonly value: "auto";
|
|
17
|
+
readonly label: "Auto";
|
|
18
|
+
readonly description: "Automatically uses the first configured web-search provider";
|
|
19
|
+
}, {
|
|
20
|
+
readonly value: "gemini";
|
|
21
|
+
readonly label: "Gemini";
|
|
22
|
+
readonly description: "Google Search grounding via the agent's Gemini model credentials (GEMINI_API_KEY/GOOGLE_API_KEY)";
|
|
23
|
+
}, {
|
|
24
|
+
readonly value: "anthropic";
|
|
25
|
+
readonly label: "Anthropic";
|
|
26
|
+
readonly description: "Claude's built-in web_search via the agent's Anthropic model credentials (ANTHROPIC_API_KEY)";
|
|
27
|
+
}, {
|
|
28
|
+
readonly value: "codex";
|
|
29
|
+
readonly label: "OpenAI";
|
|
30
|
+
readonly description: "OpenAI Responses web_search via the agent's OpenAI model credentials (OPENAI_API_KEY)";
|
|
31
|
+
}, {
|
|
32
|
+
readonly value: "xai";
|
|
33
|
+
readonly label: "xAI";
|
|
34
|
+
readonly description: "xAI Responses web_search via the agent's xAI model credentials (XAI_API_KEY)";
|
|
35
|
+
}, {
|
|
36
|
+
readonly value: "perplexity";
|
|
37
|
+
readonly label: "Perplexity";
|
|
38
|
+
readonly description: "Anonymous Perplexity ask endpoint; no key or signup required";
|
|
39
|
+
}, {
|
|
40
|
+
readonly value: "parallel";
|
|
41
|
+
readonly label: "Parallel";
|
|
42
|
+
readonly description: "Parallel's keyless web search MCP endpoint; no key or signup required";
|
|
43
|
+
}, {
|
|
44
|
+
readonly value: "searxng";
|
|
45
|
+
readonly label: "SearXNG";
|
|
46
|
+
readonly description: "Advanced: requires a self-hosted SEARXNG_ENDPOINT; never part of the default experience";
|
|
47
|
+
}, {
|
|
48
|
+
readonly value: "startpage";
|
|
49
|
+
readonly label: "Startpage";
|
|
50
|
+
readonly description: "Credential-free scrape of Startpage (Google-backed) results; may be bot-challenged";
|
|
51
|
+
}, {
|
|
52
|
+
readonly value: "duckduckgo";
|
|
53
|
+
readonly label: "DuckDuckGo";
|
|
54
|
+
readonly description: "Credential-free best-effort fallback; may be bot-challenged on datacenter/shared-egress IPs";
|
|
55
|
+
}, {
|
|
56
|
+
readonly value: "ecosia";
|
|
57
|
+
readonly label: "Ecosia";
|
|
58
|
+
readonly description: "Credential-free scrape of Ecosia (Google-backed) results";
|
|
59
|
+
}, {
|
|
60
|
+
readonly value: "google";
|
|
61
|
+
readonly label: "Google";
|
|
62
|
+
readonly description: "Credential-free fallback; slower and may be bot-challenged";
|
|
63
|
+
}, {
|
|
64
|
+
readonly value: "mojeek";
|
|
65
|
+
readonly label: "Mojeek";
|
|
66
|
+
readonly description: "Credential-free scrape of Mojeek's independent index";
|
|
67
|
+
}, {
|
|
68
|
+
readonly value: "public";
|
|
69
|
+
readonly label: "Public Web";
|
|
70
|
+
readonly description: "Queries every credential-free engine in parallel and consolidates deduplicated results";
|
|
71
|
+
}];
|
|
72
|
+
/** Default hard timeout for each web-search provider transport. */
|
|
73
|
+
export declare const DEFAULT_WEB_SEARCH_TIMEOUT_SECONDS = 60;
|
|
74
|
+
/** Maximum configurable hard timeout for each web-search provider transport. */
|
|
75
|
+
export declare const MAX_WEB_SEARCH_TIMEOUT_SECONDS = 300;
|
|
76
|
+
/** Supported web search providers (every option except `auto`). */
|
|
77
|
+
export type SearchProviderId = Exclude<(typeof SEARCH_PROVIDER_OPTIONS)[number]["value"], "auto">;
|
|
78
|
+
/**
|
|
79
|
+
* Auto-resolution priority order. Derived from {@link SEARCH_PROVIDER_OPTIONS}
|
|
80
|
+
* (minus `auto`) so any dropdown/setting and `resolveProviderChain()` share
|
|
81
|
+
* one source of truth and never drift apart: credential-free and
|
|
82
|
+
* model-credential-reusing providers first, then the scraped engines, with
|
|
83
|
+
* the public fan-out last (explicit selection only).
|
|
84
|
+
*/
|
|
85
|
+
export declare const SEARCH_PROVIDER_ORDER: readonly SearchProviderId[];
|
|
86
|
+
/** Concrete provider choices (no `auto` sentinel) — for list-valued settings like order/exclude. */
|
|
87
|
+
export declare const SEARCH_PROVIDER_CHOICES: ({
|
|
88
|
+
readonly value: "gemini";
|
|
89
|
+
readonly label: "Gemini";
|
|
90
|
+
readonly description: "Google Search grounding via the agent's Gemini model credentials (GEMINI_API_KEY/GOOGLE_API_KEY)";
|
|
91
|
+
} | {
|
|
92
|
+
readonly value: "anthropic";
|
|
93
|
+
readonly label: "Anthropic";
|
|
94
|
+
readonly description: "Claude's built-in web_search via the agent's Anthropic model credentials (ANTHROPIC_API_KEY)";
|
|
95
|
+
} | {
|
|
96
|
+
readonly value: "codex";
|
|
97
|
+
readonly label: "OpenAI";
|
|
98
|
+
readonly description: "OpenAI Responses web_search via the agent's OpenAI model credentials (OPENAI_API_KEY)";
|
|
99
|
+
} | {
|
|
100
|
+
readonly value: "xai";
|
|
101
|
+
readonly label: "xAI";
|
|
102
|
+
readonly description: "xAI Responses web_search via the agent's xAI model credentials (XAI_API_KEY)";
|
|
103
|
+
} | {
|
|
104
|
+
readonly value: "perplexity";
|
|
105
|
+
readonly label: "Perplexity";
|
|
106
|
+
readonly description: "Anonymous Perplexity ask endpoint; no key or signup required";
|
|
107
|
+
} | {
|
|
108
|
+
readonly value: "parallel";
|
|
109
|
+
readonly label: "Parallel";
|
|
110
|
+
readonly description: "Parallel's keyless web search MCP endpoint; no key or signup required";
|
|
111
|
+
} | {
|
|
112
|
+
readonly value: "searxng";
|
|
113
|
+
readonly label: "SearXNG";
|
|
114
|
+
readonly description: "Advanced: requires a self-hosted SEARXNG_ENDPOINT; never part of the default experience";
|
|
115
|
+
} | {
|
|
116
|
+
readonly value: "startpage";
|
|
117
|
+
readonly label: "Startpage";
|
|
118
|
+
readonly description: "Credential-free scrape of Startpage (Google-backed) results; may be bot-challenged";
|
|
119
|
+
} | {
|
|
120
|
+
readonly value: "duckduckgo";
|
|
121
|
+
readonly label: "DuckDuckGo";
|
|
122
|
+
readonly description: "Credential-free best-effort fallback; may be bot-challenged on datacenter/shared-egress IPs";
|
|
123
|
+
} | {
|
|
124
|
+
readonly value: "ecosia";
|
|
125
|
+
readonly label: "Ecosia";
|
|
126
|
+
readonly description: "Credential-free scrape of Ecosia (Google-backed) results";
|
|
127
|
+
} | {
|
|
128
|
+
readonly value: "google";
|
|
129
|
+
readonly label: "Google";
|
|
130
|
+
readonly description: "Credential-free fallback; slower and may be bot-challenged";
|
|
131
|
+
} | {
|
|
132
|
+
readonly value: "mojeek";
|
|
133
|
+
readonly label: "Mojeek";
|
|
134
|
+
readonly description: "Credential-free scrape of Mojeek's independent index";
|
|
135
|
+
} | {
|
|
136
|
+
readonly value: "public";
|
|
137
|
+
readonly label: "Public Web";
|
|
138
|
+
readonly description: "Queries every credential-free engine in parallel and consolidates deduplicated results";
|
|
139
|
+
})[];
|
|
140
|
+
export declare const SEARCH_PROVIDER_PREFERENCES: readonly ["auto", ...SearchProviderId[]];
|
|
141
|
+
/** Display labels, derived from {@link SEARCH_PROVIDER_OPTIONS}. */
|
|
142
|
+
export declare const SEARCH_PROVIDER_LABELS: Record<SearchProviderId, string>;
|
|
143
|
+
export declare function isSearchProviderId(value: string): value is SearchProviderId;
|
|
144
|
+
export declare function isSearchProviderPreference(value: string): value is SearchProviderId | "auto";
|
|
145
|
+
/** Source returned by search (all providers) */
|
|
146
|
+
export interface SearchSource {
|
|
147
|
+
title: string;
|
|
148
|
+
url: string;
|
|
149
|
+
snippet?: string;
|
|
150
|
+
/** ISO date string or relative ("2d ago") */
|
|
151
|
+
publishedDate?: string;
|
|
152
|
+
/** Age in seconds for consistent formatting */
|
|
153
|
+
ageSeconds?: number;
|
|
154
|
+
author?: string;
|
|
155
|
+
}
|
|
156
|
+
/** Citation with text reference (LLM-mediated providers) */
|
|
157
|
+
export interface SearchCitation {
|
|
158
|
+
url: string;
|
|
159
|
+
title: string;
|
|
160
|
+
citedText?: string;
|
|
161
|
+
}
|
|
162
|
+
/** Usage metrics */
|
|
163
|
+
export interface SearchUsage {
|
|
164
|
+
inputTokens?: number;
|
|
165
|
+
outputTokens?: number;
|
|
166
|
+
/** Anthropic: number of web search requests made */
|
|
167
|
+
searchRequests?: number;
|
|
168
|
+
/** Perplexity: combined token count */
|
|
169
|
+
totalTokens?: number;
|
|
170
|
+
}
|
|
171
|
+
/** Unified response across providers */
|
|
172
|
+
export interface SearchResponse {
|
|
173
|
+
provider: SearchProviderId | "none";
|
|
174
|
+
/** Synthesized answer text (LLM-mediated providers) */
|
|
175
|
+
answer?: string;
|
|
176
|
+
/** Search result sources */
|
|
177
|
+
sources: SearchSource[];
|
|
178
|
+
/** Text citations with context */
|
|
179
|
+
citations?: SearchCitation[];
|
|
180
|
+
/** Intermediate search queries */
|
|
181
|
+
searchQueries?: string[];
|
|
182
|
+
/** Follow-up question suggestions (provider-dependent) */
|
|
183
|
+
relatedQuestions?: string[];
|
|
184
|
+
/** Token usage metrics */
|
|
185
|
+
usage?: SearchUsage;
|
|
186
|
+
/** Model used */
|
|
187
|
+
model?: string;
|
|
188
|
+
/** Request ID for debugging */
|
|
189
|
+
requestId?: string;
|
|
190
|
+
/** Authentication mode used by the provider (e.g. oauth, api-key) */
|
|
191
|
+
authMode?: string;
|
|
192
|
+
}
|
|
193
|
+
/** Provider-specific error with optional HTTP status */
|
|
194
|
+
export declare class SearchProviderError extends Error {
|
|
195
|
+
readonly provider: SearchProviderId;
|
|
196
|
+
readonly status?: number;
|
|
197
|
+
constructor(provider: SearchProviderId, message: string, status?: number);
|
|
198
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small shared helpers for web search providers.
|
|
3
|
+
* Ported from oh-my-pi (can1357/oh-my-pi, MIT) `web/search/utils.ts`.
|
|
4
|
+
*/
|
|
5
|
+
/** Calculate age in seconds from an ISO date string. Returns undefined on invalid input. */
|
|
6
|
+
export declare function dateToAgeSeconds(dateStr: string | null | undefined): number | undefined;
|
|
7
|
+
/** Clamp a result count to [1, maxVal], returning defaultVal when value is absent or NaN. */
|
|
8
|
+
export declare function clampNumResults(value: number | undefined, defaultVal: number, maxVal: number): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autorag/librarian",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Self-evolving librarian agent on Pi framework with pluggable retrieval methods",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"iconv-lite": "^0.7.3",
|
|
61
61
|
"jszip": "^3.10.1",
|
|
62
62
|
"mailparser": "^3.9.20",
|
|
63
|
+
"puppeteer-core": "^25.11.0",
|
|
63
64
|
"slides-grab": "^1.5.1",
|
|
64
65
|
"smol-toml": "1.8.0",
|
|
65
66
|
"tesseract.js": "^7.0.0",
|
package/skills/autorag/SKILL.md
CHANGED
|
@@ -100,6 +100,7 @@ autorag feedback <sessionId> --useful 1,3 --not-useful 2 --json
|
|
|
100
100
|
## Maintenance
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
+
autorag setup --format json
|
|
103
104
|
autorag status --json
|
|
104
105
|
autorag health --json
|
|
105
106
|
autorag refresh --json
|
|
@@ -138,7 +139,7 @@ Never target source documents. `memory inspect` is read-only and path-opaque.
|
|
|
138
139
|
- Prefer `--json --debug` when another agent consumes search output or will
|
|
139
140
|
call `autorag feedback`.
|
|
140
141
|
- Do not invent CLI commands. `autorag --help` is the command list of record,
|
|
141
|
-
including the shipped `gateway`, `models`, `serve`, `p2p`, `tui`, and `lite`
|
|
142
|
+
including the shipped `setup`, `gateway`, `models`, `serve`, `p2p`, `tui`, and `lite`
|
|
142
143
|
commands. `autorag <command> --help` prints that command's own flags, and
|
|
143
144
|
`autorag --version` prints the installed version. See
|
|
144
145
|
`docs/embedding-runtime.md` for the local embedding runtime
|