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.1.0-alpha.9"
".": "0.1.0-alpha.10"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 4
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2af763aab4c314b382e1123edc4ee3d51c0fe7977730ce6776b9fb09b29fe291.yml
openapi_spec_hash: be02256478be81fa3f649076879850bc
config_hash: eab40627b734534462ae3b8ccd8b263b
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-07d481d1498bf9677437b555e9ec2d843d50107faa7501e4c430a32b1f3c3343.yml
openapi_spec_hash: 296f78d82afbac95fad12c5eabd71f18
config_hash: 2c8351ba6611ce4a352e248405783846
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.1.0-alpha.10 (2025-05-14)

Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/onkernel/kernel-node-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)

### Features

* **api:** update via SDK Studio ([3b78bc2](https://github.com/onkernel/kernel-node-sdk/commit/3b78bc20c94d4e6cfca144da4096b32fe6c5d5dc))


### Chores

* **package:** remove engines ([d4d2eb2](https://github.com/onkernel/kernel-node-sdk/commit/d4d2eb2ab59cc5e4d237fddd143388a4348d51ba))

## 0.1.0-alpha.9 (2025-05-12)

Full Changelog: [v0.1.0-alpha.8...v0.1.0-alpha.9](https://github.com/onkernel/kernel-node-sdk/compare/v0.1.0-alpha.8...v0.1.0-alpha.9)
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const client = new Kernel({

async function main() {
const response = await client.apps.deploy({
entrypointRelPath: 'app.py',
file: fs.createReadStream('path/to/file'),
version: 'REPLACE_ME',
});
Expand All @@ -53,7 +54,11 @@ const client = new Kernel({
});

async function main() {
const params: Kernel.AppDeployParams = { file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' };
const params: Kernel.AppDeployParams = {
entrypointRelPath: 'app.py',
file: fs.createReadStream('path/to/file'),
version: 'REPLACE_ME',
};
const response: Kernel.AppDeployResponse = await client.apps.deploy(params);
}

Expand All @@ -78,17 +83,23 @@ 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.deploy({ file: fs.createReadStream('/path/to/file') });
await client.apps.deploy({ entrypointRelPath: '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.deploy({ file: new File(['my bytes'], 'file') });
await client.apps.deploy({ entrypointRelPath: 'app.py', file: new File(['my bytes'], 'file') });

// You can also pass a `fetch` `Response`:
await client.apps.deploy({ file: await fetch('https://somesite/file') });
await client.apps.deploy({ entrypointRelPath: '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.deploy({ file: await toFile(Buffer.from('my bytes'), 'file') });
await client.apps.deploy({ file: await toFile(new Uint8Array([0, 1, 2]), 'file') });
await client.apps.deploy({
entrypointRelPath: 'app.py',
file: await toFile(Buffer.from('my bytes'), 'file'),
});
await client.apps.deploy({
entrypointRelPath: 'app.py',
file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
});
```

## Handling errors
Expand All @@ -101,7 +112,7 @@ a subclass of `APIError` will be thrown:
```ts
async function main() {
const response = await client.apps
.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' })
.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' })
.catch(async (err) => {
if (err instanceof Kernel.APIError) {
console.log(err.status); // 400
Expand Down Expand Up @@ -145,7 +156,7 @@ const client = new Kernel({
});

// Or, configure per-request:
await client.apps.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, {
await client.apps.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, {
maxRetries: 5,
});
```
Expand All @@ -162,7 +173,7 @@ const client = new Kernel({
});

// Override per-request:
await client.apps.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, {
await client.apps.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -186,13 +197,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
const client = new Kernel();

const response = await client.apps
.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' })
.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' })
.asResponse();
console.log(response.headers.get('X-My-Header'));
console.log(response.statusText); // access the underlying Response object

const { data: response, response: raw } = await client.apps
.deploy({ file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' })
.deploy({ entrypointRelPath: 'app.py', file: fs.createReadStream('path/to/file'), version: 'REPLACE_ME' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
console.log(response.apps);
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.1.0-alpha.9",
"version": "0.1.0-alpha.10",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -68,8 +68,5 @@
"import": "./dist/*.mjs",
"require": "./dist/*.js"
}
},
"engines": {
"node": ">= 20"
}
}
9 changes: 5 additions & 4 deletions src/resources/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class Apps extends APIResource {
* @example
* ```ts
* const response = await client.apps.deploy({
* entrypointRelPath: 'app.py',
* file: fs.createReadStream('path/to/file'),
* });
* ```
Expand Down Expand Up @@ -128,14 +129,14 @@ export interface AppRetrieveInvocationResponse {

export interface AppDeployParams {
/**
* ZIP file containing the application source directory
* Relative path to the entrypoint of the application
*/
file: Uploadable;
entrypointRelPath: string;

/**
* Relative path to the entrypoint of the application
* ZIP file containing the application source directory
*/
entrypointRelPath?: string;
file: Uploadable;

/**
* Allow overwriting an existing app version
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.1.0-alpha.9'; // x-release-please-version
export const VERSION = '0.1.0-alpha.10'; // x-release-please-version
3 changes: 2 additions & 1 deletion tests/api-resources/apps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ describe('resource apps', () => {
// skipped: tests are disabled for the time being
test.skip('deploy: only required params', async () => {
const responsePromise = client.apps.deploy({
entrypointRelPath: 'app.py',
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
});
const rawResponse = await responsePromise.asResponse();
Expand All @@ -25,8 +26,8 @@ describe('resource apps', () => {
// skipped: tests are disabled for the time being
test.skip('deploy: required and optional params', async () => {
const response = await client.apps.deploy({
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
entrypointRelPath: 'app.py',
file: await toFile(Buffer.from('# my file contents'), 'README.md'),
force: 'false',
region: 'aws.us-east-1a',
version: '1.0.0',
Expand Down