diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 0ee8c01..2537c1f 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.0"
+ ".": "0.4.0"
}
diff --git a/.stats.yml b/.stats.yml
index d4463c3..be606c6 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 10
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-3edc7a0eef4a0d4495782efbdb0d9b777a55aee058dab119f90de56019441326.yml
-openapi_spec_hash: dff0b1efa1c1614cf770ed8327cefab2
-config_hash: cb04a4d88ee9f530b303ca57ff7090b3
+configured_endpoints: 11
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml
+openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6
+config_hash: b3fcacd707da56b21d31ce0baf4fb87d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1aedc0..49f18f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.4.0 (2025-05-28)
+
+Full Changelog: [v0.3.0...v0.4.0](https://github.com/onkernel/kernel-node-sdk/compare/v0.3.0...v0.4.0)
+
+### Features
+
+* **api:** update via SDK Studio ([4c5b6b6](https://github.com/onkernel/kernel-node-sdk/commit/4c5b6b6ecf8e34ced647b42dca75c5a2b5deaf87))
+
+
+### Chores
+
+* improve publish-npm script --latest tag logic ([ac1ab4f](https://github.com/onkernel/kernel-node-sdk/commit/ac1ab4f2c79dc4df0b405007e9d64999ce8ed362))
+
## 0.3.0 (2025-05-22)
Full Changelog: [v0.2.0...v0.3.0](https://github.com/onkernel/kernel-node-sdk/compare/v0.2.0...v0.3.0)
diff --git a/api.md b/api.md
index 6c5f238..6cef980 100644
--- a/api.md
+++ b/api.md
@@ -26,11 +26,13 @@ Types:
- InvocationCreateResponse
- InvocationRetrieveResponse
+- InvocationUpdateResponse
Methods:
- client.apps.invocations.create({ ...params }) -> InvocationCreateResponse
- client.apps.invocations.retrieve(id) -> InvocationRetrieveResponse
+- client.apps.invocations.update(id, { ...params }) -> InvocationUpdateResponse
# Browsers
diff --git a/bin/publish-npm b/bin/publish-npm
index 4c21181..2505dec 100644
--- a/bin/publish-npm
+++ b/bin/publish-npm
@@ -4,19 +4,35 @@ set -eux
npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"
-# Build the project
yarn build
-
-# Navigate to the dist directory
cd dist
-# Get the version from package.json
+# Get latest version from npm
+#
+# If the package doesn't exist, yarn will return
+# {"type":"error","data":"Received invalid response from npm."}
+# where .data.version doesn't exist so LAST_VERSION will be an empty string.
+LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')"
+
+# Get current version from package.json
VERSION="$(node -p "require('./package.json').version")"
-# Extract the pre-release tag if it exists
+# Check if current version is pre-release (e.g. alpha / beta / rc)
+CURRENT_IS_PRERELEASE=false
if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then
- # Extract the part before any dot in the pre-release identifier
- TAG="${BASH_REMATCH[1]}"
+ CURRENT_IS_PRERELEASE=true
+ CURRENT_TAG="${BASH_REMATCH[1]}"
+fi
+
+# Check if last version is a stable release
+LAST_IS_STABLE_RELEASE=true
+if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then
+ LAST_IS_STABLE_RELEASE=false
+fi
+
+# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease.
+if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then
+ TAG="$CURRENT_TAG"
else
TAG="latest"
fi
diff --git a/package.json b/package.json
index c5ebe61..a5f5e93 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
- "version": "0.3.0",
+ "version": "0.4.0",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
diff --git a/src/resources/apps/apps.ts b/src/resources/apps/apps.ts
index 7db2293..dbccad8 100644
--- a/src/resources/apps/apps.ts
+++ b/src/resources/apps/apps.ts
@@ -13,6 +13,8 @@ import {
InvocationCreateParams,
InvocationCreateResponse,
InvocationRetrieveResponse,
+ InvocationUpdateParams,
+ InvocationUpdateResponse,
Invocations,
} from './invocations';
import { APIPromise } from '../../core/api-promise';
@@ -99,6 +101,8 @@ export declare namespace Apps {
Invocations as Invocations,
type InvocationCreateResponse as InvocationCreateResponse,
type InvocationRetrieveResponse as InvocationRetrieveResponse,
+ type InvocationUpdateResponse as InvocationUpdateResponse,
type InvocationCreateParams as InvocationCreateParams,
+ type InvocationUpdateParams as InvocationUpdateParams,
};
}
diff --git a/src/resources/apps/index.ts b/src/resources/apps/index.ts
index 52ecdea..29751c0 100644
--- a/src/resources/apps/index.ts
+++ b/src/resources/apps/index.ts
@@ -11,5 +11,7 @@ export {
Invocations,
type InvocationCreateResponse,
type InvocationRetrieveResponse,
+ type InvocationUpdateResponse,
type InvocationCreateParams,
+ type InvocationUpdateParams,
} from './invocations';
diff --git a/src/resources/apps/invocations.ts b/src/resources/apps/invocations.ts
index 3f1e23a..dabbdb6 100644
--- a/src/resources/apps/invocations.ts
+++ b/src/resources/apps/invocations.ts
@@ -35,6 +35,25 @@ export class Invocations extends APIResource {
retrieve(id: string, options?: RequestOptions): APIPromise {
return this._client.get(path`/invocations/${id}`, options);
}
+
+ /**
+ * Update invocation status or output
+ *
+ * @example
+ * ```ts
+ * const invocation = await client.apps.invocations.update(
+ * 'id',
+ * { status: 'succeeded' },
+ * );
+ * ```
+ */
+ update(
+ id: string,
+ body: InvocationUpdateParams,
+ options?: RequestOptions,
+ ): APIPromise {
+ return this._client.patch(path`/invocations/${id}`, { body, ...options });
+ }
}
export interface InvocationCreateResponse {
@@ -109,6 +128,55 @@ export interface InvocationRetrieveResponse {
status_reason?: string;
}
+export interface InvocationUpdateResponse {
+ /**
+ * ID of the invocation
+ */
+ id: string;
+
+ /**
+ * Name of the action invoked
+ */
+ action_name: string;
+
+ /**
+ * Name of the application
+ */
+ app_name: string;
+
+ /**
+ * RFC 3339 Nanoseconds timestamp when the invocation started
+ */
+ started_at: string;
+
+ /**
+ * Status of the invocation
+ */
+ status: 'queued' | 'running' | 'succeeded' | 'failed';
+
+ /**
+ * RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
+ * running)
+ */
+ finished_at?: string | null;
+
+ /**
+ * Output produced by the action, rendered as a JSON string. This could be: string,
+ * number, boolean, array, object, or null.
+ */
+ output?: string;
+
+ /**
+ * Payload provided to the invocation. This is a string that can be parsed as JSON.
+ */
+ payload?: string;
+
+ /**
+ * Status reason
+ */
+ status_reason?: string;
+}
+
export interface InvocationCreateParams {
/**
* Name of the action to invoke
@@ -125,16 +193,36 @@ export interface InvocationCreateParams {
*/
version: string;
+ /**
+ * If true, invoke asynchronously. When set, the API responds 202 Accepted with
+ * status "queued".
+ */
+ async?: boolean;
+
/**
* Input data for the action, sent as a JSON string.
*/
payload?: string;
}
+export interface InvocationUpdateParams {
+ /**
+ * New status for the invocation.
+ */
+ status: 'succeeded' | 'failed';
+
+ /**
+ * Updated output of the invocation rendered as JSON string.
+ */
+ output?: string;
+}
+
export declare namespace Invocations {
export {
type InvocationCreateResponse as InvocationCreateResponse,
type InvocationRetrieveResponse as InvocationRetrieveResponse,
+ type InvocationUpdateResponse as InvocationUpdateResponse,
type InvocationCreateParams as InvocationCreateParams,
+ type InvocationUpdateParams as InvocationUpdateParams,
};
}
diff --git a/src/version.ts b/src/version.ts
index 88f4d40..4e7f788 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.3.0'; // x-release-please-version
+export const VERSION = '0.4.0'; // x-release-please-version
diff --git a/tests/api-resources/apps/invocations.test.ts b/tests/api-resources/apps/invocations.test.ts
index 4d76cc8..9a1b028 100644
--- a/tests/api-resources/apps/invocations.test.ts
+++ b/tests/api-resources/apps/invocations.test.ts
@@ -30,6 +30,7 @@ describe('resource invocations', () => {
action_name: 'analyze',
app_name: 'my-app',
version: '1.0.0',
+ async: true,
payload: '{"data":"example input"}',
});
});
@@ -45,4 +46,21 @@ describe('resource invocations', () => {
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
+
+ // skipped: tests are disabled for the time being
+ test.skip('update: only required params', async () => {
+ const responsePromise = client.apps.invocations.update('id', { status: 'succeeded' });
+ 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('update: required and optional params', async () => {
+ const response = await client.apps.invocations.update('id', { status: 'succeeded', output: 'output' });
+ });
});