This commit is contained in:
Shuchang Zheng
2026-02-17 20:30:55 -08:00
committed by GitHub
parent fd8c33e0af
commit fc41285f96
30 changed files with 4013 additions and 2733 deletions

View File

@@ -26,8 +26,8 @@ export class SkyvernClient {
"x-api-key": _options?.apiKey,
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@skyvern/client",
"X-Fern-SDK-Version": "1.0.13",
"User-Agent": "@skyvern/client/1.0.13",
"X-Fern-SDK-Version": "1.0.14",
"User-Agent": "@skyvern/client/1.0.14",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
@@ -1102,6 +1102,139 @@ export class SkyvernClient {
}
}
/**
* List workflow runs across all workflows for the current organization.
*
* Results are paginated and can be filtered by **status**, **search_key**, and **error_code**. All filters are combined with **AND** logic — a run must match every supplied filter to be returned.
*
* ### search_key
*
* A case-insensitive substring search that matches against **any** of the following fields:
*
* | Searched field | Description |
* |---|---|
* | `workflow_run_id` | The unique run identifier (e.g. `wr_123…`) |
* | Parameter **key** | The `key` of any workflow parameter definition associated with the run |
* | Parameter **description** | The `description` of any workflow parameter definition |
* | Run parameter **value** | The actual value supplied for any parameter when the run was created |
* | `extra_http_headers` | Extra HTTP headers attached to the run (searched as raw JSON text) |
*
* Soft-deleted parameter definitions are excluded from key/description matching. A run is returned if **any** of the fields above contain the search term.
*
* ### error_code
*
* An **exact-match** filter against the `error_code` field inside each task's `errors` JSON array. A run matches if **any** of its tasks contains an error object with a matching `error_code` value. Error codes are user-defined strings set during workflow execution (e.g. `INVALID_CREDENTIALS`, `LOGIN_FAILED`, `CAPTCHA_DETECTED`).
*
* ### Combining filters
*
* All query parameters use AND logic:
* - `?status=failed` — only failed runs
* - `?status=failed&error_code=LOGIN_FAILED` — failed runs **and** have a LOGIN_FAILED error
* - `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match
*
* @param {Skyvern.GetWorkflowRunsRequest} request
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Skyvern.UnprocessableEntityError}
*
* @example
* await client.getWorkflowRuns({
* page: 1,
* page_size: 1,
* search_key: "search_key",
* error_code: "error_code"
* })
*/
public getWorkflowRuns(
request: Skyvern.GetWorkflowRunsRequest = {},
requestOptions?: SkyvernClient.RequestOptions,
): core.HttpResponsePromise<Skyvern.WorkflowRun[]> {
return core.HttpResponsePromise.fromPromise(this.__getWorkflowRuns(request, requestOptions));
}
private async __getWorkflowRuns(
request: Skyvern.GetWorkflowRunsRequest = {},
requestOptions?: SkyvernClient.RequestOptions,
): Promise<core.WithRawResponse<Skyvern.WorkflowRun[]>> {
const { page, page_size: pageSize, status, search_key: searchKey, error_code: errorCode } = request;
const _queryParams: Record<string, string | string[] | object | object[] | null> = {};
if (page != null) {
_queryParams.page = page.toString();
}
if (pageSize != null) {
_queryParams.page_size = pageSize.toString();
}
if (status != null) {
if (Array.isArray(status)) {
_queryParams.status = status.map((item) => item);
} else {
_queryParams.status = status;
}
}
if (searchKey != null) {
_queryParams.search_key = searchKey;
}
if (errorCode != null) {
_queryParams.error_code = errorCode;
}
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)) ??
environments.SkyvernEnvironment.Cloud,
"v1/workflows/runs",
),
method: "GET",
headers: _headers,
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return { data: _response.body as Skyvern.WorkflowRun[], rawResponse: _response.rawResponse };
}
if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 422:
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
default:
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}
}
switch (_response.error.reason) {
case "non-json":
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.SkyvernTimeoutError("Timeout exceeded when calling GET /v1/workflows/runs.");
case "unknown":
throw new errors.SkyvernError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}
/**
* @param {string} workflowPermanentId
* @param {Skyvern.GetWorkflowRequest} request
@@ -2271,6 +2404,96 @@ export class SkyvernClient {
}
}
/**
* Overwrites the stored credential data (e.g. username/password) while keeping the same credential_id.
*
* @param {string} credentialId - The unique identifier of the credential to update
* @param {Skyvern.CreateCredentialRequest} request
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Skyvern.UnprocessableEntityError}
*
* @example
* await client.updateCredential("cred_1234567890", {
* name: "My Credential",
* credential_type: "password",
* credential: {
* password: "newpassword123",
* username: "user@example.com"
* }
* })
*/
public updateCredential(
credentialId: string,
request: Skyvern.CreateCredentialRequest,
requestOptions?: SkyvernClient.RequestOptions,
): core.HttpResponsePromise<Skyvern.CredentialResponse> {
return core.HttpResponsePromise.fromPromise(this.__updateCredential(credentialId, request, requestOptions));
}
private async __updateCredential(
credentialId: string,
request: Skyvern.CreateCredentialRequest,
requestOptions?: SkyvernClient.RequestOptions,
): Promise<core.WithRawResponse<Skyvern.CredentialResponse>> {
const _headers: core.Fetcher.Args["headers"] = mergeHeaders(
this._options?.headers,
mergeOnlyDefinedHeaders({ "x-api-key": requestOptions?.apiKey ?? this._options?.apiKey }),
requestOptions?.headers,
);
const _response = await core.fetcher({
url: core.url.join(
(await core.Supplier.get(this._options.baseUrl)) ??
(await core.Supplier.get(this._options.environment)) ??
environments.SkyvernEnvironment.Cloud,
`v1/credentials/${core.url.encodePathParam(credentialId)}/update`,
),
method: "POST",
headers: _headers,
contentType: "application/json",
queryParameters: requestOptions?.queryParams,
requestType: "json",
body: request,
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return { data: _response.body as Skyvern.CredentialResponse, rawResponse: _response.rawResponse };
}
if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 422:
throw new Skyvern.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse);
default:
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.body,
rawResponse: _response.rawResponse,
});
}
}
switch (_response.error.reason) {
case "non-json":
throw new errors.SkyvernError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
rawResponse: _response.rawResponse,
});
case "timeout":
throw new errors.SkyvernTimeoutError(
"Timeout exceeded when calling POST /v1/credentials/{credential_id}/update.",
);
case "unknown":
throw new errors.SkyvernError({
message: _response.error.errorMessage,
rawResponse: _response.rawResponse,
});
}
}
/**
* Deletes a specific credential by its ID
*

View File

@@ -0,0 +1,25 @@
// This file was auto-generated by Fern from our API Definition.
import type * as Skyvern from "../../index.js";
/**
* @example
* {
* page: 1,
* page_size: 1,
* search_key: "search_key",
* error_code: "error_code"
* }
*/
export interface GetWorkflowRunsRequest {
/** Page number for pagination. */
page?: number;
/** Number of runs to return per page. */
page_size?: number;
/** Filter by one or more run statuses. */
status?: Skyvern.WorkflowRunStatus | Skyvern.WorkflowRunStatus[];
/** Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, and extra HTTP headers. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching. */
search_key?: string;
/** Exact-match filter on the error_code field inside each task's errors JSON array. A run matches if any of its tasks contains an error with a matching error_code. Error codes are user-defined strings set during workflow execution. */
error_code?: string;
}

