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.6.1"
".": "0.6.2"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 16
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-b019e469425a59061f37c5fdc7a131a5291c66134ef0627db4f06bb1f4af0b15.yml
openapi_spec_hash: f66a3c2efddb168db9539ba2507b10b8
config_hash: aae6721b2be9ec8565dfc8f7eadfe105
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2aec229ccf91f7c1ac95aa675ea2a59bd61af9e363a22c3b49677992f1eeb16a.yml
openapi_spec_hash: c80cd5d52a79cd5366a76d4a825bd27a
config_hash: b8e1fff080fbaa22656ab0a57b591777
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 0.6.2 (2025-06-24)

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

### Features

* **api:** add `since` parameter to deployment logs endpoint ([178712c](https://github.com/onkernel/kernel-node-sdk/commit/178712ccb7c7f326df11c6c63e3ca02697a793b4))


### Bug Fixes

* **client:** explicitly copy fetch in withOptions ([9859602](https://github.com/onkernel/kernel-node-sdk/commit/98596028a28e39d7b5bf7253f0a950aba5144e57))


### Chores

* **readme:** use better example snippet for undocumented params ([e8633e0](https://github.com/onkernel/kernel-node-sdk/commit/e8633e0ef4dbeb73d964ce86e74bc75288c04594))


### Refactors

* **types:** replace Record with mapped types ([73ff4fa](https://github.com/onkernel/kernel-node-sdk/commit/73ff4fa307465ad81a01070d9eb4e1ff1f7e5bd8))

## 0.6.1 (2025-06-18)

Full Changelog: [v0.6.0...v0.6.1](https://github.com/onkernel/kernel-node-sdk/compare/v0.6.0...v0.6.1)
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,8 @@ parameter. This library doesn't validate at runtime that the request matches the
send will be sent as-is.

```ts
client.foo.create({
foo: 'my_param',
bar: 12,
client.apps.deployments.create({
// ...
// @ts-expect-error baz is not yet public
baz: 'undocumented option',
});
Expand Down
3 changes: 2 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Types:
- <code><a href="./src/resources/shared.ts">ErrorDetail</a></code>
- <code><a href="./src/resources/shared.ts">ErrorEvent</a></code>
- <code><a href="./src/resources/shared.ts">ErrorModel</a></code>
- <code><a href="./src/resources/shared.ts">HeartbeatEvent</a></code>
- <code><a href="./src/resources/shared.ts">LogEvent</a></code>

# Deployments
Expand All @@ -20,7 +21,7 @@ Methods:

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

# Apps

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.6.1",
"version": "0.6.2",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import {
DeploymentCreateParams,
DeploymentCreateResponse,
DeploymentFollowParams,
DeploymentFollowResponse,
DeploymentRetrieveResponse,
DeploymentStateEvent,
Expand Down Expand Up @@ -233,6 +234,7 @@ export class Kernel {
timeout: this.timeout,
logger: this.logger,
logLevel: this.logLevel,
fetch: this.fetch,
fetchOptions: this.fetchOptions,
apiKey: this.apiKey,
...options,
Expand Down Expand Up @@ -789,6 +791,7 @@ export declare namespace Kernel {
type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
type DeploymentFollowResponse as DeploymentFollowResponse,
type DeploymentCreateParams as DeploymentCreateParams,
type DeploymentFollowParams as DeploymentFollowParams,
};

export { Apps as Apps, type AppListResponse as AppListResponse, type AppListParams as AppListParams };
Expand Down Expand Up @@ -817,5 +820,6 @@ export declare namespace Kernel {
export type ErrorDetail = API.ErrorDetail;
export type ErrorEvent = API.ErrorEvent;
export type ErrorModel = API.ErrorModel;
export type HeartbeatEvent = API.HeartbeatEvent;
export type LogEvent = API.LogEvent;
}
7 changes: 6 additions & 1 deletion src/resources/apps/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export namespace AppListResponse {
*/
app_name: string;

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

/**
* Deployment region code
*/
Expand All @@ -57,7 +62,7 @@ export namespace AppListResponse {
/**
* Environment variables configured for this app version
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/resources/apps/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ export namespace DeploymentCreateResponse {
export type DeploymentFollowResponse =
| DeploymentFollowResponse.StateEvent
| DeploymentFollowResponse.StateUpdateEvent
| Shared.LogEvent;
| Shared.LogEvent
| Shared.HeartbeatEvent;

export namespace DeploymentFollowResponse {
/**
Expand Down Expand Up @@ -156,7 +157,7 @@ export interface DeploymentCreateParams {
* Map of environment variables to set for the deployed application. Each key-value
* pair represents an environment variable.
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };

/**
* Allow overwriting an existing app version
Expand Down
28 changes: 21 additions & 7 deletions src/resources/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ export class Deployments extends APIResource {
* const response = await client.deployments.follow('id');
* ```
*/
follow(id: string, options?: RequestOptions): APIPromise<Stream<DeploymentFollowResponse>> {
follow(
id: string,
query: DeploymentFollowParams | undefined = {},
options?: RequestOptions,
): APIPromise<Stream<DeploymentFollowResponse>> {
return this._client.get(path`/deployments/${id}/events`, {
query,
...options,
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
stream: true,
Expand Down Expand Up @@ -110,7 +115,7 @@ export namespace DeploymentStateEvent {
/**
* Environment variables configured for this deployment
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };

/**
* Status reason
Expand Down Expand Up @@ -156,7 +161,7 @@ export interface DeploymentCreateResponse {
/**
* Environment variables configured for this deployment
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };

/**
* Status reason
Expand Down Expand Up @@ -201,7 +206,7 @@ export interface DeploymentRetrieveResponse {
/**
* Environment variables configured for this deployment
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };

/**
* Status reason
Expand All @@ -221,7 +226,8 @@ export type DeploymentFollowResponse =
| Shared.LogEvent
| DeploymentStateEvent
| DeploymentFollowResponse.AppVersionSummaryEvent
| Shared.ErrorEvent;
| Shared.ErrorEvent
| Shared.HeartbeatEvent;

export namespace DeploymentFollowResponse {
/**
Expand Down Expand Up @@ -266,7 +272,7 @@ export namespace DeploymentFollowResponse {
/**
* Environment variables configured for this app version
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };
}

export namespace AppVersionSummaryEvent {
Expand Down Expand Up @@ -297,7 +303,7 @@ export interface DeploymentCreateParams {
* Map of environment variables to set for the deployed application. Each key-value
* pair represents an environment variable.
*/
env_vars?: Record<string, string>;
env_vars?: { [key: string]: string };

/**
* Allow overwriting an existing app version
Expand All @@ -315,12 +321,20 @@ export interface DeploymentCreateParams {
version?: string;
}

export interface DeploymentFollowParams {
/**
* Show logs since the given time (RFC timestamps or durations like 5m).
*/
since?: string;
}

export declare namespace Deployments {
export {
type DeploymentStateEvent as DeploymentStateEvent,
type DeploymentCreateResponse as DeploymentCreateResponse,
type DeploymentRetrieveResponse as DeploymentRetrieveResponse,
type DeploymentFollowResponse as DeploymentFollowResponse,
type DeploymentCreateParams as DeploymentCreateParams,
type DeploymentFollowParams as DeploymentFollowParams,
};
}
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export {
type DeploymentRetrieveResponse,
type DeploymentFollowResponse,
type DeploymentCreateParams,
type DeploymentFollowParams,
} from './deployments';
export {
Invocations,
Expand Down
6 changes: 5 additions & 1 deletion src/resources/invocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,11 @@ export interface InvocationUpdateResponse {
/**
* Union type representing any invocation event.
*/
export type InvocationFollowResponse = Shared.LogEvent | InvocationStateEvent | Shared.ErrorEvent;
export type InvocationFollowResponse =
| Shared.LogEvent
| InvocationStateEvent
| Shared.ErrorEvent
| Shared.HeartbeatEvent;

export interface InvocationCreateParams {
/**
Expand Down
15 changes: 15 additions & 0 deletions src/resources/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ export interface ErrorModel {
inner_error?: ErrorDetail;
}

/**
* Heartbeat event sent periodically to keep SSE connection alive.
*/
export interface HeartbeatEvent {
/**
* Event type identifier (always "sse_heartbeat").
*/
event: 'sse_heartbeat';

/**
* Time the heartbeat was sent.
*/
timestamp: string;
}

/**
* A log entry from the application.
*/
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.6.1'; // x-release-please-version
export const VERSION = '0.6.2'; // x-release-please-version
12 changes: 12 additions & 0 deletions tests/api-resources/deployments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,16 @@ describe('resource deployments', () => {
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});

// skipped: currently no good way to test endpoints with content type text/event-stream, Prism mock server will fail
test.skip('follow: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
client.deployments.follow(
'id',
{ since: '2025-06-20T12:00:00Z' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Kernel.NotFoundError);
});
});