@parcha/agentrun-web 0.1.0-beta.62 → 0.1.0-beta.64
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/dist/providers/exa.d.ts +3 -3
- package/dist/providers/exa.js +6 -5
- package/package.json +2 -2
package/dist/providers/exa.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ export declare const EXA_CATEGORIES: readonly ["company", "publication", "news",
|
|
|
9
9
|
/** How Exa searches and reads, each setting optional (EXA_DEFAULTS):
|
|
10
10
|
* - `type`: the search's depth and price (fees.ts EXA_SEARCH_TYPE_USD), default "auto";
|
|
11
11
|
* - `snippet`: each result's text for its snippet, its query-relevant `highlights` or the page's `text` from its start,
|
|
12
|
-
* default "highlights"; `snippetChars`, how many characters of it Exa gives, MAX_CHARS_MIN to SNIPPET_MAX,
|
|
13
|
-
*
|
|
12
|
+
* default "highlights"; `snippetChars`, how many characters of it Exa gives, MAX_CHARS_MIN to SNIPPET_MAX. Unset,
|
|
13
|
+
* highlights go bare, as Exa's guidance asks (Exa sizes them to the query), and text goes at SNIPPET_MAX; a snippet
|
|
14
|
+
* keeps at most SNIPPET_MAX either way;
|
|
14
15
|
* - `maxAgeHours`: the oldest cached page Exa may answer from, for a search's contents and a fetch, -1 (cache only) to
|
|
15
16
|
* 720, 0 a live crawl; unset, Exa's own (its cache, a live crawl for a page it has none of);
|
|
16
17
|
* - `includeDomains`, `excludeDomains`: the domains a search keeps to or leaves out; `category`: Exa's index to search;
|
|
@@ -30,7 +31,6 @@ export type ExaSettings = {
|
|
|
30
31
|
export declare const EXA_DEFAULTS: Readonly<{
|
|
31
32
|
readonly type: "auto";
|
|
32
33
|
readonly snippet: "highlights";
|
|
33
|
-
readonly snippetChars: 3000;
|
|
34
34
|
readonly pageVerbosity: "compact";
|
|
35
35
|
readonly pageLinks: true;
|
|
36
36
|
}>;
|
package/dist/providers/exa.js
CHANGED
|
@@ -11,7 +11,7 @@ export const EXA_API_URL = "https://api.exa.ai";
|
|
|
11
11
|
/** Exa's bound on one request: a deep search takes tens of seconds. */
|
|
12
12
|
export const EXA_MS = 120_000;
|
|
13
13
|
export const EXA_CATEGORIES = ["company", "publication", "news", "personal site", "financial report", "people"];
|
|
14
|
-
export const EXA_DEFAULTS = Object.freeze({ type: "auto", snippet: "highlights",
|
|
14
|
+
export const EXA_DEFAULTS = Object.freeze({ type: "auto", snippet: "highlights", pageVerbosity: "compact", pageLinks: true });
|
|
15
15
|
const EXA_CHECKS = {
|
|
16
16
|
type: oneOf(Object.keys(EXA_SEARCH_TYPE_USD)),
|
|
17
17
|
snippet: oneOf(["highlights", "text"]),
|
|
@@ -28,11 +28,11 @@ export const exaSettingsProblems = (settings) => settingsProblems("Exa", setting
|
|
|
28
28
|
export const exaClient = (apiKey, send = fetch, pay, base = EXA_API_URL) => keyedClient({ who: "Exa", base, headers: { "x-api-key": apiKey }, feeOf: exaFeeOf, timeoutMs: EXA_MS, refuseOn: [401, 403] }, send, pay);
|
|
29
29
|
/** The /search request for `query`, `n` results, under `settings`. */
|
|
30
30
|
export function exaSearchBody(query, n, settings = {}) {
|
|
31
|
-
const {
|
|
32
|
-
const content = snippet === "text" ? { text: { maxCharacters: snippetChars } } : { highlights: { maxCharacters: snippetChars } };
|
|
31
|
+
const { snippetChars } = settings;
|
|
32
|
+
const content = (settings.snippet ?? EXA_DEFAULTS.snippet) === "text" ? { text: { maxCharacters: snippetChars ?? SNIPPET_MAX } } : { highlights: snippetChars === undefined ? true : { maxCharacters: snippetChars } };
|
|
33
33
|
return {
|
|
34
34
|
query,
|
|
35
|
-
type,
|
|
35
|
+
type: settings.type ?? EXA_DEFAULTS.type,
|
|
36
36
|
numResults: n,
|
|
37
37
|
...(settings.includeDomains ? { includeDomains: settings.includeDomains } : {}),
|
|
38
38
|
...(settings.excludeDomains ? { excludeDomains: settings.excludeDomains } : {}),
|
|
@@ -69,7 +69,8 @@ export async function exaSearched(args, client, settings = {}, signal) {
|
|
|
69
69
|
/** The /contents request for `url` under `settings`: its text to the most of a page web_fetch reads and one character
|
|
70
70
|
* more (so a page Exa cut there shows as going on), at the verbosity asked, its links kept or not. */
|
|
71
71
|
export function exaContentsBody(url, settings = {}) {
|
|
72
|
-
const
|
|
72
|
+
const pageVerbosity = settings.pageVerbosity ?? EXA_DEFAULTS.pageVerbosity;
|
|
73
|
+
const pageLinks = settings.pageLinks ?? EXA_DEFAULTS.pageLinks;
|
|
73
74
|
return {
|
|
74
75
|
urls: [url],
|
|
75
76
|
text: { maxCharacters: PAGE_READ_MAX_CHARS + 1, verbosity: pageVerbosity, ...(pageLinks ? { linkStyle: "full" } : {}) },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcha/agentrun-web",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.64",
|
|
4
4
|
"description": "Web search and web fetch for agents: providers asked in an order given as data, a breaker per provider, a per-run page cache read in parts, and a direct fetch through an injected public-host guard.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentrun",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"undici": "^8.12.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@parcha/pi-browser": "0.1.0-beta.
|
|
49
|
+
"@parcha/pi-browser": "0.1.0-beta.64"
|
|
50
50
|
},
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|