@onkernel/sdk 0.110.0 → 0.112.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 (153) hide show
  1. package/CHANGELOG.md +25 -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/browser-pools.d.mts +8 -1
  16. package/resources/browser-pools.d.mts.map +1 -1
  17. package/resources/browser-pools.d.ts +8 -1
  18. package/resources/browser-pools.d.ts.map +1 -1
  19. package/resources/browsers/browsers.d.mts +44 -3
  20. package/resources/browsers/browsers.d.mts.map +1 -1
  21. package/resources/browsers/browsers.d.ts +44 -3
  22. package/resources/browsers/browsers.d.ts.map +1 -1
  23. package/resources/browsers/browsers.js +2 -2
  24. package/resources/browsers/browsers.js.map +1 -1
  25. package/resources/browsers/browsers.mjs +2 -2
  26. package/resources/browsers/browsers.mjs.map +1 -1
  27. package/resources/browsers/index.d.mts +1 -1
  28. package/resources/browsers/index.d.mts.map +1 -1
  29. package/resources/browsers/index.d.ts +1 -1
  30. package/resources/browsers/index.d.ts.map +1 -1
  31. package/resources/browsers/index.js +2 -2
  32. package/resources/browsers/index.js.map +1 -1
  33. package/resources/browsers/index.mjs +1 -1
  34. package/resources/browsers/index.mjs.map +1 -1
  35. package/resources/browsers/telemetry.d.mts +34 -16
  36. package/resources/browsers/telemetry.d.mts.map +1 -1
  37. package/resources/browsers/telemetry.d.ts +34 -16
  38. package/resources/browsers/telemetry.d.ts.map +1 -1
  39. package/resources/browsers/telemetry.js +3 -2
  40. package/resources/browsers/telemetry.js.map +1 -1
  41. package/resources/browsers/telemetry.mjs +3 -2
  42. package/resources/browsers/telemetry.mjs.map +1 -1
  43. package/resources/browsers/webmcp/custom-tools.d.mts +118 -0
  44. package/resources/browsers/webmcp/custom-tools.d.mts.map +1 -0
  45. package/resources/browsers/webmcp/custom-tools.d.ts +118 -0
  46. package/resources/browsers/webmcp/custom-tools.d.ts.map +1 -0
  47. package/resources/browsers/webmcp/custom-tools.js +75 -0
  48. package/resources/browsers/webmcp/custom-tools.js.map +1 -0
  49. package/resources/browsers/webmcp/custom-tools.mjs +71 -0
  50. package/resources/browsers/webmcp/custom-tools.mjs.map +1 -0
  51. package/resources/browsers/webmcp/index.d.mts +3 -0
  52. package/resources/browsers/webmcp/index.d.mts.map +1 -0
  53. package/resources/browsers/webmcp/index.d.ts +3 -0
  54. package/resources/browsers/webmcp/index.d.ts.map +1 -0
  55. package/resources/browsers/webmcp/index.js +9 -0
  56. package/resources/browsers/webmcp/index.js.map +1 -0
  57. package/resources/browsers/webmcp/index.mjs +4 -0
  58. package/resources/browsers/webmcp/index.mjs.map +1 -0
  59. package/resources/browsers/webmcp/webmcp.d.mts +211 -0
  60. package/resources/browsers/webmcp/webmcp.d.mts.map +1 -0
  61. package/resources/browsers/webmcp/webmcp.d.ts +211 -0
  62. package/resources/browsers/webmcp/webmcp.d.ts.map +1 -0
  63. package/resources/browsers/webmcp/webmcp.js +66 -0
  64. package/resources/browsers/webmcp/webmcp.js.map +1 -0
  65. package/resources/browsers/webmcp/webmcp.mjs +61 -0
  66. package/resources/browsers/webmcp/webmcp.mjs.map +1 -0
  67. package/resources/browsers/webmcp.d.mts +1 -157
  68. package/resources/browsers/webmcp.d.mts.map +1 -1
  69. package/resources/browsers/webmcp.d.ts +1 -157
  70. package/resources/browsers/webmcp.d.ts.map +1 -1
  71. package/resources/browsers/webmcp.js +2 -51
  72. package/resources/browsers/webmcp.js.map +1 -1
  73. package/resources/browsers/webmcp.mjs +1 -49
  74. package/resources/browsers/webmcp.mjs.map +1 -1
  75. package/resources/index.d.mts +1 -0
  76. package/resources/index.d.mts.map +1 -1
  77. package/resources/index.d.ts +1 -0
  78. package/resources/index.d.ts.map +1 -1
  79. package/resources/index.js +3 -1
  80. package/resources/index.js.map +1 -1
  81. package/resources/index.mjs +1 -0
  82. package/resources/index.mjs.map +1 -1
  83. package/resources/organization/entitlements.d.mts +15 -0
  84. package/resources/organization/entitlements.d.mts.map +1 -1
  85. package/resources/organization/entitlements.d.ts +15 -0
  86. package/resources/organization/entitlements.d.ts.map +1 -1
  87. package/resources/search/contents.d.mts +267 -0
  88. package/resources/search/contents.d.mts.map +1 -0
  89. package/resources/search/contents.d.ts +267 -0
  90. package/resources/search/contents.d.ts.map +1 -0
  91. package/resources/search/contents.js +31 -0
  92. package/resources/search/contents.js.map +1 -0
  93. package/resources/search/contents.mjs +27 -0
  94. package/resources/search/contents.mjs.map +1 -0
  95. package/resources/search/index.d.mts +4 -0
  96. package/resources/search/index.d.mts.map +1 -0
  97. package/resources/search/index.d.ts +4 -0
  98. package/resources/search/index.d.ts.map +1 -0
  99. package/resources/search/index.js +11 -0
  100. package/resources/search/index.js.map +1 -0
  101. package/resources/search/index.mjs +5 -0
  102. package/resources/search/index.mjs.map +1 -0
  103. package/resources/search/providers.d.mts +141 -0
  104. package/resources/search/providers.d.mts.map +1 -0
  105. package/resources/search/providers.d.ts +141 -0
  106. package/resources/search/providers.d.ts.map +1 -0
  107. package/resources/search/providers.js +25 -0
  108. package/resources/search/providers.js.map +1 -0
  109. package/resources/search/providers.mjs +21 -0
  110. package/resources/search/providers.mjs.map +1 -0
  111. package/resources/search/search.d.mts +1187 -0
  112. package/resources/search/search.d.mts.map +1 -0
  113. package/resources/search/search.d.ts +1187 -0
  114. package/resources/search/search.d.ts.map +1 -0
  115. package/resources/search/search.js +58 -0
  116. package/resources/search/search.js.map +1 -0
  117. package/resources/search/search.mjs +53 -0
  118. package/resources/search/search.mjs.map +1 -0
  119. package/resources/search.d.mts +2 -0
  120. package/resources/search.d.mts.map +1 -0
  121. package/resources/search.d.ts +2 -0
  122. package/resources/search.d.ts.map +1 -0
  123. package/resources/search.js +6 -0
  124. package/resources/search.js.map +1 -0
  125. package/resources/search.mjs +3 -0
  126. package/resources/search.mjs.map +1 -0
  127. package/resources/vaults/items.d.mts +21 -14
  128. package/resources/vaults/items.d.mts.map +1 -1
  129. package/resources/vaults/items.d.ts +21 -14
  130. package/resources/vaults/items.d.ts.map +1 -1
  131. package/src/client.ts +30 -0
  132. package/src/resources/auth/connections.ts +28 -7
  133. package/src/resources/browser-pools.ts +9 -1
  134. package/src/resources/browsers/browsers.ts +65 -13
  135. package/src/resources/browsers/index.ts +4 -1
  136. package/src/resources/browsers/telemetry.ts +68 -16
  137. package/src/resources/browsers/webmcp/custom-tools.ts +160 -0
  138. package/src/resources/browsers/webmcp/index.ts +26 -0
  139. package/src/resources/browsers/webmcp/webmcp.ts +295 -0
  140. package/src/resources/browsers/webmcp.ts +1 -204
  141. package/src/resources/index.ts +12 -0
  142. package/src/resources/organization/entitlements.ts +17 -0
  143. package/src/resources/search/contents.ts +327 -0
  144. package/src/resources/search/index.ts +16 -0
  145. package/src/resources/search/providers.ts +197 -0
  146. package/src/resources/search/search.ts +1496 -0
  147. package/src/resources/search.ts +3 -0
  148. package/src/resources/vaults/items.ts +27 -14
  149. package/src/version.ts +1 -1
  150. package/version.d.mts +1 -1
  151. package/version.d.ts +1 -1
  152. package/version.js +1 -1
  153. package/version.mjs +1 -1
