Skip to content

Commit 7c5d2e4

Browse files
authored
Merge pull request #25 from onkernel/release-please--branches--main--changes--next--components--sdk
release: 0.6.0
2 parents b9cad84 + e931ee6 commit 7c5d2e4

30 files changed

+834
-115
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- 'integrated/**'
88
- 'stl-preview-head/**'
99
- 'stl-preview-base/**'
10+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
1014

1115
jobs:
1216
lint:

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.5.0"
2+
".": "0.6.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 11
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-4502c65bef0843a6ae96d23bba075433af6bab49b55b544b1522f63e7881c00c.yml
3-
openapi_spec_hash: 3e67b77bbc8cd6155b8f66f3271f2643
4-
config_hash: c6bab7ac8da570a5abbcfb19db119b6b
1+
configured_endpoints: 15
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-5d4e11bc46eeecee7363d56a9dfe946acee997d5b352c2b0a50c20e742c54d2d.yml
3+
openapi_spec_hash: 333e53ad9c706296b9afdb8ff73bec8f
4+
config_hash: 0fdf285ddd8dee229fd84ea57df9080f

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,40 @@
11
# Changelog
22

3+
## 0.6.0 (2025-06-18)
4+
5+
Full Changelog: [v0.5.0...v0.6.0](https://github.com/onkernel/kernel-node-sdk/compare/v0.5.0...v0.6.0)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([ce675af](https://github.com/onkernel/kernel-node-sdk/commit/ce675afa43f72708fd26bd0ab9d37b43f2e4b645))
10+
* **api:** update via SDK Studio ([b4fbd8c](https://github.com/onkernel/kernel-node-sdk/commit/b4fbd8cd5287894a1e31c3369e6268676b5cfb93))
11+
* **api:** update via SDK Studio ([c6890ba](https://github.com/onkernel/kernel-node-sdk/commit/c6890ba4c2ccebc4be3388107de407ef833555d6))
12+
* **api:** update via SDK Studio ([842ec55](https://github.com/onkernel/kernel-node-sdk/commit/842ec5503a95b8a7bd43405cb0af36411610d14a))
13+
* **api:** update via SDK Studio ([b0652c7](https://github.com/onkernel/kernel-node-sdk/commit/b0652c76a0d9b8ff39c8d97d0087a305ed1bb0b7))
14+
* **api:** update via SDK Studio ([76a1ea8](https://github.com/onkernel/kernel-node-sdk/commit/76a1ea8d2d978b7872ff122f6b4457f361695e22))
15+
* **api:** update via SDK Studio ([371e317](https://github.com/onkernel/kernel-node-sdk/commit/371e3178a73439915a459dc0b7e968aeaf9f7e8f))
16+
* **api:** update via SDK Studio ([6e4f782](https://github.com/onkernel/kernel-node-sdk/commit/6e4f782824e8ec1956d31ddaff7073a0015a3014))
17+
* **api:** update via SDK Studio ([121219a](https://github.com/onkernel/kernel-node-sdk/commit/121219a8e7dab92398d7373afb84be06a9d15217))
18+
* **api:** update via SDK Studio ([567602f](https://github.com/onkernel/kernel-node-sdk/commit/567602fb83e9135938abd7cd080f864fc787f288))
19+
* **api:** update via SDK Studio ([ef99764](https://github.com/onkernel/kernel-node-sdk/commit/ef99764a42bc6243b028162eb1fcc88ae36eed41))
20+
* **api:** update via SDK Studio ([e4ad78d](https://github.com/onkernel/kernel-node-sdk/commit/e4ad78d21af5a7d009f55cea09da358780ca8d2d))
21+
* **api:** update via SDK Studio ([171423f](https://github.com/onkernel/kernel-node-sdk/commit/171423fb6af8fde206a1e32a1e8611f4b1d325be))
22+
* **client:** add support for endpoint-specific base URLs ([7b4d7a2](https://github.com/onkernel/kernel-node-sdk/commit/7b4d7a2da7ba44fa0e0648545eccb5e175cf8255))
23+
24+
25+
### Bug Fixes
26+
27+
* publish script — handle NPM errors correctly ([16c70f4](https://github.com/onkernel/kernel-node-sdk/commit/16c70f444b06763b186c7138e16476d03b9638fe))
28+
29+
30+
### Chores
31+
32+
* avoid type error in certain environments ([ec7be8d](https://github.com/onkernel/kernel-node-sdk/commit/ec7be8d0c90029c4fb5911afee057dcd73f6caa1))
33+
* **ci:** enable for pull requests ([0dc0e13](https://github.com/onkernel/kernel-node-sdk/commit/0dc0e130a319209e0debcb41df6a7e4e473a013b))
34+
* **client:** refactor imports ([801fb38](https://github.com/onkernel/kernel-node-sdk/commit/801fb38b66af7598d9bbc12d6964031f44f7a6ea))
35+
* **internal:** add pure annotations, make base APIResource abstract ([71cd518](https://github.com/onkernel/kernel-node-sdk/commit/71cd5185af173938e8bf933045de56dec7c04802))
36+
* **readme:** update badges ([48f24e9](https://github.com/onkernel/kernel-node-sdk/commit/48f24e9591eeb869dfeb38b6f52f28d6edfcd10e))
37+
338
## 0.5.0 (2025-06-04)
439

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kernel TypeScript API Library
22

3-
[![NPM version](https://img.shields.io/npm/v/@onkernel/sdk.svg)](https://npmjs.org/package/@onkernel/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@onkernel/sdk)
3+
[![NPM version](<https://img.shields.io/npm/v/@onkernel/sdk.svg?label=npm%20(stable)>)](https://npmjs.org/package/@onkernel/sdk) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/@onkernel/sdk)
44

55
This library provides convenient access to the Kernel REST API from server-side TypeScript or JavaScript.
66

api.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# Shared
2+
3+
Types:
4+
5+
- <code><a href="./src/resources/shared.ts">ErrorDetail</a></code>
6+
- <code><a href="./src/resources/shared.ts">ErrorEvent</a></code>
7+
- <code><a href="./src/resources/shared.ts">ErrorModel</a></code>
8+
- <code><a href="./src/resources/shared.ts">LogEvent</a></code>
9+
10+
# Deployments
11+
12+
Types:
13+
14+
- <code><a href="./src/resources/deployments.ts">DeploymentStateEvent</a></code>
15+
- <code><a href="./src/resources/deployments.ts">DeploymentCreateResponse</a></code>
16+
- <code><a href="./src/resources/deployments.ts">DeploymentRetrieveResponse</a></code>
17+
- <code><a href="./src/resources/deployments.ts">DeploymentFollowResponse</a></code>
18+
19+
Methods:
20+
21+
- <code title="post /deployments">client.deployments.<a href="./src/resources/deployments.ts">create</a>({ ...params }) -> DeploymentCreateResponse</code>
22+
- <code title="get /deployments/{id}">client.deployments.<a href="./src/resources/deployments.ts">retrieve</a>(id) -> DeploymentRetrieveResponse</code>
23+
- <code title="get /deployments/{id}/events">client.deployments.<a href="./src/resources/deployments.ts">follow</a>(id) -> DeploymentFollowResponse</code>
24+
125
# Apps
226

327
Types:
@@ -20,19 +44,22 @@ Methods:
2044
- <code title="post /deploy">client.apps.deployments.<a href="./src/resources/apps/deployments.ts">create</a>({ ...params }) -> DeploymentCreateResponse</code>
2145
- <code title="get /apps/{id}/events">client.apps.deployments.<a href="./src/resources/apps/deployments.ts">follow</a>(id) -> DeploymentFollowResponse</code>
2246

23-
## Invocations
47+
# Invocations
2448

2549
Types:
2650

27-
- <code><a href="./src/resources/apps/invocations.ts">InvocationCreateResponse</a></code>
28-
- <code><a href="./src/resources/apps/invocations.ts">InvocationRetrieveResponse</a></code>
29-
- <code><a href="./src/resources/apps/invocations.ts">InvocationUpdateResponse</a></code>
51+
- <code><a href="./src/resources/invocations.ts">InvocationStateEvent</a></code>
52+
- <code><a href="./src/resources/invocations.ts">InvocationCreateResponse</a></code>
53+
- <code><a href="./src/resources/invocations.ts">InvocationRetrieveResponse</a></code>
54+
- <code><a href="./src/resources/invocations.ts">InvocationUpdateResponse</a></code>
55+
- <code><a href="./src/resources/invocations.ts">InvocationFollowResponse</a></code>
3056

3157
Methods:
3258

33-
- <code title="post /invocations">client.apps.invocations.<a href="./src/resources/apps/invocations.ts">create</a>({ ...params }) -> InvocationCreateResponse</code>
34-
- <code title="get /invocations/{id}">client.apps.invocations.<a href="./src/resources/apps/invocations.ts">retrieve</a>(id) -> InvocationRetrieveResponse</code>
35-
- <code title="patch /invocations/{id}">client.apps.invocations.<a href="./src/resources/apps/invocations.ts">update</a>(id, { ...params }) -> InvocationUpdateResponse</code>
59+
- <code title="post /invocations">client.invocations.<a href="./src/resources/invocations.ts">create</a>({ ...params }) -> InvocationCreateResponse</code>
60+
- <code title="get /invocations/{id}">client.invocations.<a href="./src/resources/invocations.ts">retrieve</a>(id) -> InvocationRetrieveResponse</code>
61+
- <code title="patch /invocations/{id}">client.invocations.<a href="./src/resources/invocations.ts">update</a>(id, { ...params }) -> InvocationUpdateResponse</code>
62+
- <code title="get /invocations/{id}/events">client.invocations.<a href="./src/resources/invocations.ts">follow</a>(id) -> InvocationFollowResponse</code>
3663

3764
# Browsers
3865

bin/publish-npm

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,35 @@ npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
77
yarn build
88
cd dist
99

10+
# Get package name and version from package.json
11+
PACKAGE_NAME="$(jq -r -e '.name' ./package.json)"
12+
VERSION="$(jq -r -e '.version' ./package.json)"
13+
1014
# Get latest version from npm
1115
#
12-
# If the package doesn't exist, yarn will return
13-
# {"type":"error","data":"Received invalid response from npm."}
14-
# where .data.version doesn't exist so LAST_VERSION will be an empty string.
15-
LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')"
16-
17-
# Get current version from package.json
18-
VERSION="$(node -p "require('./package.json').version")"
16+
# If the package doesn't exist, npm will return:
17+
# {
18+
# "error": {
19+
# "code": "E404",
20+
# "summary": "Unpublished on 2025-06-05T09:54:53.528Z",
21+
# "detail": "'the_package' is not in this registry..."
22+
# }
23+
# }
24+
NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)"
25+
26+
# Check if we got an E404 error
27+
if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then
28+
# Package doesn't exist yet, no last version
29+
LAST_VERSION=""
30+
elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then
31+
# Report other errors
32+
echo "ERROR: npm returned unexpected data:"
33+
echo "$NPM_INFO"
34+
exit 1
35+
else
36+
# Success - get the version
37+
LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes
38+
fi
1939

2040
# Check if current version is pre-release (e.g. alpha / beta / rc)
2141
CURRENT_IS_PRERELEASE=false

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@onkernel/sdk",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"description": "The official TypeScript library for the Kernel API",
55
"author": "Kernel <>",
66
"types": "dist/index.d.ts",
@@ -42,7 +42,7 @@
4242
"publint": "^0.2.12",
4343
"ts-jest": "^29.1.0",
4444
"ts-node": "^10.5.0",
45-
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz",
45+
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
4646
"tsconfig-paths": "^4.0.0",
4747
"typescript": "5.8.3"
4848
},

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fi
3131
node scripts/utils/make-dist-package-json.cjs > dist/package.json
3232

3333
# build to .js/.mjs/.d.ts files
34-
npm exec tsc-multi
34+
./node_modules/.bin/tsc-multi
3535
# we need to patch index.js so that `new module.exports()` works for cjs backwards
3636
# compat. No way to get that from index.ts because it would cause compile errors
3737
# when building .mjs

src/client.ts

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestIni
55
import { uuid4 } from './internal/utils/uuid';
66
import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values';
77
import { sleep } from './internal/utils/sleep';
8-
import { type Logger, type LogLevel, parseLogLevel } from './internal/utils/log';
98
export type { Logger, LogLevel } from './internal/utils/log';
109
import { castToError, isAbortError } from './internal/errors';
1110
import type { APIResponseProps } from './internal/parse';
@@ -17,9 +16,6 @@ import * as Errors from './core/error';
1716
import * as Uploads from './core/uploads';
1817
import * as API from './resources/index';
1918
import { APIPromise } from './core/api-promise';
20-
import { type Fetch } from './internal/builtin-types';
21-
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
22-
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
2319
import {
2420
BrowserCreateParams,
2521
BrowserCreateResponse,
@@ -29,11 +25,38 @@ import {
2925
BrowserRetrieveResponse,
3026
Browsers,
3127
} from './resources/browsers';
32-
import { readEnv } from './internal/utils/env';
33-
import { formatRequestDetails, loggerFor } from './internal/utils/log';
34-
import { isEmptyObj } from './internal/utils/values';
28+
import {
29+
DeploymentCreateParams,
30+
DeploymentCreateResponse,
31+
DeploymentFollowResponse,
32+
DeploymentRetrieveResponse,
33+
DeploymentStateEvent,
34+
Deployments,
35+
} from './resources/deployments';
3536
import { KernelApp } from './core/app-framework';
37+
import {
38+
InvocationCreateParams,
39+
InvocationCreateResponse,
40+
InvocationFollowResponse,
41+
InvocationRetrieveResponse,
42+
InvocationStateEvent,
43+
InvocationUpdateParams,
44+
InvocationUpdateResponse,
45+
Invocations,
46+
} from './resources/invocations';
3647
import { AppListParams, AppListResponse, Apps } from './resources/apps/apps';
48+
import { type Fetch } from './internal/builtin-types';
49+
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
50+
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
51+
import { readEnv } from './internal/utils/env';
52+
import {
53+
type LogLevel,
54+
type Logger,
55+
formatRequestDetails,
56+
loggerFor,
57+
parseLogLevel,
58+
} from './internal/utils/log';
59+
import { isEmptyObj } from './internal/utils/values';
3760

3861
const environments = {
3962
production: 'https://api.onkernel.com/',
@@ -216,6 +239,13 @@ export class Kernel {
216239
});
217240
}
218241

242+
/**
243+
* Check whether the base URL is set to its default.
244+
*/
245+
#baseURLOverridden(): boolean {
246+
return this.baseURL !== environments[this._options.environment || 'production'];
247+
}
248+
219249
protected defaultQuery(): Record<string, string | undefined> | undefined {
220250
return this._options.defaultQuery;
221251
}
@@ -265,11 +295,16 @@ export class Kernel {
265295
return Errors.APIError.generate(status, error, message, headers);
266296
}
267297

268-
buildURL(path: string, query: Record<string, unknown> | null | undefined): string {
298+
buildURL(
299+
path: string,
300+
query: Record<string, unknown> | null | undefined,
301+
defaultBaseURL?: string | undefined,
302+
): string {
303+
const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL;
269304
const url =
270305
isAbsoluteURL(path) ?
271306
new URL(path)
272-
: new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
307+
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
273308

274309
const defaultQuery = this.defaultQuery();
275310
if (!isEmptyObj(defaultQuery)) {
@@ -610,9 +645,9 @@ export class Kernel {
610645
{ retryCount = 0 }: { retryCount?: number } = {},
611646
): { req: FinalizedRequestInit; url: string; timeout: number } {
612647
const options = { ...inputOptions };
613-
const { method, path, query } = options;
648+
const { method, path, query, defaultBaseURL } = options;
614649

615-
const url = this.buildURL(path!, query as Record<string, unknown>);
650+
const url = this.buildURL(path!, query as Record<string, unknown>, defaultBaseURL);
616651
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
617652
options.timeout = options.timeout ?? this.timeout;
618653
const { bodyHeaders, body } = this.buildBody({ options });
@@ -735,16 +770,40 @@ export class Kernel {
735770

736771
static toFile = Uploads.toFile;
737772

773+
deployments: API.Deployments = new API.Deployments(this);
738774
apps: API.Apps = new API.Apps(this);
775+
invocations: API.Invocations = new API.Invocations(this);
739776
browsers: API.Browsers = new API.Browsers(this);
740777
}
778+
Kernel.Deployments = Deployments;
741779
Kernel.Apps = Apps;
780+
Kernel.Invocations = Invocations;
742781
Kernel.Browsers = Browsers;
743782
export declare namespace Kernel {
744783
export type RequestOptions = Opts.RequestOptions;
745784

785+
export {
786+
Deployments as Deployments,
787+
type DeploymentStateEvent as DeploymentStateEvent,
788+
type DeploymentCreateResponse as DeploymentCreateResponse,
789+
type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
790+
type DeploymentFollowResponse as DeploymentFollowResponse,
791+
type DeploymentCreateParams as DeploymentCreateParams,
792+
};
793+
746794
export { Apps as Apps, type AppListResponse as AppListResponse, type AppListParams as AppListParams };
747795

796+
export {
797+
Invocations as Invocations,
798+
type InvocationStateEvent as InvocationStateEvent,
799+
type InvocationCreateResponse as InvocationCreateResponse,
800+
type InvocationRetrieveResponse as InvocationRetrieveResponse,
801+
type InvocationUpdateResponse as InvocationUpdateResponse,
802+
type InvocationFollowResponse as InvocationFollowResponse,
803+
type InvocationCreateParams as InvocationCreateParams,
804+
type InvocationUpdateParams as InvocationUpdateParams,
805+
};
806+
748807
export {
749808
Browsers as Browsers,
750809
type BrowserPersistence as BrowserPersistence,
@@ -754,4 +813,9 @@ export declare namespace Kernel {
754813
type BrowserCreateParams as BrowserCreateParams,
755814
type BrowserDeleteParams as BrowserDeleteParams,
756815
};
816+
817+
export type ErrorDetail = API.ErrorDetail;
818+
export type ErrorEvent = API.ErrorEvent;
819+
export type ErrorModel = API.ErrorModel;
820+
export type LogEvent = API.LogEvent;
757821
}

0 commit comments

Comments
 (0)