diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 64f3cdd..2e1c40e 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.8.0"
+ ".": "0.8.2"
}
diff --git a/.stats.yml b/.stats.yml
index a0553b1..5c1470b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -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
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8a0ee17..e6d1265 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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)
diff --git a/README.md b/README.md
index 77ae273..98f3d75 100644
--- a/README.md
+++ b/README.md
@@ -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
@@ -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);
```
@@ -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'),
});
@@ -112,7 +101,7 @@ a subclass of `APIError` will be thrown:
```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
@@ -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,
});
```
@@ -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,
});
```
@@ -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);
@@ -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',
diff --git a/api.md b/api.md
index 6d4c5ed..5f2b98c 100644
--- a/api.md
+++ b/api.md
@@ -30,23 +30,11 @@ Methods:
Types:
-- AppListResponse
+- AppListResponse
Methods:
-- client.apps.list({ ...params }) -> AppListResponse
-
-## Deployments
-
-Types:
-
-- DeploymentCreateResponse
-- DeploymentFollowResponse
-
-Methods:
-
-- client.apps.deployments.create({ ...params }) -> DeploymentCreateResponse
-- client.apps.deployments.follow(id) -> DeploymentFollowResponse
+- client.apps.list({ ...params }) -> AppListResponse
# Invocations
diff --git a/package.json b/package.json
index c82d243..0c720ea 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -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",
@@ -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": ".",
diff --git a/src/client.ts b/src/client.ts
index 76ae00d..89509db 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -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,
@@ -38,7 +39,6 @@ import {
InvocationUpdateResponse,
Invocations,
} from './resources/invocations';
-import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
import {
BrowserCreateParams,
BrowserCreateResponse,
diff --git a/src/resources/apps.ts b/src/resources/apps.ts
index c368b82..b1b7145 100644
--- a/src/resources/apps.ts
+++ b/src/resources/apps.ts
@@ -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 {
+ return this._client.get('/apps', { query, ...options });
+ }
+}
+
+export type AppListResponse = Array;
+
+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;
+
+ /**
+ * 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 };
+}
diff --git a/src/resources/apps/apps.ts b/src/resources/apps/apps.ts
deleted file mode 100644
index 895af23..0000000
--- a/src/resources/apps/apps.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-import { APIResource } from '../../core/resource';
-import * as Shared from '../shared';
-import * as DeploymentsAPI from './deployments';
-import {
- DeploymentCreateParams,
- DeploymentCreateResponse,
- DeploymentFollowResponse,
- Deployments,
-} from './deployments';
-import { APIPromise } from '../../core/api-promise';
-import { RequestOptions } from '../../internal/request-options';
-
-export class Apps extends APIResource {
- deployments: DeploymentsAPI.Deployments = new DeploymentsAPI.Deployments(this._client);
-
- /**
- * List applications. Optionally filter by app name and/or version label.
- *
- * @example
- * ```ts
- * const apps = await client.apps.list();
- * ```
- */
- list(query: AppListParams | null | undefined = {}, options?: RequestOptions): APIPromise {
- return this._client.get('/apps', { query, ...options });
- }
-}
-
-export type AppListResponse = Array;
-
-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;
-
- /**
- * 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;
-}
-
-Apps.Deployments = Deployments;
-
-export declare namespace Apps {
- export { type AppListResponse as AppListResponse, type AppListParams as AppListParams };
-
- export {
- Deployments as Deployments,
- type DeploymentCreateResponse as DeploymentCreateResponse,
- type DeploymentFollowResponse as DeploymentFollowResponse,
- type DeploymentCreateParams as DeploymentCreateParams,
- };
-}
diff --git a/src/resources/apps/deployments.ts b/src/resources/apps/deployments.ts
deleted file mode 100644
index 109fa69..0000000
--- a/src/resources/apps/deployments.ts
+++ /dev/null
@@ -1,175 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-import { APIResource } from '../../core/resource';
-import * as Shared from '../shared';
-import { APIPromise } from '../../core/api-promise';
-import { Stream } from '../../core/streaming';
-import { type Uploadable } from '../../core/uploads';
-import { buildHeaders } from '../../internal/headers';
-import { RequestOptions } from '../../internal/request-options';
-import { multipartFormRequestOptions } from '../../internal/uploads';
-import { path } from '../../internal/utils/path';
-
-export class Deployments extends APIResource {
- /**
- * Deploy a new application and associated actions to Kernel.
- *
- * @example
- * ```ts
- * const deployment = await client.apps.deployments.create({
- * entrypoint_rel_path: 'src/app.py',
- * file: fs.createReadStream('path/to/file'),
- * });
- * ```
- */
- create(body: DeploymentCreateParams, options?: RequestOptions): APIPromise {
- return this._client.post('/deploy', multipartFormRequestOptions({ body, ...options }, this._client));
- }
-
- /**
- * Establishes a Server-Sent Events (SSE) stream that delivers real-time logs and
- * status updates for a deployed application. The stream terminates automatically
- * once the application reaches a terminal state.
- *
- * @example
- * ```ts
- * const response = await client.apps.deployments.follow('id');
- * ```
- */
- follow(id: string, options?: RequestOptions): APIPromise> {
- return this._client.get(path`/apps/${id}/events`, {
- ...options,
- headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
- stream: true,
- }) as APIPromise>;
- }
-}
-
-export interface DeploymentCreateResponse {
- /**
- * List of apps deployed
- */
- apps: Array;
-
- /**
- * Current status of the deployment
- */
- status: 'queued' | 'deploying' | 'succeeded' | 'failed';
-
- /**
- * Status reason
- */
- status_reason?: string;
-}
-
-export namespace DeploymentCreateResponse {
- export interface App {
- /**
- * ID for the app version deployed
- */
- id: string;
-
- /**
- * List of actions available on the app
- */
- actions: Array;
-
- /**
- * Name of the app
- */
- name: string;
- }
-}
-
-/**
- * Union type representing any application event. Actual schema is determined by
- * the 'event' field.
- */
-export type DeploymentFollowResponse =
- | DeploymentFollowResponse.StateEvent
- | DeploymentFollowResponse.StateUpdateEvent
- | Shared.LogEvent
- | Shared.HeartbeatEvent;
-
-export namespace DeploymentFollowResponse {
- /**
- * Initial state of the application, emitted once when subscribing.
- */
- export interface StateEvent {
- /**
- * Event type identifier (always "state").
- */
- event: 'state';
-
- /**
- * Current application state (e.g., "deploying", "running", "succeeded", "failed").
- */
- state: string;
-
- /**
- * Time the state was reported.
- */
- timestamp?: string;
- }
-
- /**
- * An update emitted when the application's state changes.
- */
- export interface StateUpdateEvent {
- /**
- * Event type identifier (always "state_update").
- */
- event: 'state_update';
-
- /**
- * New application state (e.g., "running", "succeeded", "failed").
- */
- state: string;
-
- /**
- * Time the state change occurred.
- */
- timestamp?: string;
- }
-}
-
-export interface DeploymentCreateParams {
- /**
- * Relative path to the entrypoint of the application
- */
- entrypoint_rel_path: string;
-
- /**
- * ZIP file containing the application source directory
- */
- file: Uploadable;
-
- /**
- * Map of environment variables to set for the deployed application. Each key-value
- * pair represents an environment variable.
- */
- env_vars?: { [key: string]: string };
-
- /**
- * Allow overwriting an existing app version
- */
- force?: boolean;
-
- /**
- * Region for deployment. Currently we only support "aws.us-east-1a"
- */
- region?: 'aws.us-east-1a';
-
- /**
- * Version of the application. Can be any string.
- */
- version?: string;
-}
-
-export declare namespace Deployments {
- export {
- type DeploymentCreateResponse as DeploymentCreateResponse,
- type DeploymentFollowResponse as DeploymentFollowResponse,
- type DeploymentCreateParams as DeploymentCreateParams,
- };
-}
diff --git a/src/resources/apps/index.ts b/src/resources/apps/index.ts
deleted file mode 100644
index a32f41e..0000000
--- a/src/resources/apps/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-export { Apps, type AppListResponse, type AppListParams } from './apps';
-export {
- Deployments,
- type DeploymentCreateResponse,
- type DeploymentFollowResponse,
- type DeploymentCreateParams,
-} from './deployments';
diff --git a/src/resources/index.ts b/src/resources/index.ts
index f51eb77..a368fed 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -1,7 +1,7 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
export * from './shared';
-export { Apps, type AppListResponse, type AppListParams } from './apps/apps';
+export { Apps, type AppListResponse, type AppListParams } from './apps';
export {
Browsers,
type BrowserPersistence,
diff --git a/src/resources/invocations.ts b/src/resources/invocations.ts
index 24afed1..89bc359 100644
--- a/src/resources/invocations.ts
+++ b/src/resources/invocations.ts
@@ -165,6 +165,11 @@ export interface InvocationCreateResponse {
*/
id: string;
+ /**
+ * Name of the action invoked
+ */
+ action_name: string;
+
/**
* Status of the invocation
*/
diff --git a/src/version.ts b/src/version.ts
index 23f967c..72b24dd 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.8.0'; // x-release-please-version
+export const VERSION = '0.8.2'; // x-release-please-version
diff --git a/tests/api-resources/apps/apps.test.ts b/tests/api-resources/apps.test.ts
similarity index 100%
rename from tests/api-resources/apps/apps.test.ts
rename to tests/api-resources/apps.test.ts
diff --git a/tests/api-resources/apps/deployments.test.ts b/tests/api-resources/apps/deployments.test.ts
deleted file mode 100644
index 7978198..0000000
--- a/tests/api-resources/apps/deployments.test.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-import Kernel, { toFile } from '@onkernel/sdk';
-
-const client = new Kernel({
- apiKey: 'My API Key',
- baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
-});
-
-describe('resource deployments', () => {
- // skipped: tests are disabled for the time being
- test.skip('create: only required params', async () => {
- const responsePromise = client.apps.deployments.create({
- entrypoint_rel_path: 'src/app.py',
- file: await toFile(Buffer.from('# my file contents'), 'README.md'),
- });
- 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);
- });
-
- // skipped: tests are disabled for the time being
- test.skip('create: required and optional params', async () => {
- const response = await client.apps.deployments.create({
- entrypoint_rel_path: 'src/app.py',
- file: await toFile(Buffer.from('# my file contents'), 'README.md'),
- env_vars: { foo: 'string' },
- force: false,
- region: 'aws.us-east-1a',
- version: '1.0.0',
- });
- });
-
- // skipped: currently no good way to test endpoints with content type text/event-stream, Prism mock server will fail
- test.skip('follow', async () => {
- const responsePromise = client.apps.deployments.follow('id');
- 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);
- });
-});