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.8.0"
".": "0.8.2"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-a5b1d2c806c42c1534eefc8d34516f7f6e4ab68cb6a836534ee549bdbe4653f3.yml
openapi_spec_hash: 0be350cc8ddbd1fc7e058ce6c3a44ee8
config_hash: 307153ecd5b85f77ce8e0d87f6e5dfab
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-5e4716f7fce42bbcecc7ecb699c1c467ae778d74d558f7a260d531e2af1a7f30.yml
openapi_spec_hash: f545dcef9001b00c2604e3dcc6a12f7a
config_hash: 65328ff206b8c0168c915914506d9dba
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.8.2 (2025-07-23)

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

### Features

* **api:** add action name to the response to invoke ([02097a8](https://github.com/onkernel/kernel-node-sdk/commit/02097a886f25ce632ac2ba166b510901fc6693ae))


### Chores

* **api:** remove deprecated endpoints ([904ea56](https://github.com/onkernel/kernel-node-sdk/commit/904ea5662e465a5238402427341550c6e7421614))
* **ts:** reorder package.json imports ([e260997](https://github.com/onkernel/kernel-node-sdk/commit/e260997238b81c3183bbd7ba7f178cd2c4e3a1ac))

## 0.8.0 (2025-07-16)

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

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',
});
const browser = await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } });

console.log(deployment.apps);
console.log(browser.session_id);
```

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

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

Expand All @@ -75,29 +67,26 @@ import Kernel, { toFile } from '@onkernel/sdk';
const client = new Kernel();

// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
await client.apps.deployments.create({
await client.deployments.create({
entrypoint_rel_path: 'src/app.py',
file: fs.createReadStream('/path/to/file'),
});

// Or if you have the web `File` API you can pass a `File` instance:
await client.apps.deployments.create({
entrypoint_rel_path: 'src/app.py',
file: new File(['my bytes'], 'file'),
});
await client.deployments.create({ entrypoint_rel_path: 'src/app.py', file: new File(['my bytes'], 'file') });

// You can also pass a `fetch` `Response`:
await client.apps.deployments.create({
await client.deployments.create({
entrypoint_rel_path: 'src/app.py',
file: await fetch('https://somesite/file'),
});

// Finally, if none of the above are convenient, you can use our `toFile` helper:
await client.apps.deployments.create({
await client.deployments.create({
entrypoint_rel_path: 'src/app.py',
file: await toFile(Buffer.from('my bytes'), 'file'),
});
await client.apps.deployments.create({
await client.deployments.create({
entrypoint_rel_path: 'src/app.py',
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
});
Expand All @@ -112,7 +101,7 @@ a subclass of `APIError` will be thrown:
<!-- prettier-ignore -->
```ts
const browser = await client.browsers
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
.create({ persistence: { id: 'browser-for-user-1234' } })
.catch(async (err) => {
if (err instanceof Kernel.APIError) {
console.log(err.status); // 400
Expand Down Expand Up @@ -153,7 +142,7 @@ const client = new Kernel({
});

// Or, configure per-request:
await client.browsers.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } }, {
await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }, {
maxRetries: 5,
});
```
Expand All @@ -170,7 +159,7 @@ const client = new Kernel({
});

// Override per-request:
await client.browsers.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } }, {
await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }, {
timeout: 5 * 1000,
});
```
Expand All @@ -193,14 +182,12 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
```ts
const client = new Kernel();

const response = await client.browsers
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
.asResponse();
const response = await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }).asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: browser, response: raw } = await client.browsers
.create({ invocation_id: 'REPLACE_ME', persistence: { id: 'browser-for-user-1234' } })
.create({ persistence: { id: 'browser-for-user-1234' } })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(browser.session_id);
Expand Down Expand Up @@ -283,7 +270,7 @@ parameter. This library doesn't validate at runtime that the request matches the
send will be sent as-is.

```ts
client.apps.deployments.create({
client.browsers.create({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
Expand Down
16 changes: 2 additions & 14 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,11 @@ Methods:

Types:

- <code><a href="./src/resources/apps/apps.ts">AppListResponse</a></code>
- <code><a href="./src/resources/apps.ts">AppListResponse</a></code>

Methods:

- <code title="get /apps">client.apps.<a href="./src/resources/apps/apps.ts">list</a>({ ...params }) -> AppListResponse</code>

## Deployments

Types:

- <code><a href="./src/resources/apps/deployments.ts">DeploymentCreateResponse</a></code>
- <code><a href="./src/resources/apps/deployments.ts">DeploymentFollowResponse</a></code>

Methods:

- <code title="post /deploy">client.apps.deployments.<a href="./src/resources/apps/deployments.ts">create</a>({ ...params }) -> DeploymentCreateResponse</code>
- <code title="get /apps/{id}/events">client.apps.deployments.<a href="./src/resources/apps/deployments.ts">follow</a>(id) -> DeploymentFollowResponse</code>
- <code title="get /apps">client.apps.<a href="./src/resources/apps.ts">list</a>({ ...params }) -> AppListResponse</code>

# Invocations

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.8.0",
"version": "0.8.2",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -30,7 +30,6 @@
"@swc/jest": "^0.2.29",
"@types/jest": "^29.4.0",
"@types/node": "^20.17.6",
"typescript-eslint": "8.31.1",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^9.20.1",
Expand All @@ -44,7 +43,8 @@
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"typescript": "5.8.3"
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
"imports": {
"@onkernel/sdk": ".",
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as Errors from './core/error';
import * as Uploads from './core/uploads';
import * as API from './resources/index';
import { APIPromise } from './core/api-promise';
import { AppListParams, AppListResponse, Apps } from './resources/apps';
import {
DeploymentCreateParams,
DeploymentCreateResponse,
Expand All @@ -38,7 +39,6 @@ import {
InvocationUpdateResponse,
Invocations,
} from './resources/invocations';
import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
import {
BrowserCreateParams,
BrowserCreateResponse,
Expand Down
74 changes: 73 additions & 1 deletion src/resources/apps.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export * from './apps/index';
import { APIResource } from '../core/resource';
import * as Shared from './shared';
import { APIPromise } from '../core/api-promise';
import { RequestOptions } from '../internal/request-options';

export class Apps extends APIResource {
/**
* List applications. Optionally filter by app name and/or version label.
*/
list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise<AppListResponse> {
return this._client.get('/apps', { query, ...options });
}
}

export type AppListResponse = Array<AppListResponse.AppListResponseItem>;

export namespace AppListResponse {
/**
* Summary of an application version.
*/
export interface AppListResponseItem {
/**
* Unique identifier for the app version
*/
id: string;

/**
* List of actions available on the app
*/
actions: Array<Shared.AppAction>;

/**
* Name of the application
*/
app_name: string;

/**
* Deployment ID
*/
deployment: string;

/**
* Environment variables configured for this app version
*/
env_vars: { [key: string]: string };

/**
* Deployment region code
*/
region: 'aws.us-east-1a';

/**
* Version label for the application
*/
version: string;
}
}

export interface AppListParams {
/**
* Filter results by application name.
*/
app_name?: string;

/**
* Filter results by version label.
*/
version?: string;
}

export declare namespace Apps {
export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
}
98 changes: 0 additions & 98 deletions src/resources/apps/apps.ts

This file was deleted.

Loading