@onkernel/sdk 0.114.0 → 0.116.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.
@@ -7,16 +7,24 @@ import { RequestOptions } from "../../internal/request-options.js";
7
7
  */
8
8
  export declare class Contents extends APIResource {
9
9
  /**
10
- * Deferred result-content retrieval is reserved but not available in this release.
11
- * Requests return 404 until the retrieval implementation is shipped. X-Request-Id
12
- * identifies this request separately from the search resource.
10
+ * Retrieves selected results from a retained search. Provide exactly one of
11
+ * result_ids or limit; the latter fetches the top results. Content defaults to
12
+ * source:auto. Responses preserve result_ids order. Unknown result IDs are
13
+ * rejected before retrieval starts. Missing, expired, or inaccessible searches
14
+ * return 404. Once retrieval begins, return one outcome per selected result,
15
+ * including timeout entries for work unfinished at the overall deadline. Browser
16
+ * retrievals run sequentially in result order, so later results may time out when
17
+ * earlier pages are slow. X-Request-Id identifies this request separately from the
18
+ * search resource.
13
19
  *
14
20
  * @example
15
21
  * ```ts
16
- * await client.search.contents.fetch('srch_abc123');
22
+ * const response = await client.search.contents.fetch(
23
+ * 'srch_abc123',
24
+ * );
17
25
  * ```
18
26
  */
19
- fetch(id: string, body: ContentFetchParams, options?: RequestOptions): APIPromise<void>;
27
+ fetch(id: string, body: ContentFetchParams, options?: RequestOptions): APIPromise<Response>;
20
28
  }
