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.9.1"
".": "0.10.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 31
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-b55c3e0424fa7733487139488b9fff00ad8949ff02ee3160ee36b9334e84b134.yml
openapi_spec_hash: 17f36677e3dc0a3aeb419654c8d5cae3
config_hash: f67e4b33b2fb30c1405ee2fff8096320
configured_endpoints: 41
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-a7c1df5070fe59642d7a1f168aa902a468227752bfc930cbf38930f7c205dbb6.yml
openapi_spec_hash: eab65e39aef4f0a0952b82adeecf6b5b
config_hash: 5de78bc29ac060562575cb54bb26826c
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## 0.10.0 (2025-08-27)

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

### Features

* **api:** new process, fs, and log endpoints ([0cceb4e](https://github.com/onkernel/kernel-node-sdk/commit/0cceb4e3be5b8e6d267f075f6d9f696f24b1d7f3))
* **mcp:** add code execution tool ([d3a08a9](https://github.com/onkernel/kernel-node-sdk/commit/d3a08a9e8bccbdf15e2404c9131f0969dc95be24))


### Chores

* add package to package.json ([294b1d8](https://github.com/onkernel/kernel-node-sdk/commit/294b1d85cbbe33ce1fd68f4fd879e95922b651c5))
* **client:** qualify global Blob ([7ac9358](https://github.com/onkernel/kernel-node-sdk/commit/7ac9358a1f9d8d2b12ea1f91cd54c1cb169abab9))
* **deps:** update dependency @types/node to v20.17.58 ([797f96b](https://github.com/onkernel/kernel-node-sdk/commit/797f96bd96877114412860f63f47e8ac16a7ab6c))
* **internal:** formatting change ([8a4b4cf](https://github.com/onkernel/kernel-node-sdk/commit/8a4b4cf31f313b0cbe2c8de9eed168519b702dd7))
* update CI script ([b0aabec](https://github.com/onkernel/kernel-node-sdk/commit/b0aabec18bf5b0f50264e42fd460b80a347db4a1))

## 0.9.1 (2025-08-15)

Full Changelog: [v0.9.0...v0.9.1](https://github.com/onkernel/kernel-node-sdk/compare/v0.9.0...v0.9.1)
Expand Down
29 changes: 29 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ Methods:
- <code title="put /browsers/{id}/fs/create_directory">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">createDirectory</a>(id, { ...params }) -> void</code>
- <code title="put /browsers/{id}/fs/delete_directory">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">deleteDirectory</a>(id, { ...params }) -> void</code>
- <code title="put /browsers/{id}/fs/delete_file">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">deleteFile</a>(id, { ...params }) -> void</code>
- <code title="get /browsers/{id}/fs/download_dir_zip">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">downloadDirZip</a>(id, { ...params }) -> Response</code>
- <code title="get /browsers/{id}/fs/file_info">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">fileInfo</a>(id, { ...params }) -> FFileInfoResponse</code>
- <code title="get /browsers/{id}/fs/list_files">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">listFiles</a>(id, { ...params }) -> FListFilesResponse</code>
- <code title="put /browsers/{id}/fs/move">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">move</a>(id, { ...params }) -> void</code>
- <code title="get /browsers/{id}/fs/read_file">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">readFile</a>(id, { ...params }) -> Response</code>
- <code title="put /browsers/{id}/fs/set_file_permissions">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">setFilePermissions</a>(id, { ...params }) -> void</code>
- <code title="post /browsers/{id}/fs/upload">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">upload</a>(id, { ...params }) -> void</code>
- <code title="post /browsers/{id}/fs/upload_zip">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">uploadZip</a>(id, { ...params }) -> void</code>
- <code title="put /browsers/{id}/fs/write_file">client.browsers.fs.<a href="./src/resources/browsers/fs/fs.ts">writeFile</a>(id, contents, { ...params }) -> void</code>

### Watch
Expand All @@ -116,3 +119,29 @@ Methods:
- <code title="get /browsers/{id}/fs/watch/{watch_id}/events">client.browsers.fs.watch.<a href="./src/resources/browsers/fs/watch.ts">events</a>(watchID, { ...params }) -> WatchEventsResponse</code>
- <code title="post /browsers/{id}/fs/watch">client.browsers.fs.watch.<a href="./src/resources/browsers/fs/watch.ts">start</a>(id, { ...params }) -> WatchStartResponse</code>
- <code title="delete /browsers/{id}/fs/watch/{watch_id}">client.browsers.fs.watch.<a href="./src/resources/browsers/fs/watch.ts">stop</a>(watchID, { ...params }) -> void</code>

## Process

Types:

- <code><a href="./src/resources/browsers/process.ts">ProcessExecResponse</a></code>
- <code><a href="./src/resources/browsers/process.ts">ProcessKillResponse</a></code>
- <code><a href="./src/resources/browsers/process.ts">ProcessSpawnResponse</a></code>
- <code><a href="./src/resources/browsers/process.ts">ProcessStatusResponse</a></code>
- <code><a href="./src/resources/browsers/process.ts">ProcessStdinResponse</a></code>
- <code><a href="./src/resources/browsers/process.ts">ProcessStdoutStreamResponse</a></code>

Methods:

- <code title="post /browsers/{id}/process/exec">client.browsers.process.<a href="./src/resources/browsers/process.ts">exec</a>(id, { ...params }) -> ProcessExecResponse</code>
- <code title="post /browsers/{id}/process/{process_id}/kill">client.browsers.process.<a href="./src/resources/browsers/process.ts">kill</a>(processID, { ...params }) -> ProcessKillResponse</code>
- <code title="post /browsers/{id}/process/spawn">client.browsers.process.<a href="./src/resources/browsers/process.ts">spawn</a>(id, { ...params }) -> ProcessSpawnResponse</code>
- <code title="get /browsers/{id}/process/{process_id}/status">client.browsers.process.<a href="./src/resources/browsers/process.ts">status</a>(processID, { ...params }) -> ProcessStatusResponse</code>
- <code title="post /browsers/{id}/process/{process_id}/stdin">client.browsers.process.<a href="./src/resources/browsers/process.ts">stdin</a>(processID, { ...params }) -> ProcessStdinResponse</code>
- <code title="get /browsers/{id}/process/{process_id}/stdout/stream">client.browsers.process.<a href="./src/resources/browsers/process.ts">stdoutStream</a>(processID, { ...params }) -> ProcessStdoutStreamResponse</code>

## Logs

Methods:

- <code title="get /browsers/{id}/logs/stream">client.browsers.logs.<a href="./src/resources/browsers/logs.ts">stream</a>(id, { ...params }) -> LogEvent</code>
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onkernel/sdk",
"version": "0.9.1",
"version": "0.10.0",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -44,8 +44,9 @@
"publint": "^0.2.12",
"ts-jest": "^29.1.0",
"ts-node": "^10.5.0",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz",
"tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz",
"tsconfig-paths": "^4.0.0",
"tslib": "^2.8.1",
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ echo "==> Installing Node dependencies…"

PACKAGE_MANAGER=$(command -v yarn >/dev/null 2>&1 && echo "yarn" || echo "npm")

$PACKAGE_MANAGER install
$PACKAGE_MANAGER install "$@"
2 changes: 1 addition & 1 deletion scripts/utils/upload-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi

UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \
UPLOAD_RESPONSE=$(tar -cz "${BUILD_PATH:-dist}" | curl -v -X PUT \
-H "Content-Type: application/gzip" \
--data-binary @- "$SIGNED_URL" 2>&1)

Expand Down
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ export class Kernel {
// Preserve legacy string encoding behavior for now
headers.values.has('content-type')) ||
// `Blob` is superset of `File`
body instanceof Blob ||
((globalThis as any).Blob && body instanceof (globalThis as any).Blob) ||
// `FormData` -> `multipart/form-data`
body instanceof FormData ||
// `URLSearchParams` -> `application/x-www-form-urlencoded`
Expand Down Expand Up @@ -796,10 +796,12 @@ export class Kernel {
invocations: API.Invocations = new API.Invocations(this);
browsers: API.Browsers = new API.Browsers(this);
}

Kernel.Deployments = Deployments;
Kernel.Apps = Apps;
Kernel.Invocations = Invocations;
Kernel.Browsers = Browsers;

export declare namespace Kernel {
export type RequestOptions = Opts.RequestOptions;

Expand Down
46 changes: 46 additions & 0 deletions src/resources/browsers/browsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

import { APIResource } from '../../core/resource';
import * as BrowsersAPI from './browsers';
import * as LogsAPI from './logs';
import { LogStreamParams, Logs } from './logs';
import * as ProcessAPI from './process';
import {
Process,
ProcessExecParams,
ProcessExecResponse,
ProcessKillParams,
ProcessKillResponse,
ProcessSpawnParams,
ProcessSpawnResponse,
ProcessStatusParams,
ProcessStatusResponse,
ProcessStdinParams,
ProcessStdinResponse,
ProcessStdoutStreamParams,
ProcessStdoutStreamResponse,
} from './process';
import * as ReplaysAPI from './replays';
import {
ReplayDownloadParams,
Expand All @@ -16,13 +34,16 @@ import {
FCreateDirectoryParams,
FDeleteDirectoryParams,
FDeleteFileParams,
FDownloadDirZipParams,
FFileInfoParams,
FFileInfoResponse,
FListFilesParams,
FListFilesResponse,
FMoveParams,
FReadFileParams,
FSetFilePermissionsParams,
FUploadParams,
FUploadZipParams,
FWriteFileParams,
Fs,
} from './fs/fs';
Expand All @@ -34,6 +55,8 @@ import { path } from '../../internal/utils/path';
export class Browsers extends APIResource {
replays: ReplaysAPI.Replays = new ReplaysAPI.Replays(this._client);
fs: FsAPI.Fs = new FsAPI.Fs(this._client);
process: ProcessAPI.Process = new ProcessAPI.Process(this._client);
logs: LogsAPI.Logs = new LogsAPI.Logs(this._client);

/**
* Create a new browser session from within an action.
Expand Down Expand Up @@ -296,6 +319,8 @@ export interface BrowserDeleteParams {

Browsers.Replays = Replays;
Browsers.Fs = Fs;
Browsers.Process = Process;
Browsers.Logs = Logs;

export declare namespace Browsers {
export {
Expand Down Expand Up @@ -323,11 +348,32 @@ export declare namespace Browsers {
type FCreateDirectoryParams as FCreateDirectoryParams,
type FDeleteDirectoryParams as FDeleteDirectoryParams,
type FDeleteFileParams as FDeleteFileParams,
type FDownloadDirZipParams as FDownloadDirZipParams,
type FFileInfoParams as FFileInfoParams,
type FListFilesParams as FListFilesParams,
type FMoveParams as FMoveParams,
type FReadFileParams as FReadFileParams,
type FSetFilePermissionsParams as FSetFilePermissionsParams,
type FUploadParams as FUploadParams,
type FUploadZipParams as FUploadZipParams,
type FWriteFileParams as FWriteFileParams,
};

export {
Process as Process,
type ProcessExecResponse as ProcessExecResponse,
type ProcessKillResponse as ProcessKillResponse,
type ProcessSpawnResponse as ProcessSpawnResponse,
type ProcessStatusResponse as ProcessStatusResponse,
type ProcessStdinResponse as ProcessStdinResponse,
type ProcessStdoutStreamResponse as ProcessStdoutStreamResponse,
type ProcessExecParams as ProcessExecParams,
type ProcessKillParams as ProcessKillParams,
type ProcessSpawnParams as ProcessSpawnParams,
type ProcessStatusParams as ProcessStatusParams,
type ProcessStdinParams as ProcessStdinParams,
type ProcessStdoutStreamParams as ProcessStdoutStreamParams,
};

export { Logs as Logs, type LogStreamParams as LogStreamParams };
}
105 changes: 105 additions & 0 deletions src/resources/browsers/fs/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import {
WatchStopParams,
} from './watch';
import { APIPromise } from '../../../core/api-promise';
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 Fs extends APIResource {
Expand Down Expand Up @@ -70,6 +72,29 @@ export class Fs extends APIResource {
});
}

/**
* Returns a ZIP file containing the contents of the specified directory.
*
* @example
* ```ts
* const response = await client.browsers.fs.downloadDirZip(
* 'id',
* { path: '/J!' },
* );
*
* const content = await response.blob();
* console.log(content);
* ```
*/
downloadDirZip(id: string, query: FDownloadDirZipParams, options?: RequestOptions): APIPromise<Response> {
return this._client.get(path`/browsers/${id}/fs/download_dir_zip`, {
query,
...options,
headers: buildHeaders([{ Accept: 'application/zip' }, options?.headers]),
__binaryResponse: true,
});
}

/**
* Get information about a file or directory
*
Expand Down Expand Up @@ -162,6 +187,52 @@ export class Fs extends APIResource {
});
}

/**
* Allows uploading single or multiple files to the remote filesystem.
*
* @example
* ```ts
* await client.browsers.fs.upload('id', {
* files: [
* {
* dest_path: '/J!',
* file: fs.createReadStream('path/to/file'),
* },
* ],
* });
* ```
*/
upload(id: string, body: FUploadParams, options?: RequestOptions): APIPromise<void> {
return this._client.post(
path`/browsers/${id}/fs/upload`,
multipartFormRequestOptions(
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
this._client,
),
);
}

/**
* Upload a zip file and extract its contents to the specified destination path.
*
* @example
* ```ts
* await client.browsers.fs.uploadZip('id', {
* dest_path: '/J!',
* zip_file: fs.createReadStream('path/to/file'),
* });
* ```
*/
uploadZip(id: string, body: FUploadZipParams, options?: RequestOptions): APIPromise<void> {
return this._client.post(
path`/browsers/${id}/fs/upload_zip`,
multipartFormRequestOptions(
{ body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]) },
this._client,
),
);
}

/**
* Write or create a file
*
Expand Down Expand Up @@ -290,6 +361,13 @@ export interface FDeleteFileParams {
path: string;
}

export interface FDownloadDirZipParams {
/**
* Absolute directory path to archive and download.
*/
path: string;
}

export interface FFileInfoParams {
/**
* Absolute path of the file or directory.
Expand Down Expand Up @@ -345,6 +423,30 @@ export interface FSetFilePermissionsParams {
owner?: string;
}

export interface FUploadParams {
files: Array<FUploadParams.File>;
}

export namespace FUploadParams {
export interface File {
/**
* Absolute destination path to write the file.
*/
dest_path: string;

file: Uploadable;
}
}

export interface FUploadZipParams {
/**
* Absolute destination directory to extract the archive to.
*/
dest_path: string;

zip_file: Uploadable;
}

export interface FWriteFileParams {
/**
* Query param: Destination absolute file path.
Expand All @@ -366,11 +468,14 @@ export declare namespace Fs {
type FCreateDirectoryParams as FCreateDirectoryParams,
type FDeleteDirectoryParams as FDeleteDirectoryParams,
type FDeleteFileParams as FDeleteFileParams,
type FDownloadDirZipParams as FDownloadDirZipParams,
type FFileInfoParams as FFileInfoParams,
type FListFilesParams as FListFilesParams,
type FMoveParams as FMoveParams,
type FReadFileParams as FReadFileParams,
type FSetFilePermissionsParams as FSetFilePermissionsParams,
type FUploadParams as FUploadParams,
type FUploadZipParams as FUploadZipParams,
type FWriteFileParams as FWriteFileParams,
};

Expand Down
Loading