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.23.0"
".": "0.24.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: 82
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-dac11bdb857e700a8c39d183e753ddd1ebaaca69fd9fc5ee57d6b56b70b00e6e.yml
openapi_spec_hash: 78fbc50dd0b61cdc87564fbea278ee23
config_hash: a4b4d14bdf6af723b235a6981977627c
configured_endpoints: 89
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-13214b99e392aab631aa1ca99b6a51a58df81e34156d21b8d639bea779566123.yml
openapi_spec_hash: a88d175fc3980de3097ac1411d8dcbff
config_hash: 179f33af31ece83563163d5b3d751d13
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.24.0 (2025-12-17)

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

### Features

* Enhance AuthAgentInvocationCreateResponse to include already_authenti… ([70cd6d6](https://github.com/onkernel/kernel-node-sdk/commit/70cd6d6c44fa9f90a5bfad3e6268bd6264a9f83b))
* Fix browser pool sdk types ([e4b773f](https://github.com/onkernel/kernel-node-sdk/commit/e4b773f9923b1bf4fcda5bd2c9832cbb291981bd))

## 0.23.0 (2025-12-11)

Full Changelog: [v0.22.0...v0.23.0](https://github.com/onkernel/kernel-node-sdk/compare/v0.22.0...v0.23.0)
Expand Down
23 changes: 19 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ Methods:
Types:

- <code><a href="./src/resources/browser-pools.ts">BrowserPool</a></code>
- <code><a href="./src/resources/browser-pools.ts">BrowserPoolAcquireRequest</a></code>
- <code><a href="./src/resources/browser-pools.ts">BrowserPoolReleaseRequest</a></code>
- <code><a href="./src/resources/browser-pools.ts">BrowserPoolRequest</a></code>
- <code><a href="./src/resources/browser-pools.ts">BrowserPoolUpdateRequest</a></code>
- <code><a href="./src/resources/browser-pools.ts">BrowserPoolListResponse</a></code>
- <code><a href="./src/resources/browser-pools.ts">BrowserPoolAcquireResponse</a></code>

Expand Down Expand Up @@ -261,12 +257,15 @@ Types:
- <code><a href="./src/resources/agents/auth/auth.ts">AuthAgentInvocationCreateRequest</a></code>
- <code><a href="./src/resources/agents/auth/auth.ts">AuthAgentInvocationCreateResponse</a></code>
- <code><a href="./src/resources/agents/auth/auth.ts">DiscoveredField</a></code>
- <code><a href="./src/resources/agents/auth/auth.ts">ReauthResponse</a></code>

Methods:

- <code title="post /agents/auth">client.agents.auth.<a href="./src/resources/agents/auth/auth.ts">create</a>({ ...params }) -> AuthAgent</code>
- <code title="get /agents/auth/{id}">client.agents.auth.<a href="./src/resources/agents/auth/auth.ts">retrieve</a>(id) -> AuthAgent</code>
- <code title="get /agents/auth">client.agents.auth.<a href="./src/resources/agents/auth/auth.ts">list</a>({ ...params }) -> AuthAgentsOffsetPagination</code>
- <code title="delete /agents/auth/{id}">client.agents.auth.<a href="./src/resources/agents/auth/auth.ts">delete</a>(id) -> void</code>
- <code title="post /agents/auth/{id}/reauth">client.agents.auth.<a href="./src/resources/agents/auth/auth.ts">reauth</a>(id) -> ReauthResponse</code>

### Invocations

Expand All @@ -281,3 +280,19 @@ Methods:
- <code title="post /agents/auth/invocations/{invocation_id}/discover">client.agents.auth.invocations.<a href="./src/resources/agents/auth/invocations.ts">discover</a>(invocationID, { ...params }) -> AgentAuthDiscoverResponse</code>
- <code title="post /agents/auth/invocations/{invocation_id}/exchange">client.agents.auth.invocations.<a href="./src/resources/agents/auth/invocations.ts">exchange</a>(invocationID, { ...params }) -> InvocationExchangeResponse</code>
- <code title="post /agents/auth/invocations/{invocation_id}/submit">client.agents.auth.invocations.<a href="./src/resources/agents/auth/invocations.ts">submit</a>(invocationID, { ...params }) -> AgentAuthSubmitResponse</code>

# Credentials

Types:

- <code><a href="./src/resources/credentials.ts">CreateCredentialRequest</a></code>
- <code><a href="./src/resources/credentials.ts">Credential</a></code>
- <code><a href="./src/resources/credentials.ts">UpdateCredentialRequest</a></code>

Methods:

- <code title="post /credentials">client.credentials.<a href="./src/resources/credentials.ts">create</a>({ ...params }) -> Credential</code>
- <code title="get /credentials/{id}">client.credentials.<a href="./src/resources/credentials.ts">retrieve</a>(id) -> Credential</code>
- <code title="patch /credentials/{id}">client.credentials.<a href="./src/resources/credentials.ts">update</a>(id, { ...params }) -> Credential</code>
- <code title="get /credentials">client.credentials.<a href="./src/resources/credentials.ts">list</a>({ ...params }) -> CredentialsOffsetPagination</code>
- <code title="delete /credentials/{id}">client.credentials.<a href="./src/resources/credentials.ts">delete</a>(id) -> void</code>
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.23.0",
"version": "0.24.0",
"description": "The official TypeScript library for the Kernel API",
"author": "Kernel <>",
"types": "dist/index.d.ts",
Expand Down
31 changes: 23 additions & 8 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,24 @@ import { AppListParams, AppListResponse, AppListResponsesOffsetPagination, Apps
import {
BrowserPool,
BrowserPoolAcquireParams,
BrowserPoolAcquireRequest,
BrowserPoolAcquireResponse,
BrowserPoolCreateParams,
BrowserPoolDeleteParams,
BrowserPoolListResponse,
BrowserPoolReleaseParams,
BrowserPoolReleaseRequest,
BrowserPoolRequest,
BrowserPoolUpdateParams,
BrowserPoolUpdateRequest,
BrowserPools,
} from './resources/browser-pools';
import {
CreateCredentialRequest,
Credential,
CredentialCreateParams,
CredentialListParams,
CredentialUpdateParams,
Credentials,
CredentialsOffsetPagination,
UpdateCredentialRequest,
} from './resources/credentials';
import {
DeploymentCreateParams,
DeploymentCreateResponse,
Expand Down Expand Up @@ -861,6 +867,7 @@ export class Kernel {
extensions: API.Extensions = new API.Extensions(this);
browserPools: API.BrowserPools = new API.BrowserPools(this);
agents: API.Agents = new API.Agents(this);
credentials: API.Credentials = new API.Credentials(this);
}

Kernel.Deployments = Deployments;
Expand All @@ -872,6 +879,7 @@ Kernel.Proxies = Proxies;
Kernel.Extensions = Extensions;
Kernel.BrowserPools = BrowserPools;
Kernel.Agents = Agents;
Kernel.Credentials = Credentials;

export declare namespace Kernel {
export type RequestOptions = Opts.RequestOptions;
Expand Down Expand Up @@ -956,10 +964,6 @@ export declare namespace Kernel {
export {
BrowserPools as BrowserPools,
type BrowserPool as BrowserPool,
type BrowserPoolAcquireRequest as BrowserPoolAcquireRequest,
type BrowserPoolReleaseRequest as BrowserPoolReleaseRequest,
type BrowserPoolRequest as BrowserPoolRequest,
type BrowserPoolUpdateRequest as BrowserPoolUpdateRequest,
type BrowserPoolListResponse as BrowserPoolListResponse,
type BrowserPoolAcquireResponse as BrowserPoolAcquireResponse,
type BrowserPoolCreateParams as BrowserPoolCreateParams,
Expand All @@ -971,6 +975,17 @@ export declare namespace Kernel {

export { Agents as Agents };

export {
Credentials as Credentials,
type CreateCredentialRequest as CreateCredentialRequest,
type Credential as Credential,
type UpdateCredentialRequest as UpdateCredentialRequest,
type CredentialsOffsetPagination as CredentialsOffsetPagination,
type CredentialCreateParams as CredentialCreateParams,
type CredentialUpdateParams as CredentialUpdateParams,
type CredentialListParams as CredentialListParams,
};

export type AppAction = API.AppAction;
export type BrowserExtension = API.BrowserExtension;
export type BrowserProfile = API.BrowserProfile;
Expand Down
2 changes: 2 additions & 0 deletions src/resources/agents/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
AuthCreateParams,
AuthListParams,
DiscoveredField,
ReauthResponse,
} from './auth/auth';

export class Agents extends APIResource {
Expand All @@ -34,6 +35,7 @@ export declare namespace Agents {
type AuthAgentInvocationCreateRequest as AuthAgentInvocationCreateRequest,
type AuthAgentInvocationCreateResponse as AuthAgentInvocationCreateResponse,
type DiscoveredField as DiscoveredField,
type ReauthResponse as ReauthResponse,
type AuthAgentsOffsetPagination as AuthAgentsOffsetPagination,
type AuthCreateParams as AuthCreateParams,
type AuthListParams as AuthListParams,
Expand Down
152 changes: 138 additions & 14 deletions src/resources/agents/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from './invocations';
import { APIPromise } from '../../../core/api-promise';
import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../../core/pagination';
import { buildHeaders } from '../../../internal/headers';
import { RequestOptions } from '../../../internal/request-options';
import { path } from '../../../internal/utils/path';

Expand Down Expand Up @@ -66,6 +67,42 @@ export class Auth extends APIResource {
): PagePromise<AuthAgentsOffsetPagination, AuthAgent> {
return this._client.getAPIList('/agents/auth', OffsetPagination<AuthAgent>, { query, ...options });
}

/**
* Deletes an auth agent and terminates its workflow. This will:
*
* - Soft delete the auth agent record
* - Gracefully terminate the agent's Temporal workflow
* - Cancel any in-progress invocations
*
* @example
* ```ts
* await client.agents.auth.delete('id');
* ```
*/
delete(id: string, options?: RequestOptions): APIPromise<void> {
return this._client.delete(path`/agents/auth/${id}`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}

/**
* Triggers automatic re-authentication for an auth agent using stored credentials.
* Requires the auth agent to have a linked credential, stored selectors, and
* login_url. Returns immediately with status indicating whether re-auth was
* started.
*
* @example
* ```ts
* const reauthResponse = await client.agents.auth.reauth(
* 'id',
* );
* ```
*/
reauth(id: string, options?: RequestOptions): APIPromise<ReauthResponse> {
return this._client.post(path`/agents/auth/${id}/reauth`, options);
}
}

export type AuthAgentsOffsetPagination = OffsetPagination<AuthAgent>;
Expand Down Expand Up @@ -196,6 +233,27 @@ export interface AuthAgent {
*/
status: 'AUTHENTICATED' | 'NEEDS_AUTH';

/**
* Whether automatic re-authentication is possible (has credential_id, selectors,
* and login_url)
*/
can_reauth?: boolean;

/**
* ID of the linked credential for automatic re-authentication
*/
credential_id?: string;

/**
* Name of the linked credential for automatic re-authentication
*/
credential_name?: string;

/**
* Whether this auth agent has stored selectors for deterministic re-authentication
*/
has_selectors?: boolean;

/**
* When the last authentication check was performed
*/
Expand All @@ -216,6 +274,13 @@ export interface AuthAgentCreateRequest {
*/
target_domain: string;

/**
* Optional name of an existing credential to use for this auth agent. If provided,
* the credential will be linked to the agent and its values will be used to
* auto-fill the login form on invocation.
*/
credential_name?: string;

/**
* Optional login page URL. If provided, will be stored on the agent and used to
* skip discovery in future invocations.
Expand Down Expand Up @@ -248,31 +313,62 @@ export interface AuthAgentInvocationCreateRequest {
* ID of the auth agent to create an invocation for
*/
auth_agent_id: string;

/**
* If provided, saves the submitted credentials under this name upon successful
* login. The credential will be linked to the auth agent for automatic
* re-authentication.
*/
save_credential_as?: string;
}

/**
* Response from creating an auth agent invocation
* Response when the agent is already authenticated.
*/
export interface AuthAgentInvocationCreateResponse {
/**
* When the handoff code expires
*/
expires_at: string;
export type AuthAgentInvocationCreateResponse =
| AuthAgentInvocationCreateResponse.AuthAgentAlreadyAuthenticated
| AuthAgentInvocationCreateResponse.AuthAgentInvocationCreated;

export namespace AuthAgentInvocationCreateResponse {
/**
* One-time code for handoff
* Response when the agent is already authenticated.
*/
handoff_code: string;
export interface AuthAgentAlreadyAuthenticated {
/**
* Indicates the agent is already authenticated and no invocation was created.
*/
status: 'already_authenticated';
}

/**
* URL to redirect user to
* Response when a new invocation was created.
*/
hosted_url: string;
export interface AuthAgentInvocationCreated {
/**
* When the handoff code expires.
*/
expires_at: string;

/**
* Unique identifier for the invocation
*/
invocation_id: string;
/**
* One-time code for handoff.
*/
handoff_code: string;

/**
* URL to redirect user to.
*/
hosted_url: string;

/**
* Unique identifier for the invocation.
*/
invocation_id: string;

/**
* Indicates an invocation was created.
*/
status: 'invocation_created';
}
}

/**
Expand Down Expand Up @@ -310,6 +406,26 @@ export interface DiscoveredField {
required?: boolean;
}

/**
* Response from triggering re-authentication
*/
export interface ReauthResponse {
/**
* Result of the re-authentication attempt
*/
status: 'reauth_started' | 'already_authenticated' | 'cannot_reauth';

/**
* ID of the re-auth invocation if one was created
*/
invocation_id?: string;

/**
* Human-readable description of the result
*/
message?: string;
}

export interface AuthCreateParams {
/**
* Name of the profile to use for this auth agent
Expand All @@ -321,6 +437,13 @@ export interface AuthCreateParams {
*/
target_domain: string;

/**
* Optional name of an existing credential to use for this auth agent. If provided,
* the credential will be linked to the agent and its values will be used to
* auto-fill the login form on invocation.
*/
credential_name?: string;

/**
* Optional login page URL. If provided, will be stored on the agent and used to
* skip discovery in future invocations.
Expand Down Expand Up @@ -369,6 +492,7 @@ export declare namespace Auth {
type AuthAgentInvocationCreateRequest as AuthAgentInvocationCreateRequest,
type AuthAgentInvocationCreateResponse as AuthAgentInvocationCreateResponse,
type DiscoveredField as DiscoveredField,
type ReauthResponse as ReauthResponse,
type AuthAgentsOffsetPagination as AuthAgentsOffsetPagination,
type AuthCreateParams as AuthCreateParams,
type AuthListParams as AuthListParams,
Expand Down
Loading