package/src/client.ts CHANGED
@@ -216,6 +216,18 @@ import {
216
216
  ProjectsOffsetPagination,
217
217
  UpdateProjectRequest,
218
218
  } from './resources/projects/projects';
219
+ import {
220
+ Attempt,
221
+ ProviderTarget,
222
+ Request,
223
+ Result,
224
+ Search,
225
+ SearchCreateParams,
226
+ SearchResource,
227
+ Strategy,
228
+ Usage,
229
+ Warning,
230
+ } from './resources/search/search';
219
231
  import { Telemetry } from './resources/telemetry/telemetry';
220
232
  import {
221
233
  Vault,
@@ -1104,6 +1116,10 @@ export class Kernel {
1104
1116
  * Configure external credential providers like 1Password.
1105
1117
  */
1106
1118
  credentialProviders: API.CredentialProviders = new API.CredentialProviders(this);
1119
+ /**
1120
+ * Search the web and retrieve content for selected results.
1121
+ */
1122
+ search: API.SearchResource = new API.SearchResource(this);
1107
1123
  }
1108
1124
 
1109
1125
  Kernel.Deployments = Deployments;
@@ -1125,6 +1141,7 @@ Kernel.Organization = Organization;
1125
1141
  Kernel.AuditLogs = AuditLogs;
1126
1142
  Kernel.APIKeys = APIKeys;
1127
1143
  Kernel.CredentialProviders = CredentialProviders;
1144
+ Kernel.SearchResource = SearchResource;
1128
1145
 
1129
1146
  export declare namespace Kernel {
1130
1147
  export type RequestOptions = Opts.RequestOptions;
@@ -1358,6 +1375,19 @@ export declare namespace Kernel {
1358
1375
  type CredentialProviderListParams as CredentialProviderListParams,
1359
1376
  };
1360
1377
 
1378
+ export {
1379
+ SearchResource as SearchResource,
1380
+ type Attempt as Attempt,
1381
+ type ProviderTarget as ProviderTarget,
1382
+ type Request as Request,
1383
+ type Result as Result,
1384
+ type Search as Search,
1385
+ type Strategy as Strategy,
1386
+ type Usage as Usage,
1387
+ type Warning as Warning,
1388
+ type SearchCreateParams as SearchCreateParams,
1389
+ };
1390
+
1361
1391
  export type AppAction = API.AppAction;
1362
1392
  export type BrowserExtension = API.BrowserExtension;
1363
1393
  export type BrowserProfile = API.BrowserProfile;
@@ -314,16 +314,18 @@ export interface ManagedAuth {
314
314
  browser_telemetry?: ManagedAuth.BrowserTelemetry | null;
315
315
 
316
316
  /**
317
- * Whether Kernel can automatically re-authenticate this connection when the
318
- * session expires. Requires a prior successful login plus either a Kernel
319
- * credential or an external credential reference. See `can_reauth_reason` for the
320
- * specific outcome.
317
+ * Whether this connection's stored requirements are eligible for unattended
318
+ * re-authentication. A true value can represent either fully satisfiable
319
+ * requirements or a best-effort attempt. It does not account for whether automatic
320
+ * re-authentication is enabled or parent workflow state such as an active flow or
321
+ * circuit-breaker cooldown, so it does not guarantee an attempt on the next health
322
+ * check. See `can_reauth_reason` for the specific outcome.
321
323
  */
322
324
  can_reauth?: boolean;
323
325
 
324
326
  /**
325
327
  * Machine-readable reason for the current value of `can_reauth`. Affirmative
326
- * values (re-auth is possible):
328
+ * values (requirements are eligible for unattended re-authentication):
327
329
  *
328
330
  * - `external_credential` — an external credential provider is attached
329
331
  * - `cua_has_credential` — CUA flow with a stored credential
@@ -332,8 +334,12 @@ export interface ManagedAuth {
332
334
  * - `viable_plans_found` — at least one stored login plan can be replayed
333
335
  * - `no_requirements_recorded` — no recorded credential requirements to fail
334
336
  * against
335
- * - `totp_reauth_allowed` — TOTP is the only recorded requirement and is safe to
336
- * attempt automatically
337
+ * - `totp_reauth_allowed` — TOTP is the only recorded requirement and a stored
338
+ * secret can generate the code
339
+ * - `optimistic_totp_attempt` — TOTP was previously required but no reusable
340
+ * secret is stored; the connection remains eligible for a
341
+ * circuit-breaker-bounded attempt because the site may not challenge returning
342
+ * sessions
337
343
  * - `requirements_satisfiable` — recorded requirements contain no recognized
338
344
  * blocker
339
345
  *
@@ -363,6 +369,7 @@ export interface ManagedAuth {
363
369
  | 'viable_plans_found'
364
370
  | 'no_requirements_recorded'
365
371
  | 'totp_reauth_allowed'
372
+ | 'optimistic_totp_attempt'
366
373
  | 'requirements_satisfiable'
367
374
  | 'no_prior_successful_login'
368
375
  | 'no_credential'
@@ -1298,6 +1305,13 @@ export interface ManagedAuthTimelineEvent {
1298
1305
  */
1299
1306
  browser_session_id?: string;
1300
1307
 
1308
+ /**
1309
+ * When the login/reauth attempt first reached a terminal status. Stable across
1310
+ * retries and subsequent cleanup writes. Absent for in-progress attempts, health
1311
+ * checks, and historical attempts without a recorded completion time.
1312
+ */
1313
+ completed_at?: string;
1314
+
1301
1315
  /**
1302
1316
  * Machine-readable error code. Present when a login/reauth event failed.
1303
1317
  */
@@ -2478,6 +2492,13 @@ export interface ConnectionLoginParams {
2478
2492
  * When omitted, the connection's record_session default is used.
2479
2493
  */
2480
2494
  record_session?: boolean;
2495
+
2496
+ /**
2497
+ * Controls whether this login reads and writes learned domain skills. Automatic
2498
+ * reauths inherit the selected mode until a later accepted login sets enabled or
2499
+ * omits this field. Defaults to enabled when omitted.
2500
+ */
2501
+ skill_mode?: 'enabled' | 'disabled';
2481
2502
  }
2482
2503
 
2483
2504
  export namespace ConnectionLoginParams {
@@ -1066,6 +1066,13 @@ export interface BrowserPoolAcquireParams {
1066
1066
  */
1067
1067
  name?: string;
1068
1068
 
1069
+ /**
1070
+ * Profile selection for the browser session. Provide either id or name. If
1071
+ * specified, the matching profile will be loaded into the browser session.
1072
+ * Profiles must be created beforehand.
1073
+ */
1074
+ profile?: Shared.BrowserProfile;
1075
+
1069
1076
  /**
1070
1077
  * Optional URL to navigate the acquired browser to. Overrides the pool's start_url
1071
1078
  * for this acquire only. Best-effort: failures to navigate do not fail the
@@ -1200,7 +1207,8 @@ export interface BrowserPoolReleaseParams {
1200
1207
  * Defaults to true. A reused browser keeps the configuration it was created with,
1201
1208
  * so it does not pick up pool configuration changes made while it was in use.
1202
1209
  * Release with `reuse: false`, or flush the pool afterward, to rebuild it with the
1203
- * current configuration.
1210
+ * current configuration. Browsers loaded with an acquire-time profile are always
1211
+ * destroyed and replaced, even when reuse is true.
1204
1212
  */
1205
1213
  reuse?: boolean;
1206
1214
  }
@@ -109,19 +109,6 @@ import {
109
109
  TelemetryStreamParams,
110
110
  TelemetryStreamResponse,
111
111
  } from './telemetry';
112
- import * as WebmcpAPI from './webmcp';
113
- import {
114
- InvocationFailure,
115
- InvocationResult,
116
- InvokeRequest,
117
- Tool,
118
- ToolAnnotations,
119
- ToolFrame,
120
- ToolSource,
121
- ToolsResponse,
122
- Webmcp,
123
- WebmcpInvokeToolParams,
124
- } from './webmcp';
125
112
  import * as FsAPI from './fs/fs';
126
113
  import {
127
114
  FCreateDirectoryParams,
@@ -140,6 +127,22 @@ import {
140
127
  FWriteFileParams,
141
128
  Fs,
142
129
  } from './fs/fs';
130
+ import * as WebmcpAPI from './webmcp/webmcp';
131
+ import {
132
+ CustomToolSource,
133
+ InvocationFailure,
134
+ InvocationResult,
135
+ InvokeRequest,
136
+ Tool,
137
+ ToolAnnotations,
138
+ ToolFrame,
139
+ ToolMetadata,
140
+ ToolSource,
141
+ ToolsResponse,
142
+ Webmcp,
143
+ WebmcpInvokeToolParams,
144
+ WebmcpListToolsParams,
145
+ } from './webmcp/webmcp';
143
146
  import { APIPromise } from '../../core/api-promise';
144
147
  import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../core/pagination';
145
148
  import { type Uploadable } from '../../core/uploads';
@@ -375,6 +378,52 @@ export interface BrowserNetworkConfig {
375
378
  * upstream-proxy and Kernel-managed direct egress and cannot reach into a VPN.
376
379
  */
377
380
  private_hosts?: Array<string>;
381
+
382
+ /**
383
+ * Per-destination proxy routes for a browser session. After setup, a destination
384
+ * hostname is matched against every route's hosts, regardless of port; route order
385
+ * does not matter. An exact hostname beats a wildcard, and a longer wildcard
386
+ * suffix beats a shorter one (for a.b.example.com: "a.b.example.com" >
387
+ * "_.b.example.com" > "_.example.com"). A host pattern may appear in only one
388
+ * route. "\*.example.com" matches subdomains only, not example.com. A matched
389
+ * request selects the route's proxy instead of the session's top-level proxy
390
+ * (including mode: direct); the route proxy's own bypass_hosts still apply. If the
391
+ * route proxy becomes unavailable, matched requests fail closed without falling
392
+ * back. Requests that match no route use the session's default egress from the
393
+ * top-level proxy field (or the browser default when proxy is omitted: stealth
394
+ * proxy or direct egress). Routes take effect once the session is created;
395
+ * start_url and other traffic during browser setup use the top-level proxy.
396
+ * Setting routes requires proxy v3. Not supported on browser pools.
397
+ */
398
+ proxy_routes?: Array<BrowserNetworkConfig.ProxyRoute>;
399
+ }
400
+
401
+ export namespace BrowserNetworkConfig {
402
+ export interface ProxyRoute {
403
+ /**
404
+ * Exact hostnames or leading \*. wildcard patterns (subdomains only); patterns
405
+ * cannot include ports, and matching ignores the destination port. Hosts not
406
+ * matched by any route use the session's top-level proxy (or the browser default
407
+ * when proxy is omitted).
408
+ */
409
+ hosts: Array<string>;
410
+
411
+ /**
412
+ * Select an active non-direct proxy by ID or name. Responses always use ID.
413
+ */
414
+ proxy: ProxyRoute.Proxy;
415
+ }
416
+
417
+ export namespace ProxyRoute {
418
+ /**
419
+ * Select an active non-direct proxy by ID or name. Responses always use ID.
420
+ */
421
+ export interface Proxy {
422
+ id?: string;
423
+
424
+ name?: string;
425
+ }
426
+ }
378
427
  }
379
428
 
380
429
  /**
@@ -2019,14 +2068,17 @@ export declare namespace Browsers {
2019
2068
 
2020
2069
  export {
2021
2070
  Webmcp as Webmcp,
2071
+ type CustomToolSource as CustomToolSource,
2022
2072
  type InvocationFailure as InvocationFailure,
2023
2073
  type InvocationResult as InvocationResult,
2024
2074
  type InvokeRequest as InvokeRequest,
2025
2075
  type Tool as Tool,
2026
2076
  type ToolAnnotations as ToolAnnotations,
2027
2077
  type ToolFrame as ToolFrame,
2078
+ type ToolMetadata as ToolMetadata,
2028
2079
  type ToolSource as ToolSource,
2029
2080
  type ToolsResponse as ToolsResponse,
2030
2081
  type WebmcpInvokeToolParams as WebmcpInvokeToolParams,
2082
+ type WebmcpListToolsParams as WebmcpListToolsParams,
2031
2083
  };
2032
2084
  }
@@ -152,13 +152,16 @@ export {
152
152
  } from './telemetry';
153
153
  export {
154
154
  Webmcp,
155
+ type CustomToolSource,
155
156
  type InvocationFailure,
156
157
  type InvocationResult,
157
158
  type InvokeRequest,
158
159
  type Tool,
159
160
  type ToolAnnotations,
160
161
  type ToolFrame,
162
+ type ToolMetadata,
161
163
  type ToolSource,
162
164
  type ToolsResponse,
163
165
  type WebmcpInvokeToolParams,
164
- } from './webmcp';
166
+ type WebmcpListToolsParams,
167
+ } from './webmcp/index';
@@ -16,8 +16,9 @@ export class Telemetry extends APIResource {
16
16
  /**
17
17
  * Reads a page of telemetry events for the browser session. To page through
18
18
  * results, pass the X-Next-Offset value from the previous response as offset and
19
- * repeat while X-Has-More is true. Returns an empty list when telemetry data is
20
- * unavailable.
19
+ * repeat while X-Has-More is true. The category and type filters apply within each
20
+ * page, so a filtered page may be empty while X-Has-More is true. Returns an empty
21
+ * list when telemetry data is unavailable.
21
22
  *
22
23
  * @example
23
24
  * ```ts
@@ -2979,7 +2980,14 @@ export interface BrowserEventContext {
2979
2980
  /**
2980
2981
  * CDP target type of the page that produced the event.
2981
2982
  */
2982
- target_type?: 'page' | 'background_page' | 'service_worker' | 'shared_worker' | 'other';
2983
+ target_type?:
2984
+ | 'page'
2985
+ | 'iframe'
2986
+ | 'worker'
2987
+ | 'background_page'
2988
+ | 'service_worker'
2989
+ | 'shared_worker'
2990
+ | 'other';
2983
2991
 
2984
2992
  /**
2985
2993
  * URL relevant to this event — page URL for navigation and page events, request
@@ -3283,8 +3291,12 @@ export namespace BrowserLiveViewDisconnectEvent {
3283
3291
 
3284
3292
  /**
3285
3293
  * The CDP connection to Chrome was lost. Telemetry events may be dropped until
3286
- * monitor_reconnected arrives. Treat any in-progress computed state (network_idle,
3287
- * page_layout_settled) as unreliable until then.
3294
+ * monitor_reconnected arrives. In-progress computed state is discarded rather than
3295
+ * paused, so computed events still pending for the current navigation
3296
+ * (network_idle, page_layout_settled, page_navigation_settled) never fire.
3297
+ * monitor_reconnected does not restore them. After reattachment a fresh state
3298
+ * machine starts, so computed events can resume before the next navigation and
3299
+ * carry empty navigation context until one occurs.
3288
3300
  */
3289
3301
  export interface BrowserMonitorDisconnectedEvent {
3290
3302
  category: 'monitor';
@@ -3769,7 +3781,14 @@ export namespace BrowserPageCrashedEvent {
3769
3781
  /**
3770
3782
  * CDP target type of the page that produced the event.
3771
3783
  */
3772
- target_type: 'page' | 'background_page' | 'service_worker' | 'shared_worker' | 'other';
3784
+ target_type:
3785
+ | 'page'
3786
+ | 'iframe'
3787
+ | 'worker'
3788
+ | 'background_page'
3789
+ | 'service_worker'
3790
+ | 'shared_worker'
3791
+ | 'other';
3773
3792
 
3774
3793
  /**
3775
3794
  * URL the page was on when its renderer process crashed.
@@ -4135,7 +4154,14 @@ export namespace BrowserPageNavigationEvent {
4135
4154
  /**
4136
4155
  * CDP target type of the page that produced the event.
4137
4156
  */
4138
- target_type?: 'page' | 'background_page' | 'service_worker' | 'shared_worker' | 'other';
4157
+ target_type?:
4158
+ | 'page'
4159
+ | 'iframe'
4160
+ | 'worker'
4161
+ | 'background_page'
4162
+ | 'service_worker'
4163
+ | 'shared_worker'
4164
+ | 'other';
4139
4165
 
4140
4166
  /**
4141
4167
  * URL navigated to.
@@ -4222,7 +4248,14 @@ export namespace BrowserPageTabOpenedEvent {
4222
4248
  /**
4223
4249
  * CDP target type of the page that produced the event.
4224
4250
  */
4225
- target_type?: 'page' | 'background_page' | 'service_worker' | 'shared_worker' | 'other';
4251
+ target_type?:
4252
+ | 'page'
4253
+ | 'iframe'
4254
+ | 'worker'
4255
+ | 'background_page'
4256
+ | 'service_worker'
4257
+ | 'shared_worker'
4258
+ | 'other';
4226
4259
 
4227
4260
  /**
4228
4261
  * Initial page title of the new tab.
@@ -4337,21 +4370,27 @@ export namespace BrowserProxyErrorEvent {
4337
4370
  /**
4338
4371
  * Proxy-layer error code: the X-Kernel-Proxy-Error response header value from a
4339
4372
  * branded 5xx error page served by the metro egress host-proxy. Values mirror what
4340
- * the proxy emits: destination_blocked, provider_blacklisted,
4341
- * provider_unreachable, provider_rejected, origin_tls_timeout, proxy_unavailable,
4342
- * upstream_timeout, upstream_dns_failure, upstream_connect_failed. Unknown header
4343
- * values are dropped.
4373
+ * the proxy emits: destination_blocked, destination_route_unavailable,
4374
+ * provider_blacklisted, provider_unreachable, provider_rejected,
4375
+ * origin_tls_timeout, origin_response_incomplete, proxy_unavailable,
4376
+ * restricted_route_unavailable, upstream_timeout, upstream_dns_failure,
4377
+ * upstream_connect_failed. A header value the browser image does not recognize is
4378
+ * reported as unknown, with the header value in raw_code.
4344
4379
  */
4345
4380
  code:
4346
4381
  | 'destination_blocked'
4382
+ | 'destination_route_unavailable'
4347
4383
  | 'provider_blacklisted'
4348
4384
  | 'provider_unreachable'
4349
4385
  | 'provider_rejected'
4350
4386
  | 'origin_tls_timeout'
4387
+ | 'origin_response_incomplete'
4351
4388
  | 'proxy_unavailable'
4389
+ | 'restricted_route_unavailable'
4352
4390
  | 'upstream_timeout'
4353
4391
  | 'upstream_dns_failure'
4354
- | 'upstream_connect_failed';
4392
+ | 'upstream_connect_failed'
4393
+ | 'unknown';
4355
4394
 
4356
4395
  /**
4357
4396
  * CDP request identifier matching the originating request.
@@ -4368,6 +4407,14 @@ export namespace BrowserProxyErrorEvent {
4368
4407
  */
4369
4408
  method?: string;
4370
4409
 
4410
+ /**
4411
+ * Sanitized X-Kernel-Proxy-Error header value, present only when code is unknown.
4412
+ * Surrounding whitespace is removed, the value is lowercased, characters outside
4413
+ * [a-z0-9_] are replaced with \_, and the result is truncated to at most 64
4414
+ * characters.
4415
+ */
4416
+ raw_code?: string;
4417
+
4371
4418
  /**
4372
4419
  * CDP Network.ResourceType for the request, when known.
4373
4420
  */
@@ -4817,9 +4864,7 @@ export interface TelemetryEventsParams extends OffsetPaginationParams {
4817
4864
  * Read direction. asc (default) reads oldest first, starting from since or the
4818
4865
  * offset cursor. desc reads newest first: each request returns one page of up to
4819
4866
  * limit records ending at the offset cursor (or until, or the newest archived
4820
- * event); combining desc with since is rejected with a 400. In either direction
4821
- * the category filter applies within the page, so a filtered page may be empty
4822
- * while X-Has-More is true.
4867
+ * event); combining desc with since is rejected with a 400.
4823
4868
  */
4824
4869
  order?: string;
4825
4870
 
@@ -4829,6 +4874,13 @@ export interface TelemetryEventsParams extends OffsetPaginationParams {
4829
4874
  */
4830
4875
  since?: string;
4831
4876
 
4877
+ /**
4878
+ * Restrict results to these event types, such as page_crashed or
4879
+ * captcha_challenge_result. Repeat the parameter for multiple values. Combines
4880
+ * with category: when both are set an event must match both.
4881
+ */
4882
+ type?: Array<string>;
4883
+
4832
4884
  /**
4833
4885
  * End of the window (exclusive): an RFC-3339 timestamp, or a duration like 5m
4834
4886
  * meaning that long ago.
@@ -0,0 +1,160 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as WebmcpAPI from './webmcp';
5
+ import { APIPromise } from '../../../core/api-promise';
6
+ import { buildHeaders } from '../../../internal/headers';
7
+ import { RequestOptions } from '../../../internal/request-options';
8
+ import { path } from '../../../internal/utils/path';
9
+
10
+ /**
11
+ * Discover and invoke native page tools across the browser instance.
12
+ */
13
+ export class CustomTools extends APIResource {
14
+ /**
15
+ * Returns every registered custom tool with its generated ID, namespace, matcher,
16
+ * and MCP tool metadata.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const customToolsResponse =
21
+ * await client.browsers.webmcp.customTools.list(
22
+ * 'id_or_name',
23
+ * );
24
+ * ```
25
+ */
26
+ list(idOrName: string, options?: RequestOptions): APIPromise<CustomToolsResponse> {
27
+ return this._client.get(path`/browsers/${idOrName}/webmcp/custom-tools`, options);
28
+ }
29
+
30
+ /**
31
+ * Add a namespaced batch of custom tools. A custom tool can be page-backed or
32
+ * CDP-backed. Page-backed tools execute in the page via JavaScript. CDP-backed
33
+ * tools execute via CDP and can use all browser REPL tools (see `/repl`). The
34
+ * source must evaluate to a non-empty array of definitions with URL matchers, tool
35
+ * metadata (including an optional output schema), and execute functions. The batch
36
+ * is added atomically. Matchers apply to top-level documents and nested frames,
37
+ * including out-of-process iframes; each matching tool is exposed once on the
38
+ * tab's top-level document and appears in the WebMCP tool snapshot.
39
+ *
40
+ * To update one tool, list the tools, delete its ID, and add its replacement. Set
41
+ * force_overwrite_namespace to replace every existing tool in the namespace
42
+ * atomically; omitted or false adds tools without replacing existing ones.
43
+ * Existing invocations continue.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const customToolsResponse =
48
+ * await client.browsers.webmcp.customTools.add(
49
+ * 'id_or_name',
50
+ * { namespace: 'namespace', source: 'source' },
51
+ * );
52
+ * ```
53
+ */
54
+ add(
55
+ idOrName: string,
56
+ body: CustomToolAddParams,
57
+ options?: RequestOptions,
58
+ ): APIPromise<CustomToolsResponse> {
59
+ return this._client.post(path`/browsers/${idOrName}/webmcp/custom-tools`, { body, ...options });
60
+ }
61
+
62
+ /**
63
+ * Removes one custom tool by generated ID. An invocation already in progress is
64
+ * not canceled.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * await client.browsers.webmcp.customTools.remove(
69
+ * 'ct_n10b9798ad53ecc4y69z31e1',
70
+ * { id_or_name: 'id_or_name' },
71
+ * );
72
+ * ```
73
+ */
74
+ remove(id: string, params: CustomToolRemoveParams, options?: RequestOptions): APIPromise<void> {
75
+ const { id_or_name } = params;
76
+ return this._client.delete(path`/browsers/${id_or_name}/webmcp/custom-tools/${id}`, {
77
+ ...options,
78
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
79
+ });
80
+ }
81
+ }
82
+
83
+ export interface AddRequest {
84
+ namespace: string;
85
+
86
+ /**
87
+ * JavaScript expression that evaluates to a non-empty array of custom tool
88
+ * definitions. Limited to 8,000,000 bytes when UTF-8 encoded, so multi-byte
89
+ * characters reduce the allowed character count.
90
+ */
91
+ source: string;
92
+
93
+ /**
94
+ * Atomically replace all existing tools in this namespace with this batch when
95
+ * true.
96
+ */
97
+ force_overwrite_namespace?: boolean;
98
+ }
99
+
100
+ export interface CustomToolsResponse {
101
+ tools: Array<Definition>;
102
+ }
103
+
104
+ export interface Definition {
105
+ id: string;
106
+
107
+ kind: string;
108
+
109
+ match: Match;
110
+
111
+ namespace: string;
112
+
113
+ /**
114
+ * Tool metadata follows the
115
+ * [MCP Tool definition](https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool)
116
+ * and the
117
+ * [WebMCP RegisteredTool definition](https://webmachinelearning.github.io/webmcp/#dictdef-registeredtool).
118
+ * outputSchema is optional for page and custom tools.
119
+ */
120
+ tool: WebmcpAPI.ToolMetadata;
121
+ }
122
+
123
+ export interface Match {
124
+ url_patterns: Array<string>;
125
+ }
126
+
127
+ export interface CustomToolAddParams {
128
+ namespace: string;
129
+
130
+ /**
131
+ * JavaScript expression that evaluates to a non-empty array of custom tool
132
+ * definitions. Limited to 8,000,000 bytes when UTF-8 encoded, so multi-byte
133
+ * characters reduce the allowed character count.
134
+ */
135
+ source: string;
136
+
137
+ /**
138
+ * Atomically replace all existing tools in this namespace with this batch when
139
+ * true.
140
+ */
141
+ force_overwrite_namespace?: boolean;
142
+ }
143
+
144
+ export interface CustomToolRemoveParams {
145
+ /**
146
+ * Browser session ID or name
147
+ */
148
+ id_or_name: string;
149
+ }
150
+
151
+ export declare namespace CustomTools {
152
+ export {
153
+ type AddRequest as AddRequest,
154
+ type CustomToolsResponse as CustomToolsResponse,
155
+ type Definition as Definition,
156
+ type Match as Match,
157
+ type CustomToolAddParams as CustomToolAddParams,
158
+ type CustomToolRemoveParams as CustomToolRemoveParams,
159
+ };
160
+ }
@@ -0,0 +1,26 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ CustomTools,
5
+ type AddRequest,
6
+ type CustomToolsResponse,
7
+ type Definition,
8
+ type Match,
9
+ type CustomToolAddParams,
10
+ type CustomToolRemoveParams,
11
+ } from './custom-tools';
12
+ export {
13
+ Webmcp,
14
+ type CustomToolSource,
15
+ type InvocationFailure,
16
+ type InvocationResult,
17
+ type InvokeRequest,
18
+ type Tool,
19
+ type ToolAnnotations,
20
+ type ToolFrame,
21
+ type ToolMetadata,
22
+ type ToolSource,
23
+ type ToolsResponse,
24
+ type WebmcpInvokeToolParams,
25
+ type WebmcpListToolsParams,
26
+ } from './webmcp';