notte-sdk 1.9.5 → 1.9.7
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/dist/index.d.mts +337 -158
- package/dist/index.d.ts +337 -158
- package/dist/index.js +67 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -24
- package/dist/index.mjs.map +1 -1
- package/dist/proxy/core.js +5 -5
- package/dist/proxy/core.js.map +1 -1
- package/dist/proxy/core.mjs +5 -5
- package/dist/proxy/core.mjs.map +1 -1
- package/dist/proxy/next.js +5 -5
- package/dist/proxy/next.js.map +1 -1
- package/dist/proxy/next.mjs +5 -5
- package/dist/proxy/next.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SDK_VERSION = true ? "1.9.
|
|
2
|
+
var SDK_VERSION = true ? "1.9.7" : "dev";
|
|
3
3
|
var SDK_PACKAGE_NAME = true ? "notte-sdk" : "notte-sdk";
|
|
4
4
|
|
|
5
5
|
// src/version-check.ts
|
|
@@ -961,6 +961,15 @@ var sessionProfilePreview = (options) => (options.client ?? client).get({
|
|
|
961
961
|
url: "/sessions/{session_id}/profile-preview",
|
|
962
962
|
...options
|
|
963
963
|
});
|
|
964
|
+
var sessionProfileSave = (options) => (options.client ?? client).post({
|
|
965
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
966
|
+
url: "/sessions/{session_id}/profile/save",
|
|
967
|
+
...options,
|
|
968
|
+
headers: {
|
|
969
|
+
"Content-Type": "application/json",
|
|
970
|
+
...options.headers
|
|
971
|
+
}
|
|
972
|
+
});
|
|
964
973
|
var getSessionScript = (options) => (options.client ?? client).get({
|
|
965
974
|
security: [{ scheme: "bearer", type: "http" }],
|
|
966
975
|
url: "/sessions/{session_id}/workflow/code",
|
|
@@ -1486,24 +1495,6 @@ var connectLinkSubmit = (options) => (options.client ?? client).post({
|
|
|
1486
1495
|
}
|
|
1487
1496
|
});
|
|
1488
1497
|
var connectLinkStatus = (options) => (options.client ?? client).get({ url: "/managed-auth/connect-links/status", ...options });
|
|
1489
|
-
var improvePrompt = (options) => (options.client ?? client).post({
|
|
1490
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1491
|
-
url: "/prompts/improve",
|
|
1492
|
-
...options,
|
|
1493
|
-
headers: {
|
|
1494
|
-
"Content-Type": "application/json",
|
|
1495
|
-
...options.headers
|
|
1496
|
-
}
|
|
1497
|
-
});
|
|
1498
|
-
var nudgePrompt = (options) => (options.client ?? client).post({
|
|
1499
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1500
|
-
url: "/prompts/nudge",
|
|
1501
|
-
...options,
|
|
1502
|
-
headers: {
|
|
1503
|
-
"Content-Type": "application/json",
|
|
1504
|
-
...options.headers
|
|
1505
|
-
}
|
|
1506
|
-
});
|
|
1507
1498
|
var getUsage = (options) => (options?.client ?? client).get({
|
|
1508
1499
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1509
1500
|
url: "/usage",
|
|
@@ -1547,6 +1538,11 @@ var deleteSecret = (options) => (options.client ?? client).delete({
|
|
|
1547
1538
|
url: "/secrets/{secret_id}",
|
|
1548
1539
|
...options
|
|
1549
1540
|
});
|
|
1541
|
+
var listAuditEvents = (options) => (options?.client ?? client).get({
|
|
1542
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1543
|
+
url: "/audit-events",
|
|
1544
|
+
...options
|
|
1545
|
+
});
|
|
1550
1546
|
var healthCheck = (options) => (options?.client ?? client).get({ url: "/health", ...options });
|
|
1551
1547
|
var readyCheck = (options) => (options?.client ?? client).get({ url: "/ready", ...options });
|
|
1552
1548
|
var scrapeWebpage = (options) => (options.client ?? client).post({
|
|
@@ -1849,8 +1845,8 @@ function createResources(client2, getApiKey) {
|
|
|
1849
1845
|
return response.data;
|
|
1850
1846
|
},
|
|
1851
1847
|
/** sessionDebugInfo: /sessions/{session_id}/debug. Returns the API response body. */
|
|
1852
|
-
debugInfo: async (sessionId,
|
|
1853
|
-
const response = await sessionDebugInfo({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId }
|
|
1848
|
+
debugInfo: async (sessionId, requestOptions = {}) => {
|
|
1849
|
+
const response = await sessionDebugInfo({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId } });
|
|
1854
1850
|
return response.data;
|
|
1855
1851
|
},
|
|
1856
1852
|
/** deleteSessionFile: /sessions/{session_id}/files/{file_id}. Returns the API response body. */
|
|
@@ -1913,6 +1909,11 @@ function createResources(client2, getApiKey) {
|
|
|
1913
1909
|
const response = await sessionProfilePreview({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId }, query });
|
|
1914
1910
|
return response.data;
|
|
1915
1911
|
},
|
|
1912
|
+
/** sessionProfileSave: /sessions/{session_id}/profile/save. Returns the API response body. */
|
|
1913
|
+
profileSave: async (sessionId, body, requestOptions = {}) => {
|
|
1914
|
+
const response = await sessionProfileSave({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId }, body });
|
|
1915
|
+
return response.data;
|
|
1916
|
+
},
|
|
1916
1917
|
/** sessionReplay: /sessions/{session_id}/replay. Returns the API response body. */
|
|
1917
1918
|
replay: async (sessionId, requestOptions = {}) => {
|
|
1918
1919
|
const response = await sessionReplay({ client: client2, throwOnError: true, signal: requestOptions.signal, headers: { ...requestOptions.headers }, path: { "session_id": sessionId } });
|
|
@@ -3208,6 +3209,44 @@ var Session = class {
|
|
|
3208
3209
|
return response.data.cookies;
|
|
3209
3210
|
}
|
|
3210
3211
|
// #######################################################################
|
|
3212
|
+
// ############################# Profiles ################################
|
|
3213
|
+
// #######################################################################
|
|
3214
|
+
/**
|
|
3215
|
+
* Save the session's current browser state (cookies, localStorage, sessionStorage) into a
|
|
3216
|
+
* profile, without stopping the session.
|
|
3217
|
+
*
|
|
3218
|
+
* Pass `profile_id` to overwrite an existing profile or `name` to create a new one. With
|
|
3219
|
+
* neither, the state is saved into the profile the session was started with. The session's
|
|
3220
|
+
* start-time profile settings are not changed, so a session started with `persist: true`
|
|
3221
|
+
* still saves again when it stops.
|
|
3222
|
+
*
|
|
3223
|
+
* @example
|
|
3224
|
+
* const profile = await session.saveProfile({ name: 'github' });
|
|
3225
|
+
* // later: client.Session({ profile: { id: profile.profile_id } })
|
|
3226
|
+
*/
|
|
3227
|
+
async saveProfile(options = {}) {
|
|
3228
|
+
const { profile_id, name } = options;
|
|
3229
|
+
if (profile_id !== void 0 && name !== void 0) {
|
|
3230
|
+
throw new Error("profile_id and name are mutually exclusive");
|
|
3231
|
+
}
|
|
3232
|
+
if (profile_id !== void 0 && profile_id.trim() === "") {
|
|
3233
|
+
throw new Error("profile_id must not be empty");
|
|
3234
|
+
}
|
|
3235
|
+
if (name !== void 0 && name.trim() === "") {
|
|
3236
|
+
throw new Error("name must not be empty");
|
|
3237
|
+
}
|
|
3238
|
+
const body = {};
|
|
3239
|
+
if (profile_id !== void 0) body.profile_id = profile_id;
|
|
3240
|
+
if (name !== void 0) body.name = name;
|
|
3241
|
+
const response = await sessionProfileSave({
|
|
3242
|
+
client: this.client.getClient(),
|
|
3243
|
+
path: { session_id: this.requireSessionId() },
|
|
3244
|
+
body,
|
|
3245
|
+
throwOnError: true
|
|
3246
|
+
});
|
|
3247
|
+
return response.data;
|
|
3248
|
+
}
|
|
3249
|
+
// #######################################################################
|
|
3211
3250
|
// ############################# Debug / CDP #############################
|
|
3212
3251
|
// #######################################################################
|
|
3213
3252
|
/** Detailed debug information for the session (debug URL, websocket URLs, tabs). */
|
|
@@ -3284,7 +3323,9 @@ var Session = class {
|
|
|
3284
3323
|
try {
|
|
3285
3324
|
if (!this.playwrightBrowser) {
|
|
3286
3325
|
const cdpUrl = await this.cdpUrl();
|
|
3287
|
-
this.playwrightBrowser = await playwright.chromium.connectOverCDP(cdpUrl)
|
|
3326
|
+
this.playwrightBrowser = this.options.cdp_url ? await playwright.chromium.connectOverCDP(cdpUrl) : await playwright.chromium.connectOverCDP(cdpUrl, {
|
|
3327
|
+
headers: { "x-notte-request-origin": REQUEST_ORIGIN, "x-notte-sdk-version": SDK_VERSION }
|
|
3328
|
+
});
|
|
3288
3329
|
installServerOwnedDialogPolicy(this.playwrightBrowser);
|
|
3289
3330
|
}
|
|
3290
3331
|
const page = this.playwrightBrowser.contexts()[0]?.pages()[0];
|
|
@@ -6322,11 +6363,11 @@ export {
|
|
|
6322
6363
|
getUsage,
|
|
6323
6364
|
getUsageLogs,
|
|
6324
6365
|
healthCheck,
|
|
6325
|
-
improvePrompt,
|
|
6326
6366
|
installServerOwnedDialogPolicy,
|
|
6327
6367
|
isCaptchaSolveAction,
|
|
6328
6368
|
isValidMfaSecret,
|
|
6329
6369
|
listAgents,
|
|
6370
|
+
listAuditEvents,
|
|
6330
6371
|
listFunctionRunsByFunctionId,
|
|
6331
6372
|
listFunctions,
|
|
6332
6373
|
listPersonas,
|
|
@@ -6341,7 +6382,6 @@ export {
|
|
|
6341
6382
|
mailboxSync,
|
|
6342
6383
|
mailboxUpdate,
|
|
6343
6384
|
managedAuthConnectLinkCreate,
|
|
6344
|
-
nudgePrompt,
|
|
6345
6385
|
observeServerOwnedDialog,
|
|
6346
6386
|
pageExecute,
|
|
6347
6387
|
pageObserve,
|
|
@@ -6379,6 +6419,7 @@ export {
|
|
|
6379
6419
|
sessionNetworkLogs,
|
|
6380
6420
|
sessionOffset,
|
|
6381
6421
|
sessionProfilePreview,
|
|
6422
|
+
sessionProfileSave,
|
|
6382
6423
|
sessionReplay,
|
|
6383
6424
|
sessionStart,
|
|
6384
6425
|
sessionStatus,
|