@skyvern/client 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/cjs/Client.d.ts +17 -1
- package/dist/cjs/Client.js +80 -6
- package/dist/cjs/api/client/requests/BodyUploadFileV1UploadFilePost.d.ts +10 -0
- package/dist/cjs/api/client/requests/BodyUploadFileV1UploadFilePost.js +3 -0
- package/dist/cjs/api/client/requests/GetWorkflowsRequest.d.ts +2 -0
- package/dist/cjs/api/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/Action.d.ts +1 -0
- package/dist/cjs/api/types/Artifact.d.ts +1 -0
- package/dist/cjs/api/types/PromptAction.d.ts +1 -1
- package/dist/cjs/api/types/RetryRunWebhookRequest.d.ts +4 -0
- package/dist/cjs/api/types/RetryRunWebhookRequest.js +3 -0
- package/dist/cjs/api/types/UploadFileResponse.d.ts +6 -0
- package/dist/cjs/api/types/UploadFileResponse.js +3 -0
- package/dist/cjs/api/types/Workflow.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +2 -0
- package/dist/cjs/api/types/index.js +2 -0
- package/dist/cjs/core/exports.d.ts +1 -0
- package/dist/cjs/core/exports.js +17 -0
- package/dist/cjs/core/file/exports.d.ts +1 -0
- package/dist/cjs/core/file/exports.js +2 -0
- package/dist/cjs/core/file/file.d.ts +10 -0
- package/dist/cjs/core/file/file.js +221 -0
- package/dist/cjs/core/file/index.d.ts +2 -0
- package/dist/cjs/core/file/index.js +18 -0
- package/dist/cjs/core/file/types.d.ts +66 -0
- package/dist/cjs/core/file/types.js +2 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.d.ts +15 -0
- package/dist/cjs/core/form-data-utils/FormDataWrapper.js +185 -0
- package/dist/cjs/core/form-data-utils/encodeAsFormParameter.d.ts +1 -0
- package/dist/cjs/core/form-data-utils/encodeAsFormParameter.js +12 -0
- package/dist/cjs/core/form-data-utils/index.d.ts +2 -0
- package/dist/cjs/core/form-data-utils/index.js +20 -0
- package/dist/cjs/core/index.d.ts +2 -0
- package/dist/cjs/core/index.js +3 -1
- package/dist/cjs/exports.d.ts +1 -0
- package/dist/cjs/exports.js +17 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/library/Skyvern.js +21 -3
- package/dist/cjs/library/SkyvernBrowserPage.d.ts +85 -2
- package/dist/cjs/library/SkyvernBrowserPage.js +131 -18
- package/dist/cjs/library/SkyvernBrowserPageAgent.d.ts +68 -20
- package/dist/cjs/library/SkyvernBrowserPageAgent.js +20 -33
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +17 -1
- package/dist/esm/Client.mjs +80 -6
- package/dist/esm/api/client/requests/BodyUploadFileV1UploadFilePost.d.mts +10 -0
- package/dist/esm/api/client/requests/BodyUploadFileV1UploadFilePost.mjs +2 -0
- package/dist/esm/api/client/requests/GetWorkflowsRequest.d.mts +2 -0
- package/dist/esm/api/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/Action.d.mts +1 -0
- package/dist/esm/api/types/Artifact.d.mts +1 -0
- package/dist/esm/api/types/PromptAction.d.mts +1 -1
- package/dist/esm/api/types/RetryRunWebhookRequest.d.mts +4 -0
- package/dist/esm/api/types/RetryRunWebhookRequest.mjs +2 -0
- package/dist/esm/api/types/UploadFileResponse.d.mts +6 -0
- package/dist/esm/api/types/UploadFileResponse.mjs +2 -0
- package/dist/esm/api/types/Workflow.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +2 -0
- package/dist/esm/api/types/index.mjs +2 -0
- package/dist/esm/core/exports.d.mts +1 -0
- package/dist/esm/core/exports.mjs +1 -0
- package/dist/esm/core/file/exports.d.mts +1 -0
- package/dist/esm/core/file/exports.mjs +1 -0
- package/dist/esm/core/file/file.d.mts +10 -0
- package/dist/esm/core/file/file.mjs +184 -0
- package/dist/esm/core/file/index.d.mts +2 -0
- package/dist/esm/core/file/index.mjs +2 -0
- package/dist/esm/core/file/types.d.mts +66 -0
- package/dist/esm/core/file/types.mjs +1 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.d.mts +15 -0
- package/dist/esm/core/form-data-utils/FormDataWrapper.mjs +147 -0
- package/dist/esm/core/form-data-utils/encodeAsFormParameter.d.mts +1 -0
- package/dist/esm/core/form-data-utils/encodeAsFormParameter.mjs +9 -0
- package/dist/esm/core/form-data-utils/index.d.mts +2 -0
- package/dist/esm/core/form-data-utils/index.mjs +2 -0
- package/dist/esm/core/index.d.mts +2 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/exports.d.mts +1 -0
- package/dist/esm/exports.mjs +1 -0
- package/dist/esm/index.d.mts +1 -0
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/library/Skyvern.mjs +21 -3
- package/dist/esm/library/SkyvernBrowserPage.d.mts +85 -2
- package/dist/esm/library/SkyvernBrowserPage.mjs +131 -18
- package/dist/esm/library/SkyvernBrowserPageAgent.d.mts +68 -20
- package/dist/esm/library/SkyvernBrowserPageAgent.mjs +20 -33
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
|
@@ -73,55 +73,168 @@ class SkyvernBrowserPageCore {
|
|
|
73
73
|
}
|
|
74
74
|
click(selectorOrOptions, options) {
|
|
75
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
let selector;
|
|
77
|
+
let prompt;
|
|
78
|
+
let clickOptions = {};
|
|
79
|
+
let timeout;
|
|
80
|
+
// Parse arguments
|
|
76
81
|
if (typeof selectorOrOptions === "string") {
|
|
77
|
-
|
|
82
|
+
selector = selectorOrOptions;
|
|
83
|
+
if (options && typeof options === "object") {
|
|
84
|
+
const _a = options, { prompt: p, timeout: t } = _a, rest = __rest(_a, ["prompt", "timeout"]);
|
|
85
|
+
prompt = p;
|
|
86
|
+
timeout = t;
|
|
87
|
+
clickOptions = rest;
|
|
88
|
+
}
|
|
89
|
+
else if (options) {
|
|
90
|
+
clickOptions = options;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else if (selectorOrOptions && typeof selectorOrOptions === "object") {
|
|
94
|
+
const { prompt: p, timeout: t } = selectorOrOptions, rest = __rest(selectorOrOptions, ["prompt", "timeout"]);
|
|
95
|
+
prompt = p;
|
|
96
|
+
timeout = t;
|
|
97
|
+
clickOptions = rest;
|
|
78
98
|
}
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
if (!selector && !prompt) {
|
|
100
|
+
throw new Error("Missing input: pass a selector and/or a prompt.");
|
|
101
|
+
}
|
|
102
|
+
// Try to click the element with the original selector first
|
|
103
|
+
let errorToRaise;
|
|
104
|
+
if (selector) {
|
|
105
|
+
try {
|
|
106
|
+
yield this._page.click(selector, Object.assign(Object.assign({}, clickOptions), { timeout }));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
errorToRaise = error;
|
|
111
|
+
selector = undefined;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// If the original selector doesn't work, try to click the element with the AI generated selector
|
|
115
|
+
if (prompt) {
|
|
81
116
|
yield this._ai.aiClick({
|
|
82
117
|
intention: prompt,
|
|
118
|
+
data: Object.keys(clickOptions).length > 0 ? clickOptions : undefined,
|
|
83
119
|
timeout,
|
|
84
|
-
data: Object.keys(data).length > 0 ? data : undefined,
|
|
85
120
|
});
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (errorToRaise) {
|
|
124
|
+
throw errorToRaise;
|
|
86
125
|
}
|
|
87
126
|
});
|
|
88
127
|
}
|
|
89
128
|
fill(selectorOrOptions, value, options) {
|
|
90
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
let selector;
|
|
131
|
+
let fillValue;
|
|
132
|
+
let prompt;
|
|
133
|
+
let fillOptions = {};
|
|
134
|
+
let timeout;
|
|
91
135
|
if (typeof selectorOrOptions === "string") {
|
|
92
|
-
|
|
93
|
-
|
|
136
|
+
selector = selectorOrOptions;
|
|
137
|
+
fillValue = value;
|
|
138
|
+
if (options && typeof options === "object") {
|
|
139
|
+
const _a = options, { prompt: p, timeout: t } = _a, rest = __rest(_a, ["prompt", "timeout"]);
|
|
140
|
+
prompt = p;
|
|
141
|
+
timeout = t;
|
|
142
|
+
fillOptions = rest;
|
|
143
|
+
}
|
|
144
|
+
else if (options) {
|
|
145
|
+
fillOptions = options;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (selectorOrOptions && typeof selectorOrOptions === "object") {
|
|
149
|
+
const { prompt: p, value: v, timeout: t } = selectorOrOptions, rest = __rest(selectorOrOptions, ["prompt", "value", "timeout"]);
|
|
150
|
+
prompt = p;
|
|
151
|
+
fillValue = v;
|
|
152
|
+
timeout = t;
|
|
153
|
+
fillOptions = rest;
|
|
154
|
+
}
|
|
155
|
+
if (!selector && !prompt) {
|
|
156
|
+
throw new Error("Missing input: pass a selector and/or a prompt.");
|
|
157
|
+
}
|
|
158
|
+
let errorToRaise;
|
|
159
|
+
if (selector && fillValue !== undefined) {
|
|
160
|
+
try {
|
|
161
|
+
yield this._page.fill(selector, fillValue, Object.assign(Object.assign({}, fillOptions), { timeout }));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
errorToRaise = error;
|
|
166
|
+
selector = undefined;
|
|
94
167
|
}
|
|
95
|
-
return this._page.fill(selectorOrOptions, value, options);
|
|
96
168
|
}
|
|
97
|
-
|
|
98
|
-
const { prompt, value: fillValue, timeout } = selectorOrOptions, data = __rest(selectorOrOptions, ["prompt", "value", "timeout"]);
|
|
169
|
+
if (prompt) {
|
|
99
170
|
yield this._ai.aiInputText({
|
|
100
171
|
value: fillValue,
|
|
101
172
|
intention: prompt,
|
|
173
|
+
data: Object.keys(fillOptions).length > 0 ? fillOptions : undefined,
|
|
102
174
|
timeout,
|
|
103
|
-
data: Object.keys(data).length > 0 ? data : undefined,
|
|
104
175
|
});
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (errorToRaise) {
|
|
179
|
+
throw errorToRaise;
|
|
105
180
|
}
|
|
106
181
|
});
|
|
107
182
|
}
|
|
108
183
|
selectOption(selectorOrOptions, values, options) {
|
|
109
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
let selector;
|
|
186
|
+
let selectValue;
|
|
187
|
+
let prompt;
|
|
188
|
+
let selectOptions = {};
|
|
189
|
+
let timeout;
|
|
190
|
+
// Parse arguments
|
|
110
191
|
if (typeof selectorOrOptions === "string") {
|
|
111
|
-
|
|
112
|
-
|
|
192
|
+
selector = selectorOrOptions;
|
|
193
|
+
selectValue = values;
|
|
194
|
+
if (options && typeof options === "object") {
|
|
195
|
+
const _a = options, { prompt: p, timeout: t } = _a, rest = __rest(_a, ["prompt", "timeout"]);
|
|
196
|
+
prompt = p;
|
|
197
|
+
timeout = t;
|
|
198
|
+
selectOptions = rest;
|
|
199
|
+
}
|
|
200
|
+
else if (options) {
|
|
201
|
+
selectOptions = options;
|
|
113
202
|
}
|
|
114
|
-
return this._page.selectOption(selectorOrOptions, values, options);
|
|
115
203
|
}
|
|
116
|
-
else {
|
|
117
|
-
const { prompt, value, timeout } = selectorOrOptions,
|
|
204
|
+
else if (selectorOrOptions && typeof selectorOrOptions === "object") {
|
|
205
|
+
const { prompt: p, value: v, timeout: t } = selectorOrOptions, rest = __rest(selectorOrOptions, ["prompt", "value", "timeout"]);
|
|
206
|
+
prompt = p;
|
|
207
|
+
selectValue = v;
|
|
208
|
+
timeout = t;
|
|
209
|
+
selectOptions = rest;
|
|
210
|
+
}
|
|
211
|
+
if (!selector && !prompt) {
|
|
212
|
+
throw new Error("Missing input: pass a selector and/or a prompt.");
|
|
213
|
+
}
|
|
214
|
+
// Try to select the option with the original selector first
|
|
215
|
+
let errorToRaise;
|
|
216
|
+
if (selector && selectValue !== undefined) {
|
|
217
|
+
try {
|
|
218
|
+
yield this._page.selectOption(selector, selectValue, Object.assign(Object.assign({}, selectOptions), { timeout }));
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
errorToRaise = error;
|
|
223
|
+
selector = undefined;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// If the original selector doesn't work, try to select the option with AI
|
|
227
|
+
if (prompt) {
|
|
118
228
|
yield this._ai.aiSelectOption({
|
|
119
|
-
value,
|
|
229
|
+
value: typeof selectValue === "string" ? selectValue : selectValue === null || selectValue === void 0 ? void 0 : selectValue[0],
|
|
120
230
|
intention: prompt,
|
|
231
|
+
data: Object.keys(selectOptions).length > 0 ? selectOptions : undefined,
|
|
121
232
|
timeout,
|
|
122
|
-
data: Object.keys(data).length > 0 ? data : undefined,
|
|
123
233
|
});
|
|
124
|
-
return
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (errorToRaise) {
|
|
237
|
+
throw errorToRaise;
|
|
125
238
|
}
|
|
126
239
|
});
|
|
127
240
|
}
|
|
@@ -47,30 +47,78 @@ export declare class SkyvernBrowserPageAgent {
|
|
|
47
47
|
/**
|
|
48
48
|
* Run a login task in the context of this page and wait for it to finish.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
* @param options - Optional configuration
|
|
52
|
-
* @param options.url - URL to navigate to for login. If not provided, uses the current page URL.
|
|
53
|
-
* @param options.credentialId - ID of the credential to use.
|
|
54
|
-
* @param options.bitwardenCollectionId - Bitwarden collection ID containing the credentials.
|
|
55
|
-
* @param options.bitwardenItemId - Bitwarden item ID for the credentials.
|
|
56
|
-
* @param options.onepasswordVaultId - 1Password vault ID containing the credentials.
|
|
57
|
-
* @param options.onepasswordItemId - 1Password item ID for the credentials.
|
|
58
|
-
* @param options.prompt - Additional instructions for the login process.
|
|
59
|
-
* @param options.webhookUrl - URL to receive webhook notifications about login progress.
|
|
60
|
-
* @param options.totpIdentifier - Identifier for TOTP authentication.
|
|
61
|
-
* @param options.totpUrl - URL to fetch TOTP codes from.
|
|
62
|
-
* @param options.extraHttpHeaders - Additional HTTP headers to include in requests.
|
|
63
|
-
* @param options.timeout - Maximum time in seconds to wait for login completion.
|
|
50
|
+
* This method has multiple overloaded signatures for different credential types:
|
|
64
51
|
*
|
|
65
|
-
*
|
|
52
|
+
* 1. Skyvern credentials:
|
|
53
|
+
* ```typescript
|
|
54
|
+
* await page.agent.login("skyvern", {
|
|
55
|
+
* credentialId: "cred_123"
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* 2. Bitwarden credentials:
|
|
60
|
+
* ```typescript
|
|
61
|
+
* await page.agent.login("bitwarden", {
|
|
62
|
+
* bitwardenItemId: "item_id",
|
|
63
|
+
* bitwardenCollectionId: "collection_id"
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* 3. 1Password credentials:
|
|
68
|
+
* ```typescript
|
|
69
|
+
* await page.agent.login("1password", {
|
|
70
|
+
* onepasswordVaultId: "vault_id",
|
|
71
|
+
* onepasswordItemId: "item_id"
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* 4. Azure Vault credentials:
|
|
76
|
+
* ```typescript
|
|
77
|
+
* await page.agent.login("azure_vault", {
|
|
78
|
+
* azureVaultName: "vault_name",
|
|
79
|
+
* azureVaultUsernameKey: "username_key",
|
|
80
|
+
* azureVaultPasswordKey: "password_key",
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
66
83
|
*/
|
|
67
|
-
login(credentialType:
|
|
84
|
+
login(credentialType: "skyvern", options: {
|
|
85
|
+
credentialId: string;
|
|
68
86
|
url?: string;
|
|
69
|
-
|
|
87
|
+
prompt?: string;
|
|
88
|
+
webhookUrl?: string;
|
|
89
|
+
totpIdentifier?: string;
|
|
90
|
+
totpUrl?: string;
|
|
91
|
+
extraHttpHeaders?: Record<string, string>;
|
|
92
|
+
timeout?: number;
|
|
93
|
+
}): Promise<Skyvern.WorkflowRunResponse>;
|
|
94
|
+
login(credentialType: "bitwarden", options: {
|
|
95
|
+
bitwardenItemId: string;
|
|
70
96
|
bitwardenCollectionId?: string;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
97
|
+
url?: string;
|
|
98
|
+
prompt?: string;
|
|
99
|
+
webhookUrl?: string;
|
|
100
|
+
totpIdentifier?: string;
|
|
101
|
+
totpUrl?: string;
|
|
102
|
+
extraHttpHeaders?: Record<string, string>;
|
|
103
|
+
timeout?: number;
|
|
104
|
+
}): Promise<Skyvern.WorkflowRunResponse>;
|
|
105
|
+
login(credentialType: "1password", options: {
|
|
106
|
+
onepasswordVaultId: string;
|
|
107
|
+
onepasswordItemId: string;
|
|
108
|
+
url?: string;
|
|
109
|
+
prompt?: string;
|
|
110
|
+
webhookUrl?: string;
|
|
111
|
+
totpIdentifier?: string;
|
|
112
|
+
totpUrl?: string;
|
|
113
|
+
extraHttpHeaders?: Record<string, string>;
|
|
114
|
+
timeout?: number;
|
|
115
|
+
}): Promise<Skyvern.WorkflowRunResponse>;
|
|
116
|
+
login(credentialType: "azure_vault", options: {
|
|
117
|
+
azureVaultName: string;
|
|
118
|
+
azureVaultUsernameKey: string;
|
|
119
|
+
azureVaultPasswordKey: string;
|
|
120
|
+
azureVaultTotpSecretKey?: string;
|
|
121
|
+
url?: string;
|
|
74
122
|
prompt?: string;
|
|
75
123
|
webhookUrl?: string;
|
|
76
124
|
totpIdentifier?: string;
|
|
@@ -80,55 +80,42 @@ class SkyvernBrowserPageAgent {
|
|
|
80
80
|
return completedRun;
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Run a login task in the context of this page and wait for it to finish.
|
|
85
|
-
*
|
|
86
|
-
* @param credentialType - Type of credential store to use (e.g., skyvern, bitwarden, onepassword).
|
|
87
|
-
* @param options - Optional configuration
|
|
88
|
-
* @param options.url - URL to navigate to for login. If not provided, uses the current page URL.
|
|
89
|
-
* @param options.credentialId - ID of the credential to use.
|
|
90
|
-
* @param options.bitwardenCollectionId - Bitwarden collection ID containing the credentials.
|
|
91
|
-
* @param options.bitwardenItemId - Bitwarden item ID for the credentials.
|
|
92
|
-
* @param options.onepasswordVaultId - 1Password vault ID containing the credentials.
|
|
93
|
-
* @param options.onepasswordItemId - 1Password item ID for the credentials.
|
|
94
|
-
* @param options.prompt - Additional instructions for the login process.
|
|
95
|
-
* @param options.webhookUrl - URL to receive webhook notifications about login progress.
|
|
96
|
-
* @param options.totpIdentifier - Identifier for TOTP authentication.
|
|
97
|
-
* @param options.totpUrl - URL to fetch TOTP codes from.
|
|
98
|
-
* @param options.extraHttpHeaders - Additional HTTP headers to include in requests.
|
|
99
|
-
* @param options.timeout - Maximum time in seconds to wait for login completion.
|
|
100
|
-
*
|
|
101
|
-
* @returns WorkflowRunResponse containing the login workflow execution results.
|
|
102
|
-
*/
|
|
103
83
|
login(credentialType, options) {
|
|
104
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
85
|
var _a, _b;
|
|
106
86
|
logger_js_1.LOG.info("Starting AI login workflow", { credential_type: credentialType });
|
|
107
87
|
const workflowRun = yield this._browser.skyvern.login({
|
|
108
88
|
credential_type: credentialType,
|
|
109
|
-
url: (_a = options
|
|
110
|
-
credential_id: options
|
|
111
|
-
bitwarden_collection_id: options
|
|
112
|
-
bitwarden_item_id: options
|
|
113
|
-
onepassword_vault_id: options
|
|
114
|
-
onepassword_item_id: options
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
89
|
+
url: (_a = options.url) !== null && _a !== void 0 ? _a : this._getPageUrl(),
|
|
90
|
+
credential_id: options.credentialId,
|
|
91
|
+
bitwarden_collection_id: options.bitwardenCollectionId,
|
|
92
|
+
bitwarden_item_id: options.bitwardenItemId,
|
|
93
|
+
onepassword_vault_id: options.onepasswordVaultId,
|
|
94
|
+
onepassword_item_id: options.onepasswordItemId,
|
|
95
|
+
azure_vault_name: options.azureVaultName,
|
|
96
|
+
azure_vault_username_key: options.azureVaultUsernameKey,
|
|
97
|
+
azure_vault_password_key: options.azureVaultPasswordKey,
|
|
98
|
+
azure_vault_totp_secret_key: options.azureVaultTotpSecretKey,
|
|
99
|
+
prompt: options.prompt,
|
|
100
|
+
webhook_url: options.webhookUrl,
|
|
101
|
+
totp_identifier: options.totpIdentifier,
|
|
102
|
+
totp_url: options.totpUrl,
|
|
119
103
|
browser_session_id: this._browser.browserSessionId,
|
|
120
104
|
browser_address: this._browser.browserAddress,
|
|
121
|
-
extra_http_headers: options
|
|
105
|
+
extra_http_headers: options.extraHttpHeaders,
|
|
122
106
|
}, {
|
|
123
107
|
headers: { "x-user-agent": "skyvern-sdk" },
|
|
124
108
|
});
|
|
125
109
|
if (this._browser.skyvern.environment === environments_js_1.SkyvernEnvironment.Cloud) {
|
|
126
|
-
logger_js_1.LOG.info("AI login workflow is running, this may take a while", {
|
|
110
|
+
logger_js_1.LOG.info("AI login workflow is running, this may take a while", {
|
|
111
|
+
url: getAppUrlForRun(workflowRun.run_id),
|
|
112
|
+
run_id: workflowRun.run_id,
|
|
113
|
+
});
|
|
127
114
|
}
|
|
128
115
|
else {
|
|
129
116
|
logger_js_1.LOG.info("AI login workflow is running, this may take a while", { run_id: workflowRun.run_id });
|
|
130
117
|
}
|
|
131
|
-
const completedRun = yield this._waitForRunCompletion(workflowRun.run_id, (_b = options
|
|
118
|
+
const completedRun = yield this._waitForRunCompletion(workflowRun.run_id, (_b = options.timeout) !== null && _b !== void 0 ? _b : constants_js_1.DEFAULT_AGENT_TIMEOUT);
|
|
132
119
|
logger_js_1.LOG.info("AI login workflow finished", { run_id: completedRun.run_id, status: completedRun.status });
|
|
133
120
|
return completedRun;
|
|
134
121
|
});
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.6";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.d.mts
CHANGED
|
@@ -101,6 +101,7 @@ export declare class SkyvernClient {
|
|
|
101
101
|
* page_size: 1,
|
|
102
102
|
* only_saved_tasks: true,
|
|
103
103
|
* only_workflows: true,
|
|
104
|
+
* only_templates: true,
|
|
104
105
|
* search_key: "search_key",
|
|
105
106
|
* title: "title",
|
|
106
107
|
* folder_id: "folder_id",
|
|
@@ -184,6 +185,7 @@ export declare class SkyvernClient {
|
|
|
184
185
|
* Retry sending the webhook for a run
|
|
185
186
|
*
|
|
186
187
|
* @param {string} runId - The id of the task run or the workflow run.
|
|
188
|
+
* @param {Skyvern.RetryRunWebhookRequest} request
|
|
187
189
|
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
188
190
|
*
|
|
189
191
|
* @throws {@link Skyvern.UnprocessableEntityError}
|
|
@@ -191,7 +193,7 @@ export declare class SkyvernClient {
|
|
|
191
193
|
* @example
|
|
192
194
|
* await client.retryRunWebhook("tsk_123")
|
|
193
195
|
*/
|
|
194
|
-
retryRunWebhook(runId: string, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
196
|
+
retryRunWebhook(runId: string, request?: Skyvern.RetryRunWebhookRequest, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
195
197
|
private __retryRunWebhook;
|
|
196
198
|
/**
|
|
197
199
|
* Get timeline for a run (workflow run or task_v2 run)
|
|
@@ -208,6 +210,20 @@ export declare class SkyvernClient {
|
|
|
208
210
|
*/
|
|
209
211
|
getRunTimeline(runId: string, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<Skyvern.WorkflowRunTimeline[]>;
|
|
210
212
|
private __getRunTimeline;
|
|
213
|
+
/**
|
|
214
|
+
* @param {Skyvern.BodyUploadFileV1UploadFilePost} request
|
|
215
|
+
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
216
|
+
*
|
|
217
|
+
* @throws {@link Skyvern.UnprocessableEntityError}
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* import { createReadStream } from "fs";
|
|
221
|
+
* await client.uploadFile({
|
|
222
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
223
|
+
* })
|
|
224
|
+
*/
|
|
225
|
+
uploadFile(request: Skyvern.BodyUploadFileV1UploadFilePost, requestOptions?: SkyvernClient.RequestOptions): core.HttpResponsePromise<Skyvern.UploadFileResponse>;
|
|
226
|
+
private __uploadFile;
|
|
211
227
|
/**
|
|
212
228
|
* Get all browser profiles for the organization
|
|
213
229
|
*
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -20,8 +20,8 @@ export class SkyvernClient {
|
|
|
20
20
|
"x-api-key": _options === null || _options === void 0 ? void 0 : _options.apiKey,
|
|
21
21
|
"X-Fern-Language": "JavaScript",
|
|
22
22
|
"X-Fern-SDK-Name": "@skyvern/client",
|
|
23
|
-
"X-Fern-SDK-Version": "1.0.
|
|
24
|
-
"User-Agent": "@skyvern/client/1.0.
|
|
23
|
+
"X-Fern-SDK-Version": "1.0.6",
|
|
24
|
+
"User-Agent": "@skyvern/client/1.0.6",
|
|
25
25
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
26
26
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
27
27
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -327,6 +327,7 @@ export class SkyvernClient {
|
|
|
327
327
|
* page_size: 1,
|
|
328
328
|
* only_saved_tasks: true,
|
|
329
329
|
* only_workflows: true,
|
|
330
|
+
* only_templates: true,
|
|
330
331
|
* search_key: "search_key",
|
|
331
332
|
* title: "title",
|
|
332
333
|
* folder_id: "folder_id",
|
|
@@ -339,7 +340,7 @@ export class SkyvernClient {
|
|
|
339
340
|
__getWorkflows() {
|
|
340
341
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
341
342
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
342
|
-
const { page, page_size: pageSize, only_saved_tasks: onlySavedTasks, only_workflows: onlyWorkflows, search_key: searchKey, title, folder_id: folderId, status, template, } = request;
|
|
343
|
+
const { page, page_size: pageSize, only_saved_tasks: onlySavedTasks, only_workflows: onlyWorkflows, only_templates: onlyTemplates, search_key: searchKey, title, folder_id: folderId, status, template, } = request;
|
|
343
344
|
const _queryParams = {};
|
|
344
345
|
if (page != null) {
|
|
345
346
|
_queryParams.page = page.toString();
|
|
@@ -353,6 +354,9 @@ export class SkyvernClient {
|
|
|
353
354
|
if (onlyWorkflows != null) {
|
|
354
355
|
_queryParams.only_workflows = onlyWorkflows.toString();
|
|
355
356
|
}
|
|
357
|
+
if (onlyTemplates != null) {
|
|
358
|
+
_queryParams.only_templates = onlyTemplates.toString();
|
|
359
|
+
}
|
|
356
360
|
if (searchKey != null) {
|
|
357
361
|
_queryParams.search_key = searchKey;
|
|
358
362
|
}
|
|
@@ -743,6 +747,7 @@ export class SkyvernClient {
|
|
|
743
747
|
* Retry sending the webhook for a run
|
|
744
748
|
*
|
|
745
749
|
* @param {string} runId - The id of the task run or the workflow run.
|
|
750
|
+
* @param {Skyvern.RetryRunWebhookRequest} request
|
|
746
751
|
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
747
752
|
*
|
|
748
753
|
* @throws {@link Skyvern.UnprocessableEntityError}
|
|
@@ -750,10 +755,10 @@ export class SkyvernClient {
|
|
|
750
755
|
* @example
|
|
751
756
|
* await client.retryRunWebhook("tsk_123")
|
|
752
757
|
*/
|
|
753
|
-
retryRunWebhook(runId, requestOptions) {
|
|
754
|
-
return core.HttpResponsePromise.fromPromise(this.__retryRunWebhook(runId, requestOptions));
|
|
758
|
+
retryRunWebhook(runId, request, requestOptions) {
|
|
759
|
+
return core.HttpResponsePromise.fromPromise(this.__retryRunWebhook(runId, request, requestOptions));
|
|
755
760
|
}
|
|
756
|
-
__retryRunWebhook(runId, requestOptions) {
|
|
761
|
+
__retryRunWebhook(runId, request, requestOptions) {
|
|
757
762
|
return __awaiter(this, void 0, void 0, function* () {
|
|
758
763
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
759
764
|
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -761,7 +766,10 @@ export class SkyvernClient {
|
|
|
761
766
|
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SkyvernEnvironment.Cloud, `v1/runs/${core.url.encodePathParam(runId)}/retry_webhook`),
|
|
762
767
|
method: "POST",
|
|
763
768
|
headers: _headers,
|
|
769
|
+
contentType: "application/json",
|
|
764
770
|
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
771
|
+
requestType: "json",
|
|
772
|
+
body: request != null ? request : undefined,
|
|
765
773
|
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
766
774
|
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
767
775
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
@@ -863,6 +871,72 @@ export class SkyvernClient {
|
|
|
863
871
|
}
|
|
864
872
|
});
|
|
865
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* @param {Skyvern.BodyUploadFileV1UploadFilePost} request
|
|
876
|
+
* @param {SkyvernClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
877
|
+
*
|
|
878
|
+
* @throws {@link Skyvern.UnprocessableEntityError}
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* import { createReadStream } from "fs";
|
|
882
|
+
* await client.uploadFile({
|
|
883
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
884
|
+
* })
|
|
885
|
+
*/
|
|
886
|
+
uploadFile(request, requestOptions) {
|
|
887
|
+
return core.HttpResponsePromise.fromPromise(this.__uploadFile(request, requestOptions));
|
|
888
|
+
}
|
|
889
|
+
__uploadFile(request, requestOptions) {
|
|
890
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
891
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
892
|
+
const _request = yield core.newFormData();
|
|
893
|
+
yield _request.appendFile("file", request.file);
|
|
894
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
895
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({ "x-api-key": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.apiKey) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.apiKey }, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
896
|
+
const _response = yield core.fetcher({
|
|
897
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.SkyvernEnvironment.Cloud, "v1/upload_file"),
|
|
898
|
+
method: "POST",
|
|
899
|
+
headers: _headers,
|
|
900
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
901
|
+
requestType: "file",
|
|
902
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
903
|
+
body: _maybeEncodedRequest.body,
|
|
904
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000,
|
|
905
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
906
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
907
|
+
});
|
|
908
|
+
if (_response.ok) {
|
|
909
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
910
|
+
}
|
|
911
|
+
if (_response.error.reason === "status-code") {
|
|
912
|
+
switch (_response.error.statusCode) {
|
|
913
|
+
case 422:
|
|
914
|
+
throw new Skyvern.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
915
|
+
default:
|
|
916
|
+
throw new errors.SkyvernError({
|
|
917
|
+
statusCode: _response.error.statusCode,
|
|
918
|
+
body: _response.error.body,
|
|
919
|
+
rawResponse: _response.rawResponse,
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
switch (_response.error.reason) {
|
|
924
|
+
case "non-json":
|
|
925
|
+
throw new errors.SkyvernError({
|
|
926
|
+
statusCode: _response.error.statusCode,
|
|
927
|
+
body: _response.error.rawBody,
|
|
928
|
+
rawResponse: _response.rawResponse,
|
|
929
|
+
});
|
|
930
|
+
case "timeout":
|
|
931
|
+
throw new errors.SkyvernTimeoutError("Timeout exceeded when calling POST /v1/upload_file.");
|
|
932
|
+
case "unknown":
|
|
933
|
+
throw new errors.SkyvernError({
|
|
934
|
+
message: _response.error.errorMessage,
|
|
935
|
+
rawResponse: _response.rawResponse,
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
}
|
|
866
940
|
/**
|
|
867
941
|
* Get all browser profiles for the organization
|
|
868
942
|
*
|
|
@@ -6,6 +6,7 @@ import type * as Skyvern from "../../index.mjs";
|
|
|
6
6
|
* page_size: 1,
|
|
7
7
|
* only_saved_tasks: true,
|
|
8
8
|
* only_workflows: true,
|
|
9
|
+
* only_templates: true,
|
|
9
10
|
* search_key: "search_key",
|
|
10
11
|
* title: "title",
|
|
11
12
|
* folder_id: "folder_id",
|
|
@@ -17,6 +18,7 @@ export interface GetWorkflowsRequest {
|
|
|
17
18
|
page_size?: number;
|
|
18
19
|
only_saved_tasks?: boolean;
|
|
19
20
|
only_workflows?: boolean;
|
|
21
|
+
only_templates?: boolean;
|
|
20
22
|
/** Unified search across workflow title, folder name, and parameter metadata (key, description, default_value). */
|
|
21
23
|
search_key?: string;
|
|
22
24
|
/** Deprecated: use search_key instead. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { BodyUploadFileV1UploadFilePost } from "./BodyUploadFileV1UploadFilePost.mjs";
|
|
1
2
|
export type { CreateBrowserProfileRequest } from "./CreateBrowserProfileRequest.mjs";
|
|
2
3
|
export type { CreateBrowserSessionRequest } from "./CreateBrowserSessionRequest.mjs";
|
|
3
4
|
export type { CreateCredentialRequest } from "./CreateCredentialRequest.mjs";
|
|
@@ -5,7 +5,7 @@ export interface PromptAction {
|
|
|
5
5
|
/** The prompt to send to the LLM */
|
|
6
6
|
prompt: string;
|
|
7
7
|
/** Optional JSON schema to structure the response */
|
|
8
|
-
|
|
8
|
+
response_schema?: Record<string, unknown>;
|
|
9
9
|
/** Optional model configuration */
|
|
10
10
|
model?: Record<string, unknown>;
|
|
11
11
|
}
|