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.4.0"
".": "0.5.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml
openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6
config_hash: b3fcacd707da56b21d31ce0baf4fb87d
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-4502c65bef0843a6ae96d23bba075433af6bab49b55b544b1522f63e7881c00c.yml
openapi_spec_hash: 3e67b77bbc8cd6155b8f66f3271f2643
config_hash: c6bab7ac8da570a5abbcfb19db119b6b
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.5.0 (2025-06-04)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/onkernel/kernel-node-sdk/compare/v0.4.0...v0.5.0)

### Features

* **api:** update via SDK Studio ([8622a14](https://github.com/onkernel/kernel-node-sdk/commit/8622a147a7919f2edd3aa41dfa3ab0a89a7146c8))
* **api:** update via SDK Studio ([285e2b1](https://github.com/onkernel/kernel-node-sdk/commit/285e2b18ef1458eee08daa75e26ac65884cbac92))


### Bug Fixes

* compat with more runtimes ([9862639](https://github.com/onkernel/kernel-node-sdk/commit/98626394921ac1b3ec0b91d4800d0070e90373aa))


### Chores

* adjust eslint.config.mjs ignore pattern ([8e7e28a](https://github.com/onkernel/kernel-node-sdk/commit/8e7e28aac90753040d3eb24320c6a758266d4391))
* **deps:** bump eslint-plugin-prettier ([d3c4417](https://github.com/onkernel/kernel-node-sdk/commit/d3c4417538150b91be13854d837938113ce6a09f))
* **docs:** use top-level-await in example snippets ([ac334e0](https://github.com/onkernel/kernel-node-sdk/commit/ac334e0fb49f98a15e1318c6754838ae17b036d9))
* **internal:** codegen related update ([1d16505](https://github.com/onkernel/kernel-node-sdk/commit/1d16505b24c6ee4236cf982ac710bb351006b955))
* **internal:** fix readablestream types in node 20 ([77cdbc2](https://github.com/onkernel/kernel-node-sdk/commit/77cdbc227d624567aa460e3659bdb30678548a26))
* **internal:** update jest config ([3248860](https://github.com/onkernel/kernel-node-sdk/commit/3248860f264c1a24c3721eeb5a79c59f6f53dd7f))
* **internal:** version bump ([870e534](https://github.com/onkernel/kernel-node-sdk/commit/870e534210b2ccdebdbeee4f1346d32bb321c756))

## 0.4.0 (2025-05-28)

Full Changelog: [v0.3.0...v0.4.0](https://github.com/onkernel/kernel-node-sdk/compare/v0.3.0...v0.4.0)
Expand Down
58 changes: 23 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,14 @@ const client = new Kernel({
environment: 'development', // defaults to 'production'
});

async function main() {
const deployment = await client.apps.deployments.create({
entrypoint_rel_path: 'main.ts',
file: fs.createReadStream('path/to/file'),
env_vars: { OPENAI_API_KEY: 'x' },
version: '1.0.0',
});

console.log(deployment.apps);
}
const deployment = await client.apps.deployments.create({
entrypoint_rel_path: 'main.ts',
file: fs.createReadStream('path/to/file'),
env_vars: { OPENAI_API_KEY: 'x' },
version: '1.0.0',
});

main();
console.log(deployment.apps);
```

### Request & Response types
Expand All @@ -54,15 +50,11 @@ const client = new Kernel({
environment: 'development', // defaults to 'production'
});

async function main() {
const params: Kernel.BrowserCreateParams = {
invocation_id: 'REPLACE_ME',
persistence: { id: 'browser-for-user-1234' },
};
const browser: Kernel.BrowserCreateResponse = await client.browsers.create(params);
}

main();
const params: Kernel.BrowserCreateParams = {
invocation_id: 'REPLACE_ME',
persistence: { id: 'browser-for-user-1234' },
};
const browser: Kernel.BrowserCreateResponse = await client.browsers.create(params);
```

Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
Expand Down Expand Up @@ -119,21 +111,17 @@ a subclass of `APIError` will be thrown:

<!-- prettier-ignore -->
```ts
async function main() {
const browser = await client.browsers
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
.catch(async (err) => {
if (err instanceof Kernel.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
}

main();
const browser = await client.browsers
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
.catch(async (err) => {
if (err instanceof Kernel.APIError) {
console.log(err.status); // 400
console.log(err.name); // BadRequestError
console.log(err.headers); // {server: 'nginx', ...}
} else {
throw err;
}
});
```

Error codes are as follows:
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default tseslint.config(
parserOptions: { sourceType: 'module' },
},
files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'],
ignores: ['dist/**'],
ignores: ['dist/'],
plugins: {
'@typescript-eslint': tseslint.plugin,
'unused-imports': unusedImports,
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const config: JestConfigWithTsJest = {
'<rootDir>/dist/',
'<rootDir>/deno/',
'<rootDir>/deno_tests/',
'<rootDir>/packages/',
],
testPathIgnorePatterns: ['scripts'],
};
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.4.0",
"version": "0.5.0",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,7 @@
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^9.20.1",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-prettier": "^5.4.1",
"eslint-plugin-unused-imports": "^4.1.4",
"iconv-lite": "^0.6.3",
"jest": "^29.4.0",
Expand All @@ -46,9 +46,6 @@
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
},
"resolutions": {
"synckit": "0.8.8"
},
"imports": {
"@onkernel/sdk": ".",
"@onkernel/sdk/*": "./src/*"
Expand Down
2 changes: 0 additions & 2 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ npm exec tsc-multi
# when building .mjs
node scripts/utils/fix-index-exports.cjs
cp tsconfig.dist-src.json dist/src/tsconfig.json
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts
cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts

node scripts/utils/postprocess-files.cjs

Expand Down
6 changes: 3 additions & 3 deletions src/internal/detect-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ const getPlatformProperties = (): PlatformProperties => {
return {
'X-Stainless-Lang': 'js',
'X-Stainless-Package-Version': VERSION,
'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform),
'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch),
'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform ?? 'unknown'),
'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch ?? 'unknown'),
'X-Stainless-Runtime': 'node',
'X-Stainless-Runtime-Version': (globalThis as any).process.version,
'X-Stainless-Runtime-Version': (globalThis as any).process.version ?? 'unknown',
};
}

Expand Down
28 changes: 0 additions & 28 deletions src/internal/shim-types.d.ts

This file was deleted.

26 changes: 26 additions & 0 deletions src/internal/shim-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

/**
* Shims for types that we can't always rely on being available globally.
*
* Note: these only exist at the type-level, there is no corresponding runtime
* version for any of these symbols.
*/

type NeverToAny<T> = T extends never ? any : T;

/** @ts-ignore */
type _DOMReadableStream<R = any> = globalThis.ReadableStream<R>;

/** @ts-ignore */
type _NodeReadableStream<R = any> = import('stream/web').ReadableStream<R>;

type _ConditionalNodeReadableStream<R = any> =
typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream<R>;

type _ReadableStream<R = any> = NeverToAny<
| ([0] extends [1 & _DOMReadableStream<R>] ? never : _DOMReadableStream<R>)
| ([0] extends [1 & _ConditionalNodeReadableStream<R>] ? never : _ConditionalNodeReadableStream<R>)
>;

export type { _ReadableStream as ReadableStream };
4 changes: 2 additions & 2 deletions src/internal/shims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* messages in cases where an environment isn't fully supported.
*/

import { type Fetch } from './builtin-types';
import { type ReadableStream } from './shim-types';
import type { Fetch } from './builtin-types';
import type { ReadableStream } from './shim-types';

export function getDefaultFetch(): Fetch {
if (typeof fetch !== 'undefined') {
Expand Down
3 changes: 1 addition & 2 deletions src/resources/apps/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ export class Apps extends APIResource {
invocations: InvocationsAPI.Invocations = new InvocationsAPI.Invocations(this._client);

/**
* List application versions for the authenticated user. Optionally filter by app
* name and/or version label.
* List applications. Optionally filter by app name and/or version label.
*
* @example
* ```ts
Expand Down
2 changes: 1 addition & 1 deletion src/resources/apps/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { path } from '../../internal/utils/path';

export class Deployments extends APIResource {
/**
* Deploy a new application
* Deploy a new application and associated actions to Kernel.
*
* @example
* ```ts
Expand Down
6 changes: 3 additions & 3 deletions src/resources/apps/invocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { path } from '../../internal/utils/path';

export class Invocations extends APIResource {
/**
* Invoke an application
* Invoke an action.
*
* @example
* ```ts
Expand All @@ -23,7 +23,7 @@ export class Invocations extends APIResource {
}

/**
* Get an app invocation by id
* Get details about an invocation's status and output.
*
* @example
* ```ts
Expand All @@ -37,7 +37,7 @@ export class Invocations extends APIResource {
}

/**
* Update invocation status or output
* Update an invocation's status or output.
*
* @example
* ```ts
Expand Down
16 changes: 11 additions & 5 deletions src/resources/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { path } from '../internal/utils/path';

export class Browsers extends APIResource {
/**
* Create Browser Session
* Create a new browser session from within an action.
*
* @example
* ```ts
Expand All @@ -23,7 +23,7 @@ export class Browsers extends APIResource {
}

/**
* Get Browser Session by ID
* Get information about a browser session.
*
* @example
* ```ts
Expand All @@ -37,7 +37,7 @@ export class Browsers extends APIResource {
}

/**
* List active browser sessions for the authenticated user
* List active browser sessions
*
* @example
* ```ts
Expand All @@ -49,7 +49,7 @@ export class Browsers extends APIResource {
}

/**
* Delete a persistent browser session by persistent_id query parameter.
* Delete a persistent browser session by its persistent_id.
*
* @example
* ```ts
Expand All @@ -68,7 +68,7 @@ export class Browsers extends APIResource {
}

/**
* Delete Browser Session by ID
* Delete a browser session by ID
*
* @example
* ```ts
Expand Down Expand Up @@ -175,6 +175,12 @@ export interface BrowserCreateParams {
* Optional persistence configuration for the browser session.
*/
persistence?: BrowserPersistence;

/**
* If true, launches the browser in stealth mode to reduce detection by anti-bot
* mechanisms.
*/
stealth?: boolean;
}

export interface BrowserDeleteParams {
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.4.0'; // x-release-please-version
export const VERSION = '0.5.0'; // x-release-please-version
1 change: 1 addition & 0 deletions tests/api-resources/browsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('resource browsers', () => {
const response = await client.browsers.create({
invocation_id: 'rr33xuugxj9h0bkf1rdt2bet',
persistence: { id: 'my-awesome-browser-for-user-1234' },
stealth: true,
});
});

Expand Down
Loading