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