Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.133.0"
".": "0.134.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 175
configured_endpoints: 176
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.134.0](https://github.com/kernel/kernel-node-sdk/compare/v0.133.0...v0.134.0) (2026-10-28)


### Features

* Add mid-session browser profile saves ([2aef0a4](https://github.com/kernel/kernel-node-sdk/commit/2aef0a43a0e013b09b31f4527a6af3f3c84ac4c9))

## [0.133.0](https://github.com/kernel/kernel-node-sdk/compare/v0.132.0...v0.133.0) (2026-10-28)


Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Types:
- <code><a href="./src/resources/browsers/browsers.ts">BrowserUsage</a></code>
- <code><a href="./src/resources/browsers/browsers.ts">BrowserVideoMemory</a></code>
- <code><a href="./src/resources/browsers/browsers.ts">Profile</a></code>
- <code><a href="./src/resources/browsers/browsers.ts">SaveProfileRequest</a></code>
- <code><a href="./src/resources/browsers/browsers.ts">Tags</a></code>
- <code><a href="./src/resources/browsers/browsers.ts">VaultReference</a></code>
- <code><a href="./src/resources/browsers/browsers.ts">BrowserCreateResponse</a></code>
Expand All @@ -138,6 +139,7 @@ Methods:
- <code title="delete /browsers/{id_or_name}">client.browsers.<a href="./src/resources/browsers/browsers.ts">deleteByID</a>(idOrName) -> void</code>
- <code title="post /browsers/{id_or_name}/extensions">client.browsers.<a href="./src/resources/browsers/browsers.ts">loadExtensions</a>(idOrName, { ...params }) -> void</code>
- <code title="post /browsers/{id_or_name}/repl">client.browsers.<a href="./src/resources/browsers/browsers.ts">repl</a>(idOrName, { ...params }) -> BrowserReplResult</code>
- <code title="post /browsers/{id_or_name}/profiles">client.browsers.<a href="./src/resources/browsers/browsers.ts">saveProfile</a>(idOrName, { ...params }) -> Profile</code>

## Telemetry

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.133.0",
"version": "0.134.0",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@ import {
BrowserReplTextContent,
BrowserRetrieveParams,
BrowserRetrieveResponse,
BrowserSaveProfileParams,
BrowserUpdateParams,
BrowserUpdateResponse,
BrowserUsage,
BrowserVideoMemory,
Browsers,
Profile,
SaveProfileRequest,
Tags,
VaultReference,
} from './resources/browsers/browsers';
Expand Down Expand Up @@ -1248,6 +1250,7 @@ export declare namespace Kernel {
type BrowserUsage as BrowserUsage,
type BrowserVideoMemory as BrowserVideoMemory,
type Profile as Profile,
type SaveProfileRequest as SaveProfileRequest,
type Tags as Tags,
type VaultReference as VaultReference,
type BrowserCreateResponse as BrowserCreateResponse,
Expand All @@ -1263,6 +1266,7 @@ export declare namespace Kernel {
type BrowserCurlParams as BrowserCurlParams,
type BrowserLoadExtensionsParams as BrowserLoadExtensionsParams,
type BrowserReplParams as BrowserReplParams,
type BrowserSaveProfileParams as BrowserSaveProfileParams,
};

export {
Expand Down
76 changes: 76 additions & 0 deletions src/resources/browsers/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,51 @@ export class Browsers extends APIResource {
repl(idOrName: string, body: BrowserReplParams, options?: RequestOptions): APIPromise<BrowserReplResult> {
return this._client.post(path`/browsers/${idOrName}/repl`, { body, ...options });
}

/**
* Saves the running browser's current user-data state to an existing or new
* profile without ending the browser session.
*
* Saving restarts the browser. Active CDP and WebDriver connections are closed and
* must reconnect, and WebDriver clients must create a new session. Open tabs are
* restored, but pages reload and in-memory page state is lost. The browser is
* stopped only while its user data is copied; this request returns once the
* restarted browser accepts CDP connections again and the profile has been
* uploaded. Caches, Service Worker storage and Google Drive IndexedDB data are
* left out of the saved profile but kept in the running browser.
*
* This does not attach the destination profile to the browser or change its
* save_changes setting. Active browsers that already loaded the destination
* profile keep their in-memory state. Pools with refresh_on_profile_update enabled
* flush idle sessions and replenish them from the new snapshot; other browsers
* receive it the next time they load the profile. When saves made with this
* endpoint to the same profile overlap, the save that started most recently wins,
* even if an earlier one finishes later. The automatic save at the end of a
* session whose profile has save_changes enabled is ordered against these saves by
* when each finishes.
*
* A successful save restarts the browser's inactivity timeout (timeout_seconds). A
* failed save leaves it unchanged.
*
* Returns 409 when the browser is no longer active, when a pooled browser was
* released or reacquired after the request was made (browser_lease_changed), or
* when the browser is briefly unable to accept a save (browser_busy), in which
* case the request can be retried.
*
* @example
* ```ts
* const profile = await client.browsers.saveProfile(
* 'htzv5orfit78e1m2biiifpbv',
* );
* ```
*/
saveProfile(
idOrName: string,
body: BrowserSaveProfileParams,
options?: RequestOptions,
): APIPromise<Profile> {
return this._client.post(path`/browsers/${idOrName}/profiles`, { body, ...options });
}
}

export type BrowserListResponsesOffsetPagination = OffsetPagination<BrowserListResponse>;
Expand Down Expand Up @@ -818,6 +863,23 @@ export interface Profile {
updated_at?: string;
}

/**
* Destination profile for a snapshot of the running browser. Provide either id or
* name. An id must identify an existing profile. A name overwrites the matching
* profile in the browser's project, or creates it when no matching profile exists.
*/
export interface SaveProfileRequest {
/**
* Existing profile ID to overwrite.
*/
id?: string;

/**
* Profile name to overwrite or create.
*/
name?: string;
}

/**
* User-defined key-value tags.
*/
Expand Down Expand Up @@ -2174,6 +2236,18 @@ export interface BrowserReplParams {
timeout_sec?: number;
}

export interface BrowserSaveProfileParams {
/**
* Existing profile ID to overwrite.
*/
id?: string;

/**
* Profile name to overwrite or create.
*/
name?: string;
}

Browsers.Telemetry = TelemetryAPITelemetry;
Browsers.Replays = Replays;
Browsers.Fs = Fs;
Expand Down Expand Up @@ -2206,6 +2280,7 @@ export declare namespace Browsers {
type BrowserUsage as BrowserUsage,
type BrowserVideoMemory as BrowserVideoMemory,
type Profile as Profile,
type SaveProfileRequest as SaveProfileRequest,
type Tags as Tags,
type VaultReference as VaultReference,
type BrowserCreateResponse as BrowserCreateResponse,
Expand All @@ -2221,6 +2296,7 @@ export declare namespace Browsers {
type BrowserCurlParams as BrowserCurlParams,
type BrowserLoadExtensionsParams as BrowserLoadExtensionsParams,
type BrowserReplParams as BrowserReplParams,
type BrowserSaveProfileParams as BrowserSaveProfileParams,
};

export {
Expand Down
2 changes: 2 additions & 0 deletions src/resources/browsers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export {
type BrowserUsage,
type BrowserVideoMemory,
type Profile,
type SaveProfileRequest,
type Tags,
type VaultReference,
type BrowserCreateResponse,
Expand All @@ -37,6 +38,7 @@ export {
type BrowserCurlParams,
type BrowserLoadExtensionsParams,
type BrowserReplParams,
type BrowserSaveProfileParams,
type ProfilesOffsetPagination,
type BrowserListResponsesOffsetPagination,
} from './browsers';
Expand Down
2 changes: 2 additions & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export {
type BrowserUsage,
type BrowserVideoMemory,
type Profile,
type SaveProfileRequest,
type Tags,
type VaultReference,
type BrowserCreateResponse,
Expand All @@ -75,6 +76,7 @@ export {
type BrowserCurlParams,
type BrowserLoadExtensionsParams,
type BrowserReplParams,
type BrowserSaveProfileParams,
type ProfilesOffsetPagination,
type BrowserListResponsesOffsetPagination,
} from './browsers/browsers';
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.133.0'; // x-release-please-version
export const VERSION = '0.134.0'; // x-release-please-version
12 changes: 12 additions & 0 deletions tests/api-resources/browsers/browsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,16 @@ describe('resource browsers', () => {
timeout_sec: 1,
});
});

// Mock server tests are disabled
test.skip('saveProfile', async () => {
const responsePromise = client.browsers.saveProfile('htzv5orfit78e1m2biiifpbv', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
});
Loading