View File

@@ -22,9 +22,9 @@ export interface GetWorkflowsRequest {
only_saved_tasks?: boolean;
only_workflows?: boolean;
only_templates?: boolean;
/** Unified search across workflow title, folder name, and parameter metadata (key, description, default_value). */
/** Case-insensitive substring search across: workflow title, folder name, and parameter metadata (key, description, default_value). A workflow is returned if any of these fields match. Soft-deleted parameter definitions are excluded. Takes precedence over the deprecated `title` parameter. */
search_key?: string;
/** Deprecated: use search_key instead. */
/** Deprecated: use search_key instead. Falls back to title-only search if search_key is not provided. */
title?: string;
/** Filter workflows by folder ID */
folder_id?: string;

View File

@@ -3,7 +3,6 @@ export type { ChangeTierRequest } from "./ChangeTierRequest.js";
export type { CheckoutSubscriptionRequest } from "./CheckoutSubscriptionRequest.js";
export type { CreateBrowserProfileRequest } from "./CreateBrowserProfileRequest.js";
export type { CreateBrowserSessionRequest } from "./CreateBrowserSessionRequest.js";
export type { CreateCredentialRequest } from "./CreateCredentialRequest.js";
export type { CreateScriptRequest } from "./CreateScriptRequest.js";
export type { CreateWorkflowRequest } from "./CreateWorkflowRequest.js";
export type { DeployScriptRequest } from "./DeployScriptRequest.js";
@@ -12,6 +11,7 @@ export type { GetCredentialsRequest } from "./GetCredentialsRequest.js";
export type { GetRunArtifactsRequest } from "./GetRunArtifactsRequest.js";
export type { GetScriptsRequest } from "./GetScriptsRequest.js";
export type { GetWorkflowRequest } from "./GetWorkflowRequest.js";
export type { GetWorkflowRunsRequest } from "./GetWorkflowRunsRequest.js";
export type { GetWorkflowsRequest } from "./GetWorkflowsRequest.js";
export type { GetWorkflowVersionsRequest } from "./GetWorkflowVersionsRequest.js";
export type { ListBrowserProfilesRequest } from "./ListBrowserProfilesRequest.js";

View File

@@ -40,6 +40,7 @@ export interface Action {
click_context?: Skyvern.ClickContext;
totp_timing_info?: Record<string, unknown>;
has_mini_agent?: boolean;
skip_auto_complete_tab?: boolean;
created_at?: string;
modified_at?: string;
created_by?: string;

View File

@@ -1,18 +1,9 @@
// This file was auto-generated by Fern from our API Definition.
import type * as Skyvern from "../../index.js";
import type * as Skyvern from "../index.js";
/**
* @example
* {
* name: "My Credential",
* credential_type: "password",
* credential: {
* password: "securepassword123",
* username: "user@example.com",
* totp: "JBSWY3DPEHPK3PXP"
* }
* }
* Request model for creating a new credential.
*/
export interface CreateCredentialRequest {
/** Name of the credential */

View File

@@ -5,5 +5,6 @@ export const FileType = {
Excel: "excel",
Pdf: "pdf",
Image: "image",
Docx: "docx",
} as const;
export type FileType = (typeof FileType)[keyof typeof FileType];

View File

@@ -4,6 +4,8 @@ export interface ValidationError {
loc: ValidationError.Loc.Item[];
msg: string;
type: string;
input?: unknown;
ctx?: Record<string, unknown>;
}
export namespace ValidationError {

View File

@@ -0,0 +1,41 @@
// This file was auto-generated by Fern from our API Definition.
import type * as Skyvern from "../index.js";
export interface WorkflowRun {
workflow_run_id: string;
workflow_id: string;
workflow_permanent_id: string;
organization_id: string;
browser_session_id?: string;
browser_profile_id?: string;
debug_session_id?: string;
status: Skyvern.WorkflowRunStatus;
extra_http_headers?: Record<string, string | undefined>;
proxy_location?: WorkflowRun.ProxyLocation;
webhook_callback_url?: string;
webhook_failure_reason?: string;
totp_verification_url?: string;
totp_identifier?: string;
failure_reason?: string;
parent_workflow_run_id?: string;
workflow_title?: string;
max_screenshot_scrolls?: number;
browser_address?: string;
run_with?: string;
script_run?: Skyvern.ScriptRunResponse;
job_id?: string;
depends_on_workflow_run_id?: string;
sequential_key?: string;
ai_fallback?: boolean;
code_gen?: boolean;
queued_at?: string;
started_at?: string;
finished_at?: string;
created_at: string;
modified_at: string;
}
export namespace WorkflowRun {
export type ProxyLocation = Skyvern.ProxyLocation | Skyvern.GeoTarget | Record<string, unknown>;
}

View File

@@ -0,0 +1,14 @@
// This file was auto-generated by Fern from our API Definition.
export const WorkflowRunStatus = {
Created: "created",
Queued: "queued",
Running: "running",
Failed: "failed",
Terminated: "terminated",
Canceled: "canceled",
TimedOut: "timed_out",
Completed: "completed",
Paused: "paused",
} as const;
export type WorkflowRunStatus = (typeof WorkflowRunStatus)[keyof typeof WorkflowRunStatus];

View File

@@ -38,6 +38,7 @@ export * from "./ConditionalBlockYaml.js";
export * from "./ContextParameter.js";
export * from "./ContextParameterSource.js";
export * from "./ContextParameterYaml.js";
export * from "./CreateCredentialRequest.js";
export * from "./CreateScriptResponse.js";
export * from "./CredentialParameter.js";
export * from "./CredentialParameterYaml.js";
@@ -166,9 +167,11 @@ export * from "./WorkflowParameter.js";
export * from "./WorkflowParameterType.js";
export * from "./WorkflowParameterYaml.js";
export * from "./WorkflowRequest.js";
export * from "./WorkflowRun.js";
export * from "./WorkflowRunBlock.js";
export * from "./WorkflowRunRequest.js";
export * from "./WorkflowRunResponse.js";
export * from "./WorkflowRunStatus.js";
export * from "./WorkflowRunTimeline.js";
export * from "./WorkflowRunTimelineType.js";
export * from "./WorkflowStatus.js";

View File

@@ -1 +1 @@
export const SDK_VERSION = "1.0.13";
export const SDK_VERSION = "1.0.14";