21
29
  export interface FetchRequest {
22
30
  /**
@@ -44,32 +52,33 @@ export declare namespace FetchRequest {
44
52
  */
45
53
  interface Content {
46
54
  /**
47
- * Invalid with source=provider. Supplying browser_id requires source=browser so
48
- * the chosen identity is not bypassed.
55
+ * Requires source=auto or source=browser in deferred retrieval.
49
56
  */
50
57
  browser?: Content.Browser;
51
58
  format?: 'markdown' | 'text';
52
59
  /**
53
- * Maximum acceptable age of cached page content, measured from origin retrieval. 0
54
- * forces a live fetch. Governs the Kernel content cache, which is scoped to the
55
- * caller organization and project and separated by retrieval context; fetches
56
- * through a caller-supplied browser_id bypass that cache. Mapped to the provider
57
- * freshness control when source is provider and the provider supports one;
58
- * otherwise provider content age is reported as unknown via fetched_at.
60
+ * For source=auto, maximum acceptable age of retained provider content, measured
61
+ * from when the search received it from the provider. A value of 0 disables reuse
62
+ * of retained content, so every result is fetched through a browser.
63
+ * source=provider reuses retained provider content without freshness validation.
64
+ * source=browser always fetches through a browser and does not use this age limit.
59
65
  */
60
66
  max_age_hours?: number;
61
67
  /**
62
- * Per-result Unicode character limit after extraction.
68
+ * Per-result Unicode character limit after extraction. Retained provider content
69
+ * cannot exceed what was stored at search time; such results report truncated when
70
+ * the stored text was already truncated.
63
71
  */
64
72
  max_chars?: number;
65
73
  /**
66
- * provider uses the search provider's native content retrieval; browser fetches
67
- * each URL through a Kernel browser; auto prefers Kernel browser retrieval and
68
- * falls back to provider-native content when browser retrieval is unavailable or
69
- * unsuitable. Defaults to auto for both inline and deferred retrieval. Deferred
70
- * provider retrieval requires post_hoc capability; an explicit provider source
71
- * without it is a 400. Missing documents produce per-result unavailable outcomes,
72
- * not request failures.
74
+ * auto uses retained provider content within max_age_hours; for deferred retrieval
75
+ * it falls back to a Kernel browser (caller-supplied or temporary) for results
76
+ * without it. Inline retrieval never uses a browser. provider reuses retained
77
+ * provider content when available, without freshness validation, and never
78
+ * provisions a browser. browser fetches each URL through a Kernel browser, either
79
+ * caller-supplied or temporary. No option makes a new provider request. Defaults
80
+ * to auto for both inline and deferred retrieval. Missing documents produce
81
+ * per-result unavailable outcomes, not request failures.
73
82
  */
74
83
  source?: 'auto' | 'provider' | 'browser';
75
84
  /**
@@ -80,17 +89,22 @@ export declare namespace FetchRequest {
80
89
  }
81
90
  namespace Content {
82
91
  /**
83
- * Invalid with source=provider. Supplying browser_id requires source=browser so
84
- * the chosen identity is not bypassed.
92
+ * Requires source=auto or source=browser in deferred retrieval.
85
93
  */
86
94
  interface Browser {
87
95
  /**
88
96
  * Existing browser session ID authorized for the caller and selected project.
89
- * Reuses its cookies, proxy, and browser configuration. Kernel does not delete a
90
- * caller-supplied browser. Render mode uses a temporary tab; website activity may
91
- * still change shared cookies and storage. When omitted, Kernel obtains isolated
92
- * browser capacity in the caller's account and releases it after retrieval. That
93
- * capacity is not retained for later interaction. Existing browser quotas apply.
97
+ * Reuses its cookies, proxy, and browser configuration; requests follow that
98
+ * browser's existing network access behavior, with no additional destination
99
+ * allowlist in this endpoint. Kernel does not delete a caller-supplied browser.
100
+ * Render mode uses a temporary tab; website activity may still change shared
101
+ * cookies and storage. When omitted and any result needs browser retrieval, Kernel
102
+ * creates one temporary browser for the request using the dashboard launch
103
+ * defaults (headful, stealth, default proxy), tags it with search_id, and deletes
104
+ * it when the request finishes. It is billed and counts toward browser concurrency
105
+ * like any other browser. A concurrency rejection returns 429 for source=browser;
106
+ * for source=auto, results with retained content are still returned and the rest
107
+ * report the rejection.
94
108
  */
95
109
  browser_id?: string;
96
110
  /**
@@ -123,7 +137,9 @@ export declare namespace Response {
123
137
  */
124
138
  url: string;
125
139
  /**
126
- * Kernel cache outcome. Provider-internal cache behavior may be unknown.
140
+ * Kernel content cache outcome. Kernel has no content cache yet: responses report
141
+ * bypass or unknown, and hit and miss are reserved. Provider-internal cache
142
+ * behavior may be unknown.
127
143
  */
128
144
  cache_status?: 'hit' | 'miss' | 'bypass' | 'unknown';
129
145
  /**
@@ -137,20 +153,26 @@ export declare namespace Response {
137
153
  */
138
154
  extractor_version?: string;
139
155
  /**
140
- * Origin retrieval time when known, not cache read time.
156
+ * When Kernel fetched the content, or received it from the provider for retained
157
+ * content.
141
158
  */
142
159
  fetched_at?: string | null;
143
160
  /**
144
- * Final retrieval URL when known.
161
+ * Final retrieval URL after redirects when known. Curl mode follows up to 5
162
+ * redirects.
145
163
  */
146
164
  final_url?: string;
165
+ /**
166
+ * Format of text. Plain-text and JSON pages are returned unchanged as text even
167
+ * when markdown was requested.
168
+ */
147
169
  format?: 'markdown' | 'text';
148
170
  /**
149
171
  * Final target HTTP status when known.
150
172
  */
151
173
  http_status?: number;
152
174
  /**
153
- * Original retrieval method, including on cache hits.
175
+ * Original retrieval method.
154
176
  */
155
177
  method?: 'provider' | 'browser_curl' | 'browser_render';
156
178
  /**
@@ -159,7 +181,8 @@ export declare namespace Response {
159
181
  */
160
182
  text?: string;
161
183
  /**
162
- * Whether max_chars truncated the extracted content.
184
+ * Whether the content was cut short, by max_chars or because the page exceeded the
185
+ * 1 MiB read limit.
163
186
  */
164
187
  truncated?: boolean;
165
188
  }
@@ -203,32 +226,33 @@ export declare namespace ContentFetchParams {
203
226
  */
204
227
  interface Content {
205
228
  /**
206
- * Invalid with source=provider. Supplying browser_id requires source=browser so
207
- * the chosen identity is not bypassed.
229
+ * Requires source=auto or source=browser in deferred retrieval.
208
230
  */
209
231
  browser?: Content.Browser;
210
232
  format?: 'markdown' | 'text';
211
233
  /**
212
- * Maximum acceptable age of cached page content, measured from origin retrieval. 0
213
- * forces a live fetch. Governs the Kernel content cache, which is scoped to the
214
- * caller organization and project and separated by retrieval context; fetches
215
- * through a caller-supplied browser_id bypass that cache. Mapped to the provider
216
- * freshness control when source is provider and the provider supports one;
217
- * otherwise provider content age is reported as unknown via fetched_at.
234
+ * For source=auto, maximum acceptable age of retained provider content, measured
235
+ * from when the search received it from the provider. A value of 0 disables reuse
236
+ * of retained content, so every result is fetched through a browser.
237
+ * source=provider reuses retained provider content without freshness validation.
238
+ * source=browser always fetches through a browser and does not use this age limit.
218
239
  */
219
240
  max_age_hours?: number;
220
241
  /**
221
- * Per-result Unicode character limit after extraction.
242
+ * Per-result Unicode character limit after extraction. Retained provider content
243
+ * cannot exceed what was stored at search time; such results report truncated when
244
+ * the stored text was already truncated.
222
245
  */
223
246
  max_chars?: number;
224
247
  /**
225
- * provider uses the search provider's native content retrieval; browser fetches
226
- * each URL through a Kernel browser; auto prefers Kernel browser retrieval and
227
- * falls back to provider-native content when browser retrieval is unavailable or
228
- * unsuitable. Defaults to auto for both inline and deferred retrieval. Deferred
229
- * provider retrieval requires post_hoc capability; an explicit provider source
230
- * without it is a 400. Missing documents produce per-result unavailable outcomes,
231
- * not request failures.
248
+ * auto uses retained provider content within max_age_hours; for deferred retrieval
249
+ * it falls back to a Kernel browser (caller-supplied or temporary) for results
250
+ * without it. Inline retrieval never uses a browser. provider reuses retained
251
+ * provider content when available, without freshness validation, and never
252
+ * provisions a browser. browser fetches each URL through a Kernel browser, either
253
+ * caller-supplied or temporary. No option makes a new provider request. Defaults
254
+ * to auto for both inline and deferred retrieval. Missing documents produce
255
+ * per-result unavailable outcomes, not request failures.
232
256
  */
233
257
  source?: 'auto' | 'provider' | 'browser';
234
258
  /**
@@ -239,17 +263,22 @@ export declare namespace ContentFetchParams {
239
263
  }
240
264
  namespace Content {
241
265
  /**
242
- * Invalid with source=provider. Supplying browser_id requires source=browser so
243
- * the chosen identity is not bypassed.
266
+ * Requires source=auto or source=browser in deferred retrieval.
244
267
  */
245
268
  interface Browser {
246
269
  /**
247
270
  * Existing browser session ID authorized for the caller and selected project.
248
- * Reuses its cookies, proxy, and browser configuration. Kernel does not delete a
249
- * caller-supplied browser. Render mode uses a temporary tab; website activity may
250
- * still change shared cookies and storage. When omitted, Kernel obtains isolated
251
- * browser capacity in the caller's account and releases it after retrieval. That
252
- * capacity is not retained for later interaction. Existing browser quotas apply.
271
+ * Reuses its cookies, proxy, and browser configuration; requests follow that
272
+ * browser's existing network access behavior, with no additional destination
273
+ * allowlist in this endpoint. Kernel does not delete a caller-supplied browser.
274
+ * Render mode uses a temporary tab; website activity may still change shared
275
+ * cookies and storage. When omitted and any result needs browser retrieval, Kernel
276
+ * creates one temporary browser for the request using the dashboard launch
277
+ * defaults (headful, stealth, default proxy), tags it with search_id, and deletes
278
+ * it when the request finishes. It is billed and counts toward browser concurrency
279
+ * like any other browser. A concurrency rejection returns 429 for source=browser;
280
+ * for source=auto, results with retained content are still returned and the rest
281
+ * report the rejection.
253
282
  */
254
283
  browser_id?: string;
255
284
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"contents.d.ts","sourceRoot":"","sources":["../../src/resources/search/contents.ts"],"names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hB,SAAS,EAAE,OAAO,CAAC;SACpB;KACF;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC;IAErC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yBAAiB,kBAAkB,CAAC;IAClC;;OAEG;IACH,UAAiB,OAAO;QACtB;;;WAGG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;QAE1B,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;QAE7B;;;;;;;WAOG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;;;;;;;WAQG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;QAEzC;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAED,UAAiB,OAAO,CAAC;QACvB;;;WAGG;QACH,UAAiB,OAAO;YACtB;;;;;;;eAOG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC;YAEpB;;;;eAIG;YACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;SAC1B;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
1
+ {"version":3,"file":"contents.d.ts","sourceRoot":"","sources":["../../src/resources/search/contents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,+BAA4B;AAClD,OAAO,KAAK,SAAS,oBAAiB;AACtC,OA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,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC;IAErC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yBAAiB,kBAAkB,CAAC;IAClC;;OAEG;IACH,UAAiB,OAAO;QACtB;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC;QAE1B,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;QAE7B;;;;;;WAMG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;;;;;;;;WASG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;QAEzC;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;IAED,UAAiB,OAAO,CAAC;QACvB;;WAEG;QACH,UAAiB,OAAO;YACtB;;;;;;;;;;;;;eAaG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC;YAEpB;;;;eAIG;YACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;SAC1B;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
@@ -3,28 +3,31 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.Contents = void 0;
5
5
  const resource_1 = require("../../core/resource.js");
6
- const headers_1 = require("../../internal/headers.js");
7
6
  const path_1 = require("../../internal/utils/path.js");
8
7
  /**
9
8
  * Search the web and retrieve content for selected results.
10
9
  */
11
10
  class Contents extends resource_1.APIResource {
12
11
  /**
13
- * Deferred result-content retrieval is reserved but not available in this release.
14
- * Requests return 404 until the retrieval implementation is shipped. X-Request-Id
15
- * identifies this request separately from the search resource.
12
+ * Retrieves selected results from a retained search. Provide exactly one of
13
+ * result_ids or limit; the latter fetches the top results. Content defaults to
14
+ * source:auto. Responses preserve result_ids order. Unknown result IDs are
15
+ * rejected before retrieval starts. Missing, expired, or inaccessible searches
16
+ * return 404. Once retrieval begins, return one outcome per selected result,
17
+ * including timeout entries for work unfinished at the overall deadline. Browser
18
+ * retrievals run sequentially in result order, so later results may time out when
19
+ * earlier pages are slow. X-Request-Id identifies this request separately from the
20
+ * search resource.
16
21
  *
17
22
  * @example
18
23
  * ```ts
19
- * await client.search.contents.fetch('srch_abc123');
24
+ * const response = await client.search.contents.fetch(
25
+ * 'srch_abc123',
26
+ * );
20
27
  * ```
21
28
  */
22
29
  fetch(id, body, options) {
23
- return this._client.post((0, path_1.path) `/search/${id}/contents`, {
24
- body,
25
- ...options,
26
- headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
27
- });
30
+ return this._client.post((0, path_1.path) `/search/${id}/contents`, { body, ...options });
28
31
  }
29
32
  }
30
33
  exports.Contents = Contents;
@@ -1 +1 @@
1
- {"version":3,"file":"contents.js","sourceRoot":"","sources":["../../src/resources/search/contents.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAGlD,uDAAsD;AAEtD,uDAAiD;AAEjD;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,WAAW,EAAE,WAAW,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAlBD,4BAkBC"}
1
+ {"version":3,"file":"contents.js","sourceRoot":"","sources":["../../src/resources/search/contents.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAIlD,uDAAiD;AAEjD;;GAEG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,WAAW,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF;AAtBD,4BAsBC"}
@@ -1,27 +1,30 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
  import { APIResource } from "../../core/resource.mjs";
3
- import { buildHeaders } from "../../internal/headers.mjs";
4
3
  import { path } from "../../internal/utils/path.mjs";
5
4
  /**
6
5
  * Search the web and retrieve content for selected results.
7
6
  */
8
7
  export class Contents extends APIResource {
9
8
  /**
10
- * Deferred result-content retrieval is reserved but not available in this release.
11
- * Requests return 404 until the retrieval implementation is shipped. X-Request-Id
12
- * identifies this request separately from the search resource.
9
+ * Retrieves selected results from a retained search. Provide exactly one of
10
+ * result_ids or limit; the latter fetches the top results. Content defaults to
11
+ * source:auto. Responses preserve result_ids order. Unknown result IDs are
12
+ * rejected before retrieval starts. Missing, expired, or inaccessible searches
13
+ * return 404. Once retrieval begins, return one outcome per selected result,
14
+ * including timeout entries for work unfinished at the overall deadline. Browser
15
+ * retrievals run sequentially in result order, so later results may time out when
16
+ * earlier pages are slow. X-Request-Id identifies this request separately from the
17
+ * search resource.
13
18
  *
14
19
  * @example
15
20
  * ```ts
16
- * await client.search.contents.fetch('srch_abc123');
21
+ * const response = await client.search.contents.fetch(
22
+ * 'srch_abc123',
23
+ * );
17
24
  * ```
18
25
  */
19
26
  fetch(id, body, options) {
20
- return this._client.post(path `/search/${id}/contents`, {
21
- body,
22
- ...options,
23
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
24
- });
27
+ return this._client.post(path `/search/${id}/contents`, { body, ...options });
25
28
  }
26
29
  }
27
30
  //# sourceMappingURL=contents.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"contents.mjs","sourceRoot":"","sources":["../../src/resources/search/contents.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAGlD,OAAO,EAAE,YAAY,EAAE,mCAA+B;AAEtD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,WAAW,EAAE,WAAW,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"contents.mjs","sourceRoot":"","sources":["../../src/resources/search/contents.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAIlD,OAAO,EAAE,IAAI,EAAE,sCAAkC;AAEjD;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QAClE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,WAAW,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACF"}
@@ -739,32 +739,33 @@ export interface Request {
739
739
  export declare namespace Request {
740
740
  interface SearchContentOptions {
741
741
  /**
742
- * Invalid with source=provider. Supplying browser_id requires source=browser so
743
- * the chosen identity is not bypassed.
742
+ * Requires source=auto or source=browser in deferred retrieval.
744
743
  */
745
744
  browser?: SearchContentOptions.Browser;
746
745
  format?: 'markdown' | 'text';
747
746
  /**
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.
747
+ * For source=auto, maximum acceptable age of retained provider content, measured
748
+ * from when the search received it from the provider. A value of 0 disables reuse
749
+ * of retained content, so every result is fetched through a browser.
750
+ * source=provider reuses retained provider content without freshness validation.
751
+ * source=browser always fetches through a browser and does not use this age limit.
754
752
  */
755
753
  max_age_hours?: number;
756
754
  /**
757
- * Per-result Unicode character limit after extraction.
755
+ * Per-result Unicode character limit after extraction. Retained provider content
756
+ * cannot exceed what was stored at search time; such results report truncated when
757
+ * the stored text was already truncated.
758
758
  */
759
759
  max_chars?: number;
760
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.
761
+ * auto uses retained provider content within max_age_hours; for deferred retrieval
762
+ * it falls back to a Kernel browser (caller-supplied or temporary) for results
763
+ * without it. Inline retrieval never uses a browser. provider reuses retained
764
+ * provider content when available, without freshness validation, and never
765
+ * provisions a browser. browser fetches each URL through a Kernel browser, either
766
+ * caller-supplied or temporary. No option makes a new provider request. Defaults
767
+ * to auto for both inline and deferred retrieval. Missing documents produce
768
+ * per-result unavailable outcomes, not request failures.
768
769
  */
769
770
  source?: 'auto' | 'provider' | 'browser';
770
771
  /**
@@ -775,17 +776,22 @@ export declare namespace Request {
775
776
  }
776
777
  namespace SearchContentOptions {
777
778
  /**
778
- * Invalid with source=provider. Supplying browser_id requires source=browser so
779
- * the chosen identity is not bypassed.
779
+ * Requires source=auto or source=browser in deferred retrieval.
780
780
  */
781
781
  interface Browser {
782
782
  /**
783
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.
784
+ * Reuses its cookies, proxy, and browser configuration; requests follow that
785
+ * browser's existing network access behavior, with no additional destination
786
+ * allowlist in this endpoint. Kernel does not delete a caller-supplied browser.
787
+ * Render mode uses a temporary tab; website activity may still change shared
788
+ * cookies and storage. When omitted and any result needs browser retrieval, Kernel
789
+ * creates one temporary browser for the request using the dashboard launch
790
+ * defaults (headful, stealth, default proxy), tags it with search_id, and deletes
791
+ * it when the request finishes. It is billed and counts toward browser concurrency
792
+ * like any other browser. A concurrency rejection returns 429 for source=browser;
793
+ * for source=auto, results with retained content are still returned and the rest
794
+ * report the rejection.
789
795
  */
790
796
  browser_id?: string;
791
797
  /**
@@ -852,7 +858,9 @@ export declare namespace Result {
852
858
  */
853
859
  status: 'ok' | 'unavailable' | 'blocked' | 'timeout' | 'unsupported_type' | 'extraction_failed' | 'error';
854
860
  /**
855
- * Kernel cache outcome. Provider-internal cache behavior may be unknown.
861
+ * Kernel content cache outcome. Kernel has no content cache yet: responses report
862
+ * bypass or unknown, and hit and miss are reserved. Provider-internal cache
863
+ * behavior may be unknown.
856
864
  */
857
865
  cache_status?: 'hit' | 'miss' | 'bypass' | 'unknown';
858
866
  /**
@@ -866,7 +874,7 @@ export declare namespace Result {
866
874
  */
867
875
  extractor_version?: string;
868
876
  /**
869
- * Origin retrieval time when known, not cache read time.
877
+ * When Kernel received the content from the provider.
870
878
  */
871
879
  fetched_at?: string | null;
872
880
  /**
@@ -879,7 +887,7 @@ export declare namespace Result {
879
887
  */
880
888
  http_status?: number;
881
889
  /**
882
- * Original retrieval method, including on cache hits.
890
+ * Original retrieval method.
883
891
  */
884
892
  method?: 'provider' | 'browser_curl' | 'browser_render';
885
893
  /**
@@ -1000,8 +1008,8 @@ export declare namespace Strategy {
1000
1008
  }
1001
1009
  export interface Usage {
1002
1010
  /**
1003
- * Number of result URLs for which a Kernel browser retrieval was attempted,
1004
- * excluding cache-only hits.
1011
+ * Number of result URLs for which a Kernel browser retrieval received a response
1012
+ * from the target, excluding cache-only hits.
1005
1013
  */
1006
1014
  content_fetches: number;
1007
1015
  /**
@@ -1121,32 +1129,33 @@ export interface SearchCreateParams {
1121
1129
  export declare namespace SearchCreateParams {
1122
1130
  interface SearchContentOptions {
1123
1131
  /**
1124
- * Invalid with source=provider. Supplying browser_id requires source=browser so
1125
- * the chosen identity is not bypassed.
1132
+ * Requires source=auto or source=browser in deferred retrieval.
1126
1133
  */
1127
1134
  browser?: SearchContentOptions.Browser;
1128
1135
  format?: 'markdown' | 'text';
1129
1136
  /**
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.
1137
+ * For source=auto, maximum acceptable age of retained provider content, measured
1138
+ * from when the search received it from the provider. A value of 0 disables reuse
1139
+ * of retained content, so every result is fetched through a browser.
1140
+ * source=provider reuses retained provider content without freshness validation.
1141
+ * source=browser always fetches through a browser and does not use this age limit.
1136
1142
  */
1137
1143
  max_age_hours?: number;
1138
1144
  /**
1139
- * Per-result Unicode character limit after extraction.
1145
+ * Per-result Unicode character limit after extraction. Retained provider content
1146
+ * cannot exceed what was stored at search time; such results report truncated when
1147
+ * the stored text was already truncated.
1140
1148
  */
1141
1149
  max_chars?: number;
1142
1150
  /**
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.
1151
+ * auto uses retained provider content within max_age_hours; for deferred retrieval
1152
+ * it falls back to a Kernel browser (caller-supplied or temporary) for results
1153
+ * without it. Inline retrieval never uses a browser. provider reuses retained
1154
+ * provider content when available, without freshness validation, and never
1155
+ * provisions a browser. browser fetches each URL through a Kernel browser, either
1156
+ * caller-supplied or temporary. No option makes a new provider request. Defaults
1157
+ * to auto for both inline and deferred retrieval. Missing documents produce
1158
+ * per-result unavailable outcomes, not request failures.
1150
1159
  */
1151
1160
  source?: 'auto' | 'provider' | 'browser';
1152
1161
  /**
@@ -1157,17 +1166,22 @@ export declare namespace SearchCreateParams {
1157
1166
  }
1158
1167
  namespace SearchContentOptions {
1159
1168
  /**
1160
- * Invalid with source=provider. Supplying browser_id requires source=browser so
1161
- * the chosen identity is not bypassed.
1169
+ * Requires source=auto or source=browser in deferred retrieval.
1162
1170
  */
1163
1171
  interface Browser {
1164
1172
  /**
1165
1173
  * 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.
1174
+ * Reuses its cookies, proxy, and browser configuration; requests follow that
1175
+ * browser's existing network access behavior, with no additional destination
1176
+ * allowlist in this endpoint. Kernel does not delete a caller-supplied browser.
1177
+ * Render mode uses a temporary tab; website activity may still change shared
1178
+ * cookies and storage. When omitted and any result needs browser retrieval, Kernel
1179
+ * creates one temporary browser for the request using the dashboard launch
1180
+ * defaults (headful, stealth, default proxy), tags it with search_id, and deletes
1181
+ * it when the request finishes. It is billed and counts toward browser concurrency
1182
+ * like any other browser. A concurrency rejection returns 429 for source=browser;
1183
+ * for source=auto, results with retained content are still returned and the rest
1184
+ * report the rejection.
1171
1185
  */
1172
1186
  browser_id?: string;
1173
1187
  /**