@bedolla/enriweb 0.1.5 → 0.1.7
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/README.md +48 -20
- package/dist/client/EnriProxyClient.d.ts +176 -5
- package/dist/client/EnriProxyClient.d.ts.map +1 -1
- package/dist/client/EnriProxyClient.js +255 -31
- package/dist/client/EnriProxyClient.js.map +1 -1
- package/dist/index.js +65 -25
- package/dist/index.js.map +1 -1
- package/dist/package-info.d.ts +26 -0
- package/dist/package-info.d.ts.map +1 -1
- package/dist/package-info.js +29 -2
- package/dist/package-info.js.map +1 -1
- package/dist/server/EnriWebServer.d.ts +33 -0
- package/dist/server/EnriWebServer.d.ts.map +1 -1
- package/dist/server/EnriWebServer.js +338 -28
- package/dist/server/EnriWebServer.js.map +1 -1
- package/dist/shared/Utf8SafeTextSlicer.d.ts +47 -0
- package/dist/shared/Utf8SafeTextSlicer.d.ts.map +1 -0
- package/dist/shared/Utf8SafeTextSlicer.js +97 -0
- package/dist/shared/Utf8SafeTextSlicer.js.map +1 -0
- package/dist/shared/validation.d.ts +13 -1
- package/dist/shared/validation.d.ts.map +1 -1
- package/dist/shared/validation.js +41 -17
- package/dist/shared/validation.js.map +1 -1
- package/dist/tools/WebFetchNpmProjection.d.ts +143 -0
- package/dist/tools/WebFetchNpmProjection.d.ts.map +1 -0
- package/dist/tools/WebFetchNpmProjection.js +480 -0
- package/dist/tools/WebFetchNpmProjection.js.map +1 -0
- package/dist/tools/WebFetchParamsParser.d.ts +26 -0
- package/dist/tools/WebFetchParamsParser.d.ts.map +1 -0
- package/dist/tools/WebFetchParamsParser.js +157 -0
- package/dist/tools/WebFetchParamsParser.js.map +1 -0
- package/dist/tools/WebFetchRangesExecutor.d.ts +86 -0
- package/dist/tools/WebFetchRangesExecutor.d.ts.map +1 -0
- package/dist/tools/WebFetchRangesExecutor.js +277 -0
- package/dist/tools/WebFetchRangesExecutor.js.map +1 -0
- package/dist/tools/WebFetchTool.d.ts +187 -71
- package/dist/tools/WebFetchTool.d.ts.map +1 -1
- package/dist/tools/WebFetchTool.js +145 -367
- package/dist/tools/WebFetchTool.js.map +1 -1
- package/dist/tools/WebFetchToolTextFormatter.d.ts +57 -0
- package/dist/tools/WebFetchToolTextFormatter.d.ts.map +1 -0
- package/dist/tools/WebFetchToolTextFormatter.js +135 -0
- package/dist/tools/WebFetchToolTextFormatter.js.map +1 -0
- package/dist/tools/WebSearchRegistryHttpReader.d.ts +116 -0
- package/dist/tools/WebSearchRegistryHttpReader.d.ts.map +1 -0
- package/dist/tools/WebSearchRegistryHttpReader.js +157 -0
- package/dist/tools/WebSearchRegistryHttpReader.js.map +1 -0
- package/dist/tools/WebSearchRegistryVerifier.d.ts +111 -6
- package/dist/tools/WebSearchRegistryVerifier.d.ts.map +1 -1
- package/dist/tools/WebSearchRegistryVerifier.js +406 -125
- package/dist/tools/WebSearchRegistryVerifier.js.map +1 -1
- package/dist/tools/WebSearchTool.d.ts +85 -2
- package/dist/tools/WebSearchTool.d.ts.map +1 -1
- package/dist/tools/WebSearchTool.js +197 -19
- package/dist/tools/WebSearchTool.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ If your MCP client can call MCP tools, it can do web search / fetch in a consist
|
|
|
11
11
|
|
|
12
12
|
## Requirements
|
|
13
13
|
|
|
14
|
-
- Node.js `>=
|
|
14
|
+
- Node.js `>= 24` (Node 24 LTS)
|
|
15
15
|
- A reachable EnriProxy server with:
|
|
16
16
|
- `POST /v1/tools/web_search`
|
|
17
17
|
- `POST /v1/tools/web_fetch`
|
|
@@ -98,9 +98,11 @@ EnriWeb is configured via environment variables:
|
|
|
98
98
|
|
|
99
99
|
- `ENRIPROXY_URL` (`string`, optional, default: `http://127.0.0.1:8787`)
|
|
100
100
|
- `ENRIPROXY_API_KEY` (`string`, required)
|
|
101
|
-
- `ENRIWEB_TIMEOUT_MS` (`string`, optional, default: `
|
|
102
|
-
- Parsed as an integer (milliseconds).
|
|
103
|
-
- `
|
|
101
|
+
- `ENRIWEB_TIMEOUT_MS` (`string`, optional, default: `180000`)
|
|
102
|
+
- Parsed as an integer (milliseconds); fetch budget covering the proxy's total fetch budget (150 s) plus margin, matching EnriCode's remote fetch budget.
|
|
103
|
+
- `ENRIWEB_SEARCH_TIMEOUT_MS` (`string`, optional, default: `320000`)
|
|
104
|
+
- Parsed as an integer (milliseconds); search budget covering the SearXNG engine budget plus server auto-fetch.
|
|
105
|
+
- `ENRIWEB_WEB_FETCH_DEFAULT_MAX_CHARS` (`string`, optional, default: `200000`, max `4000000`)
|
|
104
106
|
- Parsed as an integer.
|
|
105
107
|
- `ENRIWEB_GITHUB_TOKEN` (`string`, optional)
|
|
106
108
|
- Used for GitHub API enrichment to improve rate limits.
|
|
@@ -130,22 +132,33 @@ Search the web via EnriProxy.
|
|
|
130
132
|
|
|
131
133
|
Inputs:
|
|
132
134
|
|
|
133
|
-
- `query` (`string`, required): search query
|
|
134
|
-
- `
|
|
135
|
+
- `query` (`string` or `string[]`, required unless `queries` is provided): the search query. As an array it accepts a batch of 1 to 4 non-blank queries (each entry trimmed; duplicates collapse) — equivalent to sending `queries`.
|
|
136
|
+
- `queries` (`string[]`, optional): batch of 1 to 4 queries. Takes precedence over `query`. EnriProxy runs every query in parallel, merges results by relevance rank, and deduplicates by URL.
|
|
137
|
+
- `max_results` (`integer`, optional; alias `maxResults`)
|
|
135
138
|
- Must be `>= 1`.
|
|
136
139
|
- If omitted, EnriProxy uses its configured default.
|
|
137
|
-
- The upper limit is enforced server-side (
|
|
140
|
+
- The upper limit is enforced server-side (values above the limit are clamped to it).
|
|
138
141
|
- `recency` (`string`, optional, default: `noLimit`)
|
|
139
142
|
- One of: `oneDay` | `oneWeek` | `oneMonth` | `oneYear` | `noLimit`
|
|
140
|
-
- `allowed_domains` (`string[]`, optional): allowlist of domains to include.
|
|
141
|
-
- `blocked_domains` (`string[]`, optional): blocklist of domains to exclude.
|
|
142
|
-
- `search_prompt` (`string`, optional): extra context to refine the search intent.
|
|
143
|
+
- `allowed_domains` (`string[]`, optional; alias `allowedDomains`): allowlist of domains to include.
|
|
144
|
+
- `blocked_domains` (`string[]`, optional; alias `blockedDomains`): blocklist of domains to exclude.
|
|
145
|
+
- `search_prompt` (`string`, optional; alias `searchPrompt`): extra context to refine the search intent. Capped at 2000 characters server-side (the excess is trimmed).
|
|
146
|
+
|
|
147
|
+
Outputs (`structuredContent`):
|
|
148
|
+
|
|
149
|
+
- `query` / `queries`: the executed query (or batch).
|
|
150
|
+
- `results[]`: entries with `url`, `title`, `snippet`, and `published_at` when available.
|
|
151
|
+
- `count`: number of returned results.
|
|
152
|
+
- `perQuery[]`: for batched searches, `{ query, urls }` attribution groups so each result can be traced back to the query that found it.
|
|
153
|
+
- `failedQueries[]`: queries that failed while at least one other succeeded (their section is absent from `perQuery`).
|
|
154
|
+
- `fetchedContents[]` / `fetchedCount`: when server-side auto-fetch is enabled, the verified content of the top result pages (`url`, `title`, `content`, `truncated`). Read these before concluding information is missing.
|
|
155
|
+
- `verified[]`: registry verification rows for npm / PyPI / crates.io / NuGet / GitHub URLs found in the results (`kind`, `name`, `latest_stable`, `latest_prerelease`, `status`, `error`).
|
|
143
156
|
|
|
144
157
|
Example `arguments` object:
|
|
145
158
|
|
|
146
159
|
```jsonc
|
|
147
160
|
{
|
|
148
|
-
"
|
|
161
|
+
"queries": ["qdrant docker compose autostart", "qdrant container restart policy"],
|
|
149
162
|
"max_results": 10,
|
|
150
163
|
"recency": "oneMonth"
|
|
151
164
|
}
|
|
@@ -160,27 +173,42 @@ Fetch and read content from a URL via EnriProxy.
|
|
|
160
173
|
Inputs:
|
|
161
174
|
|
|
162
175
|
- `url` (`string`, required unless `cursor` is provided): full URL (`http://` or `https://`).
|
|
163
|
-
- `cursor` (`string`, optional): opaque cursor returned by a previous `web_fetch` call.
|
|
164
|
-
- `
|
|
165
|
-
- `
|
|
176
|
+
- `cursor` (`string`, optional): opaque cursor returned by a previous `web_fetch` call. A valid cursor always wins over a coexisting `url`.
|
|
177
|
+
- `action` (`"delete"`, optional): releases the server-side capture owned by `cursor`. Send with `cursor`; other parameters are ignored. Responds `{ deleted, cursor }`.
|
|
178
|
+
- `ranges` (`array`, 1-10 items, optional): grouped `{ offset_chars, limit_chars }` windows read in one call. With `cursor`: each range is read server-side in parallel and the response is a grouped object (`range_applied`, `range_count`, `ranges[]`, `range_hint`). With `url`: the document is fetched first; if it arrives truncated with a cursor the ranges read that capture in parallel, otherwise they are sliced locally from the returned content.
|
|
179
|
+
- `offset_chars` (`integer`, optional, default: `0`; aliases `offsetChars` and legacy `offset`): read offset in characters. With `cursor`: server-side window over the capture. With `url` (first read): local slice over the returned content, like EnriCode.
|
|
180
|
+
- `limit_chars` (`integer`, optional, default: `max_chars`; aliases `limitChars` and legacy `limit`): read limit in characters. A value of `0` is ignored.
|
|
166
181
|
- `prompt` (`string`, optional): extraction hint (what to focus on).
|
|
167
|
-
- `max_chars` (`
|
|
182
|
+
- `max_chars` (`integer`, optional, default: `ENRIWEB_WEB_FETCH_DEFAULT_MAX_CHARS`; alias `maxChars`): maximum content length.
|
|
168
183
|
- `format` (`string`, optional): content flavor for HTML pages — `"text"` (default, lightweight structured text), `"markdown"` (full markdown with links, emphasis, code fences, images, and tables), or `"html"` (sanitized markup for DOM inspection — scripts/styles stripped, tags intact). Use markdown only when the exact page structure matters; text is cheaper for factual lookups.
|
|
169
|
-
- `content` (`string`, optional): HTML scope — `"
|
|
170
|
-
- `include_links` (`boolean`, optional): append the `ENLACES DE LA PÁGINA` inventory with every unique link (label + URL, up to 200) — useful for informed crawling or handing image URLs to URL-capable media analysis tools.
|
|
171
|
-
- `include_metadata` (`boolean`, optional): append the `METADATOS DE LA PÁGINA` block with language, author, published date, and `og:image`.
|
|
184
|
+
- `content` (`string`, optional): HTML scope — `"main"` (default, article/main container only; drops nav, sidebars, cookie banners, and footers, typically saving 60-80% of tokens) or `"full"` (whole page).
|
|
185
|
+
- `include_links` (`boolean`, optional, default: `true`; alias `includeLinks`): append the `ENLACES DE LA PÁGINA` inventory with every unique link (label + URL, up to 200) — useful for informed crawling or handing image URLs to URL-capable media analysis tools. Send `false` to omit it.
|
|
186
|
+
- `include_metadata` (`boolean`, optional, default `false`; alias `includeMetadata`): append the `METADATOS DE LA PÁGINA` block with language, author, published date, and `og:image`.
|
|
172
187
|
- `anchor` (`string`, optional): section selector — element id (with or without `#`) or exact heading text; returns only that section up to the next same-or-higher heading. When the section is missing, the response says so and returns the full document.
|
|
173
188
|
|
|
189
|
+
Outputs (`structuredContent`):
|
|
190
|
+
|
|
191
|
+
- Single read: `content`, `status`, `content_type`, `truncated`, `url`, and pagination fields when present (`cursor`, `offset_chars`, `limit_chars`, `total_chars`, `has_more`, `next_offset_chars`, `reduced`, `fetched_truncated`, `applied_max_chars` on the npm path).
|
|
192
|
+
- Delete: `deleted` (whether the cursor existed and was released) plus the addressed `cursor`.
|
|
193
|
+
- Grouped ranges: `range_applied: true`, `range_count`, `ranges[]` (per-range `index`, offsets, `content`, `truncated`, Spanish `error`/`note` rows), `range_hint`, and the backing `cursor`/`total_chars` when a capture exists.
|
|
194
|
+
|
|
174
195
|
Notes:
|
|
175
196
|
|
|
176
|
-
- If the response includes a `cursor`,
|
|
197
|
+
- If the response is truncated and includes a `cursor`, page through the captured content by calling `web_fetch` again with `cursor` + `offset_chars` + `limit_chars` (or a `ranges` batch for non-contiguous windows) — no re-download needed.
|
|
198
|
+
- Exhausted captures are reclaimed automatically: when a read reports `has_more: false`, EnriWeb releases the server-side cursor best-effort, omits it from the result, and tells you the capture was fully read (a 10-minute TTL backstops anything left behind).
|
|
199
|
+
- npm package pages (`npmjs.com/package/<name>`, including `/v/<version>` pins and scoped packages) get a structured projection: registry metadata for the requested version plus the repository README, with pagination fields propagated when the README sub-fetch is truncated.
|
|
200
|
+
- EnriProxy-side URL controls travel glued to the URL and are documented in the tool description: `?enri_find=TEXT` (find text with offsets), `?enri_parts=` (select page sections), `?enri_body_offset=N&enri_body_limit=M` (body window), `?enri_section=` for YouTube (manifest/transcript/comments/description), and Drive/OneDrive folder listings.
|
|
177
201
|
|
|
178
202
|
Example `arguments` object:
|
|
179
203
|
|
|
180
204
|
```jsonc
|
|
181
205
|
{
|
|
182
206
|
"url": "https://example.com/docs",
|
|
183
|
-
"max_chars": 200000
|
|
207
|
+
"max_chars": 200000,
|
|
208
|
+
"ranges": [
|
|
209
|
+
{ "offset_chars": 0, "limit_chars": 5000 },
|
|
210
|
+
{ "offset_chars": 120000, "limit_chars": 5000 }
|
|
211
|
+
]
|
|
184
212
|
}
|
|
185
213
|
```
|
|
186
214
|
|
|
@@ -71,6 +71,27 @@ export interface WebSearchResultEntry {
|
|
|
71
71
|
*/
|
|
72
72
|
readonly published_at?: string;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* One verified page content attached to a web search response.
|
|
76
|
+
*/
|
|
77
|
+
export interface WebSearchFetchedContentEntry {
|
|
78
|
+
/**
|
|
79
|
+
* URL that was fetched.
|
|
80
|
+
*/
|
|
81
|
+
readonly url: string;
|
|
82
|
+
/**
|
|
83
|
+
* Result title at fetch time.
|
|
84
|
+
*/
|
|
85
|
+
readonly title: string;
|
|
86
|
+
/**
|
|
87
|
+
* Extracted page content (truncated to the server budget).
|
|
88
|
+
*/
|
|
89
|
+
readonly content: string;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the content was truncated to the server budget.
|
|
92
|
+
*/
|
|
93
|
+
readonly truncated: boolean;
|
|
94
|
+
}
|
|
74
95
|
/**
|
|
75
96
|
* Web search response.
|
|
76
97
|
*/
|
|
@@ -91,6 +112,34 @@ export interface WebSearchResponse {
|
|
|
91
112
|
* Queries whose execution failed while at least one other query succeeded.
|
|
92
113
|
*/
|
|
93
114
|
readonly failed_queries?: string[];
|
|
115
|
+
/**
|
|
116
|
+
* SearXNG engines that did not respond, when the server reported any.
|
|
117
|
+
*/
|
|
118
|
+
readonly unresponsive_engines?: string[];
|
|
119
|
+
/**
|
|
120
|
+
* Whether the server clamped the caller's `search_prompt` to its cap.
|
|
121
|
+
*/
|
|
122
|
+
readonly search_prompt_truncated?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Spanish notice describing the clamped `search_prompt`, when clamped.
|
|
125
|
+
*/
|
|
126
|
+
readonly search_prompt_notice?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Verified page contents for the top results, when server-side
|
|
129
|
+
* auto-fetch is enabled.
|
|
130
|
+
*/
|
|
131
|
+
readonly fetched_contents?: WebSearchFetchedContentEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* Number of verified page contents attached to the response.
|
|
134
|
+
*/
|
|
135
|
+
readonly fetched_count?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Per-query URL groups, when the request used batched queries.
|
|
138
|
+
*/
|
|
139
|
+
readonly per_query?: Array<{
|
|
140
|
+
query: string;
|
|
141
|
+
urls: string[];
|
|
142
|
+
}>;
|
|
94
143
|
}
|
|
95
144
|
/**
|
|
96
145
|
* Web fetch request parameters.
|
|
@@ -114,8 +163,8 @@ export interface WebFetchUrlRequest {
|
|
|
114
163
|
*/
|
|
115
164
|
readonly format?: "text" | "markdown" | "html";
|
|
116
165
|
/**
|
|
117
|
-
* Content scope for HTML sources: main content region only, or
|
|
118
|
-
* page
|
|
166
|
+
* Content scope for HTML sources: main content region only (default), or
|
|
167
|
+
* the full page.
|
|
119
168
|
*/
|
|
120
169
|
readonly content?: "main" | "full";
|
|
121
170
|
/**
|
|
@@ -156,10 +205,78 @@ export interface WebFetchCursorRequest {
|
|
|
156
205
|
*/
|
|
157
206
|
readonly maxChars?: number;
|
|
158
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Options refining transport behavior for one request.
|
|
210
|
+
*
|
|
211
|
+
* @remarks
|
|
212
|
+
* `callerSignal` lets a caller that wraps a combined subfetch signal (caller
|
|
213
|
+
* abort + `AbortSignal.timeout`) tell the client which aborts are genuine
|
|
214
|
+
* client cancellations and which are subfetch timeouts.
|
|
215
|
+
*/
|
|
216
|
+
export interface EnriProxyRequestOptions {
|
|
217
|
+
/**
|
|
218
|
+
* True caller abort signal backing the combined `signal` argument.
|
|
219
|
+
*/
|
|
220
|
+
readonly callerSignal?: AbortSignal;
|
|
221
|
+
/**
|
|
222
|
+
* Timeout budget (ms) behind a combined subfetch signal, used to label
|
|
223
|
+
* timeout aborts that the caller did not trigger.
|
|
224
|
+
*/
|
|
225
|
+
readonly subfetchTimeoutMs?: number;
|
|
226
|
+
/**
|
|
227
|
+
* Explicit response byte ceiling for this request.
|
|
228
|
+
*
|
|
229
|
+
* @remarks
|
|
230
|
+
* Callers that know the expected payload size (for example one slice of
|
|
231
|
+
* a grouped-ranges fan-out) bound the buffered response to that slice
|
|
232
|
+
* instead of the default full-budget ceiling; omitted falls back to the
|
|
233
|
+
* max_chars-derived default.
|
|
234
|
+
*/
|
|
235
|
+
readonly maxResponseBytes?: number;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Web fetch request to release a cursor's server-side capture.
|
|
239
|
+
*/
|
|
240
|
+
export interface WebFetchDeleteRequest {
|
|
241
|
+
/**
|
|
242
|
+
* Cursor identifier returned by a previous fetch.
|
|
243
|
+
*/
|
|
244
|
+
readonly cursor: string;
|
|
245
|
+
/**
|
|
246
|
+
* Literal action marker selecting cursor deletion.
|
|
247
|
+
*/
|
|
248
|
+
readonly action: "delete";
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Web fetch delete-cursor response.
|
|
252
|
+
*/
|
|
253
|
+
export interface WebFetchDeleteResponse {
|
|
254
|
+
/**
|
|
255
|
+
* Whether the cursor existed and was deleted.
|
|
256
|
+
*/
|
|
257
|
+
readonly deleted: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Cursor the deletion addressed.
|
|
260
|
+
*/
|
|
261
|
+
readonly cursor: string;
|
|
262
|
+
}
|
|
159
263
|
/**
|
|
160
264
|
* Web fetch request union.
|
|
161
265
|
*/
|
|
162
266
|
export type WebFetchRequest = WebFetchUrlRequest | WebFetchCursorRequest;
|
|
267
|
+
/**
|
|
268
|
+
* Derives the per-request response size ceiling from the content budget.
|
|
269
|
+
*
|
|
270
|
+
* @remarks
|
|
271
|
+
* EnriProxy answers JSON, so every character may expand up to ~6 bytes
|
|
272
|
+
* (`\uXXXX` escapes, quotes, newlines). A known `maxChars` raises the
|
|
273
|
+
* ceiling to `6 × maxChars + 1MB` so a legitimate ~4M-char capture rich in
|
|
274
|
+
* escapes is not rejected mid-stream.
|
|
275
|
+
*
|
|
276
|
+
* @param maxChars - Requested content budget in characters, when known.
|
|
277
|
+
* @returns Maximum accepted response body in bytes.
|
|
278
|
+
*/
|
|
279
|
+
export declare function resolveMaxResponseBytes(maxChars: number | undefined): number;
|
|
163
280
|
/**
|
|
164
281
|
* Web fetch response.
|
|
165
282
|
*/
|
|
@@ -204,6 +321,20 @@ export interface WebFetchResponse {
|
|
|
204
321
|
* Whether more content exists beyond this slice.
|
|
205
322
|
*/
|
|
206
323
|
readonly has_more?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Exact offset where the next page starts (cursor reads), when the proxy
|
|
326
|
+
* reports it.
|
|
327
|
+
*/
|
|
328
|
+
readonly next_offset_chars?: number;
|
|
329
|
+
/**
|
|
330
|
+
* Zero-based offset inside `content` where the undecorated page starts
|
|
331
|
+
* (URL reads with a status-line decoration).
|
|
332
|
+
*/
|
|
333
|
+
readonly page_offset_chars?: number;
|
|
334
|
+
/**
|
|
335
|
+
* Length of the undecorated page inside `content` (URL reads).
|
|
336
|
+
*/
|
|
337
|
+
readonly page_chars?: number;
|
|
207
338
|
/**
|
|
208
339
|
* Whether the response content was reduced (excerpt pack).
|
|
209
340
|
*/
|
|
@@ -213,6 +344,15 @@ export interface WebFetchResponse {
|
|
|
213
344
|
*/
|
|
214
345
|
readonly fetched_truncated?: boolean;
|
|
215
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Upper character budget accepted from one tool call.
|
|
349
|
+
*
|
|
350
|
+
* @remarks
|
|
351
|
+
* Single source of truth for the shared 4M wire ceiling: the client clamps
|
|
352
|
+
* every request payload with it and the tool layer imports the same constant
|
|
353
|
+
* so the documented ceiling cannot drift between modules.
|
|
354
|
+
*/
|
|
355
|
+
export declare const MAX_WIRE_MAX_CHARS = 4000000;
|
|
216
356
|
/**
|
|
217
357
|
* Error thrown when EnriProxy returns a non-2xx HTTP response.
|
|
218
358
|
*/
|
|
@@ -265,16 +405,44 @@ export declare class EnriProxyClient {
|
|
|
265
405
|
* Executes a web search via EnriProxy.
|
|
266
406
|
*
|
|
267
407
|
* @param params - Search parameters
|
|
408
|
+
* @param signal - Optional caller abort signal
|
|
268
409
|
* @returns Search response
|
|
269
410
|
*/
|
|
270
|
-
webSearch(params: WebSearchRequest): Promise<WebSearchResponse>;
|
|
411
|
+
webSearch(params: WebSearchRequest, signal?: AbortSignal, options?: EnriProxyRequestOptions): Promise<WebSearchResponse>;
|
|
271
412
|
/**
|
|
272
413
|
* Executes a web fetch via EnriProxy.
|
|
273
414
|
*
|
|
274
|
-
* @param params - Fetch parameters
|
|
415
|
+
* @param params - Fetch parameters (URL read, cursor read, or cursor delete)
|
|
416
|
+
* @param signal - Optional caller abort signal
|
|
417
|
+
* @param options - Optional transport options (subfetch abort labeling)
|
|
275
418
|
* @returns Fetch response
|
|
276
419
|
*/
|
|
277
|
-
webFetch(params:
|
|
420
|
+
webFetch(params: WebFetchDeleteRequest, signal?: AbortSignal, options?: EnriProxyRequestOptions): Promise<WebFetchDeleteResponse>;
|
|
421
|
+
webFetch(params: WebFetchRequest, signal?: AbortSignal, options?: EnriProxyRequestOptions): Promise<WebFetchResponse>;
|
|
422
|
+
/**
|
|
423
|
+
* Summarizes a response-body parse failure as a bounded Spanish tail.
|
|
424
|
+
*
|
|
425
|
+
* @remarks
|
|
426
|
+
* V8's parser message ("Unexpected token …") is English jargon that would
|
|
427
|
+
* reach the model verbatim through the tool result; it is reduced to a
|
|
428
|
+
* Spanish label plus at most 80 characters of raw parser detail.
|
|
429
|
+
*
|
|
430
|
+
* @param error - Failure thrown while parsing the proxy response body.
|
|
431
|
+
* @returns Short Spanish summary for a model-facing error message.
|
|
432
|
+
*/
|
|
433
|
+
private static describeUnparseableBody;
|
|
434
|
+
/**
|
|
435
|
+
* Summarizes one non-2xx HTTP status as bounded Spanish guidance.
|
|
436
|
+
*
|
|
437
|
+
* @remarks
|
|
438
|
+
* The raw HTTP client does not follow redirects: an `ENRIPROXY_URL` behind
|
|
439
|
+
* a 301/302/303/307/308 would otherwise surface as a bare status code with
|
|
440
|
+
* no hint that the server configuration (not the call) must change.
|
|
441
|
+
*
|
|
442
|
+
* @param status - HTTP status returned by the server.
|
|
443
|
+
* @returns Spanish guidance suffix (may be empty).
|
|
444
|
+
*/
|
|
445
|
+
private static describeHttpStatus;
|
|
278
446
|
/**
|
|
279
447
|
* Builds an absolute URL relative to the configured base URL.
|
|
280
448
|
*
|
|
@@ -289,6 +457,7 @@ export declare class EnriProxyClient {
|
|
|
289
457
|
* @param url - Target URL
|
|
290
458
|
* @param jsonBody - JSON payload
|
|
291
459
|
* @param timeoutMs - Timeout in milliseconds
|
|
460
|
+
* @param signal - Optional caller abort signal
|
|
292
461
|
* @returns HTTP result
|
|
293
462
|
*/
|
|
294
463
|
private requestJson;
|
|
@@ -300,6 +469,8 @@ export declare class EnriProxyClient {
|
|
|
300
469
|
* @param headers - Request headers
|
|
301
470
|
* @param body - Request body
|
|
302
471
|
* @param timeoutMs - Timeout in milliseconds
|
|
472
|
+
* @param signal - Optional abort signal (destroys the request on abort)
|
|
473
|
+
* @param options - Optional transport options (caller signal labeling, size ceiling)
|
|
303
474
|
* @returns HTTP result
|
|
304
475
|
*/
|
|
305
476
|
private requestRaw;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnriProxyClient.d.ts","sourceRoot":"","sources":["../../src/client/EnriProxyClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnriProxyClient.d.ts","sourceRoot":"","sources":["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