@onkernel/sdk 0.109.0 → 0.111.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 +19 -0
- package/client.d.mts +6 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +6 -0
- package/client.d.ts.map +1 -1
- package/client.js +6 -0
- package/client.js.map +1 -1
- package/client.mjs +6 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/auth/connections.d.mts +26 -8
- package/resources/auth/connections.d.mts.map +1 -1
- package/resources/auth/connections.d.ts +26 -8
- package/resources/auth/connections.d.ts.map +1 -1
- package/resources/browsers/telemetry.d.mts +13 -4
- package/resources/browsers/telemetry.d.mts.map +1 -1
- package/resources/browsers/telemetry.d.ts +13 -4
- package/resources/browsers/telemetry.d.ts.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/search/contents.d.mts +267 -0
- package/resources/search/contents.d.mts.map +1 -0
- package/resources/search/contents.d.ts +267 -0
- package/resources/search/contents.d.ts.map +1 -0
- package/resources/search/contents.js +31 -0
- package/resources/search/contents.js.map +1 -0
- package/resources/search/contents.mjs +27 -0
- package/resources/search/contents.mjs.map +1 -0
- package/resources/search/index.d.mts +4 -0
- package/resources/search/index.d.mts.map +1 -0
- package/resources/search/index.d.ts +4 -0
- package/resources/search/index.d.ts.map +1 -0
- package/resources/search/index.js +11 -0
- package/resources/search/index.js.map +1 -0
- package/resources/search/index.mjs +5 -0
- package/resources/search/index.mjs.map +1 -0
- package/resources/search/providers.d.mts +141 -0
- package/resources/search/providers.d.mts.map +1 -0
- package/resources/search/providers.d.ts +141 -0
- package/resources/search/providers.d.ts.map +1 -0
- package/resources/search/providers.js +25 -0
- package/resources/search/providers.js.map +1 -0
- package/resources/search/providers.mjs +21 -0
- package/resources/search/providers.mjs.map +1 -0
- package/resources/search/search.d.mts +1187 -0
- package/resources/search/search.d.mts.map +1 -0
- package/resources/search/search.d.ts +1187 -0
- package/resources/search/search.d.ts.map +1 -0
- package/resources/search/search.js +58 -0
- package/resources/search/search.js.map +1 -0
- package/resources/search/search.mjs +53 -0
- package/resources/search/search.mjs.map +1 -0
- package/resources/search.d.mts +2 -0
- package/resources/search.d.mts.map +1 -0
- package/resources/search.d.ts +2 -0
- package/resources/search.d.ts.map +1 -0
- package/resources/search.js +6 -0
- package/resources/search.js.map +1 -0
- package/resources/search.mjs +3 -0
- package/resources/search.mjs.map +1 -0
- package/resources/vaults/items.d.mts +35 -14
- package/resources/vaults/items.d.mts.map +1 -1
- package/resources/vaults/items.d.ts +35 -14
- package/resources/vaults/items.d.ts.map +1 -1
- package/src/client.ts +30 -0
- package/src/resources/auth/connections.ts +28 -7
- package/src/resources/browsers/telemetry.ts +17 -4
- package/src/resources/index.ts +12 -0
- package/src/resources/search/contents.ts +327 -0
- package/src/resources/search/index.ts +16 -0
- package/src/resources/search/providers.ts +197 -0
- package/src/resources/search/search.ts +1496 -0
- package/src/resources/search.ts +3 -0
- package/src/resources/vaults/items.ts +43 -14
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,1187 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as SearchAPI from "./search.mjs";
|
|
3
|
+
import * as ContentsAPI from "./contents.mjs";
|
|
4
|
+
import { ContentFetchParams, Contents as ContentsAPIContents, FetchRequest, Response } from "./contents.mjs";
|
|
5
|
+
import * as ProvidersAPI from "./providers.mjs";
|
|
6
|
+
import { Provider, ProviderListParams, ProviderListResponse, Providers } from "./providers.mjs";
|
|
7
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
8
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* Search the web and retrieve content for selected results.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SearchResource extends APIResource {
|
|
13
|
+
contents: ContentsAPI.Contents;
|
|
14
|
+
providers: ProvidersAPI.Providers;
|
|
15
|
+
/**
|
|
16
|
+
* Returns ranked results from one serving provider. The default strategy selects a
|
|
17
|
+
* provider that supports the requested options. The fallback strategy tries
|
|
18
|
+
* providers in the supplied order. Results are not blended across providers.
|
|
19
|
+
* Portable filters may be approximated or omitted according to provider
|
|
20
|
+
* capabilities; warnings describe those outcomes unless strict_params is true.
|
|
21
|
+
* Native options apply only to their selected provider.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const search = await client.search.create({ query: 'x' });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
create(body: SearchCreateParams, options?: RequestOptions): APIPromise<Search>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the retained search resource exactly as it was returned by POST /search:
|
|
31
|
+
* results, attempts, warnings, usage, and expires_at. No provider is called and
|
|
32
|
+
* nothing is billed. Use it to look up a search by ID for debugging, cost review,
|
|
33
|
+
* or to recover result IDs before calling the contents endpoint. Inline content
|
|
34
|
+
* fetched at search time is included; content fetched later through the contents
|
|
35
|
+
* endpoint is not merged in. Missing, expired, or inaccessible searches
|
|
36
|
+
* return 404.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const search = await client.search.retrieve('srch_abc123');
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<Search>;
|
|
44
|
+
}
|
|
45
|
+
export interface Attempt {
|
|
46
|
+
duration_ms: number;
|
|
47
|
+
outcome: 'success' | 'empty' | 'error' | 'timeout';
|
|
48
|
+
provider: string;
|
|
49
|
+
error_code?: string;
|
|
50
|
+
retryable?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Provider name paired with its typed native options.
|
|
54
|
+
*/
|
|
55
|
+
export type ProviderTarget = ProviderTarget.SearchBraveTarget | ProviderTarget.SearchExaTarget | ProviderTarget.SearchPerplexityTarget | ProviderTarget.SearchContextTarget | ProviderTarget.SearchParallelTarget | ProviderTarget.SearchValyuTarget | ProviderTarget.SearchOctenTarget | ProviderTarget.SearchYouTarget | ProviderTarget.SearchTavilyTarget | ProviderTarget.SearchSerpAPITarget;
|
|
56
|
+
export declare namespace ProviderTarget {
|
|
57
|
+
interface SearchBraveTarget {
|
|
58
|
+
provider: 'brave';
|
|
59
|
+
options?: SearchBraveTarget.Options;
|
|
60
|
+
}
|
|
61
|
+
namespace SearchBraveTarget {
|
|
62
|
+
interface Options {
|
|
63
|
+
/**
|
|
64
|
+
* Provider-native count. Lower-only alias for max_results; cannot raise the
|
|
65
|
+
* effective result cap.
|
|
66
|
+
*/
|
|
67
|
+
count?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Request additional snippets from Brave.
|
|
70
|
+
*/
|
|
71
|
+
extra_snippets?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Goggles re-ranking definition URL.
|
|
74
|
+
*/
|
|
75
|
+
goggles?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Deprecated Brave Goggle identifier. Prefer goggles.
|
|
78
|
+
*/
|
|
79
|
+
goggles_id?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Include Brave's fetch metadata.
|
|
82
|
+
*/
|
|
83
|
+
include_fetch_metadata?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Page offset supported by Brave.
|
|
86
|
+
*/
|
|
87
|
+
offset?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Brave search operators.
|
|
90
|
+
*/
|
|
91
|
+
operators?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Comma-separated result types to include, e.g. "web,news".
|
|
94
|
+
*/
|
|
95
|
+
result_filter?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Language of the search, e.g. "en".
|
|
98
|
+
*/
|
|
99
|
+
search_lang?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Apply Brave's query spellcheck.
|
|
102
|
+
*/
|
|
103
|
+
spellcheck?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Language for UI strings in the response.
|
|
106
|
+
*/
|
|
107
|
+
ui_lang?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Measurement units.
|
|
110
|
+
*/
|
|
111
|
+
units?: 'metric' | 'imperial';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
interface SearchExaTarget {
|
|
115
|
+
provider: 'exa';
|
|
116
|
+
options?: SearchExaTarget.Options;
|
|
117
|
+
}
|
|
118
|
+
namespace SearchExaTarget {
|
|
119
|
+
interface Options {
|
|
120
|
+
/**
|
|
121
|
+
* Provider data-category hint.
|
|
122
|
+
*/
|
|
123
|
+
category?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Provider-native compliance controls. Requires support and authorization on the
|
|
126
|
+
* provider account.
|
|
127
|
+
*/
|
|
128
|
+
compliance?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Provider-native content retrieval. Available without requesting Kernel browser
|
|
131
|
+
* retrieval; may incur provider retrieval charges.
|
|
132
|
+
*/
|
|
133
|
+
contents?: Options.Contents;
|
|
134
|
+
/**
|
|
135
|
+
* Provider-native cache-age control. Unlike content.max_age_hours, this retains
|
|
136
|
+
* Exa semantics, including any native sentinel values. It does not imply a
|
|
137
|
+
* cross-provider freshness guarantee.
|
|
138
|
+
*/
|
|
139
|
+
maxAgeHours?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Provider-native count. Lower-only alias for max_results.
|
|
142
|
+
*/
|
|
143
|
+
numResults?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Search mode supported by Exa.
|
|
146
|
+
*/
|
|
147
|
+
type?: 'auto' | 'fast' | 'instant';
|
|
148
|
+
}
|
|
149
|
+
namespace Options {
|
|
150
|
+
/**
|
|
151
|
+
* Provider-native content retrieval. Available without requesting Kernel browser
|
|
152
|
+
* retrieval; may incur provider retrieval charges.
|
|
153
|
+
*/
|
|
154
|
+
interface Contents {
|
|
155
|
+
/**
|
|
156
|
+
* Return query-relevant provider excerpts.
|
|
157
|
+
*/
|
|
158
|
+
highlights?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Return provider page text.
|
|
161
|
+
*/
|
|
162
|
+
text?: boolean;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
interface SearchPerplexityTarget {
|
|
167
|
+
provider: 'perplexity';
|
|
168
|
+
options?: SearchPerplexityTarget.Options;
|
|
169
|
+
}
|
|
170
|
+
namespace SearchPerplexityTarget {
|
|
171
|
+
interface Options {
|
|
172
|
+
/**
|
|
173
|
+
* MM/DD/YYYY. Filters by last-updated date, not published date.
|
|
174
|
+
*/
|
|
175
|
+
last_updated_after_filter?: string;
|
|
176
|
+
/**
|
|
177
|
+
* MM/DD/YYYY upper bound on last-updated date.
|
|
178
|
+
*/
|
|
179
|
+
last_updated_before_filter?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Provider-native count. Lower-only alias for max_results.
|
|
182
|
+
*/
|
|
183
|
+
max_results?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Values outside the documented range are rejected.
|
|
186
|
+
*/
|
|
187
|
+
max_tokens?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Per-page token cap.
|
|
190
|
+
*/
|
|
191
|
+
max_tokens_per_page?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Provider-native multi-query form, applied only to Perplexity. Other fallback
|
|
194
|
+
* providers receive the top-level query. Each query may incur a separate provider
|
|
195
|
+
* charge.
|
|
196
|
+
*/
|
|
197
|
+
query?: Array<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Provider context size supported by the selected model.
|
|
200
|
+
*/
|
|
201
|
+
search_context_size?: 'low' | 'medium' | 'high';
|
|
202
|
+
/**
|
|
203
|
+
* ISO 639-1 language codes, max 20.
|
|
204
|
+
*/
|
|
205
|
+
search_language_filter?: Array<string>;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
interface SearchContextTarget {
|
|
209
|
+
provider: 'context';
|
|
210
|
+
options?: SearchContextTarget.Options;
|
|
211
|
+
}
|
|
212
|
+
namespace SearchContextTarget {
|
|
213
|
+
interface Options {
|
|
214
|
+
/**
|
|
215
|
+
* ISO 3166-1 alpha-2 country code.
|
|
216
|
+
*/
|
|
217
|
+
country?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Blocklist of result domains.
|
|
220
|
+
*/
|
|
221
|
+
excludeDomains?: Array<string>;
|
|
222
|
+
/**
|
|
223
|
+
* Restrict results to content published within this window.
|
|
224
|
+
*/
|
|
225
|
+
freshness?: 'last_24_hours' | 'last_week' | 'last_month' | 'last_year';
|
|
226
|
+
/**
|
|
227
|
+
* Allowlist of result domains.
|
|
228
|
+
*/
|
|
229
|
+
includeDomains?: Array<string>;
|
|
230
|
+
markdownOptions?: Options.MarkdownOptions;
|
|
231
|
+
/**
|
|
232
|
+
* Number of results to request from Context.dev.
|
|
233
|
+
*/
|
|
234
|
+
numResults?: number;
|
|
235
|
+
/**
|
|
236
|
+
* Expand the query into multiple parallel variants.
|
|
237
|
+
*/
|
|
238
|
+
queryFanout?: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Usage tracking tags.
|
|
241
|
+
*/
|
|
242
|
+
tags?: Array<string>;
|
|
243
|
+
/**
|
|
244
|
+
* Context.dev request timeout in milliseconds.
|
|
245
|
+
*/
|
|
246
|
+
timeoutMS?: number;
|
|
247
|
+
}
|
|
248
|
+
namespace Options {
|
|
249
|
+
interface MarkdownOptions {
|
|
250
|
+
enabled?: boolean;
|
|
251
|
+
includeFrames?: boolean;
|
|
252
|
+
includeImages?: boolean;
|
|
253
|
+
includeLinks?: boolean;
|
|
254
|
+
maxAgeMs?: number;
|
|
255
|
+
pdf?: MarkdownOptions.Pdf;
|
|
256
|
+
shortenBase64Images?: boolean;
|
|
257
|
+
timeoutMS?: number;
|
|
258
|
+
useMainContentOnly?: boolean;
|
|
259
|
+
waitForMs?: number;
|
|
260
|
+
}
|
|
261
|
+
namespace MarkdownOptions {
|
|
262
|
+
interface Pdf {
|
|
263
|
+
shouldParse?: boolean;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
interface SearchParallelTarget {
|
|
269
|
+
provider: 'parallel';
|
|
270
|
+
options?: SearchParallelTarget.Options;
|
|
271
|
+
}
|
|
272
|
+
namespace SearchParallelTarget {
|
|
273
|
+
interface Options {
|
|
274
|
+
/**
|
|
275
|
+
* Explicit search settings. Unified search parameters are re-applied to
|
|
276
|
+
* overlapping settings; native result counts are lower-only.
|
|
277
|
+
*/
|
|
278
|
+
advanced_settings?: Options.AdvancedSettings;
|
|
279
|
+
/**
|
|
280
|
+
* Client model hint.
|
|
281
|
+
*/
|
|
282
|
+
client_model?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Cap total characters returned.
|
|
285
|
+
*/
|
|
286
|
+
max_chars_total?: number;
|
|
287
|
+
/**
|
|
288
|
+
* Search mode. Basic is used when omitted; each mode can have different latency
|
|
289
|
+
* and charges.
|
|
290
|
+
*/
|
|
291
|
+
mode?: 'turbo' | 'fast' | 'basic' | 'advanced';
|
|
292
|
+
/**
|
|
293
|
+
* The goal behind the search, stated separately from the query.
|
|
294
|
+
*/
|
|
295
|
+
objective?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Provider-native multi-query search. Defaults to [query] for this provider.
|
|
298
|
+
*/
|
|
299
|
+
search_queries?: Array<string>;
|
|
300
|
+
/**
|
|
301
|
+
* Group related searches.
|
|
302
|
+
*/
|
|
303
|
+
session_id?: string;
|
|
304
|
+
}
|
|
305
|
+
namespace Options {
|
|
306
|
+
/**
|
|
307
|
+
* Explicit search settings. Unified search parameters are re-applied to
|
|
308
|
+
* overlapping settings; native result counts are lower-only.
|
|
309
|
+
*/
|
|
310
|
+
interface AdvancedSettings {
|
|
311
|
+
excerpt_settings?: AdvancedSettings.ExcerptSettings;
|
|
312
|
+
fetch_policy?: AdvancedSettings.FetchPolicy;
|
|
313
|
+
/**
|
|
314
|
+
* Native ISO 3166-1 alpha-2 location preference.
|
|
315
|
+
*/
|
|
316
|
+
location?: string | null;
|
|
317
|
+
/**
|
|
318
|
+
* Native count; lower-only alias for unified max_results.
|
|
319
|
+
*/
|
|
320
|
+
max_results?: number | null;
|
|
321
|
+
source_policy?: AdvancedSettings.SourcePolicy;
|
|
322
|
+
}
|
|
323
|
+
namespace AdvancedSettings {
|
|
324
|
+
interface ExcerptSettings {
|
|
325
|
+
max_chars_per_result?: number | null;
|
|
326
|
+
}
|
|
327
|
+
interface FetchPolicy {
|
|
328
|
+
/**
|
|
329
|
+
* When false, the provider may return cached content after live fetching fails.
|
|
330
|
+
*/
|
|
331
|
+
disable_cache_fallback?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Native live-fetch trigger; minimum 600 seconds. Not the unified hard-freshness
|
|
334
|
+
* control.
|
|
335
|
+
*/
|
|
336
|
+
max_age_seconds?: number | null;
|
|
337
|
+
/**
|
|
338
|
+
* Native live-fetch timeout, bounded by the remaining overall deadline.
|
|
339
|
+
*/
|
|
340
|
+
timeout_seconds?: number | null;
|
|
341
|
+
}
|
|
342
|
+
interface SourcePolicy {
|
|
343
|
+
/**
|
|
344
|
+
* Native publication-date lower bound.
|
|
345
|
+
*/
|
|
346
|
+
after_date?: string | null;
|
|
347
|
+
/**
|
|
348
|
+
* Native exclusions; the provider ignores these when native include_domains is
|
|
349
|
+
* non-empty.
|
|
350
|
+
*/
|
|
351
|
+
exclude_domains?: Array<string>;
|
|
352
|
+
/**
|
|
353
|
+
* Native domain/path restrictions. Explicit unified domain parameters take
|
|
354
|
+
* precedence. Combined include/exclude native lists cannot exceed 200 entries.
|
|
355
|
+
*/
|
|
356
|
+
include_domains?: Array<string>;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
interface SearchValyuTarget {
|
|
362
|
+
provider: 'valyu';
|
|
363
|
+
options?: SearchValyuTarget.Options;
|
|
364
|
+
}
|
|
365
|
+
namespace SearchValyuTarget {
|
|
366
|
+
interface Options {
|
|
367
|
+
/**
|
|
368
|
+
* Trade depth for latency.
|
|
369
|
+
*/
|
|
370
|
+
fast_mode?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* Allow historical cached results.
|
|
373
|
+
*/
|
|
374
|
+
historical_cache?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Include abstracts for academic sources.
|
|
377
|
+
*/
|
|
378
|
+
include_abstracts?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Natural-language retrieval guidance.
|
|
381
|
+
*/
|
|
382
|
+
instructions?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Mark the search as an agent tool call.
|
|
385
|
+
*/
|
|
386
|
+
is_tool_call?: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Provider-native count. Lower-only alias for max_results.
|
|
389
|
+
*/
|
|
390
|
+
max_num_results?: number;
|
|
391
|
+
/**
|
|
392
|
+
* Provider-native USD-per-thousand-results price ceiling. Forwarded to Valyu.
|
|
393
|
+
*/
|
|
394
|
+
max_price?: number;
|
|
395
|
+
/**
|
|
396
|
+
* Provider-native minimum relevance threshold. Not a normalized cross-provider
|
|
397
|
+
* score.
|
|
398
|
+
*/
|
|
399
|
+
relevance_threshold?: number;
|
|
400
|
+
/**
|
|
401
|
+
* Provider result-content length preset.
|
|
402
|
+
*/
|
|
403
|
+
response_length?: 'short' | 'medium' | 'large' | 'max';
|
|
404
|
+
/**
|
|
405
|
+
* Corpus selector, including all, web, proprietary, and news. Provider corpus
|
|
406
|
+
* choice may change billing; Kernel does not force web-only searches.
|
|
407
|
+
*/
|
|
408
|
+
search_type?: string;
|
|
409
|
+
/**
|
|
410
|
+
* Bias retrieval toward these sources.
|
|
411
|
+
*/
|
|
412
|
+
source_biases?: Array<string>;
|
|
413
|
+
/**
|
|
414
|
+
* Return URLs without content.
|
|
415
|
+
*/
|
|
416
|
+
url_only?: boolean;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
interface SearchOctenTarget {
|
|
420
|
+
provider: 'octen';
|
|
421
|
+
options?: SearchOctenTarget.Options;
|
|
422
|
+
}
|
|
423
|
+
namespace SearchOctenTarget {
|
|
424
|
+
interface Options {
|
|
425
|
+
count?: number;
|
|
426
|
+
end_time?: string;
|
|
427
|
+
exclude_domains?: Array<string>;
|
|
428
|
+
exclude_text?: Array<string>;
|
|
429
|
+
format?: 'markdown' | 'text';
|
|
430
|
+
full_content?: Options.FullContent;
|
|
431
|
+
highlight?: Options.Highlight;
|
|
432
|
+
include_domains?: Array<string>;
|
|
433
|
+
include_images?: boolean;
|
|
434
|
+
include_text?: Array<string>;
|
|
435
|
+
language?: Array<string>;
|
|
436
|
+
safesearch?: 'off' | 'strict';
|
|
437
|
+
start_time?: string;
|
|
438
|
+
time_basis?: 'auto' | 'published' | 'crawled';
|
|
439
|
+
time_range?: 'day' | 'week' | 'month' | 'year' | 'd' | 'w' | 'm' | 'y';
|
|
440
|
+
topic?: 'general' | 'news';
|
|
441
|
+
}
|
|
442
|
+
namespace Options {
|
|
443
|
+
interface FullContent {
|
|
444
|
+
enable?: boolean;
|
|
445
|
+
max_tokens?: number;
|
|
446
|
+
}
|
|
447
|
+
interface Highlight {
|
|
448
|
+
enable?: boolean;
|
|
449
|
+
max_tokens?: number;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
interface SearchYouTarget {
|
|
454
|
+
provider: 'you';
|
|
455
|
+
options?: SearchYouTarget.Options;
|
|
456
|
+
}
|
|
457
|
+
namespace SearchYouTarget {
|
|
458
|
+
interface Options {
|
|
459
|
+
/**
|
|
460
|
+
* Prefer these domains without excluding others. Cannot be combined with
|
|
461
|
+
* include_domains if the provider does not accept the combination.
|
|
462
|
+
*/
|
|
463
|
+
boost_domains?: Array<string>;
|
|
464
|
+
/**
|
|
465
|
+
* Provider-native per-section count. Lower-only alias for max_results. Web and
|
|
466
|
+
* news sections may produce more rows than Kernel returns.
|
|
467
|
+
*/
|
|
468
|
+
count?: number;
|
|
469
|
+
/**
|
|
470
|
+
* Native extraction timeout in seconds, bounded by the remaining Kernel request
|
|
471
|
+
* deadline.
|
|
472
|
+
*/
|
|
473
|
+
crawl_timeout?: number;
|
|
474
|
+
/**
|
|
475
|
+
* Provider-native page extraction. Both modes may incur per-row charges; full_page
|
|
476
|
+
* may retrieve web and news rows.
|
|
477
|
+
*/
|
|
478
|
+
extraction?: Options.Extraction;
|
|
479
|
+
/**
|
|
480
|
+
* Request licensed-data output. URL-less knowledge entries are not converted into
|
|
481
|
+
* web results; include_raw exposes the full provider response separately.
|
|
482
|
+
*/
|
|
483
|
+
knowledge?: 'core';
|
|
484
|
+
/**
|
|
485
|
+
* BCP 47 result language from You.com's 51-value enum, e.g. "EN", "JA". Default
|
|
486
|
+
* EN.
|
|
487
|
+
*/
|
|
488
|
+
language?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Page offset supported by You.com.
|
|
491
|
+
*/
|
|
492
|
+
offset?: number;
|
|
493
|
+
}
|
|
494
|
+
namespace Options {
|
|
495
|
+
/**
|
|
496
|
+
* Provider-native page extraction. Both modes may incur per-row charges; full_page
|
|
497
|
+
* may retrieve web and news rows.
|
|
498
|
+
*/
|
|
499
|
+
interface Extraction {
|
|
500
|
+
extraction_mode: 'highlights' | 'full_page';
|
|
501
|
+
full_page?: Extraction.FullPage;
|
|
502
|
+
}
|
|
503
|
+
namespace Extraction {
|
|
504
|
+
interface FullPage {
|
|
505
|
+
extraction_formats?: Array<'html' | 'markdown'>;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
interface SearchTavilyTarget {
|
|
511
|
+
provider: 'tavily';
|
|
512
|
+
options?: SearchTavilyTarget.Options;
|
|
513
|
+
}
|
|
514
|
+
namespace SearchTavilyTarget {
|
|
515
|
+
interface Options {
|
|
516
|
+
/**
|
|
517
|
+
* Allow the provider to choose search parameters. May select a different billing
|
|
518
|
+
* tier; explicit caller values retain provider-native precedence.
|
|
519
|
+
*/
|
|
520
|
+
auto_parameters?: boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Provider excerpts per source, up to 500 characters each.
|
|
523
|
+
*/
|
|
524
|
+
chunks_per_source?: number;
|
|
525
|
+
/**
|
|
526
|
+
* Require the quoted phrases in the query verbatim, bypassing semantic matches.
|
|
527
|
+
*/
|
|
528
|
+
exact_match?: boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Strictly filter non-matching languages. Requires `language`.
|
|
531
|
+
*/
|
|
532
|
+
filter_by_language?: boolean;
|
|
533
|
+
/**
|
|
534
|
+
* Request the provider's generated answer. Returned as answer on the search
|
|
535
|
+
* response, independently of include_raw.
|
|
536
|
+
*/
|
|
537
|
+
include_answer?: boolean | 'basic' | 'advanced';
|
|
538
|
+
/**
|
|
539
|
+
* Native filter versus ranking boost semantics. Boost influences ranking rather
|
|
540
|
+
* than restricting results to the listed domains. Requires include_domains.
|
|
541
|
+
*/
|
|
542
|
+
include_domains_mode?: 'filter' | 'boost';
|
|
543
|
+
/**
|
|
544
|
+
* Favicon URL per result.
|
|
545
|
+
*/
|
|
546
|
+
include_favicon?: boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Describe each image. Needs include_images.
|
|
549
|
+
*/
|
|
550
|
+
include_image_descriptions?: boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Query-related images plus per-result images.
|
|
553
|
+
*/
|
|
554
|
+
include_images?: boolean;
|
|
555
|
+
/**
|
|
556
|
+
* Request native full-page content. Defaults to markdown when omitted for this
|
|
557
|
+
* provider, False disables that native retrieval; it does not disable explicitly
|
|
558
|
+
* requested Kernel browser retrieval.
|
|
559
|
+
*/
|
|
560
|
+
include_raw_content?: boolean | 'markdown' | 'text';
|
|
561
|
+
/**
|
|
562
|
+
* ISO 639-1 code or English language name. Ranking boost unless
|
|
563
|
+
* filter_by_language.
|
|
564
|
+
*/
|
|
565
|
+
language?: string;
|
|
566
|
+
/**
|
|
567
|
+
* Provider-native count. Lower-only alias for max_results.
|
|
568
|
+
*/
|
|
569
|
+
max_results?: number;
|
|
570
|
+
/**
|
|
571
|
+
* Provider relevance and latency tier. Some tiers cannot be combined with native
|
|
572
|
+
* safe search; conflicts are described in warnings.
|
|
573
|
+
*/
|
|
574
|
+
search_depth?: 'advanced' | 'basic' | 'fast' | 'ultra-fast';
|
|
575
|
+
/**
|
|
576
|
+
* Provider corpus selector. Publication metadata depends on the selected topic.
|
|
577
|
+
*/
|
|
578
|
+
topic?: 'general' | 'news' | 'finance';
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
interface SearchSerpAPITarget {
|
|
582
|
+
provider: 'serpapi';
|
|
583
|
+
options?: SearchSerpAPITarget.Options;
|
|
584
|
+
}
|
|
585
|
+
namespace SearchSerpAPITarget {
|
|
586
|
+
interface Options {
|
|
587
|
+
/**
|
|
588
|
+
* SerpApi engine identifier. The Kernel integration currently supports google
|
|
589
|
+
* only.
|
|
590
|
+
*/
|
|
591
|
+
engine: string;
|
|
592
|
+
/**
|
|
593
|
+
* Device profile used for the search.
|
|
594
|
+
*/
|
|
595
|
+
device?: 'desktop' | 'mobile' | 'tablet';
|
|
596
|
+
/**
|
|
597
|
+
* Google duplicate-content filter.
|
|
598
|
+
*/
|
|
599
|
+
filter?: 0 | 1;
|
|
600
|
+
/**
|
|
601
|
+
* Two-letter Google country code.
|
|
602
|
+
*/
|
|
603
|
+
gl?: string;
|
|
604
|
+
/**
|
|
605
|
+
* Google domain to search when using the google engine.
|
|
606
|
+
*/
|
|
607
|
+
google_domain?: string;
|
|
608
|
+
/**
|
|
609
|
+
* Interface language code.
|
|
610
|
+
*/
|
|
611
|
+
hl?: string;
|
|
612
|
+
/**
|
|
613
|
+
* Free-form geographic location used for localized results.
|
|
614
|
+
*/
|
|
615
|
+
location?: string;
|
|
616
|
+
/**
|
|
617
|
+
* Google auto-correction filter.
|
|
618
|
+
*/
|
|
619
|
+
nfpr?: 0 | 1;
|
|
620
|
+
/**
|
|
621
|
+
* When true, bypass SerpApi cached results when supported.
|
|
622
|
+
*/
|
|
623
|
+
no_cache?: boolean;
|
|
624
|
+
/**
|
|
625
|
+
* Number of results requested from the search engine.
|
|
626
|
+
*/
|
|
627
|
+
num?: number;
|
|
628
|
+
/**
|
|
629
|
+
* Safe-search setting for engines that support it.
|
|
630
|
+
*/
|
|
631
|
+
safe?: 'active' | 'off';
|
|
632
|
+
/**
|
|
633
|
+
* Zero-based result offset for pagination.
|
|
634
|
+
*/
|
|
635
|
+
start?: number;
|
|
636
|
+
/**
|
|
637
|
+
* Google vertical search selector, such as images, video, news, or shopping.
|
|
638
|
+
*/
|
|
639
|
+
tbm?: string;
|
|
640
|
+
/**
|
|
641
|
+
* Google time and search modifiers, including freshness filters.
|
|
642
|
+
*/
|
|
643
|
+
tbs?: string;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
export interface Request {
|
|
648
|
+
/**
|
|
649
|
+
* Primary search query. A provider-native multi-query option applies only to that
|
|
650
|
+
* provider; other providers in a fallback chain receive this query.
|
|
651
|
+
*/
|
|
652
|
+
query: string;
|
|
653
|
+
/**
|
|
654
|
+
* Optional portable content retrieval. Pass true for defaults or an options
|
|
655
|
+
* object. Omission never starts Kernel browser work; provider-supplied content is
|
|
656
|
+
* still returned when available, including when requested through native options.
|
|
657
|
+
* Both inline and deferred retrieval use the same options schema.
|
|
658
|
+
*/
|
|
659
|
+
content?: true | Request.SearchContentOptions;
|
|
660
|
+
/**
|
|
661
|
+
* ISO 3166-1 alpha-2 search locale preference.
|
|
662
|
+
*/
|
|
663
|
+
country?: string;
|
|
664
|
+
/**
|
|
665
|
+
* Inclusive publication-date upper bound; must not precede start_date. If recency
|
|
666
|
+
* is also supplied, recency takes precedence with a warning. Unsupported or
|
|
667
|
+
* approximated filtering is reported, or rejected under strict_params.
|
|
668
|
+
*/
|
|
669
|
+
end_date?: string;
|
|
670
|
+
/**
|
|
671
|
+
* Hostname exclusions, with the same best-effort/strict behavior as
|
|
672
|
+
* include_domains. Provider-specific combinations that cannot be represented are
|
|
673
|
+
* reported via warnings or rejected in strict mode.
|
|
674
|
+
*/
|
|
675
|
+
exclude_domains?: Array<string>;
|
|
676
|
+
/**
|
|
677
|
+
* Hostname inclusion preference, matching a hostname and its subdomains. Empty
|
|
678
|
+
* means unrestricted. Translated, emulated, or dropped with a warning according to
|
|
679
|
+
* provider capability unless strict_params is true. Native boost modes remain
|
|
680
|
+
* advisory and are identified in warnings.
|
|
681
|
+
*/
|
|
682
|
+
include_domains?: Array<string>;
|
|
683
|
+
/**
|
|
684
|
+
* Include untouched per-result payloads and the full serving-provider response in
|
|
685
|
+
* raw fields. Off by default; native top-level outputs such as answer remain
|
|
686
|
+
* available without it.
|
|
687
|
+
*/
|
|
688
|
+
include_raw?: boolean;
|
|
689
|
+
/**
|
|
690
|
+
* BCP 47 search language preference.
|
|
691
|
+
*/
|
|
692
|
+
language?: string;
|
|
693
|
+
/**
|
|
694
|
+
* Requested result count from 1 through 100. The effective count is clamped to the
|
|
695
|
+
* serving provider's cap with a warning. Effective native counts are the lower of
|
|
696
|
+
* this limit and supplied provider-native count aliases. Strict mode rejects
|
|
697
|
+
* unsupported counts.
|
|
698
|
+
*/
|
|
699
|
+
max_results?: number;
|
|
700
|
+
/**
|
|
701
|
+
* Relative search window. Takes precedence over start_date/end_date with a warning
|
|
702
|
+
* if both are set. Provider-native recency behavior is retained, including
|
|
703
|
+
* documented hour-to-day widening. Unsupported filters are rejected only in strict
|
|
704
|
+
* mode.
|
|
705
|
+
*/
|
|
706
|
+
recency?: 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
707
|
+
/**
|
|
708
|
+
* Optional safety preference. Omit to use provider defaults. Unsupported values
|
|
709
|
+
* are dropped with a warning unless strict_params is true. A search filter is not
|
|
710
|
+
* an authorization boundary.
|
|
711
|
+
*/
|
|
712
|
+
safe_search?: 'off' | 'moderate' | 'strict';
|
|
713
|
+
/**
|
|
714
|
+
* Inclusive publication-date lower bound. If recency is also supplied, recency
|
|
715
|
+
* takes precedence with a warning. Provider date semantics, precision, and
|
|
716
|
+
* unsupported filters are reported; unknown source dates are not fabricated or
|
|
717
|
+
* universally post-filtered.
|
|
718
|
+
*/
|
|
719
|
+
start_date?: string;
|
|
720
|
+
/**
|
|
721
|
+
* Omitted strategy defaults to auto.
|
|
722
|
+
*/
|
|
723
|
+
strategy?: Strategy;
|
|
724
|
+
/**
|
|
725
|
+
* When false, unsupported portable parameters are omitted and approximations are
|
|
726
|
+
* described in warnings. When true, every supplied portable parameter must be
|
|
727
|
+
* honored exactly. Requests that cannot be served with those parameters are
|
|
728
|
+
* rejected. This does not guarantee identical rankings or document timestamps
|
|
729
|
+
* across indexes. Authentication and project isolation are always enforced.
|
|
730
|
+
*/
|
|
731
|
+
strict_params?: boolean;
|
|
732
|
+
/**
|
|
733
|
+
* Overall deadline across search attempts and inline retrieval. No new attempt
|
|
734
|
+
* starts after the deadline. Completed search results survive inline retrieval
|
|
735
|
+
* timeouts.
|
|
736
|
+
*/
|
|
737
|
+
timeout_ms?: number;
|
|
738
|
+
}
|
|
739
|
+
export declare namespace Request {
|
|
740
|
+
interface SearchContentOptions {
|
|
741
|
+
/**
|
|
742
|
+
* Invalid with source=provider. Supplying browser_id requires source=browser so
|
|
743
|
+
* the chosen identity is not bypassed.
|
|
744
|
+
*/
|
|
745
|
+
browser?: SearchContentOptions.Browser;
|
|
746
|
+
format?: 'markdown' | 'text';
|
|
747
|
+
/**
|
|
748
|
+
* Maximum acceptable age of cached page content, measured from origin retrieval. 0
|
|
749
|
+
* forces a live fetch. Governs the Kernel content cache, which is scoped to the
|
|
750
|
+
* caller organization and project and separated by retrieval context; fetches
|
|
751
|
+
* through a caller-supplied browser_id bypass that cache. Mapped to the provider
|
|
752
|
+
* freshness control when source is provider and the provider supports one;
|
|
753
|
+
* otherwise provider content age is reported as unknown via fetched_at.
|
|
754
|
+
*/
|
|
755
|
+
max_age_hours?: number;
|
|
756
|
+
/**
|
|
757
|
+
* Per-result Unicode character limit after extraction.
|
|
758
|
+
*/
|
|
759
|
+
max_chars?: number;
|
|
760
|
+
/**
|
|
761
|
+
* provider uses the search provider's native content retrieval; browser fetches
|
|
762
|
+
* each URL through a Kernel browser; auto prefers Kernel browser retrieval and
|
|
763
|
+
* falls back to provider-native content when browser retrieval is unavailable or
|
|
764
|
+
* unsuitable. Defaults to auto for both inline and deferred retrieval. Deferred
|
|
765
|
+
* provider retrieval requires post_hoc capability; an explicit provider source
|
|
766
|
+
* without it is a 400. Missing documents produce per-result unavailable outcomes,
|
|
767
|
+
* not request failures.
|
|
768
|
+
*/
|
|
769
|
+
source?: 'auto' | 'provider' | 'browser';
|
|
770
|
+
/**
|
|
771
|
+
* Per-result deadline including capacity acquisition, retrieval, and extraction.
|
|
772
|
+
* Also bounded by the overall request deadline.
|
|
773
|
+
*/
|
|
774
|
+
timeout_ms?: number;
|
|
775
|
+
}
|
|
776
|
+
namespace SearchContentOptions {
|
|
777
|
+
/**
|
|
778
|
+
* Invalid with source=provider. Supplying browser_id requires source=browser so
|
|
779
|
+
* the chosen identity is not bypassed.
|
|
780
|
+
*/
|
|
781
|
+
interface Browser {
|
|
782
|
+
/**
|
|
783
|
+
* Existing browser session ID authorized for the caller and selected project.
|
|
784
|
+
* Reuses its cookies, proxy, and browser configuration. Kernel does not delete a
|
|
785
|
+
* caller-supplied browser. Render mode uses a temporary tab; website activity may
|
|
786
|
+
* still change shared cookies and storage. When omitted, Kernel obtains isolated
|
|
787
|
+
* browser capacity in the caller's account and releases it after retrieval. That
|
|
788
|
+
* capacity is not retained for later interaction. Existing browser quotas apply.
|
|
789
|
+
*/
|
|
790
|
+
browser_id?: string;
|
|
791
|
+
/**
|
|
792
|
+
* Curl uses the browser HTTP stack without navigation or JavaScript execution.
|
|
793
|
+
* Render navigates a temporary page and extracts from its DOM. The selected mode
|
|
794
|
+
* is used for the retrieval.
|
|
795
|
+
*/
|
|
796
|
+
mode?: 'curl' | 'render';
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
export interface Result {
|
|
801
|
+
/**
|
|
802
|
+
* Kernel-generated identifier for this result. Stable only within the retained
|
|
803
|
+
* search; not standardized across providers. Provider-native IDs, when available,
|
|
804
|
+
* remain provider-specific raw fields.
|
|
805
|
+
*/
|
|
806
|
+
id: string;
|
|
807
|
+
/**
|
|
808
|
+
* One-based position in the returned ranking.
|
|
809
|
+
*/
|
|
810
|
+
rank: number;
|
|
811
|
+
/**
|
|
812
|
+
* Provider-returned URL, not assumed canonical.
|
|
813
|
+
*/
|
|
814
|
+
url: string;
|
|
815
|
+
additional_snippets?: Array<string>;
|
|
816
|
+
/**
|
|
817
|
+
* Portable retrieval outcome, or native content supplied by the search provider.
|
|
818
|
+
* Identity fields remain on the enclosing result. Native excerpts are labeled
|
|
819
|
+
* excerpt rather than full_page. Omission never triggers browser retrieval.
|
|
820
|
+
*/
|
|
821
|
+
content?: Result.Content;
|
|
822
|
+
/**
|
|
823
|
+
* Provider-supplied date or timestamp, preserving available precision. No
|
|
824
|
+
* publication date is fabricated. Retains the published field name.
|
|
825
|
+
*/
|
|
826
|
+
published_date?: string | null;
|
|
827
|
+
/**
|
|
828
|
+
* Original provider result, included only with include_raw=true. Provider
|
|
829
|
+
* relevance scores are not normalized. Top-level provider data is available in
|
|
830
|
+
* Search.raw.
|
|
831
|
+
*/
|
|
832
|
+
raw?: unknown;
|
|
833
|
+
snippet?: string | null;
|
|
834
|
+
/**
|
|
835
|
+
* Provider source name or result URL hostname, when available.
|
|
836
|
+
*/
|
|
837
|
+
source?: string | null;
|
|
838
|
+
title?: string | null;
|
|
839
|
+
}
|
|
840
|
+
export declare namespace Result {
|
|
841
|
+
/**
|
|
842
|
+
* Portable retrieval outcome, or native content supplied by the search provider.
|
|
843
|
+
* Identity fields remain on the enclosing result. Native excerpts are labeled
|
|
844
|
+
* excerpt rather than full_page. Omission never triggers browser retrieval.
|
|
845
|
+
*/
|
|
846
|
+
interface Content {
|
|
847
|
+
/**
|
|
848
|
+
* Ok means non-empty extracted content, not merely HTTP 200. Blocked includes
|
|
849
|
+
* detected challenges or access denials. Detection is best-effort, not a guarantee
|
|
850
|
+
* of page completeness. Error details are present for non-ok outcomes; text is
|
|
851
|
+
* present only on ok.
|
|
852
|
+
*/
|
|
853
|
+
status: 'ok' | 'unavailable' | 'blocked' | 'timeout' | 'unsupported_type' | 'extraction_failed' | 'error';
|
|
854
|
+
/**
|
|
855
|
+
* Kernel cache outcome. Provider-internal cache behavior may be unknown.
|
|
856
|
+
*/
|
|
857
|
+
cache_status?: 'hit' | 'miss' | 'bypass' | 'unknown';
|
|
858
|
+
/**
|
|
859
|
+
* Describes source coverage before max_chars truncation. Full_page means main-page
|
|
860
|
+
* content, not every dynamic element or linked page.
|
|
861
|
+
*/
|
|
862
|
+
completeness?: 'full_page' | 'excerpt' | 'unknown';
|
|
863
|
+
error?: Content.Error;
|
|
864
|
+
/**
|
|
865
|
+
* Extraction version when Kernel transformed the input.
|
|
866
|
+
*/
|
|
867
|
+
extractor_version?: string;
|
|
868
|
+
/**
|
|
869
|
+
* Origin retrieval time when known, not cache read time.
|
|
870
|
+
*/
|
|
871
|
+
fetched_at?: string | null;
|
|
872
|
+
/**
|
|
873
|
+
* Final retrieval URL when known.
|
|
874
|
+
*/
|
|
875
|
+
final_url?: string;
|
|
876
|
+
format?: 'markdown' | 'text';
|
|
877
|
+
/**
|
|
878
|
+
* Final target HTTP status when known.
|
|
879
|
+
*/
|
|
880
|
+
http_status?: number;
|
|
881
|
+
/**
|
|
882
|
+
* Original retrieval method, including on cache hits.
|
|
883
|
+
*/
|
|
884
|
+
method?: 'provider' | 'browser_curl' | 'browser_render';
|
|
885
|
+
/**
|
|
886
|
+
* Extracted website content, untrusted, not instructions. Present only on
|
|
887
|
+
* status=ok.
|
|
888
|
+
*/
|
|
889
|
+
text?: string;
|
|
890
|
+
/**
|
|
891
|
+
* Whether max_chars truncated the extracted content.
|
|
892
|
+
*/
|
|
893
|
+
truncated?: boolean;
|
|
894
|
+
}
|
|
895
|
+
namespace Content {
|
|
896
|
+
interface Error {
|
|
897
|
+
/**
|
|
898
|
+
* Machine-readable retrieval failure code.
|
|
899
|
+
*/
|
|
900
|
+
code: string;
|
|
901
|
+
/**
|
|
902
|
+
* Human-readable failure description.
|
|
903
|
+
*/
|
|
904
|
+
message: string;
|
|
905
|
+
retryable: boolean;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Retained search results and provider attempt history.
|
|
911
|
+
*/
|
|
912
|
+
export interface Search {
|
|
913
|
+
/**
|
|
914
|
+
* Search resource ID. Request tracing uses X-Request-Id.
|
|
915
|
+
*/
|
|
916
|
+
id: string;
|
|
917
|
+
attempts: Array<Attempt>;
|
|
918
|
+
/**
|
|
919
|
+
* Expiration of result IDs for deferred retrieval. Results expire 24 hours after
|
|
920
|
+
* search completion.
|
|
921
|
+
*/
|
|
922
|
+
expires_at: string;
|
|
923
|
+
/**
|
|
924
|
+
* Concrete serving provider, never auto or fallback.
|
|
925
|
+
*/
|
|
926
|
+
provider: string;
|
|
927
|
+
/**
|
|
928
|
+
* Echo of the query. Native multi-query inputs are visible in the selected
|
|
929
|
+
* strategy target and the optional raw response.
|
|
930
|
+
*/
|
|
931
|
+
query: string;
|
|
932
|
+
results: Array<Result>;
|
|
933
|
+
usage: Usage;
|
|
934
|
+
warnings: Array<Warning>;
|
|
935
|
+
/**
|
|
936
|
+
* Provider-generated answer when requested (e.g. via Tavily include_answer or
|
|
937
|
+
* Perplexity). Preserved independently of include_raw.
|
|
938
|
+
*/
|
|
939
|
+
answer?: string;
|
|
940
|
+
/**
|
|
941
|
+
* Full serving-provider response, including top-level metadata that does not
|
|
942
|
+
* belong to a result. Present only with include_raw=true; untrusted provider data.
|
|
943
|
+
*/
|
|
944
|
+
raw?: unknown;
|
|
945
|
+
}
|
|
946
|
+
/**
|
|
947
|
+
* Typed provider selection and routing strategy.
|
|
948
|
+
*/
|
|
949
|
+
export type Strategy = Strategy.SearchAutoStrategy | Strategy.SearchPinnedStrategy | Strategy.SearchFallbackStrategy;
|
|
950
|
+
export declare namespace Strategy {
|
|
951
|
+
interface SearchAutoStrategy {
|
|
952
|
+
/**
|
|
953
|
+
* Let Kernel choose an eligible provider by capability fit.
|
|
954
|
+
*/
|
|
955
|
+
type: 'auto';
|
|
956
|
+
/**
|
|
957
|
+
* Conditions that advance to the next provider under auto routing or an explicit
|
|
958
|
+
* providers chain. Ignored when provider pins a single provider. error means a
|
|
959
|
+
* retryable provider failure, including rate limiting, not invalid caller input or
|
|
960
|
+
* caller quotas. empty means zero results after required filtering. An empty list
|
|
961
|
+
* disables fallback. If every attempt is empty or fails, the response is the first
|
|
962
|
+
* valid empty response with the full attempt trail, or a 502 if none succeeded.
|
|
963
|
+
*/
|
|
964
|
+
fallback_on?: Array<'error' | 'timeout' | 'empty'>;
|
|
965
|
+
/**
|
|
966
|
+
* Provider targets available to auto routing, each paired with typed native
|
|
967
|
+
* options. Provider names must be unique.
|
|
968
|
+
*/
|
|
969
|
+
provider_options?: Array<SearchAPI.ProviderTarget>;
|
|
970
|
+
}
|
|
971
|
+
interface SearchPinnedStrategy {
|
|
972
|
+
/**
|
|
973
|
+
* Provider name paired with its typed native options.
|
|
974
|
+
*/
|
|
975
|
+
provider: SearchAPI.ProviderTarget;
|
|
976
|
+
/**
|
|
977
|
+
* Use exactly the selected provider with no cross-provider fallback.
|
|
978
|
+
*/
|
|
979
|
+
type: 'pinned';
|
|
980
|
+
}
|
|
981
|
+
interface SearchFallbackStrategy {
|
|
982
|
+
/**
|
|
983
|
+
* Ordered provider targets. Provider names must be unique.
|
|
984
|
+
*/
|
|
985
|
+
providers: Array<SearchAPI.ProviderTarget>;
|
|
986
|
+
/**
|
|
987
|
+
* Try providers in order and advance when fallback_on matches the outcome.
|
|
988
|
+
*/
|
|
989
|
+
type: 'fallback';
|
|
990
|
+
/**
|
|
991
|
+
* Conditions that advance to the next provider under auto routing or an explicit
|
|
992
|
+
* providers chain. Ignored when provider pins a single provider. error means a
|
|
993
|
+
* retryable provider failure, including rate limiting, not invalid caller input or
|
|
994
|
+
* caller quotas. empty means zero results after required filtering. An empty list
|
|
995
|
+
* disables fallback. If every attempt is empty or fails, the response is the first
|
|
996
|
+
* valid empty response with the full attempt trail, or a 502 if none succeeded.
|
|
997
|
+
*/
|
|
998
|
+
fallback_on?: Array<'error' | 'timeout' | 'empty'>;
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
export interface Usage {
|
|
1002
|
+
/**
|
|
1003
|
+
* Number of result URLs for which a Kernel browser retrieval was attempted,
|
|
1004
|
+
* excluding cache-only hits.
|
|
1005
|
+
*/
|
|
1006
|
+
content_fetches: number;
|
|
1007
|
+
/**
|
|
1008
|
+
* Number of result entries returned, including failed entries on the contents
|
|
1009
|
+
* endpoint.
|
|
1010
|
+
*/
|
|
1011
|
+
results_count: number;
|
|
1012
|
+
/**
|
|
1013
|
+
* Total customer charge in USD when billing data is available.
|
|
1014
|
+
*/
|
|
1015
|
+
cost?: number;
|
|
1016
|
+
}
|
|
1017
|
+
export interface Warning {
|
|
1018
|
+
/**
|
|
1019
|
+
* Examples: param_unsupported, preference_unsupported, max_results_clamped,
|
|
1020
|
+
* domains_truncated, recency_emulated, filter_emulated, date_filter_overridden,
|
|
1021
|
+
* provider_ineligible, fallback_failed, content_partial.
|
|
1022
|
+
*/
|
|
1023
|
+
code: string;
|
|
1024
|
+
message: string;
|
|
1025
|
+
param?: string;
|
|
1026
|
+
provider?: string;
|
|
1027
|
+
result_id?: string;
|
|
1028
|
+
}
|
|
1029
|
+
export interface SearchCreateParams {
|
|
1030
|
+
/**
|
|
1031
|
+
* Primary search query. A provider-native multi-query option applies only to that
|
|
1032
|
+
* provider; other providers in a fallback chain receive this query.
|
|
1033
|
+
*/
|
|
1034
|
+
query: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* Optional portable content retrieval. Pass true for defaults or an options
|
|
1037
|
+
* object. Omission never starts Kernel browser work; provider-supplied content is
|
|
1038
|
+
* still returned when available, including when requested through native options.
|
|
1039
|
+
* Both inline and deferred retrieval use the same options schema.
|
|
1040
|
+
*/
|
|
1041
|
+
content?: true | SearchCreateParams.SearchContentOptions;
|
|
1042
|
+
/**
|
|
1043
|
+
* ISO 3166-1 alpha-2 search locale preference.
|
|
1044
|
+
*/
|
|
1045
|
+
country?: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* Inclusive publication-date upper bound; must not precede start_date. If recency
|
|
1048
|
+
* is also supplied, recency takes precedence with a warning. Unsupported or
|
|
1049
|
+
* approximated filtering is reported, or rejected under strict_params.
|
|
1050
|
+
*/
|
|
1051
|
+
end_date?: string;
|
|
1052
|
+
/**
|
|
1053
|
+
* Hostname exclusions, with the same best-effort/strict behavior as
|
|
1054
|
+
* include_domains. Provider-specific combinations that cannot be represented are
|
|
1055
|
+
* reported via warnings or rejected in strict mode.
|
|
1056
|
+
*/
|
|
1057
|
+
exclude_domains?: Array<string>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Hostname inclusion preference, matching a hostname and its subdomains. Empty
|
|
1060
|
+
* means unrestricted. Translated, emulated, or dropped with a warning according to
|
|
1061
|
+
* provider capability unless strict_params is true. Native boost modes remain
|
|
1062
|
+
* advisory and are identified in warnings.
|
|
1063
|
+
*/
|
|
1064
|
+
include_domains?: Array<string>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Include untouched per-result payloads and the full serving-provider response in
|
|
1067
|
+
* raw fields. Off by default; native top-level outputs such as answer remain
|
|
1068
|
+
* available without it.
|
|
1069
|
+
*/
|
|
1070
|
+
include_raw?: boolean;
|
|
1071
|
+
/**
|
|
1072
|
+
* BCP 47 search language preference.
|
|
1073
|
+
*/
|
|
1074
|
+
language?: string;
|
|
1075
|
+
/**
|
|
1076
|
+
* Requested result count from 1 through 100. The effective count is clamped to the
|
|
1077
|
+
* serving provider's cap with a warning. Effective native counts are the lower of
|
|
1078
|
+
* this limit and supplied provider-native count aliases. Strict mode rejects
|
|
1079
|
+
* unsupported counts.
|
|
1080
|
+
*/
|
|
1081
|
+
max_results?: number;
|
|
1082
|
+
/**
|
|
1083
|
+
* Relative search window. Takes precedence over start_date/end_date with a warning
|
|
1084
|
+
* if both are set. Provider-native recency behavior is retained, including
|
|
1085
|
+
* documented hour-to-day widening. Unsupported filters are rejected only in strict
|
|
1086
|
+
* mode.
|
|
1087
|
+
*/
|
|
1088
|
+
recency?: 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
1089
|
+
/**
|
|
1090
|
+
* Optional safety preference. Omit to use provider defaults. Unsupported values
|
|
1091
|
+
* are dropped with a warning unless strict_params is true. A search filter is not
|
|
1092
|
+
* an authorization boundary.
|
|
1093
|
+
*/
|
|
1094
|
+
safe_search?: 'off' | 'moderate' | 'strict';
|
|
1095
|
+
/**
|
|
1096
|
+
* Inclusive publication-date lower bound. If recency is also supplied, recency
|
|
1097
|
+
* takes precedence with a warning. Provider date semantics, precision, and
|
|
1098
|
+
* unsupported filters are reported; unknown source dates are not fabricated or
|
|
1099
|
+
* universally post-filtered.
|
|
1100
|
+
*/
|
|
1101
|
+
start_date?: string;
|
|
1102
|
+
/**
|
|
1103
|
+
* Omitted strategy defaults to auto.
|
|
1104
|
+
*/
|
|
1105
|
+
strategy?: Strategy;
|
|
1106
|
+
/**
|
|
1107
|
+
* When false, unsupported portable parameters are omitted and approximations are
|
|
1108
|
+
* described in warnings. When true, every supplied portable parameter must be
|
|
1109
|
+
* honored exactly. Requests that cannot be served with those parameters are
|
|
1110
|
+
* rejected. This does not guarantee identical rankings or document timestamps
|
|
1111
|
+
* across indexes. Authentication and project isolation are always enforced.
|
|
1112
|
+
*/
|
|
1113
|
+
strict_params?: boolean;
|
|
1114
|
+
/**
|
|
1115
|
+
* Overall deadline across search attempts and inline retrieval. No new attempt
|
|
1116
|
+
* starts after the deadline. Completed search results survive inline retrieval
|
|
1117
|
+
* timeouts.
|
|
1118
|
+
*/
|
|
1119
|
+
timeout_ms?: number;
|
|
1120
|
+
}
|
|
1121
|
+
export declare namespace SearchCreateParams {
|
|
1122
|
+
interface SearchContentOptions {
|
|
1123
|
+
/**
|
|
1124
|
+
* Invalid with source=provider. Supplying browser_id requires source=browser so
|
|
1125
|
+
* the chosen identity is not bypassed.
|
|
1126
|
+
*/
|
|
1127
|
+
browser?: SearchContentOptions.Browser;
|
|
1128
|
+
format?: 'markdown' | 'text';
|
|
1129
|
+
/**
|
|
1130
|
+
* Maximum acceptable age of cached page content, measured from origin retrieval. 0
|
|
1131
|
+
* forces a live fetch. Governs the Kernel content cache, which is scoped to the
|
|
1132
|
+
* caller organization and project and separated by retrieval context; fetches
|
|
1133
|
+
* through a caller-supplied browser_id bypass that cache. Mapped to the provider
|
|
1134
|
+
* freshness control when source is provider and the provider supports one;
|
|
1135
|
+
* otherwise provider content age is reported as unknown via fetched_at.
|
|
1136
|
+
*/
|
|
1137
|
+
max_age_hours?: number;
|
|
1138
|
+
/**
|
|
1139
|
+
* Per-result Unicode character limit after extraction.
|
|
1140
|
+
*/
|
|
1141
|
+
max_chars?: number;
|
|
1142
|
+
/**
|
|
1143
|
+
* provider uses the search provider's native content retrieval; browser fetches
|
|
1144
|
+
* each URL through a Kernel browser; auto prefers Kernel browser retrieval and
|
|
1145
|
+
* falls back to provider-native content when browser retrieval is unavailable or
|
|
1146
|
+
* unsuitable. Defaults to auto for both inline and deferred retrieval. Deferred
|
|
1147
|
+
* provider retrieval requires post_hoc capability; an explicit provider source
|
|
1148
|
+
* without it is a 400. Missing documents produce per-result unavailable outcomes,
|
|
1149
|
+
* not request failures.
|
|
1150
|
+
*/
|
|
1151
|
+
source?: 'auto' | 'provider' | 'browser';
|
|
1152
|
+
/**
|
|
1153
|
+
* Per-result deadline including capacity acquisition, retrieval, and extraction.
|
|
1154
|
+
* Also bounded by the overall request deadline.
|
|
1155
|
+
*/
|
|
1156
|
+
timeout_ms?: number;
|
|
1157
|
+
}
|
|
1158
|
+
namespace SearchContentOptions {
|
|
1159
|
+
/**
|
|
1160
|
+
* Invalid with source=provider. Supplying browser_id requires source=browser so
|
|
1161
|
+
* the chosen identity is not bypassed.
|
|
1162
|
+
*/
|
|
1163
|
+
interface Browser {
|
|
1164
|
+
/**
|
|
1165
|
+
* Existing browser session ID authorized for the caller and selected project.
|
|
1166
|
+
* Reuses its cookies, proxy, and browser configuration. Kernel does not delete a
|
|
1167
|
+
* caller-supplied browser. Render mode uses a temporary tab; website activity may
|
|
1168
|
+
* still change shared cookies and storage. When omitted, Kernel obtains isolated
|
|
1169
|
+
* browser capacity in the caller's account and releases it after retrieval. That
|
|
1170
|
+
* capacity is not retained for later interaction. Existing browser quotas apply.
|
|
1171
|
+
*/
|
|
1172
|
+
browser_id?: string;
|
|
1173
|
+
/**
|
|
1174
|
+
* Curl uses the browser HTTP stack without navigation or JavaScript execution.
|
|
1175
|
+
* Render navigates a temporary page and extracts from its DOM. The selected mode
|
|
1176
|
+
* is used for the retrieval.
|
|
1177
|
+
*/
|
|
1178
|
+
mode?: 'curl' | 'render';
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
export declare namespace SearchResource {
|
|
1183
|
+
export { type Attempt as Attempt, type ProviderTarget as ProviderTarget, type Request as Request, type Result as Result, type Search as Search, type Strategy as Strategy, type Usage as Usage, type Warning as Warning, type SearchCreateParams as SearchCreateParams, };
|
|
1184
|
+
export { ContentsAPIContents as Contents, type FetchRequest as FetchRequest, type Response as Response, type ContentFetchParams as ContentFetchParams, };
|
|
1185
|
+
export { Providers as Providers, type Provider as Provider, type ProviderListResponse as ProviderListResponse, type ProviderListParams as ProviderListParams, };
|
|
1186
|
+
}
|
|
1187
|
+
//# sourceMappingURL=search.d.mts.